imx8mm_evk_defconfig: Select CONFIG_IMX_TMU
Subsystems (2)
Fabio Estevam
reviewerPATCH 1/5 imx8mm_evk_defconfig: Select CONFIG_IMX_TMU
From: Fabio Estevam <[email protected]>
Select the i.MX8MM thermal driver as it is useful for displaying the CPU temperature and its grading:
CPU: Commercial temperature grade (0C to 95C) at 38C
It also prevents booting when the temperature is above the alert point.
--- configs/imx8mm_evk_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/imx8mm_evk_defconfig +1 -0
@@ -104,6 +104,7 @@ CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_PSCI=y CONFIG_SYSRESET_WATCHDOG=y CONFIG_DM_THERMAL=y +CONFIG_IMX_TMU=y CONFIG_USB=y CONFIG_SPL_USB_HOST=y CONFIG_USB_EHCI_HCD=y
Signature · 1 line
2.34.1
Fabio Estevam
reviewerPATCH 2/5 thermal: imx_tmu: Fix the polling default
From: Fabio Estevam <[email protected]>
When the 'polling-delay' property is not passed via devicetree, pdata->polling_delay keeps at 0. This causes the imx_tmu driver to get stuck inside the busy while() loop when the CPU temperature is above the alert point.
Fix this problem by passing a one second polling interval, which provides a proper delay to let the system to cool down and exit the while() loop when the temperature is below the alert point.
--- drivers/thermal/imx_tmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/thermal/imx_tmu.c +5 -1
@@ -37,6 +37,7 @@ DECLARE_GLOBAL_DATA_PTR;#define TER_ADC_PD 0x40000000#define TER_ALPF 0x3 +#define IMX_TMU_POLLING_DELAY_MS 1000/* * i.MX TMU Registers */
@@ -574,6 +575,8 @@ static int imx_tmu_parse_fdt(struct udevice *dev)dev_dbg (dev,"%s\n" , __func__); + pdata->polling_delay =IMX_TMU_POLLING_DELAY_MS ; +if (pdata->zone_node) { pdata->regs = (union tmu_regs *)dev_read_addr_ptr (dev);
@@ -602,7 +605,8 @@ static int imx_tmu_parse_fdt(struct udevice *dev)dev_dbg (dev,"args.args_count %d, id %d\n" , args.args_count, pdata->id); - pdata->polling_delay =dev_read_u32_default (dev,"polling-delay" ,1000 ); + pdata->polling_delay =dev_read_u32_default (dev,"polling-delay" , +IMX_TMU_POLLING_DELAY_MS ); trips_np =ofnode_path ("/thermal-zones/cpu-thermal/trips" );ofnode_for_each_subnode (trips_np, trips_np) {
Signature · 1 line
2.34.1
Fabio Estevam
reviewerPATCH 3/5 thermal: imx_tmu: Select LOG
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Without LOG being selected, the dev_info() information from the imx_tmu driver cannot be printed.
Select the LOG option, so that no dev_info() messages are lost.
--- drivers/thermal/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/thermal/Kconfig +1 -0
@@ -29,6 +29,7 @@ config IMX_SCU_THERMAL config IMX_TMU bool "Thermal Management Unit driver for NXP i.MX8M and iMX93" depends on ARCH_IMX8M || IMX93 + select LOG help Support for Temperature sensors on NXP i.MX8M and iMX93. It supports one critical trip point and one passive trip point.
Signature · 1 line
2.34.1
Re: [PATCH 3/5] thermal: imx_tmu: Select LOG
Quoted 17 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Without LOG being selected, the
dev_info()information from theimx_tmudriver cannot be printed.Select the LOG option, so that no
dev_info()messages are lost.Signed-off-by Fabio Estevam <[email protected]>--- drivers/thermal/Kconfig | 1 + 1 file changed, 1 insertion(+)drivers/thermal/Kconfig +0
-0
drivers/thermal/Kconfig config IMX_SCU_THERMAL · line 35
Quoted 7 lines
drivers/thermal/Kconfig +1
-0@@ -29,6 +29,7 @@ config IMX_SCU_THERMAL config IMX_TMU bool "Thermal Management Unit driver for NXP i.MX8M and iMX93" depends on ARCH_IMX8M || IMX93 + select LOG help Support for Temperature sensors on NXP i.MX8M and iMX93. It supports one critical trip point and one passive trip point.
This is now going to bring in a ton of other messages. Perhaps the problem is that there are critical messages in this driver which should not be dev_info ?
Signature · 1 line
Tom
Fabio Estevam
reviewerPATCH 4/5 thermal: imx_tmu: Fix th temperature unit
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
The temperature unit is millidegree Celsius, so divide by 1000 to correctly print the temperature values in Celsius.
While at it, also change a typo: "has beyond" to "is beyond".
--- drivers/thermal/imx_tmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/imx_tmu.c +2 -2
@@ -238,8 +238,8 @@ int imx_tmu_get_temp(struct udevice *dev, int *temp)return ret;while (cpu_tmp >= pdata->alert) { -dev_info (dev,"CPU Temperature (%dC) has beyond alert (%dC), close to critical (%dC) waiting...\n" , - cpu_tmp, pdata->alert, pdata->critical); +dev_info (dev,"CPU Temperature (%dC) is beyond alert (%dC), close to critical (%dC) waiting...\n" , + cpu_tmp /1000 , pdata->alert /1000 , pdata->critical /1000 );mdelay (pdata->polling_delay); ret =read_temperature (dev, &cpu_tmp);if (ret)
Signature · 1 line
2.34.1
Re: [PATCH 4/5] thermal: imx_tmu: Fix th temperature unit
Quoted 17 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
The temperature unit is millidegree Celsius, so divide by 1000 to correctly print the temperature values in Celsius.
While at it, also change a typo: "has beyond" to "is beyond".
Signed-off-by Fabio Estevam <[email protected]>--- drivers/thermal/imx_tmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/thermal/imx_tmu.c +0
-0
drivers/thermal/imx_tmu.c int imx_tmu_get_temp(struct udevice *dev, int *temp) · line 245
Quoted 10 lines
drivers/thermal/imx_tmu.c +2
-2@@ -238,8 +238,8 @@ int imx_tmu_get_temp(struct udevice *dev, int *temp)return ret;while (cpu_tmp >= pdata->alert) { -dev_info (dev,"CPU Temperature (%dC) has beyond alert (%dC), close to critical (%dC) waiting...\n" , - cpu_tmp, pdata->alert, pdata->critical); +dev_info (dev,"CPU Temperature (%dC) is beyond alert (%dC), close to critical (%dC) waiting...\n" , + cpu_tmp /1000 , pdata->alert /1000 , pdata->critical /1000 );mdelay (pdata->polling_delay); ret =read_temperature (dev, &cpu_tmp);if (ret)
To follow-up on the patch about select'ing LOG, this shouldn't be dev_info, it should be higher, at least warning if not critical. And given the default LOGLEVEL of 4, it will be included and printed.
Signature · 1 line
Tom
Fabio Estevam
reviewerPATCH 5/5 thermal: imx_tmu: Increase the polling interval
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Polling every second to check whether the CPU has cooled down is too frequent.
Allow more time for the CPU to cool down by increasing the polling interval to 5 seconds by defaut.
This value is used in the absence of the 'polling-delay' devicetree property.
--- drivers/thermal/imx_tmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/imx_tmu.c +1 -1
@@ -37,7 +37,7 @@ DECLARE_GLOBAL_DATA_PTR;#define TER_ADC_PD 0x40000000#define TER_ALPF 0x3 -#define IMX_TMU_POLLING_DELAY_MS 1000 +#define IMX_TMU_POLLING_DELAY_MS 5000/* * i.MX TMU Registers */
Signature · 1 line
2.34.1