summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/adc/max1027.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index ad0ca63212cb..66a040cbee35 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -410,11 +410,17 @@ static int max1027_set_cnvst_trigger_state(struct iio_trigger *trig, bool state)
struct max1027_state *st = iio_priv(indio_dev);
int ret;
- if (state) {
- ret = max1027_enable_trigger(indio_dev, state);
- if (ret)
- return ret;
+ /*
+ * In order to disable the convst trigger, start acquisition on
+ * conversion register write, which basically disables triggering
+ * conversions upon cnvst changes and thus has the effect of disabling
+ * the external hardware trigger.
+ */
+ ret = max1027_enable_trigger(indio_dev, state);
+ if (ret)
+ return ret;
+ if (state) {
/*
* Scan from chan 0 to the highest requested channel.
* Include temperature on demand.
@@ -427,11 +433,6 @@ static int max1027_set_cnvst_trigger_state(struct iio_trigger *trig, bool state)
ret = spi_write(st->spi, &st->reg, 1);
if (ret < 0)
return ret;
- } else {
- /* Start acquisition on conversion register write */
- ret = max1027_enable_trigger(indio_dev, state);
- if (ret)
- return ret;
}
return 0;