]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
iio: adc: max1027: Reset the device at probe time
authorMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 11 Oct 2019 14:43:42 +0000 (16:43 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:58:30 +0000 (23:58 -0500)
BugLink: https://bugs.launchpad.net/bugs/1860490
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/iio/adc/max1027.c

index da84adfdb819224def1ef9db2b24b94f265b3841..2ce3dd95204f2e30758668af8a256ee899f75301 100644 (file)
@@ -457,6 +457,14 @@ static int max1027_probe(struct spi_device *spi)
                goto fail_dev_register;
        }
 
+       /* 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);