hwmon: (aquacomputer_d5next) Add support for Aquacomputer Farbwerk
Aleksa Savic
maintainerPATCH 1/1 hwmon: (aquacomputer_d5next) Add support for Aquacomputer Farbwerk
Extend aquacomputer_d5next driver to expose hardware temperature sensors of the Aquacomputer Farbwerk RGB controller, which communicates through a proprietary USB HID protocol.
Four temperature sensors are available. Additionally, serial number and firmware version are exposed through debugfs.
Also, add Jack Doan to MAINTAINERS for this driver.
---
If adding to MAINTAINERS requires a separate commit, I'll send it separately.
--- Documentation/hwmon/aquacomputer_d5next.rst | 3 +- MAINTAINERS | 1 + drivers/hwmon/Kconfig | 5 +-- drivers/hwmon/aquacomputer_d5next.c | 37 ++++++++++++++++++--- 4 files changed, 38 insertions(+), 8 deletions(-)
Documentation/hwmon/aquacomputer_d5next.rst +2 -1
@@ -6,6 +6,7 @@ Kernel driver aquacomputer-d5next Supported devices: * Aquacomputer D5 Next watercooling pump +* Aquacomputer Farbwerk RGB controller * Aquacomputer Farbwerk 360 RGB controller * Aquacomputer Octo fan controller
@@ -32,7 +33,7 @@ better suited for userspace tools. The Octo exposes four temperature sensors and eight PWM controllable fans, along with their speed (in RPM), power, voltage and current. -The Farbwerk 360 exposes four temperature sensors. Depending on the device, +The Farbwerk and Farbwerk 360 expose four temperature sensors. Depending on the device, not all sysfs and debugfs entries will be available. Usage notes
MAINTAINERS +1 -0
@@ -1389,6 +1389,7 @@ F: drivers/media/i2c/aptina-pll.* AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER M: Aleksa Savic <[email protected]> +M: Jack Doan <[email protected]> L: [email protected] S: Maintained F: Documentation/hwmon/aquacomputer_d5next.rst
drivers/hwmon/Kconfig +3 -2
@@ -256,12 +256,13 @@ config SENSORS_AHT10 will be called aht10. config SENSORS_AQUACOMPUTER_D5NEXT - tristate "Aquacomputer D5 Next, Octo and Farbwerk 360" + tristate "Aquacomputer D5 Next, Octo, Farbwerk, Farbwerk 360" depends on USB_HID help If you say yes here you get support for sensors and fans of the Aquacomputer D5 Next watercooling pump, Octo fan - controller and Farbwerk 360 RGB controller, where available. + controller, Farbwerk and Farbwerk 360 RGB controllers, where + available. This driver can also be built as a module. If so, the module will be called aquacomputer_d5next.
drivers/hwmon/aquacomputer_d5next.c +32 -5
@@ -1,11 +1,12 @@// SPDX-License-Identifier: GPL-2.0+ /* -* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk 360, Octo) +* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo) * * Aquacomputer devices send HID reports (with ID 0x01) every second to report * sensor values. * * Copyright 2021 Aleksa Savic <[email protected]> +* Copyright 2022 Jack Doan <[email protected]> */ #include <linux/crc16.h>
@@ -19,14 +20,16 @@#include <asm/unaligned.h> #define USB_VENDOR_ID_AQUACOMPUTER 0x0c70 +#define USB_PRODUCT_ID_FARBWERK 0xf00a#define USB_PRODUCT_ID_D5NEXT 0xf00e#define USB_PRODUCT_ID_FARBWERK360 0xf010#define USB_PRODUCT_ID_OCTO 0xf011 -enum kinds { d5next, farbwerk360, octo }; +enum kinds { d5next, farbwerk, farbwerk360, octo };static const char *const aqc_device_names[] = { [d5next] ="d5next" , + [farbwerk] ="farbwerk" , [farbwerk360] ="farbwerk360" , [octo] ="octo" };
@@ -69,6 +72,12 @@ static u8 secondary_ctrl_report[] = {#define D5NEXT_PUMP_CURRENT 112#define D5NEXT_FAN_CURRENT 99 +/* Register offsets for the Farbwerk RGB controller */ +#define FARBWERK_NUM_SENSORS 4 +#define FARBWERK_SENSOR_START 0x2f +#define FARBWERK_SENSOR_SIZE 0x02 +#define FARBWERK_SENSOR_DISCONNECTED 0x7FFF +/* Register offsets for the Farbwerk 360 RGB controller */ #define FARBWERK360_NUM_SENSORS 4#define FARBWERK360_SENSOR_START 0x32
@@ -125,7 +134,7 @@ static const char *const label_d5next_current[] = {"Fan current" }; -/* Labels for Farbwerk 360 and Octo temperature sensors */ +/* Labels for Farbwerk, Farbwerk 360 and Octo temperature sensors */ static const char *const label_temp_sensors[] = {"Sensor 1" ,"Sensor 2" ,
@@ -319,6 +328,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3if (channel ==0 )return 0444 ;break ; +case farbwerk:case farbwerk360:case octo:return 0444 ;
@@ -551,8 +561,7 @@ static const struct hwmon_chip_info aqc_chip_info = { .info = aqc_info, }; -static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data, -int size) +static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data,int size) {int i, sensor_value;struct aqc_data *priv;
@@ -587,6 +596,17 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 priv->current_input[0 ] =get_unaligned_be16 (data +D5NEXT_PUMP_CURRENT ); priv->current_input[1 ] =get_unaligned_be16 (data +D5NEXT_FAN_CURRENT );break ; +case farbwerk: +/* Temperature sensor readings */ +for (i =0 ; i <FARBWERK_NUM_SENSORS ; i++) { + sensor_value =get_unaligned_be16 (data +FARBWERK_SENSOR_START + + i *FARBWERK_SENSOR_SIZE ); +if (sensor_value ==FARBWERK_SENSOR_DISCONNECTED ) + priv->temp_input[i] = -ENODATA ; +else + priv->temp_input[i] = sensor_value *10 ; + } +break ;case farbwerk360:/* Temperature sensor readings */ for (i =0 ; i <FARBWERK360_NUM_SENSORS ; i++) {
@@ -733,6 +753,11 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) priv->voltage_label = label_d5next_voltages; priv->current_label = label_d5next_current;break ; +case USB_PRODUCT_ID_FARBWERK : + priv->kind = farbwerk; + + priv->temp_label = label_temp_sensors; +break ;case USB_PRODUCT_ID_FARBWERK360 : priv->kind = farbwerk360;
@@ -795,6 +820,7 @@ static void aqc_remove(struct hid_device *hdev)static const struct hid_device_id aqc_table[] = { {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_D5NEXT ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK360 ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_OCTO ) }, { }
@@ -826,4 +852,5 @@ module_exit(aqc_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Aleksa Savic <[email protected]>" ); +MODULE_AUTHOR ("Jack Doan <[email protected]>" );MODULE_DESCRIPTION ("Hwmon driver for Aquacomputer devices" );
Signature · 1 line
2.35.1
Aleksa Savic
maintainerHi,
Just noticed that this patch is missing the "select CRC16" addition present in hwmon-next. I apologize for that, will fix in v2.
Thanks,
Aleksa
Guenter Roeck
maintainerQuoted 169 lines · Aleksa Savic
Extend
aquacomputer_d5nextdriver to expose hardware temperature sensors of the Aquacomputer Farbwerk RGB controller, which communicates through a proprietary USB HID protocol.Four temperature sensors are available. Additionally, serial number and firmware version are exposed through debugfs.
Also, add Jack Doan to
MAINTAINERSfor this driver.Signed-off-by Jack Doan <[email protected]>Signed-off-by Aleksa Savic <[email protected]>---
If adding toMAINTAINERSrequires a separate commit, I'll send it separately.--- Documentation/hwmon/aquacomputer_d5next.rst | 3 +- MAINTAINERS | 1 + drivers/hwmon/Kconfig | 5 +-- drivers/hwmon/aquacomputer_d5next.c | 37 ++++++++++++++++++--- 4 files changed, 38 insertions(+), 8 deletions(-)Documentation/hwmon/aquacomputer_d5next.rst +2
-1@@ -6,6 +6,7 @@ Kernel driver aquacomputer-d5next Supported devices: * Aquacomputer D5 Next watercooling pump +* Aquacomputer Farbwerk RGB controller * Aquacomputer Farbwerk 360 RGB controller * Aquacomputer Octo fan controller@@ -32,7 +33,7 @@ better suited for userspace tools. The Octo exposes four temperature sensors and eight PWM controllable fans, along with their speed (in RPM), power, voltage and current. -The Farbwerk 360 exposes four temperature sensors. Depending on the device, +The Farbwerk and Farbwerk 360 expose four temperature sensors. Depending on the device, not all sysfs and debugfs entries will be available. Usage notesMAINTAINERS +1
-0@@ -1389,6 +1389,7 @@ F: drivers/media/i2c/aptina-pll.* AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER M: Aleksa Savic <[email protected]> +M: Jack Doan <[email protected]> L: [email protected] S: Maintained F: Documentation/hwmon/aquacomputer_d5next.rstdrivers/hwmon/Kconfig +3
-2@@ -256,12 +256,13 @@ config SENSORS_AHT10 will be called aht10. config SENSORS_AQUACOMPUTER_D5NEXT - tristate "Aquacomputer D5 Next, Octo and Farbwerk 360" + tristate "Aquacomputer D5 Next, Octo, Farbwerk, Farbwerk 360" depends on USB_HID help If you say yes here you get support for sensors and fans of the Aquacomputer D5 Next watercooling pump, Octo fan - controller and Farbwerk 360 RGB controller, where available. + controller, Farbwerk and Farbwerk 360 RGB controllers, where + available. This driver can also be built as a module. If so, the module will be called aquacomputer_d5next.drivers/hwmon/aquacomputer_d5next.c +25
-5@@ -1,11 +1,12 @@// SPDX-License-Identifier: GPL-2.0+ /* -* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk 360, Octo) +* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo) * * Aquacomputer devices send HID reports (with ID 0x01) every second to report * sensor values. * * Copyright 2021 Aleksa Savic <[email protected]> +* Copyright 2022 Jack Doan <[email protected]> */ #include <linux/crc16.h> @@ -19,14 +20,16 @@#include <asm/unaligned.h> #define USB_VENDOR_ID_AQUACOMPUTER 0x0c70 +#define USB_PRODUCT_ID_FARBWERK 0xf00a#define USB_PRODUCT_ID_D5NEXT 0xf00e#define USB_PRODUCT_ID_FARBWERK360 0xf010#define USB_PRODUCT_ID_OCTO 0xf011 -enum kinds { d5next, farbwerk360, octo }; +enum kinds { d5next, farbwerk, farbwerk360, octo };static const char *const aqc_device_names[] = { [d5next] ="d5next" , + [farbwerk] ="farbwerk" , [farbwerk360] ="farbwerk360" , [octo] ="octo" };@@ -69,6 +72,12 @@ static u8 secondary_ctrl_report[] = {#define D5NEXT_PUMP_CURRENT 112#define D5NEXT_FAN_CURRENT 99 +/* Register offsets for the Farbwerk RGB controller */ +#define FARBWERK_NUM_SENSORS 4 +#define FARBWERK_SENSOR_START 0x2f +#define FARBWERK_SENSOR_SIZE 0x02 +#define FARBWERK_SENSOR_DISCONNECTED 0x7FFF +/* Register offsets for the Farbwerk 360 RGB controller */ #define FARBWERK360_NUM_SENSORS 4#define FARBWERK360_SENSOR_START 0x32@@ -125,7 +134,7 @@ static const char *const label_d5next_current[] = {"Fan current" }; -/* Labels for Farbwerk 360 and Octo temperature sensors */ +/* Labels for Farbwerk, Farbwerk 360 and Octo temperature sensors */ static const char *const label_temp_sensors[] = {"Sensor 1" ,"Sensor 2" ,@@ -319,6 +328,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3if (channel ==0 )return 0444 ;break ; +case farbwerk:case farbwerk360:case octo:return 0444 ;@@ -551,8 +561,7 @@ static const struct hwmon_chip_info aqc_chip_info = { .info = aqc_info, }; -static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data, -int size) +static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data,int size) {int i, sensor_value;struct aqc_data *priv;@@ -587,6 +596,17 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 priv->current_input[0 ] =get_unaligned_be16 (data +D5NEXT_PUMP_CURRENT ); priv->current_input[1 ] =get_unaligned_be16 (data +D5NEXT_FAN_CURRENT );break ; +case farbwerk: +/* Temperature sensor readings */ +for (i =0 ; i <FARBWERK_NUM_SENSORS ; i++) { + sensor_value =get_unaligned_be16 (data +FARBWERK_SENSOR_START + + i *FARBWERK_SENSOR_SIZE ); +if (sensor_value ==FARBWERK_SENSOR_DISCONNECTED ) + priv->temp_input[i] = -ENODATA ; +else + priv->temp_input[i] = sensor_value *10 ; + } +break ;case farbwerk360:/* Temperature sensor readings */ for (i =0 ; i <FARBWERK360_NUM_SENSORS ; i++) {
drivers/hwmon/aquacomputer_d5next.c static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) · line 758
Quoted 6 lines
drivers/hwmon/aquacomputer_d5next.c +3
-0@@ -733,6 +753,11 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) priv->voltage_label = label_d5next_voltages; priv->current_label = label_d5next_current;break ; +case USB_PRODUCT_ID_FARBWERK : + priv->kind = farbwerk; +
Any special reason for this empty line ? It seems kind of random.
Guenter
Quoted 22 lines
drivers/hwmon/aquacomputer_d5next.c +4
-0+ priv->temp_label = label_temp_sensors; +break ;case USB_PRODUCT_ID_FARBWERK360 : priv->kind = farbwerk360;@@ -795,6 +820,7 @@ static void aqc_remove(struct hid_device *hdev)static const struct hid_device_id aqc_table[] = { {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_D5NEXT ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK360 ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_OCTO ) }, { }@@ -826,4 +852,5 @@ module_exit(aqc_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Aleksa Savic <[email protected]>" ); +MODULE_AUTHOR ("Jack Doan <[email protected]>" );MODULE_DESCRIPTION ("Hwmon driver for Aquacomputer devices" );Signature · 1 line
2.35.1
Aleksa Savic
maintainerQuoted 180 lines · Guenter Roeck
Quoted 169 lines · Aleksa Savic
Extend
aquacomputer_d5nextdriver to expose hardware temperature sensors of the Aquacomputer Farbwerk RGB controller, which communicates through a proprietary USB HID protocol.Four temperature sensors are available. Additionally, serial number and firmware version are exposed through debugfs.
Also, add Jack Doan to
MAINTAINERSfor this driver.Signed-off-by Jack Doan <[email protected]>Signed-off-by Aleksa Savic <[email protected]>---
If adding toMAINTAINERSrequires a separate commit, I'll send it separately.--- Documentation/hwmon/aquacomputer_d5next.rst | 3 +- MAINTAINERS | 1 + drivers/hwmon/Kconfig | 5 +-- drivers/hwmon/aquacomputer_d5next.c | 37 ++++++++++++++++++--- 4 files changed, 38 insertions(+), 8 deletions(-)Documentation/hwmon/aquacomputer_d5next.rst +2
-1@@ -6,6 +6,7 @@ Kernel driver aquacomputer-d5next Supported devices: * Aquacomputer D5 Next watercooling pump +* Aquacomputer Farbwerk RGB controller * Aquacomputer Farbwerk 360 RGB controller * Aquacomputer Octo fan controller@@ -32,7 +33,7 @@ better suited for userspace tools. The Octo exposes four temperature sensors and eight PWM controllable fans, along with their speed (in RPM), power, voltage and current. -The Farbwerk 360 exposes four temperature sensors. Depending on the device, +The Farbwerk and Farbwerk 360 expose four temperature sensors. Depending on the device, not all sysfs and debugfs entries will be available. Usage notesMAINTAINERS +1
-0@@ -1389,6 +1389,7 @@ F: drivers/media/i2c/aptina-pll.* AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER M: Aleksa Savic <[email protected]> +M: Jack Doan <[email protected]> L: [email protected] S: Maintained F: Documentation/hwmon/aquacomputer_d5next.rstdrivers/hwmon/Kconfig +3
-2@@ -256,12 +256,13 @@ config SENSORS_AHT10 will be called aht10. config SENSORS_AQUACOMPUTER_D5NEXT - tristate "Aquacomputer D5 Next, Octo and Farbwerk 360" + tristate "Aquacomputer D5 Next, Octo, Farbwerk, Farbwerk 360" depends on USB_HID help If you say yes here you get support for sensors and fans of the Aquacomputer D5 Next watercooling pump, Octo fan - controller and Farbwerk 360 RGB controller, where available. + controller, Farbwerk and Farbwerk 360 RGB controllers, where + available. This driver can also be built as a module. If so, the module will be called aquacomputer_d5next.drivers/hwmon/aquacomputer_d5next.c +25
-5@@ -1,11 +1,12 @@// SPDX-License-Identifier: GPL-2.0+ /* -* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk 360, Octo) +* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo) * * Aquacomputer devices send HID reports (with ID 0x01) every second to report * sensor values. * * Copyright 2021 Aleksa Savic <[email protected]> +* Copyright 2022 Jack Doan <[email protected]> */ #include <linux/crc16.h> @@ -19,14 +20,16 @@#include <asm/unaligned.h> #define USB_VENDOR_ID_AQUACOMPUTER 0x0c70 +#define USB_PRODUCT_ID_FARBWERK 0xf00a#define USB_PRODUCT_ID_D5NEXT 0xf00e#define USB_PRODUCT_ID_FARBWERK360 0xf010#define USB_PRODUCT_ID_OCTO 0xf011 -enum kinds { d5next, farbwerk360, octo }; +enum kinds { d5next, farbwerk, farbwerk360, octo };static const char *const aqc_device_names[] = { [d5next] ="d5next" , + [farbwerk] ="farbwerk" , [farbwerk360] ="farbwerk360" , [octo] ="octo" };@@ -69,6 +72,12 @@ static u8 secondary_ctrl_report[] = {#define D5NEXT_PUMP_CURRENT 112#define D5NEXT_FAN_CURRENT 99 +/* Register offsets for the Farbwerk RGB controller */ +#define FARBWERK_NUM_SENSORS 4 +#define FARBWERK_SENSOR_START 0x2f +#define FARBWERK_SENSOR_SIZE 0x02 +#define FARBWERK_SENSOR_DISCONNECTED 0x7FFF +/* Register offsets for the Farbwerk 360 RGB controller */ #define FARBWERK360_NUM_SENSORS 4#define FARBWERK360_SENSOR_START 0x32@@ -125,7 +134,7 @@ static const char *const label_d5next_current[] = {"Fan current" }; -/* Labels for Farbwerk 360 and Octo temperature sensors */ +/* Labels for Farbwerk, Farbwerk 360 and Octo temperature sensors */ static const char *const label_temp_sensors[] = {"Sensor 1" ,"Sensor 2" ,@@ -319,6 +328,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3if (channel ==0 )return 0444 ;break ; +case farbwerk:case farbwerk360:case octo:return 0444 ;@@ -551,8 +561,7 @@ static const struct hwmon_chip_info aqc_chip_info = { .info = aqc_info, }; -static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data, -int size) +static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data,int size) {int i, sensor_value;struct aqc_data *priv;@@ -587,6 +596,17 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 priv->current_input[0 ] =get_unaligned_be16 (data +D5NEXT_PUMP_CURRENT ); priv->current_input[1 ] =get_unaligned_be16 (data +D5NEXT_FAN_CURRENT );break ; +case farbwerk: +/* Temperature sensor readings */ +for (i =0 ; i <FARBWERK_NUM_SENSORS ; i++) { + sensor_value =get_unaligned_be16 (data +FARBWERK_SENSOR_START + + i *FARBWERK_SENSOR_SIZE ); +if (sensor_value ==FARBWERK_SENSOR_DISCONNECTED ) + priv->temp_input[i] = -ENODATA ; +else + priv->temp_input[i] = sensor_value *10 ; + } +break ;case farbwerk360:/* Temperature sensor readings */ for (i =0 ; i <FARBWERK360_NUM_SENSORS ; i++) {drivers/hwmon/aquacomputer_d5next.c static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) · line 758
Quoted 6 lines
drivers/hwmon/aquacomputer_d5next.c +3
-0@@ -733,6 +753,11 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) priv->voltage_label = label_d5next_voltages; priv->current_label = label_d5next_current;break ; +case USB_PRODUCT_ID_FARBWERK : + priv->kind = farbwerk; +Any special reason for this empty line ? It seems kind of random.
Quoted 2 lines
Guenter
That's how code in other cases of that switch is formatted (not visible from this patch directly), setting priv->kind and then the appropriate labels.
Thanks,
Aleksa
Quoted 22 lines
Quoted 22 lines
drivers/hwmon/aquacomputer_d5next.c +4
-0+ priv->temp_label = label_temp_sensors; +break ;case USB_PRODUCT_ID_FARBWERK360 : priv->kind = farbwerk360;@@ -795,6 +820,7 @@ static void aqc_remove(struct hid_device *hdev)static const struct hid_device_id aqc_table[] = { {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_D5NEXT ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK360 ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_OCTO ) }, { }@@ -826,4 +852,5 @@ module_exit(aqc_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Aleksa Savic <[email protected]>" ); +MODULE_AUTHOR ("Jack Doan <[email protected]>" );MODULE_DESCRIPTION ("Hwmon driver for Aquacomputer devices" );Signature · 1 line
2.35.1
Guenter Roeck
maintainerOn Sat, Apr 23, 2022 at 06:23:46PM +0200, Aleksa Savic wrote:
[ ... ]
Quoted 7 lines
Quoted 7 lines
drivers/hwmon/aquacomputer_d5next.c static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) · line 758
Quoted 3 lines
drivers/hwmon/aquacomputer_d5next.c +3
-0+case USB_PRODUCT_ID_FARBWERK : + priv->kind = farbwerk; +Any special reason for this empty line ? It seems kind of random.
Quoted 7 lines
Quoted 2 lines
Guenter
That's how code in other cases of that switch is formatted (not visible from this patch directly), setting
priv->kindand then the appropriate labels.
Ah, ok. Looks odd here, but makes sense.
Thanks,
Guenter
Guenter Roeck
maintainerQuoted 4 lines · Aleksa Savic
Extend
aquacomputer_d5nextdriver to expose hardware temperature sensors of the Aquacomputer Farbwerk RGB controller, which communicates through a proprietary USB HID protocol.
Quoted 8 lines
Four temperature sensors are available. Additionally, serial number and firmware version are exposed through debugfs.
Also, add Jack Doan to
MAINTAINERSfor this driver.Signed-off-by Jack Doan <[email protected]>Signed-off-by Aleksa Savic <[email protected]>---
This patch doesn't apply. Please rebase to master and resend.
More comments inline.
Quoted 67 lines
If adding to
MAINTAINERSrequires a separate commit, I'll send it separately.--- Documentation/hwmon/aquacomputer_d5next.rst | 3 +- MAINTAINERS | 1 + drivers/hwmon/Kconfig | 5 +-- drivers/hwmon/aquacomputer_d5next.c | 37 ++++++++++++++++++--- 4 files changed, 38 insertions(+), 8 deletions(-)Documentation/hwmon/aquacomputer_d5next.rst +2
-1@@ -6,6 +6,7 @@ Kernel driver aquacomputer-d5next Supported devices: * Aquacomputer D5 Next watercooling pump +* Aquacomputer Farbwerk RGB controller * Aquacomputer Farbwerk 360 RGB controller * Aquacomputer Octo fan controller@@ -32,7 +33,7 @@ better suited for userspace tools. The Octo exposes four temperature sensors and eight PWM controllable fans, along with their speed (in RPM), power, voltage and current. -The Farbwerk 360 exposes four temperature sensors. Depending on the device, +The Farbwerk and Farbwerk 360 expose four temperature sensors. Depending on the device, not all sysfs and debugfs entries will be available. Usage notesMAINTAINERS +1
-0@@ -1389,6 +1389,7 @@ F: drivers/media/i2c/aptina-pll.* AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER M: Aleksa Savic <[email protected]> +M: Jack Doan <[email protected]> L: [email protected] S: Maintained F: Documentation/hwmon/aquacomputer_d5next.rstdrivers/hwmon/Kconfig +3
-2@@ -256,12 +256,13 @@ config SENSORS_AHT10 will be called aht10. config SENSORS_AQUACOMPUTER_D5NEXT - tristate "Aquacomputer D5 Next, Octo and Farbwerk 360" + tristate "Aquacomputer D5 Next, Octo, Farbwerk, Farbwerk 360" depends on USB_HID help If you say yes here you get support for sensors and fans of the Aquacomputer D5 Next watercooling pump, Octo fan - controller and Farbwerk 360 RGB controller, where available. + controller, Farbwerk and Farbwerk 360 RGB controllers, where + available. This driver can also be built as a module. If so, the module will be called aquacomputer_d5next.drivers/hwmon/aquacomputer_d5next.c +0
-0
drivers/hwmon/aquacomputer_d5next.c line 9
Quoted 10 lines
drivers/hwmon/aquacomputer_d5next.c +2
-1@@ -1,11 +1,12 @@// SPDX-License-Identifier: GPL-2.0+ /* -* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk 360, Octo) +* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo) * * Aquacomputer devices send HID reports (with ID 0x01) every second to report * sensor values. * * Copyright 2021 Aleksa Savic <[email protected]> +* Copyright 2022 Jack Doan <[email protected]>
That is a bit aggressive for a few lines of code.
Quoted 62 lines
drivers/hwmon/aquacomputer_d5next.c +12
-4*/ #include <linux/crc16.h> @@ -19,14 +20,16 @@#include <asm/unaligned.h> #define USB_VENDOR_ID_AQUACOMPUTER 0x0c70 +#define USB_PRODUCT_ID_FARBWERK 0xf00a#define USB_PRODUCT_ID_D5NEXT 0xf00e#define USB_PRODUCT_ID_FARBWERK360 0xf010#define USB_PRODUCT_ID_OCTO 0xf011 -enum kinds { d5next, farbwerk360, octo }; +enum kinds { d5next, farbwerk, farbwerk360, octo };static const char *const aqc_device_names[] = { [d5next] ="d5next" , + [farbwerk] ="farbwerk" , [farbwerk360] ="farbwerk360" , [octo] ="octo" };@@ -69,6 +72,12 @@ static u8 secondary_ctrl_report[] = {#define D5NEXT_PUMP_CURRENT 112#define D5NEXT_FAN_CURRENT 99 +/* Register offsets for the Farbwerk RGB controller */ +#define FARBWERK_NUM_SENSORS 4 +#define FARBWERK_SENSOR_START 0x2f +#define FARBWERK_SENSOR_SIZE 0x02 +#define FARBWERK_SENSOR_DISCONNECTED 0x7FFF +/* Register offsets for the Farbwerk 360 RGB controller */ #define FARBWERK360_NUM_SENSORS 4#define FARBWERK360_SENSOR_START 0x32@@ -125,7 +134,7 @@ static const char *const label_d5next_current[] = {"Fan current" }; -/* Labels for Farbwerk 360 and Octo temperature sensors */ +/* Labels for Farbwerk, Farbwerk 360 and Octo temperature sensors */ static const char *const label_temp_sensors[] = {"Sensor 1" ,"Sensor 2" ,@@ -319,6 +328,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3if (channel ==0 )return 0444 ;break ; +case farbwerk:case farbwerk360:case octo:return 0444 ;@@ -551,8 +561,7 @@ static const struct hwmon_chip_info aqc_chip_info = { .info = aqc_info, }; -static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data, -int size) +static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data,int size) {int i, sensor_value;struct aqc_data *priv;
drivers/hwmon/aquacomputer_d5next.c static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 · line 605
Quoted 10 lines
drivers/hwmon/aquacomputer_d5next.c +7
-0@@ -587,6 +596,17 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 priv->current_input[0 ] =get_unaligned_be16 (data +D5NEXT_PUMP_CURRENT ); priv->current_input[1 ] =get_unaligned_be16 (data +D5NEXT_FAN_CURRENT );break ; +case farbwerk: +/* Temperature sensor readings */ +for (i =0 ; i <FARBWERK_NUM_SENSORS ; i++) { + sensor_value =get_unaligned_be16 (data +FARBWERK_SENSOR_START + + i *FARBWERK_SENSOR_SIZE ); +if (sensor_value ==FARBWERK_SENSOR_DISCONNECTED ) + priv->temp_input[i] = -ENODATA ;
Can the sensor be connected dynamically ? If not, this should be handled in an is_visible function.
Quoted 28 lines
drivers/hwmon/aquacomputer_d5next.c +10
-0+else + priv->temp_input[i] = sensor_value *10 ; + } +break ;case farbwerk360:/* Temperature sensor readings */ for (i =0 ; i <FARBWERK360_NUM_SENSORS ; i++) {@@ -733,6 +753,11 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) priv->voltage_label = label_d5next_voltages; priv->current_label = label_d5next_current;break ; +case USB_PRODUCT_ID_FARBWERK : + priv->kind = farbwerk; + + priv->temp_label = label_temp_sensors; +break ;case USB_PRODUCT_ID_FARBWERK360 : priv->kind = farbwerk360;@@ -795,6 +820,7 @@ static void aqc_remove(struct hid_device *hdev)static const struct hid_device_id aqc_table[] = { {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_D5NEXT ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK360 ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_OCTO ) }, { }
drivers/hwmon/aquacomputer_d5next.c module_exit(aqc_exit); · line 855
Quoted 4 lines
drivers/hwmon/aquacomputer_d5next.c +1
-0@@ -826,4 +852,5 @@ module_exit(aqc_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Aleksa Savic <[email protected]>" ); +MODULE_AUTHOR ("Jack Doan <[email protected]>" );
.... as is claiming authorship. I'd be the "author" of hundreds of kernel files if I would do that. Aleksa signed off on it, so I'll accept it, but I don't think it is appropriate.
Quoted 1 line
drivers/hwmon/aquacomputer_d5next.c +0
-0MODULE_DESCRIPTION ("Hwmon driver for Aquacomputer devices" );
Jack Doan
maintainerQuoted 8 lines · Guenter Roeck
Quoted 7 lines · Aleksa Savic
Extend
aquacomputer_d5nextdriver to expose hardware temperature sensors of the Aquacomputer Farbwerk RGB controller, which communicates through a proprietary USB HID protocol.Four temperature sensors are available. Additionally, serial number and firmware version are exposed through debugfs.
Quoted 8 lines
Quoted 5 lines
Also, add Jack Doan to
MAINTAINERSfor this driver.Signed-off-by Jack Doan <[email protected]>Signed-off-by Aleksa Savic <[email protected]>---
This patch doesn't apply. Please rebase to master and resend.
Will do!
Quoted 73 lines
More comments inline.
Quoted 71 lines
If adding to
MAINTAINERSrequires a separate commit, I'll send it separately.--- Documentation/hwmon/aquacomputer_d5next.rst | 3 +- MAINTAINERS | 1 + drivers/hwmon/Kconfig | 5 +-- drivers/hwmon/aquacomputer_d5next.c | 37 ++++++++++++++++++--- 4 files changed, 38 insertions(+), 8 deletions(-)Documentation/hwmon/aquacomputer_d5next.rst +2
-1@@ -6,6 +6,7 @@ Kernel driver aquacomputer-d5next Supported devices: * Aquacomputer D5 Next watercooling pump +* Aquacomputer Farbwerk RGB controller * Aquacomputer Farbwerk 360 RGB controller * Aquacomputer Octo fan controller@@ -32,7 +33,7 @@ better suited for userspace tools. The Octo exposes four temperature sensors and eight PWM controllable fans, along with their speed (in RPM), power, voltage and current. -The Farbwerk 360 exposes four temperature sensors. Depending on the device, +The Farbwerk and Farbwerk 360 expose four temperature sensors. Depending on the device, not all sysfs and debugfs entries will be available. Usage notesMAINTAINERS +1
-0@@ -1389,6 +1389,7 @@ F: drivers/media/i2c/aptina-pll.* AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER M: Aleksa Savic <[email protected]> +M: Jack Doan <[email protected]> L: [email protected] S: Maintained F: Documentation/hwmon/aquacomputer_d5next.rstdrivers/hwmon/Kconfig +3
-2@@ -256,12 +256,13 @@ config SENSORS_AHT10 will be called aht10. config SENSORS_AQUACOMPUTER_D5NEXT - tristate "Aquacomputer D5 Next, Octo and Farbwerk 360" + tristate "Aquacomputer D5 Next, Octo, Farbwerk, Farbwerk 360" depends on USB_HID help If you say yes here you get support for sensors and fans of the Aquacomputer D5 Next watercooling pump, Octo fan - controller and Farbwerk 360 RGB controller, where available. + controller, Farbwerk and Farbwerk 360 RGB controllers, where + available. This driver can also be built as a module. If so, the module will be called aquacomputer_d5next.drivers/hwmon/aquacomputer_d5next.c +1
-1@@ -1,11 +1,12 @@// SPDX-License-Identifier: GPL-2.0+ /* -* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk 360, Octo) +* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo)
Quoted 8 lines
drivers/hwmon/aquacomputer_d5next.c line 9
Quoted 6 lines
drivers/hwmon/aquacomputer_d5next.c +1
-0* * Aquacomputer devices send HID reports (with ID 0x01) every second to report * sensor values. * * Copyright 2021 Aleksa Savic <[email protected]> +* Copyright 2022 Jack Doan <[email protected]> That is a bit aggressive for a few lines of code.
Addressed below.
Quoted 68 lines
Quoted 68 lines
drivers/hwmon/aquacomputer_d5next.c +14
-4*/ #include <linux/crc16.h> @@ -19,14 +20,16 @@#include <asm/unaligned.h> #define USB_VENDOR_ID_AQUACOMPUTER 0x0c70 +#define USB_PRODUCT_ID_FARBWERK 0xf00a#define USB_PRODUCT_ID_D5NEXT 0xf00e#define USB_PRODUCT_ID_FARBWERK360 0xf010#define USB_PRODUCT_ID_OCTO 0xf011 -enum kinds { d5next, farbwerk360, octo }; +enum kinds { d5next, farbwerk, farbwerk360, octo };static const char *const aqc_device_names[] = { [d5next] ="d5next" , + [farbwerk] ="farbwerk" , [farbwerk360] ="farbwerk360" , [octo] ="octo" };@@ -69,6 +72,12 @@ static u8 secondary_ctrl_report[] = {#define D5NEXT_PUMP_CURRENT 112#define D5NEXT_FAN_CURRENT 99 +/* Register offsets for the Farbwerk RGB controller */ +#define FARBWERK_NUM_SENSORS 4 +#define FARBWERK_SENSOR_START 0x2f +#define FARBWERK_SENSOR_SIZE 0x02 +#define FARBWERK_SENSOR_DISCONNECTED 0x7FFF +/* Register offsets for the Farbwerk 360 RGB controller */ #define FARBWERK360_NUM_SENSORS 4#define FARBWERK360_SENSOR_START 0x32@@ -125,7 +134,7 @@ static const char *const label_d5next_current[] = {"Fan current" }; -/* Labels for Farbwerk 360 and Octo temperature sensors */ +/* Labels for Farbwerk, Farbwerk 360 and Octo temperature sensors */ static const char *const label_temp_sensors[] = {"Sensor 1" ,"Sensor 2" ,@@ -319,6 +328,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3if (channel ==0 )return 0444 ;break ; +case farbwerk:case farbwerk360:case octo:return 0444 ;@@ -551,8 +561,7 @@ static const struct hwmon_chip_info aqc_chip_info = { .info = aqc_info, }; -static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data, -int size) +static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data,int size) {int i, sensor_value;struct aqc_data *priv;@@ -587,6 +596,17 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 priv->current_input[0 ] =get_unaligned_be16 (data +D5NEXT_PUMP_CURRENT ); priv->current_input[1 ] =get_unaligned_be16 (data +D5NEXT_FAN_CURRENT );break ; +case farbwerk: +/* Temperature sensor readings */
Quoted 9 lines
drivers/hwmon/aquacomputer_d5next.c static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 · line 605
Quoted 5 lines
drivers/hwmon/aquacomputer_d5next.c +5
-0+for (i =0 ; i <FARBWERK_NUM_SENSORS ; i++) { + sensor_value =get_unaligned_be16 (data +FARBWERK_SENSOR_START + + i *FARBWERK_SENSOR_SIZE ); +if (sensor_value ==FARBWERK_SENSOR_DISCONNECTED ) + priv->temp_input[i] = -ENODATA ;Can the sensor be connected dynamically ? If not, this should be handled in an
is_visiblefunction.
It's a somewhat unlikely use-case, but yes, they can be. The sensors are NTC thermistors that connect to pin-headers. Do we have a better way of representing "open circuit" than -ENODATA?
Quoted 29 lines
Quoted 29 lines
drivers/hwmon/aquacomputer_d5next.c +10
-0+else + priv->temp_input[i] = sensor_value *10 ; + } +break ;case farbwerk360:/* Temperature sensor readings */ for (i =0 ; i <FARBWERK360_NUM_SENSORS ; i++) {@@ -733,6 +753,11 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) priv->voltage_label = label_d5next_voltages; priv->current_label = label_d5next_current;break ; +case USB_PRODUCT_ID_FARBWERK : + priv->kind = farbwerk; + + priv->temp_label = label_temp_sensors; +break ;case USB_PRODUCT_ID_FARBWERK360 : priv->kind = farbwerk360;@@ -795,6 +820,7 @@ static void aqc_remove(struct hid_device *hdev)static const struct hid_device_id aqc_table[] = { {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_D5NEXT ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK360 ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_OCTO ) }, { }@@ -826,4 +852,5 @@ module_exit(aqc_exit);
Quoted 7 lines
drivers/hwmon/aquacomputer_d5next.c module_exit(aqc_exit); · line 855
Quoted 3 lines
drivers/hwmon/aquacomputer_d5next.c +1
-0MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Aleksa Savic <[email protected]>" ); +MODULE_AUTHOR ("Jack Doan <[email protected]>" );.... as is claiming authorship. I'd be the "author" of hundreds of kernel files if I would do that. Aleksa signed off on it, so I'll accept it, but I don't think it is appropriate.
In the context of just this patch, yes, I agree. But, I felt it was warranted based on my previous contributions. I did a good bit of the reverse-engineering that made writing settings to these devices possible, and a lot of the previously submitted code for writing the setting changes is mine as well.
I didn't mean to make an inappropriate request though! If you'd like, I can submit a version of the patch without these lines.
Also I'm really sorry if you get this email twice. Thunderbird seems to have snuck HTML into my emails and the mailinglist rejected my first reply. I've switched to mutt to prevent this.
Quoted 2 lines
Quoted 2 lines
drivers/hwmon/aquacomputer_d5next.c +0
-0MODULE_DESCRIPTION ("Hwmon driver for Aquacomputer devices" );
A message that is not in the archive (sent off-list or not yet received): [email protected]
Guenter Roeck
maintainerQuoted 172 lines · Jack Doan
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Aleksa Savic
Extend
aquacomputer_d5nextdriver to expose hardware temperature sensors of the Aquacomputer Farbwerk RGB controller, which communicates through a proprietary USB HID protocol.Four temperature sensors are available. Additionally, serial number and firmware version are exposed through debugfs.
Quoted 6 lines
Quoted 5 lines
Also, add Jack Doan to
MAINTAINERSfor this driver.Signed-off-by Jack Doan<[email protected]>Signed-off-by Aleksa Savic<[email protected]>---
This patch doesn't apply. Please rebase to master and resend.
Will do!
Quoted 72 lines
More comments inline.
Quoted 70 lines
If adding to
MAINTAINERSrequires a separate commit, I'll send it separately.--- Documentation/hwmon/aquacomputer_d5next.rst | 3 +- MAINTAINERS | 1 + drivers/hwmon/Kconfig | 5 +-- drivers/hwmon/aquacomputer_d5next.c | 37 ++++++++++++++++++--- 4 files changed, 38 insertions(+), 8 deletions(-)Documentation/hwmon/aquacomputer_d5next.rst +2
-1@@ -6,6 +6,7 @@ Kernel driver aquacomputer-d5next Supported devices: * Aquacomputer D5 Next watercooling pump +* Aquacomputer Farbwerk RGB controller * Aquacomputer Farbwerk 360 RGB controller * Aquacomputer Octo fan controller@@ -32,7 +33,7 @@ better suited for userspace tools. The Octo exposes four temperature sensors and eight PWM controllable fans, along with their speed (in RPM), power, voltage and current. -The Farbwerk 360 exposes four temperature sensors. Depending on the device, +The Farbwerk and Farbwerk 360 expose four temperature sensors. Depending on the device, not all sysfs and debugfs entries will be available. Usage notesMAINTAINERS +1
-0@@ -1389,6 +1389,7 @@ F: drivers/media/i2c/aptina-pll.* AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER M: Aleksa Savic<[email protected]> +M: Jack Doan<[email protected]> L: [email protected] S: Maintained F: Documentation/hwmon/aquacomputer_d5next.rstdrivers/hwmon/Kconfig +3
-2@@ -256,12 +256,13 @@ config SENSORS_AHT10 will be called aht10. config SENSORS_AQUACOMPUTER_D5NEXT - tristate "Aquacomputer D5 Next, Octo and Farbwerk 360" + tristate "Aquacomputer D5 Next, Octo, Farbwerk, Farbwerk 360" depends on USB_HID help If you say yes here you get support for sensors and fans of the Aquacomputer D5 Next watercooling pump, Octo fan - controller and Farbwerk 360 RGB controller, where available. + controller, Farbwerk and Farbwerk 360 RGB controllers, where + available. This driver can also be built as a module. If so, the module will be called aquacomputer_d5next.drivers/hwmon/aquacomputer_d5next.c +0
-1@@ -1,11 +1,12 @@// SPDX-License-Identifier: GPL-2.0+ /* -* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk 360, Octo) Quoted 8 lines
drivers/hwmon/aquacomputer_d5next.c
Quoted 7 lines
drivers/hwmon/aquacomputer_d5next.c +2
-0+* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo) * * Aquacomputer devices send HID reports (with ID 0x01) every second to report * sensor values. * * Copyright 2021 Aleksa Savic<[email protected]> +* Copyright 2022 Jack Doan<[email protected]> That is a bit aggressive for a few lines of code.
Addressed below.
Quoted 66 lines
Quoted 66 lines
drivers/hwmon/aquacomputer_d5next.c +13
-4*/ #include <linux/crc16.h> @@ -19,14 +20,16 @@#include <asm/unaligned.h> #define USB_VENDOR_ID_AQUACOMPUTER 0x0c70 +#define USB_PRODUCT_ID_FARBWERK 0xf00a#define USB_PRODUCT_ID_D5NEXT 0xf00e#define USB_PRODUCT_ID_FARBWERK360 0xf010#define USB_PRODUCT_ID_OCTO 0xf011 -enum kinds { d5next, farbwerk360, octo }; +enum kinds { d5next, farbwerk, farbwerk360, octo };static const char *const aqc_device_names[] = { [d5next] ="d5next" , + [farbwerk] ="farbwerk" , [farbwerk360] ="farbwerk360" , [octo] ="octo" };@@ -69,6 +72,12 @@ static u8 secondary_ctrl_report[] = {#define D5NEXT_PUMP_CURRENT 112#define D5NEXT_FAN_CURRENT 99 +/* Register offsets for the Farbwerk RGB controller */ +#define FARBWERK_NUM_SENSORS 4 +#define FARBWERK_SENSOR_START 0x2f +#define FARBWERK_SENSOR_SIZE 0x02 +#define FARBWERK_SENSOR_DISCONNECTED 0x7FFF +/* Register offsets for the Farbwerk 360 RGB controller */ #define FARBWERK360_NUM_SENSORS 4#define FARBWERK360_SENSOR_START 0x32@@ -125,7 +134,7 @@ static const char *const label_d5next_current[] = {"Fan current" }; -/* Labels for Farbwerk 360 and Octo temperature sensors */ +/* Labels for Farbwerk, Farbwerk 360 and Octo temperature sensors */ static const char *const label_temp_sensors[] = {"Sensor 1" ,"Sensor 2" ,@@ -319,6 +328,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3if (channel ==0 )return 0444 ;break ; +case farbwerk:case farbwerk360:case octo:return 0444 ;@@ -551,8 +561,7 @@ static const struct hwmon_chip_info aqc_chip_info = { .info = aqc_info, }; -static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data, -int size) +static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data,int size) {int i, sensor_value;struct aqc_data *priv;@@ -587,6 +596,17 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 priv->current_input[0 ] =get_unaligned_be16 (data +D5NEXT_PUMP_CURRENT ); priv->current_input[1 ] =get_unaligned_be16 (data +D5NEXT_FAN_CURRENT );break ; +case farbwerk:Quoted 8 lines
drivers/hwmon/aquacomputer_d5next.c static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 · line 605
Quoted 6 lines
drivers/hwmon/aquacomputer_d5next.c +6
-0+/* Temperature sensor readings */ +for (i =0 ; i <FARBWERK_NUM_SENSORS ; i++) { + sensor_value =get_unaligned_be16 (data +FARBWERK_SENSOR_START + + i *FARBWERK_SENSOR_SIZE ); +if (sensor_value ==FARBWERK_SENSOR_DISCONNECTED ) + priv->temp_input[i] = -ENODATA ;Can the sensor be connected dynamically ? If not, this should be handled in an
is_visiblefunction.
Quoted 1 line
It's a somewhat unlikely use-case, but yes, they can be. The sensors are NTC thermistors that connect to pin-headers. Do we have a better way of representing "open circuit" than
-ENODATA?
Seems to be a bit theoretic to assume that someone would play with connecting and disconnecting cables while the system is running. Have you tried to do that ? It would be interesting to know if the controller handles that situation. But don't blame me if you fry your system :-)
Anyway, there could be a tempX_fault attribute which would return 1 in that case. Not sure if that makes more sense, though.
Quoted 35 lines
Quoted 29 lines
Quoted 29 lines
drivers/hwmon/aquacomputer_d5next.c +10
-0+else + priv->temp_input[i] = sensor_value *10 ; + } +break ;case farbwerk360:/* Temperature sensor readings */ for (i =0 ; i <FARBWERK360_NUM_SENSORS ; i++) {@@ -733,6 +753,11 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) priv->voltage_label = label_d5next_voltages; priv->current_label = label_d5next_current;break ; +case USB_PRODUCT_ID_FARBWERK : + priv->kind = farbwerk; + + priv->temp_label = label_temp_sensors; +break ;case USB_PRODUCT_ID_FARBWERK360 : priv->kind = farbwerk360;@@ -795,6 +820,7 @@ static void aqc_remove(struct hid_device *hdev)static const struct hid_device_id aqc_table[] = { {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_D5NEXT ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK360 ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_OCTO ) }, { }@@ -826,4 +852,5 @@ module_exit(aqc_exit);Quoted 6 lines
drivers/hwmon/aquacomputer_d5next.c module_exit(aqc_exit); · line 855
Quoted 3 lines
drivers/hwmon/aquacomputer_d5next.c +1
-0MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Aleksa Savic<[email protected]>" ); +MODULE_AUTHOR ("Jack Doan<[email protected]>" );.... as is claiming authorship. I'd be the "author" of hundreds of kernel files if I would do that. Aleksa signed off on it, so I'll accept it, but I don't think it is appropriate.
Quoted 3 lines
In the context of just this patch, yes, I agree. But, I felt it was warranted based on my previous contributions. I did a good bit of the reverse-engineering that made writing settings to these devices possible, and a lot of the previously submitted code for writing the setting changes is mine as well.
I didn't mean to make an inappropriate request though! If you'd like, I can submit a version of the patch without these lines.
No, I think that makes sense as long as Aleksa is ok with it.
Guenter
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/hwmon/aquacomputer_d5next.c +0
-0MODULE_DESCRIPTION ("Hwmon driver for Aquacomputer devices" );
Aleksa Savic
maintainerQuoted 161 lines · Guenter Roeck
Quoted 158 lines · Jack Doan
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Aleksa Savic
Extend
aquacomputer_d5nextdriver to expose hardware temperature sensors of the Aquacomputer Farbwerk RGB controller, which communicates through a proprietary USB HID protocol.Four temperature sensors are available. Additionally, serial number and firmware version are exposed through debugfs.
Quoted 6 lines
Quoted 5 lines
Also, add Jack Doan to
MAINTAINERSfor this driver.Signed-off-by Jack Doan<[email protected]>Signed-off-by Aleksa Savic<[email protected]>---
This patch doesn't apply. Please rebase to master and resend.
Will do!
Quoted 65 lines
More comments inline.
Quoted 63 lines
If adding to
MAINTAINERSrequires a separate commit, I'll send it separately.--- Documentation/hwmon/aquacomputer_d5next.rst | 3 +- MAINTAINERS | 1 + drivers/hwmon/Kconfig | 5 +-- drivers/hwmon/aquacomputer_d5next.c | 37 ++++++++++++++++++--- 4 files changed, 38 insertions(+), 8 deletions(-)Documentation/hwmon/aquacomputer_d5next.rst +2
-1@@ -6,6 +6,7 @@ Kernel driver aquacomputer-d5next Supported devices: * Aquacomputer D5 Next watercooling pump +* Aquacomputer Farbwerk RGB controller * Aquacomputer Farbwerk 360 RGB controller * Aquacomputer Octo fan controller@@ -32,7 +33,7 @@ better suited for userspace tools. The Octo exposes four temperature sensors and eight PWM controllable fans, along with their speed (in RPM), power, voltage and current. -The Farbwerk 360 exposes four temperature sensors. Depending on the device, +The Farbwerk and Farbwerk 360 expose four temperature sensors. Depending on the device, not all sysfs and debugfs entries will be available. Usage notesMAINTAINERS +1
-0@@ -1389,6 +1389,7 @@ F: drivers/media/i2c/aptina-pll.* AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER M: Aleksa Savic<[email protected]> +M: Jack Doan<[email protected]> L: [email protected] S: Maintained F: Documentation/hwmon/aquacomputer_d5next.rstdrivers/hwmon/Kconfig +3
-2@@ -256,12 +256,13 @@ config SENSORS_AHT10 will be called aht10. config SENSORS_AQUACOMPUTER_D5NEXT - tristate "Aquacomputer D5 Next, Octo and Farbwerk 360" + tristate "Aquacomputer D5 Next, Octo, Farbwerk, Farbwerk 360" depends on USB_HID help If you say yes here you get support for sensors and fans of the Aquacomputer D5 Next watercooling pump, Octo fan - controller and Farbwerk 360 RGB controller, where available. + controller, Farbwerk and Farbwerk 360 RGB controllers, where + available. This driver can also be built as a module. If so, the module will be called aquacomputer_d5next.drivers/hwmon/aquacomputer_d5next.c +0
-1@@ -1,11 +1,12 @@// SPDX-License-Identifier: GPL-2.0+ /* -* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk 360, Octo) Quoted 8 lines
drivers/hwmon/aquacomputer_d5next.c
Quoted 7 lines
drivers/hwmon/aquacomputer_d5next.c +2
-0+* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo) * * Aquacomputer devices send HID reports (with ID 0x01) every second to report * sensor values. * * Copyright 2021 Aleksa Savic<[email protected]> +* Copyright 2022 Jack Doan<[email protected]> That is a bit aggressive for a few lines of code.
Addressed below.
Quoted 59 lines
Quoted 59 lines
drivers/hwmon/aquacomputer_d5next.c +13
-4*/ #include <linux/crc16.h> @@ -19,14 +20,16 @@#include <asm/unaligned.h> #define USB_VENDOR_ID_AQUACOMPUTER 0x0c70 +#define USB_PRODUCT_ID_FARBWERK 0xf00a#define USB_PRODUCT_ID_D5NEXT 0xf00e#define USB_PRODUCT_ID_FARBWERK360 0xf010#define USB_PRODUCT_ID_OCTO 0xf011 -enum kinds { d5next, farbwerk360, octo }; +enum kinds { d5next, farbwerk, farbwerk360, octo };static const char *const aqc_device_names[] = { [d5next] ="d5next" , + [farbwerk] ="farbwerk" , [farbwerk360] ="farbwerk360" , [octo] ="octo" };@@ -69,6 +72,12 @@ static u8 secondary_ctrl_report[] = {#define D5NEXT_PUMP_CURRENT 112#define D5NEXT_FAN_CURRENT 99 +/* Register offsets for the Farbwerk RGB controller */ +#define FARBWERK_NUM_SENSORS 4 +#define FARBWERK_SENSOR_START 0x2f +#define FARBWERK_SENSOR_SIZE 0x02 +#define FARBWERK_SENSOR_DISCONNECTED 0x7FFF +/* Register offsets for the Farbwerk 360 RGB controller */ #define FARBWERK360_NUM_SENSORS 4#define FARBWERK360_SENSOR_START 0x32@@ -125,7 +134,7 @@ static const char *const label_d5next_current[] = {"Fan current" }; -/* Labels for Farbwerk 360 and Octo temperature sensors */ +/* Labels for Farbwerk, Farbwerk 360 and Octo temperature sensors */ static const char *const label_temp_sensors[] = {"Sensor 1" ,"Sensor 2" ,@@ -319,6 +328,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3if (channel ==0 )return 0444 ;break ; +case farbwerk:case farbwerk360:case octo:return 0444 ;@@ -551,8 +561,7 @@ static const struct hwmon_chip_info aqc_chip_info = { .info = aqc_info, }; -static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data, -int size) +static int aqc_raw_event (struct hid_device *hdev,struct hid_report *report,u8 *data,int size) {int i, sensor_value;struct aqc_data *priv;@@ -587,6 +596,17 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 priv->current_input[0 ] =get_unaligned_be16 (data +D5NEXT_PUMP_CURRENT ); priv->current_input[1 ] =get_unaligned_be16 (data +D5NEXT_FAN_CURRENT );break ; +case farbwerk:Quoted 8 lines
drivers/hwmon/aquacomputer_d5next.c static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 · line 605
Quoted 6 lines
drivers/hwmon/aquacomputer_d5next.c +6
-0+/* Temperature sensor readings */ +for (i =0 ; i <FARBWERK_NUM_SENSORS ; i++) { + sensor_value =get_unaligned_be16 (data +FARBWERK_SENSOR_START + + i *FARBWERK_SENSOR_SIZE ); +if (sensor_value ==FARBWERK_SENSOR_DISCONNECTED ) + priv->temp_input[i] = -ENODATA ;Can the sensor be connected dynamically ? If not, this should be handled in an
is_visiblefunction.Quoted 1 line
It's a somewhat unlikely use-case, but yes, they can be. The sensors are NTC thermistors that connect to pin-headers. Do we have a better way of representing "open circuit" than
-ENODATA?
Quoted 8 lines
Seems to be a bit theoretic to assume that someone would play with connecting and disconnecting cables while the system is running. Have you tried to do that ? It would be interesting to know if the controller handles that situation. But don't blame me if you fry your system :-)
Anyway, there could be a
tempX_faultattribute which would return 1 in that case. Not sure if that makes more sense, though.
They handle hot plugging just fine, that's how I initially tested if I got the offsets right wihout having to reboot. Same goes for PWM inputs on devices that have them.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 26 lines
drivers/hwmon/aquacomputer_d5next.c +10
-0+else + priv->temp_input[i] = sensor_value *10 ; + } +break ;case farbwerk360:/* Temperature sensor readings */ for (i =0 ; i <FARBWERK360_NUM_SENSORS ; i++) {@@ -733,6 +753,11 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) priv->voltage_label = label_d5next_voltages; priv->current_label = label_d5next_current;break ; +case USB_PRODUCT_ID_FARBWERK : + priv->kind = farbwerk; + + priv->temp_label = label_temp_sensors; +break ;case USB_PRODUCT_ID_FARBWERK360 : priv->kind = farbwerk360;@@ -795,6 +820,7 @@ static void aqc_remove(struct hid_device *hdev)static const struct hid_device_id aqc_table[] = { {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_D5NEXT ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_FARBWERK360 ) }, {HID_USB_DEVICE (USB_VENDOR_ID_AQUACOMPUTER ,USB_PRODUCT_ID_OCTO ) }, { }drivers/hwmon/aquacomputer_d5next.c module_exit(aqc_exit); · line 854
Quoted 3 lines
drivers/hwmon/aquacomputer_d5next.c +1
-0@@ -826,4 +852,5 @@ module_exit(aqc_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Aleksa Savic<[email protected]>" ); +MODULE_AUTHOR ("Jack Doan<[email protected]>" );.... as is claiming authorship. I'd be the "author" of hundreds of kernel files if I would do that. Aleksa signed off on it, so I'll accept it, but I don't think it is appropriate.
Quoted 7 lines
Quoted 3 lines
In the context of just this patch, yes, I agree. But, I felt it was warranted based on my previous contributions. I did a good bit of the reverse-engineering that made writing settings to these devices possible, and a lot of the previously submitted code for writing the setting changes is mine as well.
I didn't mean to make an inappropriate request though! If you'd like, I can submit a version of the patch without these lines.
No, I think that makes sense as long as Aleksa is ok with it.
Guenter
Yes, I'm OK with adding Jack since he's the main author of this and some bigger patches that we're working on at the Github repo, such as adding support for Quadro and setting fan/pump curves directly on the D5 Next pump (which I'd say took a great deal of reverse engineering, at least from my POV).
Thanks,
Aleksa
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/hwmon/aquacomputer_d5next.c +0
-0MODULE_DESCRIPTION ("Hwmon driver for Aquacomputer devices" );