Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more sensors for poweradjust3 #98

Merged
merged 7 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The following devices are supported by this driver, and from which kernel versio
| Leakshield | 6.5 (sensors), rest here | Various sensors and setting parameters for higher accuracy | ? |
| Aquastream XT | 6.4 (sensors), rest here | Temperature sensors, voltage sensors, pump and fan speed control | ATMEGA8-16MU |
| Aquastream Ultimate | 6.3 | Temperature sensors, pump and fan sensors, pressure and flow | ? |
| Poweradjust 3 | 6.3 | External temperature sensor | ? |
| Poweradjust 3 | 6.3 | Temperature sensors, fan sensors, flow meter | ? |
| High Flow USB | 6.7 | Temperature sensors, flow meter | ? |
| MPS Flow | 6.7 | Temperature sensors, flow meter | ? |

Expand Down
71 changes: 58 additions & 13 deletions aquacomputer_d5next.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,19 @@ static u16 aquastreamxt_sensor_fan_offsets[] = { 0x13, 0x1b };
static u16 aquastreamxt_ctrl_fan_offsets[] = { 0x8, 0x1b };

/* Specs of the Poweradjust 3 */
#define POWERADJUST3_NUM_SENSORS 1
#define POWERADJUST3_SERIAL_START 0x27
#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 0x03
#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 */
#define HIGHFLOW_NUM_SENSORS 2
Expand Down Expand Up @@ -632,9 +640,23 @@ static const char *const label_aquastreamult_current[] = {

/* Labels for Poweradjust 3 */
static const char *const label_poweradjust3_temp_sensors[] = {
"Fan IC temp",
"External sensor"
};

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

static const char *const label_poweradjust3_voltages[] = {
"Fan voltage"
};

static const char *const label_poweradjust3_current[] = {
"Fan current"
};

/* Labels for Highflow */
static const char *const label_highflow_temp[] = {
"External temp",
Expand Down Expand Up @@ -1080,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 @@ -1131,6 +1154,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3
return 0444;
break;
case aquastreamxt:
case poweradjust3:
break;
default:
if (channel < priv->num_fans)
Expand Down Expand Up @@ -1205,15 +1229,21 @@ static int aqc_legacy_read(struct aqc_data *priv)
priv->temp_input[i] = sensor_value * 10;
}

/* Special-case sensor readings */
switch (priv->kind) {
case aquastreamxt:
/* Info provided with every report */
/* Serial number */
if (priv->serial_number_start_offset) {
priv->serial_number[0] = get_unaligned_le16(priv->buffer +
priv->serial_number_start_offset);
}

/* Firmware version */
if (priv->firmware_version_offset) {
priv->firmware_version =
get_unaligned_le16(priv->buffer + priv->firmware_version_offset);
}

/* Special-case sensor readings */
switch (priv->kind) {
case aquastreamxt:
/* Read pump speed in RPM */
sensor_value = get_unaligned_le16(priv->buffer + priv->fan_sensor_offsets[0]);
priv->speed_input[0] = aqc_aquastreamxt_convert_pump_rpm(sensor_value);
Expand All @@ -1239,16 +1269,23 @@ static int aqc_legacy_read(struct aqc_data *priv)
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;
case poweradjust3:
/* Read fan RPM, voltage and current */
priv->speed_input[0] = get_unaligned_le16(priv->buffer +
POWERADJUST3_FAN_SPEED_OFFSET);
sensor_value = get_unaligned_le16(priv->buffer + POWERADJUST3_FAN_VOLTAGE_OFFSET);
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 @@ -3081,13 +3118,18 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
case USB_PRODUCT_ID_POWERADJUST3:
priv->kind = poweradjust3;

priv->num_fans = 0;
priv->num_fans = POWERADJUST3_NUM_FANS;

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;
priv->speed_label = label_poweradjust3_speeds;
priv->voltage_label = label_poweradjust3_voltages;
priv->current_label = label_poweradjust3_current;
break;
case USB_PRODUCT_ID_HIGHFLOW:
priv->kind = highflow;
Expand Down Expand Up @@ -3132,6 +3174,9 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
priv->secondary_ctrl_report = aquastreamxt_secondary_ctrl_report;
break;
case poweradjust3:
priv->serial_number_start_offset = POWERADJUST3_SERIAL_START;
priv->firmware_version_offset = POWERADJUST3_FIRMWARE_VERSION;

priv->status_report_id = POWERADJUST3_STATUS_REPORT_ID;
break;
case highflow:
Expand Down
3 changes: 2 additions & 1 deletion docs/aquacomputer_d5next.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ The Aquastream Ultimate pump exposes coolant temp and an external temp sensor, a
with speed, power, voltage and current of both the pump and optionally connected fan.
It also exposes pressure and flow speed readings.

The Poweradjust 3 controller exposes a single external temperature sensor.
The Poweradjust 3 controller exposes an internal and an external temperature
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
9 changes: 9 additions & 0 deletions re-docs/poweradjust3/poweradjust3-sensors.hexpat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
le u16 temp_sensor[2] @ 0x01;
le u16 fan_curr @ 0x05;
le u16 fan_voltage @ 0x7;
le u16 flow_speed @ 0x09;
le u16 fan_speed @ 0x0b;
u8 fan_pwm @ 0x0d;
le u16 firmware @ 0x21;
le u16 serial_number @ 0x27;
u8 device_key[6] @ 0x29;
Binary file added re-docs/poweradjust3/sensor_report.bin
Binary file not shown.
Loading