Skip to content

Commit cd1a3b2

Browse files
committed
Merge tag 'thermal-v7.1-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux
Merge updates of assorted thermal drivers for 7.1-rc1 from Daniel Lezcano: "- Added an OF node address to output message to make sensor names more distinguishable (Alexander Stein) - Added hwmon support for the i.MX97 thermal sensor (Alexander Stein) - Clamped correctly the results when doing value/temperature conversion in the Spreadtrum driver (Thorsten Blum) - Added the SDM670 compatible DT bindings for the Tsens and the lMH drivers (Richard Acayan) - Added the SM8750 compatible DT bindings for the Tsens (Manaf Meethalavalappu Pallikunhi) - Added the Eliza SoC compatible DT bindings for the Tsens (Krzysztof Kozlowski) - Fixed inverted condition check on error in the Spear driver (Gopi Krishna Menon) - Converted the DT bindings documentation into DT schema (Gopi Krishna Menon) - Used max() macro to increase readibility in the Broadcom STB thermal sensor (Thorsten Blum) - Removed stale @trim_offset kernel-doc entry (John Madieu)" * tag 'thermal-v7.1-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: thermal: renesas: rzg3e: Remove stale @trim_offset kernel-doc entry thermal/drivers/brcmstb_thermal: Use max to simplify brcmstb_get_temp dt-bindings: thermal: st,thermal-spear1340: convert to dtschema thermal/drivers/spear: Fix error condition for reading st,thermal-flags dt-bindings: thermal: qcom-tsens: Add Eliza SoC TSENS dt-bindings: thermal: qcom-tsens: Document the SM8750 Temperature Sensor thermal/drivers/sprd: Use min instead of clamp in sprd_thm_temp_to_rawdata dt-bindings: thermal: lmh: Add SDM670 compatible dt-bindings: thermal: tsens: add SDM670 compatible thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp thermal/drivers/sprd: Fix temperature clamping in sprd_thm_temp_to_rawdata thermal/drivers/imx91: Add hwmon support thermal/of: Add OF node address to output message
2 parents ecc26ba + bf746e2 commit cd1a3b2

10 files changed

Lines changed: 63 additions & 34 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ properties:
2222
- qcom,sc8180x-lmh
2323
- qcom,sdm845-lmh
2424
- qcom,sm8150-lmh
25+
- items:
26+
- const: qcom,sdm670-lmh
27+
- const: qcom,sdm845-lmh
2528
- items:
2629
- const: qcom,qcm2290-lmh
2730
- const: qcom,sm8150-lmh

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ properties:
5454
- description: v2 of TSENS
5555
items:
5656
- enum:
57+
- qcom,eliza-tsens
5758
- qcom,glymur-tsens
5859
- qcom,kaanapali-tsens
5960
- qcom,milos-tsens
@@ -71,6 +72,7 @@ properties:
7172
- qcom,sc8180x-tsens
7273
- qcom,sc8280xp-tsens
7374
- qcom,sdm630-tsens
75+
- qcom,sdm670-tsens
7476
- qcom,sdm845-tsens
7577
- qcom,sm6115-tsens
7678
- qcom,sm6350-tsens
@@ -81,6 +83,7 @@ properties:
8183
- qcom,sm8450-tsens
8284
- qcom,sm8550-tsens
8385
- qcom,sm8650-tsens
86+
- qcom,sm8750-tsens
8487
- qcom,x1e80100-tsens
8588
- const: qcom,tsens-v2
8689

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

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/thermal/st,thermal-spear1340.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: SPEAr Thermal Sensor
8+
9+
maintainers:
10+
- Viresh Kumar <vireshk@kernel.org>
11+
12+
properties:
13+
compatible:
14+
const: st,thermal-spear1340
15+
16+
reg:
17+
maxItems: 1
18+
19+
st,thermal-flags:
20+
description: flags used to enable thermal sensor
21+
$ref: /schemas/types.yaml#/definitions/uint32
22+
23+
required:
24+
- compatible
25+
- reg
26+
- st,thermal-flags
27+
28+
additionalProperties: false
29+
30+
examples:
31+
- |
32+
thermal@fc000000 {
33+
compatible = "st,thermal-spear1340";
34+
reg = <0xfc000000 0x1000>;
35+
st,thermal-flags = <0x7000>;
36+
};

