[rdkb][common][bsp][Refactor and sync wifi from openwrt]

[Description]
ced8594f [MAC80211][WiFi6][Misc][Fix the MT76 WiFi6 Makefile]
7221999e [MAC80211][WiFi7][Misc][Correct the MAC80211 WiFi7 Makefile.]
9d87794a [MAC80211][WiFi7][Misc][Correct the MT76 WiFi7 Makefile.]
ff24e1b2 [openwrt-24][Mac80211][Fix patch conflict with upstream openwrt]
3a6c13e2 [mac80211][misc][fix patch fail due to openwrt update]
05763faa [MAC80211][WiFi7][misc][fix patch failed of wifi-scripts]
f34fd014 [mac80211][misc][fix patch fail due to openwrt update]
f6796660 [openwrt-24][Release][Fix build fail of Wi-Fi7 MT76]
7076d96c [MAC80211][WiFi7][Misc][Fix release build fail because of mt76 version upgradation]
1f748b17 [mac80211][misc][fix patch fail due to openwrt update]
95ba6722 [mac80211][misc][fix patch fail due to openwrt update]
17680d7f [MAC80211][WiFi7][misc][Rename eeprom of eFEM variants]
b97cefa1 [MAC80211][WiFi7][app][Add Griffin support for atenl/iwpriv]
6de718a4 [MAC80211][WiFi7][misc][fix wifi-scripts patch failed]
9f1ace86 [MAC80211][WiFi7][misc][fix hostapd Makefile patch]
e4d0d28e [MAC80211][Misc][Add MT7990 Firmware OpenWrt config]
f3a8a8f7 [MAC80211][Release][Fix build fail of Wi-Fi6 MT76]
dabe8eae [openwrt-24][common][bsp][Fix line ending]
6d438a9d [openwrt-24][common][bsp][Use zstd to compress rootfs debug symbols for unified autobuild]
c268e47e [openwrt][common][bsp][Change SMC ID of wdt nonrst reg of reset-boot-count to 0x570]
c6819fbc [openwrt-24][Release][Update release note for Filogic 880 alpha release]
6897b4de [openwrt-24][common][bsp][Adjust unified autobuild for internal build detection]
fb9b9762 [MAC80211][WiFi6/7][app][Add ext eeprom write back cmd support]
d42b42a3 [openwrt-24][common][bsp][Add kernel6.6 Filogic880 BE19000/BE14000]
3806f047 [MAC80211][misc][Add Bpi-R4 support]
ddbda753 [MAC80211][WiFi7][Misc][Fix build fail because of mt76 version upgradation]
90959b08 [MAC80211][WiFi6][mt76][Rebase mt76 pathes]
728a3362 [MAC80211][WiFi6][mt76][Refactor Qos Map]
b46277b5 [MAC80211][WiFi6][mt76][Fix add ba issue on tid not equal to zero]
c084ee8b [MAC80211][WiFi7][mt76][split mt76 Makefile patch]
bbaec094 [MAC80211][Release][Update Filogic 830/820/630 firmware]
5ce2eece [MAC80211][wifi6][MT76][Fix build fail]
5ac1121f [MAC80211][wifi6][MT76][Fix mt76 version to 2024-07-13]
485f92b1 [MAC80211][WiFi7][misc][synchronize PP bitmap when association]
84db8818 [MAC80211][WiFi6/7][app][Add ATETXNSS in iwpriv wrapper]
cc5a4605 [MAC80211][WiFi7][mt76][fix patch failed of Makefile]

[Release-log]

