blob: 61256ba57173b8aa969b4e98228619c3f53a68cb [file] [log] [blame]
developer42b63282022-06-16 13:33:13 +08001From ce19a95831eeb721ce52bb913ac52bd5a0d88bab Mon Sep 17 00:00:00 2001
developerec4ebe42022-04-12 11:17:45 +08002From: Shayne Chen <shayne.chen@mediatek.com>
3Date: Fri, 25 Feb 2022 09:36:01 +0800
developer42b63282022-06-16 13:33:13 +08004Subject: [PATCH 2/7] mt76: testmode: rework tx antenna setting
developerec4ebe42022-04-12 11:17:45 +08005
6---
7 mt7915/mcu.c | 7 +------
8 mt7915/testmode.c | 9 +--------
9 testmode.c | 4 ++--
10 3 files changed, 4 insertions(+), 16 deletions(-)
11
12diff --git a/mt7915/mcu.c b/mt7915/mcu.c
developer42b63282022-06-16 13:33:13 +080013index 2a88c14b..bdef2b37 100644
developerec4ebe42022-04-12 11:17:45 +080014--- a/mt7915/mcu.c
15+++ b/mt7915/mcu.c
developer42b63282022-06-16 13:33:13 +080016@@ -2933,14 +2933,9 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
developerec4ebe42022-04-12 11:17:45 +080017
18 #ifdef CONFIG_NL80211_TESTMODE
19 if (phy->mt76->test.tx_antenna_mask &&
20- (phy->mt76->test.state == MT76_TM_STATE_TX_FRAMES ||
21- phy->mt76->test.state == MT76_TM_STATE_RX_FRAMES ||
22- phy->mt76->test.state == MT76_TM_STATE_TX_CONT)) {
23+ mt76_testmode_enabled(phy->mt76)) {
24 req.tx_streams_num = fls(phy->mt76->test.tx_antenna_mask);
25 req.rx_streams = phy->mt76->test.tx_antenna_mask;
26-
27- if (phy != &dev->phy)
28- req.rx_streams >>= dev->chainshift;
29 }
30 #endif
31
32diff --git a/mt7915/testmode.c b/mt7915/testmode.c
33index 8d7ec9e8..d6f71436 100644
34--- a/mt7915/testmode.c
35+++ b/mt7915/testmode.c
36@@ -473,11 +473,7 @@ mt7915_tm_set_tx_frames(struct mt7915_phy *phy, bool en)
37 if (td->tx_spe_idx) {
38 phy->test.spe_idx = td->tx_spe_idx;
39 } else {
40- u8 tx_ant = td->tx_antenna_mask;
41-
42- if (phy != &dev->phy)
43- tx_ant >>= dev->chainshift;
44- phy->test.spe_idx = spe_idx_map[tx_ant];
45+ phy->test.spe_idx = spe_idx_map[td->tx_antenna_mask];
46 }
47 }
48
49@@ -728,9 +724,6 @@ mt7915_tm_set_params(struct mt76_phy *mphy, struct nlattr **tb,
50 td->state == MT76_TM_STATE_OFF)
51 return 0;
52
53- if (td->tx_antenna_mask & ~mphy->chainmask)
54- return -EINVAL;
55-
56 for (i = 0; i < ARRAY_SIZE(tm_change_map); i++) {
57 if (tb[tm_change_map[i]])
58 changed |= BIT(i);
59diff --git a/testmode.c b/testmode.c
60index 382b4563..7cd00794 100644
61--- a/testmode.c
62+++ b/testmode.c
63@@ -446,8 +446,8 @@ int mt76_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
64 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_LDPC], &td->tx_rate_ldpc, 0, 1) ||
65 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_STBC], &td->tx_rate_stbc, 0, 1) ||
66 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_LTF], &td->tx_ltf, 0, 2) ||
67- mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_ANTENNA],
68- &td->tx_antenna_mask, 0, 0xff) ||
69+ mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_ANTENNA], &td->tx_antenna_mask,
70+ 1, phy->antenna_mask) ||
71 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_SPE_IDX], &td->tx_spe_idx, 0, 27) ||
72 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_DUTY_CYCLE],
73 &td->tx_duty_cycle, 0, 99) ||
74--
752.18.0
76