First set of IIO and counter fixes for the 5.11 cycle.

Counter fixes
 
 ti,eqep
 - Remove floor interface as the device always wraps to 0.
 
 IIO
 
 adi,ad5504
 - Fix inverted power state control.
 bosch,bma255
 - Fix a difference in part naming between dt-binding doc and the driver.
 melexis,mlx90632
 - Add a delay after reset command.
 semtech,sx9310
 - Off by one error.
 - Fix an issue due to need to skip a value in a power of 2 series.
 st,st_sensors
 - Fix a possible infinite loop if data read is not define or reading it fails.
 ti,am335x
 - Remove a left over iio_kfifo_free after managed allocation conversion.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmAAwYcRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Fogmzw/+ISxGbk8nRSN6B/h5ldc8Cpz897H2TW0L
 7xIygn9Kw5HlITP2VdyBgkU8Otz1/W0UJnUTp2SJqLZ126wYURn08ZeEHSwdsGCx
 Im9di/QF3aBeb5c0D/dd31EVjWwfpvM2zjbHnzQxxn/5tncUCaNBpkBxguSCwh80
 +e1MB7h+tCKnYnJ3htiServgjnMHwumN3bTyv5IRJiuYkdAgB3Cg8l00dIHZLP1a
 hF5bV+1BiHBGiZYiFPVPFl0HuoLviudAqzFzGjHv7V4POGpBlpq5vjN0WjhhrXAs
 Q60Nh3lgZtP/rHifCL9p8ty1yWvohQ91rcy5bauNuSqOj2IE7yLDsovU4blKhNNx
 iallCMJB3OIPeGRqQsd8wym5lcVI5puY+8y9y1qXX6SHzR2JVa2ZCIvzC1tICNra
 9qDnFrdZYPdodZkAFu6lAEZ3tFOzx/wMMVgOPvIXiZniVYtCIOtow5jzBgF6LKS6
 PpOH/EmNJFhS1uqIiX2m5oYyolh8la4Y4Ly062T9EIAXt/noShu2pySgDI7Eu8ro
 PtovWE0sVJ1p6MSOHlVfRNdvmQe2pAFxHJPj7TIveHNzQbKYGdjwa8NGVSjOlLDg
 3XZe98HzTWtoORYF6s3fQN+MEEDFDteG4ysB78RU1pO3NeXqUCow2UyOVmALId15
 M5rueMyrodQ=
 =61oM
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-5.11a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

First set of IIO and counter fixes for the 5.11 cycle.

Counter fixes

ti,eqep
- Remove floor interface as the device always wraps to 0.

IIO

adi,ad5504
- Fix inverted power state control.
bosch,bma255
- Fix a difference in part naming between dt-binding doc and the driver.
melexis,mlx90632
- Add a delay after reset command.
semtech,sx9310
- Off by one error.
- Fix an issue due to need to skip a value in a power of 2 series.
st,st_sensors
- Fix a possible infinite loop if data read is not define or reading it fails.
ti,am335x
- Remove a left over iio_kfifo_free after managed allocation conversion.

* tag 'iio-fixes-for-5.11a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  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()
This commit is contained in:
Greg Kroah-Hartman 2021-01-15 08:16:35 +01:00
commit a1bfb0ccf9
7 changed files with 31 additions and 60 deletions

View File

@ -16,8 +16,8 @@ description:
properties:
compatible:
enum:
- bosch,bmc150
- bosch,bmi055
- bosch,bmc150_accel
- bosch,bmi055_accel
- bosch,bma255
- bosch,bma250e
- bosch,bma222

View File

@ -235,36 +235,6 @@ static ssize_t ti_eqep_position_ceiling_write(struct counter_device *counter,
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,
struct counter_count *count,
void *ext_priv, char *buf)
@ -301,11 +271,6 @@ static struct counter_count_ext ti_eqep_position_ext[] = {
.read = ti_eqep_position_ceiling_read,
.write = ti_eqep_position_ceiling_write,
},
{
.name = "floor",
.read = ti_eqep_position_floor_read,
.write = ti_eqep_position_floor_write,
},
{
.name = "enable",
.read = ti_eqep_position_enable_read,

View File

@ -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,
flags, indio_dev->name, indio_dev);
if (ret)
goto error_kfifo_free;
return ret;
indio_dev->setup_ops = setup_ops;
indio_dev->modes |= INDIO_BUFFER_SOFTWARE;
return 0;
error_kfifo_free:
iio_kfifo_free(indio_dev->buffer);
return ret;
}
static const char * const chan_name_ain[] = {

View File

@ -23,35 +23,31 @@
* @sdata: Sensor data.
*
* returns:
* 0 - no new samples available
* 1 - new samples available
* negative - error or unknown
* false - no new samples available or read error
* true - new samples available
*/
static int st_sensors_new_samples_available(struct iio_dev *indio_dev,
struct st_sensor_data *sdata)
static bool st_sensors_new_samples_available(struct iio_dev *indio_dev,
struct st_sensor_data *sdata)
{
int ret, status;
/* How would I know if I can't check it? */
if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr)
return -EINVAL;
return true;
/* No scan mask, no interrupt */
if (!indio_dev->active_scan_mask)
return 0;
return false;
ret = regmap_read(sdata->regmap,
sdata->sensor_settings->drdy_irq.stat_drdy.addr,
&status);
if (ret < 0) {
dev_err(sdata->dev, "error checking samples available\n");
return ret;
return false;
}
if (status & sdata->sensor_settings->drdy_irq.stat_drdy.mask)
return 1;
return 0;
return !!(status & sdata->sensor_settings->drdy_irq.stat_drdy.mask);
}
/**
@ -180,9 +176,15 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
/* Tell the interrupt handler that we're dealing with edges */
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;
else
} else {
/*
* If we're not using edges (i.e. level interrupts) we
* just mask off the IRQ, handle one interrupt, then
@ -190,6 +192,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
* interrupt handler top half again and start over.
*/
irq_trig |= IRQF_ONESHOT;
}
/*
* If the interrupt pin is Open Drain, by definition this

View File

@ -187,9 +187,9 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,
return ret;
if (pwr_down)
st->pwr_down_mask |= (1 << chan->channel);
else
st->pwr_down_mask &= ~(1 << chan->channel);
else
st->pwr_down_mask |= (1 << chan->channel);
ret = ad5504_spi_write(st, AD5504_ADDR_CTRL,
AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) |

View File

@ -601,7 +601,7 @@ static int sx9310_read_thresh(struct sx9310_data *data,
return ret;
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;
*val = sx9310_pthresh_codes[regval];
@ -1305,7 +1305,8 @@ sx9310_get_default_reg(struct sx9310_data *data, int i,
if (ret)
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 |= FIELD_PREP(SX9310_REG_PROX_CTRL7_AVGPOSFILT_MASK,
pos);

View File

@ -248,6 +248,12 @@ static int mlx90632_set_meas_type(struct regmap *regmap, u8 type)
if (ret < 0)
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,
(MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK),
(MLX90632_MTYP_STATUS(type) | MLX90632_PWR_STATUS_HALT));