Skip to contentSkip to conversation

drivers/hwmon: Corsair Commander Pro driver

RFC Superseded Marius Zachmann 1 participant 1 message Jun 9, 2020

Subsystems (3)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Marius Zachmann

author maintainer
#0 lore raw

RFC 1/1 drivers/hwmon: Corsair Commander Pro driver

This is a driver for the Corsair Commander Pro.
Since this is my first addition to the kernel I would be happy, if you would take a look at it. I am using this driver on my computer at home and I had a few people test it.

The device:

The Corsair Commander Pro is a USB device, which is usually connected on the internal USB headers on the mainboard. It has 6 fan connectors, 4 thermal sensor connectors and 2 RGB connectors.
It also reads the voltages on the SATA connector, which it needs for power.

The driver:

I hope hwmon is the right place.
The driver is a HID driver, but it uses usb_bulk_msg for communication.
The device registers as a HID device and there are userspace tools, which use hidraw to access it. I think, it would be good to maintain compatibility with these tools, but the driver can easily be rewritten to be a pure USB driver. For now it can read temp sensors, fan speeds, voltage values and set pwm values.
It also reads the connection status on the fan headers.

There are a few more things, which I would like to add in the near future:
* Fan curves (not yet sure about the nicest way to provide sysfs access)
* Force 3pin or 4pin mode. (Sometimes the device doesn't detect the fans correctly)
* Setting fixed RPM

I do not work for Corsair and I intend to keep the driver maintainted as long as I use the device privately.

---
 Documentation/hwmon/corsair-cpro.rst |  42 +++
 MAINTAINERS                          |   6 +
 drivers/hwmon/Kconfig                |  10 +
 drivers/hwmon/Makefile               |   1 +
 drivers/hwmon/corsair-cpro.c         | 481 +++++++++++++++++++++++++++
 5 files changed, 540 insertions(+)
 create mode 100644 Documentation/hwmon/corsair-cpro.rst
 create mode 100644 drivers/hwmon/corsair-cpro.c
Documentation/hwmon/corsair-cpro.rst new file +42 -0
new file mode 100644
index 000000000000..d4ea1b6b9336
@@ -0,0 +1,42 @@
+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[0-3]_input		Connected temperature sensors
+
+fan[0-5]_input		Connected fan rpm.
+fan[0-5]_label		Shows connection status of the fan as detected by the
+			device.
+			"fanX nc"   no connection
+			"fanX 3pin" 3-pin fan detected
+			"fanX 4pin" 4-pin fan detected
+fan[0-5]_enable		the driver only reports fan speeds when 1
+pwm[0-5]		Sets the fan speed. Values from 0-255.
+			When reading, it reports the last value, which
+			was set by the driver.
MAINTAINERS +6 -0
index f08f290df174..169530c7eede 100644
@@ -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
index 288ae9f63588..9f5a808768ca 100644
@@ -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_HID
+	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
index 3e32c21f5efe..18e1ef74ade7 100644
@@ -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 +481 -0

481 lines not on this page · raw message

Signature · 1 line
2.27.0