Skip to contentSkip to conversation

configs: ARM: omap2plus: Enable OMAP3_THERMAL

PATCH In review Adam Ford 3 participants 13 messages Oct 7, 2019 – Aug 17, 2020

Subsystems (3)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/2 configs: ARM: omap2plus: Enable OMAP3_THERMAL

The some in the OMAP3 family have a bandgap thermal sensor, but omap2plus has it disabled.

This patch enables the OMAP3_THERMAL by default like the rest of the OMAP family.

arch/arm/configs/omap2plus_defconfig +1 -0
index 8f1c2b6f9e56..7e14a8c8bb29 100644
@@ -292,6 +292,7 @@ CONFIG_THERMAL_GOV_FAIR_SHARE=y
 CONFIG_THERMAL_GOV_USER_SPACE=y
 CONFIG_CPU_THERMAL=y
 CONFIG_TI_THERMAL=y
+CONFIG_OMAP3_THERMAL=y
 CONFIG_OMAP4_THERMAL=y
 CONFIG_OMAP5_THERMAL=y
 CONFIG_DRA752_THERMAL=y
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/2 ARM: dts: omap3: Add cpu trips and cooling map for omap34/36 families

The OMAP3530, OMAP3630, and DM3730 all show thresholds of 90C and 105C depending on commercial or industrial temperature ratings.

This patch expands the thermal information to include the limits of 90 and 105C for alert and critical. It sets the coolings-cells for the 34xx and 36xx CPU's which both point to omap3-cpu-thermal.dtsi.

For boards who never use industrial temperatures, these can be changed on their respective device trees with something like:

&cpu_alert0 {
	temperature = <85000>; /* millicelsius */
};
&cpu_crit {
	temperature = <90000>; /* millicelsius */
};
arch/arm/boot/dts/omap3-cpu-thermal.dtsi +21 -0
index 235ecfd61e2d..dfbd0cb0b00b 100644
@@ -17,4 +17,25 @@ cpu_thermal: cpu_thermal {
 
 			/* sensor       ID */
 	thermal-sensors = <&bandgap     0>;
+
+	cpu_trips: trips {
+		cpu_alert0: cpu_alert {
+			temperature = <90000>; /* millicelsius */
+			hysteresis = <2000>; /* millicelsius */
+			type = "passive";
+		};
+		cpu_crit: cpu_crit {
+			temperature = <105000>; /* millicelsius */
+			hysteresis = <2000>; /* millicelsius */
+			type = "critical";
+		};
+	};
+
+	cpu_cooling_maps: cooling-maps {
+		map0 {
+			trip = <&cpu_alert0>;
+			cooling-device =
+				<&cpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+		};
+	};
 };
arch/arm/boot/dts/omap34xx.dtsi +1 -0
index 7b09cbee8bb8..99a7161bebb2 100644
@@ -26,6 +26,7 @@
 				600000  1350000
 			>;
 			clock-latency = <300000>; /* From legacy driver */
+			#cooling-cells = <2>;
 		};
 	};
 
arch/arm/boot/dts/omap36xx.dtsi +1 -0
index 1e552f08f120..8096b6ef0ae1 100644
@@ -28,6 +28,7 @@
 				800000  1325000
 			>;
 			clock-latency = <300000>; /* From legacy driver */
+			#cooling-cells = <2>;
 		};
 	};
 
Signature · 1 line
2.17.1
author
#2 lore raw

Re: [PATCH 2/2] ARM: dts: omap3: Add cpu trips and cooling map for omap34/36 families

Quoted 15 lines · Adam Ford

The OMAP3530, OMAP3630, and DM3730 all show thresholds of 90C and 105C depending on commercial or industrial temperature ratings.

This patch expands the thermal information to include the limits of 90 and 105C for alert and critical. It sets the coolings-cells for the 34xx and 36xx CPU's which both point to omap3-cpu-thermal.dtsi.

For boards who never use industrial temperatures, these can be changed on their respective device trees with something like:

&cpu_alert0 {
        temperature = <85000>; /* millicelsius */
};
Quoted 7 lines
&cpu_crit {
        temperature = <90000>; /* millicelsius */
};

Tony,

I know this is an old thread. I am trying to revisit some of the other issues that came about with this, but is there any way we can get patch 2/2 applied? It might not do anything unless the bandgap sensor is enabled, but it at least gets us one step closer for those who choose to enable it. With 1GHz support now available, it would be nice to have the precautions to protect the processor from running too fast when its too hot.

thanks

adam

