Re: [PATCH v4 0/5] ARM: Add GPIO support

From: Hawkins, Nick
Date: Mon Jul 03 2023 - 11:32:03 EST


> I understand the approach such that you have also constructed a
> userspace cooling daemon that will consume the fan and GPIO
> information to drive the hardware monitoring and that is what you
> mean when you say "the host" will do it.




> This is a *bad idea*.




> While I can't stop you since these are indeed userspace interfaces we
> provide, I urge you to look into my earlier proposal to use a thermal
> zone to manage the cooling inside the kernel and get rid of all that
> custom userspace.




> The kernel has all that is needed to regulate the thermal zone with
> PID and on/off regulation. It will work even if the userspace crashes
> completely, which is what you want. The code is reviewed by a large
> community and very well tested.




> I think I showed this example before from
> arch/arm/boot/dts/gemini-dlink-dns-313.dts:




> thermal-zones {
> chassis-thermal {
> /* Poll every 20 seconds */
> polling-delay = <20000>;
> /* Poll every 2nd second when cooling */
> polling-delay-passive = <2000>;




> thermal-sensors = <&g751>;




> /* Tripping points from the fan.script in the rootfs */
> trips {
> chassis_alert0: chassis-alert0 {
> /* At 43 degrees turn on low speed */
> temperature = <43000>;
> hysteresis = <3000>;
> type = "active";
> };
> chassis_alert1: chassis-alert1 {
> /* At 47 degrees turn on high speed */
> temperature = <47000>;
> hysteresis = <3000>;
> type = "active";
> };
> chassis_crit: chassis-crit {
> /* Just shut down at 60 degrees */
> temperature = <60000>;
> hysteresis = <2000>;
> type = "critical";
> };
> };




> cooling-maps {
> map0 {
> trip = <&chassis_alert0>;
> cooling-device = <&fan0 1 1>;
> };
> map1 {
> trip = <&chassis_alert1>;
> cooling-device = <&fan0 2 2>;
> };
> };
> };
> };




> This uses a thermal sensor and a fan with two speeds.




> Adding a "presence" GPIO to the thermal zone core to enable and
> disable it which is what your use case needs should be pretty trivial.


Greetings Linus,

As always thank you for your feedback and suggestions. Sorry for the
delayed response. I will bring this concept to my team to discuss.
A possible issue with this could be how our cooling profile varies
based on options present such as extra DIMMS, CPU, storage,
network ... etc.

Thanks,

-Nick Hawkins