* [PATCH v5 0/4] iio: flow: Sensirion SLF3S liquid flow sensor
@ 2026-07-14 8:53 Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 1/4] iio: types: add IIO_VOLUMEFLOW channel type Wadim Mueller
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wadim Mueller @ 2026-07-14 8:53 UTC (permalink / raw)
To: Jonathan Cameron, Krzysztof Kozlowski, Rob Herring, Conor Dooley,
David Lechner, Nuno Sá, Andy Shevchenko, Maxwell Doose
Cc: linux-iio, devicetree, linux-kernel, Marcelo Schmitt,
Rodrigo Alencar
Hi all,
this series adds a driver for the Sensirion SLF3S family of I2C liquid
flow sensors (SLF3S-0600F / -1300F / -4000B) and a new IIO_VOLUMEFLOW
channel type.
The series is now based on iio.git testing, which already contains
Rodrigo Alencar's IIO_VAL_DECIMAL64_* core formatting work, so the
external dependency listed in v4 is gone. Patch 3/4 adds the
IIO_VAL_DECIMAL64_FEMTO format type on top of it.
The compatible/fallback layout of the dt-binding is intentionally
unchanged from v4 while the discussion on the v4 thread about the
preferred fallback scheme is still open:
https://lore.kernel.org/linux-iio/20260621145117.70b2d50e@jic23-huawei/
Changes since v4
----------------
* rebased onto iio.git testing; trivial conflict with the new
IIO_COVERAGE entries in the channel-type lists resolved (1/4)
* driver: include err.h for PTR_ERR() and math.h for struct
s32_fract, per Andy
* driver: fold the per-variant scale_num/scale_den pair into a
struct s32_fract, per Andy
* driver: add enum slf3s_variant_id and use it for the variant
table and the I2C/OF match tables instead of bare indices, per
Andy
* driver: slf3s_send_cmd(): drop the "at_least 2" parameter
annotation, decouple the ret assignment from its declaration and
check errors first, per Andy
* driver: use sizeof() instead of ARRAY_SIZE() for the measurement
byte buffer, per Andy
* driver: parenthesise the (FEMTO / MILLI) factor so it folds into
a single constant multiplication, per Andy
* driver: derive the temperature scale from MILLIDEGREE_PER_DEGREE
instead of a bare 1000, per Andy
* driver: checked the struct slf3s_data layout (re Andy's pahole
question): the non-pointer members total 260 bytes, so one 4-byte
hole remains for any member order; left as is
* driver: drop the inline comment on the mutex that duplicated the
kernel-doc, per Jonathan
* driver: fix the duplicated argument in the DT/sensor variant
mismatch dev_info(), per Jonathan
* driver: reformat the i2c_device_id/of_device_id tables to one
member per line, per Jonathan
* MAINTAINERS: updated Maxwells address in the R: entry to
maxwell@maxwelld.cc, as he requested on the v4 thread
The signaling-flags word (air-in-line / high-flow / smoothing status) in
each measurement frame is intentionally not read; exposing it can be a
later follow-up.
Thanks,
Wadim
Wadim Mueller (4):
iio: types: add IIO_VOLUMEFLOW channel type
dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
iio: core: add IIO_VAL_DECIMAL64_FEMTO format type
iio: flow: add Sensirion SLF3S liquid flow sensor driver
Documentation/ABI/testing/sysfs-bus-iio | 11 +
Documentation/ABI/testing/sysfs-bus-iio-flow | 21 +
.../bindings/iio/flow/sensirion,slf3s.yaml | 58 ++
MAINTAINERS | 8 +
drivers/iio/Kconfig | 1 +
drivers/iio/Makefile | 1 +
drivers/iio/flow/Kconfig | 22 +
drivers/iio/flow/Makefile | 7 +
drivers/iio/flow/slf3s.c | 541 ++++++++++++++++++
drivers/iio/industrialio-core.c | 3 +
include/linux/iio/types.h | 1 +
include/uapi/linux/iio/types.h | 1 +
tools/iio/iio_event_monitor.c | 2 +
13 files changed, 677 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-flow
create mode 100644 Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml
create mode 100644 drivers/iio/flow/Kconfig
create mode 100644 drivers/iio/flow/Makefile
create mode 100644 drivers/iio/flow/slf3s.c
base-commit: a50909aa46dec46de3c73235fc15a7d6f763d996
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v5 1/4] iio: types: add IIO_VOLUMEFLOW channel type
2026-07-14 8:53 [PATCH v5 0/4] iio: flow: Sensirion SLF3S liquid flow sensor Wadim Mueller
@ 2026-07-14 8:53 ` Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 2/4] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 3/4] iio: core: add IIO_VAL_DECIMAL64_FEMTO format type Wadim Mueller
2 siblings, 0 replies; 4+ messages in thread
From: Wadim Mueller @ 2026-07-14 8:53 UTC (permalink / raw)
To: Jonathan Cameron, Krzysztof Kozlowski, Rob Herring, Conor Dooley,
David Lechner, Nuno Sá, Andy Shevchenko, Maxwell Doose
Cc: linux-iio, devicetree, linux-kernel, Marcelo Schmitt,
Rodrigo Alencar
Add a new IIO channel type for liquid volumetric flow sensors. The
unit exposed via the standard _scale attribute is cubic metres per
second (m^3/s), following the SI convention used by the other IIO
channel types.
Update iio-core's name table, the iio_event_monitor whitelist and
the sysfs-bus-iio ABI document to match. The new _scale attribute is
folded into the existing shared _scale block; only the per-type _raw
needs a fresh entry.
Signed-off-by: Wadim Mueller <wafgo01@gmail.com>
---
Documentation/ABI/testing/sysfs-bus-iio | 11 +++++++++++
drivers/iio/industrialio-core.c | 1 +
include/uapi/linux/iio/types.h | 1 +
tools/iio/iio_event_monitor.c | 2 ++
4 files changed, 15 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index d8d6d85235b0..8dbac1004fea 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -507,6 +507,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_intensity_red_scale
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_green_scale
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_blue_scale
What: /sys/bus/iio/devices/iio:deviceX/in_concentration_co2_scale
+What: /sys/bus/iio/devices/iio:deviceX/in_volumeflow_scale
+What: /sys/bus/iio/devices/iio:deviceX/in_volumeflowY_scale
KernelVersion: 2.6.35
Contact: linux-iio@vger.kernel.org
Description:
@@ -2496,3 +2498,12 @@ Description:
seconds, expressed as:
- a range specified as "[min step max]"
+
+What: /sys/bus/iio/devices/iio:deviceX/in_volumeflow_raw
+What: /sys/bus/iio/devices/iio:deviceX/in_volumeflowY_raw
+KernelVersion: 7.3
+Contact: linux-iio@vger.kernel.org
+Description:
+ Raw (unscaled) volumetric flow rate reading from the channel.
+ To convert to standard units (cubic metres per second, m^3/s)
+ apply the channel's _scale (and _offset, when present).
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 93c2540d4cd2..d6b547207591 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -99,6 +99,7 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_ATTENTION] = "attention",
[IIO_ALTCURRENT] = "altcurrent",
[IIO_COVERAGE] = "coverage",
+ [IIO_VOLUMEFLOW] = "volumeflow",
};
static const char * const iio_modifier_names[] = {
diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
index c9295c707041..d0fb714ca0fd 100644
--- a/include/uapi/linux/iio/types.h
+++ b/include/uapi/linux/iio/types.h
@@ -54,6 +54,7 @@ enum iio_chan_type {
IIO_ATTENTION,
IIO_ALTCURRENT,
IIO_COVERAGE,
+ IIO_VOLUMEFLOW,
};
enum iio_modifier {
diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
index bc3ef4c77c2b..b5c5479b9d78 100644
--- a/tools/iio/iio_event_monitor.c
+++ b/tools/iio/iio_event_monitor.c
@@ -66,6 +66,7 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_ATTENTION] = "attention",
[IIO_ALTCURRENT] = "altcurrent",
[IIO_COVERAGE] = "coverage",
+ [IIO_VOLUMEFLOW] = "volumeflow",
};
static const char * const iio_ev_type_text[] = {
@@ -196,6 +197,7 @@ static bool event_is_known(struct iio_event_data *event)
case IIO_ATTENTION:
case IIO_ALTCURRENT:
case IIO_COVERAGE:
+ case IIO_VOLUMEFLOW:
break;
default:
return false;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v5 2/4] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
2026-07-14 8:53 [PATCH v5 0/4] iio: flow: Sensirion SLF3S liquid flow sensor Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 1/4] iio: types: add IIO_VOLUMEFLOW channel type Wadim Mueller
@ 2026-07-14 8:53 ` Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 3/4] iio: core: add IIO_VAL_DECIMAL64_FEMTO format type Wadim Mueller
2 siblings, 0 replies; 4+ messages in thread
From: Wadim Mueller @ 2026-07-14 8:53 UTC (permalink / raw)
To: Jonathan Cameron, Krzysztof Kozlowski, Rob Herring, Conor Dooley,
David Lechner, Nuno Sá, Andy Shevchenko, Maxwell Doose
Cc: linux-iio, devicetree, linux-kernel, Marcelo Schmitt,
Rodrigo Alencar
Document the bindings for the Sensirion SLF3S family of digital
liquid-flow sensors on I2C. The family currently covers the
SLF3S-0600F, SLF3S-1300F and SLF3S-4000B variants.
All variants share the same register map and are fully detectable
from the product-information register at probe time, so
sensirion,slf3s-1300f serves as the fallback compatible for the
other variants.
The active calibration medium (water / IPA) is runtime-switchable
via the in_volumeflow_medium sysfs attribute and therefore not a
DT property.
Signed-off-by: Wadim Mueller <wafgo01@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
.../bindings/iio/flow/sensirion,slf3s.yaml | 58 +++++++++++++++++++
MAINTAINERS | 7 +++
2 files changed, 65 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml
diff --git a/Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml b/Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml
new file mode 100644
index 000000000000..c054a505b75d
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/flow/sensirion,slf3s.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sensirion SLF3S liquid flow sensor
+
+maintainers:
+ - Wadim Mueller <wafgo01@gmail.com>
+
+description:
+ Family of digital liquid-flow sensors from Sensirion with I2C interface. All
+ family members share the same register map; sub-types differ only in the flow
+ scale factor and the calibrated measurement range. The sub-type can be
+ identified from the product-information register.
+
+properties:
+ compatible:
+ oneOf:
+ - const: sensirion,slf3s-1300f
+ - items:
+ - enum:
+ - sensirion,slf3s-0600f
+ - sensirion,slf3s-4000b
+ - const: sensirion,slf3s-1300f
+
+ reg:
+ maxItems: 1
+
+ vdd-supply: true
+
+ interrupts:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - vdd-supply
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ flow-sensor@8 {
+ compatible = "sensirion,slf3s-0600f", "sensirion,slf3s-1300f";
+ reg = <0x08>;
+ vdd-supply = <®_3v3>;
+ interrupt-parent = <&gpio0>;
+ interrupts = <0 IRQ_TYPE_EDGE_RISING>;
+ };
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index b051eccafa60..f400b82520a4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -24296,6 +24296,13 @@ S: Maintained
F: Documentation/ABI/testing/sysfs-bus-iio-chemical-sgp40
F: drivers/iio/chemical/sgp40.c
+SENSIRION SLF3S LIQUID FLOW SENSOR DRIVER
+M: Wadim Mueller <wafgo01@gmail.com>
+R: Maxwell Doose <maxwell@maxwelld.cc>
+L: linux-iio@vger.kernel.org
+S: Maintained
+F: Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml
+
SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER
M: Tomasz Duszynski <tduszyns@gmail.com>
S: Maintained
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v5 3/4] iio: core: add IIO_VAL_DECIMAL64_FEMTO format type
2026-07-14 8:53 [PATCH v5 0/4] iio: flow: Sensirion SLF3S liquid flow sensor Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 1/4] iio: types: add IIO_VOLUMEFLOW channel type Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 2/4] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor Wadim Mueller
@ 2026-07-14 8:53 ` Wadim Mueller
2 siblings, 0 replies; 4+ messages in thread
From: Wadim Mueller @ 2026-07-14 8:53 UTC (permalink / raw)
To: Jonathan Cameron, Krzysztof Kozlowski, Rob Herring, Conor Dooley,
David Lechner, Nuno Sá, Andy Shevchenko, Maxwell Doose
Cc: linux-iio, devicetree, linux-kernel, Marcelo Schmitt,
Rodrigo Alencar
Extend the IIO_VAL_DECIMAL64_* family with a femto-scaled variant
(scale 15), following the existing MILLI/MICRO/NANO/PICO pattern. Both
the read formatting path in __iio_format_value() and the write parsing
path in iio_write_channel_info() (via kstrtodec64()) already derive
their scale from "type - IIO_VAL_DECIMAL64_BASE", so the new type only
needs to be added to the respective switch cases.
This is needed by drivers reporting very small SI quantities where the
existing pico scale loses precision. For example the Sensirion SLF3S
liquid flow sensor reports its volume-flow scale in m^3/s, where the
SLF3S-0600F scale is ~1.667e-12 m^3/s: at pico scale only a single
significant digit survives, whereas femto scale preserves the full
sensor resolution.
Signed-off-by: Wadim Mueller <wafgo01@gmail.com>
Reviewed-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/industrialio-core.c | 2 ++
include/linux/iio/types.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index d6b547207591..8e593f5741e1 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -715,6 +715,7 @@ static ssize_t __iio_format_value(char *buf, size_t offset, unsigned int type,
case IIO_VAL_DECIMAL64_MICRO:
case IIO_VAL_DECIMAL64_NANO:
case IIO_VAL_DECIMAL64_PICO:
+ case IIO_VAL_DECIMAL64_FEMTO:
{
int scale = type - IIO_VAL_DECIMAL64_BASE;
s64 frac;
@@ -1032,6 +1033,7 @@ static ssize_t iio_write_channel_info(struct device *dev,
case IIO_VAL_DECIMAL64_MICRO:
case IIO_VAL_DECIMAL64_NANO:
case IIO_VAL_DECIMAL64_PICO:
+ case IIO_VAL_DECIMAL64_FEMTO:
dec_scale = type - IIO_VAL_DECIMAL64_BASE;
fallthrough;
case IIO_VAL_INT_64:
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 924ac9dc6893..d8944c9e5e90 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -42,6 +42,7 @@ enum iio_event_info {
#define IIO_VAL_DECIMAL64_MICRO (IIO_VAL_DECIMAL64_BASE + 6)
#define IIO_VAL_DECIMAL64_NANO (IIO_VAL_DECIMAL64_BASE + 9)
#define IIO_VAL_DECIMAL64_PICO (IIO_VAL_DECIMAL64_BASE + 12)
+#define IIO_VAL_DECIMAL64_FEMTO (IIO_VAL_DECIMAL64_BASE + 15)
static inline s64 iio_val_s64_compose(s32 val0, s32 val1)
{
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-14 8:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 8:53 [PATCH v5 0/4] iio: flow: Sensirion SLF3S liquid flow sensor Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 1/4] iio: types: add IIO_VOLUMEFLOW channel type Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 2/4] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor Wadim Mueller
2026-07-14 8:53 ` [PATCH v5 3/4] iio: core: add IIO_VAL_DECIMAL64_FEMTO format type Wadim Mueller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox