| .. | .. |
|---|
| 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 | | - * 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 | | - *****************************************************************************/ |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | +/* Copyright(c) 2009-2012 Realtek Corporation.*/ |
|---|
| 25 | 3 | |
|---|
| 26 | 4 | #include "../wifi.h" |
|---|
| 27 | 5 | #include "reg.h" |
|---|
| .. | .. |
|---|
| 47 | 25 | |
|---|
| 48 | 26 | /* We only care about the path A for legacy. */ |
|---|
| 49 | 27 | if (rtlefuse->eeprom_version < 2) { |
|---|
| 50 | | - pwrbase0 = pwrlevel[0] + (rtlefuse->legacy_httxpowerdiff & 0xf); |
|---|
| 28 | + pwrbase0 = pwrlevel[0] + (rtlefuse->legacy_ht_txpowerdiff & 0xf); |
|---|
| 51 | 29 | } else { |
|---|
| 52 | 30 | legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff |
|---|
| 53 | 31 | [RF90_PATH_A][chnl - 1]; |
|---|
| .. | .. |
|---|
| 117 | 95 | } |
|---|
| 118 | 96 | |
|---|
| 119 | 97 | if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { |
|---|
| 120 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 121 | | - "40MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n", |
|---|
| 122 | | - p_final_pwridx[0], p_final_pwridx[1]); |
|---|
| 98 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 99 | + "40MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n", |
|---|
| 100 | + p_final_pwridx[0], p_final_pwridx[1]); |
|---|
| 123 | 101 | } else { |
|---|
| 124 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 125 | | - "20MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n", |
|---|
| 126 | | - p_final_pwridx[0], p_final_pwridx[1]); |
|---|
| 102 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 103 | + "20MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n", |
|---|
| 104 | + p_final_pwridx[0], p_final_pwridx[1]); |
|---|
| 127 | 105 | } |
|---|
| 128 | 106 | } |
|---|
| 129 | 107 | |
|---|
| .. | .. |
|---|
| 146 | 124 | if (ant_pwr_diff < -8) |
|---|
| 147 | 125 | ant_pwr_diff = -8; |
|---|
| 148 | 126 | |
|---|
| 149 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 150 | | - "Antenna Diff from RF-B to RF-A = %d (0x%x)\n", |
|---|
| 151 | | - ant_pwr_diff, ant_pwr_diff & 0xf); |
|---|
| 127 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 128 | + "Antenna Diff from RF-B to RF-A = %d (0x%x)\n", |
|---|
| 129 | + ant_pwr_diff, ant_pwr_diff & 0xf); |
|---|
| 152 | 130 | |
|---|
| 153 | 131 | ant_pwr_diff &= 0xf; |
|---|
| 154 | 132 | } |
|---|
| .. | .. |
|---|
| 165 | 143 | rtl_set_bbreg(hw, RFPGA0_TXGAINSTAGE, (BXBTXAGC | BXCTXAGC | BXDTXAGC), |
|---|
| 166 | 144 | u4reg_val); |
|---|
| 167 | 145 | |
|---|
| 168 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "Write BCD-Diff(0x%x) = 0x%x\n", |
|---|
| 169 | | - RFPGA0_TXGAINSTAGE, u4reg_val); |
|---|
| 146 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, "Write BCD-Diff(0x%x) = 0x%x\n", |
|---|
| 147 | + RFPGA0_TXGAINSTAGE, u4reg_val); |
|---|
| 170 | 148 | } |
|---|
| 171 | 149 | |
|---|
| 172 | 150 | static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, |
|---|
| .. | .. |
|---|
| 191 | 169 | writeval = rtlphy->mcs_offset[chnlgroup][index] + |
|---|
| 192 | 170 | ((index < 2) ? pwrbase0 : pwrbase1); |
|---|
| 193 | 171 | |
|---|
| 194 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 195 | | - "RTK better performance, writeval = 0x%x\n", writeval); |
|---|
| 172 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 173 | + "RTK better performance, writeval = 0x%x\n", writeval); |
|---|
| 196 | 174 | break; |
|---|
| 197 | 175 | case 1: |
|---|
| 198 | 176 | /* Realtek regulatory increase power diff defined |
|---|
| .. | .. |
|---|
| 200 | 178 | if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { |
|---|
| 201 | 179 | writeval = ((index < 2) ? pwrbase0 : pwrbase1); |
|---|
| 202 | 180 | |
|---|
| 203 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 204 | | - "Realtek regulatory, 40MHz, writeval = 0x%x\n", |
|---|
| 205 | | - writeval); |
|---|
| 181 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 182 | + "Realtek regulatory, 40MHz, writeval = 0x%x\n", |
|---|
| 183 | + writeval); |
|---|
| 206 | 184 | } else { |
|---|
| 207 | 185 | chnlgroup = 0; |
|---|
| 208 | 186 | |
|---|
| .. | .. |
|---|
| 221 | 199 | + ((index < 2) ? |
|---|
| 222 | 200 | pwrbase0 : pwrbase1); |
|---|
| 223 | 201 | |
|---|
| 224 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 225 | | - "Realtek regulatory, 20MHz, writeval = 0x%x\n", |
|---|
| 226 | | - writeval); |
|---|
| 202 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 203 | + "Realtek regulatory, 20MHz, writeval = 0x%x\n", |
|---|
| 204 | + writeval); |
|---|
| 227 | 205 | } |
|---|
| 228 | 206 | break; |
|---|
| 229 | 207 | case 2: |
|---|
| 230 | 208 | /* Better regulatory don't increase any power diff */ |
|---|
| 231 | 209 | writeval = ((index < 2) ? pwrbase0 : pwrbase1); |
|---|
| 232 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 233 | | - "Better regulatory, writeval = 0x%x\n", writeval); |
|---|
| 210 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 211 | + "Better regulatory, writeval = 0x%x\n", writeval); |
|---|
| 234 | 212 | break; |
|---|
| 235 | 213 | case 3: |
|---|
| 236 | 214 | /* Customer defined power diff. increase power diff |
|---|
| .. | .. |
|---|
| 238 | 216 | chnlgroup = 0; |
|---|
| 239 | 217 | |
|---|
| 240 | 218 | if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { |
|---|
| 241 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 242 | | - "customer's limit, 40MHz = 0x%x\n", |
|---|
| 243 | | - rtlefuse->pwrgroup_ht40 |
|---|
| 244 | | - [RF90_PATH_A][chnl - 1]); |
|---|
| 219 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 220 | + "customer's limit, 40MHz = 0x%x\n", |
|---|
| 221 | + rtlefuse->pwrgroup_ht40 |
|---|
| 222 | + [RF90_PATH_A][chnl - 1]); |
|---|
| 245 | 223 | } else { |
|---|
| 246 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 247 | | - "customer's limit, 20MHz = 0x%x\n", |
|---|
| 248 | | - rtlefuse->pwrgroup_ht20 |
|---|
| 249 | | - [RF90_PATH_A][chnl - 1]); |
|---|
| 224 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 225 | + "customer's limit, 20MHz = 0x%x\n", |
|---|
| 226 | + rtlefuse->pwrgroup_ht20 |
|---|
| 227 | + [RF90_PATH_A][chnl - 1]); |
|---|
| 250 | 228 | } |
|---|
| 251 | 229 | |
|---|
| 252 | 230 | for (i = 0; i < 4; i++) { |
|---|
| .. | .. |
|---|
| 278 | 256 | (pwrdiff_limit[2] << 16) | |
|---|
| 279 | 257 | (pwrdiff_limit[1] << 8) | |
|---|
| 280 | 258 | (pwrdiff_limit[0]); |
|---|
| 281 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 282 | | - "Customer's limit = 0x%x\n", customer_limit); |
|---|
| 259 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 260 | + "Customer's limit = 0x%x\n", customer_limit); |
|---|
| 283 | 261 | |
|---|
| 284 | 262 | writeval = customer_limit + ((index < 2) ? |
|---|
| 285 | 263 | pwrbase0 : pwrbase1); |
|---|
| 286 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 287 | | - "Customer, writeval = 0x%x\n", writeval); |
|---|
| 264 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 265 | + "Customer, writeval = 0x%x\n", writeval); |
|---|
| 288 | 266 | break; |
|---|
| 289 | 267 | default: |
|---|
| 290 | 268 | chnlgroup = 0; |
|---|
| 291 | 269 | writeval = rtlphy->mcs_offset[chnlgroup][index] + |
|---|
| 292 | 270 | ((index < 2) ? pwrbase0 : pwrbase1); |
|---|
| 293 | | - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 294 | | - "RTK better performance, writeval = 0x%x\n", writeval); |
|---|
| 271 | + rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, |
|---|
| 272 | + "RTK better performance, writeval = 0x%x\n", writeval); |
|---|
| 295 | 273 | break; |
|---|
| 296 | 274 | } |
|---|
| 297 | 275 | |
|---|