[PATCH v7 06/10] iio: core: add an accessor for scan_timestamp
From: Rupesh Majhi
Date: Fri Sep 18 2026 - 08:37:47 EST
indio_dev->scan_timestamp is __private, so a driver has no way to ask
whether the timestamp channel is in the current scan. Hide the
ACCESS_PRIVATE() behind a read-only helper, the way iio_get_masklength()
already does.
The dps310 FIFO patch later in this series is the first user: that
hardware does not timestamp entries, so it refuses a buffer with the
timestamp channel enabled.
Suggested-by: Jonathan Cameron <jic23@xxxxxxxxxx>
Assisted-by: LLM
Signed-off-by: Rupesh Majhi <zoone.rupert@xxxxxxxxx>
---
include/linux/iio/iio.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 989c1db8fb36..a893e36be988 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -1083,6 +1083,15 @@ static inline unsigned int iio_get_masklength(const struct iio_dev *indio_dev)
return ACCESS_PRIVATE(indio_dev, masklength);
}
+/**
+ * iio_scan_timestamp_enabled - Is the timestamp channel in the current scan
+ * @indio_dev: the IIO device to check
+ */
+static inline bool iio_scan_timestamp_enabled(const struct iio_dev *indio_dev)
+{
+ return ACCESS_PRIVATE(indio_dev, scan_timestamp);
+}
+
int iio_active_scan_mask_index(struct iio_dev *indio_dev);
/**
--
2.43.0