Quoted 55 lines
arch/arm/boot/dts/omap3-cpu-thermal.dtsi +21 -0
index 235ecfd61e2d..dfbd0cb0b00b 100644
@@ -17,4 +17,25 @@ cpu_thermal: cpu_thermal {
 
                        /* sensor       ID */
        thermal-sensors = <&bandgap     0>;
+
+       cpu_trips: trips {
+               cpu_alert0: cpu_alert {
+                       temperature = <90000>; /* millicelsius */
+                       hysteresis = <2000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu_crit: cpu_crit {
+                       temperature = <105000>; /* millicelsius */
+                       hysteresis = <2000>; /* millicelsius */
+                       type = "critical";
+               };
+       };
+
+       cpu_cooling_maps: cooling-maps {
+               map0 {
+                       trip = <&cpu_alert0>;
+                       cooling-device =
+                               <&cpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+               };
+       };
 };
arch/arm/boot/dts/omap34xx.dtsi +1 -0
index 7b09cbee8bb8..99a7161bebb2 100644
@@ -26,6 +26,7 @@
                                600000  1350000
                        >;
                        clock-latency = <300000>; /* From legacy driver */
+                       #cooling-cells = <2>;
                };
        };
 
arch/arm/boot/dts/omap36xx.dtsi +1 -1
index 1e552f08f120..8096b6ef0ae1 100644
@@ -28,6 +28,7 @@
                                800000  1325000
                        >;
                        clock-latency = <300000>; /* From legacy driver */
+                       #cooling-cells = <2>;
                };
        };
 
--
Quoted 2 lines

2.17.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#3 lore raw

Re: [PATCH 2/2] ARM: dts: omap3: Add cpu trips and cooling map for omap34/36 families

Quoted 7 lines · Adam Ford

I know this is an old thread. I am trying to revisit some of the other issues that came about with this, but is there any way we can get patch 2/2 applied? It might not do anything unless the bandgap sensor is enabled, but it at least gets us one step closer for those who choose to enable it. With 1GHz support now available, it would be nice to have the precautions to protect the processor from running too fast when its too hot.

Sure seems OK to me. Care to resend as I no longer have it in my inbox?

Regards,

Tony

maintainer
#4 lore raw
In reply to Adam Ford

Hi,

Quoted 5 lines · Adam Ford

The some in the OMAP3 family have a bandgap thermal sensor, but omap2plus has it disabled.

This patch enables the OMAP3_THERMAL by default like the rest of the OMAP family.

Looks like this breaks off mode during idle for omap3, and that's probably why it never got enabled. The difference in power consumption during idle is about 7mW vs 32mW for the SoC as measured from torpedo shunt for main_battery_som.

I think the right fix might be simply to add handling for CPU_CLUSTER_PM_ENTER to the related thermal driver to disable it during idle like we have for gpio-omap.c for example.

Regards,

Tony

Quoted 18 lines
arch/arm/configs/omap2plus_defconfig +1 -0
index 8f1c2b6f9e56..7e14a8c8bb29 100644
@@ -292,6 +292,7 @@ CONFIG_THERMAL_GOV_FAIR_SHARE=y
 CONFIG_THERMAL_GOV_USER_SPACE=y
 CONFIG_CPU_THERMAL=y
 CONFIG_TI_THERMAL=y
+CONFIG_OMAP3_THERMAL=y
 CONFIG_OMAP4_THERMAL=y
 CONFIG_OMAP5_THERMAL=y
 CONFIG_DRA752_THERMAL=y
Signature · 1 line
2.17.1
author
#5 lore raw
Quoted 10 lines · Tony Lindgren

Hi,

Quoted 5 lines · Adam Ford

The some in the OMAP3 family have a bandgap thermal sensor, but omap2plus has it disabled.

This patch enables the OMAP3_THERMAL by default like the rest of the OMAP family.

Quoted 8 lines

Looks like this breaks off mode during idle for omap3, and that's probably why it never got enabled. The difference in power consumption during idle is about 7mW vs 32mW for the SoC as measured from torpedo shunt for main_battery_som.

I think the right fix might be simply to add handling for CPU_CLUSTER_PM_ENTER to the related thermal driver to disable it during idle like we have for gpio-omap.c for example.

I am not sure I know where to start on fixing that issue. Would you entertain enabling the driver if we set the device tree to 'disabled' by default? This way if people want to to use it, it can be enabled on a per-device option. Once the power stuff gets resolved, we might be able to enable it by default. For people who are planning on using the DM3730 @ 1GHz in high temp environments, I am not sure they'll care about low power.

