From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 AE9D7330B14 for ; Sun, 24 May 2026 20:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779655882; cv=none; b=FtRH5+HTcNJ+4pKy1vKpORn9bHSDlrlrs1vr0ZpeorhWtx2+1pA4RRRxdjEOZsMvZgbmNDNTHpRTb88i5XT9nbzr2Z4BVGonKn0JP+DRyMA7Hr/JRe+Px/tb2awuWz3KyPnNLxYeKVd1Tvfi5+iWkpC2q6LMxISn1rwTbcRnom8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779655882; c=relaxed/simple; bh=V2o/vJV29MW00MzllS88rek3h8IxCCPVdHA37Y/IsL8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pjvr6YZXkNUlC10ngEFy9D9QdN3P8WB4nUUzQkCbLzi92PiA8XrYQ41P/lGQH0tkxW/lzZpqLU+9HBuOHBtlUpxObvT47fdsnwJ98/l9zBStPRXn6h/tGNLztZKcZrQ5jtugVuxf3RYQFT563orZ8dz6+XJpWAcUw85i95ezYjc= 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=kwt3PX4C; arc=none smtp.client-ip=209.85.221.46 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="kwt3PX4C" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-43d7645adbdso5808657f8f.1 for ; Sun, 24 May 2026 13:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779655876; x=1780260676; 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=FgZxqqtEk/bcjKKyOMFKpuNhp2tz27mBRUcefyZzmdc=; b=kwt3PX4CwQiefsHk5NL57J2GetGpFZPhNDsHy1xt181H6YuvNC2iFQpPLIhWF8AZVW v+VAUTxyJQdWORwJEW9I2hN95npm5345WLRVHi8BpXhMpkSBpMv7TLZWfOP0kgbbaY0t ykKb7C3TtTy0PTu8TCBDWgsTzRvecuHdt78ZXP4ylahFe2G8M5NaO5eIj29U8NWn7j77 hLujKJZ1qDmTcNR42asp+dA8lydwDxoY5JSg+QeYa7fu8hzxI46P7TveWwBF1gs7yiiZ FGm4/fISLHA35u34i5uoAKYTcNOAzuhwMgEavkQSD0j3CRojfOkXHz7ahHP8mcJwRlFg 5qqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779655876; x=1780260676; 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=FgZxqqtEk/bcjKKyOMFKpuNhp2tz27mBRUcefyZzmdc=; b=FeH2UdO87LV5m7fkiXxClgdm9PmC7u9oDIaShWTGQzTD9ahf/dnMiPtGUKVbRJRt+m p+gcU2o/2InyvwFDtjcXmOa0N1y+tHFUOab1ZXTvgdBqEM7JVXznbkAadC5PsdWd3Q7I 1T20K9iQWJL6rpBv6FufaREQZAf8yGulhQrR6KUA1tBUdkx++gZ7JxJLYkOvBu6EbeDN ApIkrosu+U+HRQqveUdZGUksUU/1xUkMOXIF/qSkezEoBwPnXupL/1/OuaUS+FURoiAr hO8F92L4AFmBJqCOgqnutZ3DhsC0n5I4DbhmJfBOY1PgeKg2/deJUcPxVhXtYnqMzjRZ NsGw== X-Forwarded-Encrypted: i=1; AFNElJ/e0kNKqZqazW6ItuA4kFmlq92MY+58QTEZ9UCQea0zPtD47c5RX90oNvLINACUQ4r276XuMEvN+QxwrUc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz11QB2AM8eHmjC8j2XnWCcnzaCKRG74WFtSwK2waC3Dr6mzU9x 1mmchhVbfg1GzQ/mhorSKDNAnl4IgmgzSjGU7wPzt74DCI/hGUAUMXfc X-Gm-Gg: Acq92OFdlT2HHSDfU3iDDe8Nv1vw59W/Q4+kKaR/stb68DU4CoyijSGUqN6fNz3BGoG Ps3/Gpj/4HorqNDiPhpbhz79GyyoZMu6SSZJHwHqRsgmkRorvsS1si4i5YogPiaM87EAlIlOefK 67zEhJ6TsXtWHh2khTco2m3QYJ6EZLbEXcq5WaM8nUIH0wQWCI8bHu8CQuLG2IF8X0B/EbNvHZD Y+/7i8yUl4S/LYjQ4x7qd1DP++eQLaYLRSjvPbd61Upcsf84JrkjpXlnQQEPvoNFxL+fYj2tszp zQwPe7Fi4UL+1jsGw1E0D9GDzWNOQm6rzRVATMjnTFjaU4DPy4BPxFcaSQ+CXBmZG1aLn2eCKdD 6Cvm0d25ShxepnHU9MI8ppT8UczayE0zCdFwukX+r/75CKgZqKzowNzzH0KfhkzCMPl1qq8z+/F VPrU2z X-Received: by 2002:a05:6000:2384:b0:43c:fc5c:a9fe with SMTP id ffacd0b85a97d-45eb39e1efcmr19662501f8f.20.1779655875822; Sun, 24 May 2026 13:51:15 -0700 (PDT) Received: from sefo-laptop ([2a02:8071:50c5:5c0::361b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45eb6d6ebf0sm22738588f8f.34.2026.05.24.13.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2026 13:51:15 -0700 (PDT) From: Wadim Mueller To: jic23@kernel.org Cc: lars@metafoo.de, dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, linux@roeck-us.net, 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: [RFC PATCH v1 1/4] iio: types: add IIO_VOLUMEFLOW channel type Date: Sun, 24 May 2026 22:49:36 +0200 Message-ID: <20260524205112.26638-2-wafgo01@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260524205112.26638-1-wafgo01@gmail.com> References: <20260524205112.26638-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: 8bit From: Wadim Mueller 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. Signed-off-by: Wadim Mueller --- Documentation/ABI/testing/sysfs-bus-iio | 17 +++++++++++++++++ drivers/iio/industrialio-core.c | 1 + include/uapi/linux/iio/types.h | 1 + tools/iio/iio_event_monitor.c | 2 ++ 4 files changed, 21 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 5f87dcee7..68eb703c1 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -2458,3 +2458,20 @@ 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:linux-iio@vger.kernel.org +Description: +Raw (unscaled) volumetric flow rate reading from the channel. +To convert to standard units (litres / second) apply the +channel's _scale (and _offset, when present). + +What:/sys/bus/iio/devices/iio:deviceX/in_volumeflow_scale +What:/sys/bus/iio/devices/iio:deviceX/in_volumeflowY_scale +KernelVersion:6.19 +Contact:linux-iio@vger.kernel.org +Description: +Scale factor applied to raw volumetric flow readings to obtain +the value in litres per second (l/s). diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.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[] = { [IIO_CHROMATICITY] = "chromaticity", [IIO_ATTENTION] = "attention", [IIO_ALTCURRENT] = "altcurrent", + [IIO_VOLUMEFLOW] = "volumeflow", }; static const char * const iio_modifier_names[] = { diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h index 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, }; 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[] = { [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; -- 2.52.0