]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: gateworks: venice: update thermal temp thresholds per cpu grade
authorTim Harvey <tharvey@gateworks.com>
Wed, 18 Aug 2021 22:24:30 +0000 (15:24 -0700)
committerStefano Babic <sbabic@denx.de>
Thu, 7 Oct 2021 14:53:50 +0000 (16:53 +0200)
Update the passive/critical thermal zone dt config per CPU temperature
grade.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
board/gateworks/venice/imx8mm_venice.c

index 46f4bff925317b968e721b20776343e1bf88fbe5..4e05802b6ff1a6db06b5862d2bc60936cce6520b 100644 (file)
@@ -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;
 }