Skip to content

RFC iio: Introduce new timestamp grabbing APIs

Gyeyoung Baek linux-iio lkml llvm oe-kbuild-all 1 version Applied

Status from this message: Applied.

Get series with b4
b4 am [email protected] change-id 20250518-timestamp-a899e78e07e3

Versions newest first

  1. v1 RFC Latest9 patches 11 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/9iio: buffer: Fix checkpatch.pl warningdrivers/iio/buffer/industrialio-triggered-buffer.c+1 -13 replies
2/9iio: consumer: Define timestamp-related structures and constantsinclude/linux/iio/trigger_consumer.h+13 -01 reply
3/9iio: consumer: Add new APIs of triggered_buffer_setup() familydrivers/iio/buffer/industrialio-triggered-buffer.c drivers/iio/industrialio-trigger.c include/linux/iio/trigger_consumer.h +1 more+147 -01 reply
4/9iio: consumer: Add new API iio_poll_func_register()drivers/iio/industrialio-trigger.c+54 -40 replies
5/9iio: consumer: Add new API iio_pollfunc_get_timestamp()drivers/iio/industrialio-trigger.c include/linux/iio/trigger_consumer.h+9 -00 replies
6/9iio: trigger: Define timetamp-related structures and constantsinclude/linux/iio/trigger.h+13 -11 reply
7/9iio: trigger: Add new API iio_trigger_attach_timestamp()drivers/iio/industrialio-trigger.c+22 -00 replies
8/9iio: trigger: Add new API iio_trigger_store_time()drivers/iio/industrialio-trigger.c include/linux/iio/trigger.h+18 -00 replies
9/9iio: rpr0521: Use new timestamp-related APIsdrivers/iio/light/rpr0521.c+6 -162 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 0/9] iio: Introduce new timestamp grabbing APIs

Support automatic timestamp grabbing by passing true to the timestamp_enabled parameter of iio_triggered_buffer_setup_new(). So consumer drivers don't need to set iio_pollfunc_store_time() as either the tophalf or bottomhalf manually.

For this, triggers must indicate whether they will call poll(), poll_nested(), or both before calling iio_trigger_register(). This is necessary because the consumer's handler does not know in advance which trigger will be attached.

Once iio_trigger_attach_poll_func() is called, a timestamp is grabbed in either the tophalf or bottomhalf based on the trigger's type (POLL or POLL_NESTED). If the trigger supports both (e.g., at91-sama5d2-adc.c), it is treated as POLL_NESTED since the consumer's tophalf is not invoked in poll_nested(), but the bottomhalf always is.

If the attached trigger supports timestamp grabbing itself, the consumer does not need to handle it. Instead, the consumer's poll_func pointer is passed to the trigger, which can then store the timestamp directly into consumer. Trigger drivers can pass timestamp values to consumers in a consistent interface using the new API iio_trigger_store_time().

Tested on qemu, with dummy and trig-sysfs drivers tweaked for testing.

---
Gyeyoung Baek (9):
iio: buffer: Fix checkpatch.pl warning
iio: consumer: Define timestamp-related structures and constants
iio: consumer: Add new APIs of triggered_buffer_setup() family
iio: consumer: Add new API iio_poll_func_register()
iio: consumer: Add new API iio_pollfunc_get_timestamp()
iio: trigger: Define timetamp-related structures and constants
iio: trigger: Add new API iio_trigger_attach_timestamp()
iio: trigger: Add new API iio_trigger_store_time()
iio: rpr0521: Use new timestamp-related APIs

 drivers/iio/buffer/industrialio-triggered-buffer.c |  84 ++++++++++++-
 drivers/iio/industrialio-trigger.c                 | 135 ++++++++++++++++++++-
 drivers/iio/light/rpr0521.c                        |  22 +---
 include/linux/iio/trigger.h                        |  16 ++-
 include/linux/iio/trigger_consumer.h               |  23 ++++
 include/linux/iio/triggered_buffer.h               |  25 ++++
 6 files changed, 283 insertions(+), 22 deletions(-)

---
base-commit: 43a9eee06bf8a8535d8709b29379bec8cafcab56
change-id: 20250518-timestamp-a899e78e07e3

Best regards,

Signature · 1 line
Gyeyoung Baek <[email protected]>