All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: imx: imx8m: Adjust thermal trip points for Industrial parts
@ 2022-05-05 18:10 Adam Ford
  2022-05-05 19:31 ` Tim Harvey
  2022-05-05 19:42 ` Francesco Dolcini
  0 siblings, 2 replies; 4+ messages in thread
From: Adam Ford @ 2022-05-05 18:10 UTC (permalink / raw)
  To: u-boot
  Cc: aford, tharvey, andrejs.cainikovs, Adam Ford, Stefano Babic,
	Fabio Estevam, NXP i.MX U-Boot Team, Peng Fan, Marek Vasut,
	Ye Li, Frieder Schrempf, Ricardo Salveti, Michael Trimarchi

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-07 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 18:10 [PATCH] ARM: imx: imx8m: Adjust thermal trip points for Industrial parts Adam Ford
2022-05-05 19:31 ` Tim Harvey
2022-05-05 19:42 ` Francesco Dolcini
2022-05-07 11:54   ` Adam Ford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.