summaryrefslogtreecommitdiff
path: root/driver/mag_lis2mdl.c
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2019-06-21 15:04:17 -0600
committerCommit Bot <commit-bot@chromium.org>2019-06-22 02:11:37 +0000
commit3f80f258a4aad6a7ec048683586e0ecb6c122faf (patch)
tree866147938a7601ff6b48048078815ba30242bd7e /driver/mag_lis2mdl.c
parente7024509621ddf9cd64b55bcf2898bf2cb3e3cdb (diff)
downloadchrome-ec-3f80f258a4aad6a7ec048683586e0ecb6c122faf.tar.gz
driver:lis2mdl: Remove todo
After some digging around I've found that the issue wasn't in the call to init_mag_cal. Instead it was the fact that we weren't resetting the chip using the LIS2MDL_FLAG_SW_RESET flag every time we reset the calibration. Instead of resetting every time, it actually improves performance to ignore no-op calls here. So the comment can be resolved. BUG=b:130417518 TEST=Added reset flag to set ODR command and remove early bail. Everything works. BRANCH=None Change-Id: Ida4afefc4aad0630bb60a4e25371aa050f0886d0 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1672207 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'driver/mag_lis2mdl.c')
-rw-r--r--driver/mag_lis2mdl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/driver/mag_lis2mdl.c b/driver/mag_lis2mdl.c
index 1dedb23882..40725c180d 100644
--- a/driver/mag_lis2mdl.c
+++ b/driver/mag_lis2mdl.c
@@ -342,7 +342,10 @@ int lis2mdl_set_data_rate(const struct motion_sensor_t *s, int rate, int rnd)
: reg_val == LIS2MDL_ODR_20HZ ? 20000
: 50000;
- /* b/130417518 - verify why skipping init_mag_cal is needed here. */
+ /*
+ * If no change is needed just bail. Not doing so will require a reset
+ * of the chip which only leads to re-calibration and lost samples.
+ */
if (normalized_rate == data->base.odr)
return ret;