Skip to content

Commit cdbe34d

Browse files
aleksamagickagroeck
authored andcommitted
hwmon: (aquacomputer_d5next) Add support for Aquacomputer Quadro fan controller
Extend aquacomputer_d5next driver to expose hardware temperature sensors and fans of the Aquacomputer Quadro fan controller, which communicates through a proprietary USB HID protocol. Implemented by Jack Doan [1]. Four temperature sensors and PWM controllable fans are available. The liquid flow sensor is also exposed, implemented by Leonard Anderweit [2]. Additionally, serial number, firmware version and power-on count are exposed through debugfs. This driver has been tested on x86_64. [1] aleksamagicka/aquacomputer_d5next-hwmon#5 [2] aleksamagicka/aquacomputer_d5next-hwmon#9 Originally-from: Jack Doan <[email protected]> Originally-from: Leonard Anderweit <[email protected]> Signed-off-by: Aleksa Savic <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 41cd437 commit cdbe34d

File tree

3 files changed

+78
-14
lines changed

3 files changed

+78
-14
lines changed

Documentation/hwmon/aquacomputer_d5next.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Supported devices:
99
* Aquacomputer Farbwerk RGB controller
1010
* Aquacomputer Farbwerk 360 RGB controller
1111
* Aquacomputer Octo fan controller
12+
* Aquacomputer Quadro fan controller
1213

1314
Author: Aleksa Savic
1415

@@ -33,6 +34,9 @@ better suited for userspace tools.
3334
The Octo exposes four temperature sensors and eight PWM controllable fans, along
3435
with their speed (in RPM), power, voltage and current.
3536

37+
The Quadro exposes four temperature sensors, a flow sensor and four PWM controllable
38+
fans, along with their speed (in RPM), power, voltage and current.
39+
3640
The Farbwerk and Farbwerk 360 expose four temperature sensors. Depending on the device,
3741
not all sysfs and debugfs entries will be available.
3842

@@ -45,13 +49,14 @@ the kernel and supports hotswapping.
4549
Sysfs entries
4650
-------------
4751

48-
================ =============================================
52+
================ ==============================================
4953
temp[1-4]_input Temperature sensors (in millidegrees Celsius)
50-
fan[1-2]_input Pump/fan speed (in RPM)
51-
power[1-2]_input Pump/fan power (in micro Watts)
52-
in[0-2]_input Pump/fan voltage (in milli Volts)
53-
curr[1-2]_input Pump/fan current (in milli Amperes)
54-
================ =============================================
54+
fan[1-8]_input Pump/fan speed (in RPM) / Flow speed (in dL/h)
55+
power[1-8]_input Pump/fan power (in micro Watts)
56+
in[0-7]_input Pump/fan voltage (in milli Volts)
57+
curr[1-8]_input Pump/fan current (in milli Amperes)
58+
pwm[1-8] Fan PWM (0 - 255)
59+
================ ==============================================
5560

5661
Debugfs entries
5762
---------------

drivers/hwmon/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,13 @@ config SENSORS_AHT10
257257
will be called aht10.
258258

259259
config SENSORS_AQUACOMPUTER_D5NEXT
260-
tristate "Aquacomputer D5 Next, Octo, Farbwerk, and Farbwerk 360"
260+
tristate "Aquacomputer D5 Next, Octo, Quadro, Farbwerk, and Farbwerk 360"
261261
depends on USB_HID
262262
select CRC16
263263
help
264264
If you say yes here you get support for sensors and fans of
265-
the Aquacomputer D5 Next watercooling pump, Octo fan
266-
controller, Farbwerk and Farbwerk 360 RGB controllers, where
265+
the Aquacomputer D5 Next watercooling pump, Octo and Quadro fan
266+
controllers, Farbwerk and Farbwerk 360 RGB controllers, where
267267
available.
268268

269269
This driver can also be built as a module. If so, the module

drivers/hwmon/aquacomputer_d5next.c

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0+
22
/*
3-
* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo)
3+
* hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo,
4+
* Quadro)
45
*
56
* Aquacomputer devices send HID reports (with ID 0x01) every second to report
67
* sensor values.
@@ -21,17 +22,19 @@
2122

2223
#define USB_VENDOR_ID_AQUACOMPUTER 0x0c70
2324
#define USB_PRODUCT_ID_FARBWERK 0xf00a
25+
#define USB_PRODUCT_ID_QUADRO 0xf00d
2426
#define USB_PRODUCT_ID_D5NEXT 0xf00e
2527
#define USB_PRODUCT_ID_FARBWERK360 0xf010
2628
#define USB_PRODUCT_ID_OCTO 0xf011
2729

28-
enum kinds { d5next, farbwerk, farbwerk360, octo };
30+
enum kinds { d5next, farbwerk, farbwerk360, octo, quadro };
2931

3032
static const char *const aqc_device_names[] = {
3133
[d5next] = "d5next",
3234
[farbwerk] = "farbwerk",
3335
[farbwerk360] = "farbwerk360",
34-
[octo] = "octo"
36+
[octo] = "octo",
37+
[quadro] = "quadro"
3538
};
3639

3740
#define DRIVER_NAME "aquacomputer_d5next"
@@ -97,6 +100,18 @@ static u8 octo_sensor_fan_offsets[] = { 0x7D, 0x8A, 0x97, 0xA4, 0xB1, 0xBE, 0xCB
97100
/* Fan speed registers in Octo control report (from 0-100%) */
98101
static u16 octo_ctrl_fan_offsets[] = { 0x5B, 0xB0, 0x105, 0x15A, 0x1AF, 0x204, 0x259, 0x2AE };
99102

