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/accel_bma4xx.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/accel_bma4xx.c')
-rw-r--r-- | driver/accel_bma4xx.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/driver/accel_bma4xx.c b/driver/accel_bma4xx.c index a842b42d3a..4120f726c3 100644 --- a/driver/accel_bma4xx.c +++ b/driver/accel_bma4xx.c @@ -605,7 +605,7 @@ static void process_fifo_data(struct motion_sensor_t *s, uint8_t *data, ASSERT(data_bytes % 6 == 0); for (int i = 0; i < data_bytes; i += 6) { - intv3_t v; + int *v = s->raw_xyz; if (data[i + 1] == 0x80 && data[i] == 0) { /* 0x8000 means read overrun; out of data */ @@ -613,6 +613,9 @@ static void process_fifo_data(struct motion_sensor_t *s, uint8_t *data, } swizzle_sample_data(s, &data[i], v); + if (IS_ENABLED(CONFIG_ACCEL_SPOOF_MODE) && + s->flags & MOTIONSENSE_FLAG_IN_SPOOF_MODE) + v = s->spoof_xyz; if (IS_ENABLED(CONFIG_ACCEL_FIFO)) { struct ec_response_motion_sensor_data response = { .sensor_num = s - motion_sensors, |