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]
Message-ID: <7a01c3f6-3800-472e-e18f-82af1b3f8d9e@linaro.org>
Date:   Fri, 27 Jan 2023 22:03:51 +0100
From:   Daniel Lezcano <daniel.lezcano@...aro.org>
To:     Amjad Ouled-Ameur <aouledameur@...libre.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Amit Kucheria <amitk@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>
Cc:     linux-pm@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org,
        Fabien Parent <fparent@...libre.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>,
        Rob Herring <robh@...nel.org>,
        Markus Schneider-Pargmann <msp@...libre.com>,
        Hsin-Yi Wang <hsinyi@...omium.org>,
        Michael Kao <michael.kao@...iatek.com>
Subject: Re: [PATCH v9 5/5] thermal: mediatek: add delay after thermal banks
 initialization

On 27/01/2023 16:44, Amjad Ouled-Ameur wrote:
> Thermal sensor reads performed immediately after thermal bank
> initialization returns bogus values. This is currently tackled by returning
> 0 if the temperature is bogus (exceeding 200000).
> 
> Instead, add a delay between the bank init and the thermal zone device
> register to properly fix this.
> 
> Signed-off-by: Michael Kao <michael.kao@...iatek.com>
> Signed-off-by: Hsin-Yi Wang <hsinyi@...omium.org>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@...libre.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
> ---
>   drivers/thermal/mtk_thermal.c | 11 +++--------
>   1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
> index b8e06f6c7c42..ab7db385afb3 100644
> --- a/drivers/thermal/mtk_thermal.c
> +++ b/drivers/thermal/mtk_thermal.c
> @@ -730,14 +730,6 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
>   
>   		temp = mt->raw_to_mcelsius(mt, i, raw);
>   
> -		/*
> -		 * The first read of a sensor often contains very high bogus
> -		 * temperature value. Filter these out so that the system does
> -		 * not immediately shut down.
> -		 */
> -		if (temp > 200000)
> -			temp = 0;
> -
>   		if (temp > max)
>   			max = temp;
>   	}
> @@ -1160,6 +1152,9 @@ static int mtk_thermal_probe(struct platform_device *pdev)
>   
>   	platform_set_drvdata(pdev, mt);
>   
> +	// Delay for thermal banks to be ready

Coding style for comments is : /* */

No need to resend, I'll take care of changing the comment format.

> +	msleep(30);
> +
>   	tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt,
>   					      &mtk_thermal_ops);
>   	if (IS_ERR(tzdev)) {
> 

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