diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2023-03-21 23:14:19 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-23 00:37:51 +0000 |
commit | fbf83724e6ec93c324135c5181b5f310ad6048a3 (patch) | |
tree | 24c15484ed63fee34666f5f841d85f01b6fc9861 /driver/accelgyro_icm426xx.c | |
parent | 4dd0c9465cb99d4c8d1ff237a6445dfd6b9732bd (diff) | |
download | chrome-ec-release-R113-15393.B-main.tar.gz |
driver: Add support for Spoof mode to all remaining accelerometersstabilize-15393.48.B-mainrelease-R113-15393.B-main
Spoof mode was added for few accelerometers (BMI160/260).
Use accelgyro_bmi_common as model and use it for all accelerometer.
BUG=b:263221955
BRANCH=many
TEST=In zephyr/program/nissa/program.conf, add
CONFIG_PLATFORM_EC_ACCEL_SPOOF_MODE=y
- Open the device at 90 degree check the sensors values:
ectool motionsense:
Motion sensing active
Sensor 0: -592 15872 944 (raised, lid)
Sensor 1: 803 -929 8134 (flat, base)
Sensor 2: 0 0 0
- Spoof in place, in clamshell mode.
ectool motionsense spoof -- 0 1
ectool motionsense spoof -- 1 1
- Spoof lid to be upside down:
ectool motionsense spoof -- 0 1 -592 -15872 944
- Observe the screen goes in tablet mode.
- Spoof lid accel back:
ectool motionsense spoof -- 0 1 -592 15872 944
- Observe the screen goes in laptop mode.
TEST=make buildall passes.
Change-Id: Idd4632637226f9ae57416a8afe0c137780898d16
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4358607
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'driver/accelgyro_icm426xx.c')
-rw-r--r-- | driver/accelgyro_icm426xx.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/driver/accelgyro_icm426xx.c b/driver/accelgyro_icm426xx.c index c3c9e2225f..f82cb2d718 100644 --- a/driver/accelgyro_icm426xx.c +++ b/driver/accelgyro_icm426xx.c @@ -186,12 +186,15 @@ static void __maybe_unused icm426xx_push_fifo_data(struct motion_sensor_t *s, const uint8_t *raw, uint32_t ts) { - intv3_t v; struct ec_response_motion_sensor_data vect; + int *v = s->raw_xyz; if (icm426xx_normalize(s, v, raw) != EC_SUCCESS) return; + if (IS_ENABLED(CONFIG_ACCEL_SPOOF_MODE) && + s->flags & MOTIONSENSE_FLAG_IN_SPOOF_MODE) + v = s->spoof_xyz; if (IS_ENABLED(CONFIG_ACCEL_FIFO)) { vect.data[X] = v[X]; vect.data[Y] = v[Y]; |