- Add dynamic thresholds for trip point crossing detection to prevent
trip point crossing notifications from being sent at incorrect times
or not at all in some cases (Rafael J. Wysocki).
- Fix synchronization issues related to the resume of thermal zones
during a system-wide resume and allow thermal zones to be resumed
concurrently (Rafael J. Wysocki).
- Modify the thermal zone unregistration to wait for the given zone to
go away completely before returning to the caller and rework the
sysfs interface for trip points on top of that (Rafael J. Wysocki).
- Fix a possible NULL pointer dereference in thermal zone registration
error path (Rafael J. Wysocki).
- Clean up the IPA thermal governor and modify it (with the help of a
new governor callback) to avoid allocating and freeing memory every
time its throttling callback is invoked (Lukasz Luba).
- Make the IPA thermal governor handle thermal instance weight changes
via sysfs correctly (Lukasz Luba).
- Update the thermal netlink code to avoid sending messages if there
are no recipients (Stanislaw Gruszka).
- Convert Mediatek Thermal to the json-schema (Rafał Miłecki).
- Fix thermal DT bindings issue on Loongson (Binbin Zhou).
- Fix returning NULL instead of -ENODEV during thermal probe on
Loogsoon (Binbin Zhou).
- Add thermal DT binding for tsens on the SM8650 platform (Neil
Armstrong).
- Add reboot on the critical trip point crossing option feature (Fabio
Estevam).
- Use DEFINE_SIMPLE_DEV_PM_OPS do define PM functions for thermal
suspend/resume on AmLogic (Uwe Kleine-König)
- Add D1/T113s THS controller support to the Sun8i thermal control
driver (Maxim Kiselev)
- Fix example in the thermal DT binding for QCom SPMI (Johan Hovold).
- Fix compilation warning in the tmon utility (Florian Eckert).
- Add support for interrupt-based thermal configuration on Exynos along
with a set of related cleanups (Mateusz Majewski).
- Make the Intel HFI thermal driver enable an HFI instance (eg. processor
package) from its first online CPU and disable it when the last CPU in
it goes offline (Ricardo Neri).
- Fix a kernel-doc warning and a spello in the cpuidle_cooling thermal
driver (Randy Dunlap).
- Move the .get_temp() thermal zone callback presence check to the
thermal zone registration code (Daniel Lezcano).
- Use the for_each_trip() macro for trip points table walks in a few
places in the thermal core (Rafael J. Wysocki).
- Make all trip point updates (via sysfs as well as from the platform
firmware) trigger trip change notifications (Rafael J. Wysocki).
- Drop redundant code from the thermal core and make one function in
it take a const pointer argument (Rafael J. Wysocki).
-----BEGIN PGP SIGNATURE-----
iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmWb8iUSHHJqd0Byand5
c29ja2kubmV0AAoJEILEb/54YlRxKLkP/iDsuDwmhZAjbAu2iftk/8ad8Trm2VoK
+9eZ5Eqa8lKEcJLb0RxueTnFT4ppvT/hY99HOG4FM+mCnWeH/Z32N697DhqiUg4v
GZUpeOPzxYgsfOOTeuL5XgfrVMgBjJrJunTXmzgAd8lIhTmRbAMVmFVJ18CJO11O
RHgqvYznYFi5cywA9/NkG2xkhFB0VDoiTuIiuMMV+pMjqF0d5ooBMkhmjvPQ5Rp9
FjNJ7hqiTamAsDPdULAFqhIGGhKZWWFbh4+S+JPCwBW8nqvxyJpemsm20vrwctJR
bSXWQkgkDpWEeg9yrEAOO/Uk9yGd3jiLfkvPBKbK0x/YxGZ4hOYHcbF3cOUvmPYP
5K3ZJ61DNrzB/5S3LY54VYrWmTVRdK6Lk3HYNvfAUYFJZMZ5oMYZLCUmo4SswUdy
UUEIY27H7L18eLhP9zCcKo4njdaVG+vXQn/rJIFOpG0k9OElzPs1X8Dp/m9pKQDR
rDUsMXqB34NUVrIEhjAgqvwF5xHooW8gykpuJgxwBetA9w8Pls2A/mzLsDY3wgdQ
htiANGpKTDqBQSn+HrjzYckv9/R+1tDyTJmEDNZwllA1DJfrOlpCRD2VHRpgTZEA
Ldnq0bhyq6RQnousqxhgpYkIAoGaebs9XasRH0YtBG5gIumeWfqeVzmTcM5xdsNB
yf6RdQy8QunS
=QVyh
-----END PGP SIGNATURE-----
Merge tag 'thermal-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control updates from Rafael Wysocki:
"These add support for the D1/T113s THS controller to the sun8i driver
and a DT-based mechanism for platforms to indicate a preference to
reboot (instead of shutting down) on crossing a critical trip point,
fix issues, make other improvements (in the IPA governor, the Intel
HFI driver, the exynos driver and the thermal netlink interface among
other places) and clean up code.
One long-standing issue addressed here is that trip point crossing
notifications sent to user space might be unreliable due to the
incorrect handling of trip point hysteresis in the thermal core:
multiple notifications might be sent for the same event or there might
be events without any notification at all.
Specifics:
- Add dynamic thresholds for trip point crossing detection to prevent
trip point crossing notifications from being sent at incorrect
times or not at all in some cases (Rafael J. Wysocki)
- Fix synchronization issues related to the resume of thermal zones
during a system-wide resume and allow thermal zones to be resumed
concurrently (Rafael J. Wysocki)
- Modify the thermal zone unregistration to wait for the given zone
to go away completely before returning to the caller and rework the
sysfs interface for trip points on top of that (Rafael J. Wysocki)
- Fix a possible NULL pointer dereference in thermal zone
registration error path (Rafael J. Wysocki)
- Clean up the IPA thermal governor and modify it (with the help of a
new governor callback) to avoid allocating and freeing memory every
time its throttling callback is invoked (Lukasz Luba)
- Make the IPA thermal governor handle thermal instance weight
changes via sysfs correctly (Lukasz Luba)
- Update the thermal netlink code to avoid sending messages if there
are no recipients (Stanislaw Gruszka)
- Convert Mediatek Thermal to the json-schema (Rafał Miłecki)
- Fix thermal DT bindings issue on Loongson (Binbin Zhou)
- Fix returning NULL instead of -ENODEV during thermal probe on
Loogsoon (Binbin Zhou)
- Add thermal DT binding for tsens on the SM8650 platform (Neil
Armstrong)
- Add reboot on the critical trip point crossing option feature
(Fabio Estevam)
- Use DEFINE_SIMPLE_DEV_PM_OPS do define PM functions for thermal
suspend/resume on AmLogic (Uwe Kleine-König)
- Add D1/T113s THS controller support to the Sun8i thermal control
driver (Maxim Kiselev)
- Fix example in the thermal DT binding for QCom SPMI (Johan Hovold)
- Fix compilation warning in the tmon utility (Florian Eckert)
- Add support for interrupt-based thermal configuration on Exynos
along with a set of related cleanups (Mateusz Majewski)
- Make the Intel HFI thermal driver enable an HFI instance (eg.
processor package) from its first online CPU and disable it when
the last CPU in it goes offline (Ricardo Neri)
- Fix a kernel-doc warning and a spello in the cpuidle_cooling
thermal driver (Randy Dunlap)
- Move the .get_temp() thermal zone callback presence check to the
thermal zone registration code (Daniel Lezcano)
- Use the for_each_trip() macro for trip points table walks in a few
places in the thermal core (Rafael J. Wysocki)
- Make all trip point updates (via sysfs as well as from the platform
firmware) trigger trip change notifications (Rafael J. Wysocki)
- Drop redundant code from the thermal core and make one function in
it take a const pointer argument (Rafael J. Wysocki)"
* tag 'thermal-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (64 commits)
thermal: trip: Constify thermal zone argument of thermal_zone_trip_id()
thermal: intel: hfi: Disable an HFI instance when all its CPUs go offline
thermal: intel: hfi: Enable an HFI instance from its first online CPU
thermal: intel: hfi: Refactor enabling code into helper functions
thermal/drivers/exynos: Use set_trips ops
thermal/drivers/exynos: Use BIT wherever possible
thermal/drivers/exynos: Split initialization of TMU and the thermal zone
thermal/drivers/exynos: Stop using the threshold mechanism on Exynos 4210
thermal/drivers/exynos: Simplify regulator (de)initialization
thermal/drivers/exynos: Handle devm_regulator_get_optional return value correctly
thermal/drivers/exynos: Wwitch from workqueue-driven interrupt handling to threaded interrupts
thermal/drivers/exynos: Drop id field
thermal/drivers/exynos: Remove an unnecessary field description
tools/thermal/tmon: Fix compilation warning for wrong format
dt-bindings: thermal: qcom-spmi-adc-tm5/hc: Clean up examples
dt-bindings: thermal: qcom-spmi-adc-tm5/hc: Fix example node names
thermal/drivers/sun8i: Add D1/T113s THS controller support
dt-bindings: thermal: sun8i: Add binding for D1/T113s THS controller
thermal: amlogic: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
thermal: amlogic: Make amlogic_thermal_disable() return void
...
Merge ACPI thermal zone driver updates for 6.8-rc1:
- Use generic ACPI helpers for evaluating trip point temperature
objects in the ACPI thermal zone driver (Rafael J. Wysockii, Arnd
Bergmann).
- Add Thermal fast Sampling Period (_TFP) support to the ACPI thermal
zone driver (Jeff Brasen).
* acpi-thermal:
ACPI: thermal_lib: include "internal.h" for function prototypes
ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support
ACPI: thermal: Use library functions to obtain trip point temperature values
ACPI: thermal_lib: Add functions returning temperature in deci-Kelvin
thermal: ACPI: Move the ACPI thermal library to drivers/acpi/
There are only 4 users of acpi_evaluate_reference() and none of them
actually cares about the reason why it fails. All of them are only
interested in whether or not it is successful, so it can return a bool
value indicating that.
Modify acpi_evaluate_reference() as per the observation above and update
its callers accordingly so as to get rid of useless code and local
variables.
The observable behavior of the kernel is not expected to change after
this modification of the code.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The _store callbacks of the trip point temperature and hysteresis sysfs
attributes invoke thermal_notify_tz_trip_change() to send a notification
regarding the trip point change, but when trip points are updated by the
platform firmware, trip point change notifications are not sent.
To make the behavior after a trip point change more consistent,
modify all of the 3 places where trip point temperature is updated
to use a new function called thermal_zone_set_trip_temp() for this
purpose and make that function call thermal_notify_tz_trip_change().
Note that trip point hysteresis can only be updated via sysfs and
trip_point_hyst_store() calls thermal_notify_tz_trip_change() already,
so this code path need not be changed.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Add support of "Thermal fast Sampling Period (_TFP)" for passive
cooling.
As per the ACPI specification (ACPI 6.5, Section 11.4.17 "_TFP (Thermal
fast Sampling Period)", _TFP overrides _TSP ("Thermal Sampling Period"
if both are present in a Thermal zone.
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Co-developed-by: Sumit Gupta <sumitg@nvidia.com>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Modify the ACPI thermal driver to use functions from the ACPI thermal
library to obtain trip point temperature values instead of duplicating
them locally.
Among other things, this requires the functions in question to be
exported to it, because it can be built as a module.
It effectively changes the behavior of the driver to treat temperature
values out of the reasonable range (-55 centigrade to 175 centigrade) as
invalid, but there is no other expected functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Fix the acpi_thermal_add() error path that may do a double-free
in some cases after recent changes (Dan Carpenter).
-----BEGIN PGP SIGNATURE-----
iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmVFBpgSHHJqd0Byand5
c29ja2kubmV0AAoJEILEb/54YlRx7y4P/j8xXFy5HbP+Qd5qNGTNPhmdhpC0OB72
cqbWujNv0EK6OhryK54qI5gh4z7NoX7QBb6vmGPHNsKCtPdrOY/+IU1YfYAx6o6W
00jcDr08iPqr1CNxpwn+4OSCH6cJualQCAtD+7MGmFwh2OlH0GsohlZEeti0bzt7
+2uEK1M7zGP7K0UBGeNs/epynWlikmgDX8g6rxFbjtyyTdbWwvi7Vkq9WV+09MUj
lMirq3Pmzc9kesoGEFJXSySugfGL1YWwDme8xOX9cjsIcX32KbcutbH7sMqBWiB9
nQePTF/S1gXbcQ+pXrO/KJnueOOkMgPBiqahAEVNSjfgd/KbscLaWAlMGfSzyvqo
UCWu2jN2WdnRv7B+RS3SAVejTBR4OYjHAHkTRIk+0JvbzD4tNaVdbK0zp2zxVphh
tNB2hbD3mJA5DMbqP9nbcUvkWoYcwLFUgTGKyAzp4fKSq7ct+80ove8D5eJOf94Z
YLgiMDpPjLYxboPz5JiwNk70CHQkqiMF9hQVYHmHfAPO36lcoo8zcu5vnmJaKUAz
HdrGksgs5quuYZfRYexaSB5995nr7E72g5HBkCCu4t0vTGoJ5fN8c8cepRGSWCKp
WNmPR/DGrc4y1CcJo4MnPvAMvCcExhgbpD++rLBew5AD4q663bkzB9FPghqehHIr
nFAtlS4l57WE
=LLgE
-----END PGP SIGNATURE-----
Merge tag 'acpi-6.7-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fix from Rafael Wysocki:
"Fix the acpi_thermal_add() error path that may do a double-free in
some cases after recent changes (Dan Carpenter)"
* tag 'acpi-6.7-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI: thermal: Fix acpi_thermal_unregister_thermal_zone() cleanup
- Add symbol definitions related to CDAT to the ACPICA code (Dave
Jiang).
- Use the acpi_device_is_present() helper in more places and rename
acpi_scan_device_not_present() to be about enumeration (James Morse).
- Add __printf format attribute to acpi_os_vprintf() (Su Hui).
- Clean up departures from kernel coding style in the low-level
interface for ACPICA (Jonathan Bergh).
- Replace strncpy() with strscpy() in acpi_osi_setup() (Justin Stitt).
- Fail FPDT parsing on zero length records and add proper handling for
fpdt_process_subtable() to acpi_init_fpdt() (Vasily Khoruzhick).
- Rework acpi_handle_list handling so as to manage it dynamically,
including size computation (Rafael Wysocki).
- Clean up ACPI utilities code so as to make it follow the kernel
coding style (Jonathan Bergh).
- Consolidate IRQ trigger-type override DMI tables and drop .ident
values from dmi_system_id tables used for ACPI resources management
quirks (Hans de Goede).
- Add ACPI IRQ override for TongFang GMxXGxx (Werner Sembach).
- Allow _DSD buffer data only for byte accessors and document the _DSD
data buffer GUID (Andy Shevchenko).
- Drop BayTrail and Lynxpoint pinctrl device IDs from the ACPI LPSS
driver, because it does not need them (Raag Jadav).
- Add acpi_backlight=vendor quirk for Toshiba Portégé R100 (Ondrej
Zary).
- Add "vendor" backlight quirks for 3 Lenovo x86 Android tablets (Hans
de Goede).
- Move Xiaomi Mi Pad 2 backlight quirk to its own section (Hans de
Goede).
- Annotate struct prm_module_info with __counted_by (Kees Cook).
- Fix AER info corruption in aer_recover_queue() when error status data
has multiple sections (Shiju Jose).
- Make APEI use ERST maximum execution time for slow devices (Jeshua
Smith).
- Add support for platform notification handling to the PCC mailbox
driver and modify it to support shared interrupts for multiple
subspaces (Huisong Li).
- Define common macros to use when referring to various bitfields in the
PCC generic communications channel command and status fields and use
them in some drivers (Sudeep Holla).
- Add EC GPE detection quirk for HP 250 G7 Notebook PC (Jonathan
Denose).
- Fix and clean up create_pnp_modalias() and create_of_modalias()
(Christophe JAILLET).
- Modify 2 pieces of code to use acpi_evaluate_dsm_typed() (Andy
Shevchenko).
- Define acpi_dev_uid_match() for matching _UID and use it in several
places (Raag Jadav).
- Use acpi_device_uid() for fetching _UID in 2 places (Raag Jadav).
- Add context argument to acpi_dev_install_notify_handler() (Rafael
Wysocki).
- Clarify ACPI bus concepts in the ACPI device enumeration
documentation (Rafael Wysocki).
- Switch over the ACPI AC and ACPI PAD drivers to using the platform
driver interface which, is more logically consistent than binding a
driver directly to an ACPI device object, and clean them up (Michal
Wilczynski).
- Replace strncpy() in the PNP code with either memcpy() or strscpy()
as appropriate (Justin Stitt).
- Clean up coding style in pnp.h (GuoHua Cheng).
-----BEGIN PGP SIGNATURE-----
iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmU6bTISHHJqd0Byand5
c29ja2kubmV0AAoJEILEb/54YlRxQ4AQALW9JR9te3ohnm77rpoODP5UQlfJwTYw
xppbSqfVfJbckqJArbjWXCmv1vUHLth/q8Ojd7+shkAQ4nU9v91gWKXkG/pXFnHa
PcIT8OAwverqI0fVomxSipQS/tiA0HMLz9uUa62yjRXagyvuQW0xfhToe0NU9BBx
kEXLOMztpsgfzxZtxmTcYgkzDW8/87FVR9PuBAa+vf4p46QoYAS+AXhXUlYT3guA
VRT54cwyaNxKa4PecoIcr3FvabCrtKCyNvZrKf6/xxM3XepWp7pW8RINwNy6B+lZ
X/dDLHf0XVN2h21GydfB/StPNssSIjpZZUOrJ5kv+VnOBeRTLt8kPKFdo3ZiqjT8
VUTq4aj4qmJO6A8K32bxFs7Bb/tWVviIKX2O+EVPjNSUHu0yMG5UbkcR03yRXvdy
L6cijuXZwCvSsPiOTGXRya3Ea1yGNgPEf3iAaFPMUjE064KjZb6+emtPk1JeYzDg
qGRhuwD0wuckSAUkpB3SNoWqD2fTEaRSWCCivakRbCCp0mG6QWvDT2JBlx/YRKqq
Wxg+oYXE2PJTuVc1DF1xUW7K45h9l0DhIejFKqm4cibfMdkA+MQI24frX5Dvj8hy
RW3IKGrqsgARC6oVf6oWQodrp9zxAn1XEHE43sppPvgh4tcJqxy/0Aqti+XeONQp
7/niL9+zn7FM
=p4Yo
-----END PGP SIGNATURE-----
Merge tag 'acpi-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki:
"These fix issues, add new quirks, rearrange the IRQ override quirk
definitions, add new helpers and switch over code to using them,
rework a couple of interfaces to be more flexible, eliminate strncpy()
usage from PNP, extend the ACPI PCC mailbox driver and clean up code.
This is based on ACPI thermal driver changes that are present in the
thermal control updates for 6.7-rc1 pull request (they are depended on
by the ACPI utilities updates). However, the ACPI thermal driver
changes are not included in the list of specific ACPI changes below.
Specifics:
- Add symbol definitions related to CDAT to the ACPICA code (Dave
Jiang)
- Use the acpi_device_is_present() helper in more places and rename
acpi_scan_device_not_present() to be about enumeration (James
Morse)
- Add __printf format attribute to acpi_os_vprintf() (Su Hui)
- Clean up departures from kernel coding style in the low-level
interface for ACPICA (Jonathan Bergh)
- Replace strncpy() with strscpy() in acpi_osi_setup() (Justin Stitt)
- Fail FPDT parsing on zero length records and add proper handling
for fpdt_process_subtable() to acpi_init_fpdt() (Vasily Khoruzhick)
- Rework acpi_handle_list handling so as to manage it dynamically,
including size computation (Rafael Wysocki)
- Clean up ACPI utilities code so as to make it follow the kernel
coding style (Jonathan Bergh)
- Consolidate IRQ trigger-type override DMI tables and drop .ident
values from dmi_system_id tables used for ACPI resources management
quirks (Hans de Goede)
- Add ACPI IRQ override for TongFang GMxXGxx (Werner Sembach)
- Allow _DSD buffer data only for byte accessors and document the
_DSD data buffer GUID (Andy Shevchenko)
- Drop BayTrail and Lynxpoint pinctrl device IDs from the ACPI LPSS
driver, because it does not need them (Raag Jadav)
- Add acpi_backlight=vendor quirk for Toshiba Portégé R100 (Ondrej
Zary)
- Add "vendor" backlight quirks for 3 Lenovo x86 Android tablets
(Hans de Goede)
- Move Xiaomi Mi Pad 2 backlight quirk to its own section (Hans de
Goede)
- Annotate struct prm_module_info with __counted_by (Kees Cook)
- Fix AER info corruption in aer_recover_queue() when error status
data has multiple sections (Shiju Jose)
- Make APEI use ERST maximum execution time for slow devices (Jeshua
Smith)
- Add support for platform notification handling to the PCC mailbox
driver and modify it to support shared interrupts for multiple
subspaces (Huisong Li)
- Define common macros to use when referring to various bitfields in
the PCC generic communications channel command and status fields
and use them in some drivers (Sudeep Holla)
- Add EC GPE detection quirk for HP 250 G7 Notebook PC (Jonathan
Denose)
- Fix and clean up create_pnp_modalias() and create_of_modalias()
(Christophe JAILLET)
- Modify 2 pieces of code to use acpi_evaluate_dsm_typed() (Andy
Shevchenko)
- Define acpi_dev_uid_match() for matching _UID and use it in several
places (Raag Jadav)
- Use acpi_device_uid() for fetching _UID in 2 places (Raag Jadav)
- Add context argument to acpi_dev_install_notify_handler() (Rafael
Wysocki)
- Clarify ACPI bus concepts in the ACPI device enumeration
documentation (Rafael Wysocki)
- Switch over the ACPI AC and ACPI PAD drivers to using the platform
driver interface which, is more logically consistent than binding a
driver directly to an ACPI device object, and clean them up (Michal
Wilczynski)
- Replace strncpy() in the PNP code with either memcpy() or strscpy()
as appropriate (Justin Stitt)
- Clean up coding style in pnp.h (GuoHua Cheng)"
* tag 'acpi-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (54 commits)
ACPI: resource: Do IRQ override on TongFang GMxXGxx
perf: arm_cspmu: use acpi_dev_hid_uid_match() for matching _HID and _UID
ACPI: EC: Add quirk for HP 250 G7 Notebook PC
ACPI: x86: use acpi_dev_uid_match() for matching _UID
ACPI: utils: use acpi_dev_uid_match() for matching _UID
pinctrl: intel: use acpi_dev_uid_match() for matching _UID
ACPI: utils: Introduce acpi_dev_uid_match() for matching _UID
ACPI: sysfs: Clean up create_pnp_modalias() and create_of_modalias()
ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias()
ACPI: acpi_pad: Rename ACPI device from device to adev
ACPI: acpi_pad: Use dev groups for sysfs
ACPI: acpi_pad: Replace acpi_driver with platform_driver
ACPI: APEI: Use ERST timeout for slow devices
ACPI: scan: Rename acpi_scan_device_not_present() to be about enumeration
PNP: replace deprecated strncpy() with memcpy()
PNP: ACPI: replace deprecated strncpy() with strscpy()
perf: qcom: use acpi_device_uid() for fetching _UID
ACPI: sysfs: use acpi_device_uid() for fetching _UID
ACPI: scan: Use the acpi_device_is_present() helper in more places
ACPI: AC: Rename ACPI device from device to adev
...
The acpi_thermal_unregister_thermal_zone() is paired with
acpi_thermal_register_thermal_zone() so it should mirror it. It should
clean up all the resources that the register function allocated and
leave the stuff that was allocated elsewhere.
Unfortunately, it doesn't call thermal_zone_device_disable(). Also it
calls kfree(tz->trip_table) when it shouldn't. That was allocated in
acpi_thermal_add(). Putting the kfree() here leads to a double free
in the acpi_thermal_add() clean up function.
Likewise, the acpi_thermal_remove() should mirror acpi_thermal_add() so
it should have an explicit kfree(tz->trip_table) as well.
Fixes: ec23c1c462 ("ACPI: thermal: Use trip point table to register thermal zones")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge ACPI bus type driver updates for 6.7-rc1:
- Add context argument to acpi_dev_install_notify_handler() (Rafael
Wysocki).
- Clarify ACPI bus concepts in the ACPI device enumeration
documentation (Rafael Wysocki).
* acpi-bus:
ACPI: bus: Add context argument to acpi_dev_install_notify_handler()
ACPI: docs: enumeration: Clarify ACPI bus concepts
Add void *context arrgument to the list of arguments of
acpi_dev_install_notify_handler() and modify it to pass that argument
as context to acpi_install_notify_handler() instead of its first
argument which is problematic in general (for example, if platform
drivers used it, they would rather get struct platform_device pointers
or pointers to their private data from the context arguments of their
notify handlers).
Make all of the current callers of acpi_dev_install_notify_handler()
take this change into account so as to avoid altering the general
functionality.
Co-developed-by: Michal Wilczynski <michal.wilczynski@intel.com>
Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Rearrange the code handling notifications from the platform firmware
regarding trip point updates to carry out one loop over trip points
instead of two of them by using thermal_zone_for_each_trip() for that,
which is more straightforward than using a combination of
thermal_zone_device_exec() and for_each_thermal_trip(), each with its
own callback function.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Combine acpi_thermal_update_passive_trip() and
acpi_thermal_update_active_trip() into one common function called
acpi_thermal_update_trip(), so as to reduce code duplication and
prepare the code in question for subsequent changes.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Put the get_active_temp() function next to the analogous
get_passive_temp() one to allow subsequent changes to be easier to
follow.
No functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Fix up the following formatting issues:
* braces following function declarations should be on a new line
* empty line should be present between function declarations
Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Notice that the list of device ACPI handles in struct acpi_thermal is not
used and drop it.
No functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Address a long-standing "TBD" comment in the ACPI headers regarding the
number of handles in struct acpi_handle_list.
The number 10, which along with the comment dates back to 2.4.23, seems
like it may have been arbitrarily chosen and isn't sufficient in all
cases [1].
Finally change the code to dynamically determine the size of the handles
table in struct acpi_handle_list and allocate it accordingly.
Update the users of to struct acpi_handle_list to take the additional
dynamic allocation into account.
Link: https://lore.kernel.org/linux-acpi/20230809094451.15473-1-ivan.hu@canonical.com # [1]
Co-developed-by: Vicki Pfau <vi@endrift.com>
Signed-off-by: Vicki Pfau <vi@endrift.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Rename structure fields holding temperature values in deci-Kelvin so as
to avoid temperature units confusion.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
The critical_valid and hot_valid flags in struct acpi_thermal_trips are
only used during initialization and they are only false if the
corresponding trip temperatures are equal to THERMAL_TEMP_INVALID, so
drop them and use THERMAL_TEMP_INVALID checks instead of them where
applicable.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Rearrange the ACPI thermal driver's callback functions used for cooling
device binding and unbinding, acpi_thermal_bind_cooling_device() and
acpi_thermal_unbind_cooling_device(), respectively, so that they use trip
pointers instead of trip indices which is more straightforward and allows
the driver to become independent of the ordering of trips in the thermal
zone structure.
The general functionality is not expected to be changed.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
After removing the valid flag from struct acpi_thermal_trip, the trip
temperature value is used in validity checks, so it must be
THERMAL_TEMP_INVALID for the active trip entries in struct acpi_thermal_trips
that are not going to be used (because the corresponding objects are not
present in the ACPI tables, for example).
Accordingly, modify acpi_thermal_get_trip_points() to set the temperature
value to THERMAL_TEMP_INVALID for trip point entries skipped by it after
acpi_thermal_init_trip() has returned 'false' for an active trip.
Fixes: 058f5e407d ("ACPI: thermal: Drop valid flag from struct acpi_thermal_trip")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
In order to reduce code duplicationeve further, merge
acpi_thermal_init_passive/active_trip() into one function called
acpi_thermal_init_trip() that will be used for initializing both
the passive and active trip points.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
In order to reduce code duplicationeve further, merge
acpi_thermal_update_passive/active_devices() into one function
called acpi_thermal_update_trip_devices() that will be used for
updating both the passive and active trip points.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
In order to reduce code duplication, merge update_passive_devices() and
update_active_devices() into one function called update_trip_devices()
that will be used for updating both the passive and active trip points.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
The device lists present in struct acpi_thermal_passive and struct
acpi_thermal_active can be located in struct acpi_thermal_trip which
then will allow the same code to be used for handling both the passive
and active trip points, so make that change.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Free "tz" if the "trip" allocation fails.
Fixes: 5fc2189f9335 ("ACPI: thermal: Create and populate trip points table earlier")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Notice that the valid flag in struct acpi_thermal_trip is in fact
redundant, because the temperature field of invalid trips is always
equal to THERMAL_TEMP_INVALID, so drop it from there and adjust the
code accordingly.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Trip point flags previously used by the driver need not be used any more
after the preceding changes, so drop them and adjust the code accordingly.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Separate the code needed to update active trips (in a response to a
notification from the platform firmware) as well as to initialize them
from the code that is only necessary for their initialization and
cleanly divide it into functions that each carry out a specific action.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Separate the code needed to update the passive trip (in a response to a
notification from the platform firmware) as well as to initialize it
from the code that is only necessary for its initialization and cleanly
divide it into functions that each carry out a specific action.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Notice that the only piece of information regarding the critical and hot
trips that needs to be stored in the driver's local data structures is
whether or not these trips are valid, so drop all of the redundant
information from there and adjust the code accordingly.
Among other things, this requires acpi_thermal_add() to be rearranged
so as to obtain the critical trip temperature before populating the trip
points table and for symmetry, the hot trip temperature is obtained
earlier too.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Create and populate the driver's trip points table in acpi_thermal_add()
so as to allow the its data structures to be simplified going forward.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Compute the number of trip points in acpi_thermal_add() so as to allow the
driver's data structures to be simplified going forward.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
There is only one caller of acpi_thermal_get_info() and the code from
it can be folded into its caller just fine, so do that.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Use the observation that the critical and hot trip points are never
updated by the ACPI thermal driver, because the flags passed from
acpi_thermal_notify() to acpi_thermal_trips_update() do not include
ACPI_TRIPS_CRITICAL or ACPI_TRIPS_HOT, to move the initialization
of those trip points directly into acpi_thermal_get_trip_points() and
reduce the size of __acpi_thermal_trips_update().
Also make the critical and hot trip points initialization code more
straightforward and drop the flags that are not needed any more.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
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>
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>
Move the acpi_bus_generate_netlink_event() invocation into
acpi_thermal_trips_update() which allows the code duplication in
acpi_thermal_notify() to be cleaned up, but for this purpose the
event value needs to be passed to acpi_thermal_trips_update() and
from there to acpi_thermal_adjust_thermal_zone() which has to
determine the flag value for __acpi_thermal_trips_update() by
itself.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Drop the .get_trip_type(), .get_trip_temp() and .get_crit_temp() thermal
zone callbacks that are not necessary any more from the ACPI thermal
driver along with the corresponding callback functions.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Rework the ACPI thermal driver's .get_trend() callback function,
thermal_get_trend(), so that it does not call thermal_get_trip_type()
and thermal_get_trip_temp() which are going to be dropped.
This reduces the overhead of the function too, because it will always
carry out a trip point lookup once after the change.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Make the ACPI thermal driver use thermal_zone_device_register_with_trips()
to register its thermal zones.
For this purpose, make it create a trip point table that will be passed to
thermal_zone_device_register_with_trips() as an argument.
Also use the thermal_zone_update_trip_temp() helper introduced
previously to update temperatures of the passive and active trip
points after a trip points change notification from the platform
firmware.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Add struct acpi_thermal_trip to contain the temperature and valid flag
of each trip point in the driver's local data structures.
This helps to make the subsequent changes more straightforward.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
There is a race condition between acpi_thermal_trips_update() and
acpi_thermal_check_fn(), because the trip points may get updated while
the latter is running which in theory may lead to inconsistent results.
For example, if two trips are updated together, using the temperature
value of one of them from before the update and the temperature value
of the other one from after the update may not lead to the expected
outcome.
Moreover, if thermal_get_trend() runs when a trip points update is in
progress, it may end up using stale trip point temperatures.
To address this, make acpi_thermal_trips_update() call
thermal_zone_device_exec() to carry out the trip points update and
use a new acpi_thermal_adjust_thermal_zone() wrapper around
__acpi_thermal_trips_update() as the callback function for the latter.
While at it, change the acpi_thermal_trips_update() return data type
to void as that function always returns 0 anyway.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Rename the trips variable in acpi_thermal_register_thermal_zone() to
trip_count so its name better reflects the purpose, rearrange white
space in the loop over active trips for clarity and reduce code
duplication related to calling thermal_zone_device_register() by
using an extra local variable to store the passive delay value.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Commit dabc621a31 ("ACPI: thermal: Drop enabled flag from struct
acpi_thermal_active") left behind a variable that is only assigned to
and never read, so drop it now.
Fixes: dabc621a31 ("ACPI: thermal: Drop enabled flag from struct acpi_thermal_active")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The ACPI thermal driver uses acpi_bus_attach_private_data() to attach
the thermal zone object to the ACPI handle of the thermal zone and
acpi_bus_detach_private_data() to clean that up, but it never uses
acpi_bus_get_private_data() to retrieve that object.
Drop the unneded acpi_bus_attach_private_data() and
acpi_bus_detach_private_data() calls from the ACPI thermal driver and
clean up the related code.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
The enabled field of struct acpi_thermal_active is only updated and never
read, so drop it along with the related code.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The `nocrt` module parameter has no code associated with it and does
nothing. As `crt=-1` has same functionality as what nocrt should be
doing drop `nocrt` and associated documentation.
This should fix a quirk for Gigabyte GA-7ZX that used `nocrt` and
thus didn't function properly.
Fixes: 8c99fdce30 ("ACPI: thermal: set "thermal.nocrt" via DMI on Gigabyte GA-7ZX")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Modify the ACPI thermal driver to install its own Notify() handler
directly instead of providing an ACPI driver .notify() callback.
This will allow the ACPI driver .notify() callback to be eliminated and
it will allow the thermal driver to be switched over to a platform one
in the future.
While at it, fix up whitespaces in acpi_thermal_remove().
Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
[ rjw: Subject and changelog edits, whitespace adjustments ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>