[][MAC80211][mt76][wifi: mt76: mt7915: rework mt7915_thermal_init]

[Description]
Fix mt7915_thermal_init() to initialize critial/maximum temperature if
CONFIG_HWMON is N.

[Release-log]
N/A

Change-Id: I4a3421c6b82775318b621dd34441eb63c5fd665e
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7066694
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/0007-wifi-mt76-mt7915-rework-mt7915_thermal_init.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/0007-wifi-mt76-mt7915-rework-mt7915_thermal_init.patch
new file mode 100644
index 0000000..f5c250a
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/0007-wifi-mt76-mt7915-rework-mt7915_thermal_init.patch
@@ -0,0 +1,41 @@
+From 6e2b8db65902a9ed9d0bb323b915657f14f9c740 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Thu, 19 Jan 2023 11:03:44 +0800
+Subject: [PATCH] wifi: mt76: mt7915: rework mt7915_thermal_init()
+
+If the kernel configuration "CONFIG_HWMON" is not set to Y, the
+critial/maximum high temperature will not be initialised to the correct
+setting. Rework mt7915_thermal_init to fix this.
+---
+ mt7915/init.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index b23a2fb8..476c1238 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -203,6 +203,10 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
+ 			phy->cdev = cdev;
+ 	}
+ 
++	/* initialize critical/maximum high temperature */
++	phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = MT7915_CRIT_TEMP;
++	phy->throttle_temp[MT7915_MAX_TEMP_IDX] = MT7915_MAX_TEMP;
++
+ 	if (!IS_REACHABLE(CONFIG_HWMON))
+ 		return 0;
+ 
+@@ -211,10 +215,6 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
+ 	if (IS_ERR(hwmon))
+ 		return PTR_ERR(hwmon);
+ 
+-	/* initialize critical/maximum high temperature */
+-	phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = MT7915_CRIT_TEMP;
+-	phy->throttle_temp[MT7915_MAX_TEMP_IDX] = MT7915_MAX_TEMP;
+-
+ 	return 0;
+ }
+ 
+-- 
+2.18.0
+