Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Viorel Suman and committed by
Jonathan Cameron
354c879d 3ceaa2c2

+4 -3
+4 -3
drivers/iio/magnetometer/mmc35240.c
··· 222 222 223 223 /* 224 224 * make sure we restore sensor characteristics, by doing 225 - * a RESET/SET sequence 225 + * a SET/RESET sequence, the axis polarity being naturally 226 + * aligned after RESET 226 227 */ 227 - ret = mmc35240_hw_set(data, false); 228 + ret = mmc35240_hw_set(data, true); 228 229 if (ret < 0) 229 230 return ret; 230 231 usleep_range(MMC53240_WAIT_SET_RESET, MMC53240_WAIT_SET_RESET + 1); 231 232 232 - ret = mmc35240_hw_set(data, true); 233 + ret = mmc35240_hw_set(data, false); 233 234 if (ret < 0) 234 235 return ret; 235 236