From fa4dac3e1bf7fadb4c5e098dcd721eafe3cd80c5 Mon Sep 17 00:00:00 2001 From: Marius Zachmann Date: Tue, 21 Jul 2020 10:54:47 +0200 Subject: hwmon: (corsair-cpro) add reading pwm values This adds the possibility for reading pwm values. These can not be read if the device is controlled via fan_target or a fan curve and will return an error in this case. Since an error is expected, this adds some rudimentary error handling. Changes: - add CTL_GET_FAN_PWM and use it via get_data - pwm returns -ENODATA if the device returns error 0x12 - fan_target now returns -ENODATA when the driver is started or a pwm value is set. - add ccp_get_errno to determine errno from device error. - get_data now has a parameter to determine whether to read one or two bytes of data. - update documentation - fix missing surname in MAINTAINERS Signed-off-by: Marius Zachmann Signed-off-by: Guenter Roeck --- Documentation/hwmon/corsair-cpro.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Documentation/hwmon') diff --git a/Documentation/hwmon/corsair-cpro.rst b/Documentation/hwmon/corsair-cpro.rst index 78820156f07d..751f95476b57 100644 --- a/Documentation/hwmon/corsair-cpro.rst +++ b/Documentation/hwmon/corsair-cpro.rst @@ -35,8 +35,7 @@ fan[1-6]_input Connected fan rpm. fan[1-6]_label Shows fan type as detected by the device. fan[1-6]_target Sets fan speed target rpm. When reading, it reports the last value if it was set by the driver. - Otherwise returns 0. -pwm[1-6] Sets the fan speed. Values from 0-255. - When reading, it reports the last value if it was set by the driver. - Otherwise returns 0. + Otherwise returns an error. +pwm[1-6] Sets the fan speed. Values from 0-255. Can only be read if pwm + was set directly. ======================= ===================================================================== -- cgit v1.2.3