Commit b61699d2 authored by Shayne Chen's avatar Shayne Chen Committed by Felix Fietkau

wifi: mt76: mt7915: rework testmode tx antenna setting

Let the configuration of testmode antenna mask on both band0 and band1
become antenna_mask rather than chainmask. This could simplify the
settings for user and get rid of the conversion when sending fw command.
Signed-off-by: default avatarShayne Chen <shayne.chen@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent ee0863ae
...@@ -2642,14 +2642,9 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd) ...@@ -2642,14 +2642,9 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
#ifdef CONFIG_NL80211_TESTMODE #ifdef CONFIG_NL80211_TESTMODE
if (phy->mt76->test.tx_antenna_mask && if (phy->mt76->test.tx_antenna_mask &&
(phy->mt76->test.state == MT76_TM_STATE_TX_FRAMES || mt76_testmode_enabled(phy->mt76)) {
phy->mt76->test.state == MT76_TM_STATE_RX_FRAMES ||
phy->mt76->test.state == MT76_TM_STATE_TX_CONT)) {
req.tx_path_num = fls(phy->mt76->test.tx_antenna_mask); req.tx_path_num = fls(phy->mt76->test.tx_antenna_mask);
req.rx_path = phy->mt76->test.tx_antenna_mask; req.rx_path = phy->mt76->test.tx_antenna_mask;
if (phy != &dev->phy)
req.rx_streams >>= dev->chainshift;
} }
#endif #endif
......
...@@ -447,15 +447,10 @@ mt7915_tm_set_tx_frames(struct mt7915_phy *phy, bool en) ...@@ -447,15 +447,10 @@ mt7915_tm_set_tx_frames(struct mt7915_phy *phy, bool en)
if (en) { if (en) {
mt7915_tm_update_channel(phy); mt7915_tm_update_channel(phy);
if (td->tx_spe_idx) { if (td->tx_spe_idx)
phy->test.spe_idx = td->tx_spe_idx; phy->test.spe_idx = td->tx_spe_idx;
} else { else
u8 tx_ant = td->tx_antenna_mask; phy->test.spe_idx = spe_idx_map[td->tx_antenna_mask];
if (phy != &dev->phy)
tx_ant >>= dev->chainshift;
phy->test.spe_idx = spe_idx_map[tx_ant];
}
} }
mt7915_tm_set_tam_arb(phy, en, mt7915_tm_set_tam_arb(phy, en,
...@@ -696,7 +691,9 @@ mt7915_tm_set_params(struct mt76_phy *mphy, struct nlattr **tb, ...@@ -696,7 +691,9 @@ mt7915_tm_set_params(struct mt76_phy *mphy, struct nlattr **tb,
{ {
struct mt76_testmode_data *td = &mphy->test; struct mt76_testmode_data *td = &mphy->test;
struct mt7915_phy *phy = mphy->priv; struct mt7915_phy *phy = mphy->priv;
u32 changed = 0; struct mt7915_dev *dev = phy->dev;
u32 chainmask = mphy->chainmask, changed = 0;
bool ext_phy = phy != &dev->phy;
int i; int i;
BUILD_BUG_ON(NUM_TM_CHANGED >= 32); BUILD_BUG_ON(NUM_TM_CHANGED >= 32);
...@@ -705,7 +702,8 @@ mt7915_tm_set_params(struct mt76_phy *mphy, struct nlattr **tb, ...@@ -705,7 +702,8 @@ mt7915_tm_set_params(struct mt76_phy *mphy, struct nlattr **tb,
td->state == MT76_TM_STATE_OFF) td->state == MT76_TM_STATE_OFF)
return 0; return 0;
if (td->tx_antenna_mask & ~mphy->chainmask) chainmask = ext_phy ? chainmask >> dev->chainshift : chainmask;
if (td->tx_antenna_mask > chainmask)
return -EINVAL; return -EINVAL;
for (i = 0; i < ARRAY_SIZE(tm_change_map); i++) { for (i = 0; i < ARRAY_SIZE(tm_change_map); i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment