Skip to content

Commit 7f73ba6

Browse files
committed
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 ...
2 parents bd012f3 + 17e8b76 commit 7f73ba6

30 files changed

+1074
-764
lines changed

Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ properties:
1616
- allwinner,sun8i-a83t-ths
1717
- allwinner,sun8i-h3-ths
1818
- allwinner,sun8i-r40-ths
19+
- allwinner,sun20i-d1-ths
1920
- allwinner,sun50i-a64-ths
2021
- allwinner,sun50i-a100-ths
2122
- allwinner,sun50i-h5-ths
@@ -61,6 +62,7 @@ allOf:
6162
compatible:
6263
contains:
6364
enum:
65+
- allwinner,sun20i-d1-ths
6466
- allwinner,sun50i-a100-ths
6567
- allwinner,sun50i-h6-ths
6668

@@ -84,7 +86,9 @@ allOf:
8486
properties:
8587
compatible:
8688
contains:
87-
const: allwinner,sun8i-h3-ths
89+
enum:
90+
- allwinner,sun8i-h3-ths
91+
- allwinner,sun20i-d1-ths
8892

8993
then:
9094
properties:
@@ -103,6 +107,7 @@ allOf:
103107
enum:
104108
- allwinner,sun8i-h3-ths
105109
- allwinner,sun8i-r40-ths
110+
- allwinner,sun20i-d1-ths
106111
- allwinner,sun50i-a64-ths
107112
- allwinner,sun50i-a100-ths
108113
- allwinner,sun50i-h5-ths

Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ maintainers:
1010
- zhanghongchen <zhanghongchen@loongson.cn>
1111
- Yinbo Zhu <zhuyinbo@loongson.cn>
1212

13+
allOf:
14+
- $ref: /schemas/thermal/thermal-sensor.yaml#
15+
1316
properties:
1417
compatible:
1518
oneOf:
@@ -26,12 +29,16 @@ properties:
2629
interrupts:
2730
maxItems: 1
2831

32+
'#thermal-sensor-cells':
33+
const: 1
34+
2935
required:
3036
- compatible
3137
- reg
3238
- interrupts
39+
- '#thermal-sensor-cells'
3340

34-
additionalProperties: false
41+
unevaluatedProperties: false
3542

3643
examples:
3744
- |
@@ -41,4 +48,5 @@ examples:
4148
reg = <0x1fe01500 0x30>;
4249
interrupt-parent = <&liointc0>;
4350
interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
51+
#thermal-sensor-cells = <1>;
4452
};
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/thermal/mediatek,thermal.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Mediatek thermal controller for on-SoC temperatures
8+
9+
maintainers:
10+
- Sascha Hauer <s.hauer@pengutronix.de>
11+
12+
description:
13+
This device does not have its own ADC, instead it directly controls the AUXADC
14+
via AHB bus accesses. For this reason it needs phandles to the AUXADC. Also it
15+
controls a mux in the apmixedsys register space via AHB bus accesses, so a
16+
phandle to the APMIXEDSYS is also needed.
17+
18+
allOf:
19+
- $ref: thermal-sensor.yaml#
20+
21+
properties:
22+
compatible:
23+
enum:
24+
- mediatek,mt2701-thermal
25+
- mediatek,mt2712-thermal
26+
- mediatek,mt7622-thermal
27+
- mediatek,mt7981-thermal
28+
- mediatek,mt7986-thermal
29+
- mediatek,mt8173-thermal
30+
- mediatek,mt8183-thermal
31+
- mediatek,mt8365-thermal
32+
- mediatek,mt8516-thermal
33+
34+
reg:
35+
maxItems: 1
36+
37+
interrupts:
38+
maxItems: 1
39+
40+
clocks:
41+
items:
42+
- description: Main clock needed for register access
43+
- description: The AUXADC clock
44+
45+
clock-names:
46+
items:
47+
- const: therm
48+
- const: auxadc
49+
50+
mediatek,auxadc:
51+
$ref: /schemas/types.yaml#/definitions/phandle
52+
description: A phandle to the AUXADC which the thermal controller uses
53+
54+
mediatek,apmixedsys:
55+
$ref: /schemas/types.yaml#/definitions/phandle
56+
description: A phandle to the APMIXEDSYS controller
57+
58+
resets:
59+
description: Reset controller controlling the thermal controller
60+
61+
nvmem-cells:
62+
items:
63+
- description:
64+
NVMEM cell with EEPROMA phandle to the calibration data provided by an
65+
NVMEM device. If unspecified default values shall be used.
66+
67+
nvmem-cell-names:
68+
items:
69+
- const: calibration-data
70+
71+
required:
72+
- reg
73+
- interrupts
74+
- clocks
75+
- clock-names
76+
- mediatek,auxadc
77+
- mediatek,apmixedsys
78+
79+
unevaluatedProperties: false
80+
81+
examples:
82+
- |
83+
#include <dt-bindings/interrupt-controller/irq.h>
84+
#include <dt-bindings/clock/mt8173-clk.h>
85+
#include <dt-bindings/reset/mt8173-resets.h>
86+
87+
thermal@1100b000 {
88+
compatible = "mediatek,mt8173-thermal";
89+
reg = <0x1100b000 0x1000>;
90+
interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>;
91+
clocks = <&pericfg CLK_PERI_THERM>, <&pericfg CLK_PERI_AUXADC>;
92+
clock-names = "therm", "auxadc";
93+
resets = <&pericfg MT8173_PERI_THERM_SW_RST>;
94+
mediatek,auxadc = <&auxadc>;
95+
mediatek,apmixedsys = <&apmixedsys>;
96+
nvmem-cells = <&thermal_calibration_data>;
97+
nvmem-cell-names = "calibration-data";
98+
#thermal-sensor-cells = <1>;
99+
};

