Commit 7e9dafd8 authored by Alex A. Mihaylov's avatar Alex A. Mihaylov Committed by John W. Linville

rt2x00: Fix transmit power troubles on some Ralink RT30xx cards

Some cards on Ralink RT30xx chipset not have correctly TX_MIXER_GAIN
value in them EEPROM/EFUSE. In this case, we must use default value,
but always used EEPROM/EFUSE value. As result we have tranmitt power
range from -10dBm to +6dBm instead 0dBm to +16dBm.

Correctly value in EEPROM/EFUSE is one or more for RT3070 and two or
more for other RT30xx chips.

Tested on Canyon CNP-WF518N1 usb Wi-Fi dongle and Jorjin WN8020 usb
embedded Wi-Fi module.
Signed-off-by: default avatarAlex A. Mihaylov <minimumlaw@rambler.ru>
Cc: stable@vger.kernel.org
Acked-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
Acked-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3f524559
...@@ -5036,6 +5036,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) ...@@ -5036,6 +5036,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
if (!rt2x00_rt(rt2x00dev, RT5390) && if (!rt2x00_rt(rt2x00dev, RT5390) &&
!rt2x00_rt(rt2x00dev, RT5392)) { !rt2x00_rt(rt2x00dev, RT5392)) {
u8 min_gain = rt2x00_rt(rt2x00dev, RT3070) ? 1 : 2;
rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0); rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0);
if (rt2x00_rt(rt2x00dev, RT3070) || if (rt2x00_rt(rt2x00dev, RT3070) ||
...@@ -5046,8 +5048,10 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) ...@@ -5046,8 +5048,10 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
&rt2x00dev->cap_flags)) &rt2x00dev->cap_flags))
rt2x00_set_field8(&rfcsr, RFCSR17_R, 1); rt2x00_set_field8(&rfcsr, RFCSR17_R, 1);
} }
rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN, if (drv_data->txmixer_gain_24g >= min_gain) {
drv_data->txmixer_gain_24g); rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN,
drv_data->txmixer_gain_24g);
}
rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
} }
......
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