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,365 +837,331 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter( ...@@ -837,365 +837,331 @@ 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;
for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {
if (ele_d == (ofdmswing_table[i] & MASKOFDM_D)) {
ofdm_index_old[0] = (u8)i;
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n",
ROFDM0_XATXIQIMBALANCE,
ele_d, ofdm_index_old[0]);
break;
}
}
if (is2t) {
ele_d = rtl_get_bbreg(hw, ROFDM0_XBTXIQIMBALANCE,
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 ==
ofdm_index_old[0] = (u8) i; (ofdmswing_table[i] & MASKOFDM_D)) {
ofdm_index_old[1] = (u8)i;
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, RT_TRACE(rtlpriv, COMP_POWER_TRACKING,
"Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n", DBG_LOUD,
ROFDM0_XATXIQIMBALANCE, "Initial pathB ele_d reg 0x%x = 0x%lx, ofdm_index = 0x%x\n",
ele_d, ofdm_index_old[0]); ROFDM0_XBTXIQIMBALANCE, ele_d,
ofdm_index_old[1]);
break; break;
} }
} }
if (is2t) { }
ele_d = rtl_get_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, if (rtlhal->current_bandtype == BAND_ON_2_4G) {
MASKDWORD) & MASKOFDM_D; rtl92d_bandtype_2_4G(hw, &temp_cck, &cck_index_old);
for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { } else {
if (ele_d == temp_cck = 0x090e1317;
(ofdmswing_table[i] & MASKOFDM_D)) { cck_index_old = 12;
ofdm_index_old[1] = (u8) i; }
RT_TRACE(rtlpriv, COMP_POWER_TRACKING,
DBG_LOUD,
"Initial pathB ele_d reg 0x%x = 0x%lx, ofdm_index = 0x%x\n",
ROFDM0_XBTXIQIMBALANCE, ele_d,
ofdm_index_old[1]);
break;
}
}
}
if (rtlhal->current_bandtype == BAND_ON_2_4G) {
rtl92d_bandtype_2_4G(hw, &temp_cck, &cck_index_old);
} else {
temp_cck = 0x090e1317;
cck_index_old = 12;
}
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 = rtlefuse->eeprom_thermalmeter;
rtlpriv->dm.thermalvalue_rxgain = for (i = 0; i < rf; i++)
rtlefuse->eeprom_thermalmeter; rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i];
for (i = 0; i < rf; i++) rtlpriv->dm.cck_index = cck_index_old;
rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i]; }
rtlpriv->dm.cck_index = cck_index_old; if (rtlhal->reloadtxpowerindex) {
for (i = 0; i < rf; i++)
rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i];
rtlpriv->dm.cck_index = cck_index_old;
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"reload ofdm index for band switch\n");
}
rtlpriv->dm.thermalvalue_avg
[rtlpriv->dm.thermalvalue_avg_index] = thermalvalue;
rtlpriv->dm.thermalvalue_avg_index++;
if (rtlpriv->dm.thermalvalue_avg_index == AVG_THERMAL_NUM)
rtlpriv->dm.thermalvalue_avg_index = 0;
for (i = 0; i < AVG_THERMAL_NUM; i++) {
if (rtlpriv->dm.thermalvalue_avg[i]) {
thermalvalue_avg += rtlpriv->dm.thermalvalue_avg[i];
thermalvalue_avg_count++;
} }
if (rtlhal->reloadtxpowerindex) { }
if (thermalvalue_avg_count)
thermalvalue = (u8)(thermalvalue_avg / thermalvalue_avg_count);
if (rtlhal->reloadtxpowerindex) {
delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ?
(thermalvalue - rtlefuse->eeprom_thermalmeter) :
(rtlefuse->eeprom_thermalmeter - thermalvalue);
rtlhal->reloadtxpowerindex = false;
rtlpriv->dm.done_txpower = false;
} else if (rtlpriv->dm.done_txpower) {
delta = (thermalvalue > rtlpriv->dm.thermalvalue) ?
(thermalvalue - rtlpriv->dm.thermalvalue) :
(rtlpriv->dm.thermalvalue - thermalvalue);
} else {
delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ?
(thermalvalue - rtlefuse->eeprom_thermalmeter) :
(rtlefuse->eeprom_thermalmeter - thermalvalue);
}
delta_lck = (thermalvalue > rtlpriv->dm.thermalvalue_lck) ?
(thermalvalue - rtlpriv->dm.thermalvalue_lck) :
(rtlpriv->dm.thermalvalue_lck - thermalvalue);
delta_iqk = (thermalvalue > rtlpriv->dm.thermalvalue_iqk) ?
(thermalvalue - rtlpriv->dm.thermalvalue_iqk) :
(rtlpriv->dm.thermalvalue_iqk - thermalvalue);
delta_rxgain =
(thermalvalue > rtlpriv->dm.thermalvalue_rxgain) ?
(thermalvalue - rtlpriv->dm.thermalvalue_rxgain) :
(rtlpriv->dm.thermalvalue_rxgain - thermalvalue);
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x delta 0x%x delta_lck 0x%x delta_iqk 0x%x\n",
thermalvalue, rtlpriv->dm.thermalvalue,
rtlefuse->eeprom_thermalmeter, delta, delta_lck,
delta_iqk);
if (delta_lck > rtlefuse->delta_lck && rtlefuse->delta_lck != 0) {
rtlpriv->dm.thermalvalue_lck = thermalvalue;
rtl92d_phy_lc_calibrate(hw);
}
if (delta == 0 || !rtlpriv->dm.txpower_track_control)
goto check_delta;
rtlpriv->dm.done_txpower = true;
delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ?
(thermalvalue - rtlefuse->eeprom_thermalmeter) :
(rtlefuse->eeprom_thermalmeter - thermalvalue);
if (rtlhal->current_bandtype == BAND_ON_2_4G) {
offset = 4;
if (delta > INDEX_MAPPING_NUM - 1)
index = index_mapping[offset][INDEX_MAPPING_NUM - 1];
else
index = index_mapping[offset][delta];
if (thermalvalue > rtlpriv->dm.thermalvalue) {
for (i = 0; i < rf; i++) for (i = 0; i < rf; i++)
rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i]; ofdm_index[i] -= delta;
rtlpriv->dm.cck_index = cck_index_old; cck_index -= delta;
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"reload ofdm index for band switch\n");
}
rtlpriv->dm.thermalvalue_avg
[rtlpriv->dm.thermalvalue_avg_index] = thermalvalue;
rtlpriv->dm.thermalvalue_avg_index++;
if (rtlpriv->dm.thermalvalue_avg_index == AVG_THERMAL_NUM)
rtlpriv->dm.thermalvalue_avg_index = 0;
for (i = 0; i < AVG_THERMAL_NUM; i++) {
if (rtlpriv->dm.thermalvalue_avg[i]) {
thermalvalue_avg +=
rtlpriv->dm.thermalvalue_avg[i];
thermalvalue_avg_count++;
}
}
if (thermalvalue_avg_count)
thermalvalue = (u8) (thermalvalue_avg /
thermalvalue_avg_count);
if (rtlhal->reloadtxpowerindex) {
delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ?
(thermalvalue - rtlefuse->eeprom_thermalmeter) :
(rtlefuse->eeprom_thermalmeter - thermalvalue);
rtlhal->reloadtxpowerindex = false;
rtlpriv->dm.done_txpower = false;
} else if (rtlpriv->dm.done_txpower) {
delta = (thermalvalue > rtlpriv->dm.thermalvalue) ?
(thermalvalue - rtlpriv->dm.thermalvalue) :
(rtlpriv->dm.thermalvalue - thermalvalue);
} else { } else {
delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? for (i = 0; i < rf; i++)
(thermalvalue - rtlefuse->eeprom_thermalmeter) : ofdm_index[i] += index;
(rtlefuse->eeprom_thermalmeter - thermalvalue); cck_index += index;
} }
delta_lck = (thermalvalue > rtlpriv->dm.thermalvalue_lck) ? } else if (rtlhal->current_bandtype == BAND_ON_5G) {
(thermalvalue - rtlpriv->dm.thermalvalue_lck) : rtl92d_bandtype_5G(rtlhal, ofdm_index,
(rtlpriv->dm.thermalvalue_lck - thermalvalue); &internal_pa, thermalvalue,
delta_iqk = (thermalvalue > rtlpriv->dm.thermalvalue_iqk) ? delta, rf, rtlefuse, rtlpriv,
(thermalvalue - rtlpriv->dm.thermalvalue_iqk) : rtlphy, index_mapping,
(rtlpriv->dm.thermalvalue_iqk - thermalvalue); index_mapping_internal_pa);
delta_rxgain = }
(thermalvalue > rtlpriv->dm.thermalvalue_rxgain) ? if (is2t) {
(thermalvalue - rtlpriv->dm.thermalvalue_rxgain) : RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
(rtlpriv->dm.thermalvalue_rxgain - thermalvalue); "temp OFDM_A_index=0x%x, OFDM_B_index = 0x%x,cck_index=0x%x\n",
rtlpriv->dm.ofdm_index[0],
rtlpriv->dm.ofdm_index[1],
rtlpriv->dm.cck_index);
} else {
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x delta 0x%x delta_lck 0x%x delta_iqk 0x%x\n", "temp OFDM_A_index=0x%x,cck_index = 0x%x\n",
thermalvalue, rtlpriv->dm.thermalvalue, rtlpriv->dm.ofdm_index[0],
rtlefuse->eeprom_thermalmeter, delta, delta_lck, rtlpriv->dm.cck_index);
delta_iqk); }
if ((delta_lck > rtlefuse->delta_lck) && for (i = 0; i < rf; i++) {
(rtlefuse->delta_lck != 0)) { if (ofdm_index[i] > OFDM_TABLE_SIZE_92D - 1)
rtlpriv->dm.thermalvalue_lck = thermalvalue; ofdm_index[i] = OFDM_TABLE_SIZE_92D - 1;
rtl92d_phy_lc_calibrate(hw); else if (ofdm_index[i] < ofdm_min_index)
ofdm_index[i] = ofdm_min_index;
}
if (rtlhal->current_bandtype == BAND_ON_2_4G) {
if (cck_index > CCK_TABLE_SIZE - 1) {
cck_index = CCK_TABLE_SIZE - 1;
} else if (internal_pa ||
rtlhal->current_bandtype == BAND_ON_2_4G) {
if (ofdm_index[i] < ofdm_min_index_internal_pa)
ofdm_index[i] = ofdm_min_index_internal_pa;
} else if (cck_index < 0) {
cck_index = 0;
} }
if (delta > 0 && rtlpriv->dm.txpower_track_control) { }
rtlpriv->dm.done_txpower = true; if (is2t) {
delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
(thermalvalue - rtlefuse->eeprom_thermalmeter) : "new OFDM_A_index=0x%x, OFDM_B_index = 0x%x, cck_index=0x%x\n",
(rtlefuse->eeprom_thermalmeter - thermalvalue); ofdm_index[0], ofdm_index[1],
if (rtlhal->current_bandtype == BAND_ON_2_4G) { cck_index);
offset = 4; } else {
if (delta > INDEX_MAPPING_NUM - 1) RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
index = index_mapping[offset] "new OFDM_A_index=0x%x,cck_index = 0x%x\n",
[INDEX_MAPPING_NUM - 1]; ofdm_index[0], cck_index);
else }
index = index_mapping[offset][delta]; ele_d = (ofdmswing_table[ofdm_index[0]] & 0xFFC00000) >> 22;
if (thermalvalue > rtlpriv->dm.thermalvalue) { val_x = rtlphy->iqk_matrix[indexforchannel].value[0][0];
for (i = 0; i < rf; i++) val_y = rtlphy->iqk_matrix[indexforchannel].value[0][1];
ofdm_index[i] -= delta; if (val_x != 0) {
cck_index -= delta; if ((val_x & 0x00000200) != 0)
} else { val_x = val_x | 0xFFFFFC00;
for (i = 0; i < rf; i++) ele_a = ((val_x * ele_d) >> 8) & 0x000003FF;
ofdm_index[i] += index;
cck_index += index; /* new element C = element D x Y */
} if ((val_y & 0x00000200) != 0)
} else if (rtlhal->current_bandtype == BAND_ON_5G) { val_y = val_y | 0xFFFFFC00;
rtl92d_bandtype_5G(rtlhal, ofdm_index, ele_c = ((val_y * ele_d) >> 8) & 0x000003FF;
&internal_pa, thermalvalue,
delta, rf, rtlefuse, rtlpriv, /* write new elements A, C, D to regC80 and
rtlphy, index_mapping, * regC94, element B is always 0
index_mapping_internal_pa); */
} value32 = (ele_d << 22) | ((ele_c & 0x3F) << 16) | ele_a;
if (is2t) { rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE,
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, MASKDWORD, value32);
"temp OFDM_A_index=0x%x, OFDM_B_index = 0x%x,cck_index=0x%x\n",
rtlpriv->dm.ofdm_index[0], value32 = (ele_c & 0x000003C0) >> 6;
rtlpriv->dm.ofdm_index[1], rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS,
rtlpriv->dm.cck_index); value32);
} else {
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, value32 = ((val_x * ele_d) >> 7) & 0x01;
"temp OFDM_A_index=0x%x,cck_index = 0x%x\n", rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(24),
rtlpriv->dm.ofdm_index[0], value32);
rtlpriv->dm.cck_index);
}
for (i = 0; i < rf; i++) {
if (ofdm_index[i] > OFDM_TABLE_SIZE_92D - 1)
ofdm_index[i] = OFDM_TABLE_SIZE_92D - 1;
else if (ofdm_index[i] < ofdm_min_index)
ofdm_index[i] = ofdm_min_index;
}
if (rtlhal->current_bandtype == BAND_ON_2_4G) {
if (cck_index > CCK_TABLE_SIZE - 1) {
cck_index = CCK_TABLE_SIZE - 1;
} else if (internal_pa ||
rtlhal->current_bandtype ==
BAND_ON_2_4G) {
if (ofdm_index[i] <
ofdm_min_index_internal_pa)
ofdm_index[i] =
ofdm_min_index_internal_pa;
} else if (cck_index < 0) {
cck_index = 0;
}
}
if (is2t) {
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"new OFDM_A_index=0x%x, OFDM_B_index = 0x%x, cck_index=0x%x\n",
ofdm_index[0], ofdm_index[1],
cck_index);
} else {
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"new OFDM_A_index=0x%x,cck_index = 0x%x\n",
ofdm_index[0], cck_index);
}
ele_d = (ofdmswing_table[(u8) ofdm_index[0]] &
0xFFC00000) >> 22;
val_x = rtlphy->iqk_matrix
[indexforchannel].value[0][0];
val_y = rtlphy->iqk_matrix
[indexforchannel].value[0][1];
if (val_x != 0) {
if ((val_x & 0x00000200) != 0)
val_x = val_x | 0xFFFFFC00;
ele_a =
((val_x * ele_d) >> 8) & 0x000003FF;
/* new element C = element D x Y */
if ((val_y & 0x00000200) != 0)
val_y = val_y | 0xFFFFFC00;
ele_c = ((val_y * ele_d) >> 8) & 0x000003FF;
/* wirte new elements A, C, D to regC80 and
* regC94, element B is always 0 */
value32 = (ele_d << 22) | ((ele_c & 0x3F) <<
16) | ele_a;
rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE,
MASKDWORD, value32);
value32 = (ele_c & 0x000003C0) >> 6;
rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS,
value32);
value32 = ((val_x * ele_d) >> 7) & 0x01;
rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(24),
value32);
} 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, BIT(24), 0x00);
BIT(24), 0x00); }
}
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"TxPwrTracking for interface %d path A: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xe94 = 0x%lx 0xe9c = 0x%lx\n", "TxPwrTracking for interface %d path A: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xe94 = 0x%lx 0xe9c = 0x%lx\n",
rtlhal->interfaceindex, rtlhal->interfaceindex,
val_x, val_y, ele_a, ele_c, ele_d, val_x, val_y, ele_a, ele_c, ele_d,
val_x, val_y); val_x, val_y);
if (cck_index >= CCK_TABLE_SIZE) if (cck_index >= CCK_TABLE_SIZE)
cck_index = CCK_TABLE_SIZE - 1; cck_index = CCK_TABLE_SIZE - 1;
if (cck_index < 0) if (cck_index < 0)
cck_index = 0; cck_index = 0;
if (rtlhal->current_bandtype == BAND_ON_2_4G) { if (rtlhal->current_bandtype == BAND_ON_2_4G) {
/* 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[cck_index][1]);
cckswing_table_ch1ch13 rtl_write_byte(rtlpriv, 0xa24,
[(u8)cck_index][1]); cckswing_table_ch1ch13[cck_index][2]);
rtl_write_byte(rtlpriv, 0xa24, rtl_write_byte(rtlpriv, 0xa25,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][3]);
[(u8)cck_index][2]); rtl_write_byte(rtlpriv, 0xa26,
rtl_write_byte(rtlpriv, 0xa25, cckswing_table_ch1ch13[cck_index][4]);
cckswing_table_ch1ch13 rtl_write_byte(rtlpriv, 0xa27,
[(u8)cck_index][3]); cckswing_table_ch1ch13[cck_index][5]);
rtl_write_byte(rtlpriv, 0xa26, rtl_write_byte(rtlpriv, 0xa28,
cckswing_table_ch1ch13 cckswing_table_ch1ch13[cck_index][6]);
[(u8)cck_index][4]); rtl_write_byte(rtlpriv, 0xa29,
rtl_write_byte(rtlpriv, 0xa27, cckswing_table_ch1ch13[cck_index][7]);
cckswing_table_ch1ch13 } else {
[(u8)cck_index][5]); rtl_write_byte(rtlpriv, 0xa22,
rtl_write_byte(rtlpriv, 0xa28, cckswing_table_ch14[cck_index][0]);
cckswing_table_ch1ch13 rtl_write_byte(rtlpriv, 0xa23,
[(u8)cck_index][6]); cckswing_table_ch14[cck_index][1]);
rtl_write_byte(rtlpriv, 0xa29, rtl_write_byte(rtlpriv, 0xa24,
cckswing_table_ch1ch13 cckswing_table_ch14[cck_index][2]);
[(u8)cck_index][7]); rtl_write_byte(rtlpriv, 0xa25,
} else { cckswing_table_ch14[cck_index][3]);
rtl_write_byte(rtlpriv, 0xa22, rtl_write_byte(rtlpriv, 0xa26,
cckswing_table_ch14 cckswing_table_ch14[cck_index][4]);
[(u8)cck_index][0]); rtl_write_byte(rtlpriv, 0xa27,
rtl_write_byte(rtlpriv, 0xa23, cckswing_table_ch14[cck_index][5]);
cckswing_table_ch14 rtl_write_byte(rtlpriv, 0xa28,
[(u8)cck_index][1]); cckswing_table_ch14[cck_index][6]);
rtl_write_byte(rtlpriv, 0xa24, rtl_write_byte(rtlpriv, 0xa29,
cckswing_table_ch14 cckswing_table_ch14[cck_index][7]);
[(u8)cck_index][2]);
rtl_write_byte(rtlpriv, 0xa25,
cckswing_table_ch14
[(u8)cck_index][3]);
rtl_write_byte(rtlpriv, 0xa26,
cckswing_table_ch14
[(u8)cck_index][4]);
rtl_write_byte(rtlpriv, 0xa27,
cckswing_table_ch14
[(u8)cck_index][5]);
rtl_write_byte(rtlpriv, 0xa28,
cckswing_table_ch14
[(u8)cck_index][6]);
rtl_write_byte(rtlpriv, 0xa29,
cckswing_table_ch14
[(u8)cck_index][7]);
}
}
if (is2t) {
ele_d = (ofdmswing_table[(u8) ofdm_index[1]] &
0xFFC00000) >> 22;
val_x = rtlphy->iqk_matrix
[indexforchannel].value[0][4];
val_y = rtlphy->iqk_matrix
[indexforchannel].value[0][5];
if (val_x != 0) {
if ((val_x & 0x00000200) != 0)
/* consider minus */
val_x = val_x | 0xFFFFFC00;
ele_a = ((val_x * ele_d) >> 8) &
0x000003FF;
/* new element C = element D x Y */
if ((val_y & 0x00000200) != 0)
val_y =
val_y | 0xFFFFFC00;
ele_c =
((val_y *
ele_d) >> 8) & 0x00003FF;
/* write new elements A, C, D to regC88
* and regC9C, element B is always 0
*/
value32 = (ele_d << 22) |
((ele_c & 0x3F) << 16) |
ele_a;
rtl_set_bbreg(hw,
ROFDM0_XBTXIQIMBALANCE,
MASKDWORD, value32);
value32 = (ele_c & 0x000003C0) >> 6;
rtl_set_bbreg(hw, ROFDM0_XDTXAFE,
MASKH4BITS, value32);
value32 = ((val_x * ele_d) >> 7) & 0x01;
rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD,
BIT(28), value32);
} else {
rtl_set_bbreg(hw,
ROFDM0_XBTXIQIMBALANCE,
MASKDWORD,
ofdmswing_table
[(u8) ofdm_index[1]]);
rtl_set_bbreg(hw, ROFDM0_XDTXAFE,
MASKH4BITS, 0x00);
rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD,
BIT(28), 0x00);
}
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"TxPwrTracking path B: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xeb4 = 0x%lx 0xebc = 0x%lx\n",
val_x, val_y, ele_a, ele_c,
ele_d, val_x, val_y);
}
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"TxPwrTracking 0xc80 = 0x%x, 0xc94 = 0x%x RF 0x24 = 0x%x\n",
rtl_get_bbreg(hw, 0xc80, MASKDWORD),
rtl_get_bbreg(hw, 0xc94, MASKDWORD),
rtl_get_rfreg(hw, RF90_PATH_A, 0x24,
RFREG_OFFSET_MASK));
}
if ((delta_iqk > rtlefuse->delta_iqk) &&
(rtlefuse->delta_iqk != 0)) {
rtl92d_phy_reset_iqk_result(hw);
rtlpriv->dm.thermalvalue_iqk = thermalvalue;
rtl92d_phy_iq_calibrate(hw);
} }
if (delta_rxgain > 0 && rtlhal->current_bandtype == BAND_ON_5G }
&& thermalvalue <= rtlefuse->eeprom_thermalmeter) { if (is2t) {
rtlpriv->dm.thermalvalue_rxgain = thermalvalue; ele_d = (ofdmswing_table[ofdm_index[1]] & 0xFFC00000) >> 22;
rtl92d_dm_rxgain_tracking_thermalmeter(hw); val_x = rtlphy->iqk_matrix[indexforchannel].value[0][4];
val_y = rtlphy->iqk_matrix[indexforchannel].value[0][5];
if (val_x != 0) {
if ((val_x & 0x00000200) != 0)
/* consider minus */
val_x = val_x | 0xFFFFFC00;
ele_a = ((val_x * ele_d) >> 8) & 0x000003FF;
/* new element C = element D x Y */
if ((val_y & 0x00000200) != 0)
val_y = val_y | 0xFFFFFC00;
ele_c = ((val_y * ele_d) >> 8) & 0x00003FF;
/* write new elements A, C, D to regC88
* and regC9C, element B is always 0
*/
value32 = (ele_d << 22) | ((ele_c & 0x3F) << 16) | ele_a;
rtl_set_bbreg(hw,
ROFDM0_XBTXIQIMBALANCE,
MASKDWORD, value32);
value32 = (ele_c & 0x000003C0) >> 6;
rtl_set_bbreg(hw, ROFDM0_XDTXAFE,
MASKH4BITS, value32);
value32 = ((val_x * ele_d) >> 7) & 0x01;
rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD,
BIT(28), value32);
} else {
rtl_set_bbreg(hw,
ROFDM0_XBTXIQIMBALANCE,
MASKDWORD,
ofdmswing_table[ofdm_index[1]]);
rtl_set_bbreg(hw, ROFDM0_XDTXAFE,
MASKH4BITS, 0x00);
rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD,
BIT(28), 0x00);
} }
if (rtlpriv->dm.txpower_track_control) RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
rtlpriv->dm.thermalvalue = thermalvalue; "TxPwrTracking path B: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xeb4 = 0x%lx 0xebc = 0x%lx\n",
val_x, val_y, ele_a, ele_c,
ele_d, val_x, val_y);
}
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"TxPwrTracking 0xc80 = 0x%x, 0xc94 = 0x%x RF 0x24 = 0x%x\n",
rtl_get_bbreg(hw, 0xc80, MASKDWORD),
rtl_get_bbreg(hw, 0xc94, MASKDWORD),
rtl_get_rfreg(hw, RF90_PATH_A, 0x24,
RFREG_OFFSET_MASK));
check_delta:
if (delta_iqk > rtlefuse->delta_iqk && rtlefuse->delta_iqk != 0) {
rtl92d_phy_reset_iqk_result(hw);
rtlpriv->dm.thermalvalue_iqk = thermalvalue;
rtl92d_phy_iq_calibrate(hw);
} }
if (delta_rxgain > 0 && rtlhal->current_bandtype == BAND_ON_5G &&
thermalvalue <= rtlefuse->eeprom_thermalmeter) {
rtlpriv->dm.thermalvalue_rxgain = thermalvalue;
rtl92d_dm_rxgain_tracking_thermalmeter(hw);
}
if (rtlpriv->dm.txpower_track_control)
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