[PATCH] ARM: imx: imx8m: Adjust thermal trip points for Industrial parts
Adam Ford
aford173 at gmail.com
Thu May 5 20:10:27 CEST 2022
If the thermal sensor is enabled in U-Boot, adjust the cpu-thermal
trip points for industrial rated parts.
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) {
+ 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;
}
--
2.25.1
More information about the U-Boot
mailing list