[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250519-timestamp-v1-6-fcb4f6c2721c@gmail.com>
Date: Mon, 19 May 2025 23:25:58 +0900
From: Gyeyoung Baek <gye976@...il.com>
To: Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>
Cc: Gyeyoung Baek <gye976@...il.com>,
linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH RFC 6/9] iio: trigger: Define timetamp-related structures and constants
The `trig_type` indicates whether the trigger calls poll() or poll_nested().
The `early_timestamp` indicates whether the trigger grabs the timestamp at the trigger.
We need this to prevent the consumer from overwriting the timestamp.
To allow the trigger to directly write the timestamp into the consumer's poll_func,
add poll_func pointer member to the iio_trigger structure.
However, I'm not sure if having a poll_func pointer member
in iio_trigger is a good approach.
Would this approach be acceptable?
Signed-off-by: Gyeyoung Baek <gye976@...il.com>
---
include/linux/iio/trigger.h | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index bce3b1788199..f3b89a1e0318 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -36,6 +36,10 @@ struct iio_trigger_ops {
struct iio_dev *indio_dev);
};
+#define IIO_TRIG_TYPE_POLL BIT(0)
+#define IIO_TRIG_TYPE_POLL_NESTED BIT(1)
+#define IIO_TRIG_TYPE_BOTH (IIO_TRIG_TYPE_POLL | \
+ IIO_TRIG_TYPE_POLL_NESTED)
/**
* struct iio_trigger - industrial I/O trigger device
@@ -56,7 +60,10 @@ struct iio_trigger_ops {
* i.e. if we registered a poll function to the same
* device as the one providing the trigger.
* @reenable_work: [INTERN] work item used to ensure reenable can sleep.
+ * @trig_type: [DRIVER] specifies whether the trigger calls poll(), poll_nested(), or both.
+ * @early_timestamp: [DRIVER] set to true if the trigger supports grabbing timestamp.
**/
+
struct iio_trigger {
const struct iio_trigger_ops *ops;
struct module *owner;
@@ -76,8 +83,13 @@ struct iio_trigger {
struct mutex pool_lock;
bool attached_own_device;
struct work_struct reenable_work;
-};
+ /* RFC, exists to access the consumer device’s pollfunc. */
+ struct iio_poll_func *consumer_pf[CONFIG_IIO_CONSUMERS_PER_TRIGGER];
+
+ int trig_type;
+ bool early_timestamp;
+};
static inline struct iio_trigger *to_iio_trigger(struct device *d)
{
--
2.43.0
Powered by blists - more mailing lists