summaryrefslogtreecommitdiff
path: root/drivers/iio/imu
diff options
context:
space:
mode:
authorDaniel Baluta <daniel.baluta@intel.com>2014-12-23 16:22:33 +0300
committerJonathan Cameron <jic23@kernel.org>2015-01-05 21:59:55 +0300
commit6a191c7025f80c328156a358871f5d947f443aa9 (patch)
treeff908b36bfddb3366f09f0121e916c6d175722bb /drivers/iio/imu
parentea04d2965874ca5753e756b335449c5322a85733 (diff)
downloadlinux-6a191c7025f80c328156a358871f5d947f443aa9.tar.xz
iio: imu: kmx61: Use correct base when reading data
We have two IIO devices and we need to adjust the base when reading data. Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/imu')
-rw-r--r--drivers/iio/imu/kmx61.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
index 1f7c3f1f4dfd..b60b22d25615 100644
--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -1218,12 +1218,18 @@ static irqreturn_t kmx61_trigger_handler(int irq, void *p)
struct iio_dev *indio_dev = pf->indio_dev;
struct kmx61_data *data = kmx61_get_data(indio_dev);
int bit, ret, i = 0;
+ u8 base;
s16 buffer[8];
+ if (indio_dev == data->acc_indio_dev)
+ base = KMX61_ACC_XOUT_L;
+ else
+ base = KMX61_MAG_XOUT_L;
+
mutex_lock(&data->lock);
for_each_set_bit(bit, indio_dev->buffer->scan_mask,
indio_dev->masklength) {
- ret = kmx61_read_measurement(data, KMX61_ACC_XOUT_L, bit);
+ ret = kmx61_read_measurement(data, base, bit);
if (ret < 0) {
mutex_unlock(&data->lock);
goto err;