Skip to content

Commit 5a269ca

Browse files
committed
Merge tag 'iio-fixes-for-4.6b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes: Second set of IIO fixes for the 4.6 cycle. This lot are either dependent on patches from the merge window or just came in recently enough that they ended up in this tree. * core - The watermark for the buffers was given a value that meant that it was impossible to actually set the watermark to anything sensible. * at91_adc - Fix a build config dependency on HAS_IOMEM * bmc150 - Fix wrong output on big endian systems * bmg160 - Fix wrong output on big endian systems - Fix an issue in which the regmap return value was stored to the buffer rather than the value actually being read in a bulk read. * inv_mpu6050 - Fix an indirect build config dependency on HAS_IOMEM * max30100 - Fix an error in fifo check condition that leads to a double read of the final reading. * st_magn - Make sure ST_MAGN_TRIGGER_SET_STATE is always defined to avoid a build error for relatively obscure config combinations.
2 parents a34d5df + b475c59 commit 5a269ca

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

drivers/iio/accel/bmc150-accel-core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static int bmc150_accel_get_axis(struct bmc150_accel_data *data,
547547
{
548548
int ret;
549549
int axis = chan->scan_index;
550-
unsigned int raw_val;
550+
__le16 raw_val;
551551

552552
mutex_lock(&data->mutex);
553553
ret = bmc150_accel_set_power_state(data, true);
@@ -557,14 +557,14 @@ static int bmc150_accel_get_axis(struct bmc150_accel_data *data,
557557
}
558558

559559
ret = regmap_bulk_read(data->regmap, BMC150_ACCEL_AXIS_TO_REG(axis),
560-
&raw_val, 2);
560+
&raw_val, sizeof(raw_val));
561561
if (ret < 0) {
562562
dev_err(data->dev, "Error reading axis %d\n", axis);
563563
bmc150_accel_set_power_state(data, false);
564564
mutex_unlock(&data->mutex);
565565
return ret;
566566
}
567-
*val = sign_extend32(raw_val >> chan->scan_type.shift,
567+
*val = sign_extend32(le16_to_cpu(raw_val) >> chan->scan_type.shift,
568568
chan->scan_type.realbits - 1);
569569
ret = bmc150_accel_set_power_state(data, false);
570570
mutex_unlock(&data->mutex);
@@ -988,6 +988,7 @@ static const struct iio_event_spec bmc150_accel_event = {
988988
.realbits = (bits), \
989989
.storagebits = 16, \
990990
.shift = 16 - (bits), \
991+
.endianness = IIO_LE, \
991992
}, \
992993
.event_spec = &bmc150_accel_event, \
993994
.num_event_specs = 1 \

drivers/iio/adc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ config AT91_ADC
134134
config AT91_SAMA5D2_ADC
135135
tristate "Atmel AT91 SAMA5D2 ADC"
136136
depends on ARCH_AT91 || COMPILE_TEST
137+
depends on HAS_IOMEM
137138
help
138139
Say yes here to build support for Atmel SAMA5D2 ADC which is
139140
available on SAMA5D2 SoC family.

drivers/iio/gyro/bmg160_core.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ static int bmg160_get_temp(struct bmg160_data *data, int *val)
452452
static int bmg160_get_axis(struct bmg160_data *data, int axis, int *val)
453453
{
454454
int ret;
455-
unsigned int raw_val;
455+
__le16 raw_val;
456456

457457
mutex_lock(&data->mutex);
458458
ret = bmg160_set_power_state(data, true);
@@ -462,15 +462,15 @@ static int bmg160_get_axis(struct bmg160_data *data, int axis, int *val)
462462
}
463463

464464
ret = regmap_bulk_read(data->regmap, BMG160_AXIS_TO_REG(axis), &raw_val,
465-
2);
465+
sizeof(raw_val));
466466
if (ret < 0) {
467467
dev_err(data->dev, "Error reading axis %d\n", axis);
468468
bmg160_set_power_state(data, false);
469469
mutex_unlock(&data->mutex);
470470
return ret;
471471
}
472472

473-
*val = sign_extend32(raw_val, 15);
473+
*val = sign_extend32(le16_to_cpu(raw_val), 15);
474474
ret = bmg160_set_power_state(data, false);
475475
mutex_unlock(&data->mutex);
476476
if (ret < 0)
@@ -733,6 +733,7 @@ static const struct iio_event_spec bmg160_event = {
733733
.sign = 's', \
734734
.realbits = 16, \
735735
.storagebits = 16, \
736+
.endianness = IIO_LE, \
736737
}, \
737738
.event_spec = &bmg160_event, \
738739
.num_event_specs = 1 \
@@ -780,7 +781,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)
780781
mutex_unlock(&data->mutex);
781782
goto err;
782783
}
783-
data->buffer[i++] = ret;
784+
data->buffer[i++] = val;
784785
}
785786
mutex_unlock(&data->mutex);
786787

drivers/iio/health/max30100.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,13 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private)
238238

239239
mutex_lock(&data->lock);
240240

241-
while (cnt-- || (cnt = max30100_fifo_count(data) > 0)) {
241+
while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
242242
ret = max30100_read_measurement(data);
243243
if (ret)
244244
break;
245245

246246
iio_push_to_buffers(data->indio_dev, data->buffer);
247+
cnt--;
247248
}
248249

249250
mutex_unlock(&data->lock);

drivers/iio/imu/inv_mpu6050/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ config INV_MPU6050_IIO
99

1010
config INV_MPU6050_I2C
1111
tristate "Invensense MPU6050 devices (I2C)"
12-
depends on I2C
12+
depends on I2C_MUX
1313
select INV_MPU6050_IIO
14-
select I2C_MUX
1514
select REGMAP_I2C
1615
help
1716
This driver supports the Invensense MPU6050 devices.

drivers/iio/industrialio-buffer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ static int iio_verify_update(struct iio_dev *indio_dev,
653653
unsigned int modes;
654654

655655
memset(config, 0, sizeof(*config));
656+
config->watermark = ~0;
656657

657658
/*
658659
* If there is just one buffer and we are removing it there is nothing

drivers/iio/magnetometer/st_magn.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ static inline int st_magn_allocate_ring(struct iio_dev *indio_dev)
4444
static inline void st_magn_deallocate_ring(struct iio_dev *indio_dev)
4545
{
4646
}
47+
#define ST_MAGN_TRIGGER_SET_STATE NULL
4748
#endif /* CONFIG_IIO_BUFFER */
4849

4950
#endif /* ST_MAGN_H */

0 commit comments

Comments
 (0)