Skip to content

Commit 02be605

Browse files
committed
Merge tag 'thermal-v6.3-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux into thermal-next
Pull thermal control material for 6.3-rc1 from Daniel Lezcano: "- Fix kerneldoc format errors for Rockchip, Mediatek and Uniphier (Randy Dunlap) - Add the missing 'qcom,adc-tm7' compatible string in the dt-bindings (Krzysztof Kozlowski) - Improve the calibration routine by relying on the nvmem to read the values and provide a set of fixes for the QCom tsens driver (Dmitry Baryshkov) - Remove the duplicate interrupt setting routine in the QCom tsens driver (Daniel Lezcano) - Fix a wrong loop condition in the i.MX SC thermal driver and add the iMX8QM sensors (Viorel Suman) - Fix header inclusion asm-generic.h by asm.h for the qcom-spmi-adc-tm5 driver (Andy Shevchenko) - Use the devm_platform_get_and_ioremap_resource() combo function in all the drivers where the conversion applies (Ye Xingchen) - Replace a literal mask by an existing corresponding macro (Yangtao Li) - Add support for MT7986 and MT7981 (Daniel Golle) - Use thermal_zone_get_crit_temp() for the Armada thermal driver (Daniel Lezcano)" * tag 'thermal-v6.3-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (35 commits) thermal/drivers/armada: Use the thermal_zone_get_crit_temp() thermal/drivers/mtk: Add support for MT7986 and MT7981 thermal/drivers/mtk: Use function pointer for raw_to_mcelsius thermal/drivers/sun8i: Convert to use macro thermal/drivers/spear: Use devm_platform_get_and_ioremap_resource() thermal/drivers/kirkwood: Use devm_platform_get_and_ioremap_resource() thermal/drivers/thermal_mmio: Use devm_platform_get_and_ioremap_resource() thermal/drivers/rockchip: Use devm_platform_get_and_ioremap_resource() thermal/drivers/mtk_thermal: Use devm_platform_get_and_ioremap_resource() thermal/drivers/armada: Use devm_platform_get_and_ioremap_resource() thermal/drivers/dove: Use devm_platform_get_and_ioremap_resource() thermal/drivers/bcm2835: Use devm_platform_get_and_ioremap_resource() thermal/drivers/brcmstb_thermal: Use devm_platform_get_and_ioremap_resource() thermal/drivers/qcom-spmi-adc-tm5: Use asm intead of asm-generic thermal/drivers/imx_sc_thermal: Add iMX8QM sensors thermal/drivers/imx_sc_thermal: Fix the loop condition thermal/drivers/qcom: Remove duplicate set next trip point interrupt code thermal/drivers/tsens: Drop single-cell code for msm8976/msm8956 thermal/drivers/tsens: Drop single-cell code for msm8939 thermal/drivers/tsens: Drop single-cell code for mdm9607 ...
2 parents a2c81dc + 8c5ee91 commit 02be605

19 files changed

+800
-859
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ properties:
1313
enum:
1414
- qcom,spmi-adc-tm5
1515
- qcom,spmi-adc-tm5-gen2
16+
- qcom,adc-tm7 # Incomplete / subject to change
1617

1718
reg:
1819
maxItems: 1

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

Lines changed: 143 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ properties:
3737
- description: v1 of TSENS
3838
items:
3939
- enum:
40+
- qcom,msm8956-tsens
4041
- qcom,msm8976-tsens
4142
- qcom,qcs404-tsens
4243
- const: qcom,tsens-v1
@@ -80,18 +81,120 @@ properties:
8081
maxItems: 2
8182

8283
nvmem-cells:
83-
minItems: 1
84-
maxItems: 2
85-
description:
86-
Reference to an nvmem node for the calibration data
84+
oneOf:
85+
- minItems: 1
86+
maxItems: 2
87+
description:
88+
Reference to an nvmem node for the calibration data
89+
- minItems: 5
90+
maxItems: 35
91+
description: |
92+
Reference to nvmem cells for the calibration mode, two calibration
93+
bases and two cells per each sensor
94+
# special case for msm8974 / apq8084
95+
- maxItems: 51
96+
description: |
97+
Reference to nvmem cells for the calibration mode, two calibration
98+
bases and two cells per each sensor, main and backup copies, plus use_backup cell
8799
88100
nvmem-cell-names:
89-
minItems: 1
90-
items:
91-
- const: calib
92-
- enum:
93-
- calib_backup
94-
- calib_sel
101+
oneOf:
102+
- minItems: 1
103+
items:
104+
- const: calib
105+
- enum:
106+
- calib_backup
107+
- calib_sel
108+
- minItems: 5
109+
items:
110+
- const: mode
111+
- const: base1
112+
- const: base2
113+
- pattern: '^s[0-9]+_p1$'
114+
- pattern: '^s[0-9]+_p2$'
115+
- pattern: '^s[0-9]+_p1$'
116+
- pattern: '^s[0-9]+_p2$'
117+
- pattern: '^s[0-9]+_p1$'
118+
- pattern: '^s[0-9]+_p2$'
119+
- pattern: '^s[0-9]+_p1$'
120+
- pattern: '^s[0-9]+_p2$'
121+
- pattern: '^s[0-9]+_p1$'
122+
- pattern: '^s[0-9]+_p2$'
123+
- pattern: '^s[0-9]+_p1$'
124+
- pattern: '^s[0-9]+_p2$'
125+
- pattern: '^s[0-9]+_p1$'
126+
- pattern: '^s[0-9]+_p2$'
127+
- pattern: '^s[0-9]+_p1$'
128+
- pattern: '^s[0-9]+_p2$'
129+
- pattern: '^s[0-9]+_p1$'
130+
- pattern: '^s[0-9]+_p2$'
131+
- pattern: '^s[0-9]+_p1$'
132+
- pattern: '^s[0-9]+_p2$'
133+
- pattern: '^s[0-9]+_p1$'
134+
- pattern: '^s[0-9]+_p2$'
135+
- pattern: '^s[0-9]+_p1$'
136+
- pattern: '^s[0-9]+_p2$'
137+
- pattern: '^s[0-9]+_p1$'
138+
- pattern: '^s[0-9]+_p2$'
139+
- pattern: '^s[0-9]+_p1$'
140+
- pattern: '^s[0-9]+_p2$'
141+
- pattern: '^s[0-9]+_p1$'
142+
- pattern: '^s[0-9]+_p2$'
143+
- pattern: '^s[0-9]+_p1$'
144+
- pattern: '^s[0-9]+_p2$'
145+
# special case for msm8974 / apq8084
146+
- items:
147+
- const: mode
148+
- const: base1
149+
- const: base2
150+
- const: use_backup
151+
- const: mode_backup
152+
- const: base1_backup
153+
- const: base2_backup
154+
- const: s0_p1
155+
- const: s0_p2
156+
- const: s1_p1
157+
- const: s1_p2
158+
- const: s2_p1
159+
- const: s2_p2
160+
- const: s3_p1
161+
- const: s3_p2
162+
- const: s4_p1
163+
- const: s4_p2
164+
- const: s5_p1
165+
- const: s5_p2
166+
- const: s6_p1
167+
- const: s6_p2
168+
- const: s7_p1
169+
- const: s7_p2
170+
- const: s8_p1
171+
- const: s8_p2
172+
- const: s9_p1
173+
- const: s9_p2
174+
- const: s10_p1
175+
- const: s10_p2
176+
- const: s0_p1_backup
177+
- const: s0_p2_backup
178+
- const: s1_p1_backup
179+
- const: s1_p2_backup
180+
- const: s2_p1_backup
181+
- const: s2_p2_backup
182+
- const: s3_p1_backup
183+
- const: s3_p2_backup
184+
- const: s4_p1_backup
185+
- const: s4_p2_backup
186+
- const: s5_p1_backup
187+
- const: s5_p2_backup
188+
- const: s6_p1_backup
189+
- const: s6_p2_backup
190+
- const: s7_p1_backup
191+
- const: s7_p2_backup
192+
- const: s8_p1_backup
193+
- const: s8_p2_backup
194+
- const: s9_p1_backup
195+
- const: s9_p2_backup
196+
- const: s10_p1_backup
197+
- const: s10_p2_backup
95198

