Skip to content

Commit 3bc5ed1

Browse files
committed
Merge tag 'thermal-v6.12-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux into
Merge thermal drivers changes for v6.12-rc1 from Daniel Lezcano: "- Add power domain DT bindings for new Amlogic SoCs (Georges Stark) - Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() in the ST driver and add a Kconfig dependency on THERMAL_OF subsystem for the STi driver (Raphael Gallais-Pou) - Simplify with dev_err_probe() the error code path in the probe functions for the brcmstb driver (Yan Zhen) - Remove trailing space after \n newline in the Renesas driver (Colin Ian King) - Add DT binding compatible string for the SA8255p with the tsens driver (Nikunj Kela) - Use the devm_clk_get_enabled() helpers to simplify the init routine in the sprd driver (Huan Yang) - Remove __maybe_unused notations for the functions by using the new RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() macros on the IMx and Qoriq drivers (Fabio Estevam) - Remove unused declarations in the header file as the functions were removed in a previous change on the ti-soc-thermal driver (Zhang Zekun) - Simplify with dev_err_probe() the error code path in the probe functions for the imx_sc_thermal driver (Alexander Stein)" * tag 'thermal-v6.12-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: thermal/drivers/imx_sc_thermal: Use dev_err_probe thermal/drivers/ti-soc-thermal: Remove unused declarations thermal/drivers/imx: Remove __maybe_unused notations thermal/drivers/qoriq: Remove __maybe_unused notations thermal/drivers/sprd: Use devm_clk_get_enabled() helpers dt-bindings: thermal: tsens: document support on SA8255p thermal/drivers/renesas: Remove trailing space after \n newline thermal/drivers/brcmstb_thermal: Simplify with dev_err_probe() thermal/drivers/sti: Depend on THERMAL_OF subsystem thermal/drivers/st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() dt-bindings: thermal: amlogic,thermal: add optional power-domains
2 parents e3ee4ab + 7d8abc5 commit 3bc5ed1

File tree

13 files changed

+45
-67
lines changed

13 files changed

+45
-67
lines changed

Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ properties:
3232
clocks:
3333
maxItems: 1
3434

35+
power-domains:
36+
maxItems: 1
37+
3538
amlogic,ao-secure:
3639
description: phandle to the ao-secure syscon
3740
$ref: /schemas/types.yaml#/definitions/phandle

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ properties:
5151
- qcom,msm8996-tsens
5252
- qcom,msm8998-tsens
5353
- qcom,qcm2290-tsens
54+
- qcom,sa8255p-tsens
5455
- qcom,sa8775p-tsens
5556
- qcom,sc7180-tsens
5657
- qcom,sc7280-tsens

drivers/thermal/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ source "drivers/thermal/samsung/Kconfig"
438438
endmenu
439439

440440
menu "STMicroelectronics thermal drivers"
441-
depends on (ARCH_STI || ARCH_STM32) && OF
441+
depends on (ARCH_STI || ARCH_STM32) && THERMAL_OF
442442
source "drivers/thermal/st/Kconfig"
443443
endmenu
444444

drivers/thermal/broadcom/brcmstb_thermal.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
338338

339339
thermal = devm_thermal_of_zone_register(&pdev->dev, 0, priv,
340340
of_ops);
341-
if (IS_ERR(thermal)) {
342-
ret = PTR_ERR(thermal);
343-
dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
344-
return ret;
345-
}
341+
if (IS_ERR(thermal))
342+
return dev_err_probe(&pdev->dev, PTR_ERR(thermal),
343+
"could not register sensor\n");
346344

347345
priv->thermal = thermal;
348346

@@ -352,10 +350,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
352350
brcmstb_tmon_irq_thread,
353351
IRQF_ONESHOT,
354352
DRV_NAME, priv);
355-
if (ret < 0) {
356-
dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
357-
return ret;
358-
}
353+
if (ret < 0)
354+
return dev_err_probe(&pdev->dev, ret,
355+
"could not request IRQ\n");
359356
}
360357

361358
dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");

drivers/thermal/imx_sc_thermal.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
111111
if (ret == -ENODEV)
112112
continue;
113113

114-
dev_err(&pdev->dev, "failed to register thermal zone\n");
115-
return ret;
114+
return dev_err_probe(&pdev->dev, ret, "failed to register thermal zone\n");
116115
}
117116

118117
devm_thermal_add_hwmon_sysfs(&pdev->dev, sensor->tzd);

drivers/thermal/imx_thermal.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ static void imx_thermal_remove(struct platform_device *pdev)
765765
imx_thermal_unregister_legacy_cooling(data);
766766
}
767767

768-
static int __maybe_unused imx_thermal_suspend(struct device *dev)
768+
static int imx_thermal_suspend(struct device *dev)
769769
{
770770
struct imx_thermal_data *data = dev_get_drvdata(dev);
771771
int ret;
@@ -784,7 +784,7 @@ static int __maybe_unused imx_thermal_suspend(struct device *dev)
784784
return pm_runtime_force_suspend(data->dev);
785785
}
786786

