All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Ford <aford173@gmail.com>
To: u-boot@lists.denx.de
Cc: tharvey@gateworks.com, andrejs.cainikovs@toradex.com,
	francesco.dolcini@toradex.com, Adam Ford <aford173@gmail.com>,
	Stefano Babic <sbabic@denx.de>,
	Fabio Estevam <festevam@gmail.com>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	Peng Fan <peng.fan@nxp.com>, Marek Vasut <marex@denx.de>,
	Ye Li <ye.li@nxp.com>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	Ricardo Salveti <ricardo@foundries.io>,
	Michael Trimarchi <michael@amarulasolutions.com>
Subject: [PATCH V2] ARM: imx: imx8m: Adjust thermal trip points for Industrial parts
Date: Sat,  7 May 2022 07:04:40 -0500	[thread overview]
Message-ID: <20220507120440.24240-1-aford173@gmail.com> (raw)

If the thermal sensor is enabled in U-Boot, adjust the cpu-thermal
trip points for industrial rated parts.  This should apply to 8MQ,
8MM, 8MN, and 8MP.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tim Harvey <tharvey@gateworks.com>
---
V2:  Switch the check from looking for industrial or checkoing for
     anything but commerical.  This expands the trip point updates
     other grades as well.

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 8e23e6da32..7175295c3c 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 non-Commerical grade parts */
+	if (get_cpu_temp_grade(&minc, &maxc) != 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;
 }
-- 
2.34.1


             reply	other threads:[~2022-05-07 12:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07 12:04 Adam Ford [this message]
2022-05-07 22:00 ` [PATCH V2] ARM: imx: imx8m: Adjust thermal trip points for Industrial parts Marek Vasut
2022-05-08  2:59   ` Adam Ford
2022-05-08 13:42     ` Marek Vasut
2022-05-08 16:55       ` Francesco Dolcini
2022-05-09  7:38 ` Andrejs Cainikovs
2022-05-12 10:12   ` Andrejs Cainikovs
2022-05-12 10:12   ` [PATCH] imx8m: fixup thermal trips Andrejs Cainikovs
2022-05-25 11:41     ` Adam Ford
2022-05-25 12:19       ` Andrejs Cainikovs
2022-05-25 12:21         ` Adam Ford
2022-05-25 12:24           ` Andrejs Cainikovs
2022-05-25 12:26             ` Adam Ford
2022-05-25 12:28               ` Andrejs Cainikovs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220507120440.24240-1-aford173@gmail.com \
    --to=aford173@gmail.com \
    --cc=andrejs.cainikovs@toradex.com \
    --cc=festevam@gmail.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=marex@denx.de \
    --cc=michael@amarulasolutions.com \
    --cc=peng.fan@nxp.com \
    --cc=ricardo@foundries.io \
    --cc=sbabic@denx.de \
    --cc=tharvey@gateworks.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    --cc=ye.li@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.