96199
"#qcom,sensors":
97200
description:
@@ -220,6 +323,36 @@ examples:
220323
};
221324
};
222325
326+
- |
327+
#include <dt-bindings/interrupt-controller/arm-gic.h>
328+
// Example 1 (new calbiration data: for pre v1 IP):
329+
thermal-sensor@900000 {
330+
compatible = "qcom,msm8916-tsens", "qcom,tsens-v0_1";
331+
reg = <0x4a9000 0x1000>, /* TM */
332+
<0x4a8000 0x1000>; /* SROT */
333+
334+
nvmem-cells = <&tsens_mode>,
335+
<&tsens_base1>, <&tsens_base2>,
336+
<&tsens_s0_p1>, <&tsens_s0_p2>,
337+
<&tsens_s1_p1>, <&tsens_s1_p2>,
338+
<&tsens_s2_p1>, <&tsens_s2_p2>,
339+
<&tsens_s4_p1>, <&tsens_s4_p2>,
340+
<&tsens_s5_p1>, <&tsens_s5_p2>;
341+
nvmem-cell-names = "mode",
342+
"base1", "base2",
343+
"s0_p1", "s0_p2",
344+
"s1_p1", "s1_p2",
345+
"s2_p1", "s2_p2",
346+
"s4_p1", "s4_p2",
347+
"s5_p1", "s5_p2";
348+
349+
interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
350+
interrupt-names = "uplow";
351+
352+
#qcom,sensors = <5>;
353+
#thermal-sensor-cells = <1>;
354+
};
355+
223356
- |
224357
#include <dt-bindings/interrupt-controller/arm-gic.h>
225358
// Example 1 (legacy: for pre v1 IP):

