Skip to content

Commit 83e8de8

Browse files
committed
Merge tag 'thermal-v5.16-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux
Pull thermal core and ARM thermal driver updates for v5.16 from Daniel Lezcano: - Constify a variable in thermal mmio driver (Rikard Falkeborn) - Add the current temperature in the netlink message when crossing a trip point in order to prevent useless back and forth reading from userspace (Daniel Lezcano) - Add support for the 'HC' variant on PM8998 pmic in order to support vadc channels on recent QCom boards (Bjorn Andersson) - Add support of calibration values from hardware when they are fused (Niklas Söderlund) - Fix NULL pointer dereference from the thermal_release callback when an error occured in the thermal_zone_device_register() function (Yuanzheng Song) - Fix use after free call in the __thermal_cooling_device_register() function in the error path (Ziyang Xuan) - Fix compilation error for the LMh driver when CONFIG_QCOM_SCM is not set (Jackie Liu) - Add a timeout when reading a register which can block forever under certain circumstances in the tsens driver (Ansuel Smith) - Add DT binding for the reset lines and use them in the rockchip sensor driver (Johan Jonker) - Add new uniphier NX1 SoC temperature sensor (Kunihiko Hayashi) - Save and restore the TCC value in the int340x driver (Antoine Tenart) - Deprecate the cooling device state sysfs file writable and the user space governor (Daniel Lezcano) * tag 'thermal-v5.16-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: thermal/core: Deprecate changing cooling device state from userspace thermal/core: Make the userspace governor deprecated thermal/drivers/int340x: Improve the tcc offset saving for suspend/resume thermal/drivers/uniphier: Add compatible string for NX1 SoC dt-bindings: thermal: uniphier: Add binding for NX1 SoC thermal/drivers/rockchip_thermal: Allow more resets for tsadc node dt-bindings: thermal: remove redundant comments from rockchip-thermal.yaml dt-bindings: thermal: allow more resets for tsadc node in rockchip-thermal.yaml thermal/drivers/tsens: Add timeout to get_temp_tsens_valid thermal/drivers/qcom/lmh: make QCOM_LMH depends on QCOM_SCM thermal/core: fix a UAF bug in __thermal_cooling_device_register() thermal/core: Fix null pointer dereference in thermal_release() thermal: rcar_gen3_thermal: Read calibration from hardware thermal: rcar_gen3_thermal: Store thcode and ptat in priv data thermal/drivers/qcom/spmi-adc-tm5: Add support for HC variant dt-bindings: thermal: qcom: add HC variant of adc-thermal monitor bindings thermal/drivers/netlink: Add the temperature when crossing a trip point thermal/drivers/thermal_mmio: Constify static struct thermal_mmio_ops
2 parents 3906fe9 + a67a46a commit 83e8de8

20 files changed

