developer | f11ee16 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 1 | From fdf988d26cbea1d432e6cfb9a0ca82c160101771 Mon Sep 17 00:00:00 2001 |
| 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Fri, 4 Jun 2021 18:22:07 +0800 |
| 4 | Subject: [PATCH 1102/1112] mt76: testmode: add attributes for setting rf |
| 5 | config |
| 6 | |
| 7 | Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| 8 | --- |
| 9 | drivers/net/wireless/mediatek/mt76/mt76.h | 5 ++++ |
| 10 | drivers/net/wireless/mediatek/mt76/testmode.c | 17 +++++++++++++- |
| 11 | drivers/net/wireless/mediatek/mt76/testmode.h | 23 +++++++++++++++++++ |
| 12 | 3 files changed, 44 insertions(+), 1 deletion(-) |
| 13 | |
| 14 | diff --git a/mt76.h b/mt76.h |
| 15 | index 8ad7674..157fd6d 100644 |
| 16 | --- a/mt76.h |
| 17 | +++ b/mt76.h |
| 18 | @@ -619,6 +619,11 @@ struct mt76_testmode_data { |
| 19 | |
| 20 | u8 flag; |
| 21 | |
| 22 | + struct { |
| 23 | + u8 type; |
| 24 | + u8 enable; |
| 25 | + } cfg; |
| 26 | + |
| 27 | u32 tx_pending; |
| 28 | u32 tx_queued; |
| 29 | u16 tx_queued_limit; |
| 30 | diff --git a/testmode.c b/testmode.c |
| 31 | index 1fbca66..f31e124 100644 |
| 32 | --- a/testmode.c |
| 33 | +++ b/testmode.c |
| 34 | @@ -547,7 +547,22 @@ int mt76_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 35 | if (nla_len(cur) != ETH_ALEN || idx >= 3) |
| 36 | goto out; |
| 37 | |
| 38 | - memcpy(td->addr[idx], nla_data(cur), ETH_ALEN); |
| 39 | + memcpy(td->addr[idx++], nla_data(cur), ETH_ALEN); |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + if (tb[MT76_TM_ATTR_CFG]) { |
| 44 | + struct nlattr *cur; |
| 45 | + int rem, idx = 0; |
| 46 | + |
| 47 | + nla_for_each_nested(cur, tb[MT76_TM_ATTR_CFG], rem) { |
| 48 | + if (nla_len(cur) != 1 || idx >= 2) |
| 49 | + goto out; |
| 50 | + |
| 51 | + if (idx == 0) |
| 52 | + td->cfg.type = nla_get_u8(cur); |
| 53 | + else |
| 54 | + td->cfg.enable = nla_get_u8(cur); |
| 55 | idx++; |
| 56 | } |
| 57 | } |
| 58 | diff --git a/testmode.h b/testmode.h |
| 59 | index 5900c76..c469ce6 100644 |
| 60 | --- a/testmode.h |
| 61 | +++ b/testmode.h |
| 62 | @@ -55,6 +55,8 @@ |
| 63 | * @MT76_TM_ATTR_EEPROM_VAL: values for writing into a 16-byte data block |
| 64 | * (nested, u8 attrs) |
| 65 | * |
| 66 | + * @MT76_TM_ATTR_CFG: config testmode rf feature (nested, see &mt76_testmode_cfg) |
| 67 | + * |
| 68 | */ |
| 69 | enum mt76_testmode_attr { |
| 70 | MT76_TM_ATTR_UNSPEC, |
| 71 | @@ -97,6 +99,8 @@ enum mt76_testmode_attr { |
| 72 | MT76_TM_ATTR_EEPROM_OFFSET, |
| 73 | MT76_TM_ATTR_EEPROM_VAL, |
| 74 | |
| 75 | + MT76_TM_ATTR_CFG, |
| 76 | + |
| 77 | /* keep last */ |
| 78 | NUM_MT76_TM_ATTRS, |
| 79 | MT76_TM_ATTR_MAX = NUM_MT76_TM_ATTRS - 1, |
| 80 | @@ -228,4 +232,23 @@ enum mt76_testmode_eeprom_action { |
| 81 | MT76_TM_EEPROM_ACTION_MAX = NUM_MT76_TM_EEPROM_ACTION - 1, |
| 82 | }; |
| 83 | |
| 84 | +/** |
| 85 | + * enum mt76_testmode_cfg - packet tx phy mode |
| 86 | + * |
| 87 | + * @MT76_TM_EEPROM_ACTION_UPDATE_DATA: update rf values to specific |
| 88 | + * eeprom data block |
| 89 | + * @MT76_TM_EEPROM_ACTION_UPDATE_BUFFER_MODE: send updated eeprom data to fw |
| 90 | + * @MT76_TM_EEPROM_ACTION_WRITE_TO_EFUSE: write eeprom data back to efuse |
| 91 | + */ |
| 92 | +enum mt76_testmode_cfg { |
| 93 | + MT76_TM_CFG_TSSI, |
| 94 | + MT76_TM_CFG_DPD, |
| 95 | + MT76_TM_CFG_RATE_POWER_OFFSET, |
| 96 | + MT76_TM_CFG_THERMAL_COMP, |
| 97 | + |
| 98 | + /* keep last */ |
| 99 | + NUM_MT76_TM_CFG, |
| 100 | + MT76_TM_CFG_MAX = NUM_MT76_TM_CFG - 1, |
| 101 | +}; |
| 102 | + |
| 103 | #endif |
| 104 | -- |
| 105 | 2.25.1 |
| 106 | |