[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdUDKFRsZWsZG9DY4PHdxQEDoPqzfeRx8MNTreOpxdLvpw@mail.gmail.com>
Date: Wed, 22 Jan 2025 11:29:19 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Claudiu <claudiu.beznea@...on.dev>
Cc: rafael@...nel.org, daniel.lezcano@...aro.org, rui.zhang@...el.com,
lukasz.luba@....com, robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
magnus.damm@...il.com, mturquette@...libre.com, sboyd@...nel.org,
p.zabel@...gutronix.de, ulf.hansson@...aro.org, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-clk@...r.kernel.org, Claudiu Beznea <claudiu.beznea.uj@...renesas.com>,
"open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@...r.kernel.org>
Subject: Re: [PATCH 4/6] thermal: renesas: rzg3s: Add thermal driver for the
Renesas RZ/G3S SoC
Hi Claudiu,
CC iio
On Fri, Jan 3, 2025 at 5:38 PM Claudiu <claudiu.beznea@...on.dev> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
>
> The Renesas RZ/G3S SoC features a Thermal Sensor Unit (TSU) that reports
> the junction temperature. The temperature is reported through a dedicated
> ADC channel. Add a driver for the Renesas RZ/G3S TSU.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
Thanks for your patch!
> --- /dev/null
> +++ b/drivers/thermal/renesas/rzg3s_thermal.c
> +static int rzg3s_thermal_probe(struct platform_device *pdev)
> +{
> + struct rzg3s_thermal_priv *priv;
> + struct device *dev = &pdev->dev;
> + int ret;
> +
> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(priv->base))
> + return PTR_ERR(priv->base);
> +
> + priv->channel = devm_iio_channel_get(dev, "tsu");
Given there's only a single IIO channel, you could pass NULL instead
of the name, and drop "io-channel-names" from the DT bindings.
I don't know what's the IIO policy w.r.t. unnamed channels, though.
> + if (IS_ERR(priv->channel))
> + return dev_err_probe(dev, PTR_ERR(priv->channel), "Failed to get IIO channel!\n");
> +
> + priv->rstc = devm_reset_control_get_exclusive_deasserted(dev, NULL);
> + if (IS_ERR(priv->rstc))
> + return dev_err_probe(dev, PTR_ERR(priv->rstc), "Failed to get reset!\n");
> +
> + priv->dev = dev;
> + priv->mode = THERMAL_DEVICE_DISABLED;
> + platform_set_drvdata(pdev, priv);
> +
> + pm_runtime_set_autosuspend_delay(dev, 300);
> + pm_runtime_use_autosuspend(dev);
> + pm_runtime_enable(dev);
> +
> + ret = rzg3s_thermal_read_calib(priv);
> + if (ret) {
> + dev_err_probe(dev, ret, "Failed to read calibration data!\n");
> + goto rpm_disable;
> + }
> +
> + priv->tz = thermal_of_zone_register(dev->of_node, 0, priv, &rzg3s_tz_of_ops);
> + if (IS_ERR(priv->tz)) {
> + dev_err_probe(dev, PTR_ERR(priv->tz), "Failed to register thermal zone!\n");
> + goto rpm_disable;
> + }
> +
> + ret = thermal_add_hwmon_sysfs(priv->tz);
> + if (ret) {
> + dev_err_probe(dev, ret, "Failed to add hwmon sysfs!\n");
> + goto tz_unregister;
> + }
> +
> + return 0;
> +
> +tz_unregister:
> + thermal_of_zone_unregister(priv->tz);
> +rpm_disable:
> + pm_runtime_disable(dev);
> + pm_runtime_dont_use_autosuspend(dev);
> + return ret;
> +}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists