[][MAC80211][MT76][Add mtk vendor subcmd EDCCA control]

[Description]
Add mtk vendor subcmd EDCCA_CTRL to control/dump EDCCA
enable/threshold/compensation.

[Release-log]
N/A

Change-Id: Ia04454cd2035adc62d6ea03c2cd7cb2cece46972
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6752420
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/1120-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/1120-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl.patch
index 97002bb..d1c487a 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/1120-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/1120-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl.patch
@@ -1,18 +1,19 @@
-From b3325580c9d1f3503582323e0787de7f28d49b58 Mon Sep 17 00:00:00 2001
+From a7682d61851c686f78273df7a9926203c8e17ee9 Mon Sep 17 00:00:00 2001
 From: Howard Hsu <howard-yh.hsu@mediatek.com>
 Date: Fri, 24 Jun 2022 11:15:45 +0800
-Subject: [PATCH 1120/1128] mt76: mt7915: add vendor subcmd EDCCA ctrl
+Subject: [PATCH] mt76: mt7915: add vendor subcmd EDCCA ctrl
+ enable/threshold/compensation
 
-Change-Id: I92dabf8be9c5a7ecec78f35325bc5645af8d15ab
+Change-Id: I06a3f94d5e444be894200e2b6588d76ed38d09d0
 ---
- mt76_connac_mcu.h |  1 +
- mt7915/main.c     |  3 +++
- mt7915/mcu.c      | 38 ++++++++++++++++++++++++++++
- mt7915/mcu.h      | 13 ++++++++++
- mt7915/mt7915.h   |  2 ++
- mt7915/vendor.c   | 63 +++++++++++++++++++++++++++++++++++++++++++++++
- mt7915/vendor.h   | 19 ++++++++++++++
- 7 files changed, 139 insertions(+)
+ mt76_connac_mcu.h |   1 +
+ mt7915/main.c     |   3 ++
+ mt7915/mcu.c      |  72 +++++++++++++++++++++++++
+ mt7915/mcu.h      |  21 ++++++++
+ mt7915/mt7915.h   |   3 +-
+ mt7915/vendor.c   | 134 ++++++++++++++++++++++++++++++++++++++++++++++
+ mt7915/vendor.h   |  33 ++++++++++++
+ 7 files changed, 266 insertions(+), 1 deletion(-)
 
 diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
 index a31b85f0..bceb6799 100644
@@ -41,16 +42,15 @@
  		ret = mt7915_set_channel(phy);
  		if (ret)
 diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index e03ec9e3..8fc40c5a 100644
+index e03ec9e3..67304c84 100644
 --- a/mt7915/mcu.c
 +++ b/mt7915/mcu.c
-@@ -4282,3 +4282,41 @@ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool w
+@@ -4282,3 +4282,75 @@ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool w
  
  	return 0;
  }
 +
-+int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value,
-+			 s8 compensation)
++int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation)
 +{
 +	static const u8 ch_band[] = {
 +		[NL80211_BAND_2GHZ] = 0,
@@ -70,27 +70,62 @@
 +		.band_idx = phy->band_idx,
 +		.cmd_idx = mode,
 +		.record_in_fw = false,
-+		.region = dev->mt76.region,
 +		.thres_compensation = compensation,
 +	};
 +
-+	if (ch_band[chandef->chan->band] != 2)
-+		return 0;
++	if (ch_band[chandef->chan->band] == 2 && dev->mt76.region == NL80211_DFS_FCC)
++		req.region = dev->mt76.region;
 +
 +	if (mode == EDCCA_CTRL_SET_EN) {
-+		if (!value)
-+			req.setting[0] = EDCCA_MODE_AUTO;
-+		else
-+			req.setting[0] = value[0];
++		req.setting[0] = (!value)? EDCCA_MODE_AUTO: value[0];
++	} else if (mode == EDCCA_CTRL_SET_THERS) {
++		req.setting[0] = value[0];
++		req.setting[1] = value[1];
++		req.setting[2] = value[2];
++	} else {
++		return -EINVAL;
 +	}
 +
 +	return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EDCCA), &req, sizeof(req), true);
 +}
