All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasily Khoruzhick <anarsoul@gmail.com>
To: icenowy@outlook.com
Cc: Yangtao Li <tiny.windzz@gmail.com>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	 Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>,
	 Zhang Rui <rui.zhang@intel.com>,
	Rob Herring <robh+dt@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	 Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	 Linux PM <linux-pm@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	 arm-linux <linux-arm-kernel@lists.infradead.org>,
	linux-sunxi@lists.linux.dev,
	 linux-kernel <linux-kernel@vger.kernel.org>,
	Icenowy Zheng <icenowy@aosc.io>
Subject: Re: [PATCH 2/2] thermal: sun8i: add R329 THS
Date: Fri, 22 Apr 2022 11:49:30 -0700	[thread overview]
Message-ID: <CA+E=qVfhEhe325M+s784BYw4Ctvv=eGWxGAJBMwPptHXs_vKFA@mail.gmail.com> (raw)
In-Reply-To: <BYAPR20MB24720C488FD2BB42038D9825BCF79@BYAPR20MB2472.namprd20.prod.outlook.com>

On Fri, Apr 22, 2022 at 9:12 AM <icenowy@outlook.com> wrote:
>
> From: Icenowy Zheng <icenowy@aosc.io>
>
> The thermal sensor controller on R329 is similar to the one on H6, but
> with only one sensor. Calibration method is still unknown because no
> calibration is implemented in BSP kernel, neither is it documented in
> the user manual.
>
> Add its support to sun8i-thermal driver. Calibrating it is now
> prevented.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/thermal/sun8i_thermal.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index d9cd23cbb671..3a2f381005b4 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -312,7 +312,8 @@ static int sun8i_ths_calibrate(struct ths_device *tmdev)
>                 goto out;
>         }
>
> -       tmdev->chip->calibrate(tmdev, caldata, callen);
> +       if (tmdev->chip->calibrate)
> +               tmdev->chip->calibrate(tmdev, caldata, callen);

I think it's a bit late to check it here since you already read nvmem
cell if you got here. I'd suggest moving the check to
sun8i_ths_resource_init(), i.e. call sun8i_ths_calibrate()
conditionally depending on whether calibrate callback is present.

>         kfree(caldata);
>  out:
> @@ -628,6 +629,17 @@ static const struct ths_thermal_chip sun50i_h6_ths = {
>         .calc_temp = sun8i_ths_calc_temp,
>  };
>
> +static const struct ths_thermal_chip sun50i_r329_ths = {
> +       .sensor_num = 1,
> +       .has_bus_clk_reset = true,
> +       .offset = 188744,
> +       .scale = 672,
> +       .temp_data_base = SUN50I_H6_THS_TEMP_DATA,
> +       .init = sun50i_h6_thermal_init,
> +       .irq_ack = sun50i_h6_irq_ack,
> +       .calc_temp = sun8i_ths_calc_temp,
> +};
> +
>  static const struct of_device_id of_ths_match[] = {
>         { .compatible = "allwinner,sun8i-a83t-ths", .data = &sun8i_a83t_ths },
>         { .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths },
> @@ -636,6 +648,7 @@ static const struct of_device_id of_ths_match[] = {
>         { .compatible = "allwinner,sun50i-a100-ths", .data = &sun50i_a100_ths },
>         { .compatible = "allwinner,sun50i-h5-ths", .data = &sun50i_h5_ths },
>         { .compatible = "allwinner,sun50i-h6-ths", .data = &sun50i_h6_ths },
> +       { .compatible = "allwinner,sun50i-r329-ths", .data = &sun50i_r329_ths },
>         { /* sentinel */ },
>  };
>  MODULE_DEVICE_TABLE(of, of_ths_match);
> --
> 2.35.1
>

WARNING: multiple messages have this Message-ID (diff)
From: Vasily Khoruzhick <anarsoul@gmail.com>
To: icenowy@outlook.com
Cc: Yangtao Li <tiny.windzz@gmail.com>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	 Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>,
	 Zhang Rui <rui.zhang@intel.com>,
	Rob Herring <robh+dt@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	 Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	 arm-linux <linux-arm-kernel@lists.infradead.org>,
	linux-sunxi@lists.linux.dev,
	 linux-kernel <linux-kernel@vger.kernel.org>,
	Icenowy Zheng <icenowy@aosc.io>
Subject: Re: [PATCH 2/2] thermal: sun8i: add R329 THS
Date: Fri, 22 Apr 2022 11:49:30 -0700	[thread overview]
Message-ID: <CA+E=qVfhEhe325M+s784BYw4Ctvv=eGWxGAJBMwPptHXs_vKFA@mail.gmail.com> (raw)
In-Reply-To: <BYAPR20MB24720C488FD2BB42038D9825BCF79@BYAPR20MB2472.namprd20.prod.outlook.com>

On Fri, Apr 22, 2022 at 9:12 AM <icenowy@outlook.com> wrote:
>
> From: Icenowy Zheng <icenowy@aosc.io>
>
> The thermal sensor controller on R329 is similar to the one on H6, but
> with only one sensor. Calibration method is still unknown because no
> calibration is implemented in BSP kernel, neither is it documented in
> the user manual.
>
> Add its support to sun8i-thermal driver. Calibrating it is now
> prevented.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/thermal/sun8i_thermal.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index d9cd23cbb671..3a2f381005b4 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -312,7 +312,8 @@ static int sun8i_ths_calibrate(struct ths_device *tmdev)
>                 goto out;
>         }
>
> -       tmdev->chip->calibrate(tmdev, caldata, callen);
> +       if (tmdev->chip->calibrate)
> +               tmdev->chip->calibrate(tmdev, caldata, callen);

I think it's a bit late to check it here since you already read nvmem
cell if you got here. I'd suggest moving the check to
sun8i_ths_resource_init(), i.e. call sun8i_ths_calibrate()
conditionally depending on whether calibrate callback is present.

>         kfree(caldata);
>  out:
> @@ -628,6 +629,17 @@ static const struct ths_thermal_chip sun50i_h6_ths = {
>         .calc_temp = sun8i_ths_calc_temp,
>  };
>
> +static const struct ths_thermal_chip sun50i_r329_ths = {
> +       .sensor_num = 1,
> +       .has_bus_clk_reset = true,
> +       .offset = 188744,
> +       .scale = 672,
> +       .temp_data_base = SUN50I_H6_THS_TEMP_DATA,
> +       .init = sun50i_h6_thermal_init,
> +       .irq_ack = sun50i_h6_irq_ack,
> +       .calc_temp = sun8i_ths_calc_temp,
> +};
> +
>  static const struct of_device_id of_ths_match[] = {
>         { .compatible = "allwinner,sun8i-a83t-ths", .data = &sun8i_a83t_ths },
>         { .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths },
> @@ -636,6 +648,7 @@ static const struct of_device_id of_ths_match[] = {
>         { .compatible = "allwinner,sun50i-a100-ths", .data = &sun50i_a100_ths },
>         { .compatible = "allwinner,sun50i-h5-ths", .data = &sun50i_h5_ths },
>         { .compatible = "allwinner,sun50i-h6-ths", .data = &sun50i_h6_ths },
> +       { .compatible = "allwinner,sun50i-r329-ths", .data = &sun50i_r329_ths },
>         { /* sentinel */ },
>  };
>  MODULE_DEVICE_TABLE(of, of_ths_match);
> --
> 2.35.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-04-22 18:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220422161156.1075227-1-icenowy@outlook.com>
2022-04-22 16:11 ` [PATCH 2/2] thermal: sun8i: add R329 THS icenowy
2022-04-22 16:11   ` icenowy
2022-04-22 18:49   ` Vasily Khoruzhick [this message]
2022-04-22 18:49     ` Vasily Khoruzhick
2022-04-22 23:39   ` Samuel Holland
2022-04-22 23:39     ` Samuel Holland
2022-04-22 23:41     ` Icenowy Zheng
2022-04-22 23:41       ` Icenowy Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+E=qVfhEhe325M+s784BYw4Ctvv=eGWxGAJBMwPptHXs_vKFA@mail.gmail.com' \
    --to=anarsoul@gmail.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=icenowy@aosc.io \
    --cc=icenowy@outlook.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=samuel@sholland.org \
    --cc=tiny.windzz@gmail.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.