Skip to content

Commit

Permalink
Merge tag 'thermal-v6.12-rc1' of ssh://gitolite.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/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
  • Loading branch information
Rafael J. Wysocki committed Sep 10, 2024
2 parents e3ee4ab + 7d8abc5 commit 3bc5ed1
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ properties:
clocks:
maxItems: 1

power-domains:
maxItems: 1

amlogic,ao-secure:
description: phandle to the ao-secure syscon
$ref: /schemas/types.yaml#/definitions/phandle
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ properties:
- qcom,msm8996-tsens
- qcom,msm8998-tsens
- qcom,qcm2290-tsens
- qcom,sa8255p-tsens
- qcom,sa8775p-tsens
- qcom,sc7180-tsens
- qcom,sc7280-tsens
Expand Down
2 changes: 1 addition & 1 deletion drivers/thermal/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ source "drivers/thermal/samsung/Kconfig"
endmenu

menu "STMicroelectronics thermal drivers"
depends on (ARCH_STI || ARCH_STM32) && OF
depends on (ARCH_STI || ARCH_STM32) && THERMAL_OF
source "drivers/thermal/st/Kconfig"
endmenu

Expand Down
15 changes: 6 additions & 9 deletions drivers/thermal/broadcom/brcmstb_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)

thermal = devm_thermal_of_zone_register(&pdev->dev, 0, priv,
of_ops);
if (IS_ERR(thermal)) {
ret = PTR_ERR(thermal);
dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
return ret;
}
if (IS_ERR(thermal))
return dev_err_probe(&pdev->dev, PTR_ERR(thermal),
"could not register sensor\n");

priv->thermal = thermal;

Expand All @@ -352,10 +350,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
brcmstb_tmon_irq_thread,
IRQF_ONESHOT,
DRV_NAME, priv);
if (ret < 0) {
dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
return ret;
}
if (ret < 0)
return dev_err_probe(&pdev->dev, ret,
"could not request IRQ\n");
}

dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
Expand Down
3 changes: 1 addition & 2 deletions drivers/thermal/imx_sc_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
if (ret == -ENODEV)
continue;

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

devm_thermal_add_hwmon_sysfs(&pdev->dev, sensor->tzd);
Expand Down
16 changes: 8 additions & 8 deletions drivers/thermal/imx_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ static void imx_thermal_remove(struct platform_device *pdev)
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);
int ret;
Expand All @@ -784,7 +784,7 @@ static int __maybe_unused imx_thermal_suspend(struct device *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);
int ret;
Expand All @@ -796,7 +796,7 @@ static int __maybe_unused imx_thermal_resume(struct device *dev)
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);
const struct thermal_soc_data *socdata = data->socdata;
Expand All @@ -818,7 +818,7 @@ static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev)
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);
const struct thermal_soc_data *socdata = data->socdata;
Expand Down Expand Up @@ -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 = {
SET_SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume)
SET_RUNTIME_PM_OPS(imx_thermal_runtime_suspend,
imx_thermal_runtime_resume, NULL)
SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume)
RUNTIME_PM_OPS(imx_thermal_runtime_suspend,
imx_thermal_runtime_resume, NULL)
};

static struct platform_driver imx_thermal = {
.driver = {
.name = "imx_thermal",
.pm = &imx_thermal_pm_ops,
.pm = pm_ptr(&imx_thermal_pm_ops),
.of_match_table = of_imx_thermal_match,
},
.probe = imx_thermal_probe,
Expand Down
10 changes: 5 additions & 5 deletions drivers/thermal/qoriq_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
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);
int ret;
Expand All @@ -361,7 +361,7 @@ static int __maybe_unused qoriq_tmu_suspend(struct device *dev)
return 0;
}

static int __maybe_unused qoriq_tmu_resume(struct device *dev)
static int qoriq_tmu_resume(struct device *dev)
{
int ret;
struct qoriq_tmu_data *data = dev_get_drvdata(dev);
Expand All @@ -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);
}

static SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
qoriq_tmu_suspend, qoriq_tmu_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
qoriq_tmu_suspend, qoriq_tmu_resume);

