Re: [PATCH 3/3] thermal/drivers/intel: Use generic trip points int340x

From: Daniel Lezcano
Date: Fri Jan 13 2023 - 07:20:16 EST



Hi Rui;

thanks for testing and your comments


On 13/01/2023 12:41, Zhang, Rui wrote:
On Tue, 2023-01-10 at 16:17 +0100, Daniel Lezcano wrote:
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 <daniel.lezcano@xxxxxxxxxx>
---
V3:
- The driver Kconfig option selects CONFIG_THERMAL_ACPI
- Change the initialization to use GTSH for the hysteresis on
all the trip points

Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
---
drivers/thermal/intel/int340x_thermal/Kconfig | 1 +
.../int340x_thermal/int340x_thermal_zone.c | 177 ++++----------
----

[ ... ]

-static int int340x_thermal_get_trip_hyst(struct thermal_zone_device
*zone,
- 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);
- 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?

No, it is an error. The function thermal_acpi_trip_gtsh() should do:

return deci_kelvin_to_millicelsius(hyst);




--
<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