diff mbox series

[08/42] imx: imx8_cpu: support get temperature for i.MX9

Message ID 20230428040847.10841-9-peng.fan@oss.nxp.com
State Accepted
Commit 7c5256e89f9e65b15af8821585a11f13e5cc4348
Delegated to: Stefano Babic
Headers show
Series imx: i.MX9 update | expand

Commit Message

Peng Fan (OSS) April 28, 2023, 4:08 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

Use CONFIG_DM_THERMAL to make the temperature function could be reused
by i.MX8 and i.MX9

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/cpu/imx8_cpu.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Stefano Babic May 21, 2023, 4:54 p.m. UTC | #1
> From: Peng Fan <peng.fan@nxp.com>
> Use CONFIG_DM_THERMAL to make the temperature function could be reused
> by i.MX8 and i.MX9
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/cpu/imx8_cpu.c b/drivers/cpu/imx8_cpu.c
index 2d3df419f1c..4da7a99bf30 100644
--- a/drivers/cpu/imx8_cpu.c
+++ b/drivers/cpu/imx8_cpu.c
@@ -89,15 +89,19 @@  static void set_core_data(struct udevice *dev)
 	}
 }
 
-#if IS_ENABLED(CONFIG_IMX_SCU_THERMAL)
+#if IS_ENABLED(CONFIG_DM_THERMAL)
 static int cpu_imx_get_temp(struct cpu_imx_plat *plat)
 {
 	struct udevice *thermal_dev;
 	int cpu_tmp, ret;
 	int idx = 1; /* use "cpu-thermal0" device */
 
-	if (plat->cpu_rsrc == SC_R_A72)
-		idx = 2; /* use "cpu-thermal1" device */
+	if (IS_ENABLED(CONFIG_IMX8)) {
+		if (plat->cpu_rsrc == SC_R_A72)
+			idx = 2; /* use "cpu-thermal1" device */
+	} else {
+		idx = 1;
+	}
 
 	ret = uclass_get_device(UCLASS_THERMAL, idx, &thermal_dev);
 	if (!ret) {
@@ -128,7 +132,7 @@  static int cpu_imx_get_desc(const struct udevice *dev, char *buf, int size)
 	ret = snprintf(buf, size, "NXP i.MX%s Rev%s %s at %u MHz",
 		       plat->type, plat->rev, plat->name, plat->freq_mhz);
 
-	if (IS_ENABLED(CONFIG_IMX_SCU_THERMAL)) {
+	if (IS_ENABLED(CONFIG_DM_THERMAL)) {
 		temp = cpu_imx_get_temp(plat);
 		buf = buf + ret;
 		size = size - ret;