Commit 3bde4ed3 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

rtlwifi: 8192de: Reduce indentation and fix coding style

This commit doesn't change logic at all. Since indentation is lower, the
wrapped statements can be put in single line that will become more
readable.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent c11c75ec
...@@ -837,16 +837,19 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -837,16 +837,19 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter); rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter);
rtl92d_phy_ap_calibrate(hw, (thermalvalue - rtl92d_phy_ap_calibrate(hw, (thermalvalue -
rtlefuse->eeprom_thermalmeter)); rtlefuse->eeprom_thermalmeter));
if (!thermalvalue)
goto exit;
if (is2t) if (is2t)
rf = 2; rf = 2;
else else
rf = 1; rf = 1;
if (thermalvalue) {
ele_d = rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE, ele_d = rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE, MASKDWORD) & MASKOFDM_D;
MASKDWORD) & MASKOFDM_D;
for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {
if (ele_d == (ofdmswing_table[i] & MASKOFDM_D)) { if (ele_d == (ofdmswing_table[i] & MASKOFDM_D)) {
ofdm_index_old[0] = (u8) i; ofdm_index_old[0] = (u8)i;
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n", "Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n",
...@@ -861,7 +864,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -861,7 +864,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {
if (ele_d == if (ele_d ==
(ofdmswing_table[i] & MASKOFDM_D)) { (ofdmswing_table[i] & MASKOFDM_D)) {
ofdm_index_old[1] = (u8) i; ofdm_index_old[1] = (u8)i;
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, RT_TRACE(rtlpriv, COMP_POWER_TRACKING,
DBG_LOUD, DBG_LOUD,
"Initial pathB ele_d reg 0x%x = 0x%lx, ofdm_index = 0x%x\n", "Initial pathB ele_d reg 0x%x = 0x%lx, ofdm_index = 0x%x\n",
...@@ -879,12 +882,10 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -879,12 +882,10 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
} }
if (!rtlpriv->dm.thermalvalue) { if (!rtlpriv->dm.thermalvalue) {
rtlpriv->dm.thermalvalue = rtlpriv->dm.thermalvalue = rtlefuse->eeprom_thermalmeter;
rtlefuse->eeprom_thermalmeter;
rtlpriv->dm.thermalvalue_lck = thermalvalue; rtlpriv->dm.thermalvalue_lck = thermalvalue;
rtlpriv->dm.thermalvalue_iqk = thermalvalue; rtlpriv->dm.thermalvalue_iqk = thermalvalue;
rtlpriv->dm.thermalvalue_rxgain = rtlpriv->dm.thermalvalue_rxgain = rtlefuse->eeprom_thermalmeter;
rtlefuse->eeprom_thermalmeter;
for (i = 0; i < rf; i++) for (i = 0; i < rf; i++)
rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i]; rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i];
rtlpriv->dm.cck_index = cck_index_old; rtlpriv->dm.cck_index = cck_index_old;
...@@ -903,14 +904,12 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -903,14 +904,12 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
rtlpriv->dm.thermalvalue_avg_index = 0; rtlpriv->dm.thermalvalue_avg_index = 0;
for (i = 0; i < AVG_THERMAL_NUM; i++) { for (i = 0; i < AVG_THERMAL_NUM; i++) {
if (rtlpriv->dm.thermalvalue_avg[i]) { if (rtlpriv->dm.thermalvalue_avg[i]) {
thermalvalue_avg += thermalvalue_avg += rtlpriv->dm.thermalvalue_avg[i];
rtlpriv->dm.thermalvalue_avg[i];
thermalvalue_avg_count++; thermalvalue_avg_count++;
} }
} }
if (thermalvalue_avg_count) if (thermalvalue_avg_count)
thermalvalue = (u8) (thermalvalue_avg / thermalvalue = (u8)(thermalvalue_avg / thermalvalue_avg_count);
thermalvalue_avg_count);
if (rtlhal->reloadtxpowerindex) { if (rtlhal->reloadtxpowerindex) {
delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ?
(thermalvalue - rtlefuse->eeprom_thermalmeter) : (thermalvalue - rtlefuse->eeprom_thermalmeter) :
...@@ -941,12 +940,14 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -941,12 +940,14 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
thermalvalue, rtlpriv->dm.thermalvalue, thermalvalue, rtlpriv->dm.thermalvalue,
rtlefuse->eeprom_thermalmeter, delta, delta_lck, rtlefuse->eeprom_thermalmeter, delta, delta_lck,
delta_iqk); delta_iqk);
if ((delta_lck > rtlefuse->delta_lck) && if (delta_lck > rtlefuse->delta_lck && rtlefuse->delta_lck != 0) {
(rtlefuse->delta_lck != 0)) {
rtlpriv->dm.thermalvalue_lck = thermalvalue; rtlpriv->dm.thermalvalue_lck = thermalvalue;
rtl92d_phy_lc_calibrate(hw); rtl92d_phy_lc_calibrate(hw);
} }
if (delta > 0 && rtlpriv->dm.txpower_track_control) {
if (delta == 0 || !rtlpriv->dm.txpower_track_control)
goto check_delta;
rtlpriv->dm.done_txpower = true; rtlpriv->dm.done_txpower = true;
delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ?
(thermalvalue - rtlefuse->eeprom_thermalmeter) : (thermalvalue - rtlefuse->eeprom_thermalmeter) :
...@@ -954,8 +955,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -954,8 +955,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
if (rtlhal->current_bandtype == BAND_ON_2_4G) { if (rtlhal->current_bandtype == BAND_ON_2_4G) {
offset = 4; offset = 4;
if (delta > INDEX_MAPPING_NUM - 1) if (delta > INDEX_MAPPING_NUM - 1)
index = index_mapping[offset] index = index_mapping[offset][INDEX_MAPPING_NUM - 1];
[INDEX_MAPPING_NUM - 1];
else else
index = index_mapping[offset][delta]; index = index_mapping[offset][delta];
if (thermalvalue > rtlpriv->dm.thermalvalue) { if (thermalvalue > rtlpriv->dm.thermalvalue) {
...@@ -996,12 +996,9 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -996,12 +996,9 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
if (cck_index > CCK_TABLE_SIZE - 1) { if (cck_index > CCK_TABLE_SIZE - 1) {
cck_index = CCK_TABLE_SIZE - 1; cck_index = CCK_TABLE_SIZE - 1;
} else if (internal_pa || } else if (internal_pa ||
rtlhal->current_bandtype == rtlhal->current_bandtype == BAND_ON_2_4G) {
BAND_ON_2_4G) { if (ofdm_index[i] < ofdm_min_index_internal_pa)
if (ofdm_index[i] < ofdm_index[i] = ofdm_min_index_internal_pa;
ofdm_min_index_internal_pa)
ofdm_index[i] =
ofdm_min_index_internal_pa;
} else if (cck_index < 0) { } else if (cck_index < 0) {
cck_index = 0; cck_index = 0;
} }
...@@ -1016,27 +1013,23 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -1016,27 +1013,23 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
"new OFDM_A_index=0x%x,cck_index = 0x%x\n", "new OFDM_A_index=0x%x,cck_index = 0x%x\n",
ofdm_index[0], cck_index); ofdm_index[0], cck_index);
} }
ele_d = (ofdmswing_table[(u8) ofdm_index[0]] & ele_d = (ofdmswing_table[ofdm_index[0]] & 0xFFC00000) >> 22;
0xFFC00000) >> 22; val_x = rtlphy->iqk_matrix[indexforchannel].value[0][0];
val_x = rtlphy->iqk_matrix val_y = rtlphy->iqk_matrix[indexforchannel].value[0][1];
[indexforchannel].value[0][0];
val_y = rtlphy->iqk_matrix
[indexforchannel].value[0][1];
if (val_x != 0) { if (val_x != 0) {
if ((val_x & 0x00000200) != 0) if ((val_x & 0x00000200) != 0)
val_x = val_x | 0xFFFFFC00; val_x = val_x | 0xFFFFFC00;
ele_a = ele_a = ((val_x * ele_d) >> 8) & 0x000003FF;
((val_x * ele_d) >> 8) & 0x000003FF;
/* new element C = element D x Y */ /* new element C = element D x Y */
if ((val_y & 0x00000200) != 0) if ((val_y & 0x00000200) != 0)
val_y = val_y | 0xFFFFFC00; val_y = val_y | 0xFFFFFC00;
ele_c = ((val_y * ele_d) >> 8) & 0x000003FF; ele_c = ((val_y * ele_d) >> 8) & 0x000003FF;
/* wirte new elements A, C, D to regC80 and /* write new elements A, C, D to regC80 and
* regC94, element B is always 0 */ * regC94, element B is always 0
value32 = (ele_d << 22) | ((ele_c & 0x3F) << */
16) | ele_a; value32 = (ele_d << 22) | ((ele_c & 0x3F) << 16) | ele_a;
rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE,
MASKDWORD, value32); MASKDWORD, value32);
...@@ -1051,8 +1044,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -1051,8 +1044,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
} else { } else {
rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE,
MASKDWORD, MASKDWORD,
ofdmswing_table ofdmswing_table[(u8)ofdm_index[0]]);
[(u8)ofdm_index[0]]);
rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS, rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS,
0x00); 0x00);
rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD,
...@@ -1073,82 +1065,57 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -1073,82 +1065,57 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
/* Adjust CCK according to IQK result */ /* Adjust CCK according to IQK result */
if (!rtlpriv->dm.cck_inch14) { if (!rtlpriv->dm.cck_inch14) {
rtl_write_byte(rtlpriv, 0xa22, rtl_write_byte(rtlpriv, 0xa22,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][0]);
[(u8)cck_index][0]);
rtl_write_byte(rtlpriv, 0xa23, rtl_write_byte(rtlpriv, 0xa23,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][1]);
[(u8)cck_index][1]);
rtl_write_byte(rtlpriv, 0xa24, rtl_write_byte(rtlpriv, 0xa24,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][2]);
[(u8)cck_index][2]);
rtl_write_byte(rtlpriv, 0xa25, rtl_write_byte(rtlpriv, 0xa25,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][3]);
[(u8)cck_index][3]);
rtl_write_byte(rtlpriv, 0xa26, rtl_write_byte(rtlpriv, 0xa26,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][4]);
[(u8)cck_index][4]);
rtl_write_byte(rtlpriv, 0xa27, rtl_write_byte(rtlpriv, 0xa27,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][5]);
[(u8)cck_index][5]);
rtl_write_byte(rtlpriv, 0xa28, rtl_write_byte(rtlpriv, 0xa28,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][6]);
[(u8)cck_index][6]);
rtl_write_byte(rtlpriv, 0xa29, rtl_write_byte(rtlpriv, 0xa29,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][7]);
[(u8)cck_index][7]);
} else { } else {
rtl_write_byte(rtlpriv, 0xa22, rtl_write_byte(rtlpriv, 0xa22,
cckswing_table_ch14 cckswing_table_ch14[cck_index][0]);
[(u8)cck_index][0]);
rtl_write_byte(rtlpriv, 0xa23, rtl_write_byte(rtlpriv, 0xa23,
cckswing_table_ch14 cckswing_table_ch14[cck_index][1]);
[(u8)cck_index][1]);
rtl_write_byte(rtlpriv, 0xa24, rtl_write_byte(rtlpriv, 0xa24,
cckswing_table_ch14 cckswing_table_ch14[cck_index][2]);
[(u8)cck_index][2]);
rtl_write_byte(rtlpriv, 0xa25, rtl_write_byte(rtlpriv, 0xa25,
cckswing_table_ch14 cckswing_table_ch14[cck_index][3]);
[(u8)cck_index][3]);
rtl_write_byte(rtlpriv, 0xa26, rtl_write_byte(rtlpriv, 0xa26,
cckswing_table_ch14 cckswing_table_ch14[cck_index][4]);
[(u8)cck_index][4]);
rtl_write_byte(rtlpriv, 0xa27, rtl_write_byte(rtlpriv, 0xa27,
cckswing_table_ch14 cckswing_table_ch14[cck_index][5]);
[(u8)cck_index][5]);
rtl_write_byte(rtlpriv, 0xa28, rtl_write_byte(rtlpriv, 0xa28,
cckswing_table_ch14 cckswing_table_ch14[cck_index][6]);
[(u8)cck_index][6]);
rtl_write_byte(rtlpriv, 0xa29, rtl_write_byte(rtlpriv, 0xa29,
cckswing_table_ch14 cckswing_table_ch14[cck_index][7]);
[(u8)cck_index][7]);
} }
} }
if (is2t) { if (is2t) {
ele_d = (ofdmswing_table[(u8) ofdm_index[1]] & ele_d = (ofdmswing_table[ofdm_index[1]] & 0xFFC00000) >> 22;
0xFFC00000) >> 22; val_x = rtlphy->iqk_matrix[indexforchannel].value[0][4];
val_x = rtlphy->iqk_matrix val_y = rtlphy->iqk_matrix[indexforchannel].value[0][5];
[indexforchannel].value[0][4];
val_y = rtlphy->iqk_matrix
[indexforchannel].value[0][5];
if (val_x != 0) { if (val_x != 0) {
if ((val_x & 0x00000200) != 0) if ((val_x & 0x00000200) != 0)
/* consider minus */ /* consider minus */
val_x = val_x | 0xFFFFFC00; val_x = val_x | 0xFFFFFC00;
ele_a = ((val_x * ele_d) >> 8) & ele_a = ((val_x * ele_d) >> 8) & 0x000003FF;
0x000003FF;
/* new element C = element D x Y */ /* new element C = element D x Y */
if ((val_y & 0x00000200) != 0) if ((val_y & 0x00000200) != 0)
val_y = val_y = val_y | 0xFFFFFC00;
val_y | 0xFFFFFC00; ele_c = ((val_y * ele_d) >> 8) & 0x00003FF;
ele_c =
((val_y *
ele_d) >> 8) & 0x00003FF;
/* write new elements A, C, D to regC88 /* write new elements A, C, D to regC88
* and regC9C, element B is always 0 * and regC9C, element B is always 0
*/ */
value32 = (ele_d << 22) | value32 = (ele_d << 22) | ((ele_c & 0x3F) << 16) | ele_a;
((ele_c & 0x3F) << 16) |
ele_a;
rtl_set_bbreg(hw, rtl_set_bbreg(hw,
ROFDM0_XBTXIQIMBALANCE, ROFDM0_XBTXIQIMBALANCE,
MASKDWORD, value32); MASKDWORD, value32);
...@@ -1162,8 +1129,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -1162,8 +1129,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
rtl_set_bbreg(hw, rtl_set_bbreg(hw,
ROFDM0_XBTXIQIMBALANCE, ROFDM0_XBTXIQIMBALANCE,
MASKDWORD, MASKDWORD,
ofdmswing_table ofdmswing_table[ofdm_index[1]]);
[(u8) ofdm_index[1]]);
rtl_set_bbreg(hw, ROFDM0_XDTXAFE, rtl_set_bbreg(hw, ROFDM0_XDTXAFE,
MASKH4BITS, 0x00); MASKH4BITS, 0x00);
rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD,
...@@ -1180,22 +1146,22 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -1180,22 +1146,22 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
rtl_get_bbreg(hw, 0xc94, MASKDWORD), rtl_get_bbreg(hw, 0xc94, MASKDWORD),
rtl_get_rfreg(hw, RF90_PATH_A, 0x24, rtl_get_rfreg(hw, RF90_PATH_A, 0x24,
RFREG_OFFSET_MASK)); RFREG_OFFSET_MASK));
}
if ((delta_iqk > rtlefuse->delta_iqk) && check_delta:
(rtlefuse->delta_iqk != 0)) { if (delta_iqk > rtlefuse->delta_iqk && rtlefuse->delta_iqk != 0) {
rtl92d_phy_reset_iqk_result(hw); rtl92d_phy_reset_iqk_result(hw);
rtlpriv->dm.thermalvalue_iqk = thermalvalue; rtlpriv->dm.thermalvalue_iqk = thermalvalue;
rtl92d_phy_iq_calibrate(hw); rtl92d_phy_iq_calibrate(hw);
} }
if (delta_rxgain > 0 && rtlhal->current_bandtype == BAND_ON_5G if (delta_rxgain > 0 && rtlhal->current_bandtype == BAND_ON_5G &&
&& thermalvalue <= rtlefuse->eeprom_thermalmeter) { thermalvalue <= rtlefuse->eeprom_thermalmeter) {
rtlpriv->dm.thermalvalue_rxgain = thermalvalue; rtlpriv->dm.thermalvalue_rxgain = thermalvalue;
rtl92d_dm_rxgain_tracking_thermalmeter(hw); rtl92d_dm_rxgain_tracking_thermalmeter(hw);
} }
if (rtlpriv->dm.txpower_track_control) if (rtlpriv->dm.txpower_track_control)
rtlpriv->dm.thermalvalue = thermalvalue; rtlpriv->dm.thermalvalue = thermalvalue;
}
exit:
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "<===\n"); RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "<===\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment