From: Linus Walleij Date: Wed, 29 Jun 2016 12:08:36 +0000 (+0200) Subject: iio: magn: ak8975: allow a delay after enabling regulators X-Git-Tag: v4.8-rc1~193^2^2~35 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b1037c1a498f9bb3b5a81c2f243c605c190da754;p=karo-tx-linux.git iio: magn: ak8975: allow a delay after enabling regulators 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 Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 6915bd116e49..bf3ffc4ae5c7 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -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; }