drivers/thermal/broadcom/brcmstb_thermal.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/irqreturn.h>
1717
#include <linux/interrupt.h>
1818
#include <linux/kernel.h>
19+
#include <linux/minmax.h>
1920
#include <linux/module.h>
2021
#include <linux/of.h>
2122
#include <linux/platform_device.h>
@@ -154,7 +155,7 @@ static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp)
154155
{
155156
struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz);
156157
u32 val;
157-
long t;
158+
int t;
158159

159160
val = __raw_readl(priv->tmon_base + AVS_TMON_STATUS);
160161

@@ -164,10 +165,7 @@ static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp)
164165
val = (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift;
165166

166167
t = avs_tmon_code_to_temp(priv, val);
167-
if (t < 0)
168-
*temp = 0;
169-
else
170-
*temp = t;
168+
*temp = max(0, t);
171169

172170
return 0;
173171
}

drivers/thermal/imx91_thermal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <linux/thermal.h>
1818
#include <linux/units.h>
1919

20+
#include "thermal_hwmon.h"
21+
2022
#define REG_SET 0x4
2123
#define REG_CLR 0x8
2224
#define REG_TOG 0xc
@@ -318,6 +320,8 @@ static int imx91_tmu_probe(struct platform_device *pdev)
318320
return dev_err_probe(dev, PTR_ERR(tmu->tzd),
319321
"failed to register thermal zone sensor\n");
320322

323+
devm_thermal_add_hwmon_sysfs(dev, tmu->tzd);
324+
321325
irq = platform_get_irq(pdev, 0);
322326
if (irq < 0)
323327
return irq;

