summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2019-03-03 15:10:00 +0100
committerFelix Fietkau <nbd@nbd.name>2019-03-07 12:50:23 +0100
commit45a042e3026824a7e910db7a4dd38fef0540b902 (patch)
tree97c665cc5e9357e4df26b9b6cea26f007d71d710 /drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
parent7635276989a183bdb424f9e930f836b6264d54dc (diff)
mt76: mt76x2: fix external LNA gain settings
Devices with external LNA need different values for AGC registers 8 and 9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76x2/phy.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/phy.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
index 1848e8ab2e21..c7e71f2ba2a7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
@@ -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;