summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViorel Suman <viorel.suman@intel.com>2015-07-14 14:56:54 (GMT)
committerJonathan Cameron <jic23@kernel.org>2015-07-19 10:54:29 (GMT)
commit354c879dbd9393ac411049f968474f2bf6c2a495 (patch)
treeda579072fe47fb089a1cbd019e7f2887197f270c
parent3ceaa2c207ccf6933affc8358c0a04beb93e9aa7 (diff)
downloadlinux-354c879dbd9393ac411049f968474f2bf6c2a495.tar.xz
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 <viorel.suman@intel.com> Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/magnetometer/mmc35240.c7
1 files changed, 4 insertions, 3 deletions
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;