static const struct of_device_id qoriq_tmu_match[] = {
{ .compatible = "fsl,qoriq-tmu", },
Expand All @@ -387,7 +387,7 @@ MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
static struct platform_driver qoriq_tmu = {
.driver = {
.name = "qoriq_thermal",
.pm = &qoriq_tmu_pm_ops,
.pm = pm_sleep_ptr(&qoriq_tmu_pm_ops),
.of_match_table = qoriq_tmu_match,
},
.probe = qoriq_tmu_probe,
Expand Down
2 changes: 1 addition & 1 deletion drivers/thermal/renesas/rcar_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, irq, rcar_thermal_irq,
IRQF_SHARED, dev_name(dev), common);
if (ret) {
dev_err(dev, "irq request failed\n ");
dev_err(dev, "irq request failed\n");
goto error_unregister;
}

Expand Down
14 changes: 3 additions & 11 deletions drivers/thermal/sprd_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,21 +359,17 @@ static int sprd_thm_probe(struct platform_device *pdev)
return -EINVAL;
}

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

ret = clk_prepare_enable(thm->clk);
if (ret)
return ret;

sprd_thm_para_config(thm);

ret = sprd_thm_cal_read(np, "thm_sign_cal", &val);
if (ret)
goto disable_clk;
return ret;

if (val > 0)
thm->ratio_sign = -1;
Expand All @@ -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);
if (ret)
goto disable_clk;
return ret;

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

of_put:
of_node_put(sen_child);
disable_clk:
clk_disable_unprepare(thm->clk);
return ret;
}

Expand Down Expand Up @@ -526,8 +520,6 @@ static void sprd_thm_remove(struct platform_device *pdev)
devm_thermal_of_zone_unregister(&pdev->dev,
thm->sensor[i]->tzd);
}

clk_disable_unprepare(thm->clk);
}

static const struct of_device_id sprd_thermal_of_match[] = {
Expand Down
32 changes: 12 additions & 20 deletions drivers/thermal/st/st_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/of_device.h>

#include "st_thermal.h"
#include "../thermal_hwmon.h"

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

static struct thermal_trip trip;

int st_thermal_register(struct platform_device *pdev,
const struct of_device_id *st_thermal_of_match)
{
Expand All @@ -145,7 +144,6 @@ int st_thermal_register(struct platform_device *pdev,
struct device_node *np = dev->of_node;
const struct of_device_id *match;

int polling_delay;
int ret;

if (!np) {
Expand Down Expand Up @@ -197,29 +195,24 @@ int st_thermal_register(struct platform_device *pdev,
if (ret)
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 =
thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, sensor,
&st_tz_ops, NULL, 0, polling_delay);
devm_thermal_of_zone_register(dev, 0, sensor, &st_tz_ops);
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);
goto sensor_off;
}
ret = thermal_zone_device_enable(sensor->thermal_dev);
if (ret)
goto tzd_unregister;

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;

tzd_unregister:
thermal_zone_device_unregister(sensor->thermal_dev);
sensor_off:
st_thermal_sensor_off(sensor);

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

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);

#ifdef CONFIG_PM_SLEEP
static int st_thermal_suspend(struct device *dev)
{
struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
Expand Down Expand Up @@ -265,9 +258,8 @@ static int st_thermal_resume(struct device *dev)

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);

MODULE_AUTHOR("STMicroelectronics (R&D) Limited <ajitpal.singh@st.com>");
Expand Down
2 changes: 1 addition & 1 deletion drivers/thermal/st/st_thermal_memmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static void st_mmap_remove(struct platform_device *pdev)
static struct platform_driver st_mmap_thermal_driver = {
.driver = {
.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,
},
.probe = st_mmap_probe,
Expand Down
8 changes: 3 additions & 5 deletions drivers/thermal/st/stm_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor)
return ret;
}

#ifdef CONFIG_PM_SLEEP
static int stm_thermal_suspend(struct device *dev)
{
struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
Expand All @@ -466,10 +465,9 @@ static int stm_thermal_resume(struct device *dev)

return 0;
}
#endif /* CONFIG_PM_SLEEP */

static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
stm_thermal_suspend, stm_thermal_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
stm_thermal_suspend, stm_thermal_resume);

static const struct thermal_zone_device_ops stm_tz_ops = {
.get_temp = stm_thermal_get_temp,
Expand Down Expand Up @@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev)
static struct platform_driver stm_thermal_driver = {
.driver = {
.name = "stm_thermal",
.pm = &stm_thermal_pm_ops,
.pm = pm_sleep_ptr(&stm_thermal_pm_ops),
.of_match_table = stm_thermal_of_match,
},
.probe = stm_thermal_probe,
Expand Down
4 changes: 0 additions & 4 deletions drivers/thermal/ti-soc-thermal/ti-bandgap.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,6 @@ struct ti_bandgap_data {
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 *interval);
int ti_bandgap_write_update_interval(struct ti_bandgap *bgp, int id,
Expand Down

0 comments on commit 3bc5ed1

Please sign in to comment.