Change-Id: I06704c04c4b5571af4ffd189d636c1fc9f0567fd
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0135-mtk-mt76-mt7996-add-debugfs-knob-to-set-agc.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0135-mtk-mt76-mt7996-add-debugfs-knob-to-set-agc.patch
new file mode 100644
index 0000000..4aa3e88
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0135-mtk-mt76-mt7996-add-debugfs-knob-to-set-agc.patch
@@ -0,0 +1,213 @@
+From 4483bcc086666bb2eaf40774c30d35d60911524b Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Fri, 31 May 2024 10:55:03 +0800
+Subject: [PATCH 135/223] mtk: mt76: mt7996: add debugfs knob to set agc
+
+Add the following debugfs knob
+- /sys/kernel/debug/ieee80211/phy0/mt76/mlo_agc_tx
+- /sys/kernel/debug/ieee80211/phy0/mt76/mlo_agc_trig
+
+Change-Id: I7e847be11b3083b6d776e7b00c6089dec3ad1a41
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt76_connac_mcu.h      |   1 +
+ mt7996/mcu.h           |  20 ++++++++
+ mt7996/mt7996.h        |   1 +
+ mt7996/mtk_debugfs_i.c | 103 +++++++++++++++++++++++++++++++++++++++++
+ mt7996/mtk_mcu.c       |   6 +++
+ 5 files changed, 131 insertions(+)
+
+diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
+index 2daa09cc..73cf311a 100644
+--- a/mt76_connac_mcu.h
++++ b/mt76_connac_mcu.h
+@@ -1317,6 +1317,7 @@ enum {
+ 	MCU_UNI_CMD_THERMAL_CAL = 0x4c,
+ 	MCU_UNI_CMD_RRO = 0x57,
+ 	MCU_UNI_CMD_OFFCH_SCAN_CTRL = 0x58,
++	MCU_UNI_CMD_MLO = 0x59,
+ 	MCU_UNI_CMD_PER_STA_INFO = 0x6d,
+ 	MCU_UNI_CMD_ALL_STA_INFO = 0x6e,
+ 	MCU_UNI_CMD_ASSERT_DUMP = 0x6f,
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index c39dcc3c..389aab63 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -1157,6 +1157,26 @@ enum {
+ 	UNI_CMD_SCS_ENABLE,
+ };
+ 
++enum {
++	UNI_CMD_MLO_AGC_TX = 4,
++	UNI_CMD_MLO_AGC_TRIG = 5,
++};
++
++struct mt7996_mlo_agc_set {
++	u8 rsv[4];
++
++	__le16 tag;
++	__le16 len;
++
++	u8 mld_id;
++	u8 link_id;
++	u8 ac;
++	u8 disp_pol;
++	u8 ratio;
++	u8 order;
++	__le16 mgf;
++} __packed;
++
+ #define MT7996_PATCH_SEC		GENMASK(31, 24)
+ #define MT7996_PATCH_SCRAMBLE_KEY	GENMASK(15, 8)
+ #define MT7996_PATCH_AES_KEY		GENMASK(7, 0)
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 8af3c400..7bb17126 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1328,6 +1328,7 @@ void mt7996_dump_bmac_txd_info(struct seq_file *s, struct mt7996_dev *dev,
+ 			       __le32 *txd, bool is_hif_txd, bool dump_txp);
+ int mt7996_mtk_init_dev_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir);
+ int mt7996_mtk_init_band_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir);
++int mt7996_mcu_mlo_agc(struct mt7996_dev *dev, const void *data, int len);
+ #endif
+ 
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+diff --git a/mt7996/mtk_debugfs_i.c b/mt7996/mtk_debugfs_i.c
+index 839c3e31..852d1b12 100644
+--- a/mt7996/mtk_debugfs_i.c
++++ b/mt7996/mtk_debugfs_i.c
+@@ -774,6 +774,106 @@ mt7996_agg_table_show(struct seq_file *s, void *data)
+ }
+ DEFINE_SHOW_ATTRIBUTE(mt7996_agg_table);
+ 
++static ssize_t mt7996_mlo_agc_tx_set(struct file *file,
++				     const char __user *user_buf,
++				     size_t count, loff_t *ppos)
++{
++	struct mt7996_dev *dev = file->private_data;
++	struct mt7996_mlo_agc_set req;
++	char buf[100];
++	int ret;
++	u16 mgf;
++
++	memset(&req, 0, sizeof(req));
++
++	if (count >= sizeof(buf))
++		return -EINVAL;
++
++	if (copy_from_user(buf, user_buf, count))
++		return -EFAULT;
++
++	if (count && buf[count - 1] == '\n')
++		buf[count - 1] = '\0';
++	else
++		buf[count] = '\0';
++
++	if (sscanf(buf, "%hhu %hhu %hhu %hhu %hu %hhu %hhu",
++		   &req.mld_id, &req.link_id, &req.ac, &req.disp_pol,
++		   &mgf, &req.ratio, &req.order) != 7) {
++		dev_warn(dev->mt76.dev,
++			 "format: [MldRecIdx] [Link] [Ac] [DispPol] [MGF] [Ratio] [Order]\n");
++		goto out;
++	}
++
++	req.tag = cpu_to_le16(UNI_CMD_MLO_AGC_TX);
++	req.len = cpu_to_le16(sizeof(req) - 4);
++	req.mgf = cpu_to_le16(mgf);
++
++	ret = mt7996_mcu_mlo_agc(dev, &req, sizeof(req));
++	if (ret)
++		return -EFAULT;
++
++out:
++	return count;
++}
++
++static const struct file_operations fops_mlo_agc_tx = {
++	.write = mt7996_mlo_agc_tx_set,
++	.open = simple_open,
++	.owner = THIS_MODULE,
++	.llseek = default_llseek,
++};
++
++static ssize_t mt7996_mlo_agc_trig_set(struct file *file,
++				       const char __user *user_buf,
++				       size_t count, loff_t *ppos)
++{
++	struct mt7996_dev *dev = file->private_data;
++	struct mt7996_mlo_agc_set req;
++	char buf[100];
++	int ret;
++	u16 mgf;
++
++	memset(&req, 0, sizeof(req));
++
++	if (count >= sizeof(buf))
++		return -EINVAL;
++
++	if (copy_from_user(buf, user_buf, count))
++		return -EFAULT;
++
++	if (count && buf[count - 1] == '\n')
++		buf[count - 1] = '\0';
++	else
++		buf[count] = '\0';
++
++	if (sscanf(buf, "%hhu %hhu %hhu %hhu %hu %hhu",
++		   &req.mld_id, &req.link_id, &req.ac, &req.disp_pol,
++		   &mgf, &req.ratio) != 6) {
++		dev_warn(dev->mt76.dev,
++			 "format: [MldRecIdx] [Link] [Ac] [DispPol] [MGF] [Ratio]\n");
++		goto out;
++	}
++
++	req.tag = cpu_to_le16(UNI_CMD_MLO_AGC_TRIG);
++	req.len = cpu_to_le16(sizeof(req) - 4);
++	req.mgf = cpu_to_le16(mgf);
++
++	ret = mt7996_mcu_mlo_agc(dev, &req, sizeof(req));
++	if (ret)
++		return -EFAULT;
++
++out:
++	return count;
++}
++
++static const struct file_operations fops_mlo_agc_trig = {
++	.write = mt7996_mlo_agc_trig_set,
++	.open = simple_open,
++	.owner = THIS_MODULE,
++	.llseek = default_llseek,
++};
++
+ int mt7996_mtk_init_dev_debugfs_internal(struct mt7996_phy *phy, struct dentry *dir)
+ {
+ 	struct mt7996_dev *dev = phy->dev;
+@@ -796,6 +896,9 @@ int mt7996_mtk_init_dev_debugfs_internal(struct mt7996_phy *phy, struct dentry *
+ 
+ 	/* MLO related Table */
+ 	debugfs_create_file("mat_table", 0400, dir, dev, &mt7996_mat_table_fops);
++	debugfs_create_file("mlo_agc_tx", 0200, dir, dev, &fops_mlo_agc_tx);
++	debugfs_create_file("mlo_agc_trig", 0200, dir, dev, &fops_mlo_agc_trig);
++
+ 	return 0;
+ }
+ 
+diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
+index 809181e0..82e3f721 100644
+--- a/mt7996/mtk_mcu.c
++++ b/mt7996/mtk_mcu.c
+@@ -1364,4 +1364,10 @@ int mt7996_mcu_thermal_debug(struct mt7996_dev *dev, u8 mode, u8 action)
+ 	return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(THERMAL_CAL), &req,
+ 	                         sizeof(req), true);
+ }
++
++int mt7996_mcu_mlo_agc(struct mt7996_dev *dev, const void *data, int len)
++{
++	return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MLO), data,
++	                        len, true);
++}
+ #endif
+-- 
+2.45.2
+