diff options
author | Daniel Golle <daniel@makrotopia.org> | 2024-05-02 13:21:09 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2024-06-01 16:40:10 +0100 |
commit | ac783b419b279cf2b026baa4bb3626bc00f0c8a9 (patch) | |
tree | 901b38c74fe51b8fdae9b206bf22a9a18f9ab0ec /target/linux/mvebu/patches-6.6 | |
parent | dbc9596c7e60c26fc45eaa3d58ce5806e5589650 (diff) | |
download | openwrt-ac783b419b279cf2b026baa4bb3626bc00f0c8a9.tar.gz openwrt-ac783b419b279cf2b026baa4bb3626bc00f0c8a9.tar.bz2 openwrt-ac783b419b279cf2b026baa4bb3626bc00f0c8a9.zip |
mvebu: improve thermal management of IEI Puzzle devices
- Make step_wise thermal governor respect hysteresis
This is done by importing a downstream patch, backporting the same feature
now present in Linux v6.10+ would be too messy.
- Introduce thermal zone for the WT61P803 uC (chassis and board sensors)
- Introduce thermal zones for AQR NBase-T PHYs
- No longer modify existing SoC thermal zones (which are now only in charge
for emergency shutdown, and can be interrupt driven instead of polled)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to 'target/linux/mvebu/patches-6.6')
2 files changed, 75 insertions, 0 deletions
diff --git a/target/linux/mvebu/patches-6.6/350-drivers-thermal-step_wise-add-support-for-hysteresis.patch b/target/linux/mvebu/patches-6.6/350-drivers-thermal-step_wise-add-support-for-hysteresis.patch new file mode 100644 index 0000000000..e7332b6df0 --- /dev/null +++ b/target/linux/mvebu/patches-6.6/350-drivers-thermal-step_wise-add-support-for-hysteresis.patch @@ -0,0 +1,65 @@ +From 9685ce100f0d302501117113ef0a526ad1acca1d Mon Sep 17 00:00:00 2001 +From: Ram Chandrasekar <rkumbako@codeaurora.org> +Date: Mon, 7 May 2018 11:54:08 -0600 +Subject: [PATCH] drivers: thermal: step_wise: add support for hysteresis + +Step wise governor increases the mitigation level when the temperature +goes above a threshold and will decrease the mitigation when the +temperature falls below the threshold. If it were a case, where the +temperature hovers around a threshold, the mitigation will be applied +and removed at every iteration. This reaction to the temperature is +inefficient for performance. + +The use of hysteresis temperature could avoid this ping-pong of +mitigation by relaxing the mitigation to happen only when the +temperature goes below this lower hysteresis value. + +Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org> +Signed-off-by: Lina Iyer <ilina@codeaurora.org> +[forward-ported for Linux 6.6, as stop-gap downstream solution] +Signed-off-by: Daniel Golle <daniel@makrotopia.org> +--- + drivers/thermal/gov_step_wise.c | 23 ++++++++++++++++------- + 1 file changed, 16 insertions(+), 7 deletions(-) + +--- a/drivers/thermal/gov_step_wise.c ++++ b/drivers/thermal/gov_step_wise.c +@@ -86,22 +86,31 @@ static void thermal_zone_trip_update(str + struct thermal_instance *instance; + bool throttle = false; + int old_target; ++ int hyst_temp; + + trend = get_tz_trend(tz, trip_id); + +- if (tz->temperature >= trip->temperature) { +- throttle = true; +- trace_thermal_zone_trip(tz, trip_id, trip->type); +- } +- +- dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n", +- trip_id, trip->type, trip->temperature, trend, throttle); ++ hyst_temp = trip->temperature - trip->hysteresis; ++ dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d,hyst=%d]:trend=%d,throttle=%d\n", ++ trip_id, trip->type, trip->temperature, hyst_temp, trend, throttle); + + list_for_each_entry(instance, &tz->thermal_instances, tz_node) { + if (instance->trip != trip) + continue; + + old_target = instance->target; ++ throttle = false; ++ /* ++ * Lower the mitigation only if the temperature ++ * goes below the hysteresis temperature. ++ */ ++ if (tz->temperature >= trip->temperature || ++ (tz->temperature >= hyst_temp && ++ old_target != THERMAL_NO_TARGET)) { ++ throttle = true; ++ trace_thermal_zone_trip(tz, trip_id, trip->type); ++ } ++ + instance->target = get_target_state(instance, trend, throttle); + dev_dbg(&instance->cdev->device, "old_target=%d, target=%d\n", + old_target, (int)instance->target); diff --git a/target/linux/mvebu/patches-6.6/912-drivers-hwmon-wt61p803-puzzle-thermal-zone.patch b/target/linux/mvebu/patches-6.6/912-drivers-hwmon-wt61p803-puzzle-thermal-zone.patch new file mode 100644 index 0000000000..4633c03855 --- /dev/null +++ b/target/linux/mvebu/patches-6.6/912-drivers-hwmon-wt61p803-puzzle-thermal-zone.patch @@ -0,0 +1,10 @@ +--- a/drivers/hwmon/iei-wt61p803-puzzle-hwmon.c ++++ b/drivers/hwmon/iei-wt61p803-puzzle-hwmon.c +@@ -251,6 +251,7 @@ static const struct hwmon_ops iei_wt61p8 + }; + + static const struct hwmon_channel_info *iei_wt61p803_puzzle_info[] = { ++ HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ), + HWMON_CHANNEL_INFO(pwm, + HWMON_PWM_INPUT, + HWMON_PWM_INPUT), |