linux-stable/drivers/thermal
Daniel Lezcano 4feaedf7d2 thermal/thresholds: Fix boundaries and detection routine
The current implementation does not work if the thermal zone is
interrupt driven only.

The boundaries are not correctly checked and computed as it happens
only when the temperature is increasing or decreasing.

The problem arises because the routine to detect when we cross a
threshold is correlated with the computation of the boundaries. We
assume we have to recompute the boundaries when a threshold is crossed
but actually we should do that even if the it is not the case.

Mixing the boundaries computation and the threshold detection for the
sake of optimizing the routine is much more complex as it appears
intuitively and prone to errors.

This fix separates the boundaries computation and the threshold
crossing detection into different routines. The result is a code much
more simple to understand, thus easier to maintain.

The drawback is we browse the thresholds list several time but we can
consider that as neglictible because that happens when the temperature
is updated. There are certainly some aeras to improve in the
temperature update routine but it would be not adequate as this change
aims to fix the thresholds for v6.13.

Fixes: 445936f9e2 ("thermal: core: Add user thresholds support")
Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org> # rock5b, Lenovo x13s
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://patch.msgid.link/20241216212644.1145122-1-daniel.lezcano@linaro.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-12-18 14:51:31 +01:00
..
broadcom thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
intel module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
mediatek thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
qcom thermal: qcom-spmi-adc-tm5: Simplify with scoped for each OF child loop 2024-11-26 13:28:43 +01:00
renesas thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
samsung thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
st thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
tegra thermal: tegra: Simplify with scoped for each OF child loop 2024-11-26 13:28:43 +01:00
testing thermal: testing: Initialize some variables annoteded with _free() 2024-11-14 17:40:47 +01:00
ti-soc-thermal More thermal control updates for 6.13-rc1 2024-11-22 19:43:18 -08:00
amlogic_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
armada_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
cpufreq_cooling.c thermal/cpufreq: Remove arch_update_thermal_pressure() 2024-04-24 12:08:00 +02:00
cpuidle_cooling.c thermal: cpuidle_cooling: fix kernel-doc warning and a spello 2023-12-21 12:05:48 +01:00
da9062-thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
db8500_thermal.c thermal/drivers/db8500: Remove redundant of_match_ptr() 2023-08-16 12:09:19 +02:00
devfreq_cooling.c thermal: devfreq_cooling: Fix perf state when calculate dfc res_util 2024-03-27 16:27:39 +01:00
dove_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
gov_bang_bang.c thermal: core: Introduce thermal_cdev_update_nocheck() 2024-10-23 11:57:11 +02:00
gov_fair_share.c thermal: core: Introduce thermal_cdev_update_nocheck() 2024-10-23 11:57:11 +02:00
gov_power_allocator.c thermal: gov_power_allocator: Add missing NULL pointer check 2024-11-26 13:27:56 +01:00
gov_step_wise.c thermal: core: Add and use cooling device guard 2024-10-24 14:48:23 +02:00
gov_user_space.c thermal: gov_user_space: Use .trip_crossed() instead of .throttle() 2024-04-24 20:42:10 +02:00
hisi_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
imx8mm_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
imx_sc_thermal.c thermal/drivers/imx_sc_thermal: Use dev_err_probe 2024-09-04 15:31:29 +02:00
imx_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
k3_bandgap.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
k3_j72xx_bandgap.c thermal/drivers/k3_j72xx_bandgap: Simplify code in k3_bgp_read_temp() 2024-11-13 18:37:00 +01:00
Kconfig thermal: Add PCIe cooling driver 2024-11-16 10:09:30 -06:00
khadas_mcu_fan.c thermal/core: Make cooling device state change private 2021-01-19 22:31:10 +01:00
kirkwood_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
loongson2_thermal.c thermal/drivers/loongson2: Add Loongson-2K2000 support 2024-04-23 12:40:30 +02:00
Makefile pci-v6.13-changes 2024-11-26 18:05:44 -08:00
max77620_thermal.c thermal/drivers/max77620: Remove duplicate error message 2023-10-15 23:40:10 +02:00
pcie_cooling.c thermal: Add PCIe cooling driver 2024-11-16 10:09:30 -06:00
qoriq_thermal.c thermal/drivers/qoriq: Remove __maybe_unused notations 2024-09-02 13:17:46 +02:00
rockchip_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
spear_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
sprd_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00
sun8i_thermal.c thermal: sun8i: Use scoped device node handling to simplify error paths 2024-11-26 13:28:43 +01:00
thermal_core.c thermal: core: Relocate thermal zone initialization routine 2024-10-24 17:15:07 +02:00
thermal_core.h thermal: core: Use trip lists for trip crossing detection 2024-10-24 17:15:07 +02:00
thermal_debugfs.c thermal: core: Add and use cooling device guard 2024-10-24 14:48:23 +02:00
thermal_debugfs.h thermal/debugfs: Do not extend mitigation episodes beyond system resume 2024-06-11 21:04:00 +02:00
thermal_helpers.c thermal: core: Add and use cooling device guard 2024-10-24 14:48:23 +02:00
thermal_hwmon.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
thermal_hwmon.h thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() 2023-03-03 20:45:02 +01:00
thermal_mmio.c thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers 2023-03-03 20:45:02 +01:00
thermal_netlink.c thermal: netlink: Add the commands and the events for the thresholds 2024-10-24 14:54:01 +02:00
thermal_netlink.h thermal: netlink: Add the commands and the events for the thresholds 2024-10-24 14:54:01 +02:00
thermal_of.c thermal: of: Use scoped device node handling to simplify of_thermal_zone_find() 2024-11-26 13:28:43 +01:00
thermal_sysfs.c thermal: core: Add and use cooling device guard 2024-10-24 14:48:23 +02:00
thermal_thresholds.c thermal/thresholds: Fix boundaries and detection routine 2024-12-18 14:51:31 +01:00
thermal_thresholds.h thermal: netlink: Add the commands and the events for the thresholds 2024-10-24 14:54:01 +02:00
thermal_trace_ipa.h thermal: core: Make struct thermal_zone_device definition internal 2024-04-08 16:01:20 +02:00
thermal_trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
thermal_trip.c thermal: core: Relocate functions that update trip points 2024-10-24 17:15:07 +02:00
thermal-generic-adc.c thermal/drivers/generic-adc: Simplify with dev_err_probe() 2024-07-15 13:31:41 +02:00
uniphier_thermal.c thermal: Switch back to struct platform_driver::remove() 2024-11-13 16:17:57 +01:00