From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Linus Walleij To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Gregor Boirie , Richard Leitner , Krzysztof Kozlowski , Gwendal Grignou , Linus Walleij Subject: [PATCH 4/5] iio: magn: ak8975: allow a delay after enabling regulators Date: Wed, 22 Jun 2016 00:18:17 +0200 Message-Id: <1466547498-15484-5-git-send-email-linus.walleij@linaro.org> In-Reply-To: <1466547498-15484-1-git-send-email-linus.walleij@linaro.org> References: <1466547498-15484-1-git-send-email-linus.walleij@linaro.org> List-ID: 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 --- drivers/iio/magnetometer/ak8975.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 8844e6f45c8e..1c6e4157a91f 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; } -- 2.4.11