diff --git a/Makefile b/Makefile index e4186d7..93678b3 100644 --- a/Makefile +++ b/Makefile @@ -2,21 +2,24 @@ # external KDIR specification is supported KDIR ?= /lib/modules/$(shell uname -r)/build +PWD ?= $(shell pwd) SOURCES := aquacomputer_d5next.c docs/aquacomputer_d5next.rst +.PHONY: all modules modules clean checkpatch dev + all: modules install: modules_install modules modules_install clean: - make -C $(KDIR) M=$$PWD $@ + $(MAKE) -C $(KDIR) M=$(PWD) $@ checkpatch: $(KDIR)/scripts/checkpatch.pl --strict --no-tree $(SOURCES) dev: - make clean - make + $(MAKE) clean + $(MAKE) sudo rmmod aquacomputer_d5next || true sudo insmod aquacomputer_d5next.ko diff --git a/aquacomputer_d5next.c b/aquacomputer_d5next.c index ef540d7..42ec79d 100644 --- a/aquacomputer_d5next.c +++ b/aquacomputer_d5next.c @@ -247,15 +247,18 @@ static u16 aquastreamult_sensor_fan_offsets[] = { AQUASTREAMULT_FAN_OFFSET }; #define OCTO_NUM_FANS 8 #define OCTO_NUM_SENSORS 4 #define OCTO_NUM_VIRTUAL_SENSORS 16 +#define OCTO_NUM_FLOW_SENSORS 1 #define OCTO_CTRL_REPORT_SIZE 0x65F /* Sensor report offsets for the Octo */ #define OCTO_SENSOR_START 0x3D #define OCTO_VIRTUAL_SENSORS_START 0x45 +#define OCTO_FLOW_SENSOR_OFFSET 0x7B static u16 octo_sensor_fan_offsets[] = { 0x7D, 0x8A, 0x97, 0xA4, 0xB1, 0xBE, 0xCB, 0xD8 }; /* 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[] = { 0x5A, 0xAF, 0x104, 0x159, 0x1AE, 0x203, 0x258, 0x2AD }; @@ -480,18 +483,6 @@ static const char *const label_aquaero_aquabus_temp_sensors[] = { "Aquabus sensor 20" }; -/* Labels for Octo and Quadro (except speed) */ -static const char *const label_fan_speed[] = { - "Fan 1 speed", - "Fan 2 speed", - "Fan 3 speed", - "Fan 4 speed", - "Fan 5 speed", - "Fan 6 speed", - "Fan 7 speed", - "Fan 8 speed" -}; - static const char *const label_fan_power[] = { "Fan 1 power", "Fan 2 power", @@ -534,6 +525,19 @@ static const char *const label_quadro_speeds[] = { "Flow speed [dL/h]" }; +/* Labels for Octo */ +static const char *const label_octo_speeds[] = { + "Fan 1 speed", + "Fan 2 speed", + "Fan 3 speed", + "Fan 4 speed", + "Fan 5 speed", + "Fan 6 speed", + "Fan 7 speed", + "Fan 8 speed", + "Flow speed [dL/h]", +}; + /* Labels for Aquaero fan speeds */ static const char *const label_aquaero_speeds[] = { "Fan 1 speed", @@ -1074,6 +1078,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3 break; case aquaero: case quadro: + case octo: case highflow: /* Special case to support flow sensors */ if (channel < priv->num_fans + @@ -1098,9 +1103,16 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3 return 0444; 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; default: break; @@ -2437,7 +2449,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_F_INPUT | HWMON_F_LABEL, HWMON_F_INPUT | HWMON_F_LABEL, HWMON_F_INPUT | HWMON_F_LABEL, @@ -2943,15 +2955,18 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id) priv->temp_sensor_start_offset = OCTO_SENSOR_START; priv->num_virtual_temp_sensors = OCTO_NUM_VIRTUAL_SENSORS; priv->virtual_temp_sensor_start_offset = OCTO_VIRTUAL_SENSORS_START; + priv->num_flow_sensors = OCTO_NUM_FLOW_SENSORS; + priv->flow_sensors_start_offset = OCTO_FLOW_SENSOR_OFFSET; priv->power_cycle_count_offset = AQC_POWER_CYCLES; priv->buffer_size = OCTO_CTRL_REPORT_SIZE; - priv->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET; priv->ctrl_report_delay = CTRL_REPORT_DELAY; + priv->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET; + priv->flow_pulses_ctrl_offset = OCTO_FLOW_PULSES_CTRL_OFFSET; priv->temp_label = label_temp_sensors; priv->virtual_temp_label = label_virtual_temp_sensors; - priv->speed_label = label_fan_speed; + priv->speed_label = label_octo_speeds; priv->power_label = label_fan_power; priv->voltage_label = label_fan_voltage; priv->current_label = label_fan_current; diff --git a/docs/aquacomputer_d5next.rst b/docs/aquacomputer_d5next.rst index 985cbe1..d1b3f6d 100644 --- a/docs/aquacomputer_d5next.rst +++ b/docs/aquacomputer_d5next.rst @@ -48,7 +48,7 @@ via its physical interface. The Octo exposes four physical and sixteen virtual temperature sensors, as well as eight PWM controllable fans, along with their speed (in RPM), power, voltage and -current. +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, @@ -115,6 +115,7 @@ fan[1-4]_min Minimal fan speed (in RPM) fan[1-4]_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) diff --git a/re-docs/PROTOCOLS.md b/re-docs/PROTOCOLS.md index 1c83064..4631bce 100644 --- a/re-docs/PROTOCOLS.md +++ b/re-docs/PROTOCOLS.md @@ -191,6 +191,7 @@ Here is what it's currently known to contain: | Fan 6 substructure | 0xBE | | Fan 7 substructure | 0xCB | | Fan 8 substructure | 0xD8 | +| Flow sensor | 0x7B | | Virtual temp sensor 1 | 0x45 | | Virtual temp sensor 2 | 0x47 | | Virtual temp sensor 3 | 0x49 | @@ -231,6 +232,7 @@ Here is what it's currently known to contain: | Fan 7 ctrl substructure | 0x258 | | Fan 8 ctrl substructure | 0x2AD | | Temp offset ctrl substructure | 0xA | +| Flow sensors pulses | 0x6 | | Fan curve "hold min power" and "start boost" | {0x12, 0x1B, 0x24, 0x2D, 0x36, 0x3F, 0x48, 0x51} | | Fan curve min power subgroup | {0x13, 0x1C, 0x25, 0x2E, 0x37, 0x40, 0x49, 0x52} | | Fan curve max power subgroup | {0x15, 0x1E, 0x27, 0x30, 0x39, 0x42, 0x4B, 0x54} |