Commit 69f0793e authored by Gwendal Grignou's avatar Gwendal Grignou Committed by Enric Balletbo i Serra

iio: expose iio_device_set_clock

Some IIO devices may want to override the default (realtime) to another
clock source by default.

It can beneficial when timestamps coming from the hardware or underlying
drivers are already in that format.

It can always be overridden by attribute current_timestamp_clock.
Signed-off-by: default avatarGwendal Grignou <gwendal@chromium.org>
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
parent d9452adc
...@@ -189,7 +189,12 @@ ssize_t iio_read_const_attr(struct device *dev, ...@@ -189,7 +189,12 @@ ssize_t iio_read_const_attr(struct device *dev,
} }
EXPORT_SYMBOL(iio_read_const_attr); EXPORT_SYMBOL(iio_read_const_attr);
static int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id) /**
* iio_device_set_clock() - Set current timestamping clock for the device
* @indio_dev: IIO device structure containing the device
* @clock_id: timestamping clock posix identifier to set.
*/
int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id)
{ {
int ret; int ret;
const struct iio_event_interface *ev_int = indio_dev->event_interface; const struct iio_event_interface *ev_int = indio_dev->event_interface;
...@@ -207,6 +212,7 @@ static int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id) ...@@ -207,6 +212,7 @@ static int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id)
return 0; return 0;
} }
EXPORT_SYMBOL(iio_device_set_clock);
/** /**
* iio_get_time_ns() - utility function to get a time stamp for events etc * iio_get_time_ns() - utility function to get a time stamp for events etc
......
...@@ -627,6 +627,8 @@ static inline clockid_t iio_device_get_clock(const struct iio_dev *indio_dev) ...@@ -627,6 +627,8 @@ static inline clockid_t iio_device_get_clock(const struct iio_dev *indio_dev)
return indio_dev->clock_id; return indio_dev->clock_id;
} }
int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id);
/** /**
* dev_to_iio_dev() - Get IIO device struct from a device struct * dev_to_iio_dev() - Get IIO device struct from a device struct
* @dev: The device embedded in the IIO device * @dev: The device embedded in the IIO device
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment