summaryrefslogtreecommitdiffstats
path: root/drivers/iio/inkern.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-26 08:12:25 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-26 08:12:25 -0700
commitd5cef008e95ffdaf457e38254e67d145a927df96 (patch)
tree8ed3f611c886af4276d6fb493e62d927d8f6946d /drivers/iio/inkern.c
parent58612c608f41a24c58ce082986da3e30ce2fff37 (diff)
parentea7e586bdd331fd6fba2b6f9fd3777928c2814d8 (diff)
downloadtalos-op-linux-d5cef008e95ffdaf457e38254e67d145a927df96.tar.gz
talos-op-linux-d5cef008e95ffdaf457e38254e67d145a927df96.zip
Merge tag 'iio-for-3.16a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: First round of IIO new driver, functionality and cleanups for the 3.16 cycle. New device support * AS3935 Lightning Sensor * MCP3426/7/8 support added to the existing MCP3422 ADC driver * AK8963 support in the AK8975 driver * MPU6500 support in the MPU6050 driver (the functionality that is different is mostly not supported yet in either part). Staging Graduations * AD799x ADC New functionality * ACPI enumeration for the ak8975 driver Cleanup / tweaks * Use snprintf as a matter of good practice in a few additional places. * Document *_mean_raw attributes. These have been there a while, but were undocumented. * Add an in kernel interface to get the mean values. * Bug in the length of the event info mask that by coincidence wasn't yet actually causing any problems. * itg3000 drop an unreachable return statement. * spear_adc cleanups (heading for a staging graduation but a few more issues showed up in the review of these patches). * Exynos ADC dependencies changed so it is only built when Exynos is present or COMPILE_TEST and OF are set. * tsl2583 cleanups. * Some cut and paste typos in the comments of various drivers still in staging. * Couple of minor improvements to the ST sensor drivers.
Diffstat (limited to 'drivers/iio/inkern.c')
-rw-r--r--drivers/iio/inkern.c18
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:
}
EXPORT_SYMBOL_GPL(iio_read_channel_raw);
+int iio_read_channel_average_raw(struct iio_channel *chan, int *val)
+{
+ int ret;
+
+ mutex_lock(&chan->indio_dev->info_exist_lock);
+ if (chan->indio_dev->info == NULL) {
+ ret = -ENODEV;
+ goto err_unlock;
+ }
+
+ ret = iio_channel_read(chan, val, NULL, IIO_CHAN_INFO_AVERAGE_RAW);
+err_unlock:
+ mutex_unlock(&chan->indio_dev->info_exist_lock);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(iio_read_channel_average_raw);
+
static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan,
int raw, int *processed, unsigned int scale)
{
OpenPOWER on IntegriCloud