+408
-82
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/thermal/qcom-spmi-adc-tm-hc.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Qualcomm's SPMI PMIC ADC HC Thermal Monitoring
8+
maintainers:
9+
- Dmitry Baryshkov <[email protected]>
10+
11+
properties:
12+
compatible:
13+
const: qcom,spmi-adc-tm-hc
14+
15+
reg:
16+
maxItems: 1
17+
18+
interrupts:
19+
maxItems: 1
20+
21+
"#thermal-sensor-cells":
22+
const: 1
23+
description:
24+
Number of cells required to uniquely identify the thermal sensors. Since
25+
we have multiple sensors this is set to 1
26+
27+
"#address-cells":
28+
const: 1
29+
30+
"#size-cells":
31+
const: 0
32+
33+
qcom,avg-samples:
34+
$ref: /schemas/types.yaml#/definitions/uint32
35+
description: Number of samples to be used for measurement.
36+
enum:
37+
- 1
38+
- 2
39+
- 4
40+
- 8
41+
- 16
42+
default: 1
43+
44+
qcom,decimation:
45+
$ref: /schemas/types.yaml#/definitions/uint32
46+
description: This parameter is used to decrease ADC sampling rate.
47+
Quicker measurements can be made by reducing decimation ratio.
48+
enum:
49+
- 256
50+
- 512
51+
- 1024
52+
default: 1024
53+
54+
patternProperties:
55+
"^([-a-z0-9]*)@[0-7]$":
56+
type: object
57+
description:
58+
Represent one thermal sensor.
59+
60+
properties:
61+
reg:
62+
description: Specify the sensor channel. There are 8 channels in PMIC5's ADC TM
63+
minimum: 0
64+
maximum: 7
65+
66+
io-channels:
67+
description:
68+
From common IIO binding. Used to pipe PMIC ADC channel to thermal monitor
69+
70+
qcom,ratiometric:
71+
$ref: /schemas/types.yaml#/definitions/flag
72+
description:
73+
Channel calibration type.
74+
If this property is specified VADC will use the VDD reference
75+
(1.875V) and GND for channel calibration. If property is not found,
76+
channel will be calibrated with 0V and 1.25V reference channels,
77+
also known as absolute calibration.
78+
79+
qcom,hw-settle-time-us:
80+
description: Time between AMUX getting configured and the ADC starting conversion.
81+
enum: [0, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000, 6000, 8000, 10000]
82+
83+
qcom,pre-scaling:
84+
$ref: /schemas/types.yaml#/definitions/uint32-array
85+
description: Used for scaling the channel input signal before the
86+
signal is fed to VADC. The configuration for this node is to know the
87+
pre-determined ratio and use it for post scaling. It is a pair of
88+
integers, denoting the numerator and denominator of the fraction by
89+
which input signal is multiplied. For example, <1 3> indicates the
90+
signal is scaled down to 1/3 of its value before ADC measurement. If
91+
property is not found default value depending on chip will be used.
92+
items:
93+
- const: 1
94+
- enum: [ 1, 3, 4, 6, 20, 8, 10 ]
95+
96+
required:
97+
- reg
98+
- io-channels
99+
100+
additionalProperties:
101+
false
102+
103+
required:
104+
- compatible
105+
- reg
106+
- interrupts
107+
- "#address-cells"
108+
- "#size-cells"
109+
- "#thermal-sensor-cells"
110+
111+
additionalProperties: false
112+
113+
examples:
114+
- |
115+
#include <dt-bindings/iio/qcom,spmi-vadc.h>
116+
#include <dt-bindings/interrupt-controller/irq.h>
117+
spmi_bus {
118+
#address-cells = <1>;
119+
#size-cells = <0>;
120+
pm8998_adc: adc@3100 {
121+
reg = <0x3100>;
122+
compatible = "qcom,spmi-adc-rev2";
123+
#address-cells = <1>;
124+
#size-cells = <0>;
125+
#io-channel-cells = <1>;
126+
127+
/* Other propreties are omitted */
128+
adc-chan@4c {
129+
reg = <ADC5_XO_THERM_100K_PU>;
130+
};
131+
};
132+
133+
pm8998_adc_tm: adc-tm@3400 {
134+
compatible = "qcom,spmi-adc-tm-hc";
135+
reg = <0x3400>;
136+
interrupts = <0x2 0x34 0x0 IRQ_TYPE_EDGE_RISING>;
137+
#thermal-sensor-cells = <1>;
138+
#address-cells = <1>;
139+
#size-cells = <0>;
140+
141+
thermistor@1 {
142+
reg = <1>;
143+
io-channels = <&pm8998_adc ADC5_XO_THERM_100K_PU>;
144+
qcom,ratiometric;
145+
qcom,hw-settle-time-us = <200>;
146+
};
147+
};
148+
};
149+
...

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ maintainers:
1212
properties:
1313
compatible:
1414
enum:
15-
- rockchip,px30-tsadc # PX30 SoCs
16-
- rockchip,rv1108-tsadc # RV1108 SoCs
17-
- rockchip,rk3228-tsadc # RK3228 SoCs
18-
- rockchip,rk3288-tsadc # RK3288 SoCs
19-
- rockchip,rk3328-tsadc # RK3328 SoCs
20-
- rockchip,rk3368-tsadc # RK3368 SoCs
21-
- rockchip,rk3399-tsadc # RK3399 SoCs
22-
- rockchip,rk3568-tsadc # RK3568 SoCs
15+
- rockchip,px30-tsadc
16+
- rockchip,rk3228-tsadc
17+
- rockchip,rk3288-tsadc
18+
- rockchip,rk3328-tsadc
19+
- rockchip,rk3368-tsadc
20+
- rockchip,rk3399-tsadc
21+
- rockchip,rk3568-tsadc
22+
- rockchip,rv1108-tsadc
2323

2424
reg:
2525
maxItems: 1
@@ -37,11 +37,15 @@ properties:
3737
- const: apb_pclk
3838

3939
resets:
40-
maxItems: 1
40+
minItems: 1
41+
maxItems: 3
4142