++
++
++int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value)
++{
++	struct mt7915_dev *dev = phy->dev;
++	struct {
++		u8 band_idx;
++		u8 cmd_idx;
++		u8 setting[3];
++		bool record_in_fw;
++		u8 region;
++		s8 thres_compensation;
++	} __packed req = {
++		.band_idx = phy->band_idx,
++		.cmd_idx = mode,
++		.record_in_fw = false,
++	};
++	struct sk_buff *skb;
++	int ret;
++	struct mt7915_mcu_edcca_info *res;
++
++	ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_CMD(EDCCA), &req, sizeof(req),
++				        true, &skb);
++	if (ret)
++		return ret;
++
++	res = (struct mt7915_mcu_edcca_info *)skb->data;
++	*value++ = res->info[0];
++	*value++ = res->info[1];
++	*value = res->info[2];
++
++	return 0;
++}
 diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 0a79fe04..2ca2c005 100644
+index 0a79fe04..b608cb6a 100644
 --- a/mt7915/mcu.h
 +++ b/mt7915/mcu.h
-@@ -836,6 +836,19 @@ enum {
+@@ -836,6 +836,27 @@ enum {
     MURU_DL_INIT,
     MURU_UL_INIT,
  };
@@ -107,27 +142,36 @@
 +   EDCCA_MODE_FORCE_DISABLE,
 +   EDCCA_MODE_AUTO,
 +};
++
++struct mt7915_mcu_edcca_info {
++	u8 cmd_idx;
++	u8 band_idx;
++	u8 info[3];
++	u8 fginit;
++	u8 rsv[2];
++};
  #endif
  
  #endif
 diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 5023cfcb..1cfa6f03 100644
+index 5023cfcb..2b56692d 100644
 --- a/mt7915/mt7915.h
 +++ b/mt7915/mt7915.h
-@@ -747,6 +747,8 @@ void mt7915_vendor_amnt_fill_rx(struct mt7915_phy *phy, struct sk_buff *skb);
+@@ -747,7 +747,8 @@ void mt7915_vendor_amnt_fill_rx(struct mt7915_phy *phy, struct sk_buff *skb);
  int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
  				  struct ieee80211_sta *sta);
  #endif
-+int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value,
-+			 s8 compensation);
- 
+-
++int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation);
++int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
  int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp);
  int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
+ 
 diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 77d71e48..5a28a554 100644
+index 77d71e48..cd5c3b83 100644
 --- a/mt7915/vendor.c
 +++ b/mt7915/vendor.c
-@@ -62,6 +62,17 @@ phy_capa_dump_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP] = {
+@@ -62,6 +62,24 @@ phy_capa_dump_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP] = {
  	[MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA] = { .type = NLA_U16 },
  };
  
@@ -141,11 +185,18 @@
 +       [MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE] = { .type = NLA_S8 },
 +};
 +
++static const struct nla_policy
++edcca_dump_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP] = {
++       [MTK_VENDOR_ATTR_EDCCA_DUMP_MODE] = { .type = NLA_U8 },
++       [MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL] = { .type = NLA_U8 },
++       [MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL] = { .type = NLA_U8 },
++       [MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL] = { .type = NLA_U8 },
++};
 +
  struct csi_null_tone {
  	u8 start;
  	u8 end;
-@@ -1015,6 +1026,47 @@ mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
+@@ -1015,6 +1033,110 @@ mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
  	return len;
  }
  
@@ -160,6 +211,7 @@
 +	int err;
 +	u8 edcca_mode;
 +	s8 edcca_compensation;
++	u8 edcca_value[EDCCA_THRES_NUM] = {0};
 +
 +	err = nla_parse(tb, MTK_VENDOR_ATTR_EDCCA_CTRL_MAX, data, data_len,
 +			edcca_ctrl_policy, NULL);
