public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/4] thermal: imx_tmu: enable monitoring and default alert/critical
Date: Fri,  5 Feb 2021 16:11:05 -0800	[thread overview]
Message-ID: <1612570268-8625-2-git-send-email-tharvey@gateworks.com> (raw)
In-Reply-To: <1612570268-8625-1-git-send-email-tharvey@gateworks.com>

Set default critical/alert temperature and enabling monoitoring.

Without calling imx_tmu_enable_msite() monitoring will not be enabled
and read_temperature will return 0. Additionally without setting alert
temperature will cause imx_tmu_get_temp() to spin indefiniately thinking
the system needs to cool.

This resolves the board spinning endlessly when enabling IMX_TMU in the
SPL.

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
v2: added Fabio's review
---
 drivers/thermal/imx_tmu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/thermal/imx_tmu.c b/drivers/thermal/imx_tmu.c
index 1bd0340..1dada06 100644
--- a/drivers/thermal/imx_tmu.c
+++ b/drivers/thermal/imx_tmu.c
@@ -343,6 +343,7 @@ static int imx_tmu_bind(struct udevice *dev)
 	ofnode node, offset;
 	const char *name;
 	const void *prop;
+	int minc, maxc;
 
 	debug("%s dev name %s\n", __func__, dev->name);
 
@@ -351,6 +352,10 @@ static int imx_tmu_bind(struct udevice *dev)
 		return 0;
 
 	pdata->zone_node = 1;
+	/* default alert/crit temps based on temp grade */
+	get_cpu_temp_grade(&minc, &maxc);
+	pdata->critical = maxc * 1000;
+	pdata->alert = (maxc - 10) * 1000;
 
 	node = ofnode_path("/thermal-zones");
 	ofnode_for_each_subnode(offset, node) {
@@ -442,6 +447,7 @@ static int imx_tmu_probe(struct udevice *dev)
 	if (pdata->zone_node) {
 		imx_tmu_init(dev);
 		imx_tmu_calibration(dev);
+		imx_tmu_enable_msite(dev);
 	} else {
 		imx_tmu_enable_msite(dev);
 	}
-- 
2.7.4

  reply	other threads:[~2021-02-06  0:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-06  0:11 [PATCH v2 0/4] Add Gateworks Venice board support Tim Harvey
2021-02-06  0:11 ` Tim Harvey [this message]
2021-03-01 11:55   ` [PATCH v2 1/4] thermal: imx_tmu: enable monitoring and default alert/critical sbabic at denx.de
2021-02-06  0:11 ` [PATCH v2 2/4] Respect that some compression algos can be enabled separately for SPL Tim Harvey
2021-03-01 11:56   ` sbabic at denx.de
2021-02-06  0:11 ` [PATCH v2 3/4] arm: dts: imx8mm: add Gateworks i.MX8 Mini Dev kits Tim Harvey
2021-02-06  0:11 ` [PATCH v2 4/4] board: gateworks: imx8mm: Add Gateworks Venice board support Tim Harvey
2021-03-01 16:04   ` Stefano Babic
2021-03-01 22:18     ` Tim Harvey
2021-03-02  8:14       ` Stefano Babic

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=1612570268-8625-2-git-send-email-tharvey@gateworks.com \
    --to=tharvey@gateworks.com \
    --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