]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mt76: mt7915: rework init flow in mt7915_thermal_init()
authorHoward Hsu <howard-yh.hsu@mediatek.com>
Thu, 23 Feb 2023 06:24:57 +0000 (14:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:11:16 +0000 (23:11 +0900)
[ Upstream commit 9c97df11dfe68b548a47744ba9fa6beddcfba2bc ]

If kernel do not enable CONFIG_HWMON, it may cause thermal
initialization to be done with temperature value 0 and then can not
transmit. This commit fixes it by setting trigger/restore temperature
before checking CONFIG_HWMON.

Fixes: 7d12b38ab6f6 ("wifi: mt76: mt7915: call mt7915_mcu_set_thermal_throttling() only after init_work")
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt7915/init.c

index db0a35974ca7e70bc5700166793056afed6ca77f..0d8bc7b06a46b7fe84b0bef281fbfcf36d8a794d 100644 (file)
@@ -204,6 +204,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;
 
@@ -212,10 +216,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;
 }