developer | 7af62e7 | 2022-12-26 16:10:38 +0800 | [diff] [blame] | 1 | From 36dcb418d47fb74f7a5a6fb276ff2fee63f4533a Mon Sep 17 00:00:00 2001 |
| 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Wed, 30 Nov 2022 23:18:03 +0800 |
| 4 | Subject: [PATCH 1/7] wifi: mt76: mt7996: fix chainmask calculation in |
| 5 | mt7996_set_antenna() |
| 6 | |
| 7 | Fix per-band chainmask when restoring from the dev chainmask. |
| 8 | |
| 9 | Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") |
| 10 | Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| 11 | Change-Id: Idf607cfdfb342fd283d2911231262f0f74994360 |
| 12 | --- |
| 13 | mt7996/main.c | 5 ++++- |
| 14 | 1 file changed, 4 insertions(+), 1 deletion(-) |
| 15 | |
| 16 | diff --git a/mt7996/main.c b/mt7996/main.c |
| 17 | index 4421cd5..c423b05 100644 |
| 18 | --- a/mt7996/main.c |
| 19 | +++ b/mt7996/main.c |
| 20 | @@ -880,7 +880,10 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) |
| 21 | phy->mt76->antenna_mask = tx_ant; |
| 22 | |
| 23 | /* restore to the origin chainmask which might have auxiliary path */ |
| 24 | - if (hweight8(tx_ant) == max_nss) |
| 25 | + if (hweight8(tx_ant) == max_nss && band_idx < MT_BAND2) |
| 26 | + phy->mt76->chainmask = ((dev->chainmask >> shift) & |
| 27 | + (BIT(dev->chainshift[band_idx + 1] - shift) - 1)) << shift; |
| 28 | + else if (hweight8(tx_ant) == max_nss) |
| 29 | phy->mt76->chainmask = (dev->chainmask >> shift) << shift; |
| 30 | else |
| 31 | phy->mt76->chainmask = tx_ant << shift; |
| 32 | -- |
| 33 | 2.36.1 |
| 34 | |