787-
static int __maybe_unused imx_thermal_resume(struct device *dev)
787+
static int imx_thermal_resume(struct device *dev)
788788
{
789789
struct imx_thermal_data *data = dev_get_drvdata(dev);
790790
int ret;
@@ -796,7 +796,7 @@ static int __maybe_unused imx_thermal_resume(struct device *dev)
796796
return thermal_zone_device_enable(data->tz);
797797
}
798798

799-
static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev)
799+
static int imx_thermal_runtime_suspend(struct device *dev)
800800
{
801801
struct imx_thermal_data *data = dev_get_drvdata(dev);
802802
const struct thermal_soc_data *socdata = data->socdata;
@@ -818,7 +818,7 @@ static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev)
818818
return 0;
819819
}
820820

821-
static int __maybe_unused imx_thermal_runtime_resume(struct device *dev)
821+
static int imx_thermal_runtime_resume(struct device *dev)
822822
{
823823
struct imx_thermal_data *data = dev_get_drvdata(dev);
824824
const struct thermal_soc_data *socdata = data->socdata;
@@ -849,15 +849,15 @@ static int __maybe_unused imx_thermal_runtime_resume(struct device *dev)
849849
}
850850

851851
static const struct dev_pm_ops imx_thermal_pm_ops = {
852-
SET_SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume)
853-
SET_RUNTIME_PM_OPS(imx_thermal_runtime_suspend,
854-
imx_thermal_runtime_resume, NULL)
852+
SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume)
853+
RUNTIME_PM_OPS(imx_thermal_runtime_suspend,
854+
imx_thermal_runtime_resume, NULL)
855855
};
856856

857857
static struct platform_driver imx_thermal = {
858858
.driver = {
859859
.name = "imx_thermal",
860-
.pm = &imx_thermal_pm_ops,
860+
.pm = pm_ptr(&imx_thermal_pm_ops),
861861
.of_match_table = of_imx_thermal_match,
862862
},
863863
.probe = imx_thermal_probe,

drivers/thermal/qoriq_thermal.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
347347
return 0;
348348
}
349349

350-
static int __maybe_unused qoriq_tmu_suspend(struct device *dev)
350+
static int qoriq_tmu_suspend(struct device *dev)
351351
{
352352
struct qoriq_tmu_data *data = dev_get_drvdata(dev);
353353
int ret;
@@ -361,7 +361,7 @@ static int __maybe_unused qoriq_tmu_suspend(struct device *dev)
361361
return 0;
362362
}
363363

364-
static int __maybe_unused qoriq_tmu_resume(struct device *dev)
364+
static int qoriq_tmu_resume(struct device *dev)
365365
{
366366
int ret;
367367
struct qoriq_tmu_data *data = dev_get_drvdata(dev);
@@ -374,8 +374,8 @@ static int __maybe_unused qoriq_tmu_resume(struct device *dev)
374374
return regmap_update_bits(data->regmap, REGS_TMR, TMR_ME, TMR_ME);
375375
}
376376

377-
static SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
378-
qoriq_tmu_suspend, qoriq_tmu_resume);
377+
static DEFINE_SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
378+
qoriq_tmu_suspend, qoriq_tmu_resume);
379379

380380
static const struct of_device_id qoriq_tmu_match[] = {
381381
{ .compatible = "fsl,qoriq-tmu", },
@@ -387,7 +387,7 @@ MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
387387
static struct platform_driver qoriq_tmu = {
388388
.driver = {
389389
.name = "qoriq_thermal",
390-
.pm = &qoriq_tmu_pm_ops,
390+
.pm = pm_sleep_ptr(&qoriq_tmu_pm_ops),
391391
.of_match_table = qoriq_tmu_match,
392392
},
393393
.probe = qoriq_tmu_probe,

drivers/thermal/renesas/rcar_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
447447
ret = devm_request_irq(dev, irq, rcar_thermal_irq,
448448
IRQF_SHARED, dev_name(dev), common);
449449
if (ret) {
450-
dev_err(dev, "irq request failed\n ");
450+
dev_err(dev, "irq request failed\n");
451451
goto error_unregister;
452452
}
453453

drivers/thermal/sprd_thermal.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -359,21 +359,17 @@ static int sprd_thm_probe(struct platform_device *pdev)
359359
return -EINVAL;
360360
}
361361

362-
thm->clk = devm_clk_get(&pdev->dev, "enable");
362+
thm->clk = devm_clk_get_enabled(&pdev->dev, "enable");
363363
if (IS_ERR(thm->clk)) {
364364
dev_err(&pdev->dev, "failed to get enable clock\n");
365365
return PTR_ERR(thm->clk);
366366
}
367367

368-
ret = clk_prepare_enable(thm->clk);
369-
if (ret)
370-
return ret;
371-
372368
sprd_thm_para_config(thm);
373369

374370
ret = sprd_thm_cal_read(np, "thm_sign_cal", &val);
375371
if (ret)
376-
goto disable_clk;
372+
return ret;
377373

378374
if (val > 0)
379375
thm->ratio_sign = -1;
@@ -382,7 +378,7 @@ static int sprd_thm_probe(struct platform_device *pdev)
382378

383379
ret = sprd_thm_cal_read(np, "thm_ratio_cal", &thm->ratio_off);
384380
if (ret)
385-
goto disable_clk;
381+
return ret;
386382

387383
for_each_child_of_node(np, sen_child) {
388384
sen = devm_kzalloc(&pdev->dev, sizeof(*sen), GFP_KERNEL);
@@ -439,8 +435,6 @@ static int sprd_thm_probe(struct platform_device *pdev)
439435

440436
of_put:
441437
of_node_put(sen_child);
442-
disable_clk:
443-
clk_disable_unprepare(thm->clk);
444438
return ret;
445439
}
446440

@@ -526,8 +520,6 @@ static void sprd_thm_remove(struct platform_device *pdev)
526520
devm_thermal_of_zone_unregister(&pdev->dev,
527521
thm->sensor[i]->tzd);
528522
}
529-
530-
clk_disable_unprepare(thm->clk);
531523
}
532524

