GNU Linux-libre 4.14.265-gnu1
[releases.git] / drivers / staging / rtlwifi / phydm / phydm_dynamictxpower.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2016  Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25
26 /* ************************************************************
27  * include files
28  * *************************************************************/
29 #include "mp_precomp.h"
30 #include "phydm_precomp.h"
31
32 void odm_dynamic_tx_power_init(void *dm_void)
33 {
34         struct phy_dm_struct *dm = (struct phy_dm_struct *)dm_void;
35
36         dm->last_dtp_lvl = tx_high_pwr_level_normal;
37         dm->dynamic_tx_high_power_lvl = tx_high_pwr_level_normal;
38         dm->tx_agc_ofdm_18_6 =
39                 odm_get_bb_reg(dm, 0xC24, MASKDWORD); /*TXAGC {18M 12M 9M 6M}*/
40 }
41
42 void odm_dynamic_tx_power_save_power_index(void *dm_void) {}
43
44 void odm_dynamic_tx_power_restore_power_index(void *dm_void) {}
45
46 void odm_dynamic_tx_power_write_power_index(void *dm_void, u8 value)
47 {
48         struct phy_dm_struct *dm = (struct phy_dm_struct *)dm_void;
49         u8 index;
50         u32 power_index_reg[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a};
51
52         for (index = 0; index < 6; index++)
53                 odm_write_1byte(dm, power_index_reg[index], value);
54 }
55
56 static void odm_dynamic_tx_power_nic_ce(void *dm_void) {}
57
58 void odm_dynamic_tx_power(void *dm_void)
59 {
60         /*  */
61         /* For AP/ADSL use struct rtl8192cd_priv* */
62         /* For CE/NIC use struct void* */
63         /*  */
64         struct phy_dm_struct *dm = (struct phy_dm_struct *)dm_void;
65
66         if (!(dm->support_ability & ODM_BB_DYNAMIC_TXPWR))
67                 return;
68         /* 2011/09/29 MH In HW integration first stage, we provide 4 different
69          * handle to operate at the same time.
70          * In the stage2/3, we need to prive universal interface and merge all
71          * HW dynamic mechanism.
72          */
73         switch (dm->support_platform) {
74         case ODM_WIN:
75                 odm_dynamic_tx_power_nic(dm);
76                 break;
77         case ODM_CE:
78                 odm_dynamic_tx_power_nic_ce(dm);
79                 break;
80         case ODM_AP:
81                 odm_dynamic_tx_power_ap(dm);
82                 break;
83         default:
84                 break;
85         }
86 }
87
88 void odm_dynamic_tx_power_nic(void *dm_void)
89 {
90         struct phy_dm_struct *dm = (struct phy_dm_struct *)dm_void;
91
92         if (!(dm->support_ability & ODM_BB_DYNAMIC_TXPWR))
93                 return;
94 }
95
96 void odm_dynamic_tx_power_ap(void *dm_void
97
98                              )
99 {
100 }
101
102 void odm_dynamic_tx_power_8821(void *dm_void, u8 *desc, u8 mac_id) {}