iio: inkern: add iio_read_channel_offset helper

Allow access to underlying channel IIO_CHAN_INFO_OFFSET from a consumer.

Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Matt Ranostay
2016-09-23 23:04:07 -07:00
committed by Jonathan Cameron
parent 2a20af722d
commit 0023e67dd8
2 changed files with 39 additions and 13 deletions

View File

@@ -235,6 +235,19 @@ int iio_write_channel_raw(struct iio_channel *chan, int val);
int iio_get_channel_type(struct iio_channel *channel,
enum iio_chan_type *type);
/**
* iio_read_channel_offset() - read the offset value for a channel
* @chan: The channel being queried.
* @val: First part of value read back.
* @val2: Second part of value read back.
*
* Note returns a description of what is in val and val2, such
* as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val
* + val2/1e6
*/
int iio_read_channel_offset(struct iio_channel *chan, int *val,
int *val2);
/**
* iio_read_channel_scale() - read the scale value for a channel
* @chan: The channel being queried.