Skip to content

Commit 832bcee

Browse files
committed
Merge tag 'staging-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO driver fixes from Greg KH: "Here are some IIO driver fixes for 5.11-rc5 to resolve some reported problems. Nothing major, just a few small fixes, all of these have been in linux-next for a while and full details are in the shortlog" * tag 'staging-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: iio: sx9310: Fix semtech,avg-pos-strength setting when > 16 iio: common: st_sensors: fix possible infinite loop in st_sensors_irq_thread iio: ad5504: Fix setting power-down state counter:ti-eqep: remove floor drivers: iio: temperature: Add delay after the addressed reset command in mlx90632.c iio: adc: ti_am335x_adc: remove omitted iio_kfifo_free() dt-bindings: iio: accel: bma255: Fix bmc150/bmi055 compatible iio: sx9310: Off by one in sx9310_read_thresh()
2 parents 4da81fa + a1bfb0c commit 832bcee

File tree

7 files changed

+31
-60
lines changed

7 files changed

+31
-60
lines changed

Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ description:
1616
properties:
1717
compatible:
1818
enum:
19-
- bosch,bmc150
20-
- bosch,bmi055
19+
- bosch,bmc150_accel
20+
- bosch,bmi055_accel
2121
- bosch,bma255
2222
- bosch,bma250e
2323
- bosch,bma222

drivers/counter/ti-eqep.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -235,36 +235,6 @@ static ssize_t ti_eqep_position_ceiling_write(struct counter_device *counter,
235235
return len;
236236
}
237237

238-
static ssize_t ti_eqep_position_floor_read(struct counter_device *counter,
239-
struct counter_count *count,
240-
void *ext_priv, char *buf)
241-
{
242-
struct ti_eqep_cnt *priv = counter->priv;
243-
u32 qposinit;
244-
245-
regmap_read(priv->regmap32, QPOSINIT, &qposinit);
246-
247-
return sprintf(buf, "%u\n", qposinit);
248-
}
249-
250-
static ssize_t ti_eqep_position_floor_write(struct counter_device *counter,
251-
struct counter_count *count,
252-
void *ext_priv, const char *buf,
253-
size_t len)
254-
{
255-
struct ti_eqep_cnt *priv = counter->priv;
256-
int err;
257-
u32 res;
258-
259-
err = kstrtouint(buf, 0, &res);
260-
if (err < 0)
261-
return err;
262-
263-
regmap_write(priv->regmap32, QPOSINIT, res);
264-
265-
return len;
266-
}
267-
268238
static ssize_t ti_eqep_position_enable_read(struct counter_device *counter,
269239
struct counter_count *count,
270240
void *ext_priv, char *buf)
@@ -301,11 +271,6 @@ static struct counter_count_ext ti_eqep_position_ext[] = {
301271
.read = ti_eqep_position_ceiling_read,
302272
.write = ti_eqep_position_ceiling_write,
303273
},
304-
{
305-
.name = "floor",
306-
.read = ti_eqep_position_floor_read,
307-
.write = ti_eqep_position_floor_write,
308-
},
309274
{
310275
.name = "enable",
311276
.read = ti_eqep_position_enable_read,

drivers/iio/adc/ti_am335x_adc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,12 @@ static int tiadc_iio_buffered_hardware_setup(struct device *dev,
397397
ret = devm_request_threaded_irq(dev, irq, pollfunc_th, pollfunc_bh,
398398
flags, indio_dev->name, indio_dev);
399399
if (ret)
400-
goto error_kfifo_free;
400+
return ret;
401401

402402
indio_dev->setup_ops = setup_ops;
403403
indio_dev->modes |= INDIO_BUFFER_SOFTWARE;
404404

405405
return 0;
406-
407-
error_kfifo_free:
408-
iio_kfifo_free(indio_dev->buffer);
409-
return ret;
410406
}
411407

412408
static const char * const chan_name_ain[] = {

drivers/iio/common/st_sensors/st_sensors_trigger.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,31 @@
2323
* @sdata: Sensor data.
2424
*
2525
* returns:
26-
* 0 - no new samples available
27-
* 1 - new samples available
28-
* negative - error or unknown
26+
* false - no new samples available or read error
27+
* true - new samples available
2928
*/
30-
static int st_sensors_new_samples_available(struct iio_dev *indio_dev,
31-
struct st_sensor_data *sdata)
29+
static bool st_sensors_new_samples_available(struct iio_dev *indio_dev,
30+
struct st_sensor_data *sdata)
3231
{
3332
int ret, status;
3433

3534
/* How would I know if I can't check it? */
3635
if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr)
37-
return -EINVAL;
36+
return true;
3837

3938
/* No scan mask, no interrupt */
4039
if (!indio_dev->active_scan_mask)
41-
return 0;
40+
return false;
4241

4342
ret = regmap_read(sdata->regmap,
4443
sdata->sensor_settings->drdy_irq.stat_drdy.addr,
4544
&status);
4645
if (ret < 0) {
4746
dev_err(sdata->dev, "error checking samples available\n");
48-
return ret;
47+
return false;
4948
}
5049

51-
if (status & sdata->sensor_settings->drdy_irq.stat_drdy.mask)
52-
return 1;
53-
54-
return 0;
50+
return !!(status & sdata->sensor_settings->drdy_irq.stat_drdy.mask);
5551
}
5652

5753
/**
@@ -180,16 +176,23 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
180176

181177
/* Tell the interrupt handler that we're dealing with edges */
182178
if (irq_trig == IRQF_TRIGGER_FALLING ||
183-
irq_trig == IRQF_TRIGGER_RISING)
179+
irq_trig == IRQF_TRIGGER_RISING) {
180+
if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr) {
181+
dev_err(&indio_dev->dev,
182+
"edge IRQ not supported w/o stat register.\n");
183+
err = -EOPNOTSUPP;
184+
goto iio_trigger_free;
185+
}
184186
sdata->edge_irq = true;
185-
else
187+
} else {
186188
/*
187189
* If we're not using edges (i.e. level interrupts) we
188190
* just mask off the IRQ, handle one interrupt, then
189191
* if the line is still low, we return to the
190192
* interrupt handler top half again and start over.
191193
*/
192194
irq_trig |= IRQF_ONESHOT;
195+
}
193196

