iio-fixes-for-5.7b Second set of fixes for IIO in the 5.7 cycle.
Usual mixed bag of breakage in new code and ancient bugs. ad2s1210 - Fix missing CS change needed to actually read anything. atlas-sensor - Avoid clashing scan index with the timestamp channel. sca3000 - Fix a randomly placed get_device in an error message print. st_lsm6dsx - Fix missing unlock in error path. stm32-adc - Fix which device is used to request DMA to ensure it's one that has actually been registered at point of use. stm32-dfsdm - Fix which device is used to request DMA to ensure it's one that has actually been registered at poitn of use. ti-ads8344 - Fix channel selection. vf610 dac - Fix some missing error handling code. -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl65mQQRHGppYzIzQGtl cm5lbC5vcmcACgkQVIU0mcT0FoieCw/+JfUmMwMJo3v0tFrih2LyLP40LRwJ90cd cxHhXbxcDWRXAzExutDgOXXz3cy+IfUPC3PNM5q1+RIeYyfX8hPAYEABFqVzCDRY yWPibvu5Nox/DjaCwmPpLWMkX01qjRjf/xFZsZnCgpEv6K8cj1e7HZortDYhXrxB /2I3CaohxyyS7zXQNVL/wrNDw1/pqkx8yYfzdAUxUfgm1VHEHMNELy20YpmTE1Rk 8vNA8QqlyoY07IFRbSA0WP7eLZDl9/NIHiX8/vpG/D2GCv/eLGzXdqCLu+3A/OGk 6T3kd7PQ1ecNA+CuanSe/yUsVhlPBvjx8rcFE2CseSku11C5BGlfpv545E6FXReR 3bTVckjlyex7jzR1nhSPL+giBLGRynA9CkEkfrK5muoFw+/KOwtwtfQHwSc34lfs Eu6qTkFamo9a+P4azaoE5BsM38WaXOGljt7FBkCJoLQdQdtyJrfGRm9KntumaCoC 2yBb42NclVEqlFGLvo4104/yny7R/X0FyYkKYJZ2z83p/cfI0wbYtwoExbv06yKN safdzRUULlNkoPTnqkyp8viFR4OZ9Fd/VTy5mFWmbeTO8joi5ZJdBrlZtsyPK5eS SPRX/V/Epmo3rFA9BwG/u32BKxieNDzpNfdxZDZc75si9I2wBFmeffrxNJPORIoL mwOu56gkQaU= =GTlX -----END PGP SIGNATURE----- Merge tag 'iio-fixes-for-5.7b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus Jonathan writes: iio-fixes-for-5.7b Second set of fixes for IIO in the 5.7 cycle. Usual mixed bag of breakage in new code and ancient bugs. ad2s1210 - Fix missing CS change needed to actually read anything. atlas-sensor - Avoid clashing scan index with the timestamp channel. sca3000 - Fix a randomly placed get_device in an error message print. st_lsm6dsx - Fix missing unlock in error path. stm32-adc - Fix which device is used to request DMA to ensure it's one that has actually been registered at point of use. stm32-dfsdm - Fix which device is used to request DMA to ensure it's one that has actually been registered at poitn of use. ti-ads8344 - Fix channel selection. vf610 dac - Fix some missing error handling code. * tag 'iio-fixes-for-5.7b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: sca3000: Remove an erroneous 'get_device()' iio: adc: stm32-dfsdm: fix device used to request dma iio: adc: stm32-adc: fix device used to request dma iio: adc: ti-ads8344: Fix channel selection staging: iio: ad2s1210: Fix SPI reading iio: dac: vf610: Fix an error handling path in 'vf610_dac_probe()' iio: imu: st_lsm6dsx: unlock on error in st_lsm6dsx_shub_write_raw() iio: chemical: atlas-sensor: correct DO-SM channels
This commit is contained in:
commit
bcb3928718
|
@ -980,7 +980,7 @@ static int sca3000_read_data(struct sca3000_state *st,
|
|||
st->tx[0] = SCA3000_READ_REG(reg_address_high);
|
||||
ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
|
||||
if (ret) {
|
||||
dev_err(get_device(&st->us->dev), "problem reading register");
|
||||
dev_err(&st->us->dev, "problem reading register\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1812,18 +1812,18 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int stm32_adc_dma_request(struct iio_dev *indio_dev)
|
||||
static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev)
|
||||
{
|
||||
struct stm32_adc *adc = iio_priv(indio_dev);
|
||||
struct dma_slave_config config;
|
||||
int ret;
|
||||
|
||||
adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
|
||||
adc->dma_chan = dma_request_chan(dev, "rx");
|
||||
if (IS_ERR(adc->dma_chan)) {
|
||||
ret = PTR_ERR(adc->dma_chan);
|
||||
if (ret != -ENODEV) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(&indio_dev->dev,
|
||||
dev_err(dev,
|
||||
"DMA channel request failed with %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
|
@ -1930,7 +1930,7 @@ static int stm32_adc_probe(struct platform_device *pdev)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = stm32_adc_dma_request(indio_dev);
|
||||
ret = stm32_adc_dma_request(dev, indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ enum sd_converter_type {
|
|||
|
||||
struct stm32_dfsdm_dev_data {
|
||||
int type;
|
||||
int (*init)(struct iio_dev *indio_dev);
|
||||
int (*init)(struct device *dev, struct iio_dev *indio_dev);
|
||||
unsigned int num_channels;
|
||||
const struct regmap_config *regmap_cfg;
|
||||
};
|
||||
|
@ -1365,11 +1365,12 @@ static void stm32_dfsdm_dma_release(struct iio_dev *indio_dev)
|
|||
}
|
||||
}
|
||||
|
||||
static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev)
|
||||
static int stm32_dfsdm_dma_request(struct device *dev,
|
||||
struct iio_dev *indio_dev)
|
||||
{
|
||||
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
|
||||
|
||||
adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
|
||||
adc->dma_chan = dma_request_chan(dev, "rx");
|
||||
if (IS_ERR(adc->dma_chan)) {
|
||||
int ret = PTR_ERR(adc->dma_chan);
|
||||
|
||||
|
@ -1425,7 +1426,7 @@ static int stm32_dfsdm_adc_chan_init_one(struct iio_dev *indio_dev,
|
|||
&adc->dfsdm->ch_list[ch->channel]);
|
||||
}
|
||||
|
||||
static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
|
||||
static int stm32_dfsdm_audio_init(struct device *dev, struct iio_dev *indio_dev)
|
||||
{
|
||||
struct iio_chan_spec *ch;
|
||||
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
|
||||
|
@ -1452,10 +1453,10 @@ static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
|
|||
indio_dev->num_channels = 1;
|
||||
indio_dev->channels = ch;
|
||||
|
||||
return stm32_dfsdm_dma_request(indio_dev);
|
||||
return stm32_dfsdm_dma_request(dev, indio_dev);
|
||||
}
|
||||
|
||||
static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
|
||||
static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev)
|
||||
{
|
||||
struct iio_chan_spec *ch;
|
||||
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
|
||||
|
@ -1499,17 +1500,17 @@ static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
|
|||
init_completion(&adc->completion);
|
||||
|
||||
/* Optionally request DMA */
|
||||
ret = stm32_dfsdm_dma_request(indio_dev);
|
||||
ret = stm32_dfsdm_dma_request(dev, indio_dev);
|
||||
if (ret) {
|
||||
if (ret != -ENODEV) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(&indio_dev->dev,
|
||||
dev_err(dev,
|
||||
"DMA channel request failed with %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_dbg(&indio_dev->dev, "No DMA support\n");
|
||||
dev_dbg(dev, "No DMA support\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1622,7 +1623,7 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
|
|||
adc->dfsdm->fl_list[adc->fl_id].sync_mode = val;
|
||||
|
||||
adc->dev_data = dev_data;
|
||||
ret = dev_data->init(iio);
|
||||
ret = dev_data->init(dev, iio);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -32,16 +32,17 @@ struct ads8344 {
|
|||
u8 rx_buf[3];
|
||||
};
|
||||
|
||||
#define ADS8344_VOLTAGE_CHANNEL(chan, si) \
|
||||
#define ADS8344_VOLTAGE_CHANNEL(chan, addr) \
|
||||
{ \
|
||||
.type = IIO_VOLTAGE, \
|
||||
.indexed = 1, \
|
||||
.channel = chan, \
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.address = addr, \
|
||||
}
|
||||
|
||||
#define ADS8344_VOLTAGE_CHANNEL_DIFF(chan1, chan2, si) \
|
||||
#define ADS8344_VOLTAGE_CHANNEL_DIFF(chan1, chan2, addr) \
|
||||
{ \
|
||||
.type = IIO_VOLTAGE, \
|
||||
.indexed = 1, \
|
||||
|
@ -50,6 +51,7 @@ struct ads8344 {
|
|||
.differential = 1, \
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.address = addr, \
|
||||
}
|
||||
|
||||
static const struct iio_chan_spec ads8344_channels[] = {
|
||||
|
@ -105,7 +107,7 @@ static int ads8344_read_raw(struct iio_dev *iio,
|
|||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
mutex_lock(&adc->lock);
|
||||
*value = ads8344_adc_conversion(adc, channel->scan_index,
|
||||
*value = ads8344_adc_conversion(adc, channel->address,
|
||||
channel->differential);
|
||||
mutex_unlock(&adc->lock);
|
||||
if (*value < 0)
|
||||
|
|
|
@ -194,7 +194,19 @@ static const struct iio_chan_spec atlas_orp_channels[] = {
|
|||
};
|
||||
|
||||
static const struct iio_chan_spec atlas_do_channels[] = {
|
||||
ATLAS_CONCENTRATION_CHANNEL(0, ATLAS_REG_DO_DATA),
|
||||
{
|
||||
.type = IIO_CONCENTRATION,
|
||||
.address = ATLAS_REG_DO_DATA,
|
||||
.info_mask_separate =
|
||||
BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
|
||||
.scan_index = 0,
|
||||
.scan_type = {
|
||||
.sign = 'u',
|
||||
.realbits = 32,
|
||||
.storagebits = 32,
|
||||
.endianness = IIO_BE,
|
||||
},
|
||||
},
|
||||
IIO_CHAN_SOFT_TIMESTAMP(1),
|
||||
{
|
||||
.type = IIO_TEMP,
|
||||
|
|
|
@ -223,6 +223,7 @@ static int vf610_dac_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
error_iio_device_register:
|
||||
vf610_dac_exit(info);
|
||||
clk_disable_unprepare(info->clk);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -544,8 +544,10 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
|
|||
|
||||
ref_sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]);
|
||||
odr = st_lsm6dsx_check_odr(ref_sensor, val, &odr_val);
|
||||
if (odr < 0)
|
||||
return odr;
|
||||
if (odr < 0) {
|
||||
err = odr;
|
||||
goto release;
|
||||
}
|
||||
|
||||
sensor->ext_info.slv_odr = val;
|
||||
sensor->odr = odr;
|
||||
|
@ -557,6 +559,7 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
|
|||
break;
|
||||
}
|
||||
|
||||
release:
|
||||
iio_device_release_direct_mode(iio_dev);
|
||||
|
||||
return err;
|
||||
|
|
|
@ -130,17 +130,24 @@ static int ad2s1210_config_write(struct ad2s1210_state *st, u8 data)
|
|||
static int ad2s1210_config_read(struct ad2s1210_state *st,
|
||||
unsigned char address)
|
||||
{
|
||||
struct spi_transfer xfer = {
|
||||
.len = 2,
|
||||
.rx_buf = st->rx,
|
||||
.tx_buf = st->tx,
|
||||
struct spi_transfer xfers[] = {
|
||||
{
|
||||
.len = 1,
|
||||
.rx_buf = &st->rx[0],
|
||||
.tx_buf = &st->tx[0],
|
||||
.cs_change = 1,
|
||||
}, {
|
||||
.len = 1,
|
||||
.rx_buf = &st->rx[1],
|
||||
.tx_buf = &st->tx[1],
|
||||
},
|
||||
};
|
||||
int ret = 0;
|
||||
|
||||
ad2s1210_set_mode(MOD_CONFIG, st);
|
||||
st->tx[0] = address | AD2S1210_MSB_IS_HIGH;
|
||||
st->tx[1] = AD2S1210_REG_FAULT;
|
||||
ret = spi_sync_transfer(st->sdev, &xfer, 1);
|
||||
ret = spi_sync_transfer(st->sdev, xfers, 2);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
Loading…
Reference in New Issue