Linux-Wireless Archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] wifi: mt76: mt7915: fix EEPROM offset of TSSI flag on MT7981
@ 2023-11-06 22:38 Daniel Golle
  2023-11-06 22:39 ` [PATCH 2/2] wifi: mt76: mt7915: also MT7981 is 3T3R but nss2 on 5 GHz band Daniel Golle
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Golle @ 2023-11-06 22:38 UTC (permalink / raw
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Kalle Valo, Matthias Brugger,
	AngeloGioacchino Del Regno, Daniel Golle, StanleyYP Wang,
	Peter Chiu, Howard Hsu, Rany Hany, Simon Horman,
	Alexander Couzens, linux-wireless, linux-kernel, linux-arm-kernel,
	linux-mediatek

From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>

The offset of the TSSI flag on the EEPROM of MT7981 devices was wrong.
Set the correct offset instead.

Fixes: 6bad146d162e ("wifi: mt76: mt7915: add support for MT7981")
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h
index f3e56817d36e9..adc26a222823b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h
@@ -144,7 +144,8 @@ static inline bool
 mt7915_tssi_enabled(struct mt7915_dev *dev, enum nl80211_band band)
 {
 	u8 *eep = dev->mt76.eeprom.data;
-	u8 val = eep[MT_EE_WIFI_CONF + 7];
+	u8 offs = is_mt7981(&dev->mt76) ? 8 : 7;
+	u8 val = eep[MT_EE_WIFI_CONF + offs];
 
 	if (band == NL80211_BAND_2GHZ)
 		return val & MT_EE_WIFI_CONF7_TSSI0_2G;
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] wifi: mt76: mt7915: also MT7981 is 3T3R but nss2 on 5 GHz band
  2023-11-06 22:38 [PATCH 1/2] wifi: mt76: mt7915: fix EEPROM offset of TSSI flag on MT7981 Daniel Golle
@ 2023-11-06 22:39 ` Daniel Golle
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Golle @ 2023-11-06 22:39 UTC (permalink / raw
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Kalle Valo, Matthias Brugger,
	AngeloGioacchino Del Regno, Daniel Golle, StanleyYP Wang,
	Peter Chiu, Howard Hsu, Rany Hany, Simon Horman,
	Alexander Couzens, linux-wireless, linux-kernel, linux-arm-kernel,
	linux-mediatek

From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>

Just like MT7916 also MT7981 can handle 3T3R DBDC frontend and should
hence be included in the corresponding conditional expression in the
driver. Add it.

Fixes: 6bad146d162e ("wifi: mt76: mt7915: add support for MT7981")
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/wireless/mediatek/mt76/mt7915/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index 8ebbf186fab23..e667de50ece23 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -1045,8 +1045,9 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
 
 	phy->mt76->antenna_mask = tx_ant;
 
-	/* handle a variant of mt7916 which has 3T3R but nss2 on 5 GHz band */
-	if (is_mt7916(&dev->mt76) && band && hweight8(tx_ant) == max_nss)
+	/* handle a variant of mt7916/mt7981 which has 3T3R but nss2 on 5 GHz band */
+	if ((is_mt7916(&dev->mt76) || is_mt7981(&dev->mt76)) &&
+	    band && hweight8(tx_ant) == max_nss)
 		phy->mt76->chainmask = (dev->chainmask >> chainshift) << chainshift;
 	else
 		phy->mt76->chainmask = tx_ant << (chainshift * band);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-06 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-06 22:38 [PATCH 1/2] wifi: mt76: mt7915: fix EEPROM offset of TSSI flag on MT7981 Daniel Golle
2023-11-06 22:39 ` [PATCH 2/2] wifi: mt76: mt7915: also MT7981 is 3T3R but nss2 on 5 GHz band Daniel Golle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).