rf.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2012 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. * 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
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * wlanfae <wlanfae@realtek.com>
  23. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  24. * Hsinchu 300, Taiwan.
  25. *
  26. * Larry Finger <Larry.Finger@lwfinger.net>
  27. *
  28. *****************************************************************************/
  29. #include "../wifi.h"
  30. #include "reg.h"
  31. #include "def.h"
  32. #include "phy.h"
  33. #include "rf.h"
  34. #include "dm.h"
  35. static void _rtl92s_get_powerbase(struct ieee80211_hw *hw, u8 *p_pwrlevel,
  36. u8 chnl, u32 *ofdmbase, u32 *mcsbase,
  37. u8 *p_final_pwridx)
  38. {
  39. struct rtl_priv *rtlpriv = rtl_priv(hw);
  40. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  41. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  42. u32 pwrbase0, pwrbase1;
  43. u8 legacy_pwrdiff = 0, ht20_pwrdiff = 0;
  44. u8 i, pwrlevel[4];
  45. for (i = 0; i < 2; i++)
  46. pwrlevel[i] = p_pwrlevel[i];
  47. /* We only care about the path A for legacy. */
  48. if (rtlefuse->eeprom_version < 2) {
  49. pwrbase0 = pwrlevel[0] + (rtlefuse->legacy_httxpowerdiff & 0xf);
  50. } else if (rtlefuse->eeprom_version >= 2) {
  51. legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff
  52. [RF90_PATH_A][chnl - 1];
  53. /* For legacy OFDM, tx pwr always > HT OFDM pwr.
  54. * We do not care Path B
  55. * legacy OFDM pwr diff. NO BB register
  56. * to notify HW. */
  57. pwrbase0 = pwrlevel[0] + legacy_pwrdiff;
  58. }
  59. pwrbase0 = (pwrbase0 << 24) | (pwrbase0 << 16) | (pwrbase0 << 8) |
  60. pwrbase0;
  61. *ofdmbase = pwrbase0;
  62. /* MCS rates */
  63. if (rtlefuse->eeprom_version >= 2) {
  64. /* Check HT20 to HT40 diff */
  65. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) {
  66. for (i = 0; i < 2; i++) {
  67. /* rf-A, rf-B */
  68. /* HT 20<->40 pwr diff */
  69. ht20_pwrdiff = rtlefuse->txpwr_ht20diff
  70. [i][chnl - 1];
  71. if (ht20_pwrdiff < 8) /* 0~+7 */
  72. pwrlevel[i] += ht20_pwrdiff;
  73. else /* index8-15=-8~-1 */
  74. pwrlevel[i] -= (16 - ht20_pwrdiff);
  75. }
  76. }
  77. }
  78. /* use index of rf-A */
  79. pwrbase1 = pwrlevel[0];
  80. pwrbase1 = (pwrbase1 << 24) | (pwrbase1 << 16) | (pwrbase1 << 8) |
  81. pwrbase1;
  82. *mcsbase = pwrbase1;
  83. /* The following is for Antenna
  84. * diff from Ant-B to Ant-A */
  85. p_final_pwridx[0] = pwrlevel[0];
  86. p_final_pwridx[1] = pwrlevel[1];
  87. switch (rtlefuse->eeprom_regulatory) {
  88. case 3:
  89. /* The following is for calculation
  90. * of the power diff for Ant-B to Ant-A. */
  91. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  92. p_final_pwridx[0] += rtlefuse->pwrgroup_ht40
  93. [RF90_PATH_A][
  94. chnl - 1];
  95. p_final_pwridx[1] += rtlefuse->pwrgroup_ht40
  96. [RF90_PATH_B][
  97. chnl - 1];
  98. } else {
  99. p_final_pwridx[0] += rtlefuse->pwrgroup_ht20
  100. [RF90_PATH_A][
  101. chnl - 1];
  102. p_final_pwridx[1] += rtlefuse->pwrgroup_ht20
  103. [RF90_PATH_B][
  104. chnl - 1];
  105. }
  106. break;
  107. default:
  108. break;
  109. }
  110. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  111. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  112. "40MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n",
  113. p_final_pwridx[0], p_final_pwridx[1]);
  114. } else {
  115. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  116. "20MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n",
  117. p_final_pwridx[0], p_final_pwridx[1]);
  118. }
  119. }
  120. static void _rtl92s_set_antennadiff(struct ieee80211_hw *hw,
  121. u8 *p_final_pwridx)
  122. {
  123. struct rtl_priv *rtlpriv = rtl_priv(hw);
  124. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  125. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  126. char ant_pwr_diff = 0;
  127. u32 u4reg_val = 0;
  128. if (rtlphy->rf_type == RF_2T2R) {
  129. ant_pwr_diff = p_final_pwridx[1] - p_final_pwridx[0];
  130. /* range is from 7~-8,
  131. * index = 0x0~0xf */
  132. if (ant_pwr_diff > 7)
  133. ant_pwr_diff = 7;
  134. if (ant_pwr_diff < -8)
  135. ant_pwr_diff = -8;
  136. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  137. "Antenna Diff from RF-B to RF-A = %d (0x%x)\n",
  138. ant_pwr_diff, ant_pwr_diff & 0xf);
  139. ant_pwr_diff &= 0xf;
  140. }
  141. /* Antenna TX power difference */
  142. rtlefuse->antenna_txpwdiff[2] = 0;/* RF-D, don't care */
  143. rtlefuse->antenna_txpwdiff[1] = 0;/* RF-C, don't care */
  144. rtlefuse->antenna_txpwdiff[0] = (u8)(ant_pwr_diff); /* RF-B */
  145. u4reg_val = rtlefuse->antenna_txpwdiff[2] << 8 |
  146. rtlefuse->antenna_txpwdiff[1] << 4 |
  147. rtlefuse->antenna_txpwdiff[0];
  148. rtl_set_bbreg(hw, RFPGA0_TXGAINSTAGE, (BXBTXAGC | BXCTXAGC | BXDTXAGC),
  149. u4reg_val);
  150. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "Write BCD-Diff(0x%x) = 0x%x\n",
  151. RFPGA0_TXGAINSTAGE, u4reg_val);
  152. }
  153. static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
  154. u8 chnl, u8 index,
  155. u32 pwrbase0,
  156. u32 pwrbase1,
  157. u32 *p_outwrite_val)
  158. {
  159. struct rtl_priv *rtlpriv = rtl_priv(hw);
  160. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  161. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  162. u8 i, chnlgroup, pwrdiff_limit[4];
  163. u32 writeval, customer_limit;
  164. /* Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate */
  165. switch (rtlefuse->eeprom_regulatory) {
  166. case 0:
  167. /* Realtek better performance increase power diff
  168. * defined by Realtek for large power */
  169. chnlgroup = 0;
  170. writeval = rtlphy->mcs_txpwrlevel_origoffset
  171. [chnlgroup][index] +
  172. ((index < 2) ? pwrbase0 : pwrbase1);
  173. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  174. "RTK better performance, writeval = 0x%x\n", writeval);
  175. break;
  176. case 1:
  177. /* Realtek regulatory increase power diff defined
  178. * by Realtek for regulatory */
  179. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  180. writeval = ((index < 2) ? pwrbase0 : pwrbase1);
  181. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  182. "Realtek regulatory, 40MHz, writeval = 0x%x\n",
  183. writeval);
  184. } else {
  185. if (rtlphy->pwrgroup_cnt == 1)
  186. chnlgroup = 0;
  187. if (rtlphy->pwrgroup_cnt >= 3) {
  188. if (chnl <= 3)
  189. chnlgroup = 0;
  190. else if (chnl >= 4 && chnl <= 8)
  191. chnlgroup = 1;
  192. else if (chnl > 8)
  193. chnlgroup = 2;
  194. if (rtlphy->pwrgroup_cnt == 4)
  195. chnlgroup++;
  196. }
  197. writeval = rtlphy->mcs_txpwrlevel_origoffset
  198. [chnlgroup][index]
  199. + ((index < 2) ?
  200. pwrbase0 : pwrbase1);
  201. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  202. "Realtek regulatory, 20MHz, writeval = 0x%x\n",
  203. writeval);
  204. }
  205. break;
  206. case 2:
  207. /* Better regulatory don't increase any power diff */
  208. writeval = ((index < 2) ? pwrbase0 : pwrbase1);
  209. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  210. "Better regulatory, writeval = 0x%x\n", writeval);
  211. break;
  212. case 3:
  213. /* Customer defined power diff. increase power diff
  214. defined by customer. */
  215. chnlgroup = 0;
  216. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  217. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  218. "customer's limit, 40MHz = 0x%x\n",
  219. rtlefuse->pwrgroup_ht40
  220. [RF90_PATH_A][chnl - 1]);
  221. } else {
  222. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  223. "customer's limit, 20MHz = 0x%x\n",
  224. rtlefuse->pwrgroup_ht20
  225. [RF90_PATH_A][chnl - 1]);
  226. }
  227. for (i = 0; i < 4; i++) {
  228. pwrdiff_limit[i] =
  229. (u8)((rtlphy->mcs_txpwrlevel_origoffset
  230. [chnlgroup][index] & (0x7f << (i * 8)))
  231. >> (i * 8));
  232. if (rtlphy->current_chan_bw ==
  233. HT_CHANNEL_WIDTH_20_40) {
  234. if (pwrdiff_limit[i] >
  235. rtlefuse->pwrgroup_ht40
  236. [RF90_PATH_A][chnl - 1]) {
  237. pwrdiff_limit[i] =
  238. rtlefuse->pwrgroup_ht20
  239. [RF90_PATH_A][chnl - 1];
  240. }
  241. } else {
  242. if (pwrdiff_limit[i] >
  243. rtlefuse->pwrgroup_ht20
  244. [RF90_PATH_A][chnl - 1]) {
  245. pwrdiff_limit[i] =
  246. rtlefuse->pwrgroup_ht20
  247. [RF90_PATH_A][chnl - 1];
  248. }
  249. }
  250. }
  251. customer_limit = (pwrdiff_limit[3] << 24) |
  252. (pwrdiff_limit[2] << 16) |
  253. (pwrdiff_limit[1] << 8) |
  254. (pwrdiff_limit[0]);
  255. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  256. "Customer's limit = 0x%x\n", customer_limit);
  257. writeval = customer_limit + ((index < 2) ?
  258. pwrbase0 : pwrbase1);
  259. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  260. "Customer, writeval = 0x%x\n", writeval);
  261. break;
  262. default:
  263. chnlgroup = 0;
  264. writeval = rtlphy->mcs_txpwrlevel_origoffset[chnlgroup][index] +
  265. ((index < 2) ? pwrbase0 : pwrbase1);
  266. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  267. "RTK better performance, writeval = 0x%x\n", writeval);
  268. break;
  269. }
  270. if (rtlpriv->dm.dynamic_txhighpower_lvl == TX_HIGH_PWR_LEVEL_LEVEL1)
  271. writeval = 0x10101010;
  272. else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  273. TX_HIGH_PWR_LEVEL_LEVEL2)
  274. writeval = 0x0;
  275. *p_outwrite_val = writeval;
  276. }
  277. static void _rtl92s_write_ofdm_powerreg(struct ieee80211_hw *hw,
  278. u8 index, u32 val)
  279. {
  280. struct rtl_priv *rtlpriv = rtl_priv(hw);
  281. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  282. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  283. u16 regoffset[6] = {0xe00, 0xe04, 0xe10, 0xe14, 0xe18, 0xe1c};
  284. u8 i, rfa_pwr[4];
  285. u8 rfa_lower_bound = 0, rfa_upper_bound = 0, rf_pwr_diff = 0;
  286. u32 writeval = val;
  287. /* If path A and Path B coexist, we must limit Path A tx power.
  288. * Protect Path B pwr over or under flow. We need to calculate
  289. * upper and lower bound of path A tx power. */
  290. if (rtlphy->rf_type == RF_2T2R) {
  291. rf_pwr_diff = rtlefuse->antenna_txpwdiff[0];
  292. /* Diff=-8~-1 */
  293. if (rf_pwr_diff >= 8) {
  294. /* Prevent underflow!! */
  295. rfa_lower_bound = 0x10 - rf_pwr_diff;
  296. /* if (rf_pwr_diff >= 0) Diff = 0-7 */
  297. } else {
  298. rfa_upper_bound = RF6052_MAX_TX_PWR - rf_pwr_diff;
  299. }
  300. }
  301. for (i = 0; i < 4; i++) {
  302. rfa_pwr[i] = (u8)((writeval & (0x7f << (i * 8))) >> (i * 8));
  303. if (rfa_pwr[i] > RF6052_MAX_TX_PWR)
  304. rfa_pwr[i] = RF6052_MAX_TX_PWR;
  305. /* If path A and Path B coexist, we must limit Path A tx power.
  306. * Protect Path B pwr over or under flow. We need to calculate
  307. * upper and lower bound of path A tx power. */
  308. if (rtlphy->rf_type == RF_2T2R) {
  309. /* Diff=-8~-1 */
  310. if (rf_pwr_diff >= 8) {
  311. /* Prevent underflow!! */
  312. if (rfa_pwr[i] < rfa_lower_bound)
  313. rfa_pwr[i] = rfa_lower_bound;
  314. /* Diff = 0-7 */
  315. } else if (rf_pwr_diff >= 1) {
  316. /* Prevent overflow */
  317. if (rfa_pwr[i] > rfa_upper_bound)
  318. rfa_pwr[i] = rfa_upper_bound;
  319. }
  320. }
  321. }
  322. writeval = (rfa_pwr[3] << 24) | (rfa_pwr[2] << 16) | (rfa_pwr[1] << 8) |
  323. rfa_pwr[0];
  324. rtl_set_bbreg(hw, regoffset[index], 0x7f7f7f7f, writeval);
  325. }
  326. void rtl92s_phy_rf6052_set_ofdmtxpower(struct ieee80211_hw *hw,
  327. u8 *p_pwrlevel, u8 chnl)
  328. {
  329. u32 writeval, pwrbase0, pwrbase1;
  330. u8 index = 0;
  331. u8 finalpwr_idx[4];
  332. _rtl92s_get_powerbase(hw, p_pwrlevel, chnl, &pwrbase0, &pwrbase1,
  333. &finalpwr_idx[0]);
  334. _rtl92s_set_antennadiff(hw, &finalpwr_idx[0]);
  335. for (index = 0; index < 6; index++) {
  336. _rtl92s_get_txpower_writeval_byregulatory(hw, chnl, index,
  337. pwrbase0, pwrbase1, &writeval);
  338. _rtl92s_write_ofdm_powerreg(hw, index, writeval);
  339. }
  340. }
  341. void rtl92s_phy_rf6052_set_ccktxpower(struct ieee80211_hw *hw, u8 pwrlevel)
  342. {
  343. struct rtl_priv *rtlpriv = rtl_priv(hw);
  344. struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
  345. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  346. u32 txagc = 0;
  347. bool dont_inc_cck_or_turboscanoff = false;
  348. if (((rtlefuse->eeprom_version >= 2) &&
  349. (rtlefuse->txpwr_safetyflag == 1)) ||
  350. ((rtlefuse->eeprom_version >= 2) &&
  351. (rtlefuse->eeprom_regulatory != 0)))
  352. dont_inc_cck_or_turboscanoff = true;
  353. if (mac->act_scanning) {
  354. txagc = 0x3f;
  355. if (dont_inc_cck_or_turboscanoff)
  356. txagc = pwrlevel;
  357. } else {
  358. txagc = pwrlevel;
  359. if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  360. TX_HIGH_PWR_LEVEL_LEVEL1)
  361. txagc = 0x10;
  362. else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  363. TX_HIGH_PWR_LEVEL_LEVEL2)
  364. txagc = 0x0;
  365. }
  366. if (txagc > RF6052_MAX_TX_PWR)
  367. txagc = RF6052_MAX_TX_PWR;
  368. rtl_set_bbreg(hw, RTXAGC_CCK_MCS32, BTX_AGCRATECCK, txagc);
  369. }
  370. bool rtl92s_phy_rf6052_config(struct ieee80211_hw *hw)
  371. {
  372. struct rtl_priv *rtlpriv = rtl_priv(hw);
  373. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  374. u32 u4reg_val = 0;
  375. u8 rfpath;
  376. bool rtstatus = true;
  377. struct bb_reg_def *pphyreg;
  378. /* Initialize RF */
  379. for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) {
  380. pphyreg = &rtlphy->phyreg_def[rfpath];
  381. /* Store original RFENV control type */
  382. switch (rfpath) {
  383. case RF90_PATH_A:
  384. case RF90_PATH_C:
  385. u4reg_val = rtl92s_phy_query_bb_reg(hw,
  386. pphyreg->rfintfs,
  387. BRFSI_RFENV);
  388. break;
  389. case RF90_PATH_B:
  390. case RF90_PATH_D:
  391. u4reg_val = rtl92s_phy_query_bb_reg(hw,
  392. pphyreg->rfintfs,
  393. BRFSI_RFENV << 16);
  394. break;
  395. }
  396. /* Set RF_ENV enable */
  397. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfe,
  398. BRFSI_RFENV << 16, 0x1);
  399. /* Set RF_ENV output high */
  400. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1);
  401. /* Set bit number of Address and Data for RF register */
  402. rtl92s_phy_set_bb_reg(hw, pphyreg->rfhssi_para2,
  403. B3WIRE_ADDRESSLENGTH, 0x0);
  404. rtl92s_phy_set_bb_reg(hw, pphyreg->rfhssi_para2,
  405. B3WIRE_DATALENGTH, 0x0);
  406. /* Initialize RF fom connfiguration file */
  407. switch (rfpath) {
  408. case RF90_PATH_A:
  409. rtstatus = rtl92s_phy_config_rf(hw,
  410. (enum radio_path)rfpath);
  411. break;
  412. case RF90_PATH_B:
  413. rtstatus = rtl92s_phy_config_rf(hw,
  414. (enum radio_path)rfpath);
  415. break;
  416. case RF90_PATH_C:
  417. break;
  418. case RF90_PATH_D:
  419. break;
  420. }
  421. /* Restore RFENV control type */
  422. switch (rfpath) {
  423. case RF90_PATH_A:
  424. case RF90_PATH_C:
  425. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfs, BRFSI_RFENV,
  426. u4reg_val);
  427. break;
  428. case RF90_PATH_B:
  429. case RF90_PATH_D:
  430. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfs,
  431. BRFSI_RFENV << 16,
  432. u4reg_val);
  433. break;
  434. }
  435. if (!rtstatus) {
  436. pr_err("Radio[%d] Fail!!\n", rfpath);
  437. goto fail;
  438. }
  439. }
  440. return rtstatus;
  441. fail:
  442. return rtstatus;
  443. }
  444. void rtl92s_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
  445. {
  446. struct rtl_priv *rtlpriv = rtl_priv(hw);
  447. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  448. switch (bandwidth) {
  449. case HT_CHANNEL_WIDTH_20:
  450. rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
  451. 0xfffff3ff) | 0x0400);
  452. rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
  453. rtlphy->rfreg_chnlval[0]);
  454. break;
  455. case HT_CHANNEL_WIDTH_20_40:
  456. rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
  457. 0xfffff3ff));
  458. rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
  459. rtlphy->rfreg_chnlval[0]);
  460. break;
  461. default:
  462. RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
  463. "unknown bandwidth: %#X\n", bandwidth);
  464. break;
  465. }
  466. }