lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 22 Apr 2022 11:49:30 -0700
From:   Vasily Khoruzhick <anarsoul@...il.com>
To:     icenowy@...look.com
Cc:     Yangtao Li <tiny.windzz@...il.com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Amit Kucheria <amitk@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>,
        Rob Herring <robh+dt@...nel.org>, Chen-Yu Tsai <wens@...e.org>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        Samuel Holland <samuel@...lland.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        arm-linux <linux-arm-kernel@...ts.infradead.org>,
        linux-sunxi@...ts.linux.dev,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Icenowy Zheng <icenowy@...c.io>
Subject: Re: [PATCH 2/2] thermal: sun8i: add R329 THS

On Fri, Apr 22, 2022 at 9:12 AM <icenowy@...look.com> wrote:
>
> From: Icenowy Zheng <icenowy@...c.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@...c.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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