Commit 6a191c70 authored by Daniel Baluta's avatar Daniel Baluta Committed by Jonathan Cameron

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: default avatarDaniel Baluta <daniel.baluta@intel.com>
Reviewed-by: default avatarHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent ea04d296
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment