summaryrefslogtreecommitdiff
path: root/common/motion_sense.c
diff options
context:
space:
mode:
authorShou-Chieh Hsu <shouchieh@google.com>2023-05-17 09:04:35 +0000
committerShou-Chieh Hsu <shouchieh@google.com>2023-05-17 09:04:35 +0000
commitccc57fa0cbd41dedd0fdfda607b4effb643b928a (patch)
tree064cdedad65202b1692e7bf9ad5f556afcb13795 /common/motion_sense.c
parent246a64a7a7afa655fa977b157d6b4e3bbf8854b6 (diff)
parent7f55c15872425d95df9d6e55fb9fab4a9a33937e (diff)
downloadchrome-ec-firmware-nissa-15217.B-main.tar.gz
Merge remote-tracking branch cros/main into firmware-nissa-15217.B-mainfirmware-nissa-15217.B-main
Generated by: util/update_release_branch.py -r --zephyr --board nissa firmware- nissa-15217.B-main Relevant changes: git log --oneline 246a64a7a7..7f55c15872 -- zephyr/program/nissa util/getversion.sh 7f55c15872 uldren: Modify battery parameter b98a347e1b gothrax: Initial Zephyr EC image 638a938c27 yavilla: Add convertible related functions 926f0b68e1 Craask: define LED behavior at STATE_DISCHARGE_S0_BAT_LOW BRANCH=None BUG=b:274750316 b:279614675 b:273791621 b:282116750 TEST=`make -j buildall` Force-Relevant-Builds: all Change-Id: I0a1340ab45ce827aff3180468668cfcba92c6fe5 Signed-off-by: Shou-Chieh Hsu <shouchieh@google.com>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r--common/motion_sense.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 16a37d37a5..546034c7e2 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -698,6 +698,26 @@ static void check_and_queue_gestures(uint32_t *event)
if (IS_ENABLED(CONFIG_GESTURE_SENSOR_DOUBLE_TAP) &&
(*event & TASK_EVENT_MOTION_ACTIVITY_INTERRUPT(
MOTIONSENSE_ACTIVITY_DOUBLE_TAP))) {
+ if (IS_ENABLED(CONFIG_GESTURE_HOST_DETECTION)) {
+ struct ec_response_motion_sensor_data vector;
+
+ vector.flags = MOTIONSENSE_SENSOR_FLAG_BYPASS_FIFO;
+ /*
+ * Send events to the FIFO
+ * AP is ignoring double tap event, do no wake up and no
+ * automatic disable.
+ */
+ if (IS_ENABLED(
+ CONFIG_GESTURE_SENSOR_DOUBLE_TAP_FOR_HOST))
+ vector.flags |= MOTIONSENSE_SENSOR_FLAG_WAKEUP;
+ vector.activity_data.activity =
+ MOTIONSENSE_ACTIVITY_DOUBLE_TAP;
+ vector.activity_data.state = 1 /* triggered */;
+ vector.sensor_num = MOTION_SENSE_ACTIVITY_SENSOR_ID;
+ motion_sense_fifo_stage_data(&vector, NULL, 0,
+ __hw_clock_source_read());
+ motion_sense_fifo_commit_data();
+ }
/* Call board specific function to process tap */
sensor_board_proc_double_tap();
}
@@ -705,7 +725,20 @@ static void check_and_queue_gestures(uint32_t *event)
(*event & TASK_EVENT_MOTION_ACTIVITY_INTERRUPT(
MOTIONSENSE_ACTIVITY_SIG_MOTION))) {
struct motion_sensor_t *activity_sensor;
-
+ if (IS_ENABLED(CONFIG_GESTURE_HOST_DETECTION)) {
+ struct ec_response_motion_sensor_data vector;
+
+ /* Send events to the FIFO */
+ vector.flags = MOTIONSENSE_SENSOR_FLAG_WAKEUP |
+ MOTIONSENSE_SENSOR_FLAG_BYPASS_FIFO;
+ vector.activity_data.activity =
+ MOTIONSENSE_ACTIVITY_SIG_MOTION;
+ vector.activity_data.state = 1 /* triggered */;
+ vector.sensor_num = MOTION_SENSE_ACTIVITY_SENSOR_ID;
+ motion_sense_fifo_stage_data(&vector, NULL, 0,
+ __hw_clock_source_read());
+ motion_sense_fifo_commit_data();
+ }
/* Disable further detection */
activity_sensor = &motion_sensors[CONFIG_GESTURE_SIGMO_SENSOR];
activity_sensor->drv->manage_activity(
@@ -730,6 +763,12 @@ static void check_and_queue_gestures(uint32_t *event)
(*motion_orientation_ptr(sensor) !=
MOTIONSENSE_ORIENTATION_UNKNOWN)) {
motion_orientation_update(sensor);
+ vector.activity_data.state =
+ *motion_orientation_ptr(sensor);
+ motion_sense_fifo_stage_data(
+ &vector, NULL, 0,
+ __hw_clock_source_read());
+ motion_sense_fifo_commit_data();
if (IS_ENABLED(CONFIG_DEBUG_ORIENTATION)) {
static const char *const mode[] = {
"Landscape", "Portrait",