All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] hwmon: (aquacomputer_d5next) Support for Octo flow sensor and pulses
@ 2024-04-17 17:50 Aleksa Savic
  2024-04-17 17:50 ` [PATCH 1/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor Aleksa Savic
  2024-04-17 17:50 ` [PATCH 2/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor pulses Aleksa Savic
  0 siblings, 2 replies; 5+ messages in thread
From: Aleksa Savic @ 2024-04-17 17:50 UTC (permalink / raw)
  To: linux-hwmon
  Cc: David Flemstrom, Aleksa Savic, Jack Doan, Jean Delvare,
	Guenter Roeck, Jonathan Corbet, linux-doc, linux-kernel

This patch series adds support for the flow sensor and flow sensor pulses
of the Aquacomputer Octo fan controller.

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

 Documentation/hwmon/aquacomputer_d5next.rst |  9 ++--
 drivers/hwmon/aquacomputer_d5next.c         | 51 ++++++++++++++-------
 2 files changed, 39 insertions(+), 21 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor
  2024-04-17 17:50 [PATCH 0/2] hwmon: (aquacomputer_d5next) Support for Octo flow sensor and pulses Aleksa Savic
@ 2024-04-17 17:50 ` Aleksa Savic
  2024-04-28 17:20   ` Guenter Roeck
  2024-04-17 17:50 ` [PATCH 2/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor pulses Aleksa Savic
  1 sibling, 1 reply; 5+ messages in thread
From: Aleksa Savic @ 2024-04-17 17:50 UTC (permalink / raw)
  To: linux-hwmon
  Cc: David Flemstrom, Aleksa Savic, Jack Doan, Jean Delvare,
	Guenter Roeck, Jonathan Corbet, linux-doc, linux-kernel

Add support for reading the flow sensor value 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>
---
 Documentation/hwmon/aquacomputer_d5next.rst |  8 ++---
 drivers/hwmon/aquacomputer_d5next.c         | 34 +++++++++++++--------
 2 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/Documentation/hwmon/aquacomputer_d5next.rst b/Documentation/hwmon/aquacomputer_d5next.rst
index cb073c79479c..f84b6a5e4373 100644
--- a/Documentation/hwmon/aquacomputer_d5next.rst
+++ b/Documentation/hwmon/aquacomputer_d5next.rst
@@ -45,9 +45,9 @@ seems to require sending it a complete configuration. That includes addressable
 RGB LEDs, for which there is no standard sysfs interface. Thus, that task is
 better suited for userspace tools.
 
-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.
+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.
 
 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,
@@ -95,7 +95,7 @@ Sysfs entries
 ================ ==============================================================
 temp[1-20]_input Physical/virtual temperature sensors (in millidegrees Celsius)
 temp[1-8]_offset Temperature sensor correction offset (in millidegrees Celsius)
-fan[1-8]_input   Pump/fan speed (in RPM) / Flow speed (in dL/h)
+fan[1-9]_input   Pump/fan speed (in RPM) / Flow speed (in dL/h)
 fan1_min         Minimal fan speed (in RPM)
 fan1_max         Maximal fan speed (in RPM)
 fan1_target      Target fan speed (in RPM)
diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
index 2efe97f8d003..166044e01921 100644
--- a/drivers/hwmon/aquacomputer_d5next.c
+++ b/drivers/hwmon/aquacomputer_d5next.c
@@ -202,12 +202,14 @@ 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_POWER_CYCLES		0x18
 #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 */
@@ -363,18 +365,6 @@ static const char *const label_aquaero_calc_temp_sensors[] = {
 	"Calc. virtual sensor 4"
 };
 
-/* 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",
@@ -408,6 +398,19 @@ static const char *const label_fan_current[] = {
 	"Fan 8 current"
 };
 
+/* Labels for Octo fan speeds */
+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 Quadro fan speeds */
 static const char *const label_quadro_speeds[] = {
 	"Fan 1 speed",
@@ -844,6 +847,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3
 					return 0444;
 				break;
 			case aquaero:
+			case octo:
 			case quadro:
 			case highflow:
 				/* Special case to support flow sensors */
@@ -1289,6 +1293,7 @@ static const struct hwmon_channel_info * const aqc_info[] = {
 			   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,
 			   HWMON_F_INPUT | HWMON_F_LABEL),
 	HWMON_CHANNEL_INFO(power,
 			   HWMON_P_INPUT | HWMON_P_LABEL,
@@ -1658,6 +1663,9 @@ 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->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET;
 
 		priv->buffer_size = OCTO_CTRL_REPORT_SIZE;
@@ -1667,7 +1675,7 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
 		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;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor pulses
  2024-04-17 17:50 [PATCH 0/2] hwmon: (aquacomputer_d5next) Support for Octo flow sensor and pulses Aleksa Savic
  2024-04-17 17:50 ` [PATCH 1/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor Aleksa Savic
@ 2024-04-17 17:50 ` Aleksa Savic
  2024-04-28 17:21   ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Aleksa Savic @ 2024-04-17 17:50 UTC (permalink / raw)
  To: linux-hwmon
  Cc: David Flemstrom, Aleksa Savic, Jack Doan, Jean Delvare,
	Guenter Roeck, Jonathan Corbet, linux-doc, linux-kernel

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>
---
 Documentation/hwmon/aquacomputer_d5next.rst |  3 ++-
 drivers/hwmon/aquacomputer_d5next.c         | 17 +++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/Documentation/hwmon/aquacomputer_d5next.rst b/Documentation/hwmon/aquacomputer_d5next.rst
index f84b6a5e4373..49163f387b90 100644
--- a/Documentation/hwmon/aquacomputer_d5next.rst
+++ b/Documentation/hwmon/aquacomputer_d5next.rst
@@ -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)
diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
index 166044e01921..8e55cd2f46f5 100644
--- a/drivers/hwmon/aquacomputer_d5next.c
+++ b/drivers/hwmon/aquacomputer_d5next.c
@@ -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;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor
  2024-04-17 17:50 ` [PATCH 1/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor Aleksa Savic
@ 2024-04-28 17:20   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2024-04-28 17:20 UTC (permalink / raw)
  To: Aleksa Savic
  Cc: linux-hwmon, David Flemstrom, Jack Doan, Jean Delvare,
	Jonathan Corbet, linux-doc, linux-kernel

On Wed, Apr 17, 2024 at 07:50:35PM +0200, Aleksa Savic wrote:
> Add support for reading the flow sensor value 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>

Applied.

Thanks,
Guenter

> ---
>  Documentation/hwmon/aquacomputer_d5next.rst |  8 ++---
>  drivers/hwmon/aquacomputer_d5next.c         | 34 +++++++++++++--------
>  2 files changed, 25 insertions(+), 17 deletions(-)
> 
> diff --git a/Documentation/hwmon/aquacomputer_d5next.rst b/Documentation/hwmon/aquacomputer_d5next.rst
> index cb073c79479c..f84b6a5e4373 100644
> --- a/Documentation/hwmon/aquacomputer_d5next.rst
> +++ b/Documentation/hwmon/aquacomputer_d5next.rst
> @@ -45,9 +45,9 @@ seems to require sending it a complete configuration. That includes addressable
>  RGB LEDs, for which there is no standard sysfs interface. Thus, that task is
>  better suited for userspace tools.
>  
> -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.
> +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.
>  
>  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,
> @@ -95,7 +95,7 @@ Sysfs entries
>  ================ ==============================================================
>  temp[1-20]_input Physical/virtual temperature sensors (in millidegrees Celsius)
>  temp[1-8]_offset Temperature sensor correction offset (in millidegrees Celsius)
> -fan[1-8]_input   Pump/fan speed (in RPM) / Flow speed (in dL/h)
> +fan[1-9]_input   Pump/fan speed (in RPM) / Flow speed (in dL/h)
>  fan1_min         Minimal fan speed (in RPM)
>  fan1_max         Maximal fan speed (in RPM)
>  fan1_target      Target fan speed (in RPM)
> diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
> index 2efe97f8d003..166044e01921 100644
> --- a/drivers/hwmon/aquacomputer_d5next.c
> +++ b/drivers/hwmon/aquacomputer_d5next.c
> @@ -202,12 +202,14 @@ 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_POWER_CYCLES		0x18
>  #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 */
> @@ -363,18 +365,6 @@ static const char *const label_aquaero_calc_temp_sensors[] = {
>  	"Calc. virtual sensor 4"
>  };
>  
> -/* 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",
> @@ -408,6 +398,19 @@ static const char *const label_fan_current[] = {
>  	"Fan 8 current"
>  };
>  
> +/* Labels for Octo fan speeds */
> +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 Quadro fan speeds */
>  static const char *const label_quadro_speeds[] = {
>  	"Fan 1 speed",
> @@ -844,6 +847,7 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3
>  					return 0444;
>  				break;
>  			case aquaero:
> +			case octo:
>  			case quadro:
>  			case highflow:
>  				/* Special case to support flow sensors */
> @@ -1289,6 +1293,7 @@ static const struct hwmon_channel_info * const aqc_info[] = {
>  			   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,
>  			   HWMON_F_INPUT | HWMON_F_LABEL),
>  	HWMON_CHANNEL_INFO(power,
>  			   HWMON_P_INPUT | HWMON_P_LABEL,
> @@ -1658,6 +1663,9 @@ 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->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET;
>  
>  		priv->buffer_size = OCTO_CTRL_REPORT_SIZE;
> @@ -1667,7 +1675,7 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  
>  		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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor pulses
  2024-04-17 17:50 ` [PATCH 2/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor pulses Aleksa Savic
@ 2024-04-28 17:21   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2024-04-28 17:21 UTC (permalink / raw)
  To: Aleksa Savic
  Cc: linux-hwmon, David Flemstrom, Jack Doan, Jean Delvare,
	Jonathan Corbet, linux-doc, linux-kernel

On Wed, Apr 17, 2024 at 07:50:36PM +0200, Aleksa Savic wrote:
> 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>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-28 17:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 17:50 [PATCH 0/2] hwmon: (aquacomputer_d5next) Support for Octo flow sensor and pulses Aleksa Savic
2024-04-17 17:50 ` [PATCH 1/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor Aleksa Savic
2024-04-28 17:20   ` Guenter Roeck
2024-04-17 17:50 ` [PATCH 2/2] hwmon: (aquacomputer_d5next) Add support for Octo flow sensor pulses Aleksa Savic
2024-04-28 17:21   ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.