103+
/* Register offsets for the Quadro fan controller */
104+
#define QUADRO_POWER_CYCLES 0x18
105+
#define QUADRO_NUM_FANS 4
106+
#define QUADRO_NUM_SENSORS 4
107+
#define QUADRO_SENSOR_START 0x34
108+
#define QUADRO_CTRL_REPORT_SIZE 0x3c1
109+
#define QUADRO_FLOW_SENSOR_OFFSET 0x6e
110+
static u8 quadro_sensor_fan_offsets[] = { 0x70, 0x7D, 0x8A, 0x97 };
111+
112+
/* Fan speed registers in Quadro control report (from 0-100%) */
113+
static u16 quadro_ctrl_fan_offsets[] = { 0x36, 0x8b, 0xe0, 0x135 };
114+
100115
/* Labels for D5 Next */
101116
static const char *const label_d5next_temp[] = {
102117
"Coolant temp"
@@ -124,15 +139,15 @@ static const char *const label_d5next_current[] = {
124139
"Fan current"
125140
};
126141

127-
/* Labels for Farbwerk, Farbwerk 360 and Octo temperature sensors */
142+
/* Labels for Farbwerk, Farbwerk 360 and Octo and Quadro temperature sensors */
128143
static const char *const label_temp_sensors[] = {
129144
"Sensor 1",
130145
"Sensor 2",
131146
"Sensor 3",
132147
"Sensor 4"
133148
};
134149

135-
/* Labels for Octo */
150+
/* Labels for Octo and Quadro (except speed) */
136151
static const char *const label_fan_speed[] = {
137152
"Fan 1 speed",
138153
"Fan 2 speed",
@@ -177,6 +192,15 @@ static const char *const label_fan_current[] = {
177192
"Fan 8 current"
178193
};
179194

195+
/* Labels for Quadro fan speeds */
196+
static const char *const label_quadro_speeds[] = {
197+
"Fan 1 speed",
198+
"Fan 2 speed",
199+
"Fan 3 speed",
200+
"Fan 4 speed",
201+
"Flow speed [dL/h]"
202+
};
203+
180204
struct aqc_data {
181205
struct hid_device *hdev;
182206
struct device *hwmon_dev;
@@ -197,6 +221,7 @@ struct aqc_data {
197221
int num_temp_sensors;
198222
int temp_sensor_start_offset;
199223
u16 power_cycle_count_offset;
224+
u8 flow_sensor_offset;
200225

201226
/* General info, same across all devices */
202227
u32 serial_number[2];
@@ -334,6 +359,18 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3
334359
}
335360
break;
336361
case hwmon_fan:
362+
switch (priv->kind) {
363+
case quadro:
364+
/* Special case to support flow sensor */
365+
if (channel < priv->num_fans + 1)
366+
return 0444;
367+
break;
368+
default:
369+
if (channel < priv->num_fans)
370+
return 0444;
371+
break;
372+
}
373+
break;
337374
case hwmon_power:
338375
case hwmon_curr:
339376
if (channel < priv->num_fans)
@@ -578,6 +615,9 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8
578615
priv->voltage_input[2] = get_unaligned_be16(data + D5NEXT_5V_VOLTAGE) * 10;
579616
priv->voltage_input[3] = get_unaligned_be16(data + D5NEXT_12V_VOLTAGE) * 10;
580617
break;
618+
case quadro:
619+
priv->speed_input[4] = get_unaligned_be16(data + priv->flow_sensor_offset);
620+
break;
581621
default:
582622
break;
583623
}
@@ -719,6 +759,24 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
719759
priv->voltage_label = label_fan_voltage;
720760
priv->current_label = label_fan_current;
721761
break;
762+
case USB_PRODUCT_ID_QUADRO:
763+
priv->kind = quadro;
764+
765+
priv->num_fans = QUADRO_NUM_FANS;
766+
priv->fan_sensor_offsets = quadro_sensor_fan_offsets;
767+
priv->fan_ctrl_offsets = quadro_ctrl_fan_offsets;
768+
priv->num_temp_sensors = QUADRO_NUM_SENSORS;
769+
priv->temp_sensor_start_offset = QUADRO_SENSOR_START;
770+
priv->power_cycle_count_offset = QUADRO_POWER_CYCLES;
771+
priv->buffer_size = QUADRO_CTRL_REPORT_SIZE;
772+
priv->flow_sensor_offset = QUADRO_FLOW_SENSOR_OFFSET;
773+
774+
priv->temp_label = label_temp_sensors;
775+
priv->speed_label = label_quadro_speeds;
776+
priv->power_label = label_fan_power;
777+
priv->voltage_label = label_fan_voltage;
778+
priv->current_label = label_fan_current;
779+
break;
722780
default:
723781
break;
724782
}
@@ -774,6 +832,7 @@ static const struct hid_device_id aqc_table[] = {
774832
{ HID_USB_DEVICE(USB_VENDOR_ID_AQUACOMPUTER, USB_PRODUCT_ID_FARBWERK) },
775833
{ HID_USB_DEVICE(USB_VENDOR_ID_AQUACOMPUTER, USB_PRODUCT_ID_FARBWERK360) },
776834
{ HID_USB_DEVICE(USB_VENDOR_ID_AQUACOMPUTER, USB_PRODUCT_ID_OCTO) },
835+
{ HID_USB_DEVICE(USB_VENDOR_ID_AQUACOMPUTER, USB_PRODUCT_ID_QUADRO) },
777836
{ }
778837
};
779838

0 commit comments

Comments
 (0)