I'll try to look into it when I have time, but I was hoping a compromise might be a reasonable work-around.

adam

Quoted 23 lines

Regards,

Tony

Quoted 18 lines
arch/arm/configs/omap2plus_defconfig +1 -1
index 8f1c2b6f9e56..7e14a8c8bb29 100644
@@ -292,6 +292,7 @@ CONFIG_THERMAL_GOV_FAIR_SHARE=y
 CONFIG_THERMAL_GOV_USER_SPACE=y
 CONFIG_CPU_THERMAL=y
 CONFIG_TI_THERMAL=y
+CONFIG_OMAP3_THERMAL=y
 CONFIG_OMAP4_THERMAL=y
 CONFIG_OMAP5_THERMAL=y
 CONFIG_DRA752_THERMAL=y
--

2.17.1

maintainer
#6 lore raw
Quoted 20 lines · Adam Ford
Quoted 10 lines · Tony Lindgren

Hi,

Quoted 5 lines · Adam Ford

The some in the OMAP3 family have a bandgap thermal sensor, but omap2plus has it disabled.

This patch enables the OMAP3_THERMAL by default like the rest of the OMAP family.

Quoted 8 lines

Looks like this breaks off mode during idle for omap3, and that's probably why it never got enabled. The difference in power consumption during idle is about 7mW vs 32mW for the SoC as measured from torpedo shunt for main_battery_som.

I think the right fix might be simply to add handling for CPU_CLUSTER_PM_ENTER to the related thermal driver to disable it during idle like we have for gpio-omap.c for example.

Quoted 7 lines

I am not sure I know where to start on fixing that issue. Would you entertain enabling the driver if we set the device tree to 'disabled' by default? This way if people want to to use it, it can be enabled on a per-device option. Once the power stuff gets resolved, we might be able to enable it by default. For people who are planning on using the DM3730 @ 1GHz in high temp environments, I am not sure they'll care about low power.

They should both work fine together though. They are not mutually exclusive features.

Quoted 2 lines

I'll try to look into it when I have time, but I was hoping a compromise might be a reasonable work-around.

It should be hopefully a trivial fix.. I have not looked at the driver code though.

Regards,

Tony

#7 lore raw
Quoted 32 lines

Am 23.10.2019 um 00:19 schrieb Tony Lindgren <[email protected]>:

Quoted 20 lines · Adam Ford
Quoted 10 lines · Tony Lindgren

Hi,

Quoted 5 lines · Adam Ford

The some in the OMAP3 family have a bandgap thermal sensor, but omap2plus has it disabled.

This patch enables the OMAP3_THERMAL by default like the rest of the OMAP family.

Quoted 8 lines

Looks like this breaks off mode during idle for omap3, and that's probably why it never got enabled. The difference in power consumption during idle is about 7mW vs 32mW for the SoC as measured from torpedo shunt for main_battery_som.

I think the right fix might be simply to add handling for CPU_CLUSTER_PM_ENTER to the related thermal driver to disable it during idle like we have for gpio-omap.c for example.

Quoted 7 lines

I am not sure I know where to start on fixing that issue. Would you entertain enabling the driver if we set the device tree to 'disabled' by default? This way if people want to to use it, it can be enabled on a per-device option. Once the power stuff gets resolved, we might be able to enable it by default. For people who are planning on using the DM3730 @ 1GHz in high temp environments, I am not sure they'll care about low power.

Quoted 8 lines

They should both work fine together though. They are not mutually exclusive features.

Quoted 2 lines

I'll try to look into it when I have time, but I was hoping a compromise might be a reasonable work-around.

It should be hopefully a trivial fix.. I have not looked at the driver code though.

If I am taken right, it is the drivers/thermal/ti-soc-thermal/ti-*.c which is a common driver for omap3, omap4, omap5. They only differ in the thermal data and which registers and bits are used to access the ADC.

So is this problem with off mode also known for omap4 and omap5?

BR,
Nikolaus

maintainer
#8 lore raw
Quoted 38 lines · H. Nikolaus Schaller
Quoted 38 lines

Am 23.10.2019 um 00:19 schrieb Tony Lindgren <[email protected]>:

Quoted 20 lines · Adam Ford
Quoted 10 lines · Tony Lindgren

Hi,

Quoted 5 lines · Adam Ford

The some in the OMAP3 family have a bandgap thermal sensor, but omap2plus has it disabled.

This patch enables the OMAP3_THERMAL by default like the rest of the OMAP family.

Quoted 8 lines

Looks like this breaks off mode during idle for omap3, and that's probably why it never got enabled. The difference in power consumption during idle is about 7mW vs 32mW for the SoC as measured from torpedo shunt for main_battery_som.