194197
/*
195198
* If the interrupt pin is Open Drain, by definition this

drivers/iio/dac/ad5504.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,
187187
return ret;
188188

189189
if (pwr_down)
190-
st->pwr_down_mask |= (1 << chan->channel);
191-
else
192190
st->pwr_down_mask &= ~(1 << chan->channel);
191+
else
192+
st->pwr_down_mask |= (1 << chan->channel);
193193

194194
ret = ad5504_spi_write(st, AD5504_ADDR_CTRL,
195195
AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) |

drivers/iio/proximity/sx9310.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static int sx9310_read_thresh(struct sx9310_data *data,
601601
return ret;
602602

603603
regval = FIELD_GET(SX9310_REG_PROX_CTRL8_9_PTHRESH_MASK, regval);
604-
if (regval > ARRAY_SIZE(sx9310_pthresh_codes))
604+
if (regval >= ARRAY_SIZE(sx9310_pthresh_codes))
605605
return -EINVAL;
606606

607607
*val = sx9310_pthresh_codes[regval];
@@ -1305,7 +1305,8 @@ sx9310_get_default_reg(struct sx9310_data *data, int i,
13051305
if (ret)
13061306
break;
13071307

1308-
pos = min(max(ilog2(pos), 3), 10) - 3;
1308+
/* Powers of 2, except for a gap between 16 and 64 */
1309+
pos = clamp(ilog2(pos), 3, 11) - (pos >= 32 ? 4 : 3);
13091310
reg_def->def &= ~SX9310_REG_PROX_CTRL7_AVGPOSFILT_MASK;
13101311
reg_def->def |= FIELD_PREP(SX9310_REG_PROX_CTRL7_AVGPOSFILT_MASK,
13111312
pos);

drivers/iio/temperature/mlx90632.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ static int mlx90632_set_meas_type(struct regmap *regmap, u8 type)
248248
if (ret < 0)
249249
return ret;
250250

251+
/*
252+
* Give the mlx90632 some time to reset properly before sending a new I2C command
253+
* if this is not done, the following I2C command(s) will not be accepted.
254+
*/
255+
usleep_range(150, 200);
256+
251257
ret = regmap_write_bits(regmap, MLX90632_REG_CONTROL,
252258
(MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK),
253259
(MLX90632_MTYP_STATUS(type) | MLX90632_PWR_STATUS_HALT));

0 commit comments

Comments
 (0)