Commit 832bceef authored by Linus Torvalds's avatar Linus Torvalds

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()
parents 4da81fa2 a1bfb0cc
...@@ -16,8 +16,8 @@ description: ...@@ -16,8 +16,8 @@ description:
properties: properties:
compatible: compatible:
enum: enum:
- bosch,bmc150 - bosch,bmc150_accel
- bosch,bmi055 - bosch,bmi055_accel
- bosch,bma255 - bosch,bma255
- bosch,bma250e - bosch,bma250e
- bosch,bma222 - bosch,bma222
......
...@@ -235,36 +235,6 @@ static ssize_t ti_eqep_position_ceiling_write(struct counter_device *counter, ...@@ -235,36 +235,6 @@ static ssize_t ti_eqep_position_ceiling_write(struct counter_device *counter,
return len; return len;
} }
static ssize_t ti_eqep_position_floor_read(struct counter_device *counter,
struct counter_count *count,
void *ext_priv, char *buf)
{
struct ti_eqep_cnt *priv = counter->priv;
u32 qposinit;
regmap_read(priv->regmap32, QPOSINIT, &qposinit);
return sprintf(buf, "%u\n", qposinit);
}
static ssize_t ti_eqep_position_floor_write(struct counter_device *counter,
struct counter_count *count,
void *ext_priv, const char *buf,
size_t len)
{
struct ti_eqep_cnt *priv = counter->priv;
int err;
u32 res;
err = kstrtouint(buf, 0, &res);
if (err < 0)
return err;
regmap_write(priv->regmap32, QPOSINIT, res);
return len;
}
static ssize_t ti_eqep_position_enable_read(struct counter_device *counter, static ssize_t ti_eqep_position_enable_read(struct counter_device *counter,
struct counter_count *count, struct counter_count *count,
void *ext_priv, char *buf) void *ext_priv, char *buf)
...@@ -301,11 +271,6 @@ static struct counter_count_ext ti_eqep_position_ext[] = { ...@@ -301,11 +271,6 @@ static struct counter_count_ext ti_eqep_position_ext[] = {
.read = ti_eqep_position_ceiling_read, .read = ti_eqep_position_ceiling_read,
.write = ti_eqep_position_ceiling_write, .write = ti_eqep_position_ceiling_write,
}, },
{
.name = "floor",
.read = ti_eqep_position_floor_read,
.write = ti_eqep_position_floor_write,
},
{ {
.name = "enable", .name = "enable",
.read = ti_eqep_position_enable_read, .read = ti_eqep_position_enable_read,
......
...@@ -397,16 +397,12 @@ static int tiadc_iio_buffered_hardware_setup(struct device *dev, ...@@ -397,16 +397,12 @@ static int tiadc_iio_buffered_hardware_setup(struct device *dev,
ret = devm_request_threaded_irq(dev, irq, pollfunc_th, pollfunc_bh, ret = devm_request_threaded_irq(dev, irq, pollfunc_th, pollfunc_bh,
flags, indio_dev->name, indio_dev); flags, indio_dev->name, indio_dev);
if (ret) if (ret)
goto error_kfifo_free; return ret;
indio_dev->setup_ops = setup_ops; indio_dev->setup_ops = setup_ops;
indio_dev->modes |= INDIO_BUFFER_SOFTWARE; indio_dev->modes |= INDIO_BUFFER_SOFTWARE;
return 0; return 0;
error_kfifo_free:
iio_kfifo_free(indio_dev->buffer);
return ret;
} }
static const char * const chan_name_ain[] = { static const char * const chan_name_ain[] = {
......
...@@ -23,35 +23,31 @@ ...@@ -23,35 +23,31 @@
* @sdata: Sensor data. * @sdata: Sensor data.
* *
* returns: * returns:
* 0 - no new samples available * false - no new samples available or read error
* 1 - new samples available * true - new samples available
* negative - error or unknown
*/ */
static int st_sensors_new_samples_available(struct iio_dev *indio_dev, static bool st_sensors_new_samples_available(struct iio_dev *indio_dev,
struct st_sensor_data *sdata) struct st_sensor_data *sdata)
{ {
int ret, status; int ret, status;
/* How would I know if I can't check it? */ /* How would I know if I can't check it? */
if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr) if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr)
return -EINVAL; return true;
/* No scan mask, no interrupt */ /* No scan mask, no interrupt */
if (!indio_dev->active_scan_mask) if (!indio_dev->active_scan_mask)
return 0; return false;
ret = regmap_read(sdata->regmap, ret = regmap_read(sdata->regmap,
sdata->sensor_settings->drdy_irq.stat_drdy.addr, sdata->sensor_settings->drdy_irq.stat_drdy.addr,
&status); &status);
if (ret < 0) { if (ret < 0) {
dev_err(sdata->dev, "error checking samples available\n"); dev_err(sdata->dev, "error checking samples available\n");
return ret; return false;
} }
if (status & sdata->sensor_settings->drdy_irq.stat_drdy.mask) return !!(status & sdata->sensor_settings->drdy_irq.stat_drdy.mask);
return 1;
return 0;
} }
/** /**
...@@ -180,9 +176,15 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, ...@@ -180,9 +176,15 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
/* Tell the interrupt handler that we're dealing with edges */ /* Tell the interrupt handler that we're dealing with edges */
if (irq_trig == IRQF_TRIGGER_FALLING || if (irq_trig == IRQF_TRIGGER_FALLING ||
irq_trig == IRQF_TRIGGER_RISING) irq_trig == IRQF_TRIGGER_RISING) {
if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr) {
dev_err(&indio_dev->dev,
"edge IRQ not supported w/o stat register.\n");
err = -EOPNOTSUPP;
goto iio_trigger_free;
}
sdata->edge_irq = true; sdata->edge_irq = true;
else } else {
/* /*
* If we're not using edges (i.e. level interrupts) we * If we're not using edges (i.e. level interrupts) we
* just mask off the IRQ, handle one interrupt, then * just mask off the IRQ, handle one interrupt, then
...@@ -190,6 +192,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, ...@@ -190,6 +192,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
* interrupt handler top half again and start over. * interrupt handler top half again and start over.
*/ */
irq_trig |= IRQF_ONESHOT; irq_trig |= IRQF_ONESHOT;
}
/* /*
* If the interrupt pin is Open Drain, by definition this * If the interrupt pin is Open Drain, by definition this
......
...@@ -187,9 +187,9 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev, ...@@ -187,9 +187,9 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,
return ret; return ret;
if (pwr_down) if (pwr_down)
st->pwr_down_mask |= (1 << chan->channel);
else
st->pwr_down_mask &= ~(1 << chan->channel); st->pwr_down_mask &= ~(1 << chan->channel);
else
st->pwr_down_mask |= (1 << chan->channel);
ret = ad5504_spi_write(st, AD5504_ADDR_CTRL, ret = ad5504_spi_write(st, AD5504_ADDR_CTRL,
AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) | AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) |
......
...@@ -601,7 +601,7 @@ static int sx9310_read_thresh(struct sx9310_data *data, ...@@ -601,7 +601,7 @@ static int sx9310_read_thresh(struct sx9310_data *data,
return ret; return ret;
regval = FIELD_GET(SX9310_REG_PROX_CTRL8_9_PTHRESH_MASK, regval); regval = FIELD_GET(SX9310_REG_PROX_CTRL8_9_PTHRESH_MASK, regval);
if (regval > ARRAY_SIZE(sx9310_pthresh_codes)) if (regval >= ARRAY_SIZE(sx9310_pthresh_codes))
return -EINVAL; return -EINVAL;
*val = sx9310_pthresh_codes[regval]; *val = sx9310_pthresh_codes[regval];
...@@ -1305,7 +1305,8 @@ sx9310_get_default_reg(struct sx9310_data *data, int i, ...@@ -1305,7 +1305,8 @@ sx9310_get_default_reg(struct sx9310_data *data, int i,
if (ret) if (ret)
break; break;
pos = min(max(ilog2(pos), 3), 10) - 3; /* Powers of 2, except for a gap between 16 and 64 */
pos = clamp(ilog2(pos), 3, 11) - (pos >= 32 ? 4 : 3);
reg_def->def &= ~SX9310_REG_PROX_CTRL7_AVGPOSFILT_MASK; reg_def->def &= ~SX9310_REG_PROX_CTRL7_AVGPOSFILT_MASK;
reg_def->def |= FIELD_PREP(SX9310_REG_PROX_CTRL7_AVGPOSFILT_MASK, reg_def->def |= FIELD_PREP(SX9310_REG_PROX_CTRL7_AVGPOSFILT_MASK,
pos); pos);
......
...@@ -248,6 +248,12 @@ static int mlx90632_set_meas_type(struct regmap *regmap, u8 type) ...@@ -248,6 +248,12 @@ static int mlx90632_set_meas_type(struct regmap *regmap, u8 type)
if (ret < 0) if (ret < 0)
return ret; return ret;
/*
* Give the mlx90632 some time to reset properly before sending a new I2C command
* if this is not done, the following I2C command(s) will not be accepted.
*/
usleep_range(150, 200);
ret = regmap_write_bits(regmap, MLX90632_REG_CONTROL, ret = regmap_write_bits(regmap, MLX90632_REG_CONTROL,
(MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK), (MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK),
(MLX90632_MTYP_STATUS(type) | MLX90632_PWR_STATUS_HALT)); (MLX90632_MTYP_STATUS(type) | MLX90632_PWR_STATUS_HALT));
......
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