* [PATCH v1 1/1] iio: Allow device drivers to specify IIO event unit type
@ 2026-10-08 5:27 Marcelo Schmitt
2026-10-16 8:37 ` Nuno Sá
0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Schmitt @ 2026-10-08 5:27 UTC (permalink / raw)
To: linux-iio, linux-kernel; +Cc: jic23, nuno.sa, andy, dlechner, marcelo.schmitt1
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.
Because distinguishing between device (_raw) and real-world (_input) units
only makes sense for value and hysteresis info, only add complementary enum
item for those.
Users of the IIO event ABI should, as much as possible, match the event
unit type with the channel unit type. I.e. device drivers that present
device-specific raw units for their channels ought to also provide event
interfaces that handle raw units. Conversely, when IIO channels provide
processed (_input) data, IIO events will generally be expected to operate
over real-world units as well.
Complement the IIO event info enum, allowing IIO drivers to specify what
type of event info is used for their event interfaces.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
---
This was originally a patch series [1], but the suggestions provided back then
allowed it to be greatly simplified.
[1]: https://lore.kernel.org/linux-iio/cover.1768759292.git.marcelo.schmitt1@gmail.com/
include/linux/iio/types.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index d8944c9e5e90..bf03eb498753 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -15,7 +15,11 @@
enum iio_event_info {
IIO_EV_INFO_ENABLE,
IIO_EV_INFO_VALUE,
+ IIO_EV_INFO_VALUE_RAW,
+ IIO_EV_INFO_VALUE_INPUT,
IIO_EV_INFO_HYSTERESIS,
+ IIO_EV_INFO_HYSTERESIS_RAW,
+ IIO_EV_INFO_HYSTERESIS_INPUT,
IIO_EV_INFO_PERIOD,
IIO_EV_INFO_HIGH_PASS_FILTER_3DB,
IIO_EV_INFO_LOW_PASS_FILTER_3DB,
base-commit: 04434a1d0f311d76b1f15fa987918b471a0b8c6a
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v1 1/1] iio: Allow device drivers to specify IIO event unit type
2026-10-08 5:27 [PATCH v1 1/1] iio: Allow device drivers to specify IIO event unit type Marcelo Schmitt
@ 2026-10-16 8:37 ` Nuno Sá
0 siblings, 0 replies; 2+ messages in thread
From: Nuno Sá @ 2026-10-16 8:37 UTC (permalink / raw)
To: Marcelo Schmitt; +Cc: linux-iio, linux-kernel, jic23, andy, dlechner
On Thu, Oct 08, 2026 at 02:27:15AM -0300, 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.
>
> Because distinguishing between device (_raw) and real-world (_input) units
> only makes sense for value and hysteresis info, only add complementary enum
> item for those.
>
> Users of the IIO event ABI should, as much as possible, match the event
> unit type with the channel unit type. I.e. device drivers that present
> device-specific raw units for their channels ought to also provide event
> interfaces that handle raw units. Conversely, when IIO channels provide
> processed (_input) data, IIO events will generally be expected to operate
> over real-world units as well.
>
> Complement the IIO event info enum, allowing IIO drivers to specify what
> type of event info is used for their event interfaces.
>
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
> ---
> This was originally a patch series [1], but the suggestions provided back then
> allowed it to be greatly simplified.
>
> [1]: https://lore.kernel.org/linux-iio/cover.1768759292.git.marcelo.schmitt1@gmail.com/
>
> include/linux/iio/types.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
> index d8944c9e5e90..bf03eb498753 100644
> --- a/include/linux/iio/types.h
> +++ b/include/linux/iio/types.h
> @@ -15,7 +15,11 @@
> enum iio_event_info {
> IIO_EV_INFO_ENABLE,
> IIO_EV_INFO_VALUE,
> + IIO_EV_INFO_VALUE_RAW,
> + IIO_EV_INFO_VALUE_INPUT,
> IIO_EV_INFO_HYSTERESIS,
> + IIO_EV_INFO_HYSTERESIS_RAW,
> + IIO_EV_INFO_HYSTERESIS_INPUT,
I might be missing something but how will the new values be different in
terms of ABI? Shouldn't we expose different interfaces depending on RAW
vs INPUT? Naturally we need to keep the old IIO_EV_INFO_VALUE ABI for
existing drivers and encourage new ones to use the new one. And if any
existing one wants to convert to the new thing, needs to keep both.
- Nuno Sá
> IIO_EV_INFO_PERIOD,
> IIO_EV_INFO_HIGH_PASS_FILTER_3DB,
> IIO_EV_INFO_LOW_PASS_FILTER_3DB,
>
> base-commit: 04434a1d0f311d76b1f15fa987918b471a0b8c6a
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-16 8:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-08 5:27 [PATCH v1 1/1] iio: Allow device drivers to specify IIO event unit type Marcelo Schmitt
2026-10-16 8:37 ` Nuno Sá
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®