Thermal ACPI APIs for generic trip points
v4 cover Thermal ACPI APIs for generic trip points
Recently sent as a RFC, the thermal ACPI for generic trip points is a set of functions to fill the generic trip points structure which will become the standard structure for the thermal framework and its users.
Different Intel drivers and the ACPI thermal driver are using the ACPI tables to get the thermal zone information. As those are getting the same information, providing this set of ACPI function with the generic trip points will consolidate the code.
Also, the Intel PCH and the Intel 34xx drivers are converted to use the generic trip points relying on the ACPI generic trip point parsing functions.
These changes have been tested on a Thinkpad Lenovo x280 with the PCH and INT34xx drivers. No regression have been observed, the trip points remain the same for what is described on this system.
Changelog:
- V4:
- Fixed Kconfig option dependency, select THERMAL_ACPI if ACPI is set only for the PCH driver
- V3:
- Took into account Rafael's comments
- Used a silence option THERMAL_ACPI in order to stay consistent with THERMAL_OF. It is up to the API user to select the option.
- V2:
- Fix the thermal ACPI patch where the thermal_acpi.c was not included in the series
- Provide a couple of users of this API which could have been tested on a real system
Daniel Lezcano (3):
thermal/acpi: Add ACPI trip point routines thermal/drivers/intel: Use generic trip points for intel_pch thermal/drivers/intel: Use generic trip points int340x
drivers/thermal/Kconfig | 4 + drivers/thermal/Makefile | 1 + drivers/thermal/intel/Kconfig | 1 + drivers/thermal/intel/int340x_thermal/Kconfig | 1 + .../int340x_thermal/int340x_thermal_zone.c | 177 ++++----------- .../int340x_thermal/int340x_thermal_zone.h | 10 +- drivers/thermal/intel/intel_pch_thermal.c | 88 ++------ drivers/thermal/thermal_acpi.c | 211 ++++++++++++++++++ include/linux/thermal.h | 8 + 9 files changed, 287 insertions(+), 214 deletions(-) create mode 100644 drivers/thermal/thermal_acpi.c
Signature · 1 line
2.34.1
PATCH v4 1/3 thermal/acpi: Add ACPI trip point routines
The ACPI specification describes the trip points, the device tree bindings as well.
The OF code uses the generic trip point structures.
The ACPI has their own trip points structure and uses the get_trip_* ops to retrieve them.
We can do the same as the OF code and create a set of ACPI functions to retrieve a trip point description. Having a common code for ACPI will help to cleanup the remaining Intel drivers and get rid of the get_trip_* functions.
These changes add the ACPI thermal calls to retrieve the basic information we need to be reused in the thermal ACPI and Intel drivers.
The different ACPI functions have the generic trip point structure passed as parameter where it is filled.
This structure aims to be the one used by all the thermal drivers and the thermal framework.
After this series, a couple of Intel drivers and the ACPI thermal driver will still have their own trip points definition but a new series on top of this one will finish the conversion to the generic trip point handling.
This series depends on the generic trip point added to the thermal framework and available in the thermal/linux-next branch.
https://lkml.org/lkml/2022/10/3/456
It has been tested on a Intel i7-8650U - x280 with the INT3400, the PCH, ACPITZ, and x86_pkg_temp. No regression observed so far.
---
V3:
- Removed too simple wrappers
- Changed the API to return an error and check the validity of the value
- Removed the comments describing the objects
- Added kerneldoc
- Made the Kconfig option silent
- Set the hysteresis value to zero by default
V2:
- Fixed the missing thermal_acpi.c in the patch
--- drivers/thermal/Kconfig | 4 + drivers/thermal/Makefile | 1 + drivers/thermal/thermal_acpi.c | 211 +++++++++++++++++++++++++++++++++ include/linux/thermal.h | 8 ++ 4 files changed, 224 insertions(+) create mode 100644 drivers/thermal/thermal_acpi.c
drivers/thermal/Kconfig +4 -0
@@ -76,6 +76,10 @@ config THERMAL_OF Say 'Y' here if you need to build thermal infrastructure based on device tree. +config THERMAL_ACPI + depends on ACPI + bool + config THERMAL_WRITABLE_TRIPS bool "Enable writable trip points" help
drivers/thermal/Makefile +1 -0
@@ -13,6 +13,7 @@ thermal_sys-$(CONFIG_THERMAL_NETLINK) += thermal_netlink.o # interface to/from other layers providing sensors thermal_sys-$(CONFIG_THERMAL_HWMON) += thermal_hwmon.o thermal_sys-$(CONFIG_THERMAL_OF) += thermal_of.o +thermal_sys-$(CONFIG_THERMAL_ACPI) += thermal_acpi.o # governors thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE) += gov_fair_share.o
drivers/thermal/thermal_acpi.c new file +211 -0
211 lines not on this page · raw message
include/linux/thermal.h +8 -0
@@ -334,6 +334,14 @@ static inline void devm_thermal_of_zone_unregister(struct device *dev, }#endif +#ifdef CONFIG_THERMAL_ACPI +int thermal_acpi_trip_gtsh (struct acpi_device *adev); +int thermal_acpi_trip_crit (struct acpi_device *adev,struct thermal_trip *trip); +int thermal_acpi_trip_hot (struct acpi_device *adev,struct thermal_trip *trip); +int thermal_acpi_trip_psv (struct acpi_device *adev,struct thermal_trip *trip); +int thermal_acpi_trip_act (struct acpi_device *adev,struct thermal_trip *trip,int id); +#endif +int __thermal_zone_get_trip (struct thermal_zone_device *tz,int trip_id,struct thermal_trip *trip); int thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
Signature · 1 line
2.34.1
PATCH v4 2/3 thermal/drivers/intel: Use generic trip points for intel_pch
In reply to Daniel LezcanoThe 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 the ops content logic into generic trip points and register them with the thermal zone.
In order to consolidate the code, use the ACPI thermal framework API to fill the generic trip point from the ACPI tables.
It has been tested on a Intel i7-8650U - x280 with the INT3400, the PCH, ACPITZ, and x86_pkg_temp. No regression observed so far.
---
V4:
- Changed select THERMAL_ACPI if ACPI in order to prevent dependency inconsistency
V3:
- The driver Kconfig option selects CONFIG_THERMAL_ACPI
--- drivers/thermal/intel/Kconfig | 1 + drivers/thermal/intel/intel_pch_thermal.c | 88 +++++------------------ 2 files changed, 20 insertions(+), 69 deletions(-)
drivers/thermal/intel/Kconfig +1 -0
@@ -75,6 +75,7 @@ config INTEL_BXT_PMIC_THERMAL config INTEL_PCH_THERMAL tristate "Intel PCH Thermal Reporting Driver" depends on X86 && PCI + select THERMAL_ACPI if ACPI help Enable this to support thermal reporting on certain intel PCHs. Thermal reporting device will provide temperature reading,
drivers/thermal/intel/intel_pch_thermal.c +19 -69
146 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v4 3/3 thermal/drivers/intel: Use generic trip points int340x
In reply to Daniel LezcanoThe 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 the ops content logic into generic trip points and register them with the thermal zone.
In order to consolidate the code, use the ACPI thermal framework API to fill the generic trip point from the ACPI tables.
It has been tested on a Intel i7-8650U - x280 with the INT3400, the PCH, ACPITZ, and x86_pkg_temp. No regression observed so far.
---
V3:
- The driver Kconfig option selects CONFIG_THERMAL_ACPI
- Change the initialization to use GTSH for the hysteresis on all the trip points
--- drivers/thermal/intel/int340x_thermal/Kconfig | 1 + .../int340x_thermal/int340x_thermal_zone.c | 177 ++++-------------- .../int340x_thermal/int340x_thermal_zone.h | 10 +- 3 files changed, 43 insertions(+), 145 deletions(-)
drivers/thermal/intel/int340x_thermal/Kconfig +1 -0
@@ -9,6 +9,7 @@ config INT340X_THERMAL select THERMAL_GOV_USER_SPACE select ACPI_THERMAL_REL select ACPI_FAN + select THERMAL_ACPI select INTEL_SOC_DTS_IOSF_CORE select PROC_THERMAL_MMIO_RAPL if POWERCAP help
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +40 -137
243 lines not on this page · raw message
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h +2 -8
@@ -10,6 +10,7 @@#include <acpi/acpi_lpat.h> #define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10 +#define INT340X_THERMAL_MAX_TRIP_COUNT INT340X_THERMAL_MAX_ACT_TRIP_COUNT + 3struct active_trip {int temp;
@@ -19,15 +20,8 @@ struct active_trip {struct int34x_thermal_zone {struct acpi_device *adev; -struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT ]; -unsigned long *aux_trips; +struct thermal_trip *trips;int aux_trip_nr; -int psv_temp; -int psv_trip_id; -int crt_temp; -int crt_trip_id; -int hot_temp; -int hot_trip_id;struct thermal_zone_device *zone;struct thermal_zone_device_ops *ops;void *priv_data;
Signature · 1 line
2.34.1
Can I consider these changes ok for thermal/bleeding-edge ?
Quoted 49 lines · Daniel Lezcano
Recently sent as a RFC, the thermal ACPI for generic trip points is a set of functions to fill the generic trip points structure which will become the standard structure for the thermal framework and its users.
Different Intel drivers and the ACPI thermal driver are using the ACPI tables to get the thermal zone information. As those are getting the same information, providing this set of ACPI function with the generic trip points will consolidate the code.
Also, the Intel PCH and the Intel 34xx drivers are converted to use the generic trip points relying on the ACPI generic trip point parsing functions.
These changes have been tested on a Thinkpad Lenovo x280 with the PCH and INT34xx drivers. No regression have been observed, the trip points remain the same for what is described on this system.
Changelog:
- V4:
- FixedKconfigoption dependency, selectTHERMAL_ACPIif ACPI is set only for the PCH driver- V3:
- Took into account Rafael's comments
- Used a silence optionTHERMAL_ACPIin order to stay consistent withTHERMAL_OF. It is up to the API user to select the option.- V2:
- Fix the thermal ACPI patch where thethermal_acpi.cwas not included in the series
- Provide a couple of users of this API which could have been tested on a real systemDaniel Lezcano (3):
thermal/acpi: Add ACPI trip point routines thermal/drivers/intel: Use generic trip points forintel_pchthermal/drivers/intel: Use generic trip points int340xdrivers/thermal/Kconfig | 4 + drivers/thermal/Makefile | 1 + drivers/thermal/intel/Kconfig | 1 + drivers/thermal/intel/int340x_thermal/Kconfig | 1 + .../int340x_thermal/int340x_thermal_zone.c | 177 ++++----------- .../int340x_thermal/int340x_thermal_zone.h | 10 +- drivers/thermal/intel/intel_pch_thermal.c | 88 ++------ drivers/thermal/thermal_acpi.c | 211 ++++++++++++++++++ include/linux/thermal.h | 8 + 9 files changed, 287 insertions(+), 214 deletions(-)create mode 100644
drivers/thermal/thermal_acpi.c
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Zhang, Rui
reviewerQuoted 3 lines · Daniel Lezcano
Can I consider these changes ok for thermal/bleeding-edge ?
Hi, Daniel,
In general, the patch looks good to me.
But can you give me more time so that I can test them on my test box by this week?
thanks,
rui
Quoted 66 lines · Daniel Lezcano
Quoted 65 lines
Recently sent as a RFC, the thermal ACPI for generic trip points is a set of
functions to fill the generic trip points structure which will become the
standard structure for the thermal framework and its users.Different Intel drivers and the ACPI thermal driver are using the ACPI tables to
get the thermal zone information. As those are getting the same information,
providing this set of ACPI function with the generic trip points will
consolidate the code.Also, the Intel PCH and the Intel 34xx drivers are converted to use the generic
trip points relying on the ACPI generic trip point parsing functions.These changes have been tested on a Thinkpad Lenovo x280 with the PCH and
INT34xx drivers. No regression have been observed, the trip points remain the
same for what is described on this system.Changelog:
- V4:
- FixedKconfigoption dependency, selectTHERMAL_ACPIif ACPI
is set
only for the PCH driver- V3:
- Took into account Rafael's comments
- Used a silence optionTHERMAL_ACPIin order to stay
consistent
withTHERMAL_OF. It is up to the API user to select the
option.- V2:
- Fix the thermal ACPI patch where thethermal_acpi.cwas not
included in
the series
- Provide a couple of users of this API which could have been
tested on a
real systemDaniel Lezcano (3):
thermal/acpi: Add ACPI trip point routines thermal/drivers/intel: Use generic trip points forintel_pchthermal/drivers/intel: Use generic trip points int340xdrivers/thermal/Kconfig | 4 + drivers/thermal/Makefile | 1 + drivers/thermal/intel/Kconfig | 1 + drivers/thermal/intel/int340x_thermal/Kconfig | 1 + .../int340x_thermal/int340x_thermal_zone.c | 177 ++++--------- -- .../int340x_thermal/int340x_thermal_zone.h | 10 +- drivers/thermal/intel/intel_pch_thermal.c | 88 ++------ drivers/thermal/thermal_acpi.c | 211 ++++++++++++++++++ include/linux/thermal.h | 8 + 9 files changed, 287 insertions(+), 214 deletions(-)create mode 100644
drivers/thermal/thermal_acpi.c
Quoted 9 lines · Rui
Quoted 3 lines · Daniel Lezcano
Can I consider these changes ok for thermal/bleeding-edge ?
Hi, Daniel,
In general, the patch looks good to me.
But can you give me more time so that I can test them on my test box by this week?
Ah, yes, definitively. If you have a test box for these changes that is awesome.
Do you have a suggestion for a x86 platform to test quark_dts, processor_thermal_device_pci and intel_soc_dts_iosf ?
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Zhang, Rui
reviewerHi, Daniel,
Quoted 7 lines · Daniel Lezcano
Quoted 6 lines · Rui
Quoted 3 lines · Daniel Lezcano
Can I consider these changes ok for thermal/bleeding-edge ?
Hi, Daniel,
Quoted 8 lines
Quoted 4 lines
In general, the patch looks good to me.
But can you give me more time so that I can test them on my test box by
this week?Ah, yes, definitively. If you have a test box for these changes that is
awesome.
Yeah. I have one to test both drivers.
Quoted 3 lines
Do you have a suggestion for a x86 platform to test
quark_dts,processor_thermal_device_pciandintel_soc_dts_iosf?
intel_soc_dts_iosf is for Baytrail platform. Both Baytrail and Quark are nearly 10 years old, and I don't have any of them.
For processor_thermal_device_pci, it should be available on Alderlake platforms. And I have an internal platform which I can help test the patches.
thanks,
rui
Zhang, Rui
reviewerRe: [PATCH 3/3] thermal/drivers/intel: Use generic trip points int340x
In reply to Daniel LezcanoQuoted 135 lines · Daniel Lezcano
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 the ops content logic into generic trip points and register them with the thermal zone.
In order to consolidate the code, use the ACPI thermal framework API to fill the generic trip point from the ACPI tables.
It has been tested on a Intel i7-8650U - x280 with the INT3400, the PCH, ACPITZ, and
x86_pkg_temp. No regression observed so far.Signed-off-by Daniel Lezcano <[email protected]>---
V3:
- The driverKconfigoption selectsCONFIG_THERMAL_ACPI
- Change the initialization to use GTSH for the hysteresis on all the trip pointsSigned-off-by Daniel Lezcano <[email protected]>--- drivers/thermal/intel/int340x_thermal/Kconfig | 1 + .../int340x_thermal/int340x_thermal_zone.c | 177 ++++---------- ---- .../int340x_thermal/int340x_thermal_zone.h | 10 +- 3 files changed, 43 insertions(+), 145 deletions(-)drivers/thermal/intel/int340x_thermal/Kconfig +1
-0@@ -9,6 +9,7 @@ config INT340X_THERMAL select THERMAL_GOV_USER_SPACE select ACPI_THERMAL_REL select ACPI_FAN + select THERMAL_ACPI select INTEL_SOC_DTS_IOSF_CORE select PROC_THERMAL_MMIO_RAPL if POWERCAP helpdiff --git
a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.cb/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.cindex228f44260b27..626b33253153100644drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-30@@ -37,65 +37,6 @@ static int int340x_thermal_get_zone_temp(structthermal_zone_device *zone, return 0; } -static int int340x_thermal_get_trip_temp (struct thermal_zone_device *zone, -int trip,int *temp) -{ -struct int34x_thermal_zone *d = zone->devdata; -int i; - -if (trip < d->aux_trip_nr) - *temp = d->aux_trips[trip]; -else if (trip == d->crt_trip_id) - *temp = d->crt_temp; -else if (trip == d->psv_trip_id) - *temp = d->psv_temp; -else if (trip == d->hot_trip_id) - *temp = d->hot_temp; -else { -for (i =0 ; i <INT340X_THERMAL_MAX_ACT_TRIP_COUNT ; i++) { -if (d->act_trips[i].valid && - d->act_trips[i].id == trip) { - *temp = d->act_trips[i].temp; -break ; - } - } -if (i ==INT340X_THERMAL_MAX_ACT_TRIP_COUNT ) -return -EINVAL ; - } - -return 0 ; -} - -static int int340x_thermal_get_trip_type(struct thermal_zone_device*zone,
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-16-int trip, - enum thermal_trip_type *type) -{ - struct int34x_thermal_zone *d = zone->devdata; -int i; - -if (trip < d->aux_trip_nr) - *type =THERMAL_TRIP_PASSIVE ; -else if (trip == d->crt_trip_id) - *type =THERMAL_TRIP_CRITICAL ; -else if (trip == d->hot_trip_id) - *type =THERMAL_TRIP_HOT ; -else if (trip == d->psv_trip_id) - *type =THERMAL_TRIP_PASSIVE ; -else { - for (i = 0; i < INT340X_THERMAL_MAX_ACT_TRIP_COUNT;i++) {
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-13-if (d->act_trips[i].valid && - d->act_trips[i].id == trip) { - *type =THERMAL_TRIP_ACTIVE ; -break ; - } - } -if (i ==INT340X_THERMAL_MAX_ACT_TRIP_COUNT ) -return -EINVAL ; - } - -return 0 ; -} - static int int340x_thermal_set_trip_temp(struct thermal_zone_device*zone,
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-9int trip, int temp) {@@ -109,25 +50,6 @@ static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, if (ACPI_FAILURE(status)) return -EIO; - d->aux_trips[trip] = temp; - -return 0 ; -} - - -static int int340x_thermal_get_trip_hyst (struct thermal_zone_device *zone, -int trip,int *temp) -{
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c static int int340x_thermal_set_trip_temp(struct · line 132
Quoted 10 lines
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-9-struct int34x_thermal_zone *d = zone->devdata; -acpi_status status; -unsigned long long hyst; - - status =acpi_evaluate_integer (d->adev->handle,"GTSH" ,NULL , &hyst); -if (ACPI_FAILURE (status)) - *temp =0 ; -else - *temp = hyst *100 ;
The previous code returns hyst * 100.
But the new API retuurns hyst directly.
-/sys/class/thermal/thermal_zone2/trip_point_4_hyst:2000 +/sys/class/the rmal/thermal_zone2/trip_point_4_hyst:20
Is this done on purpose?
I think this may break userspace tools like thermald.
Srinivas, can you confirm?
thanks,
rui
Quoted 227 lines
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-1-drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +13
-34return 0 ; }@@ -138,58 +60,36 @@ static void int340x_thermal_critical(struct thermal_zone_device *zone)static struct thermal_zone_device_ops int340x_thermal_zone_ops = { .get_temp = int340x_thermal_get_zone_temp, - .get_trip_temp = int340x_thermal_get_trip_temp, - .get_trip_type = int340x_thermal_get_trip_type, .set_trip_temp = int340x_thermal_set_trip_temp, - .get_trip_hyst = int340x_thermal_get_trip_hyst, .critical = int340x_thermal_critical, }; -static int int340x_thermal_get_trip_config (acpi_handle handle,char *name, -int *temp) -{ -unsigned long long r; -acpi_status status; - - status =acpi_evaluate_integer (handle, name,NULL , &r); -if (ACPI_FAILURE (status)) -return -EIO ; - - *temp =deci_kelvin_to_millicelsius (r); - -return 0 ; -} -int int340x_thermal_read_trips (struct int34x_thermal_zone *int34x_zone) { -int trip_cnt = int34x_zone->aux_trip_nr; -int i; +int trip_cnt; +int i, ret; + + trip_cnt = int34x_zone->aux_trip_nr; - int34x_zone->crt_trip_id =-1 ; -if (!int340x_thermal_get_trip_config (int34x_zone->adev->handle,"_CRT" , - &int34x_zone->crt_temp)) - int34x_zone->crt_trip_id = trip_cnt++; + ret =thermal_acpi_trip_crit (int34x_zone->adev, &int34x_zone- >trips[trip_cnt]); +if (!ret) + trip_cnt++; - int34x_zone->hot_trip_id =-1 ; -if (!int340x_thermal_get_trip_config (int34x_zone->adev->handle,"_HOT" , - &int34x_zone->hot_temp)) - int34x_zone->hot_trip_id = trip_cnt++; + ret =thermal_acpi_trip_hot (int34x_zone->adev, &int34x_zone- >trips[trip_cnt]); +if (!ret) + trip_cnt++; - int34x_zone->psv_trip_id =-1 ; -if (!int340x_thermal_get_trip_config (int34x_zone->adev->handle,"_PSV" , - &int34x_zone->psv_temp)) - int34x_zone->psv_trip_id = trip_cnt++; + ret =thermal_acpi_trip_psv (int34x_zone->adev, &int34x_zone- >trips[trip_cnt]); +if (!ret) + trip_cnt++;for (i =0 ; i <INT340X_THERMAL_MAX_ACT_TRIP_COUNT ; i++) { -char name[5 ] = {'_' ,'A' ,'C' ,'0' + i,'\0' }; - if (int340x_thermal_get_trip_config(int34x_zone->adev-Quoted 1 line
handle,
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-2- name, - &int34x_zone-Quoted 1 line
act_trips[i].temp))
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +1
-0+ ret = thermal_acpi_trip_act(int34x_zone->adev,&int34x_zone->trips[trip_cnt], i);
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +3
-3+if (ret)break ; - int34x_zone->act_trips[i].id = trip_cnt++; - int34x_zone->act_trips[i].valid = true; + trip_cnt++; }return trip_cnt;@@ -208,7 +108,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, acpi_status status; unsigned long long trip_cnt; int trip_mask = 0; -int ret; +int i, ret; int34x_thermal_zone = kzalloc(sizeof(*int34x_thermal_zone),drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +5
-16GFP_KERNEL);@@ -228,32 +128,35 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, int34x_thermal_zone->ops->get_temp = get_temp; status =acpi_evaluate_integer (adev->handle,"PATC" ,NULL , &trip_cnt); -if (ACPI_FAILURE (status)) - trip_cnt =0 ; -else { -int i; - - int34x_thermal_zone->aux_trips = -kcalloc (trip_cnt, -sizeof (*int34x_thermal_zone- >aux_trips), -GFP_KERNEL ); -if (!int34x_thermal_zone->aux_trips) { - ret = -ENOMEM ; - goto err_trip_alloc; - } - trip_mask =BIT (trip_cnt) -1 ; +if (!ACPI_FAILURE (status)) { int34x_thermal_zone->aux_trip_nr = trip_cnt; -for (i =0 ; i < trip_cnt; ++i) - int34x_thermal_zone->aux_trips[i] =THERMAL_TEMP_INVALID ; + trip_mask =BIT (trip_cnt) -1 ; + } + + int34x_thermal_zone->trips =kzalloc(sizeof(*int34x_thermal_zone->trips) *
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +1
-0+ (INT340X_THERMAL_MAX_TRIP_COUNT +
trip_cnt),drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +6
-0+ GFP_KERNEL); +if (!int34x_thermal_zone->trips) { + ret = -ENOMEM ; + goto err_trips_alloc; } trip_cnt =int340x_thermal_read_trips (int34x_thermal_zone); +for (i =0 ; i < trip_cnt; ++i) + int34x_thermal_zone->trips[i].hysteresis =
thermal_acpi_trip_gtsh(adev);drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +3
-0+ +for (i =0 ; i < int34x_thermal_zone->aux_trip_nr; i++) { + int34x_thermal_zone->trips[i].type =
THERMAL_TRIP_PASSIVE;drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +1
-0+ int34x_thermal_zone->trips[i].temperature =
THERMAL_TEMP_INVALID;drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +2
-0+ } + int34x_thermal_zone->lpat_table =acpi_lpat_get_conversion_table(
adev-Quoted 1 line
handle);
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +1
-1- int34x_thermal_zone->zone = thermal_zone_device_register( + int34x_thermal_zone->zone =thermal_zone_device_register_with_trips(
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +1
-0acpi_device_bid (adev), + int34x_thermal_zone-Quoted 1 line
trips,
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-0trip_cnt, trip_mask,
int34x_thermal_zone,
int34x_thermal_zone-Quoted 1 line
ops,
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +2
-2@@ -272,9 +175,9 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, err_enable: thermal_zone_device_unregister(int34x_thermal_zone->zone); err_thermal_zone: +kfree (int34x_thermal_zone->trips);acpi_lpat_free_conversion_table (int34x_thermal_zone- >lpat_table); -kfree (int34x_thermal_zone->aux_trips); -err_trip_alloc: +err_trips_alloc:kfree (int34x_thermal_zone->ops);
err_ops_alloc:drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-0kfree (int34x_thermal_zone);@@ -287,7 +190,7 @@ void int340x_thermal_zone_remove(struct
int34x_thermal_zone
{drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-0thermal_zone_device_unregister (int34x_thermal_zone->zone); acpi_lpat_free_conversion_table(int34x_thermal_zone-Quoted 1 line
lpat_table);drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +1
-1-kfree (int34x_thermal_zone->aux_trips); +kfree (int34x_thermal_zone->trips);kfree (int34x_thermal_zone->ops);kfree (int34x_thermal_zone); }diff --git
a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.hb/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.hindexe28ab1ba5e06..0c2c8de92014100644drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h +1
-0@@ -10,6 +10,7 @@#include <acpi/acpi_lpat.h> #define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10 +#define INT340X_THERMAL_MAX_TRIP_COUNT
INT340X_THERMAL_MAX_ACT_TRIP_COUNT+ 3struct
active_trip{drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h +1
-8int temp;@@ -19,15 +20,8 @@ struct active_trip {struct int34x_thermal_zone {struct acpi_device *adev; -struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT]; -unsigned long *aux_trips; +struct thermal_trip *trips;int aux_trip_nr; -int psv_temp; -int psv_trip_id; -int crt_temp; -int crt_trip_id; -int hot_temp; -int hot_trip_id;struct thermal_zone_device *zone;struct thermal_zone_device_ops *ops;void
*priv_data;
Zhang, Rui
reviewerHi, Daniel,
Thanks for the patch series.
I got several "trailing whitespace" warnings when applying the patches, and there are also some other checkpatch.pl warnings.
Besides that, I only have one comment about patch 3/3, and I have replied to that thread.
thanks,
rui
Quoted 60 lines · Daniel Lezcano
Recently sent as a RFC, the thermal ACPI for generic trip points is a set of
functions to fill the generic trip points structure which will become the
standard structure for the thermal framework and its users.Different Intel drivers and the ACPI thermal driver are using the ACPI tables to
get the thermal zone information. As those are getting the same information,
providing this set of ACPI function with the generic trip points will consolidate the code.Also, the Intel PCH and the Intel 34xx drivers are converted to use the generic
trip points relying on the ACPI generic trip point parsing functions.These changes have been tested on a Thinkpad Lenovo x280 with the PCH and
INT34xx drivers. No regression have been observed, the trip points remain the
same for what is described on this system.Changelog:
- V4:
- FixedKconfigoption dependency, selectTHERMAL_ACPIif ACPI is
set
only for the PCH driver- V3:
- Took into account Rafael's comments
- Used a silence optionTHERMAL_ACPIin order to stay consistent withTHERMAL_OF. It is up to the API user to select the option.- V2:
- Fix the thermal ACPI patch where thethermal_acpi.cwas not
included in
the series
- Provide a couple of users of this API which could have been
tested on a
real systemDaniel Lezcano (3):
thermal/acpi: Add ACPI trip point routines thermal/drivers/intel: Use generic trip points forintel_pchthermal/drivers/intel: Use generic trip points int340xdrivers/thermal/Kconfig | 4 + drivers/thermal/Makefile | 1 + drivers/thermal/intel/Kconfig | 1 + drivers/thermal/intel/int340x_thermal/Kconfig | 1 + .../int340x_thermal/int340x_thermal_zone.c | 177 ++++----------- .../int340x_thermal/int340x_thermal_zone.h | 10 +- drivers/thermal/intel/intel_pch_thermal.c | 88 ++------ drivers/thermal/thermal_acpi.c | 211 ++++++++++++++++++ include/linux/thermal.h | 8 + 9 files changed, 287 insertions(+), 214 deletions(-) create mode 100644 drivers/thermal/thermal_acpi.c
Re: [PATCH 3/3] thermal/drivers/intel: Use generic trip points int340x
In reply to Zhang, RuiHi Rui;
thanks for testing and your comments
Quoted 27 lines · Rui
Quoted 26 lines · Daniel Lezcano
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 the ops content logic into generic trip points and register them with the thermal zone.
In order to consolidate the code, use the ACPI thermal framework API to fill the generic trip point from the ACPI tables.
It has been tested on a Intel i7-8650U - x280 with the INT3400, the PCH, ACPITZ, and
x86_pkg_temp. No regression observed so far.Signed-off-by Daniel Lezcano <[email protected]>---
V3:
- The driverKconfigoption selectsCONFIG_THERMAL_ACPI
- Change the initialization to use GTSH for the hysteresis on all the trip pointsSigned-off-by Daniel Lezcano <[email protected]>--- drivers/thermal/intel/int340x_thermal/Kconfig | 1 + .../int340x_thermal/int340x_thermal_zone.c | 177 ++++--------------
[ ... ]
Quoted 22 lines
Quoted 10 lines
-static int int340x_thermal_get_trip_hyst(struct
thermal_zone_device*zone,drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-7- int trip, int *temp) -{ - struct int34x_thermal_zone *d = zone->devdata; -acpi_status status; -unsigned long long hyst; - - status = acpi_evaluate_integer(d->adev->handle, "GTSH", NULL,&hyst);
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, · line 129
Quoted 4 lines
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-4-if (ACPI_FAILURE (status)) - *temp =0 ; -else - *temp = hyst *100 ;The previous code returns hyst * 100.
But the new API retuurns hyst directly.(quoted diff) +1
-1-/sys/class/thermal/thermal_zone2/trip_point_4_hyst:2000 +/sys/class/thermal/thermal_zone2/trip_point_4_hyst:20
Quoted 1 line
Is this done on purpose?
No, it is an error. The function thermal_acpi_trip_gtsh() should do:
return deci_kelvin_to_millicelsius(hyst);
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Re: [PATCH 3/3] thermal/drivers/intel: Use generic trip points int340x
In reply to Zhang, RuiQuoted 161 lines · Rui
Quoted 146 lines · Daniel Lezcano
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 the ops content logic into generic trip points and register them with the thermal zone.
In order to consolidate the code, use the ACPI thermal framework API
to fill the generic trip point from the ACPI tables.It has been tested on a Intel i7-8650U - x280 with the INT3400, the PCH, ACPITZ, and
x86_pkg_temp. No regression observed so far.Signed-off-by Daniel Lezcano <[email protected]>---
V3:
- The driverKconfigoption selectsCONFIG_THERMAL_ACPI
- Change the initialization to use GTSH for the hysteresis on all the trip pointsSigned-off-by Daniel Lezcano <[email protected]>---
drivers/thermal/intel/int340x_thermal/Kconfig | 1 + .../int340x_thermal/int340x_thermal_zone.c | 177 ++++----------
----
.../int340x_thermal/int340x_thermal_zone.h | 10 +-3 files changed, 43 insertions(+), 145 deletions(-)drivers/thermal/intel/int340x_thermal/Kconfig +0
-0@@ -9,6 +9,7 @@ config INT340X_THERMALselect
THERMAL_GOV_USER_SPACE
selectACPI_THERMAL_REL
selectACPI_FAN
+ selectTHERMAL_ACPI
selectINTEL_SOC_DTS_IOSF_CORE
selectPROC_THERMAL_MMIO_RAPLif POWERCAP help
diff --gita/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.cb/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.cindex228f44260b27..626b33253153100644drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-0@@ -37,65 +37,6 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, return 0; }
-static int int340x_thermal_get_trip_temp(structthermal_zone_device
*zone,
- int trip, int *temp)drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-14-{ - struct int34x_thermal_zone *d = zone->devdata; - int i; - - if (trip < d->aux_trip_nr) - *temp = d->aux_trips[trip]; - else if (trip == d->crt_trip_id) - *temp = d->crt_temp; - else if (trip == d->psv_trip_id) - *temp = d->psv_temp; - else if (trip == d->hot_trip_id) - *temp = d->hot_temp; - else { - for (i = 0; i < INT340X_THERMAL_MAX_ACT_TRIP_COUNT;i++) {
- if (d->act_trips[i].valid && - d->act_trips[i].id == trip) { - *temp = d->act_trips[i].temp; - break;
- }
- }
- if (i ==INT340X_THERMAL_MAX_ACT_TRIP_COUNT) - return-EINVAL;
- }drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-5- - return 0; -} - -static int int340x_thermal_get_trip_type(struct
thermal_zone_device
*zone,
- int trip,
- enumthermal_trip_type*type)drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-14-{ - struct int34x_thermal_zone *d = zone->devdata; - int i; - - if (trip < d->aux_trip_nr) - *type = THERMAL_TRIP_PASSIVE; - else if (trip == d->crt_trip_id) - *type = THERMAL_TRIP_CRITICAL; - else if (trip == d->hot_trip_id) - *type = THERMAL_TRIP_HOT; - else if (trip == d->psv_trip_id) - *type = THERMAL_TRIP_PASSIVE; - else { - for (i = 0; i < INT340X_THERMAL_MAX_ACT_TRIP_COUNT;i++) {
- if (d->act_trips[i].valid && - d->act_trips[i].id == trip) { - *type =THERMAL_TRIP_ACTIVE; - break;
- }
- }
- if (i ==INT340X_THERMAL_MAX_ACT_TRIP_COUNT) - return-EINVAL;
- }drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-4- - return 0; -} -static int int340x_thermal_set_trip_temp(struct
thermal_zone_device
*zone,
int trip, int temp) {drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-0@@ -109,25 +50,6 @@ static int int340x_thermal_set_trip_temp(structthermal_zone_device *zone, if (ACPI_FAILURE(status)) return -EIO;
- d->aux_trips[trip] = temp;drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-6- - return 0; -} - - -static int int340x_thermal_get_trip_hyst(struct
thermal_zone_device
*zone,
- int trip, int *temp)drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-6-{ - struct int34x_thermal_zone *d = zone->devdata; - acpi_status status; - unsigned long long hyst; - - status = acpi_evaluate_integer(d->adev->handle, "GTSH",Quoted 6 lines
NULL,
&hyst);
- if (ACPI_FAILURE(status))
- *temp = 0;
- else
- *temp = hyst * 100;The previous code returns hyst * 100.
But the new API retuurns hyst directly.(quoted diff) +1
-1-/sys/class/thermal/thermal_zone2/trip_point_4_hyst:2000 +/sys/class/thermal/thermal_zone2/trip_point_4_hyst:20
Quoted 4 lines
Is this done on purpose?
I think this may break userspace tools like thermald.
It will.
Thanks,
Srinivas
Quoted 247 lines
Srinivas, can you confirm?
thanks,
ruiQuoted 243 lines
-
return 0;
}drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-0@@ -138,58 +60,36 @@ static void int340x_thermal_critical(struct thermal_zone_device *zone)
static structthermal_zone_device_opsint340x_thermal_zone_ops= { .get_temp =int340x_thermal_get_zone_temp, - .get_trip_temp =int340x_thermal_get_trip_temp, - .get_trip_type =int340x_thermal_get_trip_type, .set_trip_temp =int340x_thermal_set_trip_temp, - .get_trip_hyst =int340x_thermal_get_trip_hyst, .critical =int340x_thermal_critical,
};
-static int int340x_thermal_get_trip_config(acpi_handle handle, char
*name,
- int *temp)drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-13-{ - unsigned long long r; - acpi_status status; - - status = acpi_evaluate_integer(handle, name, NULL, &r); - if (ACPI_FAILURE(status)) - return -EIO; - - *temp = deci_kelvin_to_millicelsius(r); - - return 0; -} -int
int340x_thermal_read_trips(struct int34x_thermal_zone *int34x_zone)
{
- inttrip_cnt=int34x_zone->aux_trip_nr;
- int i;
+ inttrip_cnt;
+ int i, ret;
+
+ trip_cnt =int34x_zone->aux_trip_nr;
- int34x_zone->crt_trip_id = -1;
- if (!int340x_thermal_get_trip_config(int34x_zone->adev-Quoted 1 line
handle,
"
_CRT",
- &int34x_zone-Quoted 1 line
crt_temp))- int34x_zone->crt_trip_id = trip_cnt++; + ret = thermal_acpi_trip_crit(int34x_zone->adev, &int34x_zone-
Quoted 1 line
trips[trip_cnt]);
+ if (!ret)
+ trip_cnt++;
- int34x_zone->hot_trip_id = -1;
- if (!int340x_thermal_get_trip_config(int34x_zone->adev-Quoted 1 line
handle,
"
_HOT",
- &int34x_zone-Quoted 1 line
hot_temp))- int34x_zone->hot_trip_id = trip_cnt++; + ret = thermal_acpi_trip_hot(int34x_zone->adev, &int34x_zone-
Quoted 1 line
trips[trip_cnt]);
+ if (!ret)
+ trip_cnt++;
- int34x_zone->psv_trip_id = -1;
- if (!int340x_thermal_get_trip_config(int34x_zone->adev-Quoted 1 line
handle,
"
_PSV",
- &int34x_zone-Quoted 1 line
psv_temp))- int34x_zone->psv_trip_id = trip_cnt++; + ret = thermal_acpi_trip_psv(int34x_zone->adev, &int34x_zone-
Quoted 1 line
trips[trip_cnt]);
+ if (!ret)
+ trip_cnt++;
for (i = 0; i <INT340X_THERMAL_MAX_ACT_TRIP_COUNT; i++) { - char name[5] = { '_', 'A', 'C', '0' + i, '\0' };
- if (int340x_thermal_get_trip_config(int34x_zone-Quoted 2 lines
adev-
handle,- name, - &int34x_zone-
Quoted 1 line
act_trips[i].temp))
+ ret =
thermal_acpi_trip_act(int34x_zone->adev, &int34x_zone->trips[trip_cnt], i);
+ if (ret)
break;
- int34x_zone->act_trips[i].id = trip_cnt++; - int34x_zone->act_trips[i].valid = true; + trip_cnt++;
}
returntrip_cnt;drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +1
-1@@ -208,7 +108,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, acpi_status status; unsigned long long trip_cnt; int trip_mask = 0; - int ret; + int i, ret;
int34x_thermal_zone =kzalloc(sizeof(*int34x_thermal_zone), GFP_KERNEL);drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-0@@ -228,32 +128,35 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, int34x_thermal_zone->ops->get_temp = get_temp;
status =acpi_evaluate_integer(adev->handle, "PATC", NULL, &trip_cnt);
- if (ACPI_FAILURE(status))
- trip_cnt = 0;
- else {
- int i;
-
- int34x_thermal_zone->aux_trips =
- kcalloc(trip_cnt,
- sizeof(*int34x_thermal_zone-Quoted 1 line
aux_trips),- GFP_KERNEL);
- if (!int34x_thermal_zone->aux_trips) {
- ret =-ENOMEM;
- gotoerr_trip_alloc;
- }
- trip_mask =BIT(trip_cnt)- 1;
+ if (!ACPI_FAILURE(status)) {int34x_thermal_zone->aux_trip_nr=trip_cnt; - for (i = 0; i <trip_cnt; ++i)
- int34x_thermal_zone->aux_trips[i] =THERMAL_TEMP_INVALID;
+ trip_mask =BIT(trip_cnt)- 1;
+ }
+
+ int34x_thermal_zone->trips = kzalloc(sizeof(*int34x_thermal_zone->trips) *
+
(INT340X_THERMAL_MAX_TRIP_
COUNT +trip_cnt),
+GFP_KERNEL); + if (!int34x_thermal_zone->trips) {
+ ret =-ENOMEM;
+ gotoerr_trips_alloc;
}
trip_cnt =int340x_thermal_read_trips(int34x_thermal_zone);
+ for (i = 0; i <trip_cnt; ++i)
+ int34x_thermal_zone->trips[i].hysteresis =thermal_acpi_trip_gtsh(adev);
+
+ for (i = 0; i <int34x_thermal_zone->aux_trip_nr; i++) { + int34x_thermal_zone->trips[i].type =THERMAL_TRIP_PASSIVE;
+ int34x_thermal_zone->trips[i].temperature =THERMAL_TEMP_INVALID;
+ }
+
int34x_thermal_zone->lpat_table = acpi_lpat_get_conversion_table(
ade v-Quoted 1 line
handle);
- int34x_thermal_zone->zone = thermal_zone_device_register( + int34x_thermal_zone->zone = thermal_zone_device_register_with_trips(acpi_device_bid(ade v),
+ int34x_thermal_zone -Quoted 1 line
trips,
trip_cnt,
trip_mask,int34x_thermal_zone,
int34x_thermal_zone -Quoted 1 line
ops,
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-0@@ -272,9 +175,9 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,err_enable:
thermal_zone_device_unregister(int34x_thermal_zone->zone);err_thermal_zone:
+ kfree(int34x_thermal_zone->trips); acpi_lpat_free_conversion_table(int34x_thermal_zone-Quoted 1 line
lpat_table);- kfree(int34x_thermal_zone->aux_trips);
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +1
-1-err_trip_alloc: +err_trips_alloc:kfree(int34x_thermal_zone->ops);
err_ops_alloc:
kfree(int34x_thermal_zone);drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +0
-0@@ -287,7 +190,7 @@ void int340x_thermal_zone_remove(struct
int34x_thermal_zone
{thermal_zone_device_unregister(int34x_thermal_zone->zone); acpi_lpat_free_conversion_table(int34x_thermal_zone-Quoted 1 line
lpat_table);- kfree(int34x_thermal_zone->aux_trips);
+ kfree(int34x_thermal_zone->trips);kfree(int34x_thermal_zone->ops);kfree(int34x_thermal_zone);
}
diff --gita/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.hb/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.hindexe28ab1ba5e06..0c2c8de92014100644drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h +0
-0@@ -10,6 +10,7 @@ #include <acpi/acpi_lpat.h>
#define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10 +#defineINT340X_THERMAL_MAX_TRIP_COUNTINT340X_THERMAL_MAX_ACT_TRIP_COUNT+ 3
structactive_trip{
int temp;drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h +0
-0@@ -19,15 +20,8 @@ struct active_trip {
structint34x_thermal_zone{
structacpi_device*adev;
- structactive_trip
act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT];
- unsigned long*aux_trips;
+ structthermal_trip*trips;
intaux_trip_nr;
- intpsv_temp;
- intpsv_trip_id;
- intcrt_temp;
- intcrt_trip_id;
- inthot_temp;
- inthot_trip_id;
structthermal_zone_device*zone;
structthermal_zone_device_ops*ops;
void*priv_data;
Re: [PATCH 3/3] thermal/drivers/intel: Use generic trip points int340x
In reply to Daniel LezcanoHi Daniel,
Quoted 1 line
Quoted 1 line
Quoted 1 line
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
- status = acpi_evaluate_integer(d->adev->handle, "GTSH", NULL,
&hyst);
- if (ACPI_FAILURE(status))
- *temp = 0;
- else
- *temp = hyst * 100;The previous code returns hyst * 100.
But the new API retuurns hyst directly.(quoted diff) +1
-1-/sys/class/thermal/thermal_zone2/trip_point_4_hyst:2000 +/sys/class/thermal/thermal_zone2/trip_point_4_hyst:20
Quoted 7 lines
Quoted 1 line
Is this done on purpose?
No, it is an error. The function
thermal_acpi_trip_gtsh()should do:return
deci_kelvin_to_millicelsius(hyst);
GTSH returns here in tenths of degree Kelvin. For example 15 means 1.5 degree K.
I would like to test your next series with thermald. If there is a problem, it will break every distro.
Thanks,
Srinivas
Quoted 2 lines
Re: [PATCH 3/3] thermal/drivers/intel: Use generic trip points int340x
Hi Srinivas,
Quoted 25 lines · srinivas pandruvada
Hi Daniel,
Quoted 1 line
Quoted 1 line
Quoted 1 line
[...]
Quoted 19 lines
Quoted 15 lines
Quoted 7 lines
- status = acpi_evaluate_integer(d->adev->handle, "GTSH", NULL,
&hyst);
- if (ACPI_FAILURE(status))
- *temp = 0;
- else
- *temp = hyst * 100;The previous code returns hyst * 100.
But the new API retuurns hyst directly.(quoted diff) +1
-1-/sys/class/thermal/thermal_zone2/trip_point_4_hyst:2000 +/sys/class/thermal/thermal_zone2/trip_point_4_hyst:20
Quoted 1 line
Is this done on purpose?
No, it is an error. The function
thermal_acpi_trip_gtsh()should do:
Quoted 6 lines
Quoted 3 lines
return
deci_kelvin_to_millicelsius(hyst);GTSH returns here in tenths of degree Kelvin. For example 15 means 1.5 degree K.
Yes, so the above conversion is correct, right ?
Quoted 2 lines
I would like to test your next series with thermald. If there is a problem, it will break every distro.
Great, thanks!
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Re: [PATCH 3/3] thermal/drivers/intel: Use generic trip points int340x
Quoted 35 lines · Daniel Lezcano
Hi Srinivas,
Quoted 31 lines · srinivas pandruvada
Hi Daniel,
Quoted 1 line
Quoted 1 line
Quoted 1 line
[...]
Quoted 24 lines
Quoted 16 lines
Quoted 8 lines
- status = acpi_evaluate_integer(d->adev->handle, "GTSH",
NULL,
&hyst);
- if (ACPI_FAILURE(status))
- *temp = 0;
- else
- *temp = hyst * 100;The previous code returns hyst * 100.
But the new API retuurns hyst directly.(quoted diff) +1
-1-/sys/class/thermal/thermal_zone2/trip_point_4_hyst:2000 +/sys/class/thermal/thermal_zone2/trip_point_4_hyst:20
Quoted 1 line
Is this done on purpose?
No, it is an error. The function
thermal_acpi_trip_gtsh()should do:return
deci_kelvin_to_millicelsius(hyst);
Quoted 5 lines
Quoted 3 lines
GTSH returns here in tenths of degree Kelvin. For example 15 means 1.5
degree K.Yes, so the above conversion is correct, right ?
Correct.
Thanks,
Srinivas
Quoted 7 lines
Quoted 3 lines
I would like to test your next series with thermald. If there is a problem, it will break every distro.
Great, thanks!