533525
static const struct of_device_id sprd_thermal_of_match[] = {

drivers/thermal/st/st_thermal.c

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/of_device.h>
1313

1414
#include "st_thermal.h"
15+
#include "../thermal_hwmon.h"
1516

1617
/* The Thermal Framework expects millidegrees */
1718
#define mcelsius(temp) ((temp) * 1000)
@@ -135,8 +136,6 @@ static struct thermal_zone_device_ops st_tz_ops = {
135136
.get_temp = st_thermal_get_temp,
136137
};
137138

138-
static struct thermal_trip trip;
139-
140139
int st_thermal_register(struct platform_device *pdev,
141140
const struct of_device_id *st_thermal_of_match)
142141
{
@@ -145,7 +144,6 @@ int st_thermal_register(struct platform_device *pdev,
145144
struct device_node *np = dev->of_node;
146145
const struct of_device_id *match;
147146

148-
int polling_delay;
149147
int ret;
150148

151149
if (!np) {
@@ -197,29 +195,24 @@ int st_thermal_register(struct platform_device *pdev,
197195
if (ret)
198196
goto sensor_off;
199197

200-
polling_delay = sensor->ops->register_enable_irq ? 0 : 1000;
201-
202-
trip.temperature = sensor->cdata->crit_temp;
203-
trip.type = THERMAL_TRIP_CRITICAL;
204-
205198
sensor->thermal_dev =
206-
thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, sensor,
207-
&st_tz_ops, NULL, 0, polling_delay);
199+
devm_thermal_of_zone_register(dev, 0, sensor, &st_tz_ops);
208200
if (IS_ERR(sensor->thermal_dev)) {
209-
dev_err(dev, "failed to register thermal zone device\n");
201+
dev_err(dev, "failed to register thermal of zone\n");
210202
ret = PTR_ERR(sensor->thermal_dev);
211203
goto sensor_off;
212204
}
213-
ret = thermal_zone_device_enable(sensor->thermal_dev);
214-
if (ret)
215-
goto tzd_unregister;
216205

217206
platform_set_drvdata(pdev, sensor);
218207

208+
/*
209+
* devm_thermal_of_zone_register() doesn't enable hwmon by default
210+
* Enable it here
211+
*/
212+
devm_thermal_add_hwmon_sysfs(dev, sensor->thermal_dev);
213+
219214
return 0;
220215

221-
tzd_unregister:
222-
thermal_zone_device_unregister(sensor->thermal_dev);
223216
sensor_off:
224217
st_thermal_sensor_off(sensor);
225218

@@ -232,11 +225,11 @@ void st_thermal_unregister(struct platform_device *pdev)
232225
struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
233226

234227
st_thermal_sensor_off(sensor);
235-
thermal_zone_device_unregister(sensor->thermal_dev);
228+
thermal_remove_hwmon_sysfs(sensor->thermal_dev);
229+
devm_thermal_of_zone_unregister(sensor->dev, sensor->thermal_dev);
236230
}
237231
EXPORT_SYMBOL_GPL(st_thermal_unregister);
238232

239-
#ifdef CONFIG_PM_SLEEP
240233
static int st_thermal_suspend(struct device *dev)
241234
{
242235
struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
@@ -265,9 +258,8 @@ static int st_thermal_resume(struct device *dev)
265258

266259
return 0;
267260
}
268-
#endif
269261

270-
SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
262+
DEFINE_SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
271263
EXPORT_SYMBOL_GPL(st_thermal_pm_ops);
272264

273265
MODULE_AUTHOR("STMicroelectronics (R&D) Limited <[email protected]>");

0 commit comments

Comments
 (0)