I think the right fix might be simply to add handling for CPU_CLUSTER_PM_ENTER to the related thermal driver to disable it during idle like we have for gpio-omap.c for example.

Quoted 7 lines

I am not sure I know where to start on fixing that issue. Would you entertain enabling the driver if we set the device tree to 'disabled' by default? This way if people want to to use it, it can be enabled on a per-device option. Once the power stuff gets resolved, we might be able to enable it by default. For people who are planning on using the DM3730 @ 1GHz in high temp environments, I am not sure they'll care about low power.

They should both work fine together though. They are not mutually exclusive features.

Quoted 2 lines

I'll try to look into it when I have time, but I was hoping a compromise might be a reasonable work-around.

Quoted 7 lines
Quoted 2 lines

It should be hopefully a trivial fix.. I have not looked at the driver code though.

If I am taken right, it is the drivers/thermal/ti-soc-thermal/ti-*.c which is a common driver for omap3, omap4, omap5. They only differ in the thermal data and which registers and bits are used to access the ADC.

Yes so it seems. Enabling OMAP3_THERMAL adds support to of_ti_bandgap_match[] for omap3 and causes the issue.

Quoted 1 line

So is this problem with off mode also known for omap4 and omap5?

Probably. But we don't have off mode working for omap4, and it cannot be used for omap5 AFAIK.

My guess is we need to call clk_disable() and call ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to what ti_bandgap_suspend does. And then restore it on CPU_CLUSTER_PM_EXIT.

There's a similar example already in gpio_omap_cpu_notifier(). Not sure if there is some related errata to deal with too, probably the old Nokia n900 or n9 would provide some hints on what exactly needs to be done.

Regards,

Tony

author
#9 lore raw
Quoted 61 lines · Tony Lindgren
Quoted 38 lines · H. Nikolaus Schaller
Quoted 38 lines

Am 23.10.2019 um 00:19 schrieb Tony Lindgren <[email protected]>:

Quoted 20 lines · Adam Ford
Quoted 10 lines · Tony Lindgren

Hi,

Quoted 5 lines · Adam Ford

The some in the OMAP3 family have a bandgap thermal sensor, but omap2plus has it disabled.

This patch enables the OMAP3_THERMAL by default like the rest of the OMAP family.

Quoted 8 lines

Looks like this breaks off mode during idle for omap3, and that's probably why it never got enabled. The difference in power consumption during idle is about 7mW vs 32mW for the SoC as measured from torpedo shunt for main_battery_som.

I think the right fix might be simply to add handling for CPU_CLUSTER_PM_ENTER to the related thermal driver to disable it during idle like we have for gpio-omap.c for example.

Quoted 7 lines

I am not sure I know where to start on fixing that issue. Would you entertain enabling the driver if we set the device tree to 'disabled' by default? This way if people want to to use it, it can be enabled on a per-device option. Once the power stuff gets resolved, we might be able to enable it by default. For people who are planning on using the DM3730 @ 1GHz in high temp environments, I am not sure they'll care about low power.

They should both work fine together though. They are not mutually exclusive features.

Quoted 2 lines

I'll try to look into it when I have time, but I was hoping a compromise might be a reasonable work-around.

Quoted 7 lines
Quoted 2 lines

It should be hopefully a trivial fix.. I have not looked at the driver code though.

If I am taken right, it is the drivers/thermal/ti-soc-thermal/ti-*.c which is a common driver for omap3, omap4, omap5. They only differ in the thermal data and which registers and bits are used to access the ADC.

Yes so it seems. Enabling OMAP3_THERMAL adds support to of_ti_bandgap_match[] for omap3 and causes the issue.

Quoted 1 line

So is this problem with off mode also known for omap4 and omap5?

Probably. But we don't have off mode working for omap4, and it cannot be used for omap5 AFAIK.

My guess is we need to call clk_disable() and call ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to what ti_bandgap_suspend does. And then restore it on CPU_CLUSTER_PM_EXIT.

Quoted 4 lines

There's a similar example already in gpio_omap_cpu_notifier(). Not sure if there is some related errata to deal with too, probably the old Nokia n900 or n9 would provide some hints on what exactly needs to be done.

I 'think' I have a patch ready that does what you're asking, but I will fully admit that I don't completely grasp what's going on.

I'll submit it as an RFC, but I am not even sure I understand what to put into the description, so if you're OK with reviewing the RFC, feel free to mark up the actual commit message as well.

Quoted 1 line

