1 /******************************************************************************
3 * Copyright(c) 2007 - 2017 Realtek Corporation.
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.
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
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
22 * Larry Finger <Larry.Finger@lwfinger.net>
24 *****************************************************************************/
26 /* ************************************************************
28 * ************************************************************
30 #include "mp_precomp.h"
31 #include "phydm_precomp.h"
34 odm_check_power_status(void *dm_void)
36 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
37 struct dm_struct *dm = (struct dm_struct *)dm_void;
38 PADAPTER *adapter = dm->adapter;
40 RT_RF_POWER_STATE rt_state;
41 MGNT_INFO *mgnt_info = &((PADAPTER)adapter)->MgntInfo;
43 /* 2011/07/27 MH We are not testing ready~~!! We may fail to get correct value when init sequence. */
44 if (mgnt_info->init_adpt_in_progress == true) {
45 RF_DBG(dm, DBG_RF_INIT,
46 "check_pow_status Return true, due to initadapter\n");
51 * 2011/07/19 MH We can not execute tx pwoer tracking/ LLC calibrate or IQK.
53 ((PADAPTER)adapter)->HalFunc.GetHwRegHandler((PADAPTER)adapter, HW_VAR_RF_STATE, (u8 *)(&rt_state));
54 if (((PADAPTER)adapter)->bDriverStopped || ((PADAPTER)adapter)->bDriverIsGoingToPnpSetPowerSleep || rt_state == eRfOff) {
55 RF_DBG(dm, DBG_RF_INIT,
56 "check_pow_status Return false, due to %d/%d/%d\n",
57 ((PADAPTER)adapter)->bDriverStopped,
58 ((PADAPTER)adapter)->bDriverIsGoingToPnpSetPowerSleep,
66 #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
67 void halrf_update_pwr_track(void *dm_void, u8 rate)
69 struct dm_struct *dm = (struct dm_struct *)dm_void;
70 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
74 RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "Pwr Track Get rate=0x%x\n", rate);
78 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
79 #if DEV_BUS_TYPE == RT_PCI_INTERFACE
81 odm_schedule_work_item(&dm->ra_rpt_workitem);
83 if (dm->support_ic_type == ODM_RTL8821) {
84 #if (RTL8821A_SUPPORT == 1)
85 odm_tx_pwr_track_set_pwr8821a(dm, MIX_MODE, RF_PATH_A, 0);
87 } else if (dm->support_ic_type == ODM_RTL8812) {
88 for (path_idx = RF_PATH_A; path_idx < MAX_PATH_NUM_8812A; path_idx++) {
89 #if (RTL8812A_SUPPORT == 1)
90 odm_tx_pwr_track_set_pwr8812a(dm, MIX_MODE, path_idx, 0);
93 } else if (dm->support_ic_type == ODM_RTL8723B) {
94 #if (RTL8723B_SUPPORT == 1)
95 odm_tx_pwr_track_set_pwr_8723b(dm, MIX_MODE, RF_PATH_A, 0);
97 } else if (dm->support_ic_type == ODM_RTL8192E) {
98 for (path_idx = RF_PATH_A; path_idx < MAX_PATH_NUM_8192E; path_idx++) {
99 #if (RTL8192E_SUPPORT == 1)
100 odm_tx_pwr_track_set_pwr92_e(dm, MIX_MODE, path_idx, 0);
103 } else if (dm->support_ic_type == ODM_RTL8188E) {
104 #if (RTL8188E_SUPPORT == 1)
105 odm_tx_pwr_track_set_pwr88_e(dm, MIX_MODE, RF_PATH_A, 0);
110 odm_schedule_work_item(&dm->ra_rpt_workitem);
117 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
118 void halrf_update_init_rate_work_item_callback(
121 void *adapter = (void *)context;
122 HAL_DATA_TYPE *hal_data = GET_HAL_DATA(((PADAPTER)adapter));
123 struct dm_struct *dm = &hal_data->DM_OutSrc;
126 if (dm->support_ic_type == ODM_RTL8821) {
127 #if (RTL8821A_SUPPORT == 1)
128 odm_tx_pwr_track_set_pwr8821a(dm, MIX_MODE, RF_PATH_A, 0);
130 } else if (dm->support_ic_type == ODM_RTL8812) {
131 #if (RTL8812A_SUPPORT == 1)
132 /*Don't know how to include &c*/
133 for (p = RF_PATH_A; p < MAX_PATH_NUM_8812A; p++)
134 odm_tx_pwr_track_set_pwr8812a(dm, MIX_MODE, p, 0);
136 } else if (dm->support_ic_type == ODM_RTL8723B) {
137 #if (RTL8723B_SUPPORT == 1)
138 odm_tx_pwr_track_set_pwr_8723b(dm, MIX_MODE, RF_PATH_A, 0);
140 } else if (dm->support_ic_type == ODM_RTL8192E) {
141 #if (RTL8192E_SUPPORT == 1)
142 /*Don't know how to include &c*/
143 for (p = RF_PATH_A; p < MAX_PATH_NUM_8192E; p++)
144 odm_tx_pwr_track_set_pwr92_e(dm, MIX_MODE, p, 0);
146 } else if (dm->support_ic_type == ODM_RTL8188E) {
147 #if (RTL8188E_SUPPORT == 1)
148 odm_tx_pwr_track_set_pwr88_e(dm, MIX_MODE, RF_PATH_A, 0);