hwmon: (aquacomputer_d5next) Add support for Octo flow sensor pulses

Add support for reading and writing the flow sensor pulses on
the Aquacomputer Octo. Implemented by David Flemstrom [1].

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

Originally-from: David Flemstrom <david.flemstrom@gmail.com>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20240417175037.32499-3-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Aleksa Savic 2024-04-17 19:50:36 +02:00 committed by Guenter Roeck
parent 120584c728
commit bf7b5a12bd
2 changed files with 15 additions and 5 deletions

View File

@ -47,7 +47,7 @@ better suited for userspace tools.
The Octo exposes four physical and sixteen virtual temperature sensors, a flow sensor
as well as eight PWM controllable fans, along with their speed (in RPM), power, voltage
and current.
and current. Flow sensor pulses are also available.
The Quadro exposes four physical and sixteen virtual temperature sensors, a flow
sensor and four PWM controllable fans, along with their speed (in RPM), power,
@ -100,6 +100,7 @@ fan1_min Minimal fan speed (in RPM)
fan1_max Maximal fan speed (in RPM)
fan1_target Target fan speed (in RPM)
fan5_pulses Quadro flow sensor pulses
fan9_pulses Octo flow sensor pulses
power[1-8]_input Pump/fan power (in micro Watts)
in[0-7]_input Pump/fan voltage (in milli Volts)
curr[1-8]_input Pump/fan current (in milli Amperes)

View File

@ -214,6 +214,7 @@ static u16 octo_sensor_fan_offsets[] = { 0x7D, 0x8A, 0x97, 0xA4, 0xB1, 0xBE, 0xC
/* Control report offsets for the Octo */
#define OCTO_TEMP_CTRL_OFFSET 0xA
#define OCTO_FLOW_PULSES_CTRL_OFFSET 0x6
/* Fan speed offsets (0-100%) */
static u16 octo_ctrl_fan_offsets[] = { 0x5B, 0xB0, 0x105, 0x15A, 0x1AF, 0x204, 0x259, 0x2AE };
@ -861,9 +862,16 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3
}
break;
case hwmon_fan_pulses:
/* Special case for Quadro flow sensor */
if (priv->kind == quadro && channel == priv->num_fans)
return 0644;
/* Special case for Quadro/Octo flow sensor */
if (channel == priv->num_fans) {
switch (priv->kind) {
case quadro:
case octo:
return 0644;
default:
break;
}
}
break;
case hwmon_fan_min:
case hwmon_fan_max:
@ -1294,7 +1302,7 @@ static const struct hwmon_channel_info * const aqc_info[] = {
HWMON_F_INPUT | HWMON_F_LABEL,
HWMON_F_INPUT | HWMON_F_LABEL,
HWMON_F_INPUT | HWMON_F_LABEL,
HWMON_F_INPUT | HWMON_F_LABEL),
HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_PULSES),
HWMON_CHANNEL_INFO(power,
HWMON_P_INPUT | HWMON_P_LABEL,
HWMON_P_INPUT | HWMON_P_LABEL,
@ -1671,6 +1679,7 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
priv->buffer_size = OCTO_CTRL_REPORT_SIZE;
priv->ctrl_report_delay = CTRL_REPORT_DELAY;
priv->flow_pulses_ctrl_offset = OCTO_FLOW_PULSES_CTRL_OFFSET;
priv->power_cycle_count_offset = OCTO_POWER_CYCLES;
priv->temp_label = label_temp_sensors;