@@ -145,6 +145,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
int i;
unsigned int fifo1count, read;
u32 step = UINT_MAX;
+ bool found = false;
/*
* When the sub-system is first enabled,
@@ -169,11 +170,14 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
for (i = 0; i < fifo1count; i++) {
read = tiadc_readl(adc_dev, REG_FIFO1);
- if (read >> 16 == step)
+ if (read >> 16 == step) {
*val = read & 0xfff;
+ found = true;
+ }
}
am335x_tsc_se_update(adc_dev->mfd_tscadc);
-
+ if (found == false)
+ return -EBUSY;
return IIO_VAL_INT;
}