From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 AFEFA332EC8 for ; Sun, 24 May 2026 20:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779655879; cv=none; b=tSRY+B4HDSppUl7JOxQCkPWwG6JMZwrUm8f0XfaIf5etKnkb8gyS+0ZXiaW96HlXVWb8QzjRCKMtpO6VKa/GtclOBSW+PICuOjmfxaWtkD2X2VgEqsGZuUBW+hodPTOu3fJADJzCEcVApQWVtISeFnB4cR8g5BY3NSqQ4t4V5MU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779655879; c=relaxed/simple; bh=V2o/vJV29MW00MzllS88rek3h8IxCCPVdHA37Y/IsL8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K4Ufcz2Ug8wKzRx1C3xQVEtfCa53G2+sbWeqDuUBxkVtHRaqyXxZmJ44EZlrN9Tu81Ppnynj/K0iwKwtPnO+XGuMCpVyiaR/86XsviFtTuMI7WU2iE40rCzyAXN1Uh3IvRJ0ec0DhqGCPRpWws76/P6TJOSCwW1qb0rcvRRl+M4= 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.42 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-f42.google.com with SMTP id ffacd0b85a97d-43fe62837baso5250320f8f.3 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=S0/JOlIQMImYSe20BtsrJkuNZnf/gYigFgJ2UVOW581aJgs5ulL78DMpM7jYhCUkub OIr8juPg2SypkOxQuvUVUvdkhoNgmXROh+kaqL3UuGP/Hr77fOLE6yXgc7mdCv/L62H2 kHlfV5zT/Clpl/jEcVkEJkR96qRjz8f55gSpQK8K6NB8SOn+Bd73UQjdhOjRNfMD5Y/I FWtAO1/bfvJULajgqhaH4muGJL89ASQujg3cpxN2oxRxba5JCq3dB3u0qWxJPtwjbnxa APRgAP5qfRjVjBNAntH0sRC/Fu/uPzExx1DSe4AQe5JmFMgzi0T8PnTsvf8PZJlMb3Lz Qmyw== X-Forwarded-Encrypted: i=1; AFNElJ+1cHEBJEWAc3pwMHvnRxkVzAn4pCRRiT15Sch49y/Vq309Je8TQkbxnGuigPwWVlyrtX39MsjIgoiA@vger.kernel.org X-Gm-Message-State: AOJu0YwdS2hb+LDG4rkRG/Ipp30skNr4u/7KznRY1Ay6K4Aa3yUG7CQ5 4v255PkuXzbV6PLjCYiXrrCPhxxPLNVUyGeZLP9J94jHsE8IpI75s0V4 X-Gm-Gg: Acq92OGEaGLRNo4U7qxlEuqs73gD3J3xxlF6SR/PddNhMhniFyCWR6k9NT+J6f0qmPe 6QpdfkjJA1N39Ij3+u+QoYUHA950b7dUgYALFyd9DM5Qkhzm4Ow6wehS5rf1/N06t4luDOYwnGM Ffsmn3Rqjf41wJpdWOjVVXv6Jb/sgxY56OBvCUIXhraN0xhxyD/ypSs8ALjnC8bwP6yUjK/jMQt G17NwjE9zyOTTnyFOcNg4JsP++EHDHtie94lb7odUj/qCu7iJweFMje19lgLgRm3WU8cBMlJOjo 7pM06x9pz9AHy5xX4b+jZBVn0WxDV0W0Wlgu5DhzC2uIsJiG0y7jJgE+7ILZ1lzFznC6K5tj5Vz gfePpuKGhYtTzd3BdKK5KS5Qv+gJHdaiQWX0q3+5tXDan7t9O6FPDRaDgQ0XMHf3uMtj/FO7D/A PyU84O 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: devicetree@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