diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2023-03-07 09:55:52 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-11 01:44:10 +0000 |
commit | 883fc160f1d98d21c6f3b6f97a624afe864eb10c (patch) | |
tree | 021233355f2e28fd6907f6995c7f693fc3573dda | |
parent | 6507b863e6c34b6bfc2810a702bc15f4d792d5f9 (diff) | |
download | chrome-ec-883fc160f1d98d21c6f3b6f97a624afe864eb10c.tar.gz |
common: motion_sense: Call manage_activity only when needed
The global |sensor_active| which duplicates the power state is changed
in the CHIPSET_TASK.
It is used in lower priority tasks (MOTION_SENSE and HOOK), so can
change in a middle of a call.
It is usually fine, except when configuring activities, where we could
end up calling manage_activity() on a sensor that does not support it.
BUG=b:269225196
BRANCH=bugzzy,kukui (any branch where on body/off body is used).
TEST=Compile
Check buggzy ec.RW.dis to check the call to manage_activity() function
pointer is gone:
228c movs r2, #140 ; 0x8c
fb02 7005 mla r0, r2, r5, r7
2102 movs r1, #2 <<< MOTIONSENSE_ACTIVITY_DOUBLE_TAP
6c02 ldr r2, [r0, #64] ; 0x40 << sensor->driver
4620 mov r0, r4 <<< sensor
6c15 ldr r5, [r2, #64] ; 0x40 << ..drive->manage_activity
2201 movs r2, #1 <<< 1
47a8 blx r5
Change-Id: I0060cfcb7b815cde54982e3e310b745cabed2306
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4316725
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | common/motion_sense.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c index a1279167e8..4ab8afef59 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -369,9 +369,10 @@ static void motion_sense_switch_sensor_rate(void) 0, NULL); } /* Re-enable double tap in case AP disabled it */ - sensor->drv->manage_activity( - sensor, MOTIONSENSE_ACTIVITY_DOUBLE_TAP, 1, - NULL); + if (IS_ENABLED(CONFIG_GESTURE_SENSOR_DOUBLE_TAP)) + sensor->drv->manage_activity( + sensor, MOTIONSENSE_ACTIVITY_DOUBLE_TAP, + 1, NULL); } } } |