From what I can see, the changes haven't negatively impact stuff. I

didn't see the power consumption go up before, so I am not sure I can replicate your findings.

It'll be posted shortly.

adam

Quoted 4 lines

Regards,

Tony

maintainer
#10 lore raw
Quoted 18 lines · Adam Ford
Quoted 9 lines · Tony Lindgren

My guess is we need to call clk_disable() and call ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to what ti_bandgap_suspend does. And then restore it on CPU_CLUSTER_PM_EXIT.

There's a similar example already in gpio_omap_cpu_notifier(). Not sure if there is some related errata to deal with too, probably the old Nokia n900 or n9 would provide some hints on what exactly needs to be done.

I 'think' I have a patch ready that does what you're asking, but I will fully admit that I don't completely grasp what's going on.

I'll submit it as an RFC, but I am not even sure I understand what to put into the description, so if you're OK with reviewing the RFC, feel free to mark up the actual commit message as well.

Quoted 5 lines

From what I can see, the changes haven't negatively impact stuff. I didn't see the power consumption go up before, so I am not sure I can replicate your findings.

It'll be posted shortly.

Yeah seems to do the job, thanks for fixing this issue.

Tony

author
#11 lore raw
Quoted 20 lines · Tony Lindgren
Quoted 18 lines · Adam Ford
Quoted 9 lines · Tony Lindgren

My guess is we need to call clk_disable() and call ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to what ti_bandgap_suspend does. And then restore it on CPU_CLUSTER_PM_EXIT.

There's a similar example already in gpio_omap_cpu_notifier(). Not sure if there is some related errata to deal with too, probably the old Nokia n900 or n9 would provide some hints on what exactly needs to be done.

I 'think' I have a patch ready that does what you're asking, but I will fully admit that I don't completely grasp what's going on.

I'll submit it as an RFC, but I am not even sure I understand what to put into the description, so if you're OK with reviewing the RFC, feel free to mark up the actual commit message as well.

Quoted 7 lines
Quoted 5 lines

From what I can see, the changes haven't negatively impact stuff. I didn't see the power consumption go up before, so I am not sure I can replicate your findings.

It'll be posted shortly.

Yeah seems to do the job, thanks for fixing this issue.

I am glad I could help! I am learning new stuff. :-)

Once the other patch to fix the bandgap clock idling, will it be possible to accept this as-is, or do you need me to re-base and submit again?

Ideally, once we get the thermal stuff in and we can drop Nikolaus' turbo option on the 1GHz processor and just let the processor scale to 1GHz without having to deal with the boost stuff since it should throttle back when the junction temp hits its threshold.

If you want me to re-base, please let me know which branch I should use.

Thank you,

adam

Quoted 2 lines

Tony

maintainer
#12 lore raw
Quoted 27 lines · Adam Ford
Quoted 26 lines · Tony Lindgren
Quoted 23 lines · Adam Ford
Quoted 9 lines · Tony Lindgren

My guess is we need to call clk_disable() and call ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to what ti_bandgap_suspend does. And then restore it on CPU_CLUSTER_PM_EXIT.

There's a similar example already in gpio_omap_cpu_notifier(). Not sure if there is some related errata to deal with too, probably the old Nokia n900 or n9 would provide some hints on what exactly needs to be done.

I 'think' I have a patch ready that does what you're asking, but I will fully admit that I don't completely grasp what's going on.

I'll submit it as an RFC, but I am not even sure I understand what to put into the description, so if you're OK with reviewing the RFC, feel free to mark up the actual commit message as well.

From what I can see, the changes haven't negatively impact stuff. I didn't see the power consumption go up before, so I am not sure I can replicate your findings.

It'll be posted shortly.

Quoted 7 lines
Quoted 1 line

Yeah seems to do the job, thanks for fixing this issue.

I am glad I could help! I am learning new stuff. :-)

Once the other patch to fix the bandgap clock idling, will it be possible to accept this as-is, or do you need me to re-base and submit again?

No need to resend, I've tagged it again to apply after the driver fix hits the mainline kernel.

Quoted 4 lines

Ideally, once we get the thermal stuff in and we can drop Nikolaus' turbo option on the 1GHz processor and just let the processor scale to 1GHz without having to deal with the boost stuff since it should throttle back when the junction temp hits its threshold.

Right. AFAIK we also still need some way to represent the arch/arm/mach-omap2/voltage.c as drivers/regulator some kind of regulator controller regulator for cpufreq to use.

Quoted 1 line

If you want me to re-base, please let me know which branch I should use.

No need for that.

Thanks,

Tony