diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2019-10-11 16:43:42 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-31 16:44:07 +0100 |
commit | e57ff9fb690010a96bd88f2def9db1a16e55a38a (patch) | |
tree | 95f81a27e476c3d64132740121d5fdea2c0de857 /drivers/iio/adc/max1027.c | |
parent | a6d47415fcd9472e2f02da9d2194a88845751031 (diff) | |
download | linux-stable-e57ff9fb690010a96bd88f2def9db1a16e55a38a.tar.gz linux-stable-e57ff9fb690010a96bd88f2def9db1a16e55a38a.tar.bz2 linux-stable-e57ff9fb690010a96bd88f2def9db1a16e55a38a.zip |
iio: adc: max1027: Reset the device at probe time
[ Upstream commit db033831b4f5589f9fcbadb837614a7c4eac0308 ]
All the registers are configured by the driver, let's reset the chip
at probe time, avoiding any conflict with a possible earlier
configuration.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/iio/adc/max1027.c')
-rw-r--r-- | drivers/iio/adc/max1027.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c index 214883458582..e3be8eedd773 100644 --- a/drivers/iio/adc/max1027.c +++ b/drivers/iio/adc/max1027.c @@ -458,6 +458,14 @@ static int max1027_probe(struct spi_device *spi) return ret; } + /* Internal reset */ + st->reg = MAX1027_RST_REG; + ret = spi_write(st->spi, &st->reg, 1); + if (ret < 0) { + dev_err(&indio_dev->dev, "Failed to reset the ADC\n"); + return ret; + } + /* Disable averaging */ st->reg = MAX1027_AVG_REG; ret = spi_write(st->spi, &st->reg, 1); |