diff options
author | Shou-Chieh Hsu <shouchieh@google.com> | 2023-05-17 09:04:35 +0000 |
---|---|---|
committer | Shou-Chieh Hsu <shouchieh@google.com> | 2023-05-17 09:04:35 +0000 |
commit | ccc57fa0cbd41dedd0fdfda607b4effb643b928a (patch) | |
tree | 064cdedad65202b1692e7bf9ad5f556afcb13795 /common | |
parent | 246a64a7a7afa655fa977b157d6b4e3bbf8854b6 (diff) | |
parent | 7f55c15872425d95df9d6e55fb9fab4a9a33937e (diff) | |
download | chrome-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')
-rw-r--r-- | common/body_detection.c | 13 | ||||
-rw-r--r-- | common/charge_state_v2.c | 6 | ||||
-rw-r--r-- | common/motion_sense.c | 41 | ||||
-rw-r--r-- | common/motion_sense_fifo.c | 5 | ||||
-rw-r--r-- | common/usbc/usb_mode.c | 4 |
5 files changed, 64 insertions, 5 deletions
diff --git a/common/body_detection.c b/common/body_detection.c index d16e83df00..646bc6d740 100644 --- a/common/body_detection.c +++ b/common/body_detection.c @@ -102,6 +102,19 @@ void body_detect_change_state(enum body_detect_states state, bool spoof) { if (IS_ENABLED(CONFIG_ACCEL_SPOOF_MODE) && spoof_enable && !spoof) return; + if (IS_ENABLED(CONFIG_GESTURE_HOST_DETECTION)) { + struct ec_response_motion_sensor_data vector = { + .flags = MOTIONSENSE_SENSOR_FLAG_BYPASS_FIFO, + .activity_data = { + .activity = MOTIONSENSE_ACTIVITY_BODY_DETECTION, + .state = state, + }, + .sensor_num = MOTION_SENSE_ACTIVITY_SENSOR_ID, + }; + motion_sense_fifo_stage_data(&vector, NULL, 0, + __hw_clock_source_read()); + motion_sense_fifo_commit_data(); + } /* change the motion state */ motion_state = state; if (state == BODY_DETECTION_ON_BODY) { diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index a603d4f108..abfb6d2dd0 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -80,7 +80,7 @@ static uint8_t battery_level_shutdown; */ static const struct battery_info *batt_info; static struct charge_state_data curr; -static enum charge_state_v2 prev_state; +static enum charge_state prev_state; static int prev_ac, prev_charge, prev_disp_charge; static enum battery_present prev_bp; static enum ec_charge_control_mode chg_ctl_mode; @@ -776,7 +776,7 @@ static void notify_host_of_low_battery_charge(void) #endif } -static void set_charge_state(enum charge_state_v2 state) +static void set_charge_state(enum charge_state state) { prev_state = curr.state; curr.state = state; @@ -1026,7 +1026,7 @@ static void wakeup_battery(int *need_static) } } -__test_only enum charge_state_v2 charge_get_state_v2(void) +__test_only enum charge_state charge_get_state(void) { return curr.state; } 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", diff --git a/common/motion_sense_fifo.c b/common/motion_sense_fifo.c index fd1bfda88c..1a7303bc79 100644 --- a/common/motion_sense_fifo.c +++ b/common/motion_sense_fifo.c @@ -271,6 +271,9 @@ static void fifo_stage_unit(struct ec_response_motion_sensor_data *data, struct queue_chunk chunk; int i; + if (valid_data > 0 && !sensor) + return; + mutex_lock(&g_sensor_mutex); for (i = 0; i < valid_data; i++) @@ -460,7 +463,7 @@ void motion_sense_fifo_stage_data(struct ec_response_motion_sensor_data *data, fifo_staged.read_ts = __hw_clock_source_read(); fifo_stage_timestamp(time, data->sensor_num); } - if (sensor->config[SENSOR_CONFIG_AP].ec_rate > 0 && + if (sensor && sensor->config[SENSOR_CONFIG_AP].ec_rate > 0 && time_after(time, ts_last_int[id] + sensor->config[SENSOR_CONFIG_AP].ec_rate - MOTION_SENSOR_INT_ADJUSTMENT_US)) { diff --git a/common/usbc/usb_mode.c b/common/usbc/usb_mode.c index 017f89fc74..157c1b1f04 100644 --- a/common/usbc/usb_mode.c +++ b/common/usbc/usb_mode.c @@ -20,6 +20,7 @@ #include "usb_pd_dpm_sm.h" #include "usb_pd_tcpm.h" #include "usb_pe_sm.h" +#include "usb_prl_sm.h" #include "usb_tbt_alt_mode.h" #include "usbc_ppc.h" @@ -169,6 +170,9 @@ bool enter_usb_port_partner_is_capable(int port) if (usb4_state[port] == USB4_INACTIVE) return false; + if (prl_get_rev(port, TCPCI_MSG_SOP) < PD_REV30) + return false; + if (!PD_PRODUCT_IS_USB4(disc->identity.product_t1.raw_value)) return false; |