- 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)
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEGn3N4YVz0WNVyHskqDIjiipP6E8FAmba5PkACgkQqDIjiipP
 6E+8JQgAhaU8DhKMKHDG8sGPC6LSFIrssIZoGJ4T+POEEyHNRFP90f1c+tyO20st
 ScWi6jomj6EySotfs5X6MJzXhIABIw54OArL9sny0xUBC0Y1V008pjq3QJrMICbn
 HWz8OnEcpMh+3d/fsP82vjv59AJp3EJjmOjtg5rTEwNTI4ZkanM7zUoAykCf07Ui
 w3n4IO8Bu6GlU83FtLB72ePmXqggNN0a4pejGxb/vNSB5rwHBWxyBEQRJmcdg9Ic
 ZbFD2Hyr9tNxEJQzqlI6hoqPj25y4SeP61PkWM47S4zW3tXv0oicNFDXj8WJKzpo
 waOg0Q6Igen7hyC2XQzKQ7VSQF07gw==
 =+d7/
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Rafael J. Wysocki 2024-09-10 10:54:15 +02:00
commit 3bc5ed15bd
13 changed files with 45 additions and 67 deletions

View File

@ -32,6 +32,9 @@ properties:
clocks: clocks:
maxItems: 1 maxItems: 1
power-domains:
maxItems: 1
amlogic,ao-secure: amlogic,ao-secure:
description: phandle to the ao-secure syscon description: phandle to the ao-secure syscon
$ref: /schemas/types.yaml#/definitions/phandle $ref: /schemas/types.yaml#/definitions/phandle

View File

@ -51,6 +51,7 @@ properties:
- qcom,msm8996-tsens - qcom,msm8996-tsens
- qcom,msm8998-tsens - qcom,msm8998-tsens
- qcom,qcm2290-tsens - qcom,qcm2290-tsens
- qcom,sa8255p-tsens
- qcom,sa8775p-tsens - qcom,sa8775p-tsens
- qcom,sc7180-tsens - qcom,sc7180-tsens
- qcom,sc7280-tsens - qcom,sc7280-tsens

View File

@ -438,7 +438,7 @@ source "drivers/thermal/samsung/Kconfig"
endmenu endmenu
menu "STMicroelectronics thermal drivers" menu "STMicroelectronics thermal drivers"
depends on (ARCH_STI || ARCH_STM32) && OF depends on (ARCH_STI || ARCH_STM32) && THERMAL_OF
source "drivers/thermal/st/Kconfig" source "drivers/thermal/st/Kconfig"
endmenu endmenu

View File

@ -338,11 +338,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
thermal = devm_thermal_of_zone_register(&pdev->dev, 0, priv, thermal = devm_thermal_of_zone_register(&pdev->dev, 0, priv,
of_ops); of_ops);
if (IS_ERR(thermal)) { if (IS_ERR(thermal))
ret = PTR_ERR(thermal); return dev_err_probe(&pdev->dev, PTR_ERR(thermal),
dev_err(&pdev->dev, "could not register sensor: %d\n", ret); "could not register sensor\n");
return ret;
}
priv->thermal = thermal; priv->thermal = thermal;
@ -352,10 +350,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
brcmstb_tmon_irq_thread, brcmstb_tmon_irq_thread,
IRQF_ONESHOT, IRQF_ONESHOT,
DRV_NAME, priv); DRV_NAME, priv);
if (ret < 0) { if (ret < 0)
dev_err(&pdev->dev, "could not request IRQ: %d\n", ret); return dev_err_probe(&pdev->dev, ret,
return ret; "could not request IRQ\n");
}
} }
dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n"); dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");

View File

@ -111,8 +111,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
if (ret == -ENODEV) if (ret == -ENODEV)
continue; continue;
dev_err(&pdev->dev, "failed to register thermal zone\n"); return dev_err_probe(&pdev->dev, ret, "failed to register thermal zone\n");
return ret;
} }
devm_thermal_add_hwmon_sysfs(&pdev->dev, sensor->tzd); devm_thermal_add_hwmon_sysfs(&pdev->dev, sensor->tzd);

View File

