[][MAC80211][MT76][Rework Thermal Protection]

[Description]
Fix thermal protection bugs.

[Release-log]
N/A

Change-Id: I3ec0295572893c14c662a172349110e4129d1ce3
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6923892
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch
new file mode 100644
index 0000000..c4c2b78
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/0001-wifi-mt76-mt7915-call-mt7915_mcu_set_thermal_throttl.patch
@@ -0,0 +1,52 @@
+From 00cd9ac2311cf4b66ab7c3d6eb3593b52bea1bec Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Fri, 2 Dec 2022 10:16:49 +0800
+Subject: [PATCH 1/4] wifi: mt76: mt7915: call
+ mt7915_mcu_set_thermal_throttling() only after init_work
+
+Enable thermal management by default shall not be executed during mcu
+init. This causes thermal configuration being reset to the firmware
+default settings.
+
+Fixes: 0063b86c9120 ("mt76: mt7915e: Enable thermal management by default")
+Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/init.c | 3 +--
+ mt7915/main.c | 6 ++++++
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index 6fd5c63e..a03d0b3b 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -201,8 +201,7 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
+ 	phy->throttle_temp[0] = 110;
+ 	phy->throttle_temp[1] = 120;
+ 
+-	return mt7915_mcu_set_thermal_throttling(phy,
+-						 MT7915_THERMAL_THROTTLE_MAX);
++	return 0;
+ }
+ 
+ static void mt7915_led_set_config(struct led_classdev *led_cdev,
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 0511d6a5..98af032e 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -57,6 +57,12 @@ int mt7915_run(struct ieee80211_hw *hw)
+ 		mt7915_mac_enable_nf(dev, phy->mt76->band_idx);
+ 	}
+ 
++	ret = mt7915_mcu_set_thermal_throttling(phy,
++						MT7915_THERMAL_THROTTLE_MAX);
++
++	if (ret)
++		goto out;
++
+ 	ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b,
+ 					     phy->mt76->band_idx);
+ 	if (ret)
+-- 
+2.18.0
+