drivers/thermal/renesas/rzg3e_thermal.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ struct rzg3e_thermal_info {
9393
* @info: chip type specific information
9494
* @trmval0: calibration value 0 (b)
9595
* @trmval1: calibration value 1 (c)
96-
* @trim_offset: offset for trim registers in syscon
9796
* @lock: protects hardware access during conversions
9897
*/
9998
struct rzg3e_thermal_priv {

drivers/thermal/spear_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
9393
struct device_node *np = pdev->dev.of_node;
9494
int ret = 0, val;
9595

96-
if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) {
96+
if (!np || of_property_read_u32(np, "st,thermal-flags", &val)) {
9797
dev_err(&pdev->dev, "Failed: DT Pdata not passed\n");
9898
return -EINVAL;
9999
}

drivers/thermal/sprd_thermal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int sprd_thm_sensor_calibration(struct device_node *np,
178178
static int sprd_thm_rawdata_to_temp(struct sprd_thermal_sensor *sen,
179179
u32 rawdata)
180180
{
181-
clamp(rawdata, (u32)SPRD_THM_RAW_DATA_LOW, (u32)SPRD_THM_RAW_DATA_HIGH);
181+
rawdata = clamp(rawdata, SPRD_THM_RAW_DATA_LOW, SPRD_THM_RAW_DATA_HIGH);
182182

183183
/*
184184
* According to the thermal datasheet, the formula of converting
@@ -192,7 +192,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen)
192192
{
193193
u32 val;
194194

195-
clamp(temp, (int)SPRD_THM_TEMP_LOW, (int)SPRD_THM_TEMP_HIGH);
195+
temp = clamp(temp, SPRD_THM_TEMP_LOW, SPRD_THM_TEMP_HIGH);
196196

197197
/*
198198
* According to the thermal datasheet, the formula of converting
@@ -201,7 +201,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen)
201201
*/
202202
val = (temp + sen->cal_offset) / sen->cal_slope;
203203

204-
return clamp(val, val, (u32)(SPRD_THM_RAW_DATA_HIGH - 1));
204+
return min(val, SPRD_THM_RAW_DATA_HIGH - 1);
205205
}
206206

207207
static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp)

drivers/thermal/thermal_of.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
144144
count = of_count_phandle_with_args(child, "thermal-sensors",
145145
"#thermal-sensor-cells");
146146
if (count <= 0) {
147-
pr_err("%pOFn: missing thermal sensor\n", child);
147+
pr_err("%pOFP: missing thermal sensor\n", child);
148148
return ERR_PTR(-EINVAL);
149149
}
150150

@@ -156,14 +156,14 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
156156
"#thermal-sensor-cells",
157157
i, &sensor_specs);
158158
if (ret < 0) {
159-
pr_err("%pOFn: Failed to read thermal-sensors cells: %d\n", child, ret);
159+
pr_err("%pOFP: Failed to read thermal-sensors cells: %d\n", child, ret);
160160
return ERR_PTR(ret);
161161
}
162162

163163
of_node_put(sensor_specs.np);
164164
if ((sensor == sensor_specs.np) && id == (sensor_specs.args_count ?
165165
sensor_specs.args[0] : 0)) {
166-
pr_debug("sensor %pOFn id=%d belongs to %pOFn\n", sensor, id, child);
166+
pr_debug("sensor %pOFP id=%d belongs to %pOFP\n", sensor, id, child);
167167
return no_free_ptr(child);
168168
}
169169
}
@@ -180,15 +180,15 @@ static int thermal_of_monitor_init(struct device_node *np, int *delay, int *pdel
180180
if (ret == -EINVAL) {
181181
*pdelay = 0;
182182
} else if (ret < 0) {
183-
pr_err("%pOFn: Couldn't get polling-delay-passive: %d\n", np, ret);
183+
pr_err("%pOFP: Couldn't get polling-delay-passive: %d\n", np, ret);
184184
return ret;
185185
}
186186

187187
ret = of_property_read_u32(np, "polling-delay", delay);
188188
if (ret == -EINVAL) {
189189
*delay = 0;
190190
} else if (ret < 0) {
191-
pr_err("%pOFn: Couldn't get polling-delay: %d\n", np, ret);
191+
pr_err("%pOFP: Couldn't get polling-delay: %d\n", np, ret);
192192
return ret;
193193
}
194194

@@ -380,23 +380,23 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
380380
np = of_thermal_zone_find(sensor, id);
381381
if (IS_ERR(np)) {
382382
if (PTR_ERR(np) != -ENODEV)
383-
pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id);
383+
pr_err("Failed to find thermal zone for %pOFP id=%d\n", sensor, id);
384384
return ERR_CAST(np);
385385
}
386386

387387
trips = thermal_of_trips_init(np, &ntrips);
388388
if (IS_ERR(trips)) {
389-
pr_err("Failed to parse trip points for %pOFn id=%d\n", sensor, id);
389+
pr_err("Failed to parse trip points for %pOFP id=%d\n", sensor, id);
390390
ret = PTR_ERR(trips);
391391
goto out_of_node_put;
392392
}
393393

394394
if (!trips)
395-
pr_info("No trip points found for %pOFn id=%d\n", sensor, id);
395+
pr_info("No trip points found for %pOFP id=%d\n", sensor, id);
396396

397397
ret = thermal_of_monitor_init(np, &delay, &pdelay);
398398
if (ret) {
399-
pr_err("Failed to initialize monitoring delays from %pOFn\n", np);
399+
pr_err("Failed to initialize monitoring delays from %pOFP\n", np);
400400
goto out_kfree_trips;
401401
}
402402

@@ -417,7 +417,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
417417
pdelay, delay);
418418
if (IS_ERR(tz)) {
419419
ret = PTR_ERR(tz);
420-
pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret);
420+
pr_err("Failed to register thermal zone %pOFP: %d\n", np, ret);
421421
goto out_kfree_trips;
422422
}
423423

0 commit comments

Comments
 (0)