1 /******************************************************************************
3 * Copyright(c) 2009-2012 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 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
26 * Larry Finger <Larry.Finger@lwfinger.net>
28 *****************************************************************************/
37 #include "../rtl8192c/phy_common.h"
40 #include "../rtl8192c/dm_common.h"
41 #include "../rtl8192c/fw_common.h"
44 u32
rtl92cu_phy_query_rf_reg(struct ieee80211_hw
*hw
,
45 enum radio_path rfpath
, u32 regaddr
, u32 bitmask
)
47 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
48 u32 original_value
, readback_value
, bitshift
;
49 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
51 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
52 "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
53 regaddr
, rfpath
, bitmask
);
54 if (rtlphy
->rf_mode
!= RF_OP_BY_FW
) {
55 original_value
= _rtl92c_phy_rf_serial_read(hw
,
58 original_value
= _rtl92c_phy_fw_rf_serial_read(hw
,
61 bitshift
= _rtl92c_phy_calculate_bit_shift(bitmask
);
62 readback_value
= (original_value
& bitmask
) >> bitshift
;
63 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
64 "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
65 regaddr
, rfpath
, bitmask
, original_value
);
66 return readback_value
;
69 void rtl92cu_phy_set_rf_reg(struct ieee80211_hw
*hw
,
70 enum radio_path rfpath
,
71 u32 regaddr
, u32 bitmask
, u32 data
)
73 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
74 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
75 u32 original_value
, bitshift
;
77 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
78 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
79 regaddr
, bitmask
, data
, rfpath
);
80 if (rtlphy
->rf_mode
!= RF_OP_BY_FW
) {
81 if (bitmask
!= RFREG_OFFSET_MASK
) {
82 original_value
= _rtl92c_phy_rf_serial_read(hw
,
85 bitshift
= _rtl92c_phy_calculate_bit_shift(bitmask
);
87 ((original_value
& (~bitmask
)) |
90 _rtl92c_phy_rf_serial_write(hw
, rfpath
, regaddr
, data
);
92 if (bitmask
!= RFREG_OFFSET_MASK
) {
93 original_value
= _rtl92c_phy_fw_rf_serial_read(hw
,
96 bitshift
= _rtl92c_phy_calculate_bit_shift(bitmask
);
98 ((original_value
& (~bitmask
)) |
101 _rtl92c_phy_fw_rf_serial_write(hw
, rfpath
, regaddr
, data
);
103 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
104 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
105 regaddr
, bitmask
, data
, rfpath
);
108 bool rtl92cu_phy_mac_config(struct ieee80211_hw
*hw
)
111 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
112 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
113 bool is92c
= IS_92C_SERIAL(rtlhal
->version
);
115 rtstatus
= _rtl92cu_phy_config_mac_with_headerfile(hw
);
116 if (is92c
&& IS_HARDWARE_TYPE_8192CE(rtlhal
))
117 rtl_write_byte(rtlpriv
, 0x14, 0x71);
121 bool rtl92cu_phy_bb_config(struct ieee80211_hw
*hw
)
123 bool rtstatus
= true;
124 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
125 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
128 u8 b_reg_hwparafile
= 1;
130 _rtl92c_phy_init_bb_rf_register_definition(hw
);
131 regval
= rtl_read_word(rtlpriv
, REG_SYS_FUNC_EN
);
132 rtl_write_word(rtlpriv
, REG_SYS_FUNC_EN
, regval
| BIT(13) |
134 rtl_write_byte(rtlpriv
, REG_AFE_PLL_CTRL
, 0x83);
135 rtl_write_byte(rtlpriv
, REG_AFE_PLL_CTRL
+ 1, 0xdb);
136 rtl_write_byte(rtlpriv
, REG_RF_CTRL
, RF_EN
| RF_RSTB
| RF_SDMRSTB
);
137 if (IS_HARDWARE_TYPE_8192CE(rtlhal
)) {
138 rtl_write_byte(rtlpriv
, REG_SYS_FUNC_EN
, FEN_PPLL
| FEN_PCIEA
|
139 FEN_DIO_PCIE
| FEN_BB_GLB_RSTn
| FEN_BBRSTB
);
140 } else if (IS_HARDWARE_TYPE_8192CU(rtlhal
)) {
141 rtl_write_byte(rtlpriv
, REG_SYS_FUNC_EN
, FEN_USBA
| FEN_USBD
|
142 FEN_BB_GLB_RSTn
| FEN_BBRSTB
);
144 regval32
= rtl_read_dword(rtlpriv
, 0x87c);
145 rtl_write_dword(rtlpriv
, 0x87c, regval32
& (~BIT(31)));
146 if (IS_HARDWARE_TYPE_8192CU(rtlhal
))
147 rtl_write_byte(rtlpriv
, REG_LDOHCI12_CTRL
, 0x0f);
148 rtl_write_byte(rtlpriv
, REG_AFE_XTAL_CTRL
+ 1, 0x80);
149 if (b_reg_hwparafile
== 1)
150 rtstatus
= _rtl92c_phy_bb8192c_config_parafile(hw
);
154 bool _rtl92cu_phy_config_mac_with_headerfile(struct ieee80211_hw
*hw
)
156 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
157 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
162 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
, "Read Rtl819XMACPHY_Array\n");
163 arraylength
= rtlphy
->hwparam_tables
[MAC_REG
].length
;
164 ptrarray
= rtlphy
->hwparam_tables
[MAC_REG
].pdata
;
165 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
, "Img:RTL8192CEMAC_2T_ARRAY\n");
166 for (i
= 0; i
< arraylength
; i
= i
+ 2)
167 rtl_write_byte(rtlpriv
, ptrarray
[i
], (u8
) ptrarray
[i
+ 1]);
171 bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw
*hw
,
175 u32
*phy_regarray_table
;
176 u32
*agctab_array_table
;
177 u16 phy_reg_arraylen
, agctab_arraylen
;
178 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
179 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
180 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
182 if (IS_92C_SERIAL(rtlhal
->version
)) {
183 agctab_arraylen
= rtlphy
->hwparam_tables
[AGCTAB_2T
].length
;
184 agctab_array_table
= rtlphy
->hwparam_tables
[AGCTAB_2T
].pdata
;
185 phy_reg_arraylen
= rtlphy
->hwparam_tables
[PHY_REG_2T
].length
;
186 phy_regarray_table
= rtlphy
->hwparam_tables
[PHY_REG_2T
].pdata
;
188 agctab_arraylen
= rtlphy
->hwparam_tables
[AGCTAB_1T
].length
;
189 agctab_array_table
= rtlphy
->hwparam_tables
[AGCTAB_1T
].pdata
;
190 phy_reg_arraylen
= rtlphy
->hwparam_tables
[PHY_REG_1T
].length
;
191 phy_regarray_table
= rtlphy
->hwparam_tables
[PHY_REG_1T
].pdata
;
193 if (configtype
== BASEBAND_CONFIG_PHY_REG
) {
194 for (i
= 0; i
< phy_reg_arraylen
; i
= i
+ 2) {
195 rtl_addr_delay(phy_regarray_table
[i
]);
196 rtl_set_bbreg(hw
, phy_regarray_table
[i
], MASKDWORD
,
197 phy_regarray_table
[i
+ 1]);
199 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
,
200 "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
201 phy_regarray_table
[i
],
202 phy_regarray_table
[i
+ 1]);
204 } else if (configtype
== BASEBAND_CONFIG_AGC_TAB
) {
205 for (i
= 0; i
< agctab_arraylen
; i
= i
+ 2) {
206 rtl_set_bbreg(hw
, agctab_array_table
[i
], MASKDWORD
,
207 agctab_array_table
[i
+ 1]);
209 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
,
210 "The agctab_array_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
211 agctab_array_table
[i
],
212 agctab_array_table
[i
+ 1]);
218 bool _rtl92cu_phy_config_bb_with_pgheaderfile(struct ieee80211_hw
*hw
,
221 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
222 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
224 u32
*phy_regarray_table_pg
;
225 u16 phy_regarray_pg_len
;
227 rtlphy
->pwrgroup_cnt
= 0;
228 phy_regarray_pg_len
= rtlphy
->hwparam_tables
[PHY_REG_PG
].length
;
229 phy_regarray_table_pg
= rtlphy
->hwparam_tables
[PHY_REG_PG
].pdata
;
230 if (configtype
== BASEBAND_CONFIG_PHY_REG
) {
231 for (i
= 0; i
< phy_regarray_pg_len
; i
= i
+ 3) {
232 rtl_addr_delay(phy_regarray_table_pg
[i
]);
233 _rtl92c_store_pwrIndex_diffrate_offset(hw
,
234 phy_regarray_table_pg
[i
],
235 phy_regarray_table_pg
[i
+ 1],
236 phy_regarray_table_pg
[i
+ 2]);
239 RT_TRACE(rtlpriv
, COMP_SEND
, DBG_TRACE
,
240 "configtype != BaseBand_Config_PHY_REG\n");
245 bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw
*hw
,
246 enum radio_path rfpath
)
249 u32
*radioa_array_table
;
250 u32
*radiob_array_table
;
251 u16 radioa_arraylen
, radiob_arraylen
;
252 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
253 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
254 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
256 if (IS_92C_SERIAL(rtlhal
->version
)) {
257 radioa_arraylen
= rtlphy
->hwparam_tables
[RADIOA_2T
].length
;
258 radioa_array_table
= rtlphy
->hwparam_tables
[RADIOA_2T
].pdata
;
259 radiob_arraylen
= rtlphy
->hwparam_tables
[RADIOB_2T
].length
;
260 radiob_array_table
= rtlphy
->hwparam_tables
[RADIOB_2T
].pdata
;
261 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
,
262 "Radio_A:RTL8192CERADIOA_2TARRAY\n");
263 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
,
264 "Radio_B:RTL8192CE_RADIOB_2TARRAY\n");
266 radioa_arraylen
= rtlphy
->hwparam_tables
[RADIOA_1T
].length
;
267 radioa_array_table
= rtlphy
->hwparam_tables
[RADIOA_1T
].pdata
;
268 radiob_arraylen
= rtlphy
->hwparam_tables
[RADIOB_1T
].length
;
269 radiob_array_table
= rtlphy
->hwparam_tables
[RADIOB_1T
].pdata
;
270 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
,
271 "Radio_A:RTL8192CE_RADIOA_1TARRAY\n");
272 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
,
273 "Radio_B:RTL8192CE_RADIOB_1TARRAY\n");
275 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
, "Radio No %x\n", rfpath
);
278 for (i
= 0; i
< radioa_arraylen
; i
= i
+ 2) {
279 rtl_rfreg_delay(hw
, rfpath
, radioa_array_table
[i
],
281 radioa_array_table
[i
+ 1]);
285 for (i
= 0; i
< radiob_arraylen
; i
= i
+ 2) {
286 rtl_rfreg_delay(hw
, rfpath
, radiob_array_table
[i
],
288 radiob_array_table
[i
+ 1]);
292 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
293 "switch case not processed\n");
296 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
297 "switch case not processed\n");
305 void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw
*hw
)
307 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
308 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
309 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
310 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
314 RT_TRACE(rtlpriv
, COMP_SCAN
, DBG_TRACE
, "Switch to %s bandwidth\n",
315 rtlphy
->current_chan_bw
== HT_CHANNEL_WIDTH_20
?
317 if (is_hal_stop(rtlhal
)) {
318 rtlphy
->set_bwmode_inprogress
= false;
321 reg_bw_opmode
= rtl_read_byte(rtlpriv
, REG_BWOPMODE
);
322 reg_prsr_rsc
= rtl_read_byte(rtlpriv
, REG_RRSR
+ 2);
323 switch (rtlphy
->current_chan_bw
) {
324 case HT_CHANNEL_WIDTH_20
:
325 reg_bw_opmode
|= BW_OPMODE_20MHZ
;
326 rtl_write_byte(rtlpriv
, REG_BWOPMODE
, reg_bw_opmode
);
328 case HT_CHANNEL_WIDTH_20_40
:
329 reg_bw_opmode
&= ~BW_OPMODE_20MHZ
;
330 rtl_write_byte(rtlpriv
, REG_BWOPMODE
, reg_bw_opmode
);
332 (reg_prsr_rsc
& 0x90) | (mac
->cur_40_prime_sc
<< 5);
333 rtl_write_byte(rtlpriv
, REG_RRSR
+ 2, reg_prsr_rsc
);
336 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
337 "unknown bandwidth: %#X\n", rtlphy
->current_chan_bw
);
340 switch (rtlphy
->current_chan_bw
) {
341 case HT_CHANNEL_WIDTH_20
:
342 rtl_set_bbreg(hw
, RFPGA0_RFMOD
, BRFMOD
, 0x0);
343 rtl_set_bbreg(hw
, RFPGA1_RFMOD
, BRFMOD
, 0x0);
344 rtl_set_bbreg(hw
, RFPGA0_ANALOGPARAMETER2
, BIT(10), 1);
346 case HT_CHANNEL_WIDTH_20_40
:
347 rtl_set_bbreg(hw
, RFPGA0_RFMOD
, BRFMOD
, 0x1);
348 rtl_set_bbreg(hw
, RFPGA1_RFMOD
, BRFMOD
, 0x1);
349 rtl_set_bbreg(hw
, RCCK0_SYSTEM
, BCCK_SIDEBAND
,
350 (mac
->cur_40_prime_sc
>> 1));
351 rtl_set_bbreg(hw
, ROFDM1_LSTF
, 0xC00, mac
->cur_40_prime_sc
);
352 rtl_set_bbreg(hw
, RFPGA0_ANALOGPARAMETER2
, BIT(10), 0);
353 rtl_set_bbreg(hw
, 0x818, (BIT(26) | BIT(27)),
354 (mac
->cur_40_prime_sc
==
355 HAL_PRIME_CHNL_OFFSET_LOWER
) ? 2 : 1);
358 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
359 "unknown bandwidth: %#X\n", rtlphy
->current_chan_bw
);
362 rtl92cu_phy_rf6052_set_bandwidth(hw
, rtlphy
->current_chan_bw
);
363 rtlphy
->set_bwmode_inprogress
= false;
364 RT_TRACE(rtlpriv
, COMP_SCAN
, DBG_TRACE
, "<==\n");
367 void rtl92cu_bb_block_on(struct ieee80211_hw
*hw
)
369 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
371 mutex_lock(&rtlpriv
->io
.bb_mutex
);
372 rtl_set_bbreg(hw
, RFPGA0_RFMOD
, BCCKEN
, 0x1);
373 rtl_set_bbreg(hw
, RFPGA0_RFMOD
, BOFDMEN
, 0x1);
374 mutex_unlock(&rtlpriv
->io
.bb_mutex
);
377 void _rtl92cu_phy_lc_calibrate(struct ieee80211_hw
*hw
, bool is2t
)
380 u32 rf_a_mode
= 0, rf_b_mode
= 0, lc_cal
;
381 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
383 tmpreg
= rtl_read_byte(rtlpriv
, 0xd03);
385 if ((tmpreg
& 0x70) != 0)
386 rtl_write_byte(rtlpriv
, 0xd03, tmpreg
& 0x8F);
388 rtl_write_byte(rtlpriv
, REG_TXPAUSE
, 0xFF);
390 if ((tmpreg
& 0x70) != 0) {
391 rf_a_mode
= rtl_get_rfreg(hw
, RF90_PATH_A
, 0x00, MASK12BITS
);
393 rf_b_mode
= rtl_get_rfreg(hw
, RF90_PATH_B
, 0x00,
395 rtl_set_rfreg(hw
, RF90_PATH_A
, 0x00, MASK12BITS
,
396 (rf_a_mode
& 0x8FFFF) | 0x10000);
398 rtl_set_rfreg(hw
, RF90_PATH_B
, 0x00, MASK12BITS
,
399 (rf_b_mode
& 0x8FFFF) | 0x10000);
401 lc_cal
= rtl_get_rfreg(hw
, RF90_PATH_A
, 0x18, MASK12BITS
);
402 rtl_set_rfreg(hw
, RF90_PATH_A
, 0x18, MASK12BITS
, lc_cal
| 0x08000);
404 if ((tmpreg
& 0x70) != 0) {
405 rtl_write_byte(rtlpriv
, 0xd03, tmpreg
);
406 rtl_set_rfreg(hw
, RF90_PATH_A
, 0x00, MASK12BITS
, rf_a_mode
);
408 rtl_set_rfreg(hw
, RF90_PATH_B
, 0x00, MASK12BITS
,
411 rtl_write_byte(rtlpriv
, REG_TXPAUSE
, 0x00);
415 static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw
*hw
,
416 enum rf_pwrstate rfpwr_state
)
418 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
419 struct rtl_pci_priv
*pcipriv
= rtl_pcipriv(hw
);
420 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
421 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
424 struct rtl8192_tx_ring
*ring
= NULL
;
426 switch (rfpwr_state
) {
428 if ((ppsc
->rfpwr_state
== ERFOFF
) &&
429 RT_IN_PS_LEVEL(ppsc
, RT_RF_OFF_LEVL_HALT_NIC
)) {
431 u32 InitializeCount
= 0;
435 RT_TRACE(rtlpriv
, COMP_RF
, DBG_DMESG
,
436 "IPS Set eRf nic enable\n");
437 rtstatus
= rtl_ps_enable_nic(hw
);
438 } while (!rtstatus
&& (InitializeCount
< 10));
439 RT_CLEAR_PS_LEVEL(ppsc
,
440 RT_RF_OFF_LEVL_HALT_NIC
);
442 RT_TRACE(rtlpriv
, COMP_RF
, DBG_DMESG
,
443 "Set ERFON sleeped:%d ms\n",
444 jiffies_to_msecs(jiffies
-
445 ppsc
->last_sleep_jiffies
));
446 ppsc
->last_awake_jiffies
= jiffies
;
447 rtl92ce_phy_set_rf_on(hw
);
449 if (mac
->link_state
== MAC80211_LINKED
) {
450 rtlpriv
->cfg
->ops
->led_control(hw
,
453 rtlpriv
->cfg
->ops
->led_control(hw
,
458 for (queue_id
= 0, i
= 0;
459 queue_id
< RTL_PCI_MAX_TX_QUEUE_COUNT
;) {
460 ring
= &pcipriv
->dev
.tx_ring
[queue_id
];
461 if (skb_queue_len(&ring
->queue
) == 0 ||
462 queue_id
== BEACON_QUEUE
) {
466 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
467 "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
470 skb_queue_len(&ring
->queue
));
474 if (i
>= MAX_DOZE_WAITING_TIMES_9x
) {
475 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
476 "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n",
477 MAX_DOZE_WAITING_TIMES_9x
,
479 skb_queue_len(&ring
->queue
));
483 if (ppsc
->reg_rfps_level
& RT_RF_OFF_LEVL_HALT_NIC
) {
484 RT_TRACE(rtlpriv
, COMP_RF
, DBG_DMESG
,
485 "IPS Set eRf nic disable\n");
486 rtl_ps_disable_nic(hw
);
487 RT_SET_PS_LEVEL(ppsc
, RT_RF_OFF_LEVL_HALT_NIC
);
489 if (ppsc
->rfoff_reason
== RF_CHANGE_BY_IPS
) {
490 rtlpriv
->cfg
->ops
->led_control(hw
,
493 rtlpriv
->cfg
->ops
->led_control(hw
,
499 if (ppsc
->rfpwr_state
== ERFOFF
)
501 for (queue_id
= 0, i
= 0;
502 queue_id
< RTL_PCI_MAX_TX_QUEUE_COUNT
;) {
503 ring
= &pcipriv
->dev
.tx_ring
[queue_id
];
504 if (skb_queue_len(&ring
->queue
) == 0) {
508 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
509 "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
511 skb_queue_len(&ring
->queue
));
515 if (i
>= MAX_DOZE_WAITING_TIMES_9x
) {
516 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
517 "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n",
518 MAX_DOZE_WAITING_TIMES_9x
,
520 skb_queue_len(&ring
->queue
));
524 RT_TRACE(rtlpriv
, COMP_RF
, DBG_DMESG
,
525 "Set ERFSLEEP awaked:%d ms\n",
526 jiffies_to_msecs(jiffies
- ppsc
->last_awake_jiffies
));
527 ppsc
->last_sleep_jiffies
= jiffies
;
528 _rtl92c_phy_set_rf_sleep(hw
);
531 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
532 "switch case not processed\n");
537 ppsc
->rfpwr_state
= rfpwr_state
;
541 bool rtl92cu_phy_set_rf_power_state(struct ieee80211_hw
*hw
,
542 enum rf_pwrstate rfpwr_state
)
544 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
545 bool bresult
= false;
547 if (rfpwr_state
== ppsc
->rfpwr_state
)
549 bresult
= _rtl92cu_phy_set_rf_power_state(hw
, rfpwr_state
);