iio: adc: max1027: Ensure a default cnvst trigger configuration

We don't expect the (hardware) cnvst trigger to be enabled at boot time,
this is a user choice made in sysfs and there is a dedicated callback to
enable/disable this trigger. Hence, we can just ensure it is disabled in
the probe at initialization time and then assume that whenever a
->read_raw() call happens, the trigger has been disabled and conversions
will start on register write.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20210921115408.66711-9-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Miquel Raynal 2021-09-21 13:54:00 +02:00 committed by Jonathan Cameron
parent c5a3962982
commit cba18232c4
1 changed files with 5 additions and 4 deletions

View File

@ -303,10 +303,6 @@ static int max1027_read_single_value(struct iio_dev *indio_dev,
return -EBUSY;
}
ret = max1027_enable_trigger(indio_dev, false);
if (ret)
return ret;
/* Configure conversion register with the requested chan */
st->reg = MAX1027_CONV_REG | MAX1027_CHAN(chan->channel) |
MAX1027_NOSCAN;
@ -558,6 +554,11 @@ static int max1027_probe(struct spi_device *spi)
return ret;
}
/* Assume conversion on register write for now */
ret = max1027_enable_trigger(indio_dev, false);
if (ret)
return ret;
return devm_iio_device_register(&spi->dev, indio_dev);
}