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>
Mon, 28 Feb 2022 01:03:17 +0000 (17:03 -0800)
commitda74944d3a469ffc0e8229520afbf41ad01219b6
treefb3ed37735f8acc142c8ebc8f8ebc6c6a930c8a8
parent4408d3600f5af8abc3258900526ae8c16b106e81
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