@@ -171,7 +223,6 @@
 +
 +	edcca_mode = nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE]);
 +	if (edcca_mode == EDCCA_CTRL_SET_EN) {
-+		u8 edcca_value[3] = {0};
 +		if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] ||
 +			!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE]) {
 +			return -EINVAL;
@@ -182,18 +233,81 @@
 +			nla_get_s8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE]);
 +
 +		err = mt7915_mcu_set_edcca(phy, edcca_mode, edcca_value,
-+					 edcca_compensation);
++					   edcca_compensation);
 +		if (err)
 +			return err;
++	} else if (edcca_mode == EDCCA_CTRL_SET_THERS) {
++		if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] ||
++		    !tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL] ||
++		    !tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL]) {
++			return -EINVAL;
++		}
++		edcca_value[0] =
++			nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL]);
++		edcca_value[1] =
++			nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL]);
++		edcca_value[2] =
++			nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL]);
++		err = mt7915_mcu_set_edcca(phy, edcca_mode, edcca_value,
++					   edcca_compensation);
++		if (err)
++			return err;
++	} else {
++		return -EINVAL;
 +	}
++
 +	return 0;
 +}
 +
++static int
++mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
++			     struct sk_buff *skb, const void *data, int data_len,
++			     unsigned long *storage)
++{
++	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
++	struct mt7915_phy *phy = mt7915_hw_phy(hw);
++	struct mt7915_dev *dev = phy->dev;
++	struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL];
++	void *a;
++	int len = EDCCA_THRES_NUM;
++	int err;
++	u8 edcca_mode;
++	s8 value[EDCCA_THRES_NUM];
++
++	if (*storage == 1)
++		return -ENOENT;
++	*storage = 1;
++
++	err = nla_parse(tb, MTK_VENDOR_ATTR_EDCCA_CTRL_MAX, data, data_len,
++			edcca_ctrl_policy, NULL);
++	if (err)
++		return err;
++
++	if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE])
++		return -EINVAL;
++
++	edcca_mode = nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE]);
++	if (edcca_mode ==  EDCCA_CTRL_GET_EN || edcca_mode == EDCCA_CTRL_GET_THERS) {
++		err = mt7915_mcu_get_edcca(phy, edcca_mode, value);
++	} else {
++		return -EINVAL;
++	}
++
++	if (err)
++		return err;
++
++	if (nla_put_u8(skb, MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL, value[0]) ||
++	    nla_put_u8(skb, MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL, value[1]) ||
++	    nla_put_u8(skb, MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL, value[2]))
++		return -ENOMEM;
++
++	return len;
++}
 +
  static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
  	{
  		.info = {
-@@ -1083,6 +1135,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1083,6 +1205,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
  		.dumpit = mt7915_vendor_phy_capa_ctrl_dump,
  		.policy = phy_capa_ctrl_policy,
  		.maxattr = MTK_VENDOR_ATTR_PHY_CAPA_CTRL_MAX,
@@ -206,22 +320,31 @@
 +		.flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
 +			 WIPHY_VENDOR_CMD_NEED_RUNNING,
 +		.doit = mt7915_vendor_edcca_ctrl,
++		.dumpit = mt7915_vendor_edcca_ctrl_dump,
 +		.policy = edcca_ctrl_policy,
 +		.maxattr = MTK_VENDOR_ATTR_EDCCA_CTRL_MAX,
  	}
  };
  
 diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 719b851f..83c41bc1 100644
+index 719b851f..72319717 100644
 --- a/mt7915/vendor.h
 +++ b/mt7915/vendor.h
