summaryrefslogtreecommitdiff
path: root/drivers/thermal
AgeCommit message (Collapse)AuthorFilesLines
2023-10-20thermal: gov_fair_share: Rearrange get_trip_level()Rafael J. Wysocki1-16/+14
Make get_trip_level() use for_each_trip() to iterate over trip points and make it call thermal_zone_trip_id() to obtain the integer ID of a given trip point so as to avoid relying on the knowledge of struct thermal_zone_device internals. The general functionality is not expected to be changed. This change causes the governor to use trip pointers instead of trip indices everywhere except for the fair_share_throttle() second argument that will be modified subsequently along with the definition of the governor .throttle() callback. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2023-10-20thermal: trip: Define for_each_trip() macroRafael J. Wysocki2-3/+7
Define a new macro for_each_trip() to be used by the thermal core code and thermal governors for walking trips in a given thermal zone. Modify for_each_thermal_trip() to use this macro instead of an open- coded loop over trips. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
2023-10-20thermal: trip: Simplify computing trip indicesRafael J. Wysocki1-8/+5
A trip index can be computed right away as a difference between the value of a trip pointer pointing to the given trip object and the start of the trips[] table in the given thermal zone, so change thermal_zone_trip_id() accordingly. No intentional functional impact (except for some speedup). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Tested-by: Lukasz Luba <lukasz.luba@arm.com>
2023-10-11Merge branch 'acpi-thermal'Rafael J. Wysocki2-23/+0
The ACPI thermal driver changes include some thermal core modifications that are depended on by subsequent thermal core changes, so merge them. * acpi-thermal: (26 commits) thermal: trip: Drop lockdep assertion from thermal_zone_trip_id() thermal: trip: Remove lockdep assertion from for_each_thermal_trip() thermal: core: Drop thermal_zone_device_exec() ACPI: thermal: Use thermal_zone_for_each_trip() for updating trips ACPI: thermal: Combine passive and active trip update functions ACPI: thermal: Move get_active_temp() ACPI: thermal: Fix up function header formatting in two places ACPI: thermal: Drop list of device ACPI handles from struct acpi_thermal ACPI: thermal: Rename structure fields holding temperature in deci-Kelvin ACPI: thermal: Drop critical_valid and hot_valid trip flags ACPI: thermal: Do not use trip indices for cooling device binding ACPI: thermal: Mark uninitialized active trips as invalid ACPI: thermal: Merge trip initialization functions ACPI: thermal: Collapse trip devices update function wrappers ACPI: thermal: Collapse trip devices update functions ACPI: thermal: Add device list to struct acpi_thermal_trip ACPI: thermal: Fix a small leak in acpi_thermal_add() ACPI: thermal: Drop valid flag from struct acpi_thermal_trip ACPI: thermal: Drop redundant trip point flags ACPI: thermal: Untangle initialization and updates of active trips ...
2023-10-11thermal: trip: Drop lockdep assertion from thermal_zone_trip_id()Rafael J. Wysocki1-2/+0
The lockdep assertion in thermal_zone_trip_id() triggers when the trip point sysfs attribute of a thermal instance is read, because there is no thermal zone locking in that code path. This is not verly useful, though, because there is no mechanism by which the location of the trips[] table in a thermal zone or its size can change after binding cooling devices to the trips in that thermal zone and before those cooling devices are unbound from them. Thus it is not in fact necessary to hold the thermal zone lock when thermal_zone_trip_id() is called from trip_point_show() and so the lockdep asserion in the former is invalid. Accordingly, drop that lockdep assertion. Fixes: 2c7b4bfadef0 ("thermal: core: Store trip pointer in struct thermal_instance") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-10-11thermal: core: prevent potential string overflowDan Carpenter1-2/+4
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>
2023-10-07thermal: trip: Remove lockdep assertion from for_each_thermal_trip()Rafael J. Wysocki1-2/+0
The lockdep assertion in for_each_thermal_trip() was added to possibly catch incorrect usage of that function without the thermal zone lock. However, it turns out that the ACPI thermal driver has a legitimate reason to call for_each_thermal_trip() without locking. Namely, it is called by acpi_thermal_bind_unbind_cdev() in the thermal zone registration and unregistration paths. That function cannot acquire the thermal zone lock by itself, because it calls functions that acquire it, thermal_bind_cdev_to_trip() or thermal_unbind_cdev_from_trip(). However, it is invoked when the ACPI notify handler for the thermal zone in question has not been registered yet (in the registration path) or after that handler has been unregistered (in the unregistration path). Therefore, when for_each_thermal_trip() is called by acpi_thermal_bind_unbind_cdev(), thermal trip changes induced by the platform firmware cannot take place and so the thermal zone's trips[] table is effectively immutable. Hence, it is valid to call for_each_thermal_trip() from acpi_thermal_bind_unbind_cdev() without locking and the lockdep assertion in the former is in fact incorrect, so remove it. Fixes: d5ea889246b1 ("ACPI: thermal: Do not use trip indices for cooling device binding") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-10-05thermal: core: Drop thermal_zone_device_exec()Rafael J. Wysocki1-19/+0
Because thermal_zone_device_exec() has no users any more and there are no plans to use it anywhere, revert commit 9a99a996d1ec ("thermal: core: Introduce thermal_zone_device_exec()") that introduced it. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2023-10-05thermal: core: Add function to walk trips under zone lockRafael J. Wysocki1-0/+14
Add a wrapper around for_each_thermal_trip(), called thermal_zone_for_each_trip(), that will invoke the former under the thermal zone lock and pass its return value to the caller. Two drivers will be modified subsequently to use this new function. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2023-09-28thermal: core: Allow trip pointers to be used for cooling device bindingRafael J. Wysocki1-20/+34
Add new helper functions, thermal_bind_cdev_to_trip() and thermal_unbind_cdev_from_trip(), to allow a trip pointer to be used for binding a cooling device to a trip point and unbinding it, respectively, and redefine the existing helpers, thermal_zone_bind_cooling_device() and thermal_zone_unbind_cooling_device(), as wrappers around the new ones, respectively. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2023-09-28thermal: core: Store trip pointer in struct thermal_instanceRafael J. Wysocki9-37/+60
Replace the integer trip number stored in struct thermal_instance with a pointer to the relevant trip and adjust the code using the structure in question accordingly. The main reason for making this change is to allow the trip point to cooling device binding code more straightforward, as illustrated by subsequent modifications of the ACPI thermal driver, but it also helps to clarify the overall design and allows the governor code overhead to be reduced (through subsequent modifications). The only case in which it adds complexity is trip_point_show() that needs to walk the trips[] table to find the index of the given trip point, but this is not a critical path and the interface that trip_point_show() belongs to is problematic anyway (for instance, it doesn't cover the case when the same cooling devices is associated with multiple trip points). This is a preliminary change and the affected code will be refined by a series of subsequent modifications of thermal governors, the core and the ACPI thermal driver. The general functionality is not expected to be affected by this change. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2023-09-26thermal: trip: Drop redundant trips check from for_each_thermal_trip()Rafael J. Wysocki1-3/+0
It is invalid to call for_each_thermal_trip() on an unregistered thermal zone anyway, and as per thermal_zone_device_register_with_trips(), the trips[] table must be present if num_trips is greater than zero for the given thermal zone. Hence, the trips check in for_each_thermal_trip() is redundant and so it can be dropped. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2023-09-25thermal: core: Drop trips_disabled bitmaskRafael J. Wysocki1-13/+0
After recent changes, thermal_zone_get_trip() cannot fail, as invoked from thermal_zone_device_register_with_trips(), so the only role of the trips_disabled bitmask is struct thermal_zone_device is to make handle_thermal_trip() skip trip points whose temperature was initially zero. However, since the unit of temperature in the thermal core is millicelsius, zero may very well be a valid temperature value at least in some usage scenarios and the trip temperature may as well change later. Thus there is no reason to permanently disable trip points with initial temperature equal to zero. Accordingly, drop the trips_disabled bitmask along with the code related to it. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Ido Schimmel <idosch@nvidia.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2023-09-18thermal: sysfs: Fix trip_point_hyst_store()Rafael J. Wysocki1-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+
2023-09-14thermal: core: Fix disabled trip point check in handle_thermal_trip()Rafael J. Wysocki1-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>
2023-09-11thermal: Constify the trip argument of the .get_trend() zone callbackRafael J. Wysocki1-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>
2023-09-11thermal/of: add missing of_node_put()Julia Lawall1-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>
2023-09-05thermal: core: Drop thermal_zone_device_register()Rafael J. Wysocki1-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>
2023-09-05thermal: Use thermal_tripless_zone_device_register()Rafael J. Wysocki5-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>
2023-09-05thermal: core: Add function for registering tripless thermal zonesRafael J. Wysocki1-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>
2023-08-29thermal: core: Rework .get_trend() thermal zone callbackRafael J. Wysocki3-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>
2023-08-29thermal: core: Drop unused .get_trip_*() callbacksRafael J. Wysocki2-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>
2023-08-29Merge tag 'thermal-v6.6-rc1' of ↵Rafael J. Wysocki19-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 ...
2023-08-29Merge tag 'thermal-6.6-rc1' of ↵Linus Torvalds29-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
2023-08-29Merge tag 'acpi-6.6-rc1' of ↵Linus Torvalds3-15/+29
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull ACPI updates from Rafael Wysocki: "These include new ACPICA material, a rework of the ACPI thermal driver, a switch-over of the ACPI processor driver to using _OSC instead of (long deprecated) _PDC for CPU initialization, a rework of firmware notifications handling in several drivers, fixes and cleanups for suspend-to-idle handling on AMD systems, ACPI backlight driver updates and more. Specifics: - Update the ACPICA code in the kernel to upstream revision 20230628 including the following changes: - Suppress a GCC 12 dangling-pointer warning (Philip Prindeville) - Reformat the ACPI_STATE_COMMON macro and its users (George Guo) - Replace the ternary operator with ACPI_MIN() (Jiangshan Yi) - Add support for _DSC as per ACPI 6.5 (Saket Dumbre) - Remove a duplicate macro from zephyr header (Najumon B.A) - Add data structures for GED and _EVT tracking (Jose Marinho) - Fix misspelled CDAT DSMAS define (Dave Jiang) - Simplify an error message in acpi_ds_result_push() (Christophe Jaillet) - Add a struct size macro related to SRAT (Dave Jiang) - Add AML_NO_OPERAND_RESOLVE flag to Timer (Abhishek Mainkar) - Add support for RISC-V external interrupt controllers in MADT (Sunil V L) - Add RHCT flags, CMO and MMU nodes (Sunil V L) - Change ACPICA version to 20230628 (Bob Moore) - Introduce new wrappers for ACPICA notify handler install/remove and convert multiple drivers to using their own Notify() handlers instead of the ACPI bus type .notify() slated for removal (Michal Wilczynski) - Add backlight=native DMI quirk for Apple iMac12,1 and iMac12,2 (Hans de Goede) - Put ACPI video and its child devices explicitly into D0 on boot to avoid platform firmware confusion (Kai-Heng Feng) - Add backlight=native DMI quirk for Lenovo Ideapad Z470 (Jiri Slaby) - Support obtaining physical CPU ID from MADT on LoongArch (Bibo Mao) - Convert ACPI CPU initialization to using _OSC instead of _PDC that has been depreceted since 2018 and dropped from the specification in ACPI 6.5 (Michal Wilczynski, Rafael Wysocki) - Drop non-functional nocrt parameter from ACPI thermal (Mario Limonciello) - Clean up the ACPI thermal driver, rework the handling of firmware notifications in it and make it provide a table of generic trip point structures to the core during initialization (Rafael Wysocki) - Defer enumeration of devices with _DEP pointing to IVSC (Wentong Wu) - Install SystemCMOS address space handler for ACPI000E (TAD) to meet platform firmware expectations on some platforms (Zhang Rui) - Fix finding the generic error data in the ACPi extlog driver for compatibility with old and new firmware interface versions (Xiaochun Lee) - Remove assorted unused declarations of functions (Yue Haibing) - Move AMBA bus scan handling into arm64 specific directory (Sudeep Holla) - Fix and clean up suspend-to-idle interface for AMD systems (Mario Limonciello, Andy Shevchenko) - Fix string truncation warning in pnpacpi_add_device() (Sunil V L)" * tag 'acpi-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (66 commits) ACPI: x86: s2idle: Add a function to get LPS0 constraint for a device ACPI: x86: s2idle: Add for_each_lpi_constraint() helper ACPI: x86: s2idle: Add more debugging for AMD constraints parsing ACPI: x86: s2idle: Fix a logic error parsing AMD constraints table ACPI: x86: s2idle: Catch multiple ACPI_TYPE_PACKAGE objects ACPI: x86: s2idle: Post-increment variables when getting constraints ACPI: Adjust #ifdef for *_lps0_dev use ACPI: TAD: Install SystemCMOS address space handler for ACPI000E ACPI: Remove assorted unused declarations of functions ACPI: extlog: Fix finding the generic error data for v3 structure PNP: ACPI: Fix string truncation warning ACPI: Remove unused extern declaration acpi_paddr_to_node() ACPI: video: Add backlight=native DMI quirk for Apple iMac12,1 and iMac12,2 ACPI: video: Put ACPI video and its child devices into D0 on boot ACPI: processor: LoongArch: Get physical ID from MADT ACPI: scan: Defer enumeration of devices with a _DEP pointing to IVSC device 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 ...
2023-08-29Merge tag 'perf-core-2023-08-28' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull perf event updates from Ingo Molnar: - AMD IBS improvements - Intel PMU driver updates - Extend core perf facilities & the ARM PMU driver to better handle ARM big.LITTLE events - Micro-optimize software events and the ring-buffer code - Misc cleanups & fixes * tag 'perf-core-2023-08-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/uncore: Remove unnecessary ?: operator around pcibios_err_to_errno() call perf/x86/intel: Add Crestmont PMU x86/cpu: Update Hybrids x86/cpu: Fix Crestmont uarch x86/cpu: Fix Gracemont uarch perf: Remove unused extern declaration arch_perf_get_page_size() perf: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability arm_pmu: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability perf/x86/ibs: Set mem_lvl_num, mem_remote and mem_hops for data_src perf/mem: Add PERF_MEM_LVLNUM_NA to PERF_MEM_NA perf/mem: Introduce PERF_MEM_LVLNUM_UNC perf/ring_buffer: Use local_try_cmpxchg in __perf_output_begin locking/arch: Avoid variable shadowing in local_try_cmpxchg() perf/core: Use local64_try_cmpxchg in perf_swevent_set_period perf/x86: Use local64_try_cmpxchg perf/amd: Prevent grouping of IBS events
2023-08-25Merge branch 'acpi-thermal'Rafael J. Wysocki3-15/+29
Merge ACPI thermal driver changes for 6.6-rc1: - Drop non-functional nocrt parameter from ACPI thermal (Mario Limonciello). - Clean up the ACPI thermal driver, rework the handling of firmware notifications in it and make it provide a table of generic trip point structures to the core during initialization (Rafael Wysocki). * acpi-thermal: 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
2023-08-24Merge updates of thermal drivers for Intel platforms for 6.6-rc1.Rafael J. Wysocki2-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()
2023-08-22thermal: intel: intel_soc_dts_iosf: Remove redundant checkZhang Rui1-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>
2023-08-22thermal: intel: int340x: simplify the code with module_platform_driver()Yang Yingliang1-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>
2023-08-22thermal/of: Fix potential uninitialized value accessPeng Fan1-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>
2023-08-22thermal/drivers/tegra-bpmp: Check if BPMP supports trip pointsMikko Perttunen1-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
2023-08-22Merge ACPI thermal driver changes for 6.6-rc1.Rafael J. Wysocki3-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 ...
2023-08-21Merge Intel DTS IOSF thermal driver changes for 6.6-rc1.Rafael J. Wysocki4-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
2023-08-17thermal: core: Rework and rename __for_each_thermal_trip()Rafael J. Wysocki2-14/+8
Rework the currently unused __for_each_thermal_trip() to pass original pointers to struct thermal_trip objects to the callback, so it can be used for updating trip data (e.g. temperatures), rename it to for_each_thermal_trip() and make it available to modular drivers. Suggested-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-08-17thermal: core: Introduce thermal_zone_device_exec()Rafael J. Wysocki1-0/+19
Introduce a new helper function, thermal_zone_device_exec(), that can be used by drivers to run a given callback routine under the zone lock. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-08-17thermal/drivers/loongson-2: Add thermal management supportYinbo Zhu3-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
2023-08-17thermal/drivers/ti-soc-thermal: Use helper function IS_ERR_OR_NULL()Li Zetao1-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
2023-08-16thermal/drivers/generic-adc: Removed unneeded call to platform_set_drvdata()Andrei Coardos1-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
2023-08-16thermal/drivers/max77620_thermal: Removed unneeded call to ↵Andrei Coardos1-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
2023-08-16thermal/drivers/mediatek/auxadc_thermal: Removed call to platform_set_drvdata()Andrei Coardos1-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
2023-08-16thermal/drivers/sun8i_thermal: Remove unneeded call to platform_set_drvdata()Andrei Coardos1-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
2023-08-16thermal/drivers/broadcom/brcstb_thermal: Removed unneeded platform_set_drvdata()Andrei Coardos1-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
2023-08-16thermal/drivers/mediatek/lvts_thermal: Make readings valid in filtered modeNícolas F. R. A. Prado1-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
2023-08-16thermal/drivers/k3_bandgap: Remove unneeded call to platform_set_drvdata()Andrei Coardos1-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
2023-08-16thermal/drivers/k3_j72xx_bandgap: Removed unneeded call to ↵Andrei Coardos1-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
2023-08-16thermal/drivers/broadcom/sr-thermal: Removed call to platform_set_drvdata()Andrei Coardos1-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
2023-08-16thermal/drivers/samsung: Fix Wvoid-pointer-to-enum-cast warningKrzysztof Kozlowski1-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
2023-08-16thermal/drivers/db8500: Remove redundant of_match_ptr()Ruan Jinjie1-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
2023-08-16thermal/drivers/mediatek: Clean up redundant dev_err_probe()Chen Jiahao1-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