Skip to content

Commit

Permalink
aquacomputer_d5next: poweradjust3: Read flow sensor
Browse files Browse the repository at this point in the history
Signed-off-by: Leonard Anderweit <[email protected]>
  • Loading branch information
leoratte committed May 1, 2024
1 parent dce0b5c commit 5cdee76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion aquacomputer_d5next.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,14 @@ static u16 aquastreamxt_ctrl_fan_offsets[] = { 0x8, 0x1b };
#define POWERADJUST3_FIRMWARE_VERSION 0x21
#define POWERADJUST3_NUM_FANS 1
#define POWERADJUST3_NUM_SENSORS 2
#define POWERADJUST3_NUM_FLOW_SENSORS 1
#define POWERADJUST3_SENSOR_REPORT_SIZE 0x32

/* Sensor report offsets for the Poweradjust 3 */
#define POWERADJUST3_SENSOR_START 0x01
#define POWERADJUST3_FAN_CURR_OFFSET 0x05
#define POWERADJUST3_FAN_VOLTAGE_OFFSET 0x07
#define POWERADJUST3_FLOW_SENSOR_OFFSET 0x09
#define POWERADJUST3_FAN_SPEED_OFFSET 0x0b

/* Specs of the High Flow USB */
Expand Down Expand Up @@ -643,7 +645,8 @@ static const char *const label_poweradjust3_temp_sensors[] = {
};

static const char *const label_poweradjust3_speeds[] = {
"Fan speed"
"Fan speed",
"Flow speed [dL/h]"
};

static const char *const label_poweradjust3_voltages[] = {
Expand Down Expand Up @@ -1099,6 +1102,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3
case quadro:
case octo:
case highflow:
case poweradjust3:
/* Special case to support flow sensors */
if (channel < priv->num_fans +
priv->num_flow_sensors +
Expand Down Expand Up @@ -1277,6 +1281,10 @@ static int aqc_legacy_read(struct aqc_data *priv)
priv->voltage_input[0] = sensor_value * 10;
priv->current_input[0] = get_unaligned_le16(priv->buffer +
POWERADJUST3_FAN_CURR_OFFSET);

/* Read flow speed */
sensor_value = get_unaligned_le16(priv->buffer + priv->flow_sensors_start_offset);
priv->speed_input[1] = DIV_ROUND_CLOSEST(sensor_value, 10);
break;
default:
break;
Expand Down Expand Up @@ -3114,6 +3122,8 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)

priv->num_temp_sensors = POWERADJUST3_NUM_SENSORS;
priv->temp_sensor_start_offset = POWERADJUST3_SENSOR_START;
priv->num_flow_sensors = POWERADJUST3_NUM_FLOW_SENSORS;
priv->flow_sensors_start_offset = POWERADJUST3_FLOW_SENSOR_OFFSET;
priv->buffer_size = POWERADJUST3_SENSOR_REPORT_SIZE;

priv->temp_label = label_poweradjust3_temp_sensors;
Expand Down
2 changes: 1 addition & 1 deletion docs/aquacomputer_d5next.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ with speed, power, voltage and current of both the pump and optionally connected
It also exposes pressure and flow speed readings.

The Poweradjust 3 controller exposes an internal and an external temperature
sensor. It also exposes RPM, voltage and current for one fan.
sensor. It also exposes RPM, voltage and current for one fan and a flow meter.

The High Flow USB exposes an internal and external temperature sensor and a flow meter.

Expand Down

0 comments on commit 5cdee76

Please sign in to comment.