[PATCH] ARM: imx: imx8m: Adjust thermal trip points for Industrial parts

Francesco Dolcini francesco.dolcini at toradex.com
Thu May 5 21:42:44 CEST 2022


On Thu, May 05, 2022 at 01:10:27PM -0500, Adam Ford wrote:
> If the thermal sensor is enabled in U-Boot, adjust the cpu-thermal
> trip points for industrial rated parts.
Is this supposed to work fine with any i.MX8M? Mini/Plus/... ?

> 
> Signed-off-by: Adam Ford <aford173 at gmail.com>
> 
> diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
> index 8e23e6da32..619e04a602 100644
> --- a/arch/arm/mach-imx/imx8m/soc.c
> +++ b/arch/arm/mach-imx/imx8m/soc.c
> @@ -30,6 +30,7 @@
>  #include <fsl_wdog.h>
>  #include <imx_sip.h>
>  #include <linux/bitops.h>
> +#include <imx_thermal.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -1207,10 +1208,10 @@ static int cleanup_nodes_for_efi(void *blob)
>  
>  int ft_system_setup(void *blob, struct bd_info *bd)
>  {
> +	__maybe_unused int nodeoff;
>  #ifdef CONFIG_IMX8MQ
>  	int i = 0;
>  	int rc;
> -	int nodeoff;
>  
>  	if (get_boot_device() == USB_BOOT) {
>  		disable_dcss_nodes(blob);
> @@ -1346,6 +1347,24 @@ usb_modify_speed:
>  		disable_cpu_nodes(blob, 2);
>  #endif
>  
> +#if defined(CONFIG_IMX_TMU)
> +	int minc, maxc, prop;
> +
> +	nodeoff = fdt_path_offset(blob, "/thermal-zones/cpu-thermal/trips");
> +
> +	/* Only update Industrial grade parts */
> +	if (get_cpu_temp_grade(&minc, &maxc) == TEMP_INDUSTRIAL) {

I would check for != TEMP_COMMERCIAL. 

> +		fdt_for_each_subnode(prop, blob, nodeoff) {
> +			const char *type = fdt_getprop(blob, prop, "type", NULL);
> +
> +			if (type && (!strcmp("critical", type)))
> +				fdt_setprop_u32(blob, prop, "temperature", maxc * 1000);
> +			else if (type && (!strcmp("passive", type)))
> +				fdt_setprop_u32(blob, prop, "temperature", (maxc - 10) * 1000);
> +		}
> +	}
> +#endif
> +
>  	cleanup_nodes_for_efi(blob);
>  	return 0;
>  }

Francesco



More information about the U-Boot mailing list