mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Mark Brown <[email protected]>
This commit is contained in:
parent
b688c18d30
commit
34739a213d
4 changed files with 66 additions and 33 deletions
|
|
@ -664,9 +664,8 @@ err_unlock:
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(iio_convert_raw_to_processed);
|
||||
|
||||
static int iio_read_channel_attribute(struct iio_channel *chan,
|
||||
int *val, int *val2,
|
||||
enum iio_chan_info_enum attribute)
|
||||
int iio_read_channel_attribute(struct iio_channel *chan, int *val, int *val2,
|
||||
enum iio_chan_info_enum attribute)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -682,6 +681,7 @@ err_unlock:
|
|||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(iio_read_channel_attribute);
|
||||
|
||||
int iio_read_channel_offset(struct iio_channel *chan, int *val, int *val2)
|
||||
{
|
||||
|
|
@ -850,7 +850,8 @@ static int iio_channel_write(struct iio_channel *chan, int val, int val2,
|
|||
chan->channel, val, val2, info);
|
||||
}
|
||||
|
||||
int iio_write_channel_raw(struct iio_channel *chan, int val)
|
||||
int iio_write_channel_attribute(struct iio_channel *chan, int val, int val2,
|
||||
enum iio_chan_info_enum attribute)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -860,12 +861,18 @@ int iio_write_channel_raw(struct iio_channel *chan, int val)
|
|||
goto err_unlock;
|
||||
}
|
||||
|
||||
ret = iio_channel_write(chan, val, 0, IIO_CHAN_INFO_RAW);
|
||||
ret = iio_channel_write(chan, val, val2, attribute);
|
||||
err_unlock:
|
||||
mutex_unlock(&chan->indio_dev->info_exist_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(iio_write_channel_attribute);
|
||||
|
||||
int iio_write_channel_raw(struct iio_channel *chan, int val)
|
||||
{
|
||||
return iio_write_channel_attribute(chan, val, 0, IIO_CHAN_INFO_RAW);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(iio_write_channel_raw);
|
||||
|
||||
unsigned int iio_get_channel_ext_info_count(struct iio_channel *chan)
|
||||
|
|
|
|||
Loading…
Reference in a new issue