diff options
Diffstat (limited to 'drivers/iio/inkern.c')
-rw-r--r-- | drivers/iio/inkern.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 0cf5f8e06cfc..adeba5a0ecf7 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -443,6 +443,24 @@ err_unlock: | |||
443 | } | 443 | } |
444 | EXPORT_SYMBOL_GPL(iio_read_channel_raw); | 444 | EXPORT_SYMBOL_GPL(iio_read_channel_raw); |
445 | 445 | ||
446 | int iio_read_channel_average_raw(struct iio_channel *chan, int *val) | ||
447 | { | ||
448 | int ret; | ||
449 | |||
450 | mutex_lock(&chan->indio_dev->info_exist_lock); | ||
451 | if (chan->indio_dev->info == NULL) { | ||
452 | ret = -ENODEV; | ||
453 | goto err_unlock; | ||
454 | } | ||
455 | |||
456 | ret = iio_channel_read(chan, val, NULL, IIO_CHAN_INFO_AVERAGE_RAW); | ||
457 | err_unlock: | ||
458 | mutex_unlock(&chan->indio_dev->info_exist_lock); | ||
459 | |||
460 | return ret; | ||
461 | } | ||
462 | EXPORT_SYMBOL_GPL(iio_read_channel_average_raw); | ||
463 | |||
446 | static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, | 464 | static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, |
447 | int raw, int *processed, unsigned int scale) | 465 | int raw, int *processed, unsigned int scale) |
448 | { | 466 | { |