blob: 9662e573484b185685d0c9095e1f977dc1e4b982 [file] [log] [blame]
developerfc95e332022-10-25 16:32:43 +08001From 508127725db04741df06adee31b2cadf53ef11f6 Mon Sep 17 00:00:00 2001
2From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Tue, 25 Oct 2022 14:22:52 +0800
4Subject: [PATCH] Fix parameter in channel switch mcu command. use Tx path
5 instead of Tx stream in mt7915_set_chan_info().
6
7Change-Id: Ia5e7da735dbe0c5f702352ad58ea69277096e54a
8---
9 mt7915/main.c | 8 ++++----
10 mt7915/mcu.c | 16 ++++++++--------
11 2 files changed, 12 insertions(+), 12 deletions(-)
12
13diff --git a/mt7915/main.c b/mt7915/main.c
14index 01d64b2f..aa18e557 100644
15--- a/mt7915/main.c
16+++ b/mt7915/main.c
17@@ -1016,7 +1016,7 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
18 struct mt7915_dev *dev = mt7915_hw_dev(hw);
19 struct mt7915_phy *phy = mt7915_hw_phy(hw);
20 int max_nss = hweight8(hw->wiphy->available_antennas_tx);
21- bool ext_phy = phy != &dev->phy;
22+ u8 chainshift = dev->chainshift;
23
24 if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss)
25 return -EINVAL;
26@@ -1026,10 +1026,10 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
27 phy->mt76->antenna_mask = tx_ant;
28
29 /* handle a variant of mt7916 which has 3T3R but nss2 on 5 GHz band */
30- if (is_mt7916(&dev->mt76) && ext_phy && hweight8(tx_ant) == max_nss)
31- phy->mt76->chainmask = dev->chainmask >> dev->chainshift;
32+ if (is_mt7916(&dev->mt76) && phy->band_idx && hweight8(tx_ant) == max_nss)
33+ phy->mt76->chainmask = (dev->chainmask >> chainshift) << chainshift;
34 else
35- phy->mt76->chainmask = tx_ant << (dev->chainshift * ext_phy);
36+ phy->mt76->chainmask = tx_ant << (chainshift * phy->band_idx);
37
38 mt76_set_stream_caps(phy->mt76, true);
39 mt7915_set_stream_vht_txbf_caps(phy);
40diff --git a/mt7915/mcu.c b/mt7915/mcu.c
41index 38a08b9a..b8f06957 100644
42--- a/mt7915/mcu.c
43+++ b/mt7915/mcu.c
44@@ -2776,8 +2776,8 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
45 u8 control_ch;
46 u8 center_ch;
47 u8 bw;
48- u8 tx_streams_num;
49- u8 rx_streams; /* mask or num */
50+ u8 tx_path_num;
51+ u8 rx_path; /* mask or num */
52 u8 switch_reason;
53 u8 band_idx;
54 u8 center_ch2; /* for 80+80 only */
55@@ -2793,8 +2793,8 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
56 .control_ch = chandef->chan->hw_value,
57 .center_ch = ieee80211_frequency_to_channel(freq1),
58 .bw = mt76_connac_chan_bw(chandef),
59- .tx_streams_num = hweight8(phy->mt76->antenna_mask),
60- .rx_streams = phy->mt76->antenna_mask,
61+ .tx_path_num = hweight16(phy->mt76->chainmask),
62+ .rx_path = phy->mt76->chainmask >> (dev->chainshift * phy->band_idx),
63 .band_idx = phy->band_idx,
64 .channel_band = ch_band[chandef->chan->band],
65 };
66@@ -2802,13 +2802,13 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
67 #ifdef CONFIG_NL80211_TESTMODE
68 if (phy->mt76->test.tx_antenna_mask &&
69 mt76_testmode_enabled(phy->mt76)) {
70- req.tx_streams_num = fls(phy->mt76->test.tx_antenna_mask);
71- req.rx_streams = phy->mt76->test.tx_antenna_mask;
72+ req.tx_path_num = fls(phy->mt76->test.tx_antenna_mask);
73+ req.rx_path = phy->mt76->test.tx_antenna_mask;
74 }
75 #endif
76
77 if (mt76_connac_spe_idx(phy->mt76->antenna_mask))
78- req.tx_streams_num = fls(phy->mt76->antenna_mask);
79+ req.tx_path_num = fls(phy->mt76->antenna_mask);
80
81 if (cmd == MCU_EXT_CMD(SET_RX_PATH) ||
82 dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
83@@ -2822,7 +2822,7 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
84 req.switch_reason = CH_SWITCH_NORMAL;
85
86 if (cmd == MCU_EXT_CMD(CHANNEL_SWITCH))
87- req.rx_streams = hweight8(req.rx_streams);
88+ req.rx_path = hweight8(req.rx_path);
89
90 if (chandef->width == NL80211_CHAN_WIDTH_80P80) {
91 int freq2 = chandef->center_freq2;
92--
932.18.0
94