Skip to contentSkip to conversation

hwmon: corsair-cpro: add reading pwm values

PATCH New Marius Zachmann 1 participant 1 message Jul 21, 2020

Subsystems (3)
lore
Share & tools
lore

Marius Zachmann

author maintainer
#0 lore raw

PATCH 1/1 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

---
 Documentation/hwmon/corsair-cpro.rst |  7 ++-
 MAINTAINERS                          |  2 +-
 drivers/hwmon/corsair-cpro.c         | 64 +++++++++++++++++++---------
 3 files changed, 48 insertions(+), 25 deletions(-)
Documentation/hwmon/corsair-cpro.rst +3 -4
index 78820156f07d..751f95476b57 100644
@@ -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.
 ======================= =====================================================================
MAINTAINERS +1 -1
index 06607125b793..a93aefab91f1 100644
@@ -4402,7 +4402,7 @@ F:	Documentation/hwmon/coretemp.rst
 F:	drivers/hwmon/coretemp.c
 
 CORSAIR-CPRO HARDWARE MONITOR DRIVER
-M:	Marius  <[email protected]>
+M:	Marius Zachmann <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	drivers/hwmon/corsair-cpro.c
drivers/hwmon/corsair-cpro.c +44 -20

164 lines not on this page · raw message

--
2.27.0