-@@ -10,8 +10,27 @@ enum mtk_nl80211_vendor_subcmds {
+@@ -2,6 +2,7 @@
+ #define __MT7915_VENDOR_H
+ 
+ #define MTK_NL80211_VENDOR_ID	0x0ce7
++#define EDCCA_THRES_NUM 3
+ 
+ enum mtk_nl80211_vendor_subcmds {
+ 	MTK_NL80211_VENDOR_SUBCMD_AMNT_CTRL = 0xae,
+@@ -10,6 +11,38 @@ enum mtk_nl80211_vendor_subcmds {
  	MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL = 0xc4,
  	MTK_NL80211_VENDOR_SUBCMD_HEMU_CTRL = 0xc5,
  	MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6,
 +	MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
- };
- 
++};
++
 +
 +enum mtk_vendor_attr_edcca_ctrl {
 +        MTK_VENDOR_ATTR_EDCCA_THRESHOLD_INVALID = 0,
@@ -239,10 +362,21 @@
 +                NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL - 1
 +};
 +
++enum mtk_vendor_attr_edcca_dump {
++        MTK_VENDOR_ATTR_EDCCA_DUMP_UNSPEC = 0,
 +
++        MTK_VENDOR_ATTR_EDCCA_DUMP_MODE,
++        MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL,
++        MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL,
++        MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL,
++
++        /* keep last */
++        NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP,
++        MTK_VENDOR_ATTR_EDCCA_DUMP_MAX =
++                NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP - 1
+ };
+ 
  enum mtk_capi_control_changed {
- 	CAPI_RFEATURE_CHANGED		= BIT(16),
- 	CAPI_WIRELESS_CHANGED		= BIT(17),
 -- 
 2.18.0
 
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/1124-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ctrl.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/1124-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ctrl.patch
index 63ef539..7d42880 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/1124-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ctrl.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/1124-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ctrl.patch
@@ -1,8 +1,7 @@
-From 6a3e8349e8114c6fa09401df30f5b425e9fbf067 Mon Sep 17 00:00:00 2001
+From 5f2097d8515e59239f365b2a9f73e7f6e580149d Mon Sep 17 00:00:00 2001
 From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
 Date: Fri, 28 Oct 2022 10:15:56 +0800
-Subject: [PATCH 1124/1128] mt76: mt7915: add vendor subcmd three wire (PTA)
- ctrl
+Subject: [PATCH] mt76: mt7915: add vendor subcmd three wire (PTA) ctrl
 
 Change-Id: Ic1044698f294455594a0c6254f55326fdab90580
 Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -11,12 +10,12 @@
  mt7915/mcu.c      | 50 ++++++++++++++++++++++-------------------------
  mt7915/mcu.h      | 29 +++++++++++++++++++++++++++
  mt7915/mt7915.h   |  1 +
- mt7915/vendor.c   | 42 ++++++++++++++++++++++++++++++++++++++-
- mt7915/vendor.h   | 12 ++++++++++++
- 6 files changed, 107 insertions(+), 29 deletions(-)
+ mt7915/vendor.c   | 44 ++++++++++++++++++++++++++++++++++++++++-
+ mt7915/vendor.h   | 14 +++++++++++++
+ 6 files changed, 111 insertions(+), 29 deletions(-)
 
 diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index bceb679..86a8688 100644
+index bceb6799..86a8688e 100644
 --- a/mt76_connac_mcu.h
 +++ b/mt76_connac_mcu.h
 @@ -1162,7 +1162,7 @@ enum {
@@ -29,7 +28,7 @@
  	MCU_EXT_CMD_CSI_CTRL = 0xc2,
  	MCU_EXT_CMD_IPI_HIST_SCAN = 0xc5,
 diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 8fc40c5..39c8e2c 100644
+index a6c84c2f..3caa5996 100644
 --- a/mt7915/mcu.c
 +++ b/mt7915/mcu.c
 @@ -3964,37 +3964,33 @@ void mt7915_mcu_set_dynalgo(struct mt7915_phy *phy, u8 enable)
@@ -94,7 +93,7 @@
  
  void mt7915_mcu_set_bypass_smthint(struct mt7915_phy *phy, u8 val)
 diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 2ca2c00..b2e4032 100644
+index b608cb6a..2172d491 100644
 --- a/mt7915/mcu.h
 +++ b/mt7915/mcu.h
 @@ -625,6 +625,35 @@ struct mt7915_mcu_rdd_ipi_scan {
@@ -134,10 +133,10 @@
  #define OFDMA_DL                       BIT(0)
  #define OFDMA_UL                       BIT(1)
 diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 9b72f41..98c35d2 100644
+index d979950f..28a2f684 100644
 --- a/mt7915/mt7915.h
 +++ b/mt7915/mt7915.h
-@@ -750,6 +750,7 @@ void mt7915_mcu_set_mimo(struct mt7915_phy *phy, u8 direction);
+@@ -749,6 +749,7 @@ void mt7915_mcu_set_mimo(struct mt7915_phy *phy, u8 direction);
  void mt7915_mcu_set_dynalgo(struct mt7915_phy *phy, u8 enable);
  int mt7915_mcu_set_mu_edca(struct mt7915_phy *phy, u8 val);
  void mt7915_mcu_set_cert(struct mt7915_phy *phy, u8 type);
@@ -146,7 +145,7 @@
  void mt7915_vendor_register(struct mt7915_phy *phy);
  int mt7915_mcu_set_csi(struct mt7915_phy *phy, u8 mode,
 diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 7acb330..7f67c0d 100644
+index b95a1582..84e088c9 100644
 --- a/mt7915/vendor.c
 +++ b/mt7915/vendor.c
 @@ -40,6 +40,11 @@ hemu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_HEMU_CTRL] = {
@@ -161,7 +160,7 @@
  static const struct nla_policy
  rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = {
  	[MTK_VENDOR_ATTR_RFEATURE_CTRL_HE_GI] = {.type = NLA_U8 },
-@@ -964,7 +969,7 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
+@@ -971,7 +976,7 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
  			mt7915_set_wireless_vif, &val32);
  	} else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]) {
  		val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]);
@@ -170,10 +169,18 @@
  		mt7915_mcu_set_bypass_smthint(phy, val8); /* Cert bypass smooth interpolation */
  	}
  
