developer | 42b6328 | 2022-06-16 13:33:13 +0800 | [diff] [blame^] | 1 | From ce19a95831eeb721ce52bb913ac52bd5a0d88bab Mon Sep 17 00:00:00 2001 |
developer | ec4ebe4 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Fri, 25 Feb 2022 09:36:01 +0800 |
developer | 42b6328 | 2022-06-16 13:33:13 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 2/7] mt76: testmode: rework tx antenna setting |
developer | ec4ebe4 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 5 | |
| 6 | --- |
| 7 | mt7915/mcu.c | 7 +------ |
| 8 | mt7915/testmode.c | 9 +-------- |
| 9 | testmode.c | 4 ++-- |
| 10 | 3 files changed, 4 insertions(+), 16 deletions(-) |
| 11 | |
| 12 | diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
developer | 42b6328 | 2022-06-16 13:33:13 +0800 | [diff] [blame^] | 13 | index 2a88c14b..bdef2b37 100644 |
developer | ec4ebe4 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 14 | --- a/mt7915/mcu.c |
| 15 | +++ b/mt7915/mcu.c |
developer | 42b6328 | 2022-06-16 13:33:13 +0800 | [diff] [blame^] | 16 | @@ -2933,14 +2933,9 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd) |
developer | ec4ebe4 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 17 | |
| 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 | |
| 32 | diff --git a/mt7915/testmode.c b/mt7915/testmode.c |
| 33 | index 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); |
| 59 | diff --git a/testmode.c b/testmode.c |
| 60 | index 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 | -- |
| 75 | 2.18.0 |
| 76 | |