[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAIPUcS_cNRHoxwq@mai.linaro.org>
Date: Fri, 18 Apr 2025 10:37:37 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: iuncuim <iuncuim@...il.com>
Cc: Vasily Khoruzhick <anarsoul@...il.com>,
Yangtao Li <tiny.windzz@...il.com>, Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Andre Przywara <andre.przywara@....com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Zhang Rui <rui.zhang@...el.com>, Lukasz Luba <lukasz.luba@....com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-sunxi@...ts.linux.dev, linux-kernel@...r.kernel.org,
Piotr Oniszczuk <piotr.oniszczuk@...il.com>
Subject: Re: [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock
On Fri, Apr 11, 2025 at 08:38:21AM +0800, Mikhail Kalashnikov wrote:
> From: Mikhail Kalashnikov <iuncuim@...il.com>
>
> Some processors (e.g. Allwinner A523) require GPADC clocking activation for
> temperature sensors to work. So let's add support for enabling it.
>
> Signed-off-by: Mikhail Kalashnikov <iuncuim@...il.com>
> ---
> drivers/thermal/sun8i_thermal.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index 226747906..1f3908a60 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -66,8 +66,9 @@ struct tsensor {
> };
>
> struct ths_thermal_chip {
> - bool has_mod_clk;
> - bool has_bus_clk_reset;
> + bool has_gpadc_clk;
> + bool has_mod_clk;
> + bool has_bus_clk_reset;
> bool needs_sram;
> int sensor_num;
> int offset;
> @@ -89,7 +90,8 @@ struct ths_device {
> struct regmap_field *sram_regmap_field;
> struct reset_control *reset;
> struct clk *bus_clk;
> - struct clk *mod_clk;
> + struct clk *mod_clk;
> + struct clk *gpadc_clk;
> struct tsensor sensor[MAX_SENSOR_NUM];
> };
>
> @@ -417,6 +419,16 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev)
> if (ret)
> return ret;
>
> + if (tmdev->chip->has_gpadc_clk) {
> + tmdev->gpadc_clk = devm_clk_get_enabled(&pdev->dev, "gpadc");
> + if (IS_ERR(tmdev->gpadc_clk))
> + return PTR_ERR(tmdev->gpadc_clk);
return dev_err_probe();
> + }
> +
> + ret = clk_prepare_enable(tmdev->gpadc_clk);
> + if (ret)
> + return ret;
> +
Why calling clk_prepare_enable() ? devm_clk_get_enabled() did the job no ?
> if (tmdev->chip->needs_sram) {
> struct regmap *regmap;
>
> --
> 2.49.0
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Powered by blists - more mailing lists