From: David Lechner <dlechner@baylibre.com>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: jic23@kernel.org, Jonathan.Cameron@huawei.com,
nuno.sa@analog.com, andy@kernel.org
Subject: Re: [RFC PATCH v1 7/9] iio: Expand IIO event interface for real-world unit handling
Date: Sun, 18 Jan 2026 14:10:30 -0600 [thread overview]
Message-ID: <5835e21b-0b27-41f5-8c92-762cac327b40@baylibre.com> (raw)
In-Reply-To: <6d9baa8d553d03a41fbd97bca0377a7a4779a93e.1768759292.git.marcelo.schmitt1@gmail.com>
On 1/18/26 12:21 PM, Marcelo Schmitt wrote:
> The IIO event ABI documentation distinguishes between interfaces that
> handle values in device-specific units (_raw) and event interfaces that
> handle values in real-world units (e.g. meters, Joules, lux, etc).
> However, the IIO event code infrastructure had never really implemented the
> bits to distinguish between those two types of interfaces and had always
> presumed events to handle raw device values.
>
> For most current use cases, assuming events to handle values in device raw
> units is reasonable because it often matches the type of the associated IIO
> channel. There are a few cases where drivers provide events along side
> channels with both _raw and _input interfaces, though. Also, when
> real-world values can be mapped back to device configurations, it enables
> drivers to provide event interfaces that are arguably easier to use.
>
> Expand the IIO events support, enabling IIO drivers to provide event
> interfaces that handle values in real-world units.
>
...
> @@ -399,15 +410,23 @@ static int iio_device_add_event(struct iio_dev *indio_dev,
> for_each_set_bit(i, mask, sizeof(*mask)*8) {
> if (i >= ARRAY_SIZE(iio_ev_info_text))
> return -EINVAL;
> - if (dir != IIO_EV_DIR_NONE)
> - postfix = kasprintf(GFP_KERNEL, "%s_%s_%s",
> - iio_ev_type_text[type],
> - iio_ev_dir_text[dir],
> - iio_ev_info_text[i]);
> - else
> + if (dir != IIO_EV_DIR_NONE) {
> + if (i == IIO_EV_INFO_ENABLE)
> + postfix = kasprintf(GFP_KERNEL, "%s_%s_%s",
> + iio_ev_type_text[type],
> + iio_ev_dir_text[dir],
> + iio_ev_info_text[i]);
> + else
> + postfix = kasprintf(GFP_KERNEL, "%s_%s_%s_%s",
> + iio_ev_unit_text[unit],
> + iio_ev_type_text[type],
> + iio_ev_dir_text[dir],
> + iio_ev_info_text[i]);
> + } else {
I think that the units only make sense on IIO_EV_INFO_VALUE and
IIO_EV_INFO_HYSTERESIS. Everything else has it's own unit, not just
IIO_EV_INFO_ENABLE.
> postfix = kasprintf(GFP_KERNEL, "%s_%s",
> iio_ev_type_text[type],
> iio_ev_info_text[i]);
> + }
> if (postfix == NULL)
> return -ENOMEM;
>
next prev parent reply other threads:[~2026-01-18 20:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-18 18:18 [RFC PATCH v1 0/9] " Marcelo Schmitt
2026-01-18 18:18 ` [RFC PATCH v1 1/9] iio: ABI: Drop unused in_energy_input Marcelo Schmitt
2026-01-31 18:51 ` Jonathan Cameron
2026-01-18 18:20 ` [RFC PATCH v1 2/9] iio: ABI: Accurately describe in_distance_input Marcelo Schmitt
2026-01-18 19:46 ` David Lechner
2026-01-21 2:49 ` Marcelo Schmitt
2026-01-31 18:52 ` Jonathan Cameron
2026-01-18 18:20 ` [RFC PATCH v1 3/9] iio: ABI: Accurately describe in_illuminance[Y]_input Marcelo Schmitt
2026-01-18 18:20 ` [RFC PATCH v1 4/9] iio: ABI: Slight readability improve for event threshold value doc Marcelo Schmitt
2026-01-18 18:21 ` [RFC PATCH v1 5/9] iio: ABI: Update event threshold value documentation Marcelo Schmitt
2026-01-18 18:21 ` [RFC PATCH v1 6/9] iio: ABI: Adjust event threshold enable desc to unitless thresh values Marcelo Schmitt
2026-01-18 18:21 ` [RFC PATCH v1 7/9] iio: Expand IIO event interface for real-world unit handling Marcelo Schmitt
2026-01-18 20:10 ` David Lechner [this message]
2026-01-31 18:55 ` Jonathan Cameron
2026-01-18 18:22 ` [RFC PATCH v1 8/9] iio: dummy: iio_simple_dummy: Update to event unit expanded interface Marcelo Schmitt
2026-01-18 18:22 ` [RFC PATCH v1 9/9] iio: adc: ad7091r-base: " Marcelo Schmitt
2026-01-18 20:33 ` [RFC PATCH v1 0/9] iio: Expand IIO event interface for real-world unit handling David Lechner
2026-01-21 2:40 ` Marcelo Schmitt
2026-01-21 9:33 ` Nuno Sá
2026-01-21 17:43 ` David Lechner
2026-01-31 18:48 ` Jonathan Cameron
2026-02-02 10:21 ` Nuno Sá
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=5835e21b-0b27-41f5-8c92-762cac327b40@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy@kernel.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=nuno.sa@analog.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
all inboxes | Powered by JetHome®