Hello,
In first :
_ I am not an expert in C-coding (i am beginner)
_ I am using a RockPro64
I would like to implement also the management of the FAN, vs the the
framework sensors :
https://ftp.openbsd.org/papers/asiabsdcon2009-sensors-paper.pdf
and regarding this post :
https://marc.info/?l=openbsd-tech&m=124182023631365&w=2
For my understanding to control the FAN we have to control the pwm :
pwmfan for Rockpro64 :
* fanpwr0 at iic2 addr 0x40: SYR827, 1.00 VDC
* fanpwr1 at iic2 addr 0x41: SYR828, 1.00 VDC
_ I tried to understand how to use the ii2c bus (i2c_scan.c ?), without
success for the moment.
Maybe i did not understood the post below, however regarding it, my
approach is not in the right way ?
Thanks.
On 12/20/2021 7:10 PM, Christopher Zimmermann wrote:
Hi,
to me it seems the thermal zone fan control model (see
https://www.kernel.org/doc/Documentation/devicetree/bindings/thermal/thermal.txt)
is inappropriate in many cases.
This model relies on a `cooling-levels` property of the fan being
present, which is then referenced by a thermal zone trip-point.
`cooling-levels` is essentially a map of 0-n fan power to 0-255 fan
power. It is probably meant to be used to make a power-cooling
relation more linear and cut off low-power setting which won't suffice
to spin up the fan ?!?
This setting can obviously only be configured for a specific fan. And
to do so one needs to recompile and install a device tree for the
specific fan.
To test the fan I added a fall-back code path to pwmfan.c, so the fan
doesn't depend on a `cooling-levels` setting (patch attached).
Now knowing that the 80mm fan does actually work and at what level it
will relieably spin up I could work out a sensible thermal-zone
configuration which I then added to the device tree (patch attached).
This diff won't help anybody with a different fan since other fans
will need more or less power to spin up.
What I would maybe like to add is a sysctl knob with which one can set
the cooling-levels map as a uint8_t cooling-levels[255]. That way the
fan could be controlled from userspace by setting the whole array to
the same value or the map can be used to adapt a given fan to the
thermal zones configuration of the device tree.
I'm not sure where to put it. Since this whole thermal-zone and
cooling-levels stuff is only an abstraction it should maybe be moved
to ofw_thermal.c and a generic "cooling-device" knob be added there.
Cooling devices would then need to pass their fdt_attach_args to
ofw_thermal so that ofw_thermal could then read the cooling-levels.
Does this make any sense? Is it a reasonable design?
Christopher