hwmon: add Corsair Commander Pro driver
Marius Zachmann
maintainerRFC v3 1/1 hwmon: add Corsair Commander Pro driver
This is v3 of a driver for the Corsair Commander Pro. It provides sysfs attributes for:
- Reading fan speed
- Reading temp sensors
- Reading voltage values
- Writing pwm and reading last written pwm
- Reading fan and temp connection status
I still need to add it to hid_ignore_list in hid-quirks.h, but for now I don't want to spam another mailing list.
---
Changes from v2
- add corsair-cpro to Documentation/hwmon/index.rst
- add SPDX license identifier to corsair-cpro.rst
- remove fanX_enable from Documentation and driver
- changed comment style
- clarified protocol in comments
- add get_temp_cnct for reading temperature sensor connection status
- added temp_cnct and temp_label in ccp_device
- added tempX_label, showing connection status
- renamed get_fan_mode_label to get_fan_cnct
- get_temp_cnct and get_fan_cnct only called in probe
- send_usb_cmd checks errors in the device response
- send_usb_cmd clears the buffer and sets the command
- inlined get_fan_rpm and get_voltage and removed functions
- more reverse christmas tree
- add device ids to hid_ignore_list in hid-quirks.h
Changes from v1:
- Style issues
- Changed to USB driver
- Clarify reading pwm
- Fixed attribute name number in Documentation
- MODULE_LICENSE now "GPL"
- Removed unneccesary hwmondev in ccp_device
- Moved buffer to ccp_device and mutex out of send_usb_cmd
- No more replacing or ignoring error codes
- Use DIV_ROUND_CLOSEST in set_pwm
- Changed fan_label when unknown to "fanX other"
- Only accept 0 or 1 for fan_enable
- Check for ERR_PTR in ccp_probe
--- Documentation/hwmon/corsair-cpro.rst | 40 +++ Documentation/hwmon/index.rst | 1 + MAINTAINERS | 6 + drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/corsair-cpro.c | 497 +++++++++++++++++++++++++++ 6 files changed, 555 insertions(+) create mode 100644 Documentation/hwmon/corsair-cpro.rst create mode 100644 drivers/hwmon/corsair-cpro.c
Documentation/hwmon/corsair-cpro.rst new file +40 -0
@@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Kernel driver corsair-cpro +========================== + +Supported devices: + + * Corsair Commander Pro + * Corsair Commander Pro (1000D) + +Author: Marius Zachmann + +Description +----------- + +This driver implements the sysfs interface for the Corsair Commander Pro. +The Corsair Commander Pro is a USB device with 6 fan connectors, +4 temperature sensor connectors and 2 Corsair LED connectors. +It can read the voltage levels on the SATA power connector. + +Usage Notes +----------- + +Since it is a USB device, hotswapping is possible. The device is autodetected. + +Sysfs entries +------------- + +======================= ===================================================================== +in0_input Voltage on SATA 12v +in1_input Voltage on SATA 5v +in2_input Voltage on SATA 3.3v +temp[1-4]_input Temperature on connected temperature sensors +temp[1-4] label Shows "nc" after name, when not connected +fan[1-6]_input Connected fan rpm. +fan[1-6]_label Shows connection status of the fan as detected by the device. +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. +======================= =====================================================================
Documentation/hwmon/index.rst +1 -0
@@ -47,6 +47,7 @@ Hardware Monitoring Kernel Drivers bel-pfe bt1-pvt coretemp + corsair-cpro da9052 da9055 dell-smm-hwmon
MAINTAINERS +6 -0
@@ -4386,6 +4386,12 @@ S: Maintained F: Documentation/hwmon/coretemp.rst F: drivers/hwmon/coretemp.c +CORSAIR-CPRO HARDWARE MONITOR DRIVER +M: Marius Zachmann <[email protected]> +L: [email protected] +S: Maintained +F: drivers/hwmon/corsair-cpro.c + COSA/SRP SYNC SERIAL DRIVER M: Jan "Yenya" Kasprzak <[email protected]> S: Maintained
drivers/hwmon/Kconfig +10 -0
@@ -439,6 +439,16 @@ config SENSORS_BT1_PVT_ALARMS the data conversion will be periodically performed and the data will be saved in the internal driver cache. +config SENSORS_CORSAIR_CPRO + tristate "Corsair Commander Pro controller" + depends on USB + help + If you say yes here you get support for the Corsair Commander Pro + controller. + + This driver can also be built as a module. If so, the module + will be called corsair-cpro. + config SENSORS_DRIVETEMP tristate "Hard disk drives with temperature sensors" depends on SCSI && ATA
drivers/hwmon/Makefile +1 -0
@@ -56,6 +56,7 @@ obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o obj-$(CONFIG_SENSORS_AXI_FAN_CONTROL) += axi-fan-control.o obj-$(CONFIG_SENSORS_BT1_PVT) += bt1-pvt.o obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o +obj-$(CONFIG_SENSORS_CORSAIR_CPRO) += corsair-cpro.o obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o obj-$(CONFIG_SENSORS_DA9055)+= da9055-hwmon.o obj-$(CONFIG_SENSORS_DELL_SMM) += dell-smm-hwmon.o
drivers/hwmon/corsair-cpro.c new file +497 -0
497 lines not on this page · raw message
Signature · 4 lines
2.27.0 -------------------------------------------------------------
kernel test robot
build bot[RFC PATCH] hwmon: ccp_disconnect() can be static
Signed-off-by: kernel test robot <[email protected]>
--- corsair-cpro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/corsair-cpro.c +1 -1
@@ -474,7 +474,7 @@ static int ccp_probe(struct usb_interface *intf, const struct usb_device_id *id)return PTR_ERR_OR_ZERO (hwmon_dev); } -void ccp_disconnect (struct usb_interface *intf) +static void ccp_disconnect (struct usb_interface *intf) { }