* [PATCH 1/5] imx8mm_evk_defconfig: Select CONFIG_IMX_TMU
@ 2023-08-23 17:26 Fabio Estevam
2023-08-23 17:26 ` [PATCH 2/5] thermal: imx_tmu: Fix the polling default Fabio Estevam
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Fabio Estevam @ 2023-08-23 17:26 UTC (permalink / raw)
To: sbabic; +Cc: peng.fan, u-boot, Fabio Estevam
From: Fabio Estevam <festevam@denx.de>
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.
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
configs/imx8mm_evk_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig
index ac9810fe1b..822c2fbfab 100644
--- a/configs/imx8mm_evk_defconfig
+++ b/configs/imx8mm_evk_defconfig
@@ -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
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] thermal: imx_tmu: Fix the polling default
2023-08-23 17:26 [PATCH 1/5] imx8mm_evk_defconfig: Select CONFIG_IMX_TMU Fabio Estevam
@ 2023-08-23 17:26 ` Fabio Estevam
2023-08-23 17:26 ` [PATCH 3/5] thermal: imx_tmu: Select LOG Fabio Estevam
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2023-08-23 17:26 UTC (permalink / raw)
To: sbabic; +Cc: peng.fan, u-boot, Fabio Estevam
From: Fabio Estevam <festevam@denx.de>
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.
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
drivers/thermal/imx_tmu.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/imx_tmu.c b/drivers/thermal/imx_tmu.c
index 97efc55044..d9a04eaf79 100644
--- a/drivers/thermal/imx_tmu.c
+++ b/drivers/thermal/imx_tmu.c
@@ -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) {
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] thermal: imx_tmu: Select LOG
2023-08-23 17:26 [PATCH 1/5] imx8mm_evk_defconfig: Select CONFIG_IMX_TMU Fabio Estevam
2023-08-23 17:26 ` [PATCH 2/5] thermal: imx_tmu: Fix the polling default Fabio Estevam
@ 2023-08-23 17:26 ` Fabio Estevam
2023-08-23 17:34 ` Tom Rini
2023-08-23 17:26 ` [PATCH 4/5] thermal: imx_tmu: Fix th temperature unit Fabio Estevam
2023-08-23 17:26 ` [PATCH 5/5] thermal: imx_tmu: Increase the polling interval Fabio Estevam
3 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2023-08-23 17:26 UTC (permalink / raw)
To: sbabic; +Cc: peng.fan, u-boot, Fabio Estevam
From: Fabio Estevam <festevam@denx.de>
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.
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
drivers/thermal/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 681b621760..0a1d11e216 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -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.
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] thermal: imx_tmu: Fix th temperature unit
2023-08-23 17:26 [PATCH 1/5] imx8mm_evk_defconfig: Select CONFIG_IMX_TMU Fabio Estevam
2023-08-23 17:26 ` [PATCH 2/5] thermal: imx_tmu: Fix the polling default Fabio Estevam
2023-08-23 17:26 ` [PATCH 3/5] thermal: imx_tmu: Select LOG Fabio Estevam
@ 2023-08-23 17:26 ` Fabio Estevam
2023-08-23 17:37 ` Tom Rini
2023-08-23 17:26 ` [PATCH 5/5] thermal: imx_tmu: Increase the polling interval Fabio Estevam
3 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2023-08-23 17:26 UTC (permalink / raw)
To: sbabic; +Cc: peng.fan, u-boot, Fabio Estevam
From: Fabio Estevam <festevam@denx.de>
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 <festevam@denx.de>
---
drivers/thermal/imx_tmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/imx_tmu.c b/drivers/thermal/imx_tmu.c
index d9a04eaf79..f79b583811 100644
--- a/drivers/thermal/imx_tmu.c
+++ b/drivers/thermal/imx_tmu.c
@@ -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)
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] thermal: imx_tmu: Increase the polling interval
2023-08-23 17:26 [PATCH 1/5] imx8mm_evk_defconfig: Select CONFIG_IMX_TMU Fabio Estevam
` (2 preceding siblings ...)
2023-08-23 17:26 ` [PATCH 4/5] thermal: imx_tmu: Fix th temperature unit Fabio Estevam
@ 2023-08-23 17:26 ` Fabio Estevam
3 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2023-08-23 17:26 UTC (permalink / raw)
To: sbabic; +Cc: peng.fan, u-boot, Fabio Estevam
From: Fabio Estevam <festevam@denx.de>
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.
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
drivers/thermal/imx_tmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/imx_tmu.c b/drivers/thermal/imx_tmu.c
index f79b583811..15e01b6166 100644
--- a/drivers/thermal/imx_tmu.c
+++ b/drivers/thermal/imx_tmu.c
@@ -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
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/5] thermal: imx_tmu: Select LOG
2023-08-23 17:26 ` [PATCH 3/5] thermal: imx_tmu: Select LOG Fabio Estevam
@ 2023-08-23 17:34 ` Tom Rini
0 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2023-08-23 17:34 UTC (permalink / raw)
To: Fabio Estevam; +Cc: sbabic, peng.fan, u-boot, Fabio Estevam
[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]
On Wed, Aug 23, 2023 at 02:26:35PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
>
> 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.
>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
> drivers/thermal/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 681b621760..0a1d11e216 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -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 ?
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 4/5] thermal: imx_tmu: Fix th temperature unit
2023-08-23 17:26 ` [PATCH 4/5] thermal: imx_tmu: Fix th temperature unit Fabio Estevam
@ 2023-08-23 17:37 ` Tom Rini
0 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2023-08-23 17:37 UTC (permalink / raw)
To: Fabio Estevam; +Cc: sbabic, peng.fan, u-boot, Fabio Estevam
[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]
On Wed, Aug 23, 2023 at 02:26:36PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
>
> 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 <festevam@denx.de>
> ---
> drivers/thermal/imx_tmu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/imx_tmu.c b/drivers/thermal/imx_tmu.c
> index d9a04eaf79..f79b583811 100644
> --- a/drivers/thermal/imx_tmu.c
> +++ b/drivers/thermal/imx_tmu.c
> @@ -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.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-08-23 17:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-23 17:26 [PATCH 1/5] imx8mm_evk_defconfig: Select CONFIG_IMX_TMU Fabio Estevam
2023-08-23 17:26 ` [PATCH 2/5] thermal: imx_tmu: Fix the polling default Fabio Estevam
2023-08-23 17:26 ` [PATCH 3/5] thermal: imx_tmu: Select LOG Fabio Estevam
2023-08-23 17:34 ` Tom Rini
2023-08-23 17:26 ` [PATCH 4/5] thermal: imx_tmu: Fix th temperature unit Fabio Estevam
2023-08-23 17:37 ` Tom Rini
2023-08-23 17:26 ` [PATCH 5/5] thermal: imx_tmu: Increase the polling interval Fabio Estevam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox