On 3/28/22 04:28, Michael Walle wrote:
Am 2022-03-27 20:22, schrieb Guenter Roeck:
On 3/27/22 07:18, Michael Walle wrote:
Am 2022-03-27 03:34, schrieb Guenter Roeck:
+ /*
+ * Data is given in pulses per second. According to the hwmon ABI we
+ * have to assume two pulses per revolution.
The hwmon ABI doesn't make any such assumptions. It wants to see RPM,
that is all. Pulses per revolution is a fan property.
There is fanY_pulses according to Documentation/ABI/testing/sysfs-class-hwmon:
Should only be created if the chip has a register to configure
the number of pulses. In the absence of such a register (and
thus attribute) the value assumed by all devices is 2 pulses
per fan revolution.
The hardware returns just the pulses per second. Doesn't that
mean I have to divide that value by two?
The above refers to hardware which reports RPM.
It is up to the driver to calculate and return RPM. How you do it is your
decision. Drivers should report the most likely correct RPM value to
userspace, one that rarely needs manual adjustment. Almost all fans
report two pulses per revolution, so normally that assumption is used
to convert PPM to RPM. That isn't mandated (or supposed to be mandated)
by the ABI. I would call it common sense.
I'll be happy to accept a patch clarifying this.
Where would that go? into the sysfs abi description of the
fanY_input?
For example.
Thanks,
Guenter