developer | ec4ebe4 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 1 | From 63de755813ec9d82c785b4d70c4f59d5fb00ca69 Mon Sep 17 00:00:00 2001 |
| 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Fri, 4 Jun 2021 18:25:21 +0800 |
| 4 | Subject: [PATCH 1103/1112] mt76: mt7915: implement config set in testmode |
| 5 | |
| 6 | Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| 7 | --- |
| 8 | .../net/wireless/mediatek/mt76/mt7915/mcu.h | 4 +++ |
| 9 | .../wireless/mediatek/mt76/mt7915/testmode.c | 26 +++++++++++++++++++ |
| 10 | 2 files changed, 30 insertions(+) |
| 11 | |
| 12 | diff --git a/mt7915/mcu.h b/mt7915/mcu.h |
| 13 | index c15f89b..4b78468 100644 |
| 14 | --- a/mt7915/mcu.h |
| 15 | +++ b/mt7915/mcu.h |
| 16 | @@ -27,6 +27,10 @@ struct mt7915_mcu_txd { |
| 17 | |
| 18 | enum { |
| 19 | MCU_ATE_SET_TRX = 0x1, |
| 20 | + MCU_ATE_SET_TSSI = 0x5, |
| 21 | + MCU_ATE_SET_DPD = 0x6, |
| 22 | + MCU_ATE_SET_RATE_POWER_OFFSET = 0x7, |
| 23 | + MCU_ATE_SET_THERMAL_COMP = 0x8, |
| 24 | MCU_ATE_SET_FREQ_OFFSET = 0xa, |
| 25 | MCU_ATE_SET_PHY_COUNT = 0x11, |
| 26 | MCU_ATE_SET_SLOT_TIME = 0x13, |
| 27 | diff --git a/mt7915/testmode.c b/mt7915/testmode.c |
| 28 | index 2c859f6..98431d6 100644 |
| 29 | --- a/mt7915/testmode.c |
| 30 | +++ b/mt7915/testmode.c |
| 31 | @@ -9,6 +9,7 @@ |
| 32 | enum { |
| 33 | TM_CHANGED_TXPOWER, |
| 34 | TM_CHANGED_FREQ_OFFSET, |
| 35 | + TM_CHANGED_CFG, |
| 36 | |
| 37 | /* must be last */ |
| 38 | NUM_TM_CHANGED |
| 39 | @@ -17,6 +18,7 @@ enum { |
| 40 | static const u8 tm_change_map[] = { |
| 41 | [TM_CHANGED_TXPOWER] = MT76_TM_ATTR_TX_POWER, |
| 42 | [TM_CHANGED_FREQ_OFFSET] = MT76_TM_ATTR_FREQ_OFFSET, |
| 43 | + [TM_CHANGED_CFG] = MT76_TM_ATTR_CFG, |
| 44 | }; |
| 45 | |
| 46 | struct reg_band { |
| 47 | @@ -182,6 +184,28 @@ mt7915_tm_set_tam_arb(struct mt7915_phy *phy, bool enable, bool mu) |
| 48 | return mt7915_mcu_set_muru_ctrl(dev, MURU_SET_ARB_OP_MODE, op_mode); |
| 49 | } |
| 50 | |
| 51 | +static int |
| 52 | +mt7915_tm_set_cfg(struct mt7915_phy *phy) |
| 53 | +{ |
| 54 | + static const u8 cfg_cmd[] = { |
| 55 | + [MT76_TM_CFG_TSSI] = MCU_ATE_SET_TSSI, |
| 56 | + [MT76_TM_CFG_DPD] = MCU_ATE_SET_DPD, |
| 57 | + [MT76_TM_CFG_RATE_POWER_OFFSET] = MCU_ATE_SET_RATE_POWER_OFFSET, |
| 58 | + [MT76_TM_CFG_THERMAL_COMP] = MCU_ATE_SET_THERMAL_COMP, |
| 59 | + }; |
| 60 | + struct mt76_testmode_data *td = &phy->mt76->test; |
| 61 | + struct mt7915_dev *dev = phy->dev; |
| 62 | + struct mt7915_tm_cmd req = { |
| 63 | + .testmode_en = !(phy->mt76->test.state == MT76_TM_STATE_OFF), |
| 64 | + .param_idx = cfg_cmd[td->cfg.type], |
| 65 | + .param.cfg.enable = td->cfg.enable, |
| 66 | + .param.cfg.band = phy != &dev->phy, |
| 67 | + }; |
| 68 | + |
| 69 | + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req, |
| 70 | + sizeof(req), false); |
| 71 | +} |
| 72 | + |
| 73 | static int |
| 74 | mt7915_tm_set_wmm_qid(struct mt7915_dev *dev, u8 qid, u8 aifs, u8 cw_min, |
| 75 | u16 cw_max, u16 txop) |
| 76 | @@ -727,6 +751,8 @@ mt7915_tm_update_params(struct mt7915_phy *phy, u32 changed) |
| 77 | mt7915_tm_set_freq_offset(phy, en, en ? td->freq_offset : 0); |
| 78 | if (changed & BIT(TM_CHANGED_TXPOWER)) |
| 79 | mt7915_tm_set_tx_power(phy); |
| 80 | + if (changed & BIT(TM_CHANGED_CFG)) |
| 81 | + mt7915_tm_set_cfg(phy); |
| 82 | } |
| 83 | |
| 84 | static int |
| 85 | -- |
| 86 | 2.25.1 |
| 87 | |