
On Wed, May 25, 2022 at 7:19 AM Andrejs Cainikovs andrejs.cainikovs@toradex.com wrote:
Hi Adam,
On Wed, 2022-05-25 at 06:41 -0500, Adam Ford wrote:
On Thu, May 12, 2022 at 5:13 AM Andrejs Cainikovs andrejs.cainikovs@toradex.com wrote:
Fixup thermal trips in Linux device tree according to SoC thermal grade.
Signed-off-by: Andrejs Cainikovs andrejs.cainikovs@toradex.com
arch/arm/mach-imx/imx8m/soc.c | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach- imx/imx8m/soc.c index e93ecd2846..b451ece91f 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -1001,6 +1001,49 @@ static int disable_cpu_nodes(void *blob, u32 disabled_cores) return 0; }
+int fixup_thermal_trips(void *blob, const char *name)
Is there any reason this function cannot be static?
No, this function should be static indeed.
With that change:
Tested-by: Adam Ford aford173@gmail.com
+{
int minc, maxc;
int node, trip;
node = fdt_path_offset(blob, "/thermal-zones");
if (node < 0)
return node;
node = fdt_subnode_offset(blob, node, name);
if (node < 0)
return node;
node = fdt_subnode_offset(blob, node, "trips");
if (node < 0)
return node;
get_cpu_temp_grade(&minc, &maxc);
fdt_for_each_subnode(trip, blob, node) {
const char *type;
int temp, ret;
type = fdt_getprop(blob, trip, "type", NULL);
if (!type)
continue;
temp = 0;
if (!strcmp(type, "critical")) {
temp = 1000 * maxc;
} else if (!strcmp(type, "passive")) {
temp = 1000 * (maxc - 10);
}
if (temp) {
ret = fdt_setprop_u32(blob, trip,
"temperature", temp);
if (ret)
return ret;
}
}
return 0;
+}
int ft_system_setup(void *blob, bd_t *bd) { #ifdef CONFIG_IMX8MQ @@ -1128,6 +1171,13 @@ usb_modify_speed: disable_cpu_nodes(blob, 2); #endif
if (fixup_thermal_trips(blob, "cpu-thermal"))
printf("Failed to update cpu-thermal trip(s)");
+#ifdef CONFIG_IMX8MP
if (fixup_thermal_trips(blob, "soc-thermal"))
printf("Failed to update soc-thermal trip(s)");
+#endif
return ft_add_optee_node(blob, bd);
}
#endif
2.34.1