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  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 May 2020 19:33:10 +0200
From:   Daniel Lezcano <daniel.lezcano@...aro.org>
To:     Anson Huang <Anson.Huang@....com>, rui.zhang@...el.com,
        amit.kucheria@...durent.com, shawnguo@...nel.org,
        s.hauer@...gutronix.de, kernel@...gutronix.de, festevam@...il.com,
        linux-pm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Cc:     Linux-imx@....com
Subject: Re: [PATCH] thermal: imx8mm: Add get_trend ops

On 13/05/2020 04:58, Anson Huang wrote:
> Add get_trend ops for i.MX8MM thermal to apply fast cooling
> mechanism, when temperature exceeds passive trip point, the
> highest cooling action will be applied, and when temperature
> drops to lower than the margin below passive trip point, the
> lowest cooling action will be applied.

You are not describing what is the goal of this change.

IIUC, the resulting change will be an on/off action. The thermal zone is
mitigated with the highest cooling effect, so the lowest OPP, then the
temperature trend is stable until it goes below the trip - margin where
the mitigation is stopped.

Except, I'm missing something, setting a trip point with a 10000
hysteresis and a cooling map min/max set to the highest opp will result
on the same.


> Signed-off-by: Anson Huang <Anson.Huang@....com>
> ---
>  drivers/thermal/imx8mm_thermal.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
> index e6061e2..8f6a0b8 100644
> --- a/drivers/thermal/imx8mm_thermal.c
> +++ b/drivers/thermal/imx8mm_thermal.c
> @@ -38,6 +38,8 @@
>  #define TMU_VER1		0x1
>  #define TMU_VER2		0x2
>  
> +#define IMX_TEMP_COOL_MARGIN	10000
> +
>  struct thermal_soc_data {
>  	u32 num_sensors;
>  	u32 version;
> @@ -103,8 +105,33 @@ static int tmu_get_temp(void *data, int *temp)
>  	return tmu->socdata->get_temp(data, temp);
>  }
>  
> +static int tmu_get_trend(void *p, int trip, enum thermal_trend *trend)
> +{
> +	struct tmu_sensor *sensor = p;
> +	int trip_temp, temp, ret;
> +
> +	if (!sensor->tzd)
> +		return -EINVAL;
> +
> +	ret = sensor->tzd->ops->get_trip_temp(sensor->tzd, trip, &trip_temp);
> +	if (ret)
> +		return ret;
> +
> +	temp = READ_ONCE(sensor->tzd->temperature);
> +
> +	if (temp > trip_temp)
> +		*trend = THERMAL_TREND_RAISE_FULL;
> +	else if (temp < (trip_temp - IMX_TEMP_COOL_MARGIN))
> +		*trend = THERMAL_TREND_DROP_FULL;
> +	else
> +		*trend = THERMAL_TREND_STABLE;
> +
> +	return 0;
> +}
> +
>  static struct thermal_zone_of_device_ops tmu_tz_ops = {
>  	.get_temp = tmu_get_temp,
> +	.get_trend = tmu_get_trend,
>  };
>  
>  static void imx8mm_tmu_enable(struct imx8mm_tmu *tmu, bool enable)
> 


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