Skip to content

Commit bda61d3

Browse files
committed
iio: adc: at91-sama5d2_adc: exit from write_raw() when buffers are enabled
When buffers are enabled conversion may start asynchronously thus allowing changes on actual hardware could lead to bad behavior. Thus do not allow changing oversampling ratio and sample frequency when buffers are enabled. Fixes: 5e1a1da ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support") Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
1 parent 702bf92 commit bda61d3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/iio/adc/at91-sama5d2_adc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,9 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev,
16831683
struct at91_adc_state *st = iio_priv(indio_dev);
16841684
int ret = 0;
16851685

1686+
if (iio_buffer_enabled(indio_dev))
1687+
return -EBUSY;
1688+
16861689
switch (mask) {
16871690
case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
16881691
if ((val != AT91_OSR_1SAMPLES) && (val != AT91_OSR_4SAMPLES) &&

0 commit comments

Comments
 (0)