hwmon: (mlxreg-fan) Use pwm attribute for setting fan speed low limit
authorVadim Pasternak <vadimp@nvidia.com>
Wed, 26 Jan 2022 14:18:25 +0000 (16:18 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 5 Feb 2022 18:01:35 +0000 (10:01 -0800)
commit40ca67115d60eb974a2c286764dfe4b46081dc65
tree5a3d957e3d554cf9d56f28b1760d5579931af713
parentef8669148153805a7044ebe08eef4a67279feada
hwmon: (mlxreg-fan) Use pwm attribute for setting fan speed low limit

Recently 'cur_state' user space 'sysfs' interface 'sysfs' has been
deprecated. This interface is used in Nvidia systems for setting fan
speed limit. Currently fan speed limit is set from the user space by
setting 'sysfs' 'cur_state' attribute to 'max_state + n', where 'n' is
required limit, for example: 15 for 50% speed limit, 20 for full fan
speed enforcement.
The purpose of this feature is to provides ability to limit fan speed
according to some system wise considerations, like absence of some
replaceable units (PSU or line cards), high system ambient temperature,
unreliable transceivers temperature sensing or some other factors which
indirectly impacts system's airflow.

The motivation is to support fan low limit feature through 'hwmon'
interface.

Use 'hwmon' 'pwm' attribute for setting low limit for fan speed in
case 'thermal' subsystem is configured in kernel. In this case setting
fan speed through 'hwmon' will never let the 'thermal' subsystem to
select a lower duty cycle than the duty cycle selected with the 'pwm'
attribute.
From other side, fan speed is to be updated in hardware through 'pwm'
only in case the requested fan speed is above last speed set by
'thermal' subsystem, otherwise requested fan speed will be just stored
with no PWM update.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20220126141825.13545-1-vadimp@nvidia.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/mlxreg-fan.c