rtlwifi: 8192de: Fix used uninitialized variables in power tracking
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 10 May 2019 08:03:32 +0000 (16:03 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 28 May 2019 12:34:01 +0000 (15:34 +0300)
commit0e7d38132bf8fbf6651add139ef506106d91ab29
treef7249c44c07c654298a7a0b84c813dd3584e3cad
parent8a7db8b66b40eac8bdeffb35c73fe252462d04a0
rtlwifi: 8192de: Fix used uninitialized variables in power tracking

ofdm_index_old[] is the index of ofdmswing_table[], and used to indicate
initial value of ROFDM0_X{A,B}TXIQIMBALANCE in rtl8192de_phy_reg_2tarray[]
table, and the initial value is corresponding to calibration thermal value
written in efuse, namely rtlefuse->eeprom_thermalmeter. Then, local
variable ofdm_index_old[] save to rtlpriv->dm.ofdm_index[] for operational
use.

If thermal value (temperature) is increasing, output TX power is lower.
So, we calculate the delta between current and calibration thermal value,
then add power to yield expected and the same output TX power.

Thus, ofdm_index[] should be initialized as rtlpriv->dm.ofdm_index[], and
shift to proper index depends on delta of thermal value. Then, new power
value ofdmswing_table[ofdm_index[]] is written to register.

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c