diff options
author | Kornel Dulęba <korneld@google.com> | 2023-03-28 13:50:05 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-17 19:30:52 +0000 |
commit | 8b50c762dc2df4d14e7aff4838e2490419be7913 (patch) | |
tree | d4c6840dcf887f368c47bdeebd39e8ae8d036c0a /driver | |
parent | 26d7d64e7423c1e6af33796c36d702fd4ee2e74f (diff) | |
download | chrome-ec-8b50c762dc2df4d14e7aff4838e2490419be7913.tar.gz |
accel_list2dw12: Set high perf mode for ODR >= 50z
Until recently we're used it only as lid accel, where no significant
precision is required. However in Winterhold we want to use it for
body detection. In order to reduce the noise and make it usable for that
purpose we need to set it into "high performance" power mode.
ODR is used to recognize the sensor purpose.
For lid accel it's set to 12.5Hz, assume that if it's at least 50Hz
the high performance is wanted.
BUG=b:262680246
BRANCH=none
TEST=Set ODR to 50Hz, verify high performance mode is on
Change-Id: I8c4decc93d2f2cfcc074cf2399f5cb582eb72696
Signed-off-by: Kornel Dulęba <korneld@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4379149
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/accel_lis2dw12.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/driver/accel_lis2dw12.c b/driver/accel_lis2dw12.c index f249f1896c..bdd3f2120d 100644 --- a/driver/accel_lis2dw12.c +++ b/driver/accel_lis2dw12.c @@ -360,7 +360,7 @@ static int set_data_rate(const struct motion_sensor_t *s, int rate, int rnd) * But lis2dw12 needs switch low power mode according to odr value. */ if (!IS_ENABLED(CONFIG_ACCEL_LIS2DWL)) { - if (reg_val > LIS2DW12_ODR_200HZ_VAL) + if (reg_val >= LIS2DW12_ODR_50HZ_VAL) ret = lis2dw12_set_power_mode(s, LIS2DW12_HIGH_PERF, 0); else ret = lis2dw12_set_power_mode( @@ -392,7 +392,7 @@ static int get_rms_noise(const struct motion_sensor_t *s) rate = INT_TO_FP(st_get_data_rate(s) / 1000); /* - * LIS2DW12: 90ug/sqrt(Hz) when ODR is over 200Hz + * LIS2DW12: 90ug/sqrt(Hz) when ODR is over 50Hz * When lower, we are in power mode 2, so the noise density does not * depend on frequency and the RMS at +/-2g is 2.4mg. * @@ -401,7 +401,7 @@ static int get_rms_noise(const struct motion_sensor_t *s) */ if (!IS_ENABLED(CONFIG_ACCEL_LIS2DWL)) { - if (rate < INT_TO_FP(200)) + if (rate < INT_TO_FP(50)) return 2400; noise_density_ug = INT_TO_FP(90); } else { |