iio: flow: Sensirion SLF3S liquid flow sensor
Subsystems (3)
Wadim Mueller
maintainerv5 cover iio: flow: Sensirion SLF3S liquid flow sensor
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 [email protected], 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
Signature · 1 line
2.43.0
Wadim Mueller
maintainerPATCH v5 1/4 iio: types: add IIO_VOLUMEFLOW channel type
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.
--- 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(+)
Documentation/ABI/testing/sysfs-bus-iio +11 -0
@@ -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: [email protected] 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: [email protected] +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).
drivers/iio/industrialio-core.c +1 -0
@@ -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[] = {
include/uapi/linux/iio/types.h +1 -0
@@ -54,6 +54,7 @@ enum iio_chan_type {IIO_ATTENTION ,IIO_ALTCURRENT ,IIO_COVERAGE , + IIO_VOLUMEFLOW, }; enum iio_modifier {
tools/iio/iio_event_monitor.c +2 -0
@@ -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;
Signature · 1 line
2.43.0
Wadim Mueller
maintainerPATCH v5 2/4 dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Wadim MuellerDocument 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.
--- .../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
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +58 -0
@@ -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 <[email protected]> + +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>; + }; + };
MAINTAINERS +7 -0
@@ -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 <[email protected]> +R: Maxwell Doose <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml + SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER M: Tomasz Duszynski <[email protected]> S: Maintained
Signature · 1 line
2.43.0
Re: [PATCH v5 2/4] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 43 lines · Wadim Mueller
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_mediumsysfs attribute and therefore not a DT property.Signed-off-by Wadim Mueller <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>--- .../bindings/iio/flow/sensirion,slf3s.yaml | 58 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yamlDocumentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +16
-0@@ -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 <[email protected]> + +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.
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 26
Quoted 10 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +10
-0+ +properties: + compatible: + oneOf: + - const: sensirion,slf3s-1300f + - items: + - enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-4000b + - const: sensirion,slf3s-1300f
This is fine with me, also fine with separate non-compatible compatibles.
Best regards,
Krzysztof
Re: [PATCH v5 2/4] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 48 lines · On Sun, 19 Jul 2026 08:19:34 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 47 lines · Wadim Mueller
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_mediumsysfs attribute and therefore not a DT property.Signed-off-by Wadim Mueller <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>--- .../bindings/iio/flow/sensirion,slf3s.yaml | 58 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yamlDocumentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +20
-0@@ -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 <[email protected]> + +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:
Quoted 8 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 26
Quoted 6 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +6
-0+ - const: sensirion,slf3s-1300f + - items: + - enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-4000b + - const: sensirion,slf3s-1300fThis is fine with me, also fine with separate non-compatible compatibles.
Thanks!
I'd prefer separate to avoid confusing me at least! :)
It needs new version anyway as the driver (patch 4) doesn't seem to have reached me or patchwork.
Jonathan
Quoted 3 lines
Best regards,
Krzysztof
Wadim Mueller
maintainerPATCH v5 3/4 iio: core: add IIO_VAL_DECIMAL64_FEMTO format type
In reply to Wadim MuellerExtend 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.
--- drivers/iio/industrialio-core.c | 2 ++ include/linux/iio/types.h | 1 + 2 files changed, 3 insertions(+)
drivers/iio/industrialio-core.c +2 -0
@@ -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 :
include/linux/iio/types.h +1 -0
@@ -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) {
Signature · 1 line
2.43.0
Quoted 5 lines · On Tue, 14 Jul 2026 10:53:54 +0200 Wadim Mueller <[email protected]> wrote:
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_VOLUMEFLOWchannel type.
Hi Wadim
Something seems to have gone wrong somewhere. I'm not seeing patch 4 and it didn't reach patchwork either.
Thanks,
Jonathan
Quoted 79 lines
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_FEMTOformat 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 newIIO_COVERAGEentries in the channel-type lists resolved (1/4)
* driver: includeerr.hforPTR_ERR()andmath.hfor structs32_fract, per Andy
* driver: fold the per-variant scale_num/scale_den pair into a structs32_fract, per Andy
* driver: add enumslf3s_variant_idand 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_least2" parameter annotation, decouple the ret assignment from its declaration and check errors first, per Andy
* driver: usesizeof()instead ofARRAY_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 fromMILLIDEGREE_PER_DEGREEinstead of a bare 1000, per Andy
* driver: checked the structslf3s_datalayout (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 mismatchdev_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 [email protected], as he requested on the v4 threadThe 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,
WadimWadim Mueller (4):
iio: types: addIIO_VOLUMEFLOWchannel type
dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
iio: core: addIIO_VAL_DECIMAL64_FEMTOformat type
iio: flow: add Sensirion SLF3S liquid flow sensor driverDocumentation/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.cbase-commit:
a50909aa46dec46de3c73235fc15a7d6f763d996
Wadim Mueller
maintainerQuoted 4 lines · On Mon, 20 Jul 2026 03:29:27 +0100 Jonathan Cameron…
Hi Wadim
Something seems to have gone wrong somewhere. I'm not seeing patch 4 and it didn't reach patchwork either.
I have no explanation for it. The other three went out fine, and I was too sloppy to check that 4/4 actually made it to the list. Sorry for the wasted time.
v6 follows shortly, with the driver included and with each variant having its own compatible, as you and Krzysztof settled on. Krzysztof's Reviewed-by on the binding is dropped accordingly.
Thanks,
Wadim