iio: magn: ak8975: allow a delay after enabling regulators
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 29 Jun 2016 12:08:36 +0000 (14:08 +0200)
committerJonathan Cameron <jic23@kernel.org>
Thu, 30 Jun 2016 19:40:04 +0000 (20:40 +0100)
The datasheet actually specifies that we need to wait atleast
500us after powering on the device before trying to set mode.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/magnetometer/ak8975.c

index 6915bd1..bf3ffc4 100644 (file)
@@ -399,6 +399,12 @@ static int ak8975_power_on(const struct ak8975_data *data)
                         "Failed to enable specified Vid supply\n");
                return ret;
        }
+       /*
+        * According to the datasheet the power supply rise time i 200us
+        * and the minimum wait time before mode setting is 100us, in
+        * total 300 us. Add some margin and say minimum 500us here.
+        */
+       usleep_range(500, 1000);
        return 0;
 }