4243
reset-names:
44+
minItems: 1
4345
items:
4446
- const: tsadc-apb
47+
- const: tsadc
48+
- const: tsadc-phy
4549

4650
"#thermal-sensor-cells":
4751
const: 1
@@ -71,7 +75,6 @@ required:
7175
- clocks
7276
- clock-names
7377
- resets
74-
- reset-names
7578
- "#thermal-sensor-cells"
7679

7780
additionalProperties: false

Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ properties:
2020
- socionext,uniphier-pxs2-thermal
2121
- socionext,uniphier-ld20-thermal
2222
- socionext,uniphier-pxs3-thermal
23+
- socionext,uniphier-nx1-thermal
2324

2425
interrupts:
2526
maxItems: 1

drivers/thermal/gov_user_space.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515

1616
#include "thermal_core.h"
1717

18+
static int user_space_bind(struct thermal_zone_device *tz)
19+
{
20+
pr_warn("Userspace governor deprecated: use thermal netlink " \
21+
"notification instead\n");
22+
23+
return 0;
24+
}
25+
1826
/**
1927
* notify_user_space - Notifies user space about thermal events
2028
* @tz: thermal_zone_device
@@ -43,5 +51,6 @@ static int notify_user_space(struct thermal_zone_device *tz, int trip)
4351
static struct thermal_governor thermal_gov_user_space = {
4452
.name = "user_space",
4553
.throttle = notify_user_space,
54+
.bind_to_tz = user_space_bind,
4655
};
4756
THERMAL_GOVERNOR_DECLARE(thermal_gov_user_space);

drivers/thermal/intel/int340x_thermal/int3401_thermal.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,21 @@ static int int3401_remove(struct platform_device *pdev)
4444
}
4545

4646
#ifdef CONFIG_PM_SLEEP
47+
static int int3401_thermal_suspend(struct device *dev)
48+
{
49+
return proc_thermal_suspend(dev);
50+
}
4751
static int int3401_thermal_resume(struct device *dev)
4852
{
4953
return proc_thermal_resume(dev);
5054
}
5155
#else
56+
#define int3401_thermal_suspend NULL
5257
#define int3401_thermal_resume NULL
5358
#endif
5459

55-
static SIMPLE_DEV_PM_OPS(int3401_proc_thermal_pm, NULL, int3401_thermal_resume);
60+
static SIMPLE_DEV_PM_OPS(int3401_proc_thermal_pm, int3401_thermal_suspend,
61+
int3401_thermal_resume);
5662

5763
static struct platform_driver int3401_driver = {
5864
.probe = int3401_add,

drivers/thermal/intel/int340x_thermal/processor_thermal_device.c

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ static const struct attribute_group power_limit_attribute_group = {
6868
.name = "power_limits"
6969
};
7070

71-
static ssize_t tcc_offset_degree_celsius_show(struct device *dev,
72-
struct device_attribute *attr, char *buf)
71+
static int tcc_get_offset(void)
7372
{
7473
u64 val;
7574
int err;
@@ -78,8 +77,20 @@ static ssize_t tcc_offset_degree_celsius_show(struct device *dev,
7877
if (err)
7978
return err;
8079

81-
val = (val >> 24) & 0x3f;
82-
return sprintf(buf, "%d\n", (int)val);
80+
return (val >> 24) & 0x3f;
81+
}
82+
83+
static ssize_t tcc_offset_degree_celsius_show(struct device *dev,
84+
struct device_attribute *attr,
85+
char *buf)
86+
{
87+
int tcc;
88+
89+
tcc = tcc_get_offset();
90+
if (tcc < 0)
91+
return tcc;
92+
93+
return sprintf(buf, "%d\n", tcc);
8394
}
8495

8596
static int tcc_offset_update(unsigned int tcc)
@@ -107,8 +118,6 @@ static int tcc_offset_update(unsigned int tcc)
107118
return 0;
108119
}
109120

110-
static int tcc_offset_save = -1;
111-
112121
static ssize_t tcc_offset_degree_celsius_store(struct device *dev,
113122
struct device_attribute *attr, const char *buf,
114123
size_t count)
@@ -131,8 +140,6 @@ static ssize_t tcc_offset_degree_celsius_store(struct device *dev,
131140
if (err)
132141
return err;
133142

134-
tcc_offset_save = tcc;
135-
136143
return count;
137144
}
138145

@@ -345,13 +352,26 @@ void proc_thermal_remove(struct proc_thermal_device *proc_priv)
345352
}
346353
EXPORT_SYMBOL_GPL(proc_thermal_remove);
347354

355+
static int tcc_offset_save = -1;
356+
357+
int proc_thermal_suspend(struct device *dev)
358+
{
359+
tcc_offset_save = tcc_get_offset();
360+
if (tcc_offset_save < 0)
361+
dev_warn(dev, "failed to save offset (%d)\n", tcc_offset_save);
362+
363+
return 0;
364+
}
365+
EXPORT_SYMBOL_GPL(proc_thermal_suspend);
366+
348367
int proc_thermal_resume(struct device *dev)
349368
{
350369
struct proc_thermal_device *proc_dev;
351370

352371
proc_dev = dev_get_drvdata(dev);
353372
proc_thermal_read_ppcc(proc_dev);
354373

374+
/* Do not update if saving failed */
355375
if (tcc_offset_save >= 0)
356376
tcc_offset_update(tcc_offset_save);
357377

drivers/thermal/intel/int340x_thermal/processor_thermal_device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void proc_thermal_mbox_remove(struct pci_dev *pdev);
8383
int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cmd_resp);
8484
int proc_thermal_add(struct device *dev, struct proc_thermal_device *priv);
8585
void proc_thermal_remove(struct proc_thermal_device *proc_priv);
86+
int proc_thermal_suspend(struct device *dev);
8687
int proc_thermal_resume(struct device *dev);
8788
int proc_thermal_mmio_add(struct pci_dev *pdev,
8889
struct proc_thermal_device *proc_priv,

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,20 @@ static void proc_thermal_pci_remove(struct pci_dev *pdev)
314314
}
315315

316316
#ifdef CONFIG_PM_SLEEP
317+
static int proc_thermal_pci_suspend(struct device *dev)
318+
{
319+
struct pci_dev *pdev = to_pci_dev(dev);
320+
struct proc_thermal_device *proc_priv;
321+
struct proc_thermal_pci *pci_info;
322+
323+
proc_priv = pci_get_drvdata(pdev);
324+
pci_info = proc_priv->priv_data;
325+
326+
if (!pci_info->no_legacy)
327+
return proc_thermal_suspend(dev);
328+
329+
return 0;
330+
}
317331
static int proc_thermal_pci_resume(struct device *dev)
318332
{
319333
struct pci_dev *pdev = to_pci_dev(dev);
@@ -335,10 +349,12 @@ static int proc_thermal_pci_resume(struct device *dev)
335349
return 0;
336350
}
337351
#else
352+
#define proc_thermal_pci_suspend NULL
338353
#define proc_thermal_pci_resume NULL
339354
#endif
340355

341-
static SIMPLE_DEV_PM_OPS(proc_thermal_pci_pm, NULL, proc_thermal_pci_resume);
356+
static SIMPLE_DEV_PM_OPS(proc_thermal_pci_pm, proc_thermal_pci_suspend,
357+
proc_thermal_pci_resume);
342358

343359
static const struct pci_device_id proc_thermal_pci_ids[] = {
344360
{ PCI_DEVICE_DATA(INTEL, ADL_THERMAL, PROC_THERMAL_FEATURE_RAPL | PROC_THERMAL_FEATURE_FIVR | PROC_THERMAL_FEATURE_DVFS | PROC_THERMAL_FEATURE_MBOX) },

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,21 @@ static void proc_thermal_pci_remove(struct pci_dev *pdev)
107107
}
108108

109109
#ifdef CONFIG_PM_SLEEP
110+
static int proc_thermal_pci_suspend(struct device *dev)
111+
{
112+
return proc_thermal_suspend(dev);
113+
}
110114
static int proc_thermal_pci_resume(struct device *dev)
111115
{
112116
return proc_thermal_resume(dev);
113117
}
114118
#else
119+
#define proc_thermal_pci_suspend NULL
115120
#define proc_thermal_pci_resume NULL
116121
#endif
117122

118-
static SIMPLE_DEV_PM_OPS(proc_thermal_pci_pm, NULL, proc_thermal_pci_resume);
123+
static SIMPLE_DEV_PM_OPS(proc_thermal_pci_pm, proc_thermal_pci_suspend,
124+
proc_thermal_pci_resume);
119125

120126
static const struct pci_device_id proc_thermal_pci_ids[] = {
121127
{ PCI_DEVICE_DATA(INTEL, BDW_THERMAL, 0) },

0 commit comments

Comments
 (0)