- 09 Jan, 2023 1 commit
-
-
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linuxRafael J. Wysocki authored
Pull thermal control updates for 6.3 from Daniel Lezcano: "- Rework a large bunch of drivers to use the generic thermal trip structure and the opportunity to do more cleanups by removing unused functions in the OF code (Daniel Lezcano). - Fix some locking issues related to the generic thermal trip rework (Johan Hovold). - Fix a crash when requesting the critical temperature on tegra, this fix is related to the generic trip point (Jon Hunter). - Use strscpy() to instead of strncpy() (Xu Panda)." * tag 'generic-trip-point' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (37 commits) thermal/drivers/armada: Use strscpy() to instead of strncpy() thermal/drivers/qcom: Fix lock inversion thermal/drivers/tegra: Fix set_trip_temp() deadlock thermal/drivers/qcom: Fix set_trip_temp() deadlock thermal/drivers/mellanox: Use generic thermal_zone_get_trip() function wifi: iwlwifi: Use generic thermal_zone_get_trip() function thermal/drivers/tegra: Fix crash when getting critical temp thermal/drivers/exynos: Fix NULL pointer dereference when getting the critical temp thermal/drivers/intel: Use generic thermal_zone_get_trip() function thermal/intel/int340x: Replace parameter to simplify thermal/drivers/cxgb4: Use generic thermal_zone_get_trip() function thermal/drivers/acerhdf: Use generic thermal_zone_get_trip() function thermal/drivers/ti: Remove unused macros ti_thermal_get_trip_value() / ti_thermal_trip_is_valid() thermal/drivers/da9062: Use generic thermal_zone_get_trip() function thermal/drivers/broadcom: Use generic thermal_zone_get_trip() function thermal/drivers/rcar: Use generic thermal_zone_get_trip() function thermal/drivers/imx: Use generic thermal_zone_get_trip() function thermal/drivers/st: Use generic trip points thermal/of: Remove of_thermal_get_crit_temp() thermal/of: Remove of_thermal_set_trip_hyst() ...
-
- 06 Jan, 2023 37 commits
-
-
Xu Panda authored
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings. Signed-off-by:
Xu Panda <xu.panda@zte.com.cn> Signed-off-by:
Yang Yang <yang.yang29@zte.com> Link: https://lore.kernel.org/r/202212280945491860150@zte.com.cnSigned-off-by:
Daniel Lezcano <daniel.lezcano@kernel.org>
-
Johan Hovold authored
The thermal-zone-device lock is held by core when setting trip points and the driver takes its chip lock in the corresponding callback. Fetching the thermal trip points using thermal_zone_get_trip() also involves taking the thermal-zone-device lock, which means that the chip lock can not be held when doing so. Drop the chip lock temporarily during probe to avoid the lock inversion that was detected by lockdep: ====================================================== WARNING: possible circular locking dependency detected 6.1.0-next-20221213 #122 Not tainted ------------------------------------------------------ systemd-udevd/264 is trying to acquire lock: ffff741e444a0920 (&chip->lock){+.+.}-{3:3}, at: qpnp_tm_get_temp+0xb4/0x1b0 [qcom_spmi_temp_alarm] but task is already holding lock: ffff741e44341618 (&tz->lock){+.+.}-{3:3}, at: thermal_zone_device_update+0x2c/0x70 which lock already depends on the new lock. Fixes: 78c3e2429be8 ("thermal/drivers/qcom: Use generic thermal_zone_get_trip() function") Signed-off-by:
Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20221214131617.2447-5-johan+linaro@kernel.orgSigned-off-by:
Daniel Lezcano <daniel.lezcano@kernel.org>
-
Johan Hovold authored
The set_trip_temp() callback is used when changing the trip temperature through sysfs. As it is called with the thermal-zone-device lock held it must not use thermal_zone_get_trip() directly or it will deadlock. Fixes: 56d7b397cc29 ("thermal/drivers/tegra: Use generic thermal_zone_get_trip() function") Signed-off-by:
Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20221214131617.2447-4-johan+linaro@kernel.orgSigned-off-by:
Daniel Lezcano <daniel.lezcano@kernel.org>
-
Johan Hovold authored
The set_trip_temp() callback is used when changing the trip temperature through sysfs. As it is called with the thermal-zone-device lock held it must not use thermal_zone_get_trip() directly or it will deadlock. Fixes: 78c3e2429be8 ("thermal/drivers/qcom: Use generic thermal_zone_get_trip() function") Signed-off-by:
Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20221214131617.2447-2-johan+linaro@kernel.orgSigned-off-by:
Daniel Lezcano <daniel.lezcano@kernel.org>
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by:
Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20221014073253.3719911-2-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. The get_trip_temp, get_trip_hyst and get_trip_type are handled by the get_trip_point(). The set_trip_temp() generic function does some checks which are no longer needed in the set_trip_point() ops. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Kalle Valo <kvalo@kernel.org> Acked-by:
Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20221014073253.3719911-1-daniel.lezcano@linaro.org
-
Jon Hunter authored
Commit 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()") removed the function of_thermal_get_crit_temp() and this is causing a NULL pointer deference crash when attempting to call the 'get_crit_temp' function pointer because this function pointer is no longer initialised. Fix this by replacing the call to the 'get_crit_temp' function pointer with a call to the function thermal_zone_get_crit_temp() instead. Fixes: 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp()") Signed-off-by:
Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20221010150311.40384-1-jonathanh@nvidia.comSigned-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org>
-
Daniel Lezcano authored
The driver is assuming the get_critical temperature exists as it is inherited by the thermal of ops. But this one has been removed in favor of the generic one. Use the generic thermal_zone_get_crit_temp() function instead Fixes: 13bea86623be ("thermal/of: Remove of_thermal_get_crit_temp(") Reported-by:
Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by:
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Tested-by:
Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org>
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://lore.kernel.org/r/20221003092602.1323944-30-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
In the process of replacing the get_trip_* ops by the generic trip points, the current code has an 'override' property to add another indirection to a different ops. Rework this approach to prevent this indirection and make the code ready for the generic trip points conversion. Actually the get_temp() is different regarding the platform, so it is pointless to add a new set of ops but just create dynamically the ops at init time. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://lore.kernel.org/r/20221003092602.1323944-29-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/20221003092602.1323944-28-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Hans de Goede <hdegoede@redhat.com> Acked-by:
Peter Kästle <peter@piie.net> Link: https://lore.kernel.org/r/20221003092602.1323944-27-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The macros: ti_thermal_get_trip_value() ti_thermal_trip_is_valid() are unused. Remove them. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-26-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Link: https://lore.kernel.org/r/20221003092602.1323944-25-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20221003092602.1323944-24-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Link: https://lore.kernel.org/r/20221003092602.1323944-23-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-22-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert to the generic trip points Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-21-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The generic version of of_thermal_get_crit_temp() can be used. Let's remove this ops which is pointless. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-20-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal core is providing the generic thermal_zone_set_trip() function which does exactly what the OF ops function is doing. It is pointless to define our own version, just remove the ops and the thermal_zone_set_trip() will take care of it. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-19-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
There is no benefit with the of_thermal_is_trip_valid() function as it does the check the thermal_zone_get_trip() is already doing for the sake of getting the trip point. As all the calls have been replaced by thermal_zone_get_trip(), there is no more users of of_thermal_is_trip_valid(). Remove the function. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-18-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal OF code uses the generic trip points to initialize the thermal zone. Consequently thermal_zone_get_num_trips() can be used and the of_thermal_get_ntrips() is no longer needed. Remove it. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-17-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal core framework allows to get the number of thermal trips, use it instead of visiting the thermal core structure internals. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Link: https://lore.kernel.org/r/20221003092602.1323944-16-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-15-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Amit Kucheria <amitk@kernel.org> Reviewed-by:
Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-14-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-13-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Link: https://lore.kernel.org/r/20221003092602.1323944-12-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
Replace a single call to thermal_zone_get_trip() to get a trip point instead of calling the different ops->get_trip* Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-11-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal_zone_get_trip() does the same check as of_thermal_is_trip_valid(). Replace the call to of_thermal_is_trip_valid() by thermal_zone_get_trip(). Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-10-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal core framework allows to get the number of thermal trips, use it instead of visiting the thermal core structure internals. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-9-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-8-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
Remove the dead code: of_thermal_get_trip_points() Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-7-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. The thermal OF code uses the thermal_zone_device_register_with_trips() function. It builds the trips array and pass it to the register function. That means the get_trip_* ops are duplicated with what does already the core code. Remove them. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-6-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The governors are using the ops->get_trip_* functions, Replace these calls with thermal_zone_get_trip(). Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Zhang Rui <rui.zhang@intel.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> # IPA Acked-by:
Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/20221003092602.1323944-5-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal zone ops defines a set_trip callback where we can invoke the backend driver to set an interrupt for the next trip point temperature being crossed the way up or down, or setting the low level with the hysteresis. The ops is only called from the thermal sysfs code where the userspace has the ability to modify a trip point characteristic. With the effort of encapsulating the thermal framework core code, let's create a thermal_zone_set_trip() which is the writable side of the thermal_zone_get_trip() and put there all the ops encapsulation. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/20221003092602.1323944-4-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
Instead of avoiding to expose the hysteresis attributes of a thermal zone when its get_trip_hyst() operation is not defined, which is confusing, expose them always and use the default thermal_zone_get_trip() function returning 0 hysteresis when that operation is not present. The hysteresis of 0 is perfectly valid, so this change should not introduce any backwards compatibility issues. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/20221003092602.1323944-3-daniel.lezcano@linaro.org
-
Daniel Lezcano authored
The thermal_zone_device_ops structure defines a set of ops family, get_trip_temp(), get_trip_hyst(), get_trip_type(). Each of them is returning a property of a trip point. The result is the code is calling the ops everywhere to get a trip point which is supposed to be defined in the backend driver. It is a non-sense as a thermal trip can be generic and used by the backend driver to declare its trip points. Part of the thermal framework has been changed and all the OF thermal drivers are using the same definition for the trip point and use a thermal zone registration variant to pass those trip points which are part of the thermal zone device structure. Consequently, we can use a generic function to get the trip points when they are stored in the thermal zone device structure. This approach can be generalized to all the drivers and we can get rid of the ops->get_trip_*. That will result to a much more simpler code and make possible to rework how the thermal trip are handled in the thermal core framework as discussed previously. This change adds a function thermal_zone_get_trip() where we get the thermal trip point structure which contains all the properties (type, temp, hyst) instead of doing multiple calls to ops->get_trip_*. That opens the door for trip point extension with more attributes. For instance, replacing the trip points disabled bitmask with a 'disabled' field in the structure. Here we replace all the calls to ops->get_trip_* in the thermal core code with a call to the thermal_zone_get_trip() function. The thermal zone ops defines a callback to retrieve the critical temperature. As the trip handling is being reworked, all the trip points will be the same whatever the driver and consequently finding the critical trip temperature will be just a loop to search for a critical trip point type. Provide such a generic function, so we encapsulate the ops get_crit_temp() which can be removed when all the backend drivers are using the generic trip points handling. While at it, add the thermal_zone_get_num_trips() to encapsulate the code more and reduce the grip with the thermal framework internals. Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by:
Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by:
Zhang Rui <rui.zhang@intel.com> Link: https://lore.kernel.org/r/20221003092602.1323944-2-daniel.lezcano@linaro.org
-
- 30 Dec, 2022 1 commit
-
-
Srinivas Pandruvada authored
Commit 473be511 ("thermal: int340x: processor_thermal: Add RFIM driver")' added rfi_restriction_data_rate_base string, mmio details and documentation, but missed adding attribute to sysfs. Add missing sysfs attribute. Fixes: 473be511 ("thermal: int340x: processor_thermal: Add RFIM driver") Cc: 5.11+ <stable@vger.kernel.org> # v5.11+ Signed-off-by:
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by:
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-
- 25 Dec, 2022 1 commit
-
-
Linus Torvalds authored
-