@ -765,7 +765,7 @@ static void imx_thermal_remove(struct platform_device *pdev)
imx_thermal_unregister_legacy_cooling(data); imx_thermal_unregister_legacy_cooling(data);
} }
static int __maybe_unused imx_thermal_suspend(struct device *dev) static int imx_thermal_suspend(struct device *dev)
{ {
struct imx_thermal_data *data = dev_get_drvdata(dev); struct imx_thermal_data *data = dev_get_drvdata(dev);
int ret; int ret;
@ -784,7 +784,7 @@ static int __maybe_unused imx_thermal_suspend(struct device *dev)
return pm_runtime_force_suspend(data->dev); return pm_runtime_force_suspend(data->dev);
} }
static int __maybe_unused imx_thermal_resume(struct device *dev) static int imx_thermal_resume(struct device *dev)
{ {
struct imx_thermal_data *data = dev_get_drvdata(dev); struct imx_thermal_data *data = dev_get_drvdata(dev);
int ret; int ret;
@ -796,7 +796,7 @@ static int __maybe_unused imx_thermal_resume(struct device *dev)
return thermal_zone_device_enable(data->tz); return thermal_zone_device_enable(data->tz);
} }
static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev) static int imx_thermal_runtime_suspend(struct device *dev)
{ {
struct imx_thermal_data *data = dev_get_drvdata(dev); struct imx_thermal_data *data = dev_get_drvdata(dev);
const struct thermal_soc_data *socdata = data->socdata; const struct thermal_soc_data *socdata = data->socdata;
@ -818,7 +818,7 @@ static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev)
return 0; return 0;
} }
static int __maybe_unused imx_thermal_runtime_resume(struct device *dev) static int imx_thermal_runtime_resume(struct device *dev)
{ {
struct imx_thermal_data *data = dev_get_drvdata(dev); struct imx_thermal_data *data = dev_get_drvdata(dev);
const struct thermal_soc_data *socdata = data->socdata; const struct thermal_soc_data *socdata = data->socdata;
@ -849,15 +849,15 @@ static int __maybe_unused imx_thermal_runtime_resume(struct device *dev)
} }
static const struct dev_pm_ops imx_thermal_pm_ops = { static const struct dev_pm_ops imx_thermal_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume) SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume)
SET_RUNTIME_PM_OPS(imx_thermal_runtime_suspend, RUNTIME_PM_OPS(imx_thermal_runtime_suspend,
imx_thermal_runtime_resume, NULL) imx_thermal_runtime_resume, NULL)
}; };
static struct platform_driver imx_thermal = { static struct platform_driver imx_thermal = {
.driver = { .driver = {
.name = "imx_thermal", .name = "imx_thermal",
.pm = &imx_thermal_pm_ops, .pm = pm_ptr(&imx_thermal_pm_ops),
.of_match_table = of_imx_thermal_match, .of_match_table = of_imx_thermal_match,
}, },
.probe = imx_thermal_probe, .probe = imx_thermal_probe,

View File

@ -347,7 +347,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __maybe_unused qoriq_tmu_suspend(struct device *dev) static int qoriq_tmu_suspend(struct device *dev)
{ {
struct qoriq_tmu_data *data = dev_get_drvdata(dev); struct qoriq_tmu_data *data = dev_get_drvdata(dev);
int ret; int ret;
@ -361,7 +361,7 @@ static int __maybe_unused qoriq_tmu_suspend(struct device *dev)
return 0; return 0;
} }
static int __maybe_unused qoriq_tmu_resume(struct device *dev) static int qoriq_tmu_resume(struct device *dev)
{ {
int ret; int ret;
struct qoriq_tmu_data *data = dev_get_drvdata(dev); struct qoriq_tmu_data *data = dev_get_drvdata(dev);
@ -374,8 +374,8 @@ static int __maybe_unused qoriq_tmu_resume(struct device *dev)
return regmap_update_bits(data->regmap, REGS_TMR, TMR_ME, TMR_ME); return regmap_update_bits(data->regmap, REGS_TMR, TMR_ME, TMR_ME);
} }
static SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops, static DEFINE_SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
qoriq_tmu_suspend, qoriq_tmu_resume); qoriq_tmu_suspend, qoriq_tmu_resume);
static const struct of_device_id qoriq_tmu_match[] = { static const struct of_device_id qoriq_tmu_match[] = {
{ .compatible = "fsl,qoriq-tmu", }, { .compatible = "fsl,qoriq-tmu", },
@ -387,7 +387,7 @@ MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
static struct platform_driver qoriq_tmu = { static struct platform_driver qoriq_tmu = {
.driver = { .driver = {
.name = "qoriq_thermal", .name = "qoriq_thermal",
.pm = &qoriq_tmu_pm_ops, .pm = pm_sleep_ptr(&qoriq_tmu_pm_ops),
.of_match_table = qoriq_tmu_match, .of_match_table = qoriq_tmu_match,
}, },
.probe = qoriq_tmu_probe, .probe = qoriq_tmu_probe,

View File

@ -447,7 +447,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, irq, rcar_thermal_irq, ret = devm_request_irq(dev, irq, rcar_thermal_irq,
IRQF_SHARED, dev_name(dev), common); IRQF_SHARED, dev_name(dev), common);
if (ret) { if (ret) {
dev_err(dev, "irq request failed\n "); dev_err(dev, "irq request failed\n");
goto error_unregister; goto error_unregister;
} }

View File

@ -359,21 +359,17 @@ static int sprd_thm_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
thm->clk = devm_clk_get(&pdev->dev, "enable"); thm->clk = devm_clk_get_enabled(&pdev->dev, "enable");
if (IS_ERR(thm->clk)) { if (IS_ERR(thm->clk)) {
dev_err(&pdev->dev, "failed to get enable clock\n"); dev_err(&pdev->dev, "failed to get enable clock\n");
return PTR_ERR(thm->clk); return PTR_ERR(thm->clk);
} }
ret = clk_prepare_enable(thm->clk);
if (ret)
return ret;
sprd_thm_para_config(thm); sprd_thm_para_config(thm);
ret = sprd_thm_cal_read(np, "thm_sign_cal", &val); ret = sprd_thm_cal_read(np, "thm_sign_cal", &val);
if (ret) if (ret)
goto disable_clk; return ret;
if (val > 0) if (val > 0)
thm->ratio_sign = -1; thm->ratio_sign = -1;
@ -382,7 +378,7 @@ static int sprd_thm_probe(struct platform_device *pdev)
ret = sprd_thm_cal_read(np, "thm_ratio_cal", &thm->ratio_off); ret = sprd_thm_cal_read(np, "thm_ratio_cal", &thm->ratio_off);
if (ret) if (ret)
goto disable_clk; return ret;
for_each_child_of_node(np, sen_child) { for_each_child_of_node(np, sen_child) {
sen = devm_kzalloc(&pdev->dev, sizeof(*sen), GFP_KERNEL); sen = devm_kzalloc(&pdev->dev, sizeof(*sen), GFP_KERNEL);
@ -439,8 +435,6 @@ static int sprd_thm_probe(struct platform_device *pdev)
of_put: of_put:
of_node_put(sen_child); of_node_put(sen_child);
disable_clk:
clk_disable_unprepare(thm->clk);
return ret; return ret;
} }
@ -526,8 +520,6 @@ static void sprd_thm_remove(struct platform_device *pdev)
devm_thermal_of_zone_unregister(&pdev->dev, devm_thermal_of_zone_unregister(&pdev->dev,
thm->sensor[i]->tzd); thm->sensor[i]->tzd);
} }
clk_disable_unprepare(thm->clk);
} }
static const struct of_device_id sprd_thermal_of_match[] = { static const struct of_device_id sprd_thermal_of_match[] = {

View File

@ -12,6 +12,7 @@
#include <linux/of_device.h> #include <linux/of_device.h>
#include "st_thermal.h" #include "st_thermal.h"
#include "../thermal_hwmon.h"
/* The Thermal Framework expects millidegrees */ /* The Thermal Framework expects millidegrees */
#define mcelsius(temp) ((temp) * 1000) #define mcelsius(temp) ((temp) * 1000)
@ -135,8 +136,6 @@ static struct thermal_zone_device_ops st_tz_ops = {
.get_temp = st_thermal_get_temp, .get_temp = st_thermal_get_temp,
}; };
static struct thermal_trip trip;
int st_thermal_register(struct platform_device *pdev, int st_thermal_register(struct platform_device *pdev,
const struct of_device_id *st_thermal_of_match) const struct of_device_id *st_thermal_of_match)
{ {
@ -145,7 +144,6 @@ int st_thermal_register(struct platform_device *pdev,
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
const struct of_device_id *match; const struct of_device_id *match;
int polling_delay;
int ret; int ret;
if (!np) { if (!np) {
@ -197,29 +195,24 @@ int st_thermal_register(struct platform_device *pdev,
if (ret) if (ret)
goto sensor_off; goto sensor_off;
polling_delay = sensor->ops->register_enable_irq ? 0 : 1000;
trip.temperature = sensor->cdata->crit_temp;
trip.type = THERMAL_TRIP_CRITICAL;
sensor->thermal_dev = sensor->thermal_dev =
thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, sensor, devm_thermal_of_zone_register(dev, 0, sensor, &st_tz_ops);
&st_tz_ops, NULL, 0, polling_delay);
if (IS_ERR(sensor->thermal_dev)) { if (IS_ERR(sensor->thermal_dev)) {
dev_err(dev, "failed to register thermal zone device\n"); dev_err(dev, "failed to register thermal of zone\n");
ret = PTR_ERR(sensor->thermal_dev); ret = PTR_ERR(sensor->thermal_dev);
goto sensor_off; goto sensor_off;
} }
ret = thermal_zone_device_enable(sensor->thermal_dev);
if (ret)
goto tzd_unregister;
platform_set_drvdata(pdev, sensor); platform_set_drvdata(pdev, sensor);
/*
* devm_thermal_of_zone_register() doesn't enable hwmon by default
* Enable it here
*/
devm_thermal_add_hwmon_sysfs(dev, sensor->thermal_dev);
return 0; return 0;
tzd_unregister:
thermal_zone_device_unregister(sensor->thermal_dev);
sensor_off: sensor_off:
st_thermal_sensor_off(sensor); st_thermal_sensor_off(sensor);
@ -232,11 +225,11 @@ void st_thermal_unregister(struct platform_device *pdev)
struct st_thermal_sensor *sensor = platform_get_drvdata(pdev); struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
st_thermal_sensor_off(sensor); st_thermal_sensor_off(sensor);
thermal_zone_device_unregister(sensor->thermal_dev); thermal_remove_hwmon_sysfs(sensor->thermal_dev);
devm_thermal_of_zone_unregister(sensor->dev, sensor->thermal_dev);
} }
EXPORT_SYMBOL_GPL(st_thermal_unregister); EXPORT_SYMBOL_GPL(st_thermal_unregister);
#ifdef CONFIG_PM_SLEEP
static int st_thermal_suspend(struct device *dev) static int st_thermal_suspend(struct device *dev)
{ {
struct st_thermal_sensor *sensor = dev_get_drvdata(dev); struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
@ -265,9 +258,8 @@ static int st_thermal_resume(struct device *dev)
return 0; return 0;
} }
#endif
SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); DEFINE_SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
EXPORT_SYMBOL_GPL(st_thermal_pm_ops); EXPORT_SYMBOL_GPL(st_thermal_pm_ops);
MODULE_AUTHOR("STMicroelectronics (R&D) Limited <ajitpal.singh@st.com>"); MODULE_AUTHOR("STMicroelectronics (R&D) Limited <ajitpal.singh@st.com>");

View File

@ -170,7 +170,7 @@ static void st_mmap_remove(struct platform_device *pdev)
static struct platform_driver st_mmap_thermal_driver = { static struct platform_driver st_mmap_thermal_driver = {
.driver = { .driver = {
.name = "st_thermal_mmap", .name = "st_thermal_mmap",
.pm = &st_thermal_pm_ops, .pm = pm_sleep_ptr(&st_thermal_pm_ops),
.of_match_table = st_mmap_thermal_of_match, .of_match_table = st_mmap_thermal_of_match,
}, },
.probe = st_mmap_probe, .probe = st_mmap_probe,

View File

@ -440,7 +440,6 @@ thermal_unprepare:
return ret; return ret;
} }
#ifdef CONFIG_PM_SLEEP
static int stm_thermal_suspend(struct device *dev) static int stm_thermal_suspend(struct device *dev)
{ {
struct stm_thermal_sensor *sensor = dev_get_drvdata(dev); struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
@ -466,10 +465,9 @@ static int stm_thermal_resume(struct device *dev)
return 0; return 0;
} }
#endif /* CONFIG_PM_SLEEP */
static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops, static DEFINE_SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
stm_thermal_suspend, stm_thermal_resume); stm_thermal_suspend, stm_thermal_resume);
static const struct thermal_zone_device_ops stm_tz_ops = { static const struct thermal_zone_device_ops stm_tz_ops = {
.get_temp = stm_thermal_get_temp, .get_temp = stm_thermal_get_temp,
@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev)
static struct platform_driver stm_thermal_driver = { static struct platform_driver stm_thermal_driver = {
.driver = { .driver = {
.name = "stm_thermal", .name = "stm_thermal",
.pm = &stm_thermal_pm_ops, .pm = pm_sleep_ptr(&stm_thermal_pm_ops),
.of_match_table = stm_thermal_of_match, .of_match_table = stm_thermal_of_match,
}, },
.probe = stm_thermal_probe, .probe = stm_thermal_probe,

View File

@ -336,10 +336,6 @@ struct ti_bandgap_data {
struct ti_temp_sensor sensors[]; struct ti_temp_sensor sensors[];
}; };
int ti_bandgap_read_thot(struct ti_bandgap *bgp, int id, int *thot);
int ti_bandgap_write_thot(struct ti_bandgap *bgp, int id, int val);
int ti_bandgap_read_tcold(struct ti_bandgap *bgp, int id, int *tcold);
int ti_bandgap_write_tcold(struct ti_bandgap *bgp, int id, int val);
int ti_bandgap_read_update_interval(struct ti_bandgap *bgp, int id, int ti_bandgap_read_update_interval(struct ti_bandgap *bgp, int id,
int *interval); int *interval);
int ti_bandgap_write_update_interval(struct ti_bandgap *bgp, int id, int ti_bandgap_write_update_interval(struct ti_bandgap *bgp, int id,