Skip to contentSkip to conversation

hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and MPS Flow

PATCH Applied Aleksa Savic 2 participants 9 messages Oct 16, 2023 – Oct 29, 2023

Subsystems (3)
lore
Share & tools
lore

Aleksa Savic

author maintainer
#0 lore raw

cover hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and MPS Flow

This series adds support for the Aquacomputer High Flow USB and MPS Flow flow sensor devices, which communicate through a proprietary USB protocol.

Patch 1 resolves the case when devices that communicate through the legacy way (such as these) don't contain a reading for a sensor, in which case -ENODATA is now returned.

Patch 2 adds support for the devices and implements reading their temperature and flow sensors.

Aleksa Savic (2):
hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices
are connected
hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow
USB and MPS Flow

 Documentation/hwmon/aquacomputer_d5next.rst |  7 ++
 drivers/hwmon/aquacomputer_d5next.c         | 72 +++++++++++++++++++--
 2 files changed, 74 insertions(+), 5 deletions(-)
Signature · 1 line
2.41.0
author maintainer
#1 lore raw

PATCH 1/2 hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected

Return -ENODATA if a temp sensor of a legacy device does not contain a reading.

Originally-from: Leonard Anderweit <[email protected]>

---
 drivers/hwmon/aquacomputer_d5next.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hwmon/aquacomputer_d5next.c +4 -1
index 023807859be7..46ff4fd4f87d 100644
@@ -926,7 +926,10 @@ static int aqc_legacy_read(struct aqc_data *priv)
 	for (i = 0; i < priv->num_temp_sensors; i++) {
 		sensor_value = get_unaligned_le16(priv->buffer + priv->temp_sensor_start_offset +
 						  i * AQC_SENSOR_SIZE);
-		priv->temp_input[i] = sensor_value * 10;
+		if (sensor_value == AQC_SENSOR_NA)
+			priv->temp_input[i] = -ENODATA;
+		else
+			priv->temp_input[i] = sensor_value * 10;
 	}
 
 	/* Special-case sensor readings */
Signature · 1 line
2.41.0
author maintainer
#4 lore raw

PATCH 2/2 hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and MPS Flow

In reply to Aleksa Savic

Extend aquacomputer_d5next driver to expose various hardware sensors of the Aquacomputer High Flow USB flow sensor, which communicates through a proprietary USB HID protocol. This commit also adds support for the sensors of the MPS Flow devices, as they have the same USB product ID and sensor layouts. Implemented by Leonard Anderweit [1].

Internal and external temp sensor readings are available, along with the flow sensor.

Additionally, serial number and firmware version are exposed through debugfs.

[1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/90

Originally-from: Leonard Anderweit <[email protected]>

---
 Documentation/hwmon/aquacomputer_d5next.rst |  7 +++
 drivers/hwmon/aquacomputer_d5next.c         | 67 +++++++++++++++++++--
 2 files changed, 70 insertions(+), 4 deletions(-)
Documentation/hwmon/aquacomputer_d5next.rst +7 -0
index 94dc2d93d180..cb073c79479c 100644
@@ -16,6 +16,8 @@ Supported devices:
 * Aquacomputer Aquastream XT watercooling pump
 * Aquacomputer Aquastream Ultimate watercooling pump
 * Aquacomputer Poweradjust 3 fan controller
+* Aquacomputer High Flow USB flow meter
+* Aquacomputer MPS Flow devices
 
 Author: Aleksa Savic
 
@@ -73,6 +75,11 @@ It also exposes pressure and flow speed readings.
 
 The Poweradjust 3 controller exposes a single external temperature sensor.
 
+The High Flow USB exposes an internal and external temperature sensor, and a flow meter.
+
+The MPS Flow devices expose the same entries as the High Flow USB because they have
+the same USB product ID and report sensors equivalently.
+
 Depending on the device, not all sysfs and debugfs entries will be available.
 Writing to virtual temperature sensors is not currently supported.
 
drivers/hwmon/aquacomputer_d5next.c +63 -4

140 lines not on this page · raw message

Signature · 1 line
2.41.0
maintainer
#2 lore raw

Re: [PATCH 1/2] hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected

In reply to Aleksa Savic
Quoted 3 lines · Aleksa Savic

Return -ENODATA if a temp sensor of a legacy device does not contain a reading.

Why is the sensor instantiated in the first place ? Returning -ENODATA for every reading is not desirable. If this can happen, the is_visible function should check for it and skip affected sensors.

Guenter

Quoted 22 lines

Originally-from: Leonard Anderweit <[email protected]>

---
 drivers/hwmon/aquacomputer_d5next.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hwmon/aquacomputer_d5next.c +4 -1
index 023807859be7..46ff4fd4f87d 100644
@@ -926,7 +926,10 @@ static int aqc_legacy_read(struct aqc_data *priv)
 	for (i = 0; i < priv->num_temp_sensors; i++) {
 		sensor_value = get_unaligned_le16(priv->buffer + priv->temp_sensor_start_offset +
 						  i * AQC_SENSOR_SIZE);
-		priv->temp_input[i] = sensor_value * 10;
+		if (sensor_value == AQC_SENSOR_NA)
+			priv->temp_input[i] = -ENODATA;
+		else
+			priv->temp_input[i] = sensor_value * 10;
 	}
 
 	/* Special-case sensor readings */
author maintainer
#3 lore raw

Re: [PATCH 1/2] hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected

Quoted 8 lines · Guenter Roeck

Why is the sensor instantiated in the first place ? Returning -ENODATA for every reading is not desirable. If this can happen, the is_visible function should check for it and skip affected sensors.

Guenter

The external temp sensor(s) are hot-swappable and can be plugged or unplugged anytime. Similar logic already exists in aqc_raw_event() for the sensors.

Thanks,
Aleksa

maintainer Applied
#5 lore raw
In reply to Aleksa Savic
Quoted 9 lines · Aleksa Savic

Extend aquacomputer_d5next driver to expose various hardware sensors of the Aquacomputer High Flow USB flow sensor, which communicates through a proprietary USB HID protocol. This commit also adds support for the sensors of the MPS Flow devices, as they have the same USB product ID and sensor layouts. Implemented by Leonard Anderweit [1].

Internal and external temp sensor readings are available, along with the flow sensor.

Quoted 7 lines

Additionally, serial number and firmware version are exposed through debugfs.

[1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/90

Originally-from: Leonard Anderweit <[email protected]>

Applied.

Thanks,
Guenter

Quoted 185 lines
---
 Documentation/hwmon/aquacomputer_d5next.rst |  7 +++
 drivers/hwmon/aquacomputer_d5next.c         | 67 +++++++++++++++++++--
 2 files changed, 70 insertions(+), 4 deletions(-)
Documentation/hwmon/aquacomputer_d5next.rst +7 -0
index 94dc2d93d180..cb073c79479c 100644
@@ -16,6 +16,8 @@ Supported devices:
 * Aquacomputer Aquastream XT watercooling pump
 * Aquacomputer Aquastream Ultimate watercooling pump
 * Aquacomputer Poweradjust 3 fan controller
+* Aquacomputer High Flow USB flow meter
+* Aquacomputer MPS Flow devices
 
 Author: Aleksa Savic
 
@@ -73,6 +75,11 @@ It also exposes pressure and flow speed readings.
 
 The Poweradjust 3 controller exposes a single external temperature sensor.
 
+The High Flow USB exposes an internal and external temperature sensor, and a flow meter.
+
+The MPS Flow devices expose the same entries as the High Flow USB because they have
+the same USB product ID and report sensors equivalently.
+
 Depending on the device, not all sysfs and debugfs entries will be available.
 Writing to virtual temperature sensors is not currently supported.
 
drivers/hwmon/aquacomputer_d5next.c +63 -4
index 46ff4fd4f87d..4fdd2e12427b 100644
@@ -1,11 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * hwmon driver for Aquacomputer devices (D5 Next, Farbwerk, Farbwerk 360, Octo,
- * Quadro, High Flow Next, Aquaero, Aquastream Ultimate, Leakshield)
+ * Quadro, High Flow Next, Aquaero, Aquastream Ultimate, Leakshield,
+ * High Flow USB/MPS Flow family)
  *
  * Aquacomputer devices send HID reports (with ID 0x01) every second to report
  * sensor values, except for devices that communicate through the
- * legacy way (currently, Poweradjust 3).
+ * legacy way (currently, Poweradjust 3 and High Flow USB/MPS Flow family).
  *
  * Copyright 2021 Aleksa Savic <[email protected]>
  * Copyright 2022 Jack Doan <[email protected]>
@@ -35,11 +36,12 @@
 #define USB_PRODUCT_ID_AQUASTREAMXT	0xf0b6
 #define USB_PRODUCT_ID_AQUASTREAMULT	0xf00b
 #define USB_PRODUCT_ID_POWERADJUST3	0xf0bd
+#define USB_PRODUCT_ID_HIGHFLOW		0xf003
 
 enum kinds {
 	d5next, farbwerk, farbwerk360, octo, quadro,
 	highflownext, aquaero, poweradjust3, aquastreamult,
-	aquastreamxt, leakshield
+	aquastreamxt, leakshield, highflow
 };
 
 static const char *const aqc_device_names[] = {
@@ -53,7 +55,8 @@ static const char *const aqc_device_names[] = {
 	[aquastreamxt] = "aquastreamxt",
 	[aquaero] = "aquaero",
 	[aquastreamult] = "aquastreamultimate",
-	[poweradjust3] = "poweradjust3"
+	[poweradjust3] = "poweradjust3",
+	[highflow] = "highflow" /* Covers MPS Flow devices */
 };
 
 #define DRIVER_NAME			"aquacomputer_d5next"
@@ -90,6 +93,8 @@ static u8 aquaero_secondary_ctrl_report[] = {
 
 #define POWERADJUST3_STATUS_REPORT_ID	0x03
 
+#define HIGHFLOW_STATUS_REPORT_ID	0x02
+
 /* Data types for reading and writing control reports */
 #define AQC_8		0
 #define AQC_BE16	1
@@ -282,6 +287,17 @@ static u16 aquastreamxt_sensor_fan_offsets[] = { 0x13, 0x1b };
 /* Sensor report offsets for the Poweradjust 3 */
 #define POWERADJUST3_SENSOR_START	0x03
 
+/* Specs of the High Flow USB */
+#define HIGHFLOW_NUM_SENSORS		2
+#define HIGHFLOW_NUM_FLOW_SENSORS	1
+#define HIGHFLOW_SENSOR_REPORT_SIZE	0x76
+
+/* Sensor report offsets for the High Flow USB */
+#define HIGHFLOW_FIRMWARE_VERSION	0x3
+#define HIGHFLOW_SERIAL_START		0x9
+#define HIGHFLOW_FLOW_SENSOR_OFFSET	0x23
+#define HIGHFLOW_SENSOR_START		0x2b
+
 /* Labels for D5 Next */
 static const char *const label_d5next_temp[] = {
 	"Coolant temp"
@@ -486,6 +502,16 @@ static const char *const label_poweradjust3_temp_sensors[] = {
 	"External sensor"
 };
 
+/* Labels for Highflow */
+static const char *const label_highflow_temp[] = {
+	"External temp",
+	"Internal temp"
+};
+
+static const char *const label_highflow_speeds[] = {
+	"Flow speed [dL/h]"
+};
+
 struct aqc_fan_structure_offsets {
 	u8 voltage;
 	u8 curr;
@@ -819,6 +845,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3
 				break;
 			case aquaero:
 			case quadro:
+			case highflow:
 				/* Special case to support flow sensors */
 				if (channel < priv->num_fans + priv->num_flow_sensors)
 					return 0444;
@@ -965,6 +992,17 @@ static int aqc_legacy_read(struct aqc_data *priv)
 		sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_FAN_VOLTAGE_OFFSET);
 		priv->voltage_input[1] = DIV_ROUND_CLOSEST(sensor_value * 1000, 63);
 		break;
+	case highflow:
+		/* Info provided with every report */
+		priv->serial_number[0] = get_unaligned_le16(priv->buffer +
+							    priv->serial_number_start_offset);
+		priv->firmware_version =
+		    get_unaligned_le16(priv->buffer + priv->firmware_version_offset);
+
+		/* Read flow speed */
+		priv->speed_input[0] = get_unaligned_le16(priv->buffer +
+							  priv->flow_sensors_start_offset);
+		break;
 	default:
 		break;
 	}
@@ -1750,6 +1788,20 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
 		priv->temp_label = label_poweradjust3_temp_sensors;
 		break;
+	case USB_PRODUCT_ID_HIGHFLOW:
+		priv->kind = highflow;
+
+		priv->num_fans = 0;
+
+		priv->num_temp_sensors = HIGHFLOW_NUM_SENSORS;
+		priv->temp_sensor_start_offset = HIGHFLOW_SENSOR_START;
+		priv->num_flow_sensors = HIGHFLOW_NUM_FLOW_SENSORS;
+		priv->flow_sensors_start_offset = HIGHFLOW_FLOW_SENSOR_OFFSET;
+		priv->buffer_size = HIGHFLOW_SENSOR_REPORT_SIZE;
+
+		priv->temp_label = label_highflow_temp;
+		priv->speed_label = label_highflow_speeds;
+		break;
 	default:
 		break;
 	}
@@ -1775,6 +1827,12 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
 		priv->status_report_id = AQUASTREAMXT_STATUS_REPORT_ID;
 		break;
+	case highflow:
+		priv->serial_number_start_offset = HIGHFLOW_SERIAL_START;
+		priv->firmware_version_offset = HIGHFLOW_FIRMWARE_VERSION;
+
+		priv->status_report_id = HIGHFLOW_STATUS_REPORT_ID;
+		break;
 	default:
 		priv->serial_number_start_offset = AQC_SERIAL_START;
 		priv->firmware_version_offset = AQC_FIRMWARE_VERSION;
@@ -1849,6 +1907,7 @@ static const struct hid_device_id aqc_table[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_AQUACOMPUTER, USB_PRODUCT_ID_AQUASTREAMXT) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_AQUACOMPUTER, USB_PRODUCT_ID_AQUASTREAMULT) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_AQUACOMPUTER, USB_PRODUCT_ID_POWERADJUST3) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_AQUACOMPUTER, USB_PRODUCT_ID_HIGHFLOW) },
 	{ }
 };
 
author maintainer
#6 lore raw
Quoted 6 lines · Guenter Roeck

Applied.

Thanks,
Guenter

Thanks. Maybe I'm missing something, why is the first patch from the series not applied as well?

Aleksa

maintainer
#7 lore raw
Quoted 11 lines · Aleksa Savic
Quoted 6 lines · Guenter Roeck

Applied.

Thanks,
Guenter

Thanks. Maybe I'm missing something, why is the first patch from the series not applied as well?

Because I missed your reply to my question. Sorry, I have to admit that I am less than perfect. Applied now.

Guenter

author maintainer
#8 lore raw
Quoted 9 lines · Guenter Roeck
Quoted 8 lines · Aleksa Savic
Quoted 6 lines · Guenter Roeck

Applied.

Thanks,
Guenter

Quoted 9 lines
Quoted 3 lines

Thanks. Maybe I'm missing something, why is the first patch from the series not applied as well?

Because I missed your reply to my question. Sorry, I have to admit that I am less than perfect. Applied now.

Guenter

Thank you, much appreciated :)

Aleksa