iio: flow: Sensirion SLF3S liquid flow sensor
Subsystems (3)
Wadim Mueller
maintainerv3 cover iio: flow: Sensirion SLF3S liquid flow sensor
Hi all,
v3 addresses the per-patch review feedback from Jonathan (driver + cover, https://lore.kernel.org/linux-iio/20260528124413.6c91e1bb@jic23-huawei/)
and Krzysztof (dt-binding,
https://lore.kernel.org/linux-iio/20260528-transparent-adventurous-python-af8f69@quoll/).
As requested this is sent as a fresh thread, not in-reply-to v2.
The IIO_VOLUMEFLOW patch (1/3) is unchanged from v2.
Changes since v2:
* dt-bindings: drop the generic-only "sensirion,slf3s" compatible;
the per-variant compatibles stay (-0600F, -1300F, -4000B) * dt-bindings: drop the optional interrupts property -- the driver is polled-only and the binding should not advertise something we do not consume
* dt-bindings: drop the sensirion,medium property and move medium selection to the IIO sysfs in_volumeflow_medium ext_info enum; the sensor starts in water mode after probe and IPA is selected at runtime via that attribute
* dt-bindings: MAINTAINERS no longer claims drivers/iio/flow/
* driver: includes cleaned up per IWYU (drop property.h since no DT property is read any more, add array_size.h / dev_printk.h / device.h / errno.h / types.h / units.h)
* driver: drop the SLF3S_MEAS_LEN define in favour of ARRAY_SIZE()
* driver: inline SLF3S_TEMP_SCALE_MILLIC at the call site with a short comment that explains the 1000/200 ratio
* driver: use 600 * MICRO / 30 * MICRO / 1920 * MILLI from linux/units.h for the per-variant scale denominators
* driver: slf3s_send_cmd() takes cmd[at_least 2] (kernel idiom) rather than cmd[static 2]
* driver: detection wins over the DT-supplied compatible; a mismatch is reported with dev_info and the sensor-reported variant is used
* driver: SLF3S_MEAS_START_DELAY_US bumped to 60 ms (datasheet section 2.2, tw) and a 25 ms tPU power-up delay is observed between regulator enable and the first I2C command
* driver: blank line before plain return statements; minor reflow to 80 columns
* commit messages: drop the manual Cc trailers (get_maintainer.pl handles those) and move Signed-off-by to the end of the trailer block
Patches:
1/3 iio: types: add IIO_VOLUMEFLOW channel type (unchanged) 2/3 dt-bindings: iio: flow: add Sensirion SLF3S binding 3/3 iio: flow: add Sensirion SLF3S liquid flow sensor driver
Tested with an SLF3S-0600F on a TI AM64x platform; W=1 build clean, checkpatch --strict clean, dt_binding_check clean.
Thanks,
Wadim
Wadim Mueller (3):
iio: types: add IIO_VOLUMEFLOW channel type
dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
iio: flow: add Sensirion SLF3S liquid flow sensor driver
Documentation/ABI/testing/sysfs-bus-iio | 11 + .../bindings/iio/flow/sensirion,slf3s.yaml | 49 +++ MAINTAINERS | 8 + drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/flow/Kconfig | 27 ++ drivers/iio/flow/Makefile | 7 + drivers/iio/flow/slf3s.c | 406 ++++++++++++++++++ drivers/iio/industrialio-core.c | 1 + include/uapi/linux/iio/types.h | 1 + tools/iio/iio_event_monitor.c | 2 + 11 files changed, 514 insertions(+) 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
Signature · 1 line
2.52.0
Wadim Mueller
maintainerPATCH v3 1/3 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 litres per second (l/s), so drivers reporting smaller native units (e.g. ml/min) only need to set a fractional scale.
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:
@@ -2458,3 +2460,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: 6.19 +Contact: [email protected] +Description: + Raw (unscaled) volumetric flow rate reading from the channel. + To convert to standard units (litres per second) apply the + channel's _scale (and _offset, when present).
drivers/iio/industrialio-core.c +1 -0
@@ -98,6 +98,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_CHROMATICITY] = "chromaticity", [IIO_ATTENTION] = "attention", [IIO_ALTCURRENT] = "altcurrent", + [IIO_VOLUMEFLOW] = "volumeflow", };static const char *const iio_modifier_names[] = {
include/uapi/linux/iio/types.h +1 -0
@@ -53,6 +53,7 @@ enum iio_chan_type {IIO_CHROMATICITY ,IIO_ATTENTION ,IIO_ALTCURRENT , + IIO_VOLUMEFLOW, }; enum iio_modifier {
tools/iio/iio_event_monitor.c +2 -0
@@ -65,6 +65,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_CHROMATICITY] = "chromaticity", [IIO_ATTENTION] = "attention", [IIO_ALTCURRENT] = "altcurrent", + [IIO_VOLUMEFLOW] = "volumeflow", };static const char *const iio_ev_type_text[] = {
@@ -193,6 +194,7 @@ static bool event_is_known(struct iio_event_data *event)case IIO_CHROMATICITY :case IIO_ATTENTION :case IIO_ALTCURRENT : +case IIO_VOLUMEFLOW :break ;default :return false;
Signature · 1 line
2.52.0
Wadim Mueller
maintainerPATCH v3 2/3 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and dt_binding_check purposes.
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 | 49 +++++++++++++++++++ MAINTAINERS | 8 +++ 2 files changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +49 -0
@@ -0,0 +1,49 @@ +# 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, both of which are detected at probe time via the + product-information register. + +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000b + + reg: + maxItems: 1 + + vdd-supply: true + +required: + - compatible + - reg + - vdd-supply + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + flow-sensor@8 { + compatible = "sensirion,slf3s-0600f"; + reg = <0x08>; + vdd-supply = <®_3v3>; + }; + };
MAINTAINERS +8 -0
@@ -24187,6 +24187,14 @@ 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 +F: drivers/iio/flow/slf3s.c + SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER M: Tomasz Duszynski <[email protected]> S: Maintained
Signature · 1 line
2.52.0
Wadim Mueller
maintainerPATCH v3 3/3 iio: flow: add Sensirion SLF3S liquid flow sensor driver
In reply to Wadim MuellerAdd a driver for the Sensirion SLF3S family of digital liquid-flow sensors on I2C. Currently supported variants are SLF3S-0600F, SLF3S-1300F and SLF3S-4000B; they share the same register map and differ only in flow-scale factor and calibrated measurement range. The variant (and therefore the scale) is auto-detected from the product-information register at probe time.
Each measurement frame returns a 16-bit signed flow value, a 16-bit signed temperature reading and a status word, each protected by a CRC-8 byte. The driver exposes the flow rate as IIO_VOLUMEFLOW and the temperature as IIO_TEMP via the standard IIO read_raw / read_scale interface.
The active calibration medium can be switched at runtime between the factory-calibrated water and isopropyl-alcohol modes via the in_volumeflow_medium sysfs attribute; the sensor starts in water mode after probe.
This driver also creates the drivers/iio/flow/ subdirectory and the corresponding Kconfig/Makefile glue.
--- drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/flow/Kconfig | 27 +++ drivers/iio/flow/Makefile | 7 + drivers/iio/flow/slf3s.c | 406 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 442 insertions(+) create mode 100644 drivers/iio/flow/Kconfig create mode 100644 drivers/iio/flow/Makefile create mode 100644 drivers/iio/flow/slf3s.c
drivers/iio/Kconfig +1 -0
@@ -92,6 +92,7 @@ source "drivers/iio/common/Kconfig" source "drivers/iio/dac/Kconfig" source "drivers/iio/dummy/Kconfig" source "drivers/iio/filter/Kconfig" +source "drivers/iio/flow/Kconfig" source "drivers/iio/frequency/Kconfig" source "drivers/iio/gyro/Kconfig" source "drivers/iio/health/Kconfig"
drivers/iio/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-y += dac/ obj-y += dummy/ obj-y += gyro/ obj-y += filter/ +obj-y += flow/ obj-y += frequency/ obj-y += health/ obj-y += humidity/
drivers/iio/flow/Kconfig new file +27 -0
@@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Liquid / gas flow sensor drivers +# +# When adding new entries keep the list in alphabetical order + +menu "Flow sensors" + +config SENSIRION_SLF3S + tristate "Sensirion SLF3S liquid flow sensor" + depends on I2C + select CRC8 + help + Say yes here to build support for the Sensirion SLF3S family + of digital liquid-flow sensors: + + - SLF3S-0600F + - SLF3S-1300F + - SLF3S-4000B + + The driver reports the volumetric flow rate and the embedded + temperature reading via the standard IIO interface. + + To compile this driver as a module, choose M here: the module + will be called slf3s. + +endmenu
drivers/iio/flow/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for industrial I/O flow sensor drivers +# + +# When adding new entries keep the list in alphabetical order +obj-$(CONFIG_SENSIRION_SLF3S) += slf3s.o
drivers/iio/flow/slf3s.c new file +406 -0
406 lines not on this page · raw message
Signature · 1 line
2.52.0
[email protected]
AI reviewRe: [PATCH v3 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Probe fails after a warm reboot or kexec because the sensor is not stopped before reading the…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Probe fails after a warm reboot or kexec because the sensor is not stopped before reading the product ID.
- [Medium] Missing power management (PM) operations causes device failure after system suspend/resume. --
commit f4e028602d040a62e916ee2e4f3679882fcd7b4e
Author: Wadim Mueller <[email protected]>
iio: flow: add Sensirion SLF3S liquid flow sensor driver
This adds a new IIO driver for the Sensirion SLF3S family of liquid-flow sensors. The driver supports reporting volumetric flow rate and temperature over I2C, and handles switching the calibration medium between water and isopropyl alcohol at runtime.
Quoted 5 lines
drivers/iio/flow/slf3s.c new file +0
-0
[ ... ]
drivers/iio/flow/slf3s.c line 149
Quoted 9 lines
drivers/iio/flow/slf3s.c new file +9
-0+static int slf3s_detect_variant (struct slf3s_data *sf) +{ +struct i2c_client *client = sf->client; +u8 buf[SLF3S_PRODUCT_ID_LEN ]; +int ret; + + ret =slf3s_send_cmd (client, slf3s_cmd_prep_pid); +if (ret) +return ret;
[Severity: High]
If the system goes through a warm reboot or kexec, won't the sensor still be running in continuous measurement mode since there is no .shutdown callback?
If the sensor is actively measuring, will it NACK the 'read product ID' command sent here and cause the probe to unconditionally fail? Should a stop measurement command be sent before trying to read the product ID?
[ ... ]
drivers/iio/flow/slf3s.c line 402
Quoted 9 lines
drivers/iio/flow/slf3s.c new file +9
-0+static struct i2c_driver slf3s_driver = { + .driver = { + .name ="slf3s" , + .of_match_table = slf3s_of_match, + }, + .probe = slf3s_probe, + .id_table = slf3s_id, +}; +module_i2c_driver (slf3s_driver);
[Severity: Medium]
Since the driver lacks power management operations, what happens when the system suspends and resumes?
If power is cut to the sensor during suspend, won't it reset to the IDLE state and cause subsequent IIO reads to fail because the driver never re-issues the start command? Or if power isn't cut, will leaving it actively measuring waste power?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Wadim MuellerHello Wadim,
The dt doc looks good to me.
A couple of minor comments inline.
Quoted 44 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.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]>--- .../bindings/iio/flow/sensirion,slf3s.yaml | 49 +++++++++++++++++++ MAINTAINERS | 8 +++ 2 files changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yamlDocumentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +19
-0@@ -0,0 +1,49 @@ +# 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, both of which are detected at probe time via the + product-information register. + +properties:
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 29
Quoted 10 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +10
-0+ compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000b + + reg: + maxItems: 1 + + vdd-supply: true
We could add a mention to the IRQ pin to make the doc more complete.
interrupts:
maxItems: 1
Though, I see the chip has an unused pin. If future designs implement an aditional IRQ signaling on that unused pin, we would need to add extra properties to the dt-doc to specify the number of interrupts each design has. Anyway, documenting the IRQ now is probably okay even if we have to update it in the future.
Quoted 25 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +20
-0+ +required: + - compatible + - reg + - vdd-supply + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + flow-sensor@8 { + compatible = "sensirion,slf3s-0600f"; + reg = <0x08>; + vdd-supply = <®_3v3>; + }; + };MAINTAINERS +0
-0
MAINTAINERS S: Maintained · line 24196
Quoted 10 lines
MAINTAINERS +7
-0@@ -24187,6 +24187,14 @@ 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 +F: drivers/iio/flow/slf3s.c
The driver file is added in patch 2 so the above line would be introduced in the second patch.
With the MAINTAINERS entry adjustment,
Quoted 8 lines
MAINTAINERS +1
-0+ SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER M: Tomasz Duszynski <[email protected]> S: MaintainedSignature · 1 line
2.52.0
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
...
Quoted 8 lines
Quoted 8 lines
MAINTAINERS +0
-0@@ -24187,6 +24187,14 @@ S: Maintained F: Documentation/ABI/testing/sysfs-bus-iio-chemical-sgp40 F: drivers/iio/chemical/sgp40.c
Quoted 9 lines
MAINTAINERS S: Maintained · line 24196
Quoted 7 lines
MAINTAINERS +7
-0+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 +F: drivers/iio/flow/slf3s.cThe driver file is added in patch 2 so the above line would be introduced in the second patch.
The patch adding the driver is actually patch number 3. Anyways, add the line for the driver file only in the patch that adds that file to the kernel.
Quoted 3 lines
With the
MAINTAINERSentry adjustment,Reviewed-by Marcelo Schmitt <[email protected]>
Re: [PATCH v3 1/3] iio: types: add IIO_VOLUMEFLOW channel type
In reply to Wadim MuellerQuoted 32 lines · Wadim Mueller
Add a new IIO channel type for liquid volumetric flow sensors. The unit exposed via the standard
_scaleattribute is litres per second (l/s), so drivers reporting smaller native units (e.g. ml/min) only need to set a fractional scale.Update iio-core's name table, the
iio_event_monitorwhitelist and the sysfs-bus-iio ABI document to match. The new_scaleattribute is folded into the existing shared_scaleblock; only the per-type_rawneeds a fresh entry.Signed-off-by Wadim Mueller <[email protected]>--- 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 +2
-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:
Documentation/ABI/testing/sysfs-bus-iio Description: · line 2466
Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-iio +4
-0@@ -2458,3 +2460,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: 6.19
This is probably only landing in kernel 7.2 (or later?), so bumping the version seems appropriate.
Documentation/ABI/testing/sysfs-bus-iio Description: · line 2471
Quoted 5 lines
Documentation/ABI/testing/sysfs-bus-iio +5
-0+Contact: [email protected] +Description: + Raw (unscaled) volumetric flow rate reading from the channel. + To convert to standard units (litres per second) apply the + channel's _scale (and _offset, when present).
Early reviews suggested to use SI units so I think we would have cubic meters per second. Disregard if I missed some review accepting it as liters per second.
With best regards,
Marcelo
Re: [PATCH v3 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver
In reply to Wadim MuellerHi Wadim,
Quoted 22 lines · On Sat, 30 May 2026 22:54:32 +0200 Wadim Mueller <[email protected]> wrote:
Add a driver for the Sensirion SLF3S family of digital liquid-flow sensors on I2C. Currently supported variants are SLF3S-0600F, SLF3S-1300F and SLF3S-4000B; they share the same register map and differ only in flow-scale factor and calibrated measurement range. The variant (and therefore the scale) is auto-detected from the product-information register at probe time.
Each measurement frame returns a 16-bit signed flow value, a 16-bit signed temperature reading and a status word, each protected by a CRC-8 byte. The driver exposes the flow rate as
IIO_VOLUMEFLOWand the temperature asIIO_TEMPvia the standard IIOread_raw/read_scaleinterface.The active calibration medium can be switched at runtime between the factory-calibrated water and isopropyl-alcohol modes via the
in_volumeflow_mediumsysfs attribute; the sensor starts in water mode after probe.This driver also creates the
drivers/iio/flow/subdirectory and the corresponding Kconfig/Makefile glue.Signed-off-by Wadim Mueller <[email protected]>
Quoted 11 lines
--- drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/flow/Kconfig | 27 +++ drivers/iio/flow/Makefile | 7 + drivers/iio/flow/slf3s.c | 406 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 442 insertions(+) create mode 100644 drivers/iio/flow/Kconfig create mode 100644 drivers/iio/flow/Makefile create mode 100644 drivers/iio/flow/slf3s.c
Nice code. Just have a couple of questions (+sashiko has some concerns as well).
[snip]
Quoted 10 lines
drivers/iio/flow/slf3s.c new file +10
-0+/* +* Read the product-info block and pick the matching variant. The +* sub-type byte returned by the sensor is the source of truth; a +* DT-supplied compatible only seeds an initial guess and is overridden +* on mismatch (with an informational message so misconfigured device +* trees are easy to spot). +* +* Bus / CRC failures are real errors and fail probe. An unknown +* sub-type byte fails probe too: we cannot publish a meaningful scale +* without a matching entry in slf3s_variants[].
drivers/iio/flow/slf3s.c line 149
Quoted 10 lines
drivers/iio/flow/slf3s.c new file +10
-0+*/ +static int slf3s_detect_variant (struct slf3s_data *sf) +{ +struct i2c_client *client = sf->client; +u8 buf[SLF3S_PRODUCT_ID_LEN ]; +int ret; + + ret =slf3s_send_cmd (client, slf3s_cmd_prep_pid); +if (ret) +return ret;
Here sashiko said:
"If the system goes through a warm reboot or kexec, won't the sensor still be running in continuous measurement mode since there is no .shutdown callback? If the sensor is actively measuring, will it NACK the 'read product ID' command sent here and cause the probe to unconditionally fail? Should a stop measurement command be sent before trying to read the product ID?"
Was looking and didn't find a shutdown callback, so you'll probably want to add that.
Quoted 10 lines
drivers/iio/flow/slf3s.c new file +10
-0+ ret =slf3s_send_cmd (client, slf3s_cmd_read_pid); +if (ret) +return ret; + + ret =i2c_master_recv (client, buf,sizeof (buf)); +if (ret <0 ) +return ret; +if (ret !=sizeof (buf)) +return -EIO ; +
drivers/iio/flow/slf3s.c line 170
Quoted 10 lines
drivers/iio/flow/slf3s.c new file +10
-0+for (unsigned int i =0 ; i <SLF3S_PRODUCT_ID_LEN ; i +=3 ) { +if (!slf3s_crc_valid (sf, &buf[i])) +return -EIO ; + } + +if (buf[SLF3S_PRODUCT_FAMILY_BYTE ] !=SLF3S_PRODUCT_FAMILY_ID ) +dev_info (&client->dev, +"unexpected family byte 0x%02x (expected 0x%02x)\n" , + buf[SLF3S_PRODUCT_FAMILY_BYTE ], +SLF3S_PRODUCT_FAMILY_ID );
This feels like something that could be dev_warn() to me (if it's unexpected then it means it probably shouldn't happen!)
drivers/iio/flow/slf3s.c line 182
Quoted 12 lines
drivers/iio/flow/slf3s.c new file +12
-0+ +for (unsigned int i =0 ; i <ARRAY_SIZE (slf3s_variants); i++) { +if (buf[SLF3S_PRODUCT_SUBTYPE_BYTE ] != + slf3s_variants[i].sub_type) +continue ; + +if (sf->variant && sf->variant != &slf3s_variants[i]) +dev_info (&client->dev, +"DT compatible says %s but sensor reports %s; using %s\n" , + sf->variant->name, + slf3s_variants[i].name, + slf3s_variants[i].name);
Same here, if the DT says it should be x and we get y, then that also feels like something that shouldn't have happened.
Quoted 11 lines
drivers/iio/flow/slf3s.c new file +11
-0+ + sf->variant = &slf3s_variants[i]; + +return 0 ; + } + +dev_err (&client->dev,"unknown SLF3S sub-type 0x%02x\n" , + buf[SLF3S_PRODUCT_SUBTYPE_BYTE ]); + +return -ENODEV ; +}
[snip]
drivers/iio/flow/slf3s.c line 401
Quoted 9 lines
drivers/iio/flow/slf3s.c new file +9
-0+ +static struct i2c_driver slf3s_driver = { + .driver = { + .name ="slf3s" , + .of_match_table = slf3s_of_match, + }, + .probe = slf3s_probe, + .id_table = slf3s_id, +};
Sashiko said:
"Since the driver lacks power management operations, what happens when the system suspends and resumes?
If power is cut to the sensor during suspend, won't it reset to the IDLE state and cause subsequent IIO reads to fail because the driver never re-issues the start command? Or if power isn't cut, will leaving it actively measuring waste power?"
Which it has some good points, you'll just have to issue a start command once the system is back from suspend.
I'd say it's very close, but please address those comments from sashiko (also you don't have to take my advice on the dev_warn() stuff, I'll be honest I haven't written a driver from scratch yet!)
Signature · 2 lines
best regards, max
Re: [PATCH v3 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver
In reply to Wadim MuellerHello Wadim,
Some additional comments. Feel free to disregard any of them if they conflict with previous reviews.
Quoted 23 lines · Wadim Mueller
Add a driver for the Sensirion SLF3S family of digital liquid-flow sensors on I2C. Currently supported variants are SLF3S-0600F, SLF3S-1300F and SLF3S-4000B; they share the same register map and differ only in flow-scale factor and calibrated measurement range. The variant (and therefore the scale) is auto-detected from the product-information register at probe time.
Each measurement frame returns a 16-bit signed flow value, a 16-bit signed temperature reading and a status word, each protected by a CRC-8 byte. The driver exposes the flow rate as
IIO_VOLUMEFLOWand the temperature asIIO_TEMPvia the standard IIOread_raw/read_scaleinterface.The active calibration medium can be switched at runtime between the factory-calibrated water and isopropyl-alcohol modes via the
in_volumeflow_mediumsysfs attribute; the sensor starts in water mode after probe.This driver also creates the
drivers/iio/flow/subdirectory and the corresponding Kconfig/Makefile glue.Signed-off-by Wadim Mueller <[email protected]>---
...
Quoted 4 lines
drivers/iio/flow/Kconfig new file +4
-0+config SENSIRION_SLF3S + tristate "Sensirion SLF3S liquid flow sensor" + depends on I2C + select CRC8
drivers/iio/flow/Kconfig line 22
Quoted 10 lines
drivers/iio/flow/Kconfig new file +10
-0+ help + Say yes here to build support for the Sensirion SLF3S family + of digital liquid-flow sensors: + + - SLF3S-0600F + - SLF3S-1300F + - SLF3S-4000B + + The driver reports the volumetric flow rate and the embedded + temperature reading via the standard IIO interface.
This level of detail is probably not needed in the Kconfig entry. Though, it's probably okay to have it anyways.
Quoted 24 lines
drivers/iio/flow/Kconfig new file +5
-0+ + To compile this driver as a module, choose M here: the module + will be called slf3s. + +endmenudrivers/iio/flow/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for industrial I/O flow sensor drivers +# + +# When adding new entries keep the list in alphabetical order +obj-$(CONFIG_SENSIRION_SLF3S) += slf3s.odrivers/iio/flow/slf3s.c new file +0
-0@@ -0,0 +1,406 @@
...
drivers/iio/flow/slf3s.c line 91
Quoted 12 lines
drivers/iio/flow/slf3s.c new file +12
-0+static const struct slf3s_variant slf3s_variants[] = { + [0 ] = { + .sub_type =0x03 , + .name ="slf3s-0600f" , + .scale_num =1 , + .scale_den =600 *MICRO , + }, + [1 ] = { + .sub_type =0x02 , + .name ="slf3s-1300f" , + .scale_num =1 , + .scale_den =30 *MICRO ,
This one seems to almost zero out with 9 decimal digit precision. And it doesn't get better if _raw * _scale is to result in m³/s. I haven't followed it closely but, maybe this driver could use some of the new IIO_VAL types from ADF41513 series [1].
Ignore my comment if l/s was accepted.
Quoted 1 line
drivers/iio/flow/slf3s.c new file +1
-0+ },
...
drivers/iio/flow/slf3s.c line 197
Quoted 4 lines
drivers/iio/flow/slf3s.c new file +4
-0+ +static int slf3s_read_sample (struct slf3s_data *sf,int *flow,int *temp) +{ +u8 buf[9 ];
Can buf be 6 bytes long? 2 bytes of flow data + 1 CRC + 2 bytes of temp + 1 CRC.
Quoted 19 lines
drivers/iio/flow/slf3s.c new file +19
-0+int ret; + + ret =i2c_master_recv (sf->client, buf,ARRAY_SIZE (buf)); +if (ret <0 ) +return ret; +if (ret !=ARRAY_SIZE (buf)) +return -EIO ; + +for (unsigned int i =0 ; i <ARRAY_SIZE (buf); i +=3 ) { +if (!slf3s_crc_valid (sf, &buf[i])) +return -EIO ; + } + + *flow =sign_extend32 (get_unaligned_be16 (&buf[0 ]),15 ); + *temp =sign_extend32 (get_unaligned_be16 (&buf[3 ]),15 ); + +return 0 ; +} +
...
drivers/iio/flow/slf3s.c line 263
Quoted 3 lines
drivers/iio/flow/slf3s.c new file +3
-0+static const struct iio_chan_spec_ext_info slf3s_ext_info[] = { +IIO_ENUM ("medium" ,IIO_SHARED_BY_TYPE , &slf3s_medium_enum), +IIO_ENUM_AVAILABLE ("medium" ,IIO_SHARED_BY_TYPE , &slf3s_medium_enum),
We should probably document the new 'medium' ABI.
For consolidated ABI, we document it in Documentation/ABI/testing/sysfs-bus-iio. Since this is new stuf, maybe start with a separate ABI doc
(e.g. Documentation/ABI/testing/sysfs-bus-iio-slf3s) ?
drivers/iio/flow/slf3s.c
Quoted 2 lines
drivers/iio/flow/slf3s.c new file +2
-0+ { } +};
With best regards,
Marcelo
Jonathan Cameron
maintainerRe: [PATCH v3 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver
In reply to Maxwell DooseQuoted 73 lines · On Sun, 31 May 2026 18:59:31 -0500 Maxwell Doose <[email protected]> wrote:
Hi Wadim,
Quoted 22 lines · On Sat, 30 May 2026 22:54:32 +0200 Wadim Mueller <[email protected]> wrote:
Add a driver for the Sensirion SLF3S family of digital liquid-flow sensors on I2C. Currently supported variants are SLF3S-0600F, SLF3S-1300F and SLF3S-4000B; they share the same register map and differ only in flow-scale factor and calibrated measurement range. The variant (and therefore the scale) is auto-detected from the product-information register at probe time.
Each measurement frame returns a 16-bit signed flow value, a 16-bit signed temperature reading and a status word, each protected by a CRC-8 byte. The driver exposes the flow rate as
IIO_VOLUMEFLOWand the temperature asIIO_TEMPvia the standard IIOread_raw/read_scaleinterface.The active calibration medium can be switched at runtime between the factory-calibrated water and isopropyl-alcohol modes via the
in_volumeflow_mediumsysfs attribute; the sensor starts in water mode after probe.This driver also creates the
drivers/iio/flow/subdirectory and the corresponding Kconfig/Makefile glue.Signed-off-by Wadim Mueller <[email protected]>Quoted 11 lines
--- drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/flow/Kconfig | 27 +++ drivers/iio/flow/Makefile | 7 + drivers/iio/flow/slf3s.c | 406 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 442 insertions(+) create mode 100644 drivers/iio/flow/Kconfig create mode 100644 drivers/iio/flow/Makefile create mode 100644 drivers/iio/flow/slf3s.cNice code. Just have a couple of questions (+sashiko has some concerns as well).
[snip]
Quoted 10 lines
drivers/iio/flow/slf3s.c new file +10
-0+/* +* Read the product-info block and pick the matching variant. The +* sub-type byte returned by the sensor is the source of truth; a +* DT-supplied compatible only seeds an initial guess and is overridden +* on mismatch (with an informational message so misconfigured device +* trees are easy to spot). +* +* Bus / CRC failures are real errors and fail probe. An unknown +* sub-type byte fails probe too: we cannot publish a meaningful scale +* without a matching entry in slf3s_variants[]. drivers/iio/flow/slf3s.c line 149
Quoted 10 lines
drivers/iio/flow/slf3s.c new file +10
-0+*/ +static int slf3s_detect_variant (struct slf3s_data *sf) +{ +struct i2c_client *client = sf->client; +u8 buf[SLF3S_PRODUCT_ID_LEN ]; +int ret; + + ret =slf3s_send_cmd (client, slf3s_cmd_prep_pid); +if (ret) +return ret;Here sashiko said:
"If the system goes through a warm reboot or kexec, won't the sensor still be running in continuous measurement mode since there is no .shutdown callback? If the sensor is actively measuring, will it NACK the 'read product ID' command sent here and cause the probe to unconditionally fail? Should a stop measurement command be sent before trying to read the product ID?"
Quoted 2 lines
Was looking and didn't find a shutdown callback, so you'll probably want to add that.
It's a fair question from sashiko as seems a stop command or reset is needed to break out of that mode and let other commands function.
There is the option of a soft reset which might make sense to implement in probe() but it's an odd one as it's a general call (so may affect other devices on the same bus).
Given we can never know what silly mode some other software has left the device in, we'd normally reset (but here probably can't due to the reset addressing all devices on the bus), we can however just issue a stop command in probe() I think I'd prefer that to shutdown() Note I couldn't find a statement that says stop can be issued when not running continuous mode. So test that and see. Hopefully it's a no-op!
Quoted 16 lines
Quoted 16 lines
drivers/iio/flow/slf3s.c new file +15
-0+ ret =slf3s_send_cmd (client, slf3s_cmd_read_pid); +if (ret) +return ret; + + ret =i2c_master_recv (client, buf,sizeof (buf)); +if (ret <0 ) +return ret; +if (ret !=sizeof (buf)) +return -EIO ; + +for (unsigned int i =0 ; i <SLF3S_PRODUCT_ID_LEN ; i +=3 ) { +if (!slf3s_crc_valid (sf, &buf[i])) +return -EIO ; + } +
Quoted 8 lines
drivers/iio/flow/slf3s.c line 170
Quoted 5 lines
drivers/iio/flow/slf3s.c new file +5
-0+if (buf[SLF3S_PRODUCT_FAMILY_BYTE ] !=SLF3S_PRODUCT_FAMILY_ID ) +dev_info (&client->dev, +"unexpected family byte 0x%02x (expected 0x%02x)\n" , + buf[SLF3S_PRODUCT_FAMILY_BYTE ], +SLF3S_PRODUCT_FAMILY_ID );This feels like something that could be
dev_warn()to me (if it's unexpected then it means it probably shouldn't happen!)
This is about fallback compatibles - it is absolutely expected to happen in the future (assuming this company doesn't feel the need to keep inventing new control schemes for every device released!) dev_info() is fine.
Quoted 16 lines
drivers/iio/flow/slf3s.c line 182
Quoted 13 lines
drivers/iio/flow/slf3s.c new file +12
-0+ +for (unsigned int i =0 ; i <ARRAY_SIZE (slf3s_variants); i++) { +if (buf[SLF3S_PRODUCT_SUBTYPE_BYTE ] != + slf3s_variants[i].sub_type) +continue ; + +if (sf->variant && sf->variant != &slf3s_variants[i]) +dev_info (&client->dev, +"DT compatible says %s but sensor reports %s; using %s\n" , + sf->variant->name, + slf3s_variants[i].name, + slf3s_variants[i].name);Same here, if the DT says it should be x and we get y, then that also feels like something that shouldn't have happened.
Agree on this one.
Quoted 34 lines
Quoted 12 lines
drivers/iio/flow/slf3s.c new file +11
-0+ + sf->variant = &slf3s_variants[i]; + +return 0 ; + } + +dev_err (&client->dev,"unknown SLF3S sub-type 0x%02x\n" , + buf[SLF3S_PRODUCT_SUBTYPE_BYTE ]); + +return -ENODEV ; +}[snip]
drivers/iio/flow/slf3s.c line 401
Quoted 9 lines
drivers/iio/flow/slf3s.c new file +9
-0+ +static struct i2c_driver slf3s_driver = { + .driver = { + .name ="slf3s" , + .of_match_table = slf3s_of_match, + }, + .probe = slf3s_probe, + .id_table = slf3s_id, +};Sashiko said:
"Since the driver lacks power management operations, what happens when the system suspends and resumes?
If power is cut to the sensor during suspend, won't it reset to the IDLE state and cause subsequent IIO reads to fail because the driver never re-issues the start command? Or if power isn't cut, will leaving it actively measuring waste power?"
Quoted 2 lines
Which it has some good points, you'll just have to issue a start command once the system is back from suspend.
For IIO drivers, we normally consider power management a 'feature' that can be added later. Sure kooky things can happen if it's not there and the 'feature' is used. That might mean you have to rebind the driver. If a platform cuts the power to a device with a driver that doesn't know it can happen, then it is broken at a higher level.
Quoted 6 lines
I'd say it's very close, but please address those comments from sashiko (also you don't have to take my advice on the
dev_warn()stuff, I'll be honest I haven't written a driver from scratch yet!)
Jonathan Cameron
maintainerRe: [PATCH v3 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver
In reply to Marcelo SchmittJust picking one thing to add to from the set of good points from Marcelo.
Quoted 8 lines
...
drivers/iio/flow/slf3s.c line 263
Quoted 3 lines
drivers/iio/flow/slf3s.c new file +3
-0+static const struct iio_chan_spec_ext_info slf3s_ext_info[] = { +IIO_ENUM ("medium" ,IIO_SHARED_BY_TYPE , &slf3s_medium_enum), +IIO_ENUM_AVAILABLE ("medium" ,IIO_SHARED_BY_TYPE , &slf3s_medium_enum),We should probably document the new 'medium' ABI.
For consolidated ABI, we document it inDocumentation/ABI/testing/sysfs-bus-iio. Since this is new stuf, maybe start with a separate ABI doc
(e.g.Documentation/ABI/testing/sysfs-bus-iio-slf3s) ?
Definitely needs docs but maybe go one up sysfs-bus-iio-flow. This is intended to be a generic ABI but one specific to flow sensors.
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ { } +};With best regards,
Marcelo
Jonathan Cameron
maintainerRe: [PATCH v3 1/3] iio: types: add IIO_VOLUMEFLOW channel type
In reply to Marcelo SchmittQuoted 43 lines · On Sun, 31 May 2026 15:09:54 -0300 Marcelo Schmitt…
Quoted 32 lines · Wadim Mueller
Add a new IIO channel type for liquid volumetric flow sensors. The unit exposed via the standard
_scaleattribute is litres per second (l/s), so drivers reporting smaller native units (e.g. ml/min) only need to set a fractional scale.Update iio-core's name table, the
iio_event_monitorwhitelist and the sysfs-bus-iio ABI document to match. The new_scaleattribute is folded into the existing shared_scaleblock; only the per-type_rawneeds a fresh entry.Signed-off-by Wadim Mueller <[email protected]>--- 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 +2
-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:Documentation/ABI/testing/sysfs-bus-iio Description: · line 2466
Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-iio +4
-0@@ -2458,3 +2460,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: 6.19This is probably only landing in kernel 7.2 (or later?), so bumping the version seems appropriate.
Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-iio Description: · line 2471
Quoted 5 lines
Documentation/ABI/testing/sysfs-bus-iio +5
-0+Contact: [email protected] +Description: + Raw (unscaled) volumetric flow rate reading from the channel. + To convert to standard units (litres per second) apply the + channel's _scale (and _offset, when present).Early reviews suggested to use SI units so I think we would have cubic meters per second. Disregard if I missed some review accepting it as liters per second.
I don't think that discussion ever finished. Please makes sure to capture open questions like this in your cover letter. A comment in the individual patch / code is also appropriate so people don't miss it.
J
Quoted 3 lines
With best regards,
Marcelo
Jonathan Cameron
maintainerRe: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Wadim MuellerQuoted 14 lines · On Sat, 30 May 2026 22:54:31 +0200 Wadim Mueller <[email protected]> wrote:
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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.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]>
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 17
Quoted 7 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +7
-0+ +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, both of which are detected at probe time via the + product-information register.
Slightly odd line wrap. Can go to 80 chars. e.g. something like
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, both of which are detected at probe time via the product-information register.
Jonathan Cameron
maintainerRe: [PATCH v3 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver
In reply to Wadim MuellerQuoted 18 lines · On Sat, 30 May 2026 22:54:32 +0200 Wadim Mueller <[email protected]> wrote:
Add a driver for the Sensirion SLF3S family of digital liquid-flow sensors on I2C. Currently supported variants are SLF3S-0600F, SLF3S-1300F and SLF3S-4000B; they share the same register map and differ only in flow-scale factor and calibrated measurement range. The variant (and therefore the scale) is auto-detected from the product-information register at probe time.
Each measurement frame returns a 16-bit signed flow value, a 16-bit signed temperature reading and a status word, each protected by a CRC-8 byte. The driver exposes the flow rate as
IIO_VOLUMEFLOWand the temperature asIIO_TEMPvia the standard IIOread_raw/read_scaleinterface.The active calibration medium can be switched at runtime between the factory-calibrated water and isopropyl-alcohol modes via the
in_volumeflow_mediumsysfs attribute; the sensor starts in water mode after probe.
Quoted 4 lines
This driver also creates the
drivers/iio/flow/subdirectory and the corresponding Kconfig/Makefile glue.Signed-off-by Wadim Mueller <[email protected]>
Hi Wadim
A few things inline. Biggest one is don't use direct mode claims to do serialization of things that lie entirely in your driver. That there is a lock in that call is an implementation detail you should not be relying on.
Jonathan
drivers/iio/flow/slf3s.c line 135
Quoted 13 lines
drivers/iio/flow/slf3s.c new file +7
-0+ +/* +* Read the product-info block and pick the matching variant. The +* sub-type byte returned by the sensor is the source of truth; a +* DT-supplied compatible only seeds an initial guess and is overridden +* on mismatch (with an informational message so misconfigured device +* trees are easy to spot).
Wrap to 80 chars. Also if following suggestion to 'warn' on mismatch make sure to update the comment as well.
Quoted 8 lines
+ *
+ * Bus / CRC failures are real errors and fail probe. An unknown
+ * sub-type byte fails probe too: we cannot publish a meaningful scale
+ * without a matching entry in slf3s_variants[].
+ */drivers/iio/flow/slf3s.c new file +2
-0+static int slf3s_detect_variant (struct slf3s_data *sf) +{
drivers/iio/flow/slf3s.c line 232
Quoted 10 lines
drivers/iio/flow/slf3s.c new file +9
-0+ +static int slf3s_set_medium (struct iio_dev *indio_dev, +const struct iio_chan_spec *chan,unsigned int mode) +{ +struct slf3s_data *sf =iio_priv (indio_dev); +const u8 *start_cmd; +int ret; + +if (!iio_device_claim_direct (indio_dev))
It makes no sense to claim direct mode in a driver that doesn't do any other modes. I think you are just using this to serialize commands, all of which occur in direct mode. Don't do that, use your own local lock.
Quoted 15 lines
drivers/iio/flow/slf3s.c new file +15
-0+return -EBUSY ; + + ret =slf3s_send_cmd (sf->client, slf3s_cmd_stop_meas); +if (ret) + goto out; + + start_cmd = (mode ==SLF3S_MEDIUM_IPA ) ? slf3s_cmd_start_ipa + : slf3s_cmd_start_water; + + ret =slf3s_send_cmd (sf->client, start_cmd); +if (ret) + goto out; + +fsleep (SLF3S_MEAS_START_DELAY_US ); + sf->medium = mode;
drivers/iio/flow/slf3s.c
Quoted 10 lines
drivers/iio/flow/slf3s.c new file +8
-0+out: +iio_device_release_direct (indio_dev); + +return ret; +} +static const struct i2c_device_id slf3s_id[] = { + { .name ="slf3s-0600f" , + .driver_data = (kernel_ulong_t)&slf3s_variants[0 ] },
{
.name = "slf3s-0600f",
.driver_data = (kernel_ulong_t)&slf3s_variants[0],
},Quoted 7 lines
drivers/iio/flow/slf3s.c new file +7
-0+ { .name = "slf3s-1300f", + .driver_data = (kernel_ulong_t)&slf3s_variants[1] }, + { .name = "slf3s-4000b", + .driver_data = (kernel_ulong_t)&slf3s_variants[2] }, + { } +}; +MODULE_DEVICE_TABLE (i2c, slf3s_id);
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Wadim MuellerQuoted 7 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.
Here...
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 17
Quoted 6 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +6
-0+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, both of which are detected at probe time via the + product-information register.
And here...
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 24
Quoted 7 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +7
-0+ +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000b
And here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
Quoted 30 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +25
-0+ + reg: + maxItems: 1 + + vdd-supply: true + +required: + - compatible + - reg + - vdd-supply + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + flow-sensor@8 { + compatible = "sensirion,slf3s-0600f"; + reg = <0x08>; + vdd-supply = <®_3v3>; + }; + };MAINTAINERS +0
-0
MAINTAINERS S: Maintained · line 24196
Quoted 10 lines
MAINTAINERS +7
-0@@ -24187,6 +24187,14 @@ 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 +F: drivers/iio/flow/slf3s.c
Basically almost the same comment as before. Drop. There is no such file.
Quoted 7 lines
MAINTAINERS +1
-0+ SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER M: Tomasz Duszynski <[email protected]> S: MaintainedSignature · 1 line
2.52.0
Jonathan Cameron
maintainerRe: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 20 lines · On Mon, 1 Jun 2026 13:53:23 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 7 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.Here...
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 17
Quoted 6 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +6
-0+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, both of which are detected at probe time via the + product-information register.And here...
Quoted 10 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 24
Quoted 7 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +7
-0+ +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000bAnd here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
And then future fallback compatibles can never work. Basically as far as I have ever been able to establish this is why generic compatibles are almost always the wrong way to go.
If we get a future part with an unknown ID and don't have these existing specific compatibles, then we have no way to specify which one it is compatible with. Given these are providing scaling info that means we can't realistically support such a future part with a fallback at all.
That would only be possible if there was feature level discovery. A single whoami register with no structure to the value is useless for this.
Note for this type of device I absolutely expect there to be future parts with different IDs and same ranges as here, the unknown is whether sensiron will change the interface or not.
Jonathan
Quoted 52 lines
Quoted 31 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +25
-0+ + reg: + maxItems: 1 + + vdd-supply: true + +required: + - compatible + - reg + - vdd-supply + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + flow-sensor@8 { + compatible = "sensirion,slf3s-0600f"; + reg = <0x08>; + vdd-supply = <®_3v3>; + }; + };MAINTAINERS +0
-0MAINTAINERS S: Maintained · line 24196
Quoted 10 lines
MAINTAINERS +7
-0@@ -24187,6 +24187,14 @@ 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 +F: drivers/iio/flow/slf3s.cBasically almost the same comment as before. Drop. There is no such file.
Quoted 7 lines
MAINTAINERS +1
-0+ SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER M: Tomasz Duszynski <[email protected]> S: MaintainedSignature · 1 line
2.52.0
Wadim Mueller
maintainerRe: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 9 lines · On Mon, 1 Jun 2026 15:09:59 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 2 lines
And here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
And then future fallback compatibles can never work. [...] this is why generic compatibles are almost always the wrong way to go. If we get a future part with an unknown ID and don't have these existing specific compatibles, then we have no way to specify which one it is compatible with. [...] Note for this type of device I absolutely expect there to be future parts with different IDs and same ranges as here [...]
The scale comes from the detected sub-type and
there is no real feature discovery, only the opaque product-id. So for a future part a generic-only compatible would give the right driver but the wrong scale. For me the per-variant compatibles are the safer way.
Krzysztof, is this ok for you, or you still want the single generic one?
Wadim
Wadim Mueller
maintainerRe: [PATCH v3 1/3] iio: types: add IIO_VOLUMEFLOW channel type
In reply to Jonathan CameronQuoted 1 line · On Mon, 1 Jun 2026 10:42:33 +0100 Jonathan Cameron <[email protected]> wrote:
I don't think that discussion ever finished. [...]
So i need to decide the unit: l/s or m^3/s? My feeling is l/s. The ranges are sub-ml/s, so m^3/s only makes the scale 1e3 smaller and the DECIMAL64 precision thing worse, for no real benefit in sysfs. If you want strict SI i change it. What you prefer?
Wadim
Wadim Mueller
maintainerRe: [PATCH v3 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver
In reply to Marcelo SchmittQuoted 2 lines · On Sun, 31 May 2026 21:45:23 -0300 Marcelo Schmitt…
Can buf be 6 bytes long? 2 bytes of flow data + 1 CRC + 2 bytes of temp
+ 1 CRC.
Yes. The third word (Byte 7-9 in the datasheet, Table 8) is the signaling
flags: 2 byte flags + 1 CRC. The driver does not use the flags, and the datasheet says the read can be aborted with a NACK/STOP after the temp word. So i make buf 6 bytes and read only flow + temp.
Wadim
Wadim Mueller
maintainerRe: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Marcelo SchmittQuoted 3 lines · On Sun, 31 May 2026 14:45:08 -0300 Marcelo Schmitt…
We could add a mention to the IRQ pin to make the doc more complete.
interrupts:
maxItems: 1
I would let interrupts out for now. The driver is polled and in v2 the feedback was to not put properties in the binding which we do not use. If later a board uses the IRQ pin we can add it. Ok for you?
Wadim
Re: [PATCH v3 1/3] iio: types: add IIO_VOLUMEFLOW channel type
In reply to Wadim MuellerQuoted 9 lines · Wadim Mueller
Add a new IIO channel type for liquid volumetric flow sensors. The unit exposed via the standard
_scaleattribute is litres per second (l/s), so drivers reporting smaller native units (e.g. ml/min) only need to set a fractional scale.Update iio-core's name table, the
iio_event_monitorwhitelist and the sysfs-bus-iio ABI document to match. The new_scaleattribute is folded into the existing shared_scaleblock; only the per-type_rawneeds a fresh entry.
...
Documentation/ABI/testing/sysfs-bus-iio Description: · line 2466
Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-iio +3
-0+What: /sys/bus/iio/devices/iio:deviceX/in_volumeflow_raw +What: /sys/bus/iio/devices/iio:deviceX/in_volumeflowY_raw +KernelVersion: 6.19
This is wrong. It has to be 7.2 and unlikely makes it, so next one is 7.3.
Quoted 5 lines
Documentation/ABI/testing/sysfs-bus-iio +5
-0+Contact: [email protected] +Description: + Raw (unscaled) volumetric flow rate reading from the channel. + To convert to standard units (litres per second) apply the + channel's _scale (and _offset, when present).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Jonathan CameronQuoted 34 lines · Jonathan Cameron
Quoted 20 lines · On Mon, 1 Jun 2026 13:53:23 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 7 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.Here...
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 17
Quoted 6 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +6
-0+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, both of which are detected at probe time via the + product-information register.And here...
Quoted 10 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 24
Quoted 7 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +7
-0+ +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000bAnd here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
Quoted 6 lines
And then future fallback compatibles can never work. Basically as far as I have ever been able to establish this is why generic compatibles are almost always the wrong way to go.
If we get a future part with an unknown ID and don't have these existing specific compatibles, then we have no way to specify which one it is
But why would you have future part with unknown ID?
The device is slf3s with variants. All of known variants have an interface to detect the actual variant. There is no indication that this won't work - why would company remove the ID register?
But even if this happens, then it would be change of device interface, thus you cannot use generic compatible and you will have a new dedicated compatible.
If the device is actually "slf3s-0600f" (because slf3s is a family), then I am fine with using that as the fallback. Specific front compatibles are also fine in such case.
Quoted 5 lines
compatible with. Given these are providing scaling info that means we can't realistically support such a future part with a fallback at all.
That would only be possible if there was feature level discovery. A single whoami register with no structure to the value is useless for this.
The whoami register defines all the features, no? What would feature discovery improve? ID register is simply logical OR of some feature set, still uniquely identifying the features set/variant.
Best regards,
Krzysztof
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Wadim MuellerQuoted 11 lines · Wadim Mueller
Quoted 3 lines · On Sun, 31 May 2026 14:45:08 -0300 Marcelo Schmitt…
We could add a mention to the IRQ pin to make the doc more complete.
interrupts:
maxItems: 1I would let interrupts out for now. The driver is polled and in v2 the feedback was to not put properties in the binding which we do not use. If later a board uses the IRQ pin we can add it. Ok for you?
Well, okay for me. I suggested that because of the guidelines for dt-bindings [1].
Though, TBH, I'm also frequently tempted to leave interrupt properties out of bindings. It's not uncommon to have IIO drivers that don't support interrupt lines and, for those cases, having to describe the interrupts in dt ends up becoming just an extra task. Even though I don't know/recall the reason why dt maintainers have such guideline, they probably have a good reason to have that (right?). If the guidance has changed, then maybe we can update the guidelines for writing bindings?
With best regards,
Marcelo
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 8 lines · Marcelo Schmitt
Quoted 7 lines · Wadim Mueller
Quoted 3 lines · On Sun, 31 May 2026 14:45:08 -0300 Marcelo Schmitt…
We could add a mention to the IRQ pin to make the doc more complete.
interrupts:
maxItems: 1
Quoted 6 lines
Quoted 4 lines
I would let interrupts out for now. The driver is polled and in v2 the feedback was to not put properties in the binding which we do not use. If later a board uses the IRQ pin we can add it. Ok for you?
Well, okay for me. I suggested that because of the guidelines for dt-bindings [1].
Yes, the interrupt should be in the binding.
At v1 there was a feedback TO INCLUDE interrupts:
https://lore.kernel.org/linux-iio/20260526171930.0db4125e@jic23-huawei/
Where was a different feedback about BINDINGS provided?
Best regards,
Krzysztof
Jonathan Cameron
maintainerRe: [PATCH v3 1/3] iio: types: add IIO_VOLUMEFLOW channel type
In reply to Wadim MuellerQuoted 10 lines · On Wed, 3 Jun 2026 16:08:33 +0200 Wadim Mueller <[email protected]> wrote:
Quoted 1 line · On Mon, 1 Jun 2026 10:42:33 +0100 Jonathan Cameron <[email protected]> wrote:
I don't think that discussion ever finished. [...]
So i need to decide the unit: l/s or m^3/s? My feeling is l/s. The ranges are sub-ml/s, so m^3/s only makes the scale 1e3 smaller and the DECIMAL64 precision thing worse, for no real benefit in sysfs. If you want strict SI i change it. What you prefer?
Yes, I'd prefer that for consistency (m^3/sec). Hopefully the scaling is fine with the new forms that are happy with more leading zeros.
Quoted 1 line
Wadim
Jonathan Cameron
maintainerRe: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Krzysztof KozlowskiQuoted 35 lines · On Wed, 3 Jun 2026 16:29:10 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 34 lines · Jonathan Cameron
Quoted 30 lines · On Mon, 1 Jun 2026 13:53:23 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 7 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.Here...
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 17
Quoted 6 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +6
-0+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, both of which are detected at probe time via the + product-information register.And here...
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 24
Quoted 7 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +7
-0+ +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000bAnd here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
Quoted 8 lines
Quoted 6 lines
And then future fallback compatibles can never work. Basically as far as I have ever been able to establish this is why generic compatibles are almost always the wrong way to go.
If we get a future part with an unknown ID and don't have these existing specific compatibles, then we have no way to specify which one it is
But why would you have future part with unknown ID?
That's what manufacturers do on a very frequent basis. They tweak something that has no affect on the interface or channel scaling etc and release a new part with a different ID. Can be something like a part suited to different operating conditions, or with a different supply tolerance.
Quoted 4 lines
The device is slf3s with variants. All of known variants have an interface to detect the actual variant. There is no indication that this won't work - why would company remove the ID register?
They won't remove the ID, but they will put other values in it to indicate new revisions of a part - often entirely backwards compatible
- sometimes with extra features that we don't use until the driver is updated.
Quoted 4 lines
But even if this happens, then it would be change of device interface, thus you cannot use generic compatible and you will have a new dedicated compatible.
We've had this discussion a number of times for whether an ID register difference alone makes a device non compatible, and the answer from DT review has always been a firm no and that it is incorrect to reject an unknown ID if the dt-compatible is known. The compromise that people were happy with was an info print if such a mismatch is detected as it might indicate an incompatible part replacement and a broken DT.
Probably 80%+ of IIO bindings with fallback compatibles do not have matching "who am I" register values. This is incredibly common.
Quoted 4 lines
If the device is actually "slf3s-0600f" (because slf3s is a family), then I am fine with using that as the fallback. Specific front compatibles are also fine in such case.
Yes, it's a part in the family. Each of the compatibles here has a separate datasheet:
https://sensirion.com/media/documents/C4F8D965/66F56F53/LQ_DS_SLF3S-0600F_Datasheet.pdf
https://sensirion.com/media/documents/6971528D/63625D22/Sensirion_Datasheet_SLF3S-1300F.pdf
etc
(wonderfully inconsistent file naming ;)
Quoted 6 lines
Quoted 6 lines
compatible with. Given these are providing scaling info that means we can't realistically support such a future part with a fallback at all.
Quoted 6 lines
Quoted 2 lines
That would only be possible if there was feature level discovery. A single whoami register with no structure to the value is useless for this.
The whoami register defines all the features, no? What would feature discovery improve? ID register is simply logical OR of some feature set, still uniquely identifying the features set/variant.
Would be lovely if true. Sadly almost never true. They are typically just the next number in a list of parts released. There is no direct information on feature set encoded in that value, we have to have a look up table in the driver to translate to feature set. (Not relevant here but sometimes manufacturers forget to change the number and we get different feature sets with the same ID and no discoverability)
If they were an OR of features that would be great.
The thing is a little structured in this case
0x07 Liquid flow sensor 0x 03 Product family (e.g. SLF3x) 0x 03 Subtype (e.g. SLF3S-0600F) 0x 02 Revision number (changes with minor firmware or hardware revisions)
But both the product family and subtype are numbers to feed into look up tables (maybe revision number as well)
Jonathan
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 45 lines · Jonathan Cameron
Quoted 42 lines · On Wed, 3 Jun 2026 16:29:10 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 40 lines · Jonathan Cameron
Quoted 20 lines · On Mon, 1 Jun 2026 13:53:23 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 7 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.Here...
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 17
Quoted 6 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +6
-0+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, both of which are detected at probe time via the + product-information register.And here...
Quoted 10 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 24
Quoted 7 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +7
-0+ +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000bAnd here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
And then future fallback compatibles can never work. Basically as far as I have ever been able to establish this is why generic compatibles are almost always the wrong way to go.
If we get a future part with an unknown ID and don't have these existing specific compatibles, then we have no way to specify which one it is
Quoted 6 lines
Quoted 1 line
But why would you have future part with unknown ID?
That's what manufacturers do on a very frequent basis. They tweak something that has no affect on the interface or channel scaling etc and release a new part with a different ID. Can be something like a part suited to different operating conditions, or with a different supply tolerance.
and it will have a different, known that time ID. How could be "unknown"?
Quoted 12 lines
Quoted 5 lines
The device is slf3s with variants. All of known variants have an interface to detect the actual variant. There is no indication that this won't work - why would company remove the ID register?
They won't remove the ID, but they will put other values in it to indicate new revisions of a part - often entirely backwards compatible
- sometimes with extra features that we don't use until the driver is updated.Quoted 1 line
Quoted 7 lines
Quoted 3 lines
But even if this happens, then it would be change of device interface, thus you cannot use generic compatible and you will have a new dedicated compatible.
We've had this discussion a number of times for whether an ID register difference alone makes a device non compatible, and the answer from DT review has always been a firm no and that it is incorrect to reject an unknown ID if the dt-compatible
True, but this is not the case here. That incompatible device would simply not use this compatible, thus it will not start the probe.
Quoted 34 lines
is known. The compromise that people were happy with was an info print if such a mismatch is detected as it might indicate an incompatible part replacement and a broken DT.
Probably 80%+ of IIO bindings with fallback compatibles do not have matching "who am I" register values. This is incredibly common.
Quoted 4 lines
If the device is actually "slf3s-0600f" (because slf3s is a family), then I am fine with using that as the fallback. Specific front compatibles are also fine in such case.
Yes, it's a part in the family. Each of the compatibles here has a separate datasheet:
https://sensirion.com/media/documents/C4F8D965/66F56F53/LQ_DS_SLF3S-0600F_Datasheet.pdf
https://sensirion.com/media/documents/6971528D/63625D22/Sensirion_Datasheet_SLF3S-1300F.pdf
etc(wonderfully inconsistent file naming ;)
Quoted 6 lines
Quoted 6 lines
compatible with. Given these are providing scaling info that means we can't realistically support such a future part with a fallback at all.
Quoted 6 lines
Quoted 2 lines
That would only be possible if there was feature level discovery. A single whoami register with no structure to the value is useless for this.
The whoami register defines all the features, no? What would feature discovery improve? ID register is simply logical OR of some feature set, still uniquely identifying the features set/variant.
Quoted 6 lines
Would be lovely if true. Sadly almost never true. They are typically just the next number in a list of parts released. There is no direct information on feature set encoded in that value, we have to have a look up table in the driver to translate to feature set. (Not relevant here but sometimes manufacturers forget to change the number and we get different feature sets with the same ID and no discoverability)
I did not mean there is direct information. I meant that you can create such map, so basically it is defining all features.
Quoted 5 lines
If they were an OR of features that would be great.
The thing is a little structured in this case
Quoted 7 lines
0x07 Liquid flow sensor 0x 03 Product family (e.g. SLF3x) 0x 03 Subtype (e.g. SLF3S-0600F) 0x 02 Revision number (changes with minor firmware or hardware revisions)But both the product family and subtype are numbers to feed into look up tables (maybe revision number as well)
The values don't matter. What only matters is that each is unique, you can map it to a real device (and its datasheet) and features are decodable from the datasheet.
Best regards,
Krzysztof
Jonathan Cameron
maintainerRe: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 46 lines · On Thu, 4 Jun 2026 13:22:17 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 45 lines · Jonathan Cameron
Quoted 42 lines · On Wed, 3 Jun 2026 16:29:10 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 40 lines · Jonathan Cameron
Quoted 20 lines · On Mon, 1 Jun 2026 13:53:23 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 7 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.Here...
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 17
Quoted 6 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +6
-0+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, both of which are detected at probe time via the + product-information register.And here...
Quoted 10 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml line 24
Quoted 7 lines
Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file +7
-0+ +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000bAnd here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
And then future fallback compatibles can never work. Basically as far as I have ever been able to establish this is why generic compatibles are almost always the wrong way to go.
If we get a future part with an unknown ID and don't have these existing specific compatibles, then we have no way to specify which one it is
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
But why would you have future part with unknown ID?
That's what manufacturers do on a very frequent basis. They tweak something that has no affect on the interface or channel scaling etc and release a new part with a different ID. Can be something like a part suited to different operating conditions, or with a different supply tolerance.
and it will have a different, known that time ID. How could be "unknown"?
Known to us, sure, know to old kernel (or other software), not so much. For this sort of driver the main use of fallback compatibles is to work on a not yet aware kernel.
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
The device is slf3s with variants. All of known variants have an interface to detect the actual variant. There is no indication that this won't work - why would company remove the ID register?
They won't remove the ID, but they will put other values in it to indicate new revisions of a part - often entirely backwards compatible
- sometimes with extra features that we don't use until the driver is updated.Quoted 4 lines
But even if this happens, then it would be change of device interface, thus you cannot use generic compatible and you will have a new dedicated compatible.
Quoted 6 lines
Quoted 3 lines
We've had this discussion a number of times for whether an ID register difference alone makes a device non compatible, and the answer from DT review has always been a firm no and that it is incorrect to reject an unknown ID if the dt-compatible
True, but this is not the case here. That incompatible device would simply not use this compatible, thus it will not start the probe.
Taking a rather extreme viewpoint: So fallback compatibles are pointless why do we bother with them? Note this ID register thing covers most IIO drivers that have fallback compatibles today. This is not a rare corner case.
Quoted 56 lines
Quoted 36 lines
is known. The compromise that people were happy with was an info print if such a mismatch is detected as it might indicate an incompatible part replacement and a broken DT.
Probably 80%+ of IIO bindings with fallback compatibles do not have matching "who am I" register values. This is incredibly common.
Quoted 4 lines
If the device is actually "slf3s-0600f" (because slf3s is a family), then I am fine with using that as the fallback. Specific front compatibles are also fine in such case.
Yes, it's a part in the family. Each of the compatibles here has a separate datasheet:
https://sensirion.com/media/documents/C4F8D965/66F56F53/LQ_DS_SLF3S-0600F_Datasheet.pdf
https://sensirion.com/media/documents/6971528D/63625D22/Sensirion_Datasheet_SLF3S-1300F.pdf
etc(wonderfully inconsistent file naming ;)
Quoted 6 lines
Quoted 6 lines
compatible with. Given these are providing scaling info that means we can't realistically support such a future part with a fallback at all.
Quoted 6 lines
Quoted 2 lines
That would only be possible if there was feature level discovery. A single whoami register with no structure to the value is useless for this.
The whoami register defines all the features, no? What would feature discovery improve? ID register is simply logical OR of some feature set, still uniquely identifying the features set/variant.
Quoted 6 lines
Would be lovely if true. Sadly almost never true. They are typically just the next number in a list of parts released. There is no direct information on feature set encoded in that value, we have to have a look up table in the driver to translate to feature set. (Not relevant here but sometimes manufacturers forget to change the number and we get different feature sets with the same ID and no discoverability)
I did not mean there is direct information. I meant that you can create such map, so basically it is defining all features.
Quoted 10 lines
If they were an OR of features that would be great.
The thing is a little structured in this case
0x07 Liquid flow sensor 0x 03 Product family (e.g. SLF3x) 0x 03 Subtype (e.g. SLF3S-0600F) 0x 02 Revision number (changes with minor firmware or hardware revisions)
Quoted 6 lines
Quoted 2 lines
But both the product family and subtype are numbers to feed into look up tables (maybe revision number as well)
The values don't matter. What only matters is that each is unique, you can map it to a real device (and its datasheet) and features are decodable from the datasheet.
Sure, but as above, that breaks the use of fallback compatibles for the incredibly common case of otherwise identical parts that would work fine on an old kernel but where we can't match them because the ID register differs.
Jonathan
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 56 lines · Jonathan Cameron
Quoted 53 lines · On Thu, 4 Jun 2026 13:22:17 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 51 lines · Jonathan Cameron
Quoted 35 lines · On Wed, 3 Jun 2026 16:29:10 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 34 lines · Jonathan Cameron
Quoted 30 lines · On Mon, 1 Jun 2026 13:53:23 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 7 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.Here...
Review
Quoted 6 lines
(quoted diff) +6
-0+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, both of which are detected at probe time via the + product-information register.And here...
Review
Quoted 7 lines
(quoted diff) +7
-0+ +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000bAnd here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
Quoted 8 lines
Quoted 6 lines
And then future fallback compatibles can never work. Basically as far as I have ever been able to establish this is why generic compatibles are almost always the wrong way to go.
If we get a future part with an unknown ID and don't have these existing specific compatibles, then we have no way to specify which one it is
But why would you have future part with unknown ID?
That's what manufacturers do on a very frequent basis. They tweak something that has no affect on the interface or channel scaling etc and release a new part with a different ID. Can be something like a part suited to different operating conditions, or with a different supply tolerance.
Quoted 5 lines
Quoted 1 line
and it will have a different, known that time ID. How could be "unknown"?
Known to us, sure, know to old kernel (or other software), not so much. For this sort of driver the main use of fallback compatibles is to work on a not yet aware kernel.
So you mean a case that sometime in the future, someone will write a DTS with sensirion,slf3s fallback for a sensirion,slf3s-WAHTEVER_NEW_MODEL, use old kernel and be surprised it does not work?
Our goal is not to stop whatever poor code people can ever come up with.
Every future user wanting to the fallback MUST understand what the fallback means.
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 7 lines
The device is slf3s with variants. All of known variants have an interface to detect the actual variant. There is no indication that this won't work - why would company remove the ID register?
They won't remove the ID, but they will put other values in it to indicate new revisions of a part - often entirely backwards compatible
- sometimes with extra features that we don't use until the driver is updated.Quoted 4 lines
But even if this happens, then it would be change of device interface, thus you cannot use generic compatible and you will have a new dedicated compatible.
We've had this discussion a number of times for whether an ID register difference alone makes a device non compatible, and the answer from DT review has always been a firm no and that it is incorrect to reject an unknown ID if the dt-compatible
Quoted 6 lines
Quoted 2 lines
True, but this is not the case here. That incompatible device would simply not use this compatible, thus it will not start the probe.
Taking a rather extreme viewpoint: So fallback compatibles are pointless why do we bother with them? Note this ID register thing covers most IIO drivers that have fallback compatibles today. This is not a rare corner case.
Fallback would not be pointless. It would be used to match and bind the driver. Without fallback, driver would not match.
Quoted 60 lines
Quoted 60 lines
Quoted 37 lines
is known. The compromise that people were happy with was an info print if such a mismatch is detected as it might indicate an incompatible part replacement and a broken DT.
Probably 80%+ of IIO bindings with fallback compatibles do not have matching "who am I" register values. This is incredibly common.
Quoted 4 lines
If the device is actually "slf3s-0600f" (because slf3s is a family), then I am fine with using that as the fallback. Specific front compatibles are also fine in such case.
Yes, it's a part in the family. Each of the compatibles here has a separate datasheet:
https://sensirion.com/media/documents/C4F8D965/66F56F53/LQ_DS_SLF3S-0600F_Datasheet.pdf
https://sensirion.com/media/documents/6971528D/63625D22/Sensirion_Datasheet_SLF3S-1300F.pdf
etc(wonderfully inconsistent file naming ;)
Quoted 6 lines
Quoted 6 lines
compatible with. Given these are providing scaling info that means we can't realistically support such a future part with a fallback at all.
Quoted 6 lines
Quoted 2 lines
That would only be possible if there was feature level discovery. A single whoami register with no structure to the value is useless for this.
The whoami register defines all the features, no? What would feature discovery improve? ID register is simply logical OR of some feature set, still uniquely identifying the features set/variant.
Quoted 6 lines
Would be lovely if true. Sadly almost never true. They are typically just the next number in a list of parts released. There is no direct information on feature set encoded in that value, we have to have a look up table in the driver to translate to feature set. (Not relevant here but sometimes manufacturers forget to change the number and we get different feature sets with the same ID and no discoverability)
I did not mean there is direct information. I meant that you can create such map, so basically it is defining all features.
Quoted 12 lines
If they were an OR of features that would be great.
The thing is a little structured in this case
0x07 Liquid flow sensor 0x 03 Product family (e.g. SLF3x) 0x 03 Subtype (e.g. SLF3S-0600F) 0x 02 Revision number (changes with minor firmware or hardware revisions)But both the product family and subtype are numbers to feed into look up tables (maybe revision number as well)
Quoted 7 lines
Quoted 3 lines
The values don't matter. What only matters is that each is unique, you can map it to a real device (and its datasheet) and features are decodable from the datasheet.
Sure, but as above, that breaks the use of fallback compatibles for the incredibly common case of otherwise identical parts that would work fine on an old kernel but where we can't match them because the ID register differs.
And it is not a problem. Every other case would not work either. If you have specific compatibles - such device would not work. If you have fallback with ID mapping to features - such device would not work.
In all cases device would not work.
Best regards,
Krzysztof
Wadim Mueller
maintainerRe: [PATCH v3 1/3] iio: types: add IIO_VOLUMEFLOW channel type
In reply to Jonathan CameronQuoted 2 lines · On Thu, 4 Jun 2026 09:44:36 +0100 Jonathan Cameron <[email protected]> wrote:
Yes, I'd prefer that for consistency (m^3/sec). Hopefully the scaling is fine with the new forms that are happy with more leading zeros.
Ok for m^3/s if you prefer SI, but two things before i switch:
1) The scaling is not quite fine with pico. In m^3/s the SLF3S-0600F scale is ~1.667e-12, so IIO_VAL_DECIMAL64_PICO keeps only a single digit again. It would need IIO_VAL_DECIMAL64_FEMTO, which Rodrigo's series does not define yet (only MILLI..PICO). Rodrigo, you offered FEMTO earlier - could you add it? Then i base v4 on top of it.
2) Honestly m^3/s feels quite far from reality for these parts. They are liquid flow sensors; even the largest variant (4000B) tops out at 600 ml/min = 1e-5 m^3/s, so no value is ever close to 1 - everything sits between ~1e-12 and ~1e-5. l/s keeps the numbers in a saner range and pico is enough (no new core type needed). IIO also uses practical units in a few places already (kPa, milli-degC) instead of strict SI.
So i'm fine either way, but m^3/s costs us a new FEMTO core type for a mostly cosmetic unit choice, while l/s works with what Rodrigo already has. What do you prefer?
Wadim
Re: [PATCH v3 1/3] iio: types: add IIO_VOLUMEFLOW channel type
Quoted 6 lines · Wadim Mueller
Quoted 2 lines · On Thu, 4 Jun 2026 09:44:36 +0100 Jonathan Cameron <[email protected]> wrote:
Yes, I'd prefer that for consistency (m^3/sec). Hopefully the scaling is fine with the new forms that are happy with more leading zeros.
Quoted 7 lines
Ok for m^3/s if you prefer SI, but two things before i switch:
1) The scaling is not quite fine with pico. In m^3/s the SLF3S-0600F scale is ~1.667e-12, so
IIO_VAL_DECIMAL64_PICOkeeps only a single digit again. It would needIIO_VAL_DECIMAL64_FEMTO, which Rodrigo's series does not define yet (only MILLI..PICO). Rodrigo, you offered FEMTO earlier - could you add it? Then i base v4 on top of it.
v16 is essentially ready to be accepted! I suppose adding the FEMTO format could be done here if needed.
Signature · 3 lines
Kind regards, Rodrigo Alencar
Wadim Mueller
maintainerRe: [PATCH v3 1/3] iio: types: add IIO_VOLUMEFLOW channel type
Quoted 2 lines · On Mon, 8 Jun 2026 09:53:28 +0100 Rodrigo Alencar…
v16 is essentially ready to be accepted! I suppose adding the FEMTO format could be done here if needed.
Thanks Rodrigo,
then let's go with m^3/s as Jonathan prefers. That does need FEMTO (the SLF3S-0600F scale is ~1.667e-12 m^3/s), so could you fold IIO_VAL_DECIMAL64_FEMTO into v16? I'll base v4 on top of it.
Thanks,
Wadim
Re: [PATCH v3 1/3] iio: types: add IIO_VOLUMEFLOW channel type
Quoted 11 lines · Wadim Mueller
Quoted 2 lines · On Mon, 8 Jun 2026 09:53:28 +0100 Rodrigo Alencar…
v16 is essentially ready to be accepted! I suppose adding the FEMTO format could be done here if needed.
Thanks Rodrigo,
then let's go with m^3/s as Jonathan prefers. That does need FEMTO (the SLF3S-0600F scale is ~1.667e-12 m^3/s), so could you fold
IIO_VAL_DECIMAL64_FEMTOinto v16? I'll base v4 on top of it.
v16 was sent Thursday last week:
https://lore.kernel.org/linux-iio/[email protected]/
It does not have FEMTO. I meant you could add it here (in your series).
Signature · 3 lines
Kind regards, Rodrigo Alencar
Wadim Mueller
maintainerRe: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Krzysztof KozlowskiHi Krzysztof, Jonathan,
for v4 I'd like to keep the three specific per-variant compatibles from v3 (sensirion,slf3s-0600f / -1300f / -4000b) and no generic fallback, since the flow scale differs per sub-type.
Krzysztof, is that ok for you?
Thanks,
Wadim
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 7 lines · Wadim Mueller
Hi Krzysztof, Jonathan,
for v4 I'd like to keep the three specific per-variant compatibles from v3 (sensirion,slf3s-0600f / -1300f / -4000b) and no generic fallback, since the flow scale differs per sub-type.
Krzysztof, is that ok for you?
You should have a specific fallback (since we did not reach consensus on more generic fallback). All your three variants are fully detectable.
Best regards,
Krzysztof
Jonathan Cameron
maintainerRe: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
In reply to Krzysztof KozlowskiQuoted 59 lines · On Sun, 7 Jun 2026 10:30:07 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 58 lines · Jonathan Cameron
Quoted 54 lines · On Thu, 4 Jun 2026 13:22:17 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 45 lines · Jonathan Cameron
Quoted 42 lines · On Wed, 3 Jun 2026 16:29:10 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 40 lines · Jonathan Cameron
Quoted 20 lines · On Mon, 1 Jun 2026 13:53:23 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 7 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.Here...
Review
Quoted 6 lines
(quoted diff) +6
-0+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, both of which are detected at probe time via the + product-information register.And here...
Quoted 10 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000bAnd here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
And then future fallback compatibles can never work. Basically as far as I have ever been able to establish this is why generic compatibles are almost always the wrong way to go.
If we get a future part with an unknown ID and don't have these existing specific compatibles, then we have no way to specify which one it is
Quoted 6 lines
Quoted 1 line
But why would you have future part with unknown ID?
That's what manufacturers do on a very frequent basis. They tweak something that has no affect on the interface or channel scaling etc and release a new part with a different ID. Can be something like a part suited to different operating conditions, or with a different supply tolerance.
and it will have a different, known that time ID. How could be "unknown"?
Quoted 7 lines
Quoted 3 lines
Known to us, sure, know to old kernel (or other software), not so much. For this sort of driver the main use of fallback compatibles is to work on a not yet aware kernel.
So you mean a case that sometime in the future, someone will write a DTS with sensirion,slf3s fallback for a sensirion,slf3s-WAHTEVER_NEW_MODEL, use old kernel and be surprised it does not work?
To me that is exactly what a fallback compatible is promising - if we have any kernel / driver that supports the part that we are saying is a valid fallback then we are saying we support at least the functionality of that part (sure there may be extra stuff that doesn't work)
We had a long discussion a few years back on whether code that did
if (read_reg_whoami() != EXPECTED_ID) return -ENODEV;
was correct. Someone (maybe Rob?) strongly argued that we must not do that because it effectively made fallbacks pointless as we always needed to upgrade the driver. I argued against this (on basis that swapping in incompatible parts is annoyingly common) but was eventually persuaded.
If that is not a valid reading of what fallback compatibles mean, is there any documentation of the rules I can refer to?
Quoted 5 lines
Our goal is not to stop whatever poor code people can ever come up with.
Every future user wanting to the fallback MUST understand what the fallback means.
This is where we disagree.
This is not hard to support, it just means not using generic compatibles when the device differ (and they are not self describing which these are not).
Jonathan
Quoted 111 lines
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 8 lines
The device is slf3s with variants. All of known variants have an interface to detect the actual variant. There is no indication that this won't work - why would company remove the ID register?
They won't remove the ID, but they will put other values in it to indicate new revisions of a part - often entirely backwards compatible
- sometimes with extra features that we don't use until the driver is updated.Quoted 4 lines
But even if this happens, then it would be change of device interface, thus you cannot use generic compatible and you will have a new dedicated compatible.
We've had this discussion a number of times for whether an ID register difference alone makes a device non compatible, and the answer from DT review has always been a firm no and that it is incorrect to reject an unknown ID if the dt-compatible
Quoted 6 lines
Quoted 2 lines
True, but this is not the case here. That incompatible device would simply not use this compatible, thus it will not start the probe.
Taking a rather extreme viewpoint: So fallback compatibles are pointless why do we bother with them? Note this ID register thing covers most IIO drivers that have fallback compatibles today. This is not a rare corner case.
Fallback would not be pointless. It would be used to match and bind the driver. Without fallback, driver would not match.
Quoted 60 lines
Quoted 60 lines
Quoted 37 lines
is known. The compromise that people were happy with was an info print if such a mismatch is detected as it might indicate an incompatible part replacement and a broken DT.
Probably 80%+ of IIO bindings with fallback compatibles do not have matching "who am I" register values. This is incredibly common.
Quoted 4 lines
If the device is actually "slf3s-0600f" (because slf3s is a family), then I am fine with using that as the fallback. Specific front compatibles are also fine in such case.
Yes, it's a part in the family. Each of the compatibles here has a separate datasheet:
https://sensirion.com/media/documents/C4F8D965/66F56F53/LQ_DS_SLF3S-0600F_Datasheet.pdf
https://sensirion.com/media/documents/6971528D/63625D22/Sensirion_Datasheet_SLF3S-1300F.pdf
etc(wonderfully inconsistent file naming ;)
Quoted 6 lines
Quoted 6 lines
compatible with. Given these are providing scaling info that means we can't realistically support such a future part with a fallback at all.
Quoted 6 lines
Quoted 2 lines
That would only be possible if there was feature level discovery. A single whoami register with no structure to the value is useless for this.
The whoami register defines all the features, no? What would feature discovery improve? ID register is simply logical OR of some feature set, still uniquely identifying the features set/variant.
Quoted 6 lines
Would be lovely if true. Sadly almost never true. They are typically just the next number in a list of parts released. There is no direct information on feature set encoded in that value, we have to have a look up table in the driver to translate to feature set. (Not relevant here but sometimes manufacturers forget to change the number and we get different feature sets with the same ID and no discoverability)
I did not mean there is direct information. I meant that you can create such map, so basically it is defining all features.
Quoted 12 lines
If they were an OR of features that would be great.
The thing is a little structured in this case
0x07 Liquid flow sensor 0x 03 Product family (e.g. SLF3x) 0x 03 Subtype (e.g. SLF3S-0600F) 0x 02 Revision number (changes with minor firmware or hardware revisions)But both the product family and subtype are numbers to feed into look up tables (maybe revision number as well)
Quoted 7 lines
Quoted 3 lines
The values don't matter. What only matters is that each is unique, you can map it to a real device (and its datasheet) and features are decodable from the datasheet.
Sure, but as above, that breaks the use of fallback compatibles for the incredibly common case of otherwise identical parts that would work fine on an old kernel but where we can't match them because the ID register differs.
And it is not a problem. Every other case would not work either. If you have specific compatibles - such device would not work. If you have fallback with ID mapping to features - such device would not work.
In all cases device would not work.
Best regards,
Krzysztof
Re: [PATCH v3 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
Quoted 92 lines · Jonathan Cameron
Quoted 59 lines · On Sun, 7 Jun 2026 10:30:07 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 58 lines · Jonathan Cameron
Quoted 54 lines · On Thu, 4 Jun 2026 13:22:17 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 45 lines · Jonathan Cameron
Quoted 42 lines · On Wed, 3 Jun 2026 16:29:10 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 40 lines · Jonathan Cameron
Quoted 20 lines · On Mon, 1 Jun 2026 13:53:23 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 7 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.
The driver auto-detects the variant from the product-information register at probe time; the per-variant compatible strings exist for documentation and
dt_binding_checkpurposes.Here...
Review
Quoted 6 lines
(quoted diff) +6
-0+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, both of which are detected at probe time via the + product-information register.And here...
Quoted 10 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ +properties: + compatible: + enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000bAnd here something else. Confusing. Didn't you say device variants are auto-detectable? So you have only one compatible sensirion,slf3s.
And then future fallback compatibles can never work. Basically as far as I have ever been able to establish this is why generic compatibles are almost always the wrong way to go.
If we get a future part with an unknown ID and don't have these existing specific compatibles, then we have no way to specify which one it is
Quoted 6 lines
Quoted 1 line
But why would you have future part with unknown ID?
That's what manufacturers do on a very frequent basis. They tweak something that has no affect on the interface or channel scaling etc and release a new part with a different ID. Can be something like a part suited to different operating conditions, or with a different supply tolerance.
and it will have a different, known that time ID. How could be "unknown"?
Quoted 7 lines
Quoted 3 lines
Known to us, sure, know to old kernel (or other software), not so much. For this sort of driver the main use of fallback compatibles is to work on a not yet aware kernel.
So you mean a case that sometime in the future, someone will write a DTS with sensirion,slf3s fallback for a sensirion,slf3s-WAHTEVER_NEW_MODEL, use old kernel and be surprised it does not work?
To me that is exactly what a fallback compatible is promising - if we have any kernel / driver that supports the part that we are saying is a valid fallback then we are saying we support at least the functionality of that part (sure there may be extra stuff that doesn't work)
We had a long discussion a few years back on whether code that did
if (read_reg_whoami() != EXPECTED_ID) return -ENODEV;was correct. Someone (maybe Rob?) strongly argued that we must not do that because it effectively made fallbacks pointless as we always needed to upgrade the driver. I argued against this (on basis that swapping in incompatible parts is annoyingly common) but was eventually persuaded.
If that is not a valid reading of what fallback compatibles mean, is there any documentation of the rules I can refer to?
Quoted 3 lines
Our goal is not to stop whatever poor code people can ever come up with.
Quoted 8 lines
Quoted 2 lines
Every future user wanting to the fallback MUST understand what the fallback means.
This is where we disagree.
This is not hard to support, it just means not using generic compatibles when the device differ (and they are not self describing which these are not).
FWIW, I think the no generic compatible approach is reasonable. The devices might be able to self-identify, but the featureset is not discoverable, which makes the self-identification much less valuable. Permitting drop-in replacement parts (or knock off devices from other manufacturers etc) to use a compatible device as a fallback seems to me exactly what fallbacks are intended for.
If the driver has to be updated every time a new device is created then I think a generic compatible has effectively no value.