drivers/thermal/armada_thermal.c

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -709,12 +709,10 @@ static int armada_thermal_probe_legacy(struct platform_device *pdev,
709709
struct armada_thermal_priv *priv)
710710
{
711711
struct armada_thermal_data *data = priv->data;
712-
struct resource *res;
713712
void __iomem *base;
714713

715714
/* First memory region points towards the status register */
716-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
717-
base = devm_ioremap_resource(&pdev->dev, res);
715+
base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
718716
if (IS_ERR(base))
719717
return PTR_ERR(base);
720718

@@ -784,34 +782,26 @@ static int armada_configure_overheat_int(struct armada_thermal_priv *priv,
784782
int sensor_id)
785783
{
786784
/* Retrieve the critical trip point to enable the overheat interrupt */
787-
struct thermal_trip trip;
785+
int temperature;
788786
int ret;
789-
int i;
790-
791-
for (i = 0; i < thermal_zone_get_num_trips(tz); i++) {
792-
793-
ret = thermal_zone_get_trip(tz, i, &trip);
794-
if (ret)
795-
return ret;
796-
797-
if (trip.type != THERMAL_TRIP_CRITICAL)
798-
continue;
799-
800-
ret = armada_select_channel(priv, sensor_id);
801-
if (ret)
802-
return ret;
803787

804-
armada_set_overheat_thresholds(priv, trip.temperature,
805-
trip.hysteresis);
806-
priv->overheat_sensor = tz;
807-
priv->interrupt_source = sensor_id;
788+
ret = thermal_zone_get_crit_temp(tz, &temperature);
789+
if (ret)
790+
return ret;
808791

809-
armada_enable_overheat_interrupt(priv);
792+
ret = armada_select_channel(priv, sensor_id);
793+
if (ret)
794+
return ret;
810795

811-
return 0;
812-
}
796+
/*
797+
* A critical temperature does not have a hysteresis
798+
*/
799+
armada_set_overheat_thresholds(priv, temperature, 0);
800+
priv->overheat_sensor = tz;
801+
priv->interrupt_source = sensor_id;
802+
armada_enable_overheat_interrupt(priv);
813803

814-
return -EINVAL;
804+
return 0;
815805
}
816806

817807
static int armada_thermal_probe(struct platform_device *pdev)

drivers/thermal/broadcom/bcm2835_thermal.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
167167
const struct of_device_id *match;
168168
struct thermal_zone_device *tz;
169169
struct bcm2835_thermal_data *data;
170-
struct resource *res;
171170
int err = 0;
172171
u32 val;
173172
unsigned long rate;
@@ -181,8 +180,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
181180
if (!match)
182181
return -EINVAL;
183182

184-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
185-
data->regs = devm_ioremap_resource(&pdev->dev, res);
183+
data->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
186184
if (IS_ERR(data->regs)) {
187185
err = PTR_ERR(data->regs);
188186
return err;

drivers/thermal/broadcom/brcmstb_thermal.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
321321
const struct thermal_zone_device_ops *of_ops;
322322
struct thermal_zone_device *thermal;
323323
struct brcmstb_thermal_priv *priv;
324-
struct resource *res;
325324
int irq, ret;
326325

327326
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -332,8 +331,7 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
332331
if (!priv->temp_params)
333332
return -EINVAL;
334333

335-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
336-
priv->tmon_base = devm_ioremap_resource(&pdev->dev, res);
334+
priv->tmon_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
337335
if (IS_ERR(priv->tmon_base))
338336
return PTR_ERR(priv->tmon_base);
339337

drivers/thermal/dove_thermal.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,17 @@ static int dove_thermal_probe(struct platform_device *pdev)
122122
{
123123
struct thermal_zone_device *thermal = NULL;
124124
struct dove_thermal_priv *priv;
125-
struct resource *res;
126125
int ret;
127126

128127
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
129128
if (!priv)
130129
return -ENOMEM;
131130

132-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
133-
priv->sensor = devm_ioremap_resource(&pdev->dev, res);
131+
priv->sensor = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
134132
if (IS_ERR(priv->sensor))
135133
return PTR_ERR(priv->sensor);
136134

137-
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
138-
priv->control = devm_ioremap_resource(&pdev->dev, res);
135+
priv->control = devm_platform_get_and_ioremap_resource(pdev, 1, NULL);
139136
if (IS_ERR(priv->control))
140137
return PTR_ERR(priv->control);
141138

drivers/thermal/imx_sc_thermal.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
8888
if (!resource_id)
8989
return -EINVAL;
9090

91-
for (i = 0; resource_id[i] > 0; i++) {
91+
for (i = 0; resource_id[i] >= 0; i++) {
9292

9393
sensor = devm_kzalloc(&pdev->dev, sizeof(*sensor), GFP_KERNEL);
9494
if (!sensor)
@@ -127,7 +127,11 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
127127
return 0;
128128
}
129129

130-
static int imx_sc_sensors[] = { IMX_SC_R_SYSTEM, IMX_SC_R_PMIC_0, -1 };
130+
static const int imx_sc_sensors[] = {
131+
IMX_SC_R_SYSTEM, IMX_SC_R_PMIC_0,
132+
IMX_SC_R_AP_0, IMX_SC_R_AP_1,
133+
IMX_SC_R_GPU_0_PID0, IMX_SC_R_GPU_1_PID0,
134+
IMX_SC_R_DRC_0, -1 };
131135

132136
static const struct of_device_id imx_sc_thermal_table[] = {
133137
{ .compatible = "fsl,imx-sc-thermal", .data = imx_sc_sensors },

drivers/thermal/kirkwood_thermal.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,13 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
6464
{
6565
struct thermal_zone_device *thermal = NULL;
6666
struct kirkwood_thermal_priv *priv;
67-
struct resource *res;
6867
int ret;
6968

7069
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
7170
if (!priv)
7271
return -ENOMEM;
7372

74-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
75-
priv->sensor = devm_ioremap_resource(&pdev->dev, res);
73+
priv->sensor = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
7674
if (IS_ERR(priv->sensor))
7775
return PTR_ERR(priv->sensor);
7876

0 commit comments

Comments
 (0)