public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: sbabic@denx.de
Cc: peng.fan@nxp.com, u-boot@lists.denx.de, Fabio Estevam <festevam@denx.de>
Subject: [PATCH 2/5] thermal: imx_tmu: Fix the polling default
Date: Wed, 23 Aug 2023 14:26:34 -0300	[thread overview]
Message-ID: <20230823172637.303101-2-festevam@gmail.com> (raw)
In-Reply-To: <20230823172637.303101-1-festevam@gmail.com>

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


  reply	other threads:[~2023-08-23 17:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 17:26 [PATCH 1/5] imx8mm_evk_defconfig: Select CONFIG_IMX_TMU Fabio Estevam
2023-08-23 17:26 ` Fabio Estevam [this message]
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

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=20230823172637.303101-2-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=festevam@denx.de \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox