rt2800: fix wrong TX power compensation
authorStanislaw Gruszka <sgruszka@redhat.com>
Mon, 26 Aug 2013 13:18:53 +0000 (15:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Oct 2013 16:17:45 +0000 (09:17 -0700)
commit 6e956da2027c767859128b9bfef085cf2a8e233b upstream.

We should not do temperature compensation on devices without
EXTERNAL_TX_ALC bit set (called DynamicTxAgcControl on vendor driver).
Such devices can have totally bogus TSSI parameters on the EEPROM,
but still threaded by us as valid and result doing wrong TX power
calculations.

This fix inability to connect to AP on slightly longer distance on
some Ralink chips/devices.

Reported-and-tested-by: Fabien ADAM <id2ndr@crocobox.org>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/rt2x00/rt2800lib.c

index 7e66a903cfeecdfae806f197aef1759ac979bfc3..33bfb19a75ae55dacf5bfb6f6140869144795f88 100644 (file)
@@ -2766,6 +2766,13 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev)
        u8 step;
        int i;
 
+       /*
+        * First check if temperature compensation is supported.
+        */
+       rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+       if (!rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_TX_ALC))
+               return 0;
+
        /*
         * Read TSSI boundaries for temperature compensation from
         * the EEPROM.