developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 1 | From d49feab75f9fc7ffc5fd8b817b11c80251ec720c Mon Sep 17 00:00:00 2001 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 2 | From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 3 | Date: Fri, 24 Jun 2022 11:15:45 +0800 |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 4 | Subject: [PATCH] wifi: mt76: mt7915: add vendor subcmd EDCCA ctrl |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 5 | enable/threshold/compensation |
| 6 | |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 7 | --- |
| 8 | mt76_connac_mcu.h | 1 + |
| 9 | mt7915/main.c | 3 ++ |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 10 | mt7915/mcu.c | 72 +++++++++++++++++++++++++ |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 11 | mt7915/mcu.h | 21 ++++++++ |
| 12 | mt7915/mt7915.h | 3 +- |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 13 | mt7915/vendor.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++ |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 14 | mt7915/vendor.h | 33 ++++++++++++ |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 15 | 7 files changed, 264 insertions(+), 1 deletion(-) |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 16 | |
| 17 | diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 18 | index 09d41b5..10b6133 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 19 | --- a/mt76_connac_mcu.h |
| 20 | +++ b/mt76_connac_mcu.h |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 21 | @@ -1254,6 +1254,7 @@ enum { |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 22 | MCU_EXT_CMD_RX_STAT_USER_CTRL = 0xb3, |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 23 | MCU_EXT_CMD_SET_QOS_MAP = 0xb4, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 24 | MCU_EXT_CMD_CERT_CFG = 0xb7, |
| 25 | + MCU_EXT_CMD_EDCCA = 0xba, |
| 26 | MCU_EXT_CMD_CSI_CTRL = 0xc2, |
| 27 | MCU_EXT_CMD_IPI_HIST_SCAN = 0xc5, |
| 28 | }; |
| 29 | diff --git a/mt7915/main.c b/mt7915/main.c |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 30 | index b0e11f1..b1d7383 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 31 | --- a/mt7915/main.c |
| 32 | +++ b/mt7915/main.c |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 33 | @@ -479,6 +479,9 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed) |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 34 | mutex_unlock(&dev->mt76.mutex); |
| 35 | } |
| 36 | #endif |
| 37 | + ret = mt7915_mcu_set_edcca(phy, EDCCA_CTRL_SET_EN, NULL, 0); |
| 38 | + if (ret) |
| 39 | + return ret; |
| 40 | ieee80211_stop_queues(hw); |
| 41 | ret = mt7915_set_channel(phy); |
| 42 | if (ret) |
| 43 | diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 44 | index 0b5b3ae..0e04fc2 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 45 | --- a/mt7915/mcu.c |
| 46 | +++ b/mt7915/mcu.c |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 47 | @@ -5037,3 +5037,75 @@ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool w |
| 48 | |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 49 | return 0; |
| 50 | } |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 51 | + |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 52 | +int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation) |
| 53 | +{ |
| 54 | + static const u8 ch_band[] = { |
| 55 | + [NL80211_BAND_2GHZ] = 0, |
| 56 | + [NL80211_BAND_5GHZ] = 1, |
| 57 | + [NL80211_BAND_6GHZ] = 2, |
| 58 | + }; |
| 59 | + struct mt7915_dev *dev = phy->dev; |
| 60 | + struct cfg80211_chan_def *chandef = &phy->mt76->chandef; |
| 61 | + struct { |
| 62 | + u8 band_idx; |
| 63 | + u8 cmd_idx; |
| 64 | + u8 setting[3]; |
| 65 | + bool record_in_fw; |
| 66 | + u8 region; |
| 67 | + s8 thres_compensation; |
| 68 | + } __packed req = { |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 69 | + .band_idx = phy->mt76->band_idx, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 70 | + .cmd_idx = mode, |
| 71 | + .record_in_fw = false, |
| 72 | + .thres_compensation = compensation, |
| 73 | + }; |
| 74 | + |
| 75 | + if (ch_band[chandef->chan->band] == 2 && dev->mt76.region == NL80211_DFS_FCC) |
| 76 | + req.region = dev->mt76.region; |
| 77 | + |
| 78 | + if (mode == EDCCA_CTRL_SET_EN) { |
| 79 | + req.setting[0] = (!value)? EDCCA_MODE_AUTO: value[0]; |
| 80 | + } else if (mode == EDCCA_CTRL_SET_THERS) { |
| 81 | + req.setting[0] = value[0]; |
| 82 | + req.setting[1] = value[1]; |
| 83 | + req.setting[2] = value[2]; |
| 84 | + } else { |
| 85 | + return -EINVAL; |
| 86 | + } |
| 87 | + |
| 88 | + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EDCCA), &req, sizeof(req), true); |
| 89 | +} |
| 90 | + |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 91 | +int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value) |
| 92 | +{ |
| 93 | + struct mt7915_dev *dev = phy->dev; |
| 94 | + struct { |
| 95 | + u8 band_idx; |
| 96 | + u8 cmd_idx; |
| 97 | + u8 setting[3]; |
| 98 | + bool record_in_fw; |
| 99 | + u8 region; |
| 100 | + s8 thres_compensation; |
| 101 | + } __packed req = { |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 102 | + .band_idx = phy->mt76->band_idx, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 103 | + .cmd_idx = mode, |
| 104 | + .record_in_fw = false, |
| 105 | + }; |
| 106 | + struct sk_buff *skb; |
| 107 | + int ret; |
| 108 | + struct mt7915_mcu_edcca_info *res; |
| 109 | + |
| 110 | + ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_CMD(EDCCA), &req, sizeof(req), |
| 111 | + true, &skb); |
| 112 | + if (ret) |
| 113 | + return ret; |
| 114 | + |
| 115 | + res = (struct mt7915_mcu_edcca_info *)skb->data; |
| 116 | + *value++ = res->info[0]; |
| 117 | + *value++ = res->info[1]; |
| 118 | + *value = res->info[2]; |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 119 | + dev_kfree_skb(skb); |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 120 | + |
| 121 | + return 0; |
| 122 | +} |
| 123 | diff --git a/mt7915/mcu.h b/mt7915/mcu.h |
developer | dc9eeae | 2024-04-08 14:36:46 +0800 | [diff] [blame] | 124 | index de17c57..1682c11 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 125 | --- a/mt7915/mcu.h |
| 126 | +++ b/mt7915/mcu.h |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 127 | @@ -1128,6 +1128,27 @@ enum { |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 128 | MURU_DL_INIT, |
| 129 | MURU_UL_INIT, |
| 130 | }; |
| 131 | + |
| 132 | +enum { |
| 133 | + EDCCA_CTRL_SET_EN = 0, |
| 134 | + EDCCA_CTRL_SET_THERS, |
| 135 | + EDCCA_CTRL_GET_EN, |
| 136 | + EDCCA_CTRL_GET_THERS, |
| 137 | + EDCCA_CTRL_NUM, |
| 138 | +}; |
| 139 | + |
| 140 | +enum { |
| 141 | + EDCCA_MODE_FORCE_DISABLE, |
| 142 | + EDCCA_MODE_AUTO, |
| 143 | +}; |
| 144 | + |
| 145 | +struct mt7915_mcu_edcca_info { |
| 146 | + u8 cmd_idx; |
| 147 | + u8 band_idx; |
| 148 | + u8 info[3]; |
| 149 | + u8 fginit; |
| 150 | + u8 rsv[2]; |
| 151 | +}; |
| 152 | #endif |
| 153 | |
| 154 | #endif |
| 155 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 156 | index 64cfa2e..141c151 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 157 | --- a/mt7915/mt7915.h |
| 158 | +++ b/mt7915/mt7915.h |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 159 | @@ -789,7 +789,8 @@ void mt7915_vendor_amnt_fill_rx(struct mt7915_phy *phy, struct sk_buff *skb); |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 160 | int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy, |
| 161 | struct ieee80211_sta *sta); |
| 162 | #endif |
| 163 | - |
| 164 | +int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation); |
| 165 | +int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value); |
| 166 | int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp); |
| 167 | int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp); |
| 168 | |
| 169 | diff --git a/mt7915/vendor.c b/mt7915/vendor.c |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 170 | index 9e8d244..aaa0cf1 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 171 | --- a/mt7915/vendor.c |
| 172 | +++ b/mt7915/vendor.c |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 173 | @@ -64,6 +64,24 @@ phy_capa_dump_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP] = { |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 174 | [MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA] = { .type = NLA_U16 }, |
| 175 | }; |
| 176 | |
| 177 | +static const struct nla_policy |
| 178 | +edcca_ctrl_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL] = { |
| 179 | + [MTK_VENDOR_ATTR_EDCCA_CTRL_MODE] = { .type = NLA_U8 }, |
| 180 | + [MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] = { .type = NLA_U8 }, |
| 181 | + [MTK_VENDOR_ATTR_EDCCA_CTRL_SEC20_VAL] = { .type = NLA_U8 }, |
| 182 | + [MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL] = { .type = NLA_U8 }, |
| 183 | + [MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL] = { .type = NLA_U8 }, |
| 184 | + [MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE] = { .type = NLA_S8 }, |
| 185 | +}; |
| 186 | + |
| 187 | +static const struct nla_policy |
| 188 | +edcca_dump_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP] = { |
| 189 | + [MTK_VENDOR_ATTR_EDCCA_DUMP_MODE] = { .type = NLA_U8 }, |
| 190 | + [MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL] = { .type = NLA_U8 }, |
| 191 | + [MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL] = { .type = NLA_U8 }, |
| 192 | + [MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL] = { .type = NLA_U8 }, |
| 193 | +}; |
| 194 | + |
| 195 | struct csi_null_tone { |
| 196 | u8 start; |
| 197 | u8 end; |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 198 | @@ -1172,6 +1190,108 @@ mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 199 | return len; |
| 200 | } |
| 201 | |
| 202 | +static int mt7915_vendor_edcca_ctrl(struct wiphy *wiphy, |
| 203 | + struct wireless_dev *wdev, |
| 204 | + const void *data, |
| 205 | + int data_len) |
| 206 | +{ |
| 207 | + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
| 208 | + struct mt7915_phy *phy = mt7915_hw_phy(hw); |
| 209 | + struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL]; |
| 210 | + int err; |
| 211 | + u8 edcca_mode; |
| 212 | + s8 edcca_compensation; |
| 213 | + u8 edcca_value[EDCCA_THRES_NUM] = {0}; |
| 214 | + |
| 215 | + err = nla_parse(tb, MTK_VENDOR_ATTR_EDCCA_CTRL_MAX, data, data_len, |
| 216 | + edcca_ctrl_policy, NULL); |
| 217 | + if (err) |
| 218 | + return err; |
| 219 | + |
| 220 | + if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE]) |
| 221 | + return -EINVAL; |
| 222 | + |
| 223 | + edcca_mode = nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE]); |
| 224 | + if (edcca_mode == EDCCA_CTRL_SET_EN) { |
| 225 | + if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] || |
| 226 | + !tb[MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE]) { |
| 227 | + return -EINVAL; |
| 228 | + } |
| 229 | + edcca_value[0] = |
| 230 | + nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL]); |
| 231 | + edcca_compensation = |
| 232 | + nla_get_s8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE]); |
| 233 | + |
| 234 | + err = mt7915_mcu_set_edcca(phy, edcca_mode, edcca_value, |
| 235 | + edcca_compensation); |
| 236 | + if (err) |
| 237 | + return err; |
| 238 | + } else if (edcca_mode == EDCCA_CTRL_SET_THERS) { |
| 239 | + if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] || |
| 240 | + !tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL] || |
| 241 | + !tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL]) { |
| 242 | + return -EINVAL; |
| 243 | + } |
| 244 | + edcca_value[0] = |
| 245 | + nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL]); |
| 246 | + edcca_value[1] = |
| 247 | + nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL]); |
| 248 | + edcca_value[2] = |
| 249 | + nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL]); |
| 250 | + err = mt7915_mcu_set_edcca(phy, edcca_mode, edcca_value, |
| 251 | + edcca_compensation); |
| 252 | + if (err) |
| 253 | + return err; |
| 254 | + } else { |
| 255 | + return -EINVAL; |
| 256 | + } |
| 257 | + |
| 258 | + return 0; |
| 259 | +} |
| 260 | + |
| 261 | +static int |
| 262 | +mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 263 | + struct sk_buff *skb, const void *data, int data_len, |
| 264 | + unsigned long *storage) |
| 265 | +{ |
| 266 | + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
| 267 | + struct mt7915_phy *phy = mt7915_hw_phy(hw); |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 268 | + struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL]; |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 269 | + int len = EDCCA_THRES_NUM; |
| 270 | + int err; |
| 271 | + u8 edcca_mode; |
| 272 | + s8 value[EDCCA_THRES_NUM]; |
| 273 | + |
| 274 | + if (*storage == 1) |
| 275 | + return -ENOENT; |
| 276 | + *storage = 1; |
| 277 | + |
| 278 | + err = nla_parse(tb, MTK_VENDOR_ATTR_EDCCA_CTRL_MAX, data, data_len, |
| 279 | + edcca_ctrl_policy, NULL); |
| 280 | + if (err) |
| 281 | + return err; |
| 282 | + |
| 283 | + if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE]) |
| 284 | + return -EINVAL; |
| 285 | + |
| 286 | + edcca_mode = nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE]); |
| 287 | + if (edcca_mode == EDCCA_CTRL_GET_EN || edcca_mode == EDCCA_CTRL_GET_THERS) { |
| 288 | + err = mt7915_mcu_get_edcca(phy, edcca_mode, value); |
| 289 | + } else { |
| 290 | + return -EINVAL; |
| 291 | + } |
| 292 | + |
| 293 | + if (err) |
| 294 | + return err; |
| 295 | + |
| 296 | + if (nla_put_u8(skb, MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL, value[0]) || |
| 297 | + nla_put_u8(skb, MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL, value[1]) || |
| 298 | + nla_put_u8(skb, MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL, value[2])) |
| 299 | + return -ENOMEM; |
| 300 | + |
| 301 | + return len; |
| 302 | +} |
| 303 | + |
| 304 | static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
| 305 | { |
| 306 | .info = { |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 307 | @@ -1240,6 +1360,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 308 | .dumpit = mt7915_vendor_phy_capa_ctrl_dump, |
| 309 | .policy = phy_capa_ctrl_policy, |
| 310 | .maxattr = MTK_VENDOR_ATTR_PHY_CAPA_CTRL_MAX, |
| 311 | + }, |
| 312 | + { |
| 313 | + .info = { |
| 314 | + .vendor_id = MTK_NL80211_VENDOR_ID, |
| 315 | + .subcmd = MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL, |
| 316 | + }, |
| 317 | + .flags = WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 318 | + WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 319 | + .doit = mt7915_vendor_edcca_ctrl, |
| 320 | + .dumpit = mt7915_vendor_edcca_ctrl_dump, |
| 321 | + .policy = edcca_ctrl_policy, |
| 322 | + .maxattr = MTK_VENDOR_ATTR_EDCCA_CTRL_MAX, |
| 323 | } |
| 324 | }; |
| 325 | |
| 326 | diff --git a/mt7915/vendor.h b/mt7915/vendor.h |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 327 | index e58884c..c8d30b5 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 328 | --- a/mt7915/vendor.h |
| 329 | +++ b/mt7915/vendor.h |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 330 | @@ -3,6 +3,7 @@ |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 331 | #define __MT7915_VENDOR_H |
| 332 | |
| 333 | #define MTK_NL80211_VENDOR_ID 0x0ce7 |
| 334 | +#define EDCCA_THRES_NUM 3 |
| 335 | |
| 336 | enum mtk_nl80211_vendor_subcmds { |
| 337 | MTK_NL80211_VENDOR_SUBCMD_AMNT_CTRL = 0xae, |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 338 | @@ -11,6 +12,38 @@ enum mtk_nl80211_vendor_subcmds { |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 339 | MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL = 0xc4, |
developer | 2c78ce7 | 2023-02-24 11:26:12 +0800 | [diff] [blame] | 340 | MTK_NL80211_VENDOR_SUBCMD_MU_CTRL = 0xc5, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 341 | MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6, |
| 342 | + MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7, |
| 343 | +}; |
| 344 | + |
| 345 | + |
| 346 | +enum mtk_vendor_attr_edcca_ctrl { |
| 347 | + MTK_VENDOR_ATTR_EDCCA_THRESHOLD_INVALID = 0, |
| 348 | + |
| 349 | + MTK_VENDOR_ATTR_EDCCA_CTRL_MODE, |
| 350 | + MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL, |
| 351 | + MTK_VENDOR_ATTR_EDCCA_CTRL_SEC20_VAL, |
| 352 | + MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL, |
| 353 | + MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL, |
| 354 | + MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE, |
| 355 | + |
| 356 | + /* keep last */ |
| 357 | + NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL, |
| 358 | + MTK_VENDOR_ATTR_EDCCA_CTRL_MAX = |
| 359 | + NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL - 1 |
| 360 | +}; |
| 361 | + |
| 362 | +enum mtk_vendor_attr_edcca_dump { |
| 363 | + MTK_VENDOR_ATTR_EDCCA_DUMP_UNSPEC = 0, |
| 364 | + |
| 365 | + MTK_VENDOR_ATTR_EDCCA_DUMP_MODE, |
| 366 | + MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL, |
| 367 | + MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL, |
| 368 | + MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL, |
| 369 | + |
| 370 | + /* keep last */ |
| 371 | + NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP, |
| 372 | + MTK_VENDOR_ATTR_EDCCA_DUMP_MAX = |
| 373 | + NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP - 1 |
| 374 | }; |
| 375 | |
| 376 | enum mtk_capi_control_changed { |
| 377 | -- |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 378 | 2.18.0 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 379 | |