[PATCH 37/41] imx9: print temperature

Peng Fan (OSS) peng.fan at oss.nxp.com
Mon Jan 23 10:16:56 CET 2023


From: Peng Fan <peng.fan at nxp.com>

Print tempeature for i.MX93

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 arch/arm/mach-imx/imx9/soc.c         | 17 +++++++++++++++++
 configs/imx93_11x11_evk_defconfig    |  2 ++
 configs/imx93_11x11_evk_ld_defconfig |  2 ++
 3 files changed, 21 insertions(+)

diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c
index 9ce4abf43e1..e3e96e7bc9b 100644
--- a/arch/arm/mach-imx/imx9/soc.c
+++ b/arch/arm/mach-imx/imx9/soc.c
@@ -594,6 +594,23 @@ int print_cpuinfo(void)
 	}
 	printf("(%dC to %dC)", minc, maxc);
 
+#if defined(CONFIG_IMX_TMU)
+	struct udevice *udev;
+	int ret, temp;
+
+	ret = uclass_get_device_by_name(UCLASS_THERMAL, "cpu-thermal", &udev);
+	if (!ret) {
+		ret = thermal_get_temp(udev, &temp);
+
+		if (!ret)
+			printf(" at %dC", temp);
+		else
+			debug(" - invalid sensor data\n");
+	} else {
+		debug(" - invalid sensor device\n");
+	}
+#endif
+
 	printf("\nReset cause: %s (0x%x)\n", get_reset_cause(&ssrs_ret), ssrs_ret);
 
 	return 0;
diff --git a/configs/imx93_11x11_evk_defconfig b/configs/imx93_11x11_evk_defconfig
index 53ab0f61610..b5f43827400 100644
--- a/configs/imx93_11x11_evk_defconfig
+++ b/configs/imx93_11x11_evk_defconfig
@@ -111,6 +111,8 @@ CONFIG_DM_RTC=y
 CONFIG_RTC_EMULATION=y
 CONFIG_DM_SERIAL=y
 CONFIG_FSL_LPUART=y
+CONFIG_DM_THERMAL=y
+CONFIG_IMX_TMU=y
 CONFIG_ULP_WATCHDOG=y
 CONFIG_WDT=y
 CONFIG_LZO=y
diff --git a/configs/imx93_11x11_evk_ld_defconfig b/configs/imx93_11x11_evk_ld_defconfig
index 945dc504726..c785576fe92 100644
--- a/configs/imx93_11x11_evk_ld_defconfig
+++ b/configs/imx93_11x11_evk_ld_defconfig
@@ -112,6 +112,8 @@ CONFIG_DM_RTC=y
 CONFIG_RTC_EMULATION=y
 CONFIG_DM_SERIAL=y
 CONFIG_FSL_LPUART=y
+CONFIG_DM_THERMAL=y
+CONFIG_IMX_TMU=y
 CONFIG_ULP_WATCHDOG=y
 CONFIG_WDT=y
 CONFIG_LZO=y
-- 
2.36.0



More information about the U-Boot mailing list