mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
staging:iio:ade7758: Use iio_validate_scan_mask_onehot
Only one of the channels of the ade7758 may be sampled at a time. Use the new validate_scan_mask callback and the iio_validate_scan_mask_onehot function to implement this restriction. Previously this was implemented using available_scan_masks, but this requires a individual scan mask for each channel. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
8c2c6ba6aa
commit
ee0312a05d
3 changed files with 2 additions and 7 deletions
|
@ -122,7 +122,6 @@ struct ade7758_state {
|
||||||
u8 *tx;
|
u8 *tx;
|
||||||
u8 *rx;
|
u8 *rx;
|
||||||
struct mutex buf_lock;
|
struct mutex buf_lock;
|
||||||
unsigned long available_scan_masks[AD7758_NUM_WAVESRC];
|
|
||||||
struct iio_chan_spec *ade7758_ring_channels;
|
struct iio_chan_spec *ade7758_ring_channels;
|
||||||
struct spi_transfer ring_xfer[4];
|
struct spi_transfer ring_xfer[4];
|
||||||
struct spi_message ring_msg;
|
struct spi_message ring_msg;
|
||||||
|
|
|
@ -883,7 +883,7 @@ static const struct iio_info ade7758_info = {
|
||||||
|
|
||||||
static int __devinit ade7758_probe(struct spi_device *spi)
|
static int __devinit ade7758_probe(struct spi_device *spi)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int ret;
|
||||||
struct ade7758_state *st;
|
struct ade7758_state *st;
|
||||||
struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
|
struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
|
||||||
|
|
||||||
|
@ -916,11 +916,6 @@ static int __devinit ade7758_probe(struct spi_device *spi)
|
||||||
indio_dev->info = &ade7758_info;
|
indio_dev->info = &ade7758_info;
|
||||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||||
|
|
||||||
for (i = 0; i < AD7758_NUM_WAVESRC; i++)
|
|
||||||
set_bit(i, &st->available_scan_masks[i]);
|
|
||||||
|
|
||||||
indio_dev->available_scan_masks = st->available_scan_masks;
|
|
||||||
|
|
||||||
ret = ade7758_configure_ring(indio_dev);
|
ret = ade7758_configure_ring(indio_dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_free_tx;
|
goto error_free_tx;
|
||||||
|
|
|
@ -114,6 +114,7 @@ static const struct iio_buffer_setup_ops ade7758_ring_setup_ops = {
|
||||||
.preenable = &ade7758_ring_preenable,
|
.preenable = &ade7758_ring_preenable,
|
||||||
.postenable = &iio_triggered_buffer_postenable,
|
.postenable = &iio_triggered_buffer_postenable,
|
||||||
.predisable = &iio_triggered_buffer_predisable,
|
.predisable = &iio_triggered_buffer_predisable,
|
||||||
|
.validate_scan_mask = &iio_validate_scan_mask_onehot,
|
||||||
};
|
};
|
||||||
|
|
||||||
void ade7758_unconfigure_ring(struct iio_dev *indio_dev)
|
void ade7758_unconfigure_ring(struct iio_dev *indio_dev)
|
||||||
|
|
Loading…
Reference in a new issue