From: Viorel Suman Date: Tue, 14 Jul 2015 14:56:54 +0000 (+0300) Subject: iio: magnetometer: mmc35240: fix SET/RESET sequence X-Git-Tag: v4.14-rc1~4981^2^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=354c879dbd9393ac411049f968474f2bf6c2a495;p=platform%2Fkernel%2Flinux-rpi.git iio: magnetometer: mmc35240: fix SET/RESET sequence The RESET operation invoked in the last instance will align in the natural way all 3 axis and the chip top view. Without this, north and south are swapped. Signed-off-by: Viorel Suman Signed-off-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c index e9dfa0e..706ebfd 100644 --- a/drivers/iio/magnetometer/mmc35240.c +++ b/drivers/iio/magnetometer/mmc35240.c @@ -222,14 +222,15 @@ static int mmc35240_init(struct mmc35240_data *data) /* * make sure we restore sensor characteristics, by doing - * a RESET/SET sequence + * a SET/RESET sequence, the axis polarity being naturally + * aligned after RESET */ - ret = mmc35240_hw_set(data, false); + ret = mmc35240_hw_set(data, true); if (ret < 0) return ret; usleep_range(MMC53240_WAIT_SET_RESET, MMC53240_WAIT_SET_RESET + 1); - ret = mmc35240_hw_set(data, true); + ret = mmc35240_hw_set(data, false); if (ret < 0) return ret;