OSDN Git Service

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)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 15 Oct 2019 20:11:03 +0000 (21:11 +0100)
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>
drivers/iio/adc/max1027.c

index 823223b..f9b473e 100644 (file)
@@ -466,6 +466,14 @@ static int max1027_probe(struct spi_device *spi)
                }
        }
 
+       /* 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);