summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
Commit message (Collapse)AuthorAgeFilesLines
* thermal: intel: powerclamp: fix mismatch in get function for max_idleDavid Arcari2023-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | commit fae633cfb729da2771b5433f6b84ae7e8b4aa5f7 upstream. KASAN reported this [ 444.853098] BUG: KASAN: global-out-of-bounds in param_get_int+0x77/0x90 [ 444.853111] Read of size 4 at addr ffffffffc16c9220 by task cat/2105 ... [ 444.853442] The buggy address belongs to the variable: [ 444.853443] max_idle+0x0/0xffffffffffffcde0 [intel_powerclamp] There is a mismatch between the param_get_int and the definition of max_idle. Replacing param_get_int with param_get_byte resolves this issue. Fixes: ebf519710218 ("thermal: intel: powerclamp: Add two module parameters") Cc: 6.3+ <stable@vger.kernel.org> # 6.3+ Signed-off-by: David Arcari <darcari@redhat.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* thermal: core: Don't update trip points inside the hysteresis rangeNícolas F. R. A. Prado2023-11-201-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ Upstream commit cf3986f8c01d355490d0ac6024391b989a9d1e9d ] When searching for the trip points that need to be set, the nearest higher trip point's temperature is used for the high trip, while the nearest lower trip point's temperature minus the hysteresis is used for the low trip. The issue with this logic is that when the current temperature is inside a trip point's hysteresis range, both high and low trips will come from the same trip point. As a consequence instability can still occur like this: * the temperature rises slightly and enters the hysteresis range of a trip point * polling happens and updates the trip points to the hysteresis range * the temperature falls slightly, exiting the hysteresis range, crossing the trip point and triggering an IRQ, the trip points are updated * repeat So even though the current hysteresis implementation prevents instability from happening due to IRQs triggering on the same temperature value, both ways, it doesn't prevent it from happening due to an IRQ on one way and polling on the other. To properly implement a hysteresis behavior, when inside the hysteresis range, don't update the trip points. This way, the previously set trip points will stay in effect, which will in a way remember the previous state (if the temperature signal came from above or below the range) and therefore have the right trip point already set. The exception is if there was no previous trip point set, in which case a previous state doesn't exist, and so it's sensible to allow the hysteresis range as trip points. The following logs show the current behavior when running on a real machine: [ 202.524658] thermal thermal_zone0: new temperature boundaries: -2147483647 < x < 40000 203.562817: thermal_temperature: thermal_zone=vpu0-thermal id=0 temp_prev=36986 temp=37979 [ 203.562845] thermal thermal_zone0: new temperature boundaries: 37000 < x < 40000 204.176059: thermal_temperature: thermal_zone=vpu0-thermal id=0 temp_prev=37979 temp=40028 [ 204.176089] thermal thermal_zone0: new temperature boundaries: 37000 < x < 100000 205.226813: thermal_temperature: thermal_zone=vpu0-thermal id=0 temp_prev=40028 temp=38652 [ 205.226842] thermal thermal_zone0: new temperature boundaries: 37000 < x < 40000 And with this patch applied: [ 184.933415] thermal thermal_zone0: new temperature boundaries: -2147483647 < x < 40000 185.981182: thermal_temperature: thermal_zone=vpu0-thermal id=0 temp_prev=36986 temp=37872 186.744685: thermal_temperature: thermal_zone=vpu0-thermal id=0 temp_prev=37872 temp=40058 [ 186.744716] thermal thermal_zone0: new temperature boundaries: 37000 < x < 100000 187.773284: thermal_temperature: thermal_zone=vpu0-thermal id=0 temp_prev=40058 temp=38698 Fixes: 060c034a9741 ("thermal: Add support for hardware-tracked trip points") Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Co-developed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
* thermal/drivers/mediatek: Fix probe for THERMAL_V2Markus Schneider-Pargmann2023-11-201-1/+1
| | | | | | | | | | | | | | | | | | | [ Upstream commit 5055fadfa7e16f2427d5b3c40b2bf563ddfdab22 ] Fix the probe function to call mtk_thermal_release_periodic_ts for everything != MTK_THERMAL_V1. This was accidentally changed from V1 to V2 in the original patch. Reported-by: Frank Wunderlich <frank-w@public-files.de> Closes: https://lore.kernel.org/lkml/B0B3775B-B8D1-4284-814F-4F41EC22F532@public-files.de/ Reported-by: Daniel Lezcano <daniel.lezcano@linaro.org> Closes: https://lore.kernel.org/lkml/07a569b9-e691-64ea-dd65-3b49842af33d@linaro.org/ Fixes: 33140e668b10 ("thermal/drivers/mediatek: Control buffer enablement tweaks") Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230918100706.1229239-1-msp@baylibre.com Signed-off-by: Sasha Levin <sashal@kernel.org>
* thermal: core: prevent potential string overflowDan Carpenter2023-11-201-2/+4
| | | | | | | | | | | | [ Upstream commit c99626092efca3061b387043d4a7399bf75fbdd5 ] The dev->id value comes from ida_alloc() so it's a number between zero and INT_MAX. If it's too high then these sprintf()s will overflow. Fixes: 203d3d4aa482 ("the generic thermal sysfs driver") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
* thermal: sysfs: Fix trip_point_hyst_store()Rafael J. Wysocki2023-09-181-4/+5
| | | | | | | | | | | | | | | | | After commit 2e38a2a981b2 ("thermal/core: Add a generic thermal_zone_set_trip() function") updating a trip point temperature doesn't actually work, because the value supplied by user space is subsequently overwritten with the current trip point hysteresis value. Fix this by changing the code to parse the number string supplied by user space after retrieving the current trip point data from the thermal zone. Also drop a redundant tab character from the code in question. Fixes: 2e38a2a981b2 ("thermal/core: Add a generic thermal_zone_set_trip() function") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: 6.3+ <stable@vger.kernel.org> # 6.3+
* thermal: core: Fix disabled trip point check in handle_thermal_trip()Rafael J. Wysocki2023-09-141-2/+4
| | | | | | | | | | | | | | | Commit bc840ea5f9a9 ("thermal: core: Do not handle trip points with invalid temperature") added a check for invalid temperature to the disabled trip point check in handle_thermal_trip(), but that check was added at a point when the trip structure has not been initialized yet. This may cause handle_thermal_trip() to skip a valid trip point in some cases, so fix it by moving the check to a suitable place, after __thermal_zone_get_trip() has been called to populate the trip structure. Fixes: bc840ea5f9a9 ("thermal: core: Do not handle trip points with invalid temperature") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* thermal: Constify the trip argument of the .get_trend() zone callbackRafael J. Wysocki2023-09-111-1/+2
| | | | | | | | | | | | | Add 'const' to the definition of the 'trip' argument of the .get_trend() thermal zone callback to indicate that the trip point passed to it should not be modified by it and adjust the callback functions implementing it, thermal_get_trend() in the ACPI thermal driver and __ti_thermal_get_trend(), accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Michal Wilczynski <michal.wilczynski@intel.com>
* thermal/of: add missing of_node_put()Julia Lawall2023-09-111-2/+6
| | | | | | | | | | | | for_each_child_of_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. This was done using the Coccinelle semantic patch iterators/for_each_child.cocci Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* thermal: core: Drop thermal_zone_device_register()Rafael J. Wysocki2023-09-051-11/+0
| | | | | | | | | | | | There are no more users of thermal_zone_device_register(), so drop it from the core. Note that thermal_zone_device_register_with_trips() may be renamed to thermal_zone_device_register() in the future, but only after a grace period allowing all of the possible work in progress that may be using the latter to adjust. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* thermal: Use thermal_tripless_zone_device_register()Rafael J. Wysocki2023-09-055-11/+12
| | | | | | | | | | | All of the remaining callers of thermal_zone_device_register() can use thermal_tripless_zone_device_register(), so make them do so in order to allow the former to be dropped. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
* thermal: core: Add function for registering tripless thermal zonesRafael J. Wysocki2023-09-051-0/+11
| | | | | | | | Multiple callers of thermal_zone_device_register() don't pass any trips to it and they might use a shortened argument list for that, so add a special function with fewer arguments for this purpose. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* thermal: core: Rework .get_trend() thermal zone callbackRafael J. Wysocki2023-08-293-3/+5
| | | | | | | | | | | | | Passing a struct thermal_trip pointer instead of a trip index to the .get_trend() thermal zone callback allows one of its 2 implementations, the thermal_get_trend() function in the ACPI thermal driver, to be simplified quite a bit, and the other implementation of it in the ti-soc-thermal driver does not even use the relevant callback argument. For this reason, change the .get_trend() thermal zone callback definition and adjust the related code accordingly. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* thermal: core: Drop unused .get_trip_*() callbacksRafael J. Wysocki2023-08-292-22/+4
| | | | | | | | | | After recent changes in the ACPI thermal driver and in the Intel DTS IOSF thermal driver, all thermal zone drivers are expected to use trip tables for initialization and none of them should implement .get_trip_type(), .get_trip_temp() or .get_trip_hyst() callbacks, so drop these callbacks entirely from the core. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* Merge tag 'thermal-v6.6-rc1' of ↵Rafael J. Wysocki2023-08-2919-73/+374
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux Merge ARM and related thermal control updates for 6.6-rc1 from Daniel Lezcano: "- Check if the Tegra BPMP supports the trip points in order to set the .set_trips callback (Mikko Perttunen) - Add the new Loongson-2 thermal sensor along with the DT bindings (Yinbo Zhu) - Use IS_ERR_OR_NULL helper to replace a double test on the TI bandgap sensor (Li Zetao) - Remove the call to platform_set_drvdata() as there is no call to platform_get_drvdata() in a bunch of drivers where that happens (Andrei Coardos) - Switch the Mediatek LVTS mode to filtered in order to enable the interrupts (Nícolas F. R. A. Prado) - Fix Wvoid-pointer-to-enum-cast warning on the Exynos TMU (Krzysztof Kozlowski) - Remove redundant usage of of_match_ptr() as the driver db8500 already depends on CONFIG_OF (Ruan Jinjie) - Remove redundant dev_err_probe() because the underlying function already called it in the Mediatek sensor (Chen Jiahao) - Free calibration nvmem after reading it on sun8i (Mark Brown) - Remove useless comment in the code on sun8i (Yangtao Li) - Make tsens_xxxx_nvmem static to fix sparse warning on QCom tsens (Min-Hua Chen) - Remove error message at probe deferral on imx8mm (Ahmad Fatoum) - Fix parameter check in lvts_debugfs_init with IS_ERR on Mediatek LVTS (Minjie Du) - Fix the interrupt routine and configuratoin for the Mediatek LVTS (Nícolas F. R. A. Prado)" * tag 'thermal-v6.6-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (27 commits) thermal/drivers/tegra-bpmp: Check if BPMP supports trip points thermal: dt-bindings: add loongson-2 thermal thermal/drivers/loongson-2: Add thermal management support thermal/drivers/ti-soc-thermal: Use helper function IS_ERR_OR_NULL() thermal/drivers/generic-adc: Removed unneeded call to platform_set_drvdata() thermal/drivers/max77620_thermal: Removed unneeded call to platform_set_drvdata() thermal/drivers/mediatek/auxadc_thermal: Removed call to platform_set_drvdata() thermal/drivers/sun8i_thermal: Remove unneeded call to platform_set_drvdata() thermal/drivers/broadcom/brcstb_thermal: Removed unneeded platform_set_drvdata() thermal/drivers/mediatek/lvts_thermal: Make readings valid in filtered mode thermal/drivers/k3_bandgap: Remove unneeded call to platform_set_drvdata() thermal/drivers/k3_j72xx_bandgap: Removed unneeded call to platform_set_drvdata() thermal/drivers/broadcom/sr-thermal: Removed call to platform_set_drvdata() thermal/drivers/samsung: Fix Wvoid-pointer-to-enum-cast warning thermal/drivers/db8500: Remove redundant of_match_ptr() thermal/drivers/mediatek: Clean up redundant dev_err_probe() thermal/drivers/sun8i: Free calibration nvmem after reading it thermal/drivers/sun8i: Remove unneeded comments thermal/drivers/tsens: Make tsens_xxxx_nvmem static thermal/drivers/imx8mm: Suppress log message on probe deferral ...
| * thermal/drivers/tegra-bpmp: Check if BPMP supports trip pointsMikko Perttunen2023-08-221-1/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | Check if BPMP supports thermal trip points, and if not, do not expose the .set_trips callback to the thermal core framework. This can happen in virtualized environments where asynchronous communication with VM BPMP drivers is not available. Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221129153914.2699041-1-cyndis@kapsi.fi
| * thermal/drivers/loongson-2: Add thermal management supportYinbo Zhu2023-08-173-0/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the support for Loongson-2 thermal sensor controller, which can support maximum four sensor selectors that corresponding to four sets of thermal control registers and one set of sampling register. The sensor selector can selector a speific thermal sensor as temperature input. The sampling register is used to obtain the temperature in real time, the control register GATE field is used to set the threshold of high or low temperature, when the input temperature is higher than the high temperature threshold or lower than the low temperature threshold, an interrupt will occur. Signed-off-by: zhanghongchen <zhanghongchen@loongson.cn> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230817021007.10350-1-zhuyinbo@loongson.cn
| * thermal/drivers/ti-soc-thermal: Use helper function IS_ERR_OR_NULL()Li Zetao2023-08-171-1/+1
| | | | | | | | | | | | | | | | | | Use IS_ERR_OR_NULL() to detect an error pointer or a null pointer open-coding to simplify the code. Signed-off-by: Li Zetao <lizetao1@huawei.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230817014900.3094512-1-lizetao1@huawei.com
| * thermal/drivers/generic-adc: Removed unneeded call to platform_set_drvdata()Andrei Coardos2023-08-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file. Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230814180921.3336-1-aboutphysycs@gmail.com
| * thermal/drivers/max77620_thermal: Removed unneeded call to ↵Andrei Coardos2023-08-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | platform_set_drvdata() This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file. Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230811191548.3340-1-aboutphysycs@gmail.com
| * thermal/drivers/mediatek/auxadc_thermal: Removed call to platform_set_drvdata()Andrei Coardos2023-08-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file. Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230811192847.3838-1-aboutphysycs@gmail.com
| * thermal/drivers/sun8i_thermal: Remove unneeded call to platform_set_drvdata()Andrei Coardos2023-08-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file. Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230811194032.4240-1-aboutphysycs@gmail.com
| * thermal/drivers/broadcom/brcstb_thermal: Removed unneeded platform_set_drvdata()Andrei Coardos2023-08-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file. Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230809154813.16033-1-aboutphysycs@gmail.com
| * thermal/drivers/mediatek/lvts_thermal: Make readings valid in filtered modeNícolas F. R. A. Prado2023-08-161-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, when a controller is configured to use filtered mode, thermal readings are valid only about 30% of the time. Upon testing, it was noticed that lowering any of the interval settings resulted in an improved rate of valid data. The same was observed when decreasing the number of samples for each sensor (which also results in quicker measurements). Retrying the read with a timeout longer than the time it takes to resample (about 344us with these settings and 4 sensors) also improves the rate. Lower all timing settings to the minimum, configure the filtering to single sample, and poll the measurement register for at least one period to improve the data validity on filtered mode. With these changes in place, out of 100000 reads, a single one failed, ie 99.999% of the data was valid. Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: Chen-Yu Tsai <wenst@chromium.org> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230713154743.611870-1-nfraprado@collabora.com
| * thermal/drivers/k3_bandgap: Remove unneeded call to platform_set_drvdata()Andrei Coardos2023-08-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file. Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230810112344.3806-1-aboutphysycs@gmail.com
| * thermal/drivers/k3_j72xx_bandgap: Removed unneeded call to ↵Andrei Coardos2023-08-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | platform_set_drvdata() This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file. Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230810112015.3578-1-aboutphysycs@gmail.com
| * thermal/drivers/broadcom/sr-thermal: Removed call to platform_set_drvdata()Andrei Coardos2023-08-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file. Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230810111330.3248-1-aboutphysycs@gmail.com
| * thermal/drivers/samsung: Fix Wvoid-pointer-to-enum-cast warningKrzysztof Kozlowski2023-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | 'soc' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: exynos_tmu.c:890:14: error: cast to smaller integer type 'enum soc_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230810091318.70261-1-krzysztof.kozlowski@linaro.org
| * thermal/drivers/db8500: Remove redundant of_match_ptr()Ruan Jinjie2023-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | The driver depends on CONFIG_OF, it is not necessary to use of_match_ptr() here. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230809101439.2663042-1-ruanjinjie@huawei.com
| * thermal/drivers/mediatek: Clean up redundant dev_err_probe()Chen Jiahao2023-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Referring to platform_get_irq()'s definition, the return value has already been checked if ret < 0, and printed via dev_err_probe(). Calling dev_err_probe() one more time outside platform_get_irq() is obviously redundant. Removing dev_err_probe() outside platform_get_irq() to clean up above problem. Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230802094527.988842-1-chenjiahao16@huawei.com
| * thermal/drivers/sun8i: Free calibration nvmem after reading itMark Brown2023-08-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sun8i thermal driver reads calibration data via the nvmem API at startup, updating the device configuration and not referencing the data again. Rather than explicitly freeing the nvmem data the driver relies on devm_ to release it, even though the data is never referenced again. The allocation is still tracked so it's not leaked but this is notable when looking at the code and is a little wasteful so let's instead explicitly free the nvmem after we're done with it. Signed-off-by: Mark Brown <broonie@kernel.org> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230719-thermal-sun8i-free-nvmem-v1-1-f553d5afef79@kernel.org
| * thermal/drivers/sun8i: Remove unneeded commentsYangtao Li2023-08-161-2/+0
| | | | | | | | | | | | | | | | | | It's redundant, let's remove it. Signed-off-by: Yangtao Li <frank.li@vivo.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230626125515.18830-1-frank.li@vivo.com
| * thermal/drivers/tsens: Make tsens_xxxx_nvmem staticMin-Hua Chen2023-08-162-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the following sparse warnings: drivers/thermal/qcom/tsens-v1.c:24:40: sparse: warning: symbol 'tsens_qcs404_nvmem' was not declared. Should it be static? drivers/thermal/qcom/tsens-v0_1.c:26:40: sparse: warning: symbol 'tsens_8916_nvmem' was not declared. Should it be static? drivers/thermal/qcom/tsens-v0_1.c:42:40: sparse: warning: symbol 'tsens_8974_nvmem' was not declared. Should it be static? drivers/thermal/qcom/tsens-v0_1.c:64:40: sparse: warning: symbol 'tsens_8974_backup_nvmem' was not declared. Should it be static? No functional change intended. Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230713160415.149381-1-minhuadotchen@gmail.com
| * thermal/drivers/imx8mm: Suppress log message on probe deferralAhmad Fatoum2023-08-161-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nvmem_cell_read_u32() may return -EPROBE_DEFER if NVMEM supplier has not yet been probed. Future reprobe may succeed, so printing: i.mx8mm_thermal 30260000.tmu: Failed to read OCOTP nvmem cell (-517). to the log is confusing. Fix this by using dev_err_probe. This also elevates the message from warning to error, which is more correct: The log message is only ever printed in probe error path and probe aborts afterwards, so it really warrants an error-level message. Fixes: 403291648823 ("thermal/drivers/imx: Add support for loading calibration data from OCOTP") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230708112647.2897294-1-a.fatoum@pengutronix.de
| * thermal/drivers/mediatek/lvts: Fix parameter check in lvts_debugfs_init()Minjie Du2023-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | The documentation says "If an error occurs, ERR_PTR(-ERROR) will be returned" but the current code checks against a NULL pointer returned. Fix this by checking if IS_ERR(). Signed-off-by: Minjie Du <duminjie@vivo.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230713042413.2519-1-duminjie@vivo.com
| * thermal/drivers/mediatek/lvts_thermal: Manage threshold between sensorsNícolas F. R. A. Prado2023-08-161-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each LVTS thermal controller can have up to four sensors, each capable of triggering its own interrupt when its measured temperature crosses the configured threshold. The threshold for each sensor is handled separately by the thermal framework, since each one is registered with its own thermal zone and trips. However, the temperature thresholds are configured on the controller, and therefore are shared between all sensors on that controller. When the temperature measured by the sensors is different enough to cause the thermal framework to configure different thresholds for each one, interrupts start triggering on sensors outside the last threshold configured. To address the issue, track the thresholds required by each sensor and only actually set the highest one in the hardware, and disable interrupts for all sensors outside the current configured range. Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230706153823.201943-7-nfraprado@collabora.com
| * thermal/drivers/mediatek/lvts_thermal: Don't leave threshold zeroedNícolas F. R. A. Prado2023-08-161-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The thermal framework might leave the low threshold unset if there aren't any lower trip points. This leaves the register zeroed, which translates to a very high temperature for the low threshold. The interrupt for this threshold is then immediately triggered, and the state machine gets stuck, preventing any other temperature monitoring interrupts to ever trigger. (The same happens by not setting the Cold or Hot to Normal thresholds when using those) Set the unused threshold to a valid low value. This value was chosen so that for any valid golden temperature read from the efuse, when the value is converted to raw and back again to milliCelsius, the result doesn't underflow. Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230706153823.201943-6-nfraprado@collabora.com
| * thermal/drivers/mediatek/lvts_thermal: Disable undesired interruptsNícolas F. R. A. Prado2023-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Out of the many interrupts supported by the hardware, the only ones of interest to the driver currently are: * The temperature went over the high offset threshold, for any of the sensors * The temperature went below the low offset threshold, for any of the sensors * The temperature went over the stage3 threshold These are the only thresholds configured by the driver through the OFFSETH, OFFSETL, and PROTTC registers, respectively. The current interrupt mask in LVTS_MONINT_CONF, enables many more interrupts, including data ready on sensors for both filtered and immediate mode. These are not only not handled by the driver, but they are also triggered too often, causing unneeded overhead. Disable these unnecessary interrupts. The meaning of each bit can be seen in the comment describing LVTS_MONINTST in the IRQ handler. Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230706153823.201943-5-nfraprado@collabora.com
| * thermal/drivers/mediatek/lvts_thermal: Use offset threshold for IRQNícolas F. R. A. Prado2023-08-161-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two kinds of temperature monitoring interrupts available: * High Offset, Low Offset * Hot, Hot to normal, Cold The code currently uses the hot/h2n/cold interrupts, however in a way that doesn't work: the cold threshold is left uninitialized, which prevents the other thresholds from ever triggering, and the h2n interrupt is used as the lower threshold, which prevents the hot interrupt from triggering again after the thresholds are updated by the thermal framework, since a hot interrupt can only trigger again after the hot to normal interrupt has been triggered. But better yet than addressing those issues, is to use the high/low offset interrupts instead. This way only two thresholds need to be managed, which have a simpler state machine, making them a better match to the thermal framework's high and low thresholds. Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230706153823.201943-4-nfraprado@collabora.com
| * thermal/drivers/mediatek/lvts_thermal: Honor sensors in immediate modeNícolas F. R. A. Prado2023-08-161-24/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each controller can be configured to operate on immediate or filtered mode. On filtered mode, the sensors are enabled by setting the corresponding bits in MONCTL0, while on immediate mode, by setting MSRCTL1. Previously, the code would set MSRCTL1 for all four sensors when configured to immediate mode, but given that the controller might not have all four sensors connected, this would cause interrupts to trigger for non-existent sensors. Fix this by handling the MSRCTL1 register analogously to the MONCTL0: only enable the sensors that were declared. Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: Chen-Yu Tsai <wenst@chromium.org> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230706153823.201943-3-nfraprado@collabora.com
| * thermal/drivers/mediatek/lvts_thermal: Handle IRQ on all controllersNícolas F. R. A. Prado2023-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a single IRQ handler for each LVTS thermal domain, and it is supposed to check each of its underlying controllers for the origin of the interrupt and clear its status. However due to a typo, only the first controller was ever being handled, which resulted in the interrupt never being cleared when it happened on the other controllers. Add the missing index so interrupts are handled for all controllers. Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: Chen-Yu Tsai <wenst@chromium.org> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230706153823.201943-2-nfraprado@collabora.com
* | Merge tag 'thermal-6.6-rc1' of ↵Linus Torvalds2023-08-2829-205/+123
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull thermal control updates from Rafael Wysocki: "These rework the Intel DTS IOSF and the ACPI thermal drivers to pass tables of generic trip point structures to the core during initialization and make some requisite modifications in the thermal core, fix a few issues elsewhere and clean up code. This includes changes that are present in the ACPI updates too, because they involve both ACPI and the thermal core. The list of specific changes below is limited to thermal control, however. Specifics: - Make the ACPI thermal driver use its own Notify() handler (Michal Wilczynski) - Rework the ACPI thermal driver to use a table of generic trip point structures on top of the internal representation of trip points and remove thermal zone callbacks that are not necessary any more from that driver (Rafael Wysocki) - Fix a few issues in the Intel DTS IOSF thermal driver, clean up code in it and make it pass tables of generic trip point structures to the core during thermal zone registration (Rafael Wysocki) - Drop a redundant check from the Intel DTS IOSF thermal driver's "remove" routine (Zhang Rui) - Use module_platform_driver() to replace an open-coded counterpart of it in the int340x thermal driver (Yang Yingliang) - Fix possible uninitialized value access in __thermal_of_bind() and __thermal_of_unbind() (Peng Fan) - Make the int3400 driver use thermal zone device wrappers (Daniel Lezcano) - Remove redundant thermal zone state check from the int340x thermal driver (Daniel Lezcano) - Drop non-functional nocrt parameter from ACPI thermal (Mario Limonciello) - Explicitly include correct DT includes in the thermal core and drivers (Rob Herring)" * tag 'thermal-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: thermal: intel: intel_soc_dts_iosf: Remove redundant check thermal: intel: int340x: simplify the code with module_platform_driver() thermal/of: Fix potential uninitialized value access thermal: intel: intel_soc_dts_iosf: Use struct thermal_trip thermal: intel: intel_soc_dts_iosf: Rework critical trip setup thermal: intel: intel_soc_dts_iosf: Add helper for resetting trip points thermal: intel: intel_soc_dts_iosf: Change initialization ordering thermal: intel: intel_soc_dts_iosf: Pass sensors to update_trip_temp() thermal: intel: intel_soc_dts_iosf: Untangle update_trip_temp() thermal: intel: intel_soc_dts_iosf: Always assume notification support thermal: intel: intel_soc_dts_iosf: Drop redundant symbol definition thermal: intel: intel_soc_dts_iosf: Always use 2 trips thermal: Explicitly include correct DT includes thermal/drivers/int340x: Do not check the thermal zone state thermal/drivers/int3400: Use thermal zone device wrappers
| * \ Merge updates of thermal drivers for Intel platforms for 6.6-rc1.Rafael J. Wysocki2023-08-242-17/+4
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These remove a redundant check from a driver's "remove" routine and use module_platform_driver() to replace an open-coded version of it in one driver. * thermal-intel: thermal: intel: intel_soc_dts_iosf: Remove redundant check thermal: intel: int340x: simplify the code with module_platform_driver()
| | * | thermal: intel: intel_soc_dts_iosf: Remove redundant checkZhang Rui2023-08-221-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the redundant check in remove_dts_thermal_zone() because all of its existing callers pass a valid pointer as the argument. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| | * | thermal: intel: int340x: simplify the code with module_platform_driver()Yang Yingliang2023-08-221-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The init/exit() of the driver only calls platform_driver_{un}register(), so it can be simpilfied by using module_platform_driver(). Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * | | thermal/of: Fix potential uninitialized value accessPeng Fan2023-08-221-4/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If of_parse_phandle_with_args() called from __thermal_of_bind() or __thermal_of_unbind() fails, cooling_spec.np will not be initialized, so move the of_node_put() calls below the respective return value checks to avoid dereferencing an uninitialized pointer. Fixes: 3fd6d6e2b4e8 ("thermal/of: Rework the thermal device tree initialization") Signed-off-by: Peng Fan <peng.fan@nxp.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * | Merge ACPI thermal driver changes for 6.6-rc1.Rafael J. Wysocki2023-08-223-15/+29
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reworks the ACPI thermal driver to use a table of generic trip point structures on top of the internal representation of trip points and removes thermal zone callbacks that are not necessary any more from it. It requires some relatively small changes to be made in the thermal core too and it is based on top of changes reworking ACPI device notification handling that are included in this merge. * acpi-thermal: (24 commits) ACPI: thermal: Eliminate code duplication from acpi_thermal_notify() ACPI: thermal: Drop unnecessary thermal zone callbacks ACPI: thermal: Rework thermal_get_trend() ACPI: thermal: Use trip point table to register thermal zones thermal: core: Rework and rename __for_each_thermal_trip() ACPI: thermal: Introduce struct acpi_thermal_trip ACPI: thermal: Carry out trip point updates under zone lock ACPI: thermal: Clean up acpi_thermal_register_thermal_zone() thermal: core: Add priv pointer to struct thermal_trip thermal: core: Introduce thermal_zone_device_exec() thermal: core: Do not handle trip points with invalid temperature ACPI: thermal: Drop redundant local variable from acpi_thermal_resume() ACPI: thermal: Do not attach private data to ACPI handles ACPI: thermal: Drop enabled flag from struct acpi_thermal_active ACPI: thermal: Drop nocrt parameter ACPI: thermal: Install Notify() handler directly ACPI: NFIT: Remove unnecessary .remove callback ACPI: NFIT: Install Notify() handler directly ACPI: HED: Install Notify() handler directly ACPI: battery: Install Notify() handler directly ...
| * \ \ Merge Intel DTS IOSF thermal driver changes for 6.6-rc1.Rafael J. Wysocki2023-08-214-136/+78
| |\ \ \ | | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These fix a few issues in the Intel DTS IOSF thermal driver, clean up code in it and make it use trip point tables for registering thermal zones. * thermal-intel: thermal: intel: intel_soc_dts_iosf: Use struct thermal_trip thermal: intel: intel_soc_dts_iosf: Rework critical trip setup thermal: intel: intel_soc_dts_iosf: Add helper for resetting trip points thermal: intel: intel_soc_dts_iosf: Change initialization ordering thermal: intel: intel_soc_dts_iosf: Pass sensors to update_trip_temp() thermal: intel: intel_soc_dts_iosf: Untangle update_trip_temp() thermal: intel: intel_soc_dts_iosf: Always assume notification support thermal: intel: intel_soc_dts_iosf: Drop redundant symbol definition thermal: intel: intel_soc_dts_iosf: Always use 2 trips
| | * | thermal: intel: intel_soc_dts_iosf: Use struct thermal_tripRafael J. Wysocki2023-08-112-45/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the number of trip points in each thermal zone and their types are known to intel_soc_dts_iosf_init() prior to the registration of the thermal zones, make it create an array of struct thermal_trip entries in each struct intel_soc_dts_sensor_entry object and make add_dts_thermal_zone() use thermal_zone_device_register_with_trips() for thermal zone registration and pass that array as its second argument. Drop the sys_get_trip_temp() and sys_get_trip_type() callback functions along with the respective callback pointers in tzone_ops, because they are not necessary any more. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
| | * | thermal: intel: intel_soc_dts_iosf: Rework critical trip setupRafael J. Wysocki2023-08-114-51/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Critical trip points appear in the DTS thermal zones only after those thermal zones have been registered via intel_soc_dts_iosf_init(). Moreover, they are "created" by changing the type of an existing trip point from THERMAL_TRIP_PASSIVE to THERMAL_TRIP_CRITICAL via intel_soc_dts_iosf_add_read_only_critical_trip(), the caller of which has to be careful enough to pass at least 1 as the number of read-only trip points to intel_soc_dts_iosf_init() beforehand. This is questionable, because user space may have started to use the trips at the time when intel_soc_dts_iosf_add_read_only_critical_trip() runs and there is no synchronization between it and sys_set_trip_temp(). To address it, use the observation that nonzero number of read-only trip points is only passed to intel_soc_dts_iosf_init() when critical trip points are going to be used, so in fact that function may get all of the information regarding the critical trip points upfront and it can configure them before registering the corresponding thermal zones. Accordingly, replace the read_only_trip_count argument of intel_soc_dts_iosf_init() with a pair of new arguments related to critical trip points: a bool one indicating whether or not critical trip points are to be used at all and an int one representing the critical trip point temperature offset relative to Tj_max. Use these arguments to configure the critical trip points before the registration of the thermal zones and to compute the number of writeable trip points in add_dts_thermal_zone(). Modify both callers of intel_soc_dts_iosf_init() to take these changes into account and drop the intel_soc_dts_iosf_add_read_only_critical_trip() call, that is not necessary any more, from intel_soc_thermal_init(), which also allows it to return success right after requesting the IRQ. Finally, drop intel_soc_dts_iosf_add_read_only_critical_trip() altogether, because it does not have any more users. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
| | * | thermal: intel: intel_soc_dts_iosf: Add helper for resetting trip pointsRafael J. Wysocki2023-08-111-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because trip points are reset for each sensor in two places in the same way, add a helper function for that to reduce code duplication a bit. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>