Documentation/devicetree/bindings/thermal/mediatek-thermal.txt

Lines changed: 0 additions & 52 deletions
This file was deleted.

Documentation/devicetree/bindings/thermal/qcom-spmi-adc-tm-hc.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,14 @@ examples:
114114
- |
115115
#include <dt-bindings/iio/qcom,spmi-vadc.h>
116116
#include <dt-bindings/interrupt-controller/irq.h>
117-
spmi_bus {
117+
118+
pmic {
118119
#address-cells = <1>;
119120
#size-cells = <0>;
121+
120122
pm8998_adc: adc@3100 {
121-
reg = <0x3100>;
122123
compatible = "qcom,spmi-adc-rev2";
124+
reg = <0x3100>;
123125
#address-cells = <1>;
124126
#size-cells = <0>;
125127
#io-channel-cells = <1>;
@@ -130,7 +132,7 @@ examples:
130132
};
131133
};
132134
133-
pm8998_adc_tm: adc-tm@3400 {
135+
adc-tm@3400 {
134136
compatible = "qcom,spmi-adc-tm-hc";
135137
reg = <0x3400>;
136138
interrupts = <0x2 0x34 0x0 IRQ_TYPE_EDGE_RISING>;

Documentation/devicetree/bindings/thermal/qcom-spmi-adc-tm5.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,14 @@ examples:
167167
- |
168168
#include <dt-bindings/iio/qcom,spmi-vadc.h>
169169
#include <dt-bindings/interrupt-controller/irq.h>
170-
spmi_bus {
170+
171+
pmic {
171172
#address-cells = <1>;
172173
#size-cells = <0>;
174+
173175
pm8150b_adc: adc@3100 {
174-
reg = <0x3100>;
175176
compatible = "qcom,spmi-adc5";
177+
reg = <0x3100>;
176178
#address-cells = <1>;
177179
#size-cells = <0>;
178180
#io-channel-cells = <1>;
@@ -186,7 +188,7 @@ examples:
186188
};
187189
};
188190
189-
pm8150b_adc_tm: adc-tm@3500 {
191+
adc-tm@3500 {
190192
compatible = "qcom,spmi-adc-tm5";
191193
reg = <0x3500>;
192194
interrupts = <0x2 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
@@ -207,12 +209,14 @@ examples:
207209
#include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
208210
#include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h>
209211
#include <dt-bindings/interrupt-controller/irq.h>
210-
spmi_bus {
212+
213+
pmic {
211214
#address-cells = <1>;
212215
#size-cells = <0>;
216+
213217
pmk8350_vadc: adc@3100 {
214-
reg = <0x3100>;
215218
compatible = "qcom,spmi-adc7";
219+
reg = <0x3100>;
216220
#address-cells = <1>;
217221
#size-cells = <0>;
218222
#io-channel-cells = <1>;
@@ -233,7 +237,7 @@ examples:
233237
};
234238
};
235239
236-
pmk8350_adc_tm: adc-tm@3400 {
240+
adc-tm@3400 {
237241
compatible = "qcom,spmi-adc-tm5-gen2";
238242
reg = <0x3400>;
239243
interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>;

Documentation/devicetree/bindings/thermal/qcom-tsens.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ properties:
6666
- qcom,sm8350-tsens
6767
- qcom,sm8450-tsens
6868
- qcom,sm8550-tsens
69+
- qcom,sm8650-tsens
6970
- const: qcom,tsens-v2
7071

7172
- description: v2 of TSENS with combined interrupt

Documentation/devicetree/bindings/thermal/thermal-zones.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ patternProperties:
7575
framework and assumes that the thermal sensors in this zone
7676
support interrupts.
7777

78+
critical-action:
79+
$ref: /schemas/types.yaml#/definitions/string
80+
description: |
81+
The action the OS should perform after the critical temperature is reached.
82+
By default the system will shutdown as a safe action to prevent damage
83+
to the hardware, if the property is not set.
84+
The shutdown action should be always the default and preferred one.
85+
Choose 'reboot' with care, as the hardware may be in thermal stress,
86+
thus leading to infinite reboots that may cause damage to the hardware.
87+
Make sure the firmware/bootloader will act as the last resort and take
88+
over the thermal control.
89+
90+
enum:
91+
- shutdown
92+
- reboot
93+
7894
thermal-sensors:
7995
$ref: /schemas/types.yaml#/definitions/phandle-array
8096
maxItems: 1

drivers/acpi/thermal.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ static int acpi_thermal_adjust_trip(struct thermal_trip *trip, void *data)
292292
struct acpi_thermal_trip *acpi_trip = trip->priv;
293293
struct adjust_trip_data *atd = data;
294294
struct acpi_thermal *tz = atd->tz;
295+
int temp;
295296

296297
if (!acpi_trip || !acpi_thermal_trip_valid(acpi_trip))
297298
return 0;
@@ -302,9 +303,11 @@ static int acpi_thermal_adjust_trip(struct thermal_trip *trip, void *data)
302303
acpi_thermal_update_trip_devices(tz, trip);
303304

304305
if (acpi_thermal_trip_valid(acpi_trip))
305-
trip->temperature = acpi_thermal_temp(tz, acpi_trip->temp_dk);
306+
temp = acpi_thermal_temp(tz, acpi_trip->temp_dk);
306307
else
307-
trip->temperature = THERMAL_TEMP_INVALID;
308+
temp = THERMAL_TEMP_INVALID;
309+
310+
thermal_zone_set_trip_temp(tz->thermal_zone, trip, temp);
308311

309312
return 0;
310313
}

0 commit comments

Comments
 (0)