hwmon: Add Corsair Commander Pro driver
Marius Zachmann
maintainerv4 cover hwmon: Add Corsair Commander Pro driver
This is v4 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
It is an usb driver, so it needs to be ignored by usbhid. (patch 3/3) This is based on the staging/hwmon tree.
---
Changes from v3
- add device ids to hid_ignore_list in hid-quirks.h
- removed unused update_interval
- ccp_disconnect is static
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
Marius Zachmann (3):
input: add to hid_ignore_list
add Documentation
add driver
Documentation/hwmon/corsair-cpro.rst | 40 +++ Documentation/hwmon/index.rst | 1 + MAINTAINERS | 6 + drivers/hid/hid-quirks.c | 2 + drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/corsair-cpro.c | 489 +++++++++++++++++++++++++++ 7 files changed, 549 insertions(+) create mode 100644 Documentation/hwmon/corsair-cpro.rst create mode 100644 drivers/hwmon/corsair-cpro.c
--
2.27.0
Marius Zachmann
maintainerPATCH v4 1/3 input: add to hid_ignore_list
--- drivers/hid/hid-quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-quirks.c +2 -0
@@ -699,6 +699,8 @@ static const struct hid_device_id hid_ignore_list[] = { { HID_USB_DEVICE(USB_VENDOR_ID_AXENTIA, USB_DEVICE_ID_AXENTIA_FM_RADIO) }, { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, 0x0c10) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, 0x1d00) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI4713) }, { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) },
Signature · 1 line
2.27.0
Marius Zachmann
maintainerPATCH v4 3/3 hwmon: add driver
In reply to Marius Zachmann--- MAINTAINERS | 6 + drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/corsair-cpro.c | 489 +++++++++++++++++++++++++++++++++++ 4 files changed, 506 insertions(+) create mode 100644 drivers/hwmon/corsair-cpro.c
MAINTAINERS +6 -0
@@ -4400,6 +4400,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 +489 -0
489 lines not on this page · raw message
Signature · 1 line
2.27.0
Marius Zachmann
maintainerPATCH v4 2/3 hwmon: add Documentation
In reply to Marius Zachmann--- Documentation/hwmon/corsair-cpro.rst | 40 ++++++++++++++++++++++++++++ Documentation/hwmon/index.rst | 1 + 2 files changed, 41 insertions(+) create mode 100644 Documentation/hwmon/corsair-cpro.rst
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
Signature · 1 line
2.27.0
Re: [PATCH v4 1/3] input: add to hid_ignore_list
In reply to Marius ZachmannHi Marius,
Quoted 2 lines · Marius Zachmann
Signed-off-by Marius Zachmann <[email protected]>
I wasn't Cc-ed on the cover letter (0/3) if any, but there are a few things to improve here (not code wise, I haven't reviewed the series, but on the form).
Every commit needs a commit message. And here, this particular commit just disables 2 device IDs from HID, which, without explanation seems like you decided to remove support for 2 keyboards from the kernel. So please add commit messages explaining *why* you are introducing a new driver/change in the code.
Then, it would be much better to have a single commit that disables the HID support and add the hwmon driver in one go. Leave the synchronisation between the trees to the maintainers, and keep it
simple: you can squash your 3 commits together, so it's one semantic action. This way, if there is a need to bisect or revert this patch, we won't have side effects and can revert just one patch. Think also that if someone needs that to be backported in a stable or a distribution kernel, it would make everyone's life simpler.
That being said, if you squash the 3 patches and provide a good enough explanation on the series, from a HID point of view, there should not be any reasons for us to not give an Ack.
Cheers,
Benjamin
Quoted 20 lines
--- drivers/hid/hid-quirks.c | 2 ++ 1 file changed, 2 insertions(+)drivers/hid/hid-quirks.c +2
-1@@ -699,6 +699,8 @@ static const struct hid_device_id hid_ignore_list[] = { { HID_USB_DEVICE(USB_VENDOR_ID_AXENTIA, USB_DEVICE_ID_AXENTIA_FM_RADIO) }, { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, 0x0c10) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, 0x1d00) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI4713) }, { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) }, --2.27.0