]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
mt76: mt76x2: fix external LNA gain settings
authorFelix Fietkau <nbd@nbd.name>
Sun, 3 Mar 2019 14:10:00 +0000 (15:10 +0100)
committerFelix Fietkau <nbd@nbd.name>
Thu, 7 Mar 2019 11:50:23 +0000 (12:50 +0100)
Devices with external LNA need different values for AGC registers 8 and 9

Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x2/phy.c

index 1848e8ab2e21cfb6332fd17259986d6b932dbff6..c7e71f2ba2a7c6ef1b615ce9a43d59ec97539ca2 100644 (file)
@@ -260,10 +260,15 @@ mt76x2_phy_set_gain_val(struct mt76x02_dev *dev)
        gain_val[0] = dev->cal.agc_gain_cur[0] - dev->cal.agc_gain_adjust;
        gain_val[1] = dev->cal.agc_gain_cur[1] - dev->cal.agc_gain_adjust;
 
-       if (dev->mt76.chandef.width >= NL80211_CHAN_WIDTH_40)
+       val = 0x1836 << 16;
+       if (!mt76x2_has_ext_lna(dev) &&
+           dev->mt76.chandef.width >= NL80211_CHAN_WIDTH_40)
                val = 0x1e42 << 16;
-       else
-               val = 0x1836 << 16;
+
+       if (mt76x2_has_ext_lna(dev) &&
+           dev->mt76.chandef.chan->band == NL80211_BAND_2GHZ &&
+           dev->mt76.chandef.width < NL80211_CHAN_WIDTH_40)
+               val = 0x0f36 << 16;
 
        val |= 0xf8;