diff options
author | Arnaud Pouliquen <arnaud.pouliquen@st.com> | 2018-01-10 11:13:06 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-01-10 10:30:08 +0000 |
commit | 34739a213dbb85c8d775de42d52358255059c257 (patch) | |
tree | a12a6cb37562cf92480e9b45e18c1f3257135e51 /include/linux/iio/consumer.h | |
parent | b688c18d30060e8a840d8af72790339c72acdac4 (diff) |
IIO: inkern: API for manipulating channel attributes
Extend the inkern API with functions for reading and writing
attribute of iio channels.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux/iio/consumer.h')
-rw-r--r-- | include/linux/iio/consumer.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h index 5e347a9805fd..2017f35db17c 100644 --- a/include/linux/iio/consumer.h +++ b/include/linux/iio/consumer.h @@ -216,6 +216,32 @@ int iio_read_channel_average_raw(struct iio_channel *chan, int *val); int iio_read_channel_processed(struct iio_channel *chan, int *val); /** + * iio_write_channel_attribute() - Write values to the device attribute. + * @chan: The channel being queried. + * @val: Value being written. + * @val2: Value being written.val2 use depends on attribute type. + * @attribute: info attribute to be read. + * + * Returns an error code or 0. + */ +int iio_write_channel_attribute(struct iio_channel *chan, int val, + int val2, enum iio_chan_info_enum attribute); + +/** + * iio_read_channel_attribute() - Read values from the device attribute. + * @chan: The channel being queried. + * @val: Value being written. + * @val2: Value being written.Val2 use depends on attribute type. + * @attribute: info attribute to be written. + * + * Returns an error code if failed. Else 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_attribute(struct iio_channel *chan, int *val, + int *val2, enum iio_chan_info_enum attribute); + +/** * iio_write_channel_raw() - write to a given channel * @chan: The channel being queried. * @val: Value being written. |