public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: Stefano Babic <sbabic@denx.de>,
	Fabio Estevam <festevam@gmail.com>,
	"NXP i . MX U-Boot Team" <uboot-imx@nxp.com>,
	u-boot@lists.denx.de
Cc: Tim Harvey <tharvey@gateworks.com>
Subject: [PATCH v2 4/5] board: gateworks: venice: update thermal temp thresholds per cpu grade
Date: Wed, 18 Aug 2021 15:24:30 -0700	[thread overview]
Message-ID: <20210818222431.13862-4-tharvey@gateworks.com> (raw)
In-Reply-To: <20210818222431.13862-1-tharvey@gateworks.com>

Update the passive/critical thermal zone dt config per CPU temperature
grade.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
v2: no changes
---
 board/gateworks/venice/imx8mm_venice.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/board/gateworks/venice/imx8mm_venice.c b/board/gateworks/venice/imx8mm_venice.c
index 46f4bff925..4e05802b6f 100644
--- a/board/gateworks/venice/imx8mm_venice.c
+++ b/board/gateworks/venice/imx8mm_venice.c
@@ -156,8 +156,26 @@ int board_mmc_get_env_dev(int devno)
 
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
+	int off;
+
 	/* set board model dt prop */
 	fdt_setprop_string(blob, 0, "board", gsc_get_model());
 
+	/* update temp thresholds */
+	off = fdt_path_offset(blob, "/thermal-zones/cpu-thermal/trips");
+	if (off >= 0) {
+		int minc, maxc, prop;
+
+		get_cpu_temp_grade(&minc, &maxc);
+		fdt_for_each_subnode(prop, blob, off) {
+			const char *type = fdt_getprop(blob, prop, "type", NULL);
+
+			if (type && (!strcmp("critical", type)))
+				fdt_setprop_u32(blob, prop, "temperature", maxc * 1000);
+			else if (type && (!strcmp("passive", type)))
+				fdt_setprop_u32(blob, prop, "temperature", (maxc - 10) * 1000);
+		}
+	}
+
 	return 0;
 }
-- 
2.17.1


  parent reply	other threads:[~2021-08-18 22:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18 22:24 [PATCH v2 1/5] board: gateworks: venice: display hwmon details by default Tim Harvey
2021-08-18 22:24 ` [PATCH v2 2/5] board: gateworks: venice: do not overwrite serial# Tim Harvey
2021-10-07 14:12   ` sbabic
2021-08-18 22:24 ` [PATCH v2 3/5] arm: dts: imx8mm-venice-gw700x: fix mp5416 pmic config Tim Harvey
2021-10-07 14:13   ` sbabic
2021-08-18 22:24 ` Tim Harvey [this message]
2021-10-07 14:14   ` [PATCH v2 4/5] board: gateworks: venice: update thermal temp thresholds per cpu grade sbabic
2021-08-18 22:24 ` [PATCH v2 5/5] arm: dts: imx8mm-venice*: remove thermal zone overrides Tim Harvey
2021-10-07 14:13   ` sbabic
2021-08-23 18:04 ` [PATCH v2 1/5] board: gateworks: venice: display hwmon details by default Fabio Estevam
2021-10-07 14:13 ` sbabic

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=20210818222431.13862-4-tharvey@gateworks.com \
    --to=tharvey@gateworks.com \
    --cc=festevam@gmail.com \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /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