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-26 08:06:11 +0000 |
commit | faa22b40be5c0e0c2ace3080cd4ec1942a8eb08e (patch) | |
tree | 74d54215f024cca70e3db9bc20a55e456dad4bc7 /driver | |
parent | 1f908510a9c58a53685aafe33565f283b236ca43 (diff) | |
download | chrome-ec-faa22b40be5c0e0c2ace3080cd4ec1942a8eb08e.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>
(cherry picked from commit 8b50c762dc2df4d14e7aff4838e2490419be7913)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4465588
Tested-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
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 f3f3ae8537..d8c47251de 100644 --- a/driver/accel_lis2dw12.c +++ b/driver/accel_lis2dw12.c @@ -357,7 +357,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( @@ -389,7 +389,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. * @@ -398,7 +398,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 { |