From: Jonathan Cameron <jic23@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Wadim Mueller <wafgo01@gmail.com>,
lars@metafoo.de, dlechner@baylibre.com, nuno.sa@analog.com,
andy@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, jdelvare@suse.com, ak@it-klinger.de,
linux-iio@vger.kernel.org, linux-hwmon@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v1 3/4] iio: flow: add Sensirion SLF3x liquid flow sensor driver
Date: Tue, 26 May 2026 17:06:18 +0100 [thread overview]
Message-ID: <20260526170618.14f45e2d@jic23-huawei> (raw)
In-Reply-To: <4349f634-dd7b-468a-912c-5ceb8a283954@roeck-us.net>
On Sun, 24 May 2026 14:40:51 -0700
Guenter Roeck <linux@roeck-us.net> wrote:
> On 5/24/26 13:49, Wadim Mueller wrote:
> > From: Wadim Mueller <wadim.mueller@cmblu.de>
> >
> > Add an IIO driver for the Sensirion SLF3S family of digital
> > liquid-flow sensors. The supported sub-types (SLF3S-0600F,
> > SLF3S-4000B) share the same register map and command set and are
> > distinguished only by the flow scale; the variant is detected at
> > probe time from the product-information register.
> >
> Sice you are at it, it might make sense to also support SLF3S-1300F.
>
>
> > The driver exposes two IIO channels:
> > - in_volumeflow_raw / in_volumeflow_scale (litres per second)
> > - in_temp_raw / in_temp_scale (milli-degC)
> >
> > Continuous measurement mode is started in probe and stopped via
> > devm-action; read_raw() fetches the most recent sample on demand.
> >
> > Signed-off-by: Wadim Mueller <wadim.mueller@cmblu.de>
> > ---
> > drivers/iio/Kconfig | 1 +
> > drivers/iio/Makefile | 1 +
> > drivers/iio/flow/Kconfig | 22 ++++
> > drivers/iio/flow/Makefile | 7 +
> > drivers/iio/flow/slf3x.c | 264 ++++++++++++++++++++++++++++++++++++++
>
> What does the "X" refer to ? Why not "S" ?
Absolutely - no wild cards in file names or indeed in variables etc.
Just pick a part to name after. Wild cards go wrong far too often!
A couple more follow ups below to some of what Guenter noted
> > +static const u8 slf3x_cmd_stop[] = { 0x3f, 0xf9 };
> > +
> > +DECLARE_CRC8_TABLE(slf3x_crc_table);
> > +
> > +struct slf3x_variant {
> > + u8 sub_type;
> > + const char *name;
> > + /*
> > + * Flow scale exposed via IIO_CHAN_INFO_SCALE in litres per second
> > + * per LSB, encoded as IIO_VAL_FRACTIONAL (num / den). The encoding
> > + * comes from the Sensirion datasheet's "scale factor" (ticks per
> > + * ml/min) combined with the 1 ml/min = 1/60000 l/s conversion.
> > + */
>
> Not my call to make, but at least the Sensirion sensors all talk about
> flow rate per minute, not per second. A Google search suggests that
> flow rate is normally measured per minute or even per hour, and that
> per-second measurements are typically only used for large-scale engineering,
> rivers, dams, and rapid industrial chemical dosing. Taking SLF3S-0600F
> as example, it measures up to ±2000 µl/min (!). Even Sensirion's gas
> sensors use per-minute flow rates.
>
> Any special reason to use a per-second rate ?
As I just replied to the cover letter - things in IIO that have relationship
to time (delays, integration times etc) are in seconds.
Would be very confusing to mix and match. In general for new channel types
we stick to SI units without multipliers.
>
> > + int scale_num;
> > + int scale_den;
> > +};
> > + dev_err(&client->dev,
> > + "product-info CRC mismatch at byte %d\n", i);
> > + return -EIO;
> > + }
> > + }
> > +
> > + if (buf[SLF3X_FAMILY_BYTE] != SLF3X_FAMILY_ID) {
> > + dev_err(&client->dev,
> > + "unexpected device family 0x%02x\n",
> > + buf[SLF3X_FAMILY_BYTE]);
> > + return -ENODEV;
Similar to below. This can't be an error or we break fallback
compatibles in DT. There are historic drivers that do this that
we haven't fixed up yet - but no new ones please!
> > + }
> > +
> > + for (i = 0; i < ARRAY_SIZE(slf3x_variants); i++) {
> > + if (buf[SLF3X_SUBTYPE_BYTE] == slf3x_variants[i].sub_type) {
> > + sf->variant = &slf3x_variants[i];
> > + return 0;
> > + }
> > + }
> > +
> > + dev_err(&client->dev, "unsupported SLF3x sub-type 0x%02x\n",
> > + buf[SLF3X_SUBTYPE_BYTE]);
>
> Not my call to make, but the driver is way too noisy for my liking.
>
Given the need to support fallback compatibles from device tree we don't
fail at all on mismatches as that prevents use supporting a new fully
backwards compatible (other than IDs) part in older kernels.
Whether a dev_info() or dev_dbg() is appropriate for such a case is
less obvious but definitely dev_err().
> > + return -ENODEV;
and it's not an error to read an unexpected ID.
> > +}
next prev parent reply other threads:[~2026-05-26 16:06 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-24 20:49 [RFC PATCH v1 0/4] iio: add Sensirion SLF3x liquid flow sensor support Wadim Mueller
2026-05-24 20:49 ` [RFC PATCH v1 1/4] iio: types: add IIO_VOLUMEFLOW channel type Wadim Mueller
2026-05-24 21:39 ` Guenter Roeck
2026-05-26 15:59 ` Jonathan Cameron
2026-05-27 14:35 ` Wadim Mueller
2026-05-27 14:35 ` Wadim Mueller
2026-05-26 16:13 ` Jonathan Cameron
2026-05-27 14:35 ` Wadim Mueller
2026-05-24 20:49 ` [RFC PATCH v1 2/4] dt-bindings: iio: flow: add Sensirion SLF3x liquid flow sensor Wadim Mueller
2026-05-26 16:19 ` Jonathan Cameron
2026-05-27 14:35 ` Wadim Mueller
2026-05-24 20:49 ` [RFC PATCH v1 3/4] iio: flow: add Sensirion SLF3x liquid flow sensor driver Wadim Mueller
2026-05-24 21:40 ` Guenter Roeck
2026-05-26 16:06 ` Jonathan Cameron [this message]
2026-05-27 14:35 ` Wadim Mueller
2026-05-27 14:35 ` Wadim Mueller
2026-05-26 16:35 ` Jonathan Cameron
2026-05-27 14:35 ` Wadim Mueller
2026-05-26 16:43 ` Jonathan Cameron
2026-05-27 14:34 ` Wadim Mueller
2026-05-24 20:49 ` [RFC PATCH v1 4/4] MAINTAINERS: add entry for Sensirion SLF3x " Wadim Mueller
2026-05-26 16:36 ` Jonathan Cameron
2026-05-27 14:35 ` Wadim Mueller
2026-05-27 14:42 ` Maxwell Doose
2026-05-27 18:36 ` Wadim Mueller
2026-05-26 16:12 ` [RFC PATCH v1 0/4] iio: add Sensirion SLF3x liquid flow sensor support Jonathan Cameron
2026-05-27 14:34 ` Wadim Mueller
2026-05-27 18:32 ` Jonathan Cameron
2026-05-27 18:42 ` [PATCH v2 0/3] iio: flow: Sensirion SLF3S liquid flow sensor Wadim Mueller
2026-05-27 18:42 ` [PATCH v2 1/3] iio: types: add IIO_VOLUMEFLOW channel type Wadim Mueller
2026-05-28 10:20 ` Jonathan Cameron
2026-05-27 18:42 ` [PATCH v2 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor Wadim Mueller
2026-05-28 9:07 ` Krzysztof Kozlowski
2026-05-30 20:42 ` Wadim Mueller
2026-05-27 18:42 ` [PATCH v2 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver Wadim Mueller
2026-05-28 11:22 ` Jonathan Cameron
2026-05-28 13:56 ` Rodrigo Alencar
2026-05-30 20:42 ` Wadim Mueller
2026-05-31 8:52 ` Jonathan Cameron
2026-05-28 10:14 ` [PATCH v2 0/3] iio: flow: Sensirion SLF3S liquid flow sensor Jonathan Cameron
2026-05-30 20:42 ` Wadim Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260526170618.14f45e2d@jic23-huawei \
--to=jic23@kernel.org \
--cc=ak@it-klinger.de \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=wafgo01@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome