[PATCH 0/2] hwmon: Add new pwmX_fan_channel attribute

From: Armin Wolf
Date: Fri Jul 22 2022 - 23:40:09 EST


Userspace software which needs to know which PWM channel is
associated with which fan channel (like fancontrol/pwmconfig)
currently has to probe each PWM channel and watch for fan speed
changes.

This process has multiple issues:
1. Hardware might overhead during probing of PWM channels.
2. Not all fans react the same to PWM changes, making
detection unreliable.

However some hwmon chips, especially firmware-based ones, already
know which PWM channels are associated to which fan channel,
making probing of them unnecessary.

Add a new sysfs attribute to allow such chips to export
this knowlege to userspace in a standardized manner.

The first patch adds support for the new attribute to the hwmon core,
while the second patch adds support for this new attribute to the
dell-smm-hwmon driver.

All changes have been tested on a Dell Inspiron 3505.

Armin Wolf (2):
hwmon: Add pwmX_fan_channel attribute
hwmon: (dell-smm) Add support for pwmX_fan_channel attribute

Documentation/ABI/testing/sysfs-class-hwmon | 8 ++++++++
Documentation/hwmon/dell-smm-hwmon.rst | 1 +
Documentation/hwmon/sysfs-interface.rst | 3 +++
drivers/hwmon/dell-smm-hwmon.c | 15 ++++++++++++---
drivers/hwmon/hwmon.c | 1 +
include/linux/hwmon.h | 2 ++
6 files changed, 27 insertions(+), 3 deletions(-)

--
2.30.2