From nobody Mon Jun 8 17:38:29 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99BA04219F2 for ; Wed, 27 May 2026 18:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779907385; cv=none; b=KT7tMRvJDkyQ7adQhf55/PR9YrdPAFlXcHWpnEfHag/wHyi+6DYhJd4m7NhYKAkQSqLNo1qfJB+59ul9irPJrVwYUZy8JJqOkCyTCHts9pUAPbAnk2s3cVpu4rhlfs17/oIPYNa8HxQTesPObIiLn9cJHKM+xEjQBvQkRSF+jHg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779907385; c=relaxed/simple; bh=D9BxbyTlaO5evXhF/LaETEV0mQZGeHluXR9mIUC2e0g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WoBkjrmExedzmHMiJQo/ysOpu60I6G/Ok56K1F+GIZsarly41W6z1yp8usyAHgcRBaFKrHiMrNkqTQ9T4fC2vWb0kN/0pE8u+gS+gNR88r3YA96vy+hFOhbekXqEz3eeIgoOv3mulXGfWFosOLf7Uk0msb8nJIw2hIktTblfucE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZHhIqiIz; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZHhIqiIz" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4893940bb5eso64991625e9.3 for ; Wed, 27 May 2026 11:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779907382; x=1780512182; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=APxKf4/T3LceCmlA6Kks7f2ZfrO1GmfmpalJc2yympY=; b=ZHhIqiIzuwwA97JXllqBpdWYvUY/xlHLrTlntWnIXbeI0/G8usJAnDFb9QypigipH6 pzVJdRziMFWw9yU55nsKbbPdp5JdYRcCNxiKd+hTrZVFu1htrGKSM+iLs7dvwOr7lUK1 +oWkk8G9RK6MXmkMoG1vqzuNXscabaLhgSaj+vW6JTtDPrbYX9Wb+XYriOSUgP2G640c Y0VV0AI2gQYig+9il1Xqa1h6zddAe9TtOhYYgo4VRh1d8bzbkhleMp62Wdd9Nd+ilepF hHBrBTUAkHDnhvBTlFIZp/Jq3bma/mw4PFKt+OFqSBDqQfjA9YLIs2Rp706uHYbB8l9B ypyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779907382; x=1780512182; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=APxKf4/T3LceCmlA6Kks7f2ZfrO1GmfmpalJc2yympY=; b=cwmW7ehrwGIJ556Y1/saF0wG6xBFQM+mTq0IoOhBvEIWZJto1qtYmTb8qxyJfldFcw NoJK10BiMiQ9rgdRD3zD3l5O0N+krHHsbP546a1wTHN6gmeyRlBBVgu0Oq0I5WUlN+GX IgzgphX7+TcdDhjkZTP1U5h21+IQ4NzNGObutMEsj3CFvh8jcAJloELWXXRI7UNBVZ74 sEvvBEvMSnoQ0N/Ca80+CWwYe0/E04mDdqyau5stRSHM0fX6gohJf+HRf768IywwQGvx OzHhHjfZFXBpUwUu2oDvXjlHX/d4oKXmqJb9Z/0F/xfnUCipd0McXBZLdwvlG6A50By1 BO7w== X-Forwarded-Encrypted: i=1; AFNElJ8hWp6D99XUDu4LVzz/rFHVi5xjEPSPuoq0fLDQ50LWWSz+NQPLayY/n+aTFex96v5JCZ0/wcGRhsB/kxU=@vger.kernel.org X-Gm-Message-State: AOJu0YwYo48FpoD3EEFJnNga4bLlPtPOpfNHWJ3dmvracl7v7poH4QUd ufoXj/OP0p91IE2eOMaEFEJtyBxLUmV2WLYi/dtCmmHfWgy4+IGbk+U6 X-Gm-Gg: Acq92OGe/0sYXZpFNAdAteCpfK9f/giSHJtcT3+B8tGvw//I5p/UvWnQSdJhKdZSJBC K6liDYw0GwdFTFYqfp1gFYTfJA2z5C/boG4GWGIe8SiJj9CNAxgGAoe0Pbk8b2tIQJKvxWVIrzY R57RYpXpzVIwpY/Z5fpOnJtBUJVjLvVR95tDB4QLOrFEsCegcG8hxVZREoEbyMrQxQ0IUwCzmW3 8nYnPh66nIC7eU2FWPMYQmeMfqMK8cSaoz4dFiLc3ZZCh/uef1mYWBj+uk82u01sE7f5kMaRaIH 3RqLDSej8JZbg4bpP0XLH+2uDM+8MGOtuKJUVZehVaRSOXVHcxekyK7uqt0IUoEJxNJRE04WCvz z+vLUrApQa/rjIMLyn8tNmdbIh6i0BHJGQ/DqWEYskrjBydYbvgzf4MserMFH0n4kJSDdzdnkIn vDB2g77AgaKUoohwQ= X-Received: by 2002:a05:600c:1c21:b0:490:44eb:c1e0 with SMTP id 5b1f17b1804b1-49044ebc29emr405905935e9.21.1779907381827; Wed, 27 May 2026 11:43:01 -0700 (PDT) Received: from sefo-laptop ([2a02:8071:50c5:5c0::361b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490809ca202sm35312935e9.6.2026.05.27.11.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2026 11:43:01 -0700 (PDT) From: Wadim Mueller To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Guenter Roeck , Jean Delvare , Andreas Klinger , Lars-Peter Clausen , linux-hwmon@vger.kernel.org, Maxwell Doose Subject: [PATCH v2 1/3] iio: types: add IIO_VOLUMEFLOW channel type Date: Wed, 27 May 2026 20:42:52 +0200 Message-ID: <20260527184257.141635-2-wafgo01@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260527184257.141635-1-wafgo01@gmail.com> References: <20260524205112.26638-1-wafgo01@gmail.com> <20260527184257.141635-1-wafgo01@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Wadim Mueller Cc: Guenter Roeck Cc: Jean Delvare Cc: Andreas Klinger Cc: Lars-Peter Clausen Cc: linux-hwmon@vger.kernel.org Cc: Maxwell Doose --- Documentation/ABI/testing/sysfs-bus-iio | 11 +++++++++++ drivers/iio/industrialio-core.c | 1 + include/uapi/linux/iio/types.h | 1 + tools/iio/iio_event_monitor.c | 2 ++ 4 files changed, 15 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/te= sting/sysfs-bus-iio index 5f87dcee7..2188557cb 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -507,6 +507,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_intensity_re= d_scale What: /sys/bus/iio/devices/iio:deviceX/in_intensity_green_scale What: /sys/bus/iio/devices/iio:deviceX/in_intensity_blue_scale What: /sys/bus/iio/devices/iio:deviceX/in_concentration_co2_scale +What: /sys/bus/iio/devices/iio:deviceX/in_volumeflow_scale +What: /sys/bus/iio/devices/iio:deviceX/in_volumeflowY_scale KernelVersion: 2.6.35 Contact: linux-iio@vger.kernel.org Description: @@ -2458,3 +2460,12 @@ Description: seconds, expressed as: =20 - 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: linux-iio@vger.kernel.org +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). diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-cor= e.c index 22eefd048..aa34fcd8e 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -98,6 +98,7 @@ static const char * const iio_chan_type_name_spec[] =3D { [IIO_CHROMATICITY] =3D "chromaticity", [IIO_ATTENTION] =3D "attention", [IIO_ALTCURRENT] =3D "altcurrent", + [IIO_VOLUMEFLOW] =3D "volumeflow", }; =20 static const char * const iio_modifier_names[] =3D { diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h index 6d269b844..49480f321 100644 --- a/include/uapi/linux/iio/types.h +++ b/include/uapi/linux/iio/types.h @@ -53,6 +53,7 @@ enum iio_chan_type { IIO_CHROMATICITY, IIO_ATTENTION, IIO_ALTCURRENT, + IIO_VOLUMEFLOW, }; =20 enum iio_modifier { diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 03ca33869..078004750 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -65,6 +65,7 @@ static const char * const iio_chan_type_name_spec[] =3D { [IIO_CHROMATICITY] =3D "chromaticity", [IIO_ATTENTION] =3D "attention", [IIO_ALTCURRENT] =3D "altcurrent", + [IIO_VOLUMEFLOW] =3D "volumeflow", }; =20 static const char * const iio_ev_type_text[] =3D { @@ -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; --=20 2.52.0 From nobody Mon Jun 8 17:38:29 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BE724611CF for ; Wed, 27 May 2026 18:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779907390; cv=none; b=CLgSqnD+hZNcOoFf90V/tTtc/13a3dfF0BNPKuLU3ORztAkushvnBPrPs8Am0xFO0KUKUcYyz4VSbB34lV1hVBvuVKjb08Bv9IzrI1cIdWiFPCo6OpBKdghqonMM1QbA3+eA8LZy5GjvPB3+9l65NyPWWB7fTQmu4nOF9OM+ZI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779907390; c=relaxed/simple; bh=S6cOIQ9icy+P7rvUpdDlaXAeTozliAus/Ll9N8r1BiU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RzzQj/nViMHaekX03cCeoHEwL9MnWOBHZy1ggYml7xXUmUIsJ6YmSgazCPl7dogm0ehqZqnPARD7Hr1L1pwRyAFR3hwThs+wohB1Q/bUem4yCuwIK8VZ+AKgWnuWA5DUqqLdnDKiEWMspPCd6C55UZhdmy9nzUzyGf+107w/Czc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QItF5Xvp; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QItF5Xvp" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4906238c62eso33990395e9.3 for ; Wed, 27 May 2026 11:43:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779907384; x=1780512184; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lodW82P5YwYpxQxDxn5G0N2M8jp9f8jZPuN/5IUlEPw=; b=QItF5XvpEtR8S5uuWNtP51OkSRTA0Bs+xRVVhIemCje46HJIxLZi44crSIr2YuPx2l 6B5JF33fkAbwUs1YSPjRFaNtfzakCpP2G6mBo8uzLSyu4cK+N4yWaJEGPC0JppTifopW ms7ZiMNc/x5r0PBhUIl/2uqZy5Zn/QzU9H207xihtG47H9E2OU1hxFW56bQwuQHvrDA6 a7G3hwrGdMYw1QMNQESS70hM1nI7qTjK5u33VQhfYGxdb7QeqR2FY000PMEvTcU7QajD 9CuOSCLQsEF/di321W5qO0CxpVAi4JaGjhLcK3unSiEhsaBj/mSE+EYLIyaQw0Z8v+wr YVSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779907384; x=1780512184; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lodW82P5YwYpxQxDxn5G0N2M8jp9f8jZPuN/5IUlEPw=; b=SpZ8mwiYaRH15c7f4pl4Yho30APA36rfOYP6PB+TvnTLToSpAhw1GmvohXaCBcKGDe oM4JlABMWUJhB5I3RiIgNAIQXdXTuKD3coDwX0X8mKHRWvdGNMHOQoQBaFt/kGKN21+i y2oUu1yCmEYMCaP5QNRZr+nWhjjrXVp7GtaIY6TYInzSJRr2t/IDd9q2QkY9oqwDNZYI /lZTpBahdGwWsifisam32xaV46hF491PJ3O7RnEM1mTjKuMWR1irzylZwAfi2D+0BV0i +Hbs4Ya+yh6z72nA1+ZvUiMQ0F/lbwRlAa97ucKkSxR7gF6G2jMS/3xW0AI5ZpMNyTNb l2NQ== X-Forwarded-Encrypted: i=1; AFNElJ87PxE8ZV4GLOEsv9E2gsdF1+J5LUSAtdU2irPKz8CNjQKmXSL+LgAaSDWLxNvtNX44IqDMlOI7VmAIQlY=@vger.kernel.org X-Gm-Message-State: AOJu0YyXyhyoG7TkJqWQE4jGFYZZh6bllf0NdQ/a20Wq7HFG5CpScrud stIuwDdoRxZu1wGrmR8EqXd90teLB2GVhGZTq/lj9ncRx8vJVyP8vLtw X-Gm-Gg: Acq92OFGBDEmHDkCR42dn3+Ve2ZUDSmO0L66UYCxKMDnRs85tcSYycEm0hwDjae6QSr x/cN1BZaZBDe0+MlFq2L6u53oLt60x/gOPflgSHBanoNPkiUfypzZ6u5KbPObtgVDru8eplZg/F YcFyYYyFk/ts9tC41oFaVqOJ134jKdO/Yx3o2kJ5ofj4ZEk/CAvMSttRzP4dcAvT4LuKVZ/7F6m jZgPmcdBMoJAcfPLtuY1AubTzfqw3eDS2aNaovwlBeLK5ruwofEowz13iPtC30hTJ01BROB0dJT tP69cpqrCfX6F0BQ/8O/uuug1JsmgfT3+5PLBJ3VjXmDecCSEfFgZy3lupqWMh14R+o1edwwVkx yyH1tF6zu6cTyLo2Qx8Gl9RBLt/8crSVHEhJryN0s+ECiWl3BSlkAMqe1NeYKfBMAdk4vfSehtN bzE2ED6hmlH3MKatmbH1buMshTvQ== X-Received: by 2002:a05:600c:c8d:b0:490:6869:46d2 with SMTP id 5b1f17b1804b1-490686947f8mr207785505e9.0.1779907383635; Wed, 27 May 2026 11:43:03 -0700 (PDT) Received: from sefo-laptop ([2a02:8071:50c5:5c0::361b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490809ca202sm35312935e9.6.2026.05.27.11.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2026 11:43:03 -0700 (PDT) From: Wadim Mueller To: Maxwell Doose , Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Guenter Roeck , Jean Delvare , Andreas Klinger , Lars-Peter Clausen , linux-hwmon@vger.kernel.org Subject: [PATCH v2 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor Date: Wed, 27 May 2026 20:42:53 +0200 Message-ID: <20260527184257.141635-3-wafgo01@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260527184257.141635-1-wafgo01@gmail.com> References: <20260524205112.26638-1-wafgo01@gmail.com> <20260527184257.141635-1-wafgo01@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Variants share the same register map and differ only in the flow scale factor and calibrated measurement range, both of which are auto-detected at probe time via the product-information register. Per-variant compatible strings are accepted for documentation and future-proofing; new variants will fall back on the generic "sensirion,slf3s" compatible without a driver update. The data-ready interrupt is optional; without it the driver falls back to polled I2C reads. A sensirion,medium property is added so that the driver can start the sensor with either the H2O or the IPA factory calibration (default H2O). Signed-off-by: Wadim Mueller Cc: Guenter Roeck Cc: Jean Delvare Cc: Andreas Klinger Cc: Lars-Peter Clausen Cc: linux-hwmon@vger.kernel.org Cc: Maxwell Doose --- .../bindings/iio/flow/sensirion,slf3s.yaml | 68 +++++++++++++++++++ MAINTAINERS | 8 +++ 2 files changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/flow/sensirion,sl= f3s.yaml diff --git a/Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yam= l b/Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml new file mode 100644 index 000000000..f58cf199a --- /dev/null +++ b/Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml @@ -0,0 +1,68 @@ +# 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 + +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: + oneOf: + - items: + - enum: + - sensirion,slf3s-0600f + - sensirion,slf3s-1300f + - sensirion,slf3s-4000b + - const: sensirion,slf3s + - const: sensirion,slf3s + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + description: + Optional data-ready interrupt line. If omitted the driver falls + back to polled I2C reads. + + vdd-supply: true + + sensirion,medium: + $ref: /schemas/types.yaml#/definitions/string + enum: [ water, ipa ] + default: water + description: + Calibration medium the sensor is configured for at probe time. + SLF3S sensors are factory-calibrated for both water and + isopropyl alcohol (IPA); this property selects which calibration + to activate. Defaults to water when omitted. + +required: + - compatible + - reg + - vdd-supply + +additionalProperties: false + +examples: + - | + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + flow-sensor@8 { + compatible =3D "sensirion,slf3s-0600f", "sensirion,slf3s"; + reg =3D <0x08>; + vdd-supply =3D <®_3v3>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 06a8c7457..096ef2fe7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24187,6 +24187,14 @@ S: Maintained F: Documentation/ABI/testing/sysfs-bus-iio-chemical-sgp40 F: drivers/iio/chemical/sgp40.c =20 +SENSIRION SLF3S LIQUID FLOW SENSOR DRIVER +M: Wadim Mueller +R: Maxwell Doose +L: linux-iio@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/iio/flow/sensirion,slf3s.yaml +F: drivers/iio/flow/ + SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER M: Tomasz Duszynski S: Maintained --=20 2.52.0 From nobody Mon Jun 8 17:38:29 2026 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B3084418EC for ; Wed, 27 May 2026 18:43:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779907390; cv=none; b=Wxjp3+3UDbuWmAMbHfILZbnyOd0zFXbpisaXmqg+JTSqB3eYa8zEGLpnXIvxgfgGmQg0yiTS/1BBYk9BrGGZQH6oQe8qxRP7qQ00oZ/0eaO0tcz24Xq5vF2uI6fnM5lLTkC15jOC7zYS8lCGN6y3aBA68qbDr8OqXHez7IbQ428= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779907390; c=relaxed/simple; bh=K5QeEgn9PZGE1hc6uJfVP9MHCcz16m7KWBxjK5Lvqog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rhfosZv5fLiony3DjCdz0eOQzyTyh5wFeZ/ye4W0lnDU+p4ujUpwBpEveDgddMb9FE2DrCF5ttR81k/eXUIGxc0YCUfY0edmPdYkUcwnlC5lZwODc/rIwQ8HNVeItlDz0dYDBEhaZ0zxf+bZBXAsCJyaMGlXohu9Br9ctXVbLAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Za18lits; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Za18lits" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4891e86fabeso26205525e9.1 for ; Wed, 27 May 2026 11:43:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779907387; x=1780512187; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z4Yh6+PEL/bdnCIB+WuUc2fTFy0+k/cCB2E3bDYhFW4=; b=Za18litsWFgI7d9PEE3cXbf31iVFlqCLbFqwC8hRBLM+KQetb+YihPBaC2qMDVr4oJ THsX+nhME66AEyrQKPAjP7CGZPcnX4Jr5wu/1yOYmxAZFgThKejtb2L3+5Hc6v65DoCn aq1azS3Dg+Pz2OkpfL/xRWZnQSDJ//nGmncXcVM2DQH8H1wyCSxfCzjyA9VF9IiNyELk NdPy10zJic6xH5g/1LDJuK1R6rMyc0VAVKo7ucm6DB5IqaNbCdDVz8x0yjvGc4kIBpXQ KFYknBs1KjjaGwatvP3H2dSoa/IJ4GidlRD1hpZylkInn00gimeSSetJCkBbz/XFr1e7 UzkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779907387; x=1780512187; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=z4Yh6+PEL/bdnCIB+WuUc2fTFy0+k/cCB2E3bDYhFW4=; b=clV6Ow6uuuqrfVFH1/4D+5rDMSFo0MlaEboyhLNsLPnnF64m5oVjH6UixIguq3rFDm vjeoZPyTmAQb5hV+tKcup38uiM7XnSjibetyiKxAperH/LV1Lgk2bKjrOnt673fmGCAS aEkI4Be3WTOarj/xBZwdXHe7eGs8e+JctJNn7TobFU9F6Ac52zExfjY8/RLscjATl3JK AduI207wHYH5wTZrVca184wJHAkNcM5B3ghtqZgvu0aYkV6CWzfbf40q80FFsBG0nxrc YoQXf6glBJG8ZjPYh9QPVidr+S24u9CGir2BUgHQdC1gI0W+q/IdCP0Nk0RWOV8P5jd8 LXzg== X-Forwarded-Encrypted: i=1; AFNElJ8k3XO1HnZm6Vb2f5xUs7z/birZo2c797N/rLcWbqy+/hZRXuBVDJJgYLJjKBpjAY7x8UKWWJ4HYLNJK8Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwntZck2JecF6xFNSK/WO8M607KfuYy3STbz+Z2JNaDAWWMIktz hmSlh74V0JsF+iyNdaqkEHVJoQdtugwehcubHLnk0YLYmLF4DvxT6yKv X-Gm-Gg: Acq92OFvnmqKqa63qCHJfsxiVaaQG+2wugu/UQAM1pQcSqdQHp0Kzsxz5iaIi407WIk eg3p6eb/oBuILJTk/zQ0vj+Abz2UZfJ/TgBV7d1Yv1FBWJdfMKMALA6clNXC1k7bH2VF7EWQ+IL NXVLXiWloYF8eLlHl0bZyurPN94IXVajReQ+NwFIj1eHZaNm088uQ98ui0lOSublcvVgfzhbAzE x+qvUSv/8Rk3fCK4jqCXFkp5Kw7blfzbRXRmim38I+Df9hrw38KzFBeeugdJRvQZTZVECXxRXxN /aXPlgbanL/zn9eP0Y/YEoRdlx9TiKbu9JNl2JneIcRxt31xV2rb0PG/9Rq6PwqKEktJOlV/t86 Pym3AEm3LBCekOfzYPQYOjNPX70e/LJH9vieHxvRKUl7CZbvKqvAycOb7HMz8OUxeR6lvb7Mi6l 5FdlBwa468wRwOUOY= X-Received: by 2002:a05:600d:6451:10b0:48f:d5e8:758c with SMTP id 5b1f17b1804b1-490426d1a78mr301377695e9.16.1779907386233; Wed, 27 May 2026 11:43:06 -0700 (PDT) Received: from sefo-laptop ([2a02:8071:50c5:5c0::361b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490809ca202sm35312935e9.6.2026.05.27.11.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2026 11:43:05 -0700 (PDT) From: Wadim Mueller To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Maxwell Doose , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: Guenter Roeck , Jean Delvare , Andreas Klinger , Lars-Peter Clausen , linux-hwmon@vger.kernel.org Subject: [PATCH v2 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver Date: Wed, 27 May 2026 20:42:54 +0200 Message-ID: <20260527184257.141635-4-wafgo01@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260527184257.141635-1-wafgo01@gmail.com> References: <20260524205112.26638-1-wafgo01@gmail.com> <20260527184257.141635-1-wafgo01@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a driver for the Sensirion SLF3S family of digital liquid-flow sensors (SLF3S-0600F, SLF3S-1300F and SLF3S-4000B). The sensors communicate over I2C and return a 16-bit signed flow value, a 16-bit signed temperature reading and a status word - each protected by a CRC-8 byte - in every measurement frame. The driver exposes: in_volumeflow_raw - signed raw counts in_volumeflow_scale - litres per second per LSB (per variant) in_temp_raw - signed raw counts in_temp_scale - millidegrees Celsius per LSB The variant is auto-detected from the product-info word read at probe time. All three SLF3S devices are factory-calibrated for both water and isopropyl alcohol; the calibration medium is selected via the sensirion,medium device property and defaults to water. Scale factors are taken from the respective datasheets (Table 16 for SLF3S-0600F, Table 15 for SLF3S-1300F and SLF3S-4000B): SLF3S-0600F: 10 (ul/min)^-1 -> 1/600 000 000 (l/s)/LSB SLF3S-1300F: 500 (ml/min)^-1 -> 1/30 000 000 (l/s)/LSB SLF3S-4000B: 32 (ml/min)^-1 -> 1/1 920 000 (l/s)/LSB Signed-off-by: Wadim Mueller Cc: Guenter Roeck Cc: Jean Delvare Cc: Andreas Klinger Cc: Lars-Peter Clausen Cc: linux-hwmon@vger.kernel.org Cc: Maxwell Doose --- drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/flow/Kconfig | 27 +++ drivers/iio/flow/Makefile | 7 + drivers/iio/flow/slf3s.c | 345 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 381 insertions(+) create mode 100644 drivers/iio/flow/Kconfig create mode 100644 drivers/iio/flow/Makefile create mode 100644 drivers/iio/flow/slf3s.c diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 661127aed..652557a5b 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -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" diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index cb80ef837..f03a4100c 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -29,6 +29,7 @@ obj-y +=3D dac/ obj-y +=3D dummy/ obj-y +=3D gyro/ obj-y +=3D filter/ +obj-y +=3D flow/ obj-y +=3D frequency/ obj-y +=3D health/ obj-y +=3D humidity/ diff --git a/drivers/iio/flow/Kconfig b/drivers/iio/flow/Kconfig new file mode 100644 index 000000000..1eee131ea --- /dev/null +++ b/drivers/iio/flow/Kconfig @@ -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 diff --git a/drivers/iio/flow/Makefile b/drivers/iio/flow/Makefile new file mode 100644 index 000000000..3cf4ab95c --- /dev/null +++ b/drivers/iio/flow/Makefile @@ -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) +=3D slf3s.o diff --git a/drivers/iio/flow/slf3s.c b/drivers/iio/flow/slf3s.c new file mode 100644 index 000000000..f971a2dc2 --- /dev/null +++ b/drivers/iio/flow/slf3s.c @@ -0,0 +1,345 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Sensirion SLF3S liquid flow sensor driver. + * + * Supports the SLF3S-0600F, SLF3S-1300F and SLF3S-4000B liquid-flow + * sensors over I2C. Each measurement frame returns a 16-bit signed + * flow value, a 16-bit signed temperature value and a status word, + * each protected by a CRC-8 byte. + * + * Datasheet: https://sensirion.com/products/catalog/SLF3S-0600F/ + * + * Copyright (C) 2026 CMBlu Energy GmbH + * Author: Wadim Mueller + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define SLF3S_CRC8_POLY 0x31 +#define SLF3S_CRC8_INIT 0xff + +#define SLF3S_PRODUCT_ID_LEN 18 +#define SLF3S_PRODUCT_FAMILY_BYTE 1 +#define SLF3S_PRODUCT_SUBTYPE_BYTE 3 +#define SLF3S_PRODUCT_FAMILY_ID 0x03 + +#define SLF3S_MEAS_LEN 9 +#define SLF3S_MEAS_START_DELAY_US 12000 + +/* + * Temperature LSB equals 1/200 degC. IIO_TEMP uses milli-degrees, + * therefore the scale exposed to userspace is 1000 / 200 =3D 5. + */ +#define SLF3S_TEMP_SCALE_MILLIC 5 + +static const u8 slf3s_cmd_prep_pid[] =3D { 0x36, 0x7c }; +static const u8 slf3s_cmd_read_pid[] =3D { 0xe1, 0x02 }; +static const u8 slf3s_cmd_start_water[] =3D { 0x36, 0x08 }; +static const u8 slf3s_cmd_start_ipa[] =3D { 0x36, 0x15 }; +static const u8 slf3s_cmd_stop_meas[] =3D { 0x3f, 0xf9 }; + +/** + * struct slf3s_variant - per-variant calibration constants + * @sub_type: product-info sub-type byte returned by the sensor + * @name: name reported via @iio_dev.name + * @scale_num: flow scale numerator (l/s per LSB) + * @scale_den: flow scale denominator (l/s per LSB) + */ +struct slf3s_variant { + u8 sub_type; + const char *name; + int scale_num; + int scale_den; +}; + +static const struct slf3s_variant slf3s_variants[] =3D { + [0] =3D { + .sub_type =3D 0x03, + .name =3D "slf3s-0600f", + .scale_num =3D 1, + .scale_den =3D 600000000, + }, + [1] =3D { + .sub_type =3D 0x02, + .name =3D "slf3s-1300f", + .scale_num =3D 1, + .scale_den =3D 30000000, + }, + [2] =3D { + .sub_type =3D 0x05, + .name =3D "slf3s-4000b", + .scale_num =3D 1, + .scale_den =3D 1920000, + }, +}; + +/** + * struct slf3s_data - per-device state + * @client: I2C client this instance is bound to + * @variant: pointer into @slf3s_variants for the detected device + * @crc_table: pre-computed CRC-8 lookup table for SLF3S_CRC8_POLY + */ +struct slf3s_data { + struct i2c_client *client; + const struct slf3s_variant *variant; + u8 crc_table[CRC8_TABLE_SIZE]; +}; + +static bool slf3s_crc_valid(const struct slf3s_data *sf, const u8 *block) +{ + return crc8(sf->crc_table, block, 2, SLF3S_CRC8_INIT) =3D=3D block[2]; +} + +static int slf3s_send_cmd(struct i2c_client *client, const u8 cmd[static 2= ]) +{ + int ret =3D i2c_master_send(client, cmd, 2); + + if (ret =3D=3D 2) + return 0; + return ret < 0 ? ret : -EIO; +} + +/* + * Read the product-info block and update @sf->variant. The kernel + * trusts the DT compatible (or i2c id_table .data) above all else; the + * sub-type byte is a sanity hint. This means: + * + * - bus / CRC failures are real errors and must fail probe; + * - if the caller already picked a variant (specific compatible), the + * PID is logged for diagnostics but mismatches do not fail probe; + * - if the caller has no variant (generic "sensirion,slf3s" fallback), + * the sub-type byte is used to pick one; unknown sub-type fails. + */ +static int slf3s_detect_variant(struct slf3s_data *sf) +{ + struct i2c_client *client =3D sf->client; + u8 buf[SLF3S_PRODUCT_ID_LEN]; + int ret; + + ret =3D slf3s_send_cmd(client, slf3s_cmd_prep_pid); + if (ret) + return ret; + + ret =3D slf3s_send_cmd(client, slf3s_cmd_read_pid); + if (ret) + return ret; + + ret =3D i2c_master_recv(client, buf, sizeof(buf)); + if (ret < 0) + return ret; + if (ret !=3D sizeof(buf)) + return -EIO; + + for (unsigned int i =3D 0; i < SLF3S_PRODUCT_ID_LEN; i +=3D 3) { + if (!slf3s_crc_valid(sf, &buf[i])) + return -EIO; + } + + if (buf[SLF3S_PRODUCT_FAMILY_BYTE] !=3D SLF3S_PRODUCT_FAMILY_ID) + dev_dbg(&client->dev, + "unexpected family byte 0x%02x (expected 0x%02x)\n", + buf[SLF3S_PRODUCT_FAMILY_BYTE], + SLF3S_PRODUCT_FAMILY_ID); + + for (unsigned int i =3D 0; i < ARRAY_SIZE(slf3s_variants); i++) { + if (buf[SLF3S_PRODUCT_SUBTYPE_BYTE] !=3D + slf3s_variants[i].sub_type) + continue; + + if (sf->variant && sf->variant !=3D &slf3s_variants[i]) + dev_dbg(&client->dev, + "DT compatible says %s but sub-type 0x%02x suggests %s\n", + sf->variant->name, + buf[SLF3S_PRODUCT_SUBTYPE_BYTE], + slf3s_variants[i].name); + else if (!sf->variant) + sf->variant =3D &slf3s_variants[i]; + return 0; + } + + if (sf->variant) { + dev_dbg(&client->dev, + "unknown SLF3S sub-type 0x%02x, trusting DT compatible %s\n", + buf[SLF3S_PRODUCT_SUBTYPE_BYTE], sf->variant->name); + return 0; + } + + dev_dbg(&client->dev, "unknown SLF3S sub-type 0x%02x\n", + buf[SLF3S_PRODUCT_SUBTYPE_BYTE]); + return -ENODEV; +} + +static int slf3s_read_sample(struct slf3s_data *sf, int *flow, int *temp) +{ + u8 buf[SLF3S_MEAS_LEN]; + int ret; + + ret =3D i2c_master_recv(sf->client, buf, sizeof(buf)); + if (ret < 0) + return ret; + if (ret !=3D sizeof(buf)) + return -EIO; + + for (unsigned int i =3D 0; i < SLF3S_MEAS_LEN; i +=3D 3) { + if (!slf3s_crc_valid(sf, &buf[i])) + return -EIO; + } + + *flow =3D sign_extend32(get_unaligned_be16(&buf[0]), 15); + *temp =3D sign_extend32(get_unaligned_be16(&buf[3]), 15); + return 0; +} + +static const struct iio_chan_spec slf3s_channels[] =3D { + { + .type =3D IIO_VOLUMEFLOW, + .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SCALE), + }, + { + .type =3D IIO_TEMP, + .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SCALE), + }, +}; + +static int slf3s_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + struct slf3s_data *sf =3D iio_priv(indio_dev); + int flow, temp, ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (!iio_device_claim_direct(indio_dev)) + return -EBUSY; + + ret =3D slf3s_read_sample(sf, &flow, &temp); + iio_device_release_direct(indio_dev); + if (ret) + return ret; + + *val =3D (chan->type =3D=3D IIO_VOLUMEFLOW) ? flow : temp; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + if (chan->type =3D=3D IIO_VOLUMEFLOW) { + *val =3D sf->variant->scale_num; + *val2 =3D sf->variant->scale_den; + return IIO_VAL_FRACTIONAL; + } + *val =3D SLF3S_TEMP_SCALE_MILLIC; + return IIO_VAL_INT; + default: + return -EINVAL; + } +} + +static const struct iio_info slf3s_info =3D { + .read_raw =3D slf3s_read_raw, +}; + +static void slf3s_stop_meas(void *data) +{ + struct slf3s_data *sf =3D data; + + slf3s_send_cmd(sf->client, slf3s_cmd_stop_meas); +} + +static int slf3s_probe(struct i2c_client *client) +{ + struct device *dev =3D &client->dev; + struct iio_dev *indio_dev; + struct slf3s_data *sf; + const u8 *start_cmd =3D slf3s_cmd_start_water; + const char *medium; + int ret; + + indio_dev =3D devm_iio_device_alloc(dev, sizeof(*sf)); + if (!indio_dev) + return -ENOMEM; + + sf =3D iio_priv(indio_dev); + sf->client =3D client; + sf->variant =3D i2c_get_match_data(client); + crc8_populate_msb(sf->crc_table, SLF3S_CRC8_POLY); + + ret =3D devm_regulator_get_enable(dev, "vdd"); + if (ret) + return dev_err_probe(dev, ret, "failed to enable vdd supply\n"); + + ret =3D slf3s_detect_variant(sf); + if (ret) + return dev_err_probe(dev, ret, "product info read failed\n"); + + ret =3D device_property_read_string(dev, "sensirion,medium", &medium); + if (!ret) { + if (!strcmp(medium, "ipa")) + start_cmd =3D slf3s_cmd_start_ipa; + else if (strcmp(medium, "water")) + return dev_err_probe(dev, -EINVAL, + "unknown sensirion,medium '%s'\n", + medium); + } + + ret =3D slf3s_send_cmd(client, start_cmd); + if (ret) + return dev_err_probe(dev, ret, + "failed to start measurement\n"); + + fsleep(SLF3S_MEAS_START_DELAY_US); + + ret =3D devm_add_action_or_reset(dev, slf3s_stop_meas, sf); + if (ret) + return ret; + + indio_dev->name =3D sf->variant->name; + indio_dev->channels =3D slf3s_channels; + indio_dev->num_channels =3D ARRAY_SIZE(slf3s_channels); + indio_dev->info =3D &slf3s_info; + indio_dev->modes =3D INDIO_DIRECT_MODE; + + return devm_iio_device_register(dev, indio_dev); +} + +static const struct i2c_device_id slf3s_id[] =3D { + { .name =3D "slf3s-0600f", .driver_data =3D (kernel_ulong_t)&slf3s_varian= ts[0] }, + { .name =3D "slf3s-1300f", .driver_data =3D (kernel_ulong_t)&slf3s_varian= ts[1] }, + { .name =3D "slf3s-4000b", .driver_data =3D (kernel_ulong_t)&slf3s_varian= ts[2] }, + { .name =3D "slf3s" }, + { } +}; +MODULE_DEVICE_TABLE(i2c, slf3s_id); + +static const struct of_device_id slf3s_of_match[] =3D { + { .compatible =3D "sensirion,slf3s-0600f", .data =3D &slf3s_variants[0] }, + { .compatible =3D "sensirion,slf3s-1300f", .data =3D &slf3s_variants[1] }, + { .compatible =3D "sensirion,slf3s-4000b", .data =3D &slf3s_variants[2] }, + { .compatible =3D "sensirion,slf3s" }, + { } +}; +MODULE_DEVICE_TABLE(of, slf3s_of_match); + +static struct i2c_driver slf3s_driver =3D { + .driver =3D { + .name =3D "slf3s", + .of_match_table =3D slf3s_of_match, + }, + .probe =3D slf3s_probe, + .id_table =3D slf3s_id, +}; +module_i2c_driver(slf3s_driver); + +MODULE_AUTHOR("Wadim Mueller "); +MODULE_DESCRIPTION("Sensirion SLF3S liquid flow sensor driver"); +MODULE_LICENSE("GPL"); --=20 2.52.0