-@@ -1091,6 +1096,30 @@ static int mt7915_vendor_edcca_ctrl(struct wiphy *wiphy,
+@@ -1117,6 +1122,7 @@ static int mt7915_vendor_edcca_ctrl(struct wiphy *wiphy,
  	return 0;
  }
  
++
+ static int
+ mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
+ 			     struct sk_buff *skb, const void *data, int data_len,
+@@ -1164,6 +1170,31 @@ mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
+ 	return len;
+ }
+ 
 +static int mt7915_vendor_3wire_ctrl(struct wiphy *wiphy,
 +				    struct wireless_dev *wdev,
 +				    const void *data,
@@ -198,11 +205,12 @@
 +	return mt7915_mcu_set_cfg(phy, CFGINFO_3WIRE_EN_CFG, three_wire_mode);
 +}
 +
- 
++
  static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
  	{
-@@ -1172,6 +1201,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
- 		.doit = mt7915_vendor_edcca_ctrl,
+ 		.info = {
+@@ -1245,6 +1276,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+ 		.dumpit = mt7915_vendor_edcca_ctrl_dump,
  		.policy = edcca_ctrl_policy,
  		.maxattr = MTK_VENDOR_ATTR_EDCCA_CTRL_MAX,
 +	},
@@ -220,10 +228,10 @@
  };
  
 diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 57f52f3..e0c5fd9 100644
+index c19ffe72..d96e5c23 100644
 --- a/mt7915/vendor.h
 +++ b/mt7915/vendor.h
-@@ -11,6 +11,7 @@ enum mtk_nl80211_vendor_subcmds {
+@@ -12,6 +12,7 @@ enum mtk_nl80211_vendor_subcmds {
  	MTK_NL80211_VENDOR_SUBCMD_HEMU_CTRL = 0xc5,
  	MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6,
  	MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
@@ -231,10 +239,18 @@
  };
  
  
-@@ -30,6 +31,17 @@ enum mtk_vendor_attr_edcca_ctrl {
+@@ -31,6 +32,7 @@ enum mtk_vendor_attr_edcca_ctrl {
                  NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL - 1
  };
  
++
+ enum mtk_vendor_attr_edcca_dump {
+         MTK_VENDOR_ATTR_EDCCA_DUMP_UNSPEC = 0,
+ 
+@@ -45,6 +47,18 @@ enum mtk_vendor_attr_edcca_dump {
+                 NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP - 1
+ };
+ 
 +enum mtk_vendor_attr_3wire_ctrl {
 +	MTK_VENDOR_ATTR_3WIRE_CTRL_UNSPEC,
 +
@@ -246,9 +262,10 @@
 +		NUM_MTK_VENDOR_ATTRS_3WIRE_CTRL - 1
 +};
 +
- 
++
  enum mtk_capi_control_changed {
  	CAPI_RFEATURE_CHANGED		= BIT(16),
+ 	CAPI_WIRELESS_CHANGED		= BIT(17),
 -- 
 2.18.0
 
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/1125-mt76-add-ibf-control-vendor-cmd.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/1125-mt76-add-ibf-control-vendor-cmd.patch
index 0168676..b5be350 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/1125-mt76-add-ibf-control-vendor-cmd.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/1125-mt76-add-ibf-control-vendor-cmd.patch
@@ -1,20 +1,20 @@
-From df996674306a59f87f87dda7495079ffadddfad0 Mon Sep 17 00:00:00 2001
+From 6de06b0f652673f2db19060161dcc94d47ff4ce3 Mon Sep 17 00:00:00 2001
 From: mtk27835 <shurong.wen@mediatek.com>
 Date: Wed, 7 Sep 2022 14:01:29 -0700
-Subject: [PATCH 1125/1128] mt76: add ibf control vendor cmd
+Subject: [PATCH] mt76: add ibf control vendor cmd
 
 Signed-off-by: mtk27835 <shurong.wen@mediatek.com>
 ---
- mt7915/vendor.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
- mt7915/vendor.h | 25 +++++++++++++++++-
- 2 files changed, 94 insertions(+), 1 deletion(-)
+ mt7915/vendor.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++
+ mt7915/vendor.h | 25 ++++++++++++++++-
+ 2 files changed, 95 insertions(+), 1 deletion(-)
 
 diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 7f67c0d..cbbb084 100644
+index 84e088c9..648d2dfb 100644
 --- a/mt7915/vendor.c
 +++ b/mt7915/vendor.c
-@@ -78,6 +78,16 @@ edcca_ctrl_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL] = {
-        [MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE] = { .type = NLA_S8 },
+@@ -86,6 +86,17 @@ edcca_dump_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP] = {
+        [MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL] = { .type = NLA_U8 },
  };
  
 +static const struct nla_policy
@@ -27,10 +27,11 @@
 +	[MTK_VENDOR_ATTR_IBF_DUMP_ENABLE] = { .type = NLA_U8 },
 +};
 +
- 
++
  struct csi_null_tone {
  	u8 start;
-@@ -1120,6 +1130,54 @@ static int mt7915_vendor_3wire_ctrl(struct wiphy *wiphy,
+ 	u8 end;
+@@ -1194,6 +1205,54 @@ static int mt7915_vendor_3wire_ctrl(struct wiphy *wiphy,
  	return mt7915_mcu_set_cfg(phy, CFGINFO_3WIRE_EN_CFG, three_wire_mode);
  }
  
@@ -85,7 +86,7 @@
  
  static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
  	{
-@@ -1212,6 +1270,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1287,6 +1346,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
  		.doit = mt7915_vendor_3wire_ctrl,
  		.policy = three_wire_ctrl_policy,
  		.maxattr = MTK_VENDOR_ATTR_3WIRE_CTRL_MAX,
@@ -105,10 +106,10 @@
  };
  
 diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index e0c5fd9..5aac559 100644
+index d96e5c23..949c8853 100644
 --- a/mt7915/vendor.h
 +++ b/mt7915/vendor.h
-@@ -11,7 +11,8 @@ enum mtk_nl80211_vendor_subcmds {
+@@ -12,7 +12,8 @@ enum mtk_nl80211_vendor_subcmds {
  	MTK_NL80211_VENDOR_SUBCMD_HEMU_CTRL = 0xc5,
  	MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6,
  	MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
@@ -118,7 +119,7 @@
  };
  
  
-@@ -206,4 +207,26 @@ enum mtk_vendor_attr_phy_capa_dump {
+@@ -222,4 +223,26 @@ enum mtk_vendor_attr_phy_capa_dump {
  		NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP - 1
  };
  
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/3007-mt76-mt7915-enable-red-per-band-token-drop-for-HW-Pa.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/3007-mt76-mt7915-enable-red-per-band-token-drop-for-HW-Pa.patch
index 0cd77e5..16d9e8f 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/3007-mt76-mt7915-enable-red-per-band-token-drop-for-HW-Pa.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/3007-mt76-mt7915-enable-red-per-band-token-drop-for-HW-Pa.patch
@@ -1,8 +1,7 @@
-From 45412cabb6bde48e1ef69d6a762c78cece035486 Mon Sep 17 00:00:00 2001
+From 8a932d446bb0da8b7aa4cc7ea8ed541e002cf015 Mon Sep 17 00:00:00 2001
 From: Peter Chiu <chui-hao.chiu@mediatek.com>
 Date: Fri, 2 Sep 2022 14:40:40 +0800
-Subject: [PATCH 3007/3011] mt76: mt7915: enable red per-band token drop for HW
- Path
+Subject: [PATCH] mt76: mt7915: enable red per-band token drop for HW Path
 
 Limit the number of token used by each band. If a band uses too many token,
 it may hurt the throughput of the other band. The SW path can solve this
@@ -12,11 +11,11 @@
 ---
  mt7915/mcu.c    | 53 +++++++++++++++++++++++++++++++++++++++----------
  mt7915/mcu.h    |  1 +
- mt7915/mt7915.h |  2 +-
- 3 files changed, 45 insertions(+), 11 deletions(-)
+ mt7915/mt7915.h |  3 ++-
+ 3 files changed, 46 insertions(+), 11 deletions(-)
 
 diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index c11e575..ad2d6a3 100644
+index 16349c58..2ef353b2 100644
 --- a/mt7915/mcu.c
 +++ b/mt7915/mcu.c
 @@ -2320,8 +2320,13 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
@@ -110,7 +109,7 @@
  int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set)
  {
 diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 42d5e39..3e89235 100644
+index 4ae8d532..14a0972b 100644
 --- a/mt7915/mcu.h
 +++ b/mt7915/mcu.h
 @@ -271,6 +271,7 @@ enum {
@@ -122,18 +121,18 @@
  
  enum mcu_mmps_mode {
 diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 7165273..8567415 100644
+index 46670de4..d8765041 100644
 --- a/mt7915/mt7915.h
 +++ b/mt7915/mt7915.h
-@@ -774,6 +774,7 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
+@@ -773,13 +773,14 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
  #endif
- int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value,
- 			 s8 compensation);
+ int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation);
+ int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
 +int mt7915_mcu_set_red(struct mt7915_dev *dev, bool enabled);
- 
++
  int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp);
  int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
-@@ -781,7 +782,6 @@ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool w
+ 
  #ifdef MTK_DEBUG
  int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir);
  int mt7915_dbg_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3, bool wait_resp);