From a67adf4af55274251bd05028ae89a60f868f5823 Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Thu, 2 Oct 2014 11:12:22 -0700 Subject: [PATCH] samus_pd: send host event when we recv info VDM from PD device Send host event to AP when we receive info VDM from a PD device. This allows the AP to potentially send an update to the device. BUG=none BRANCH=samus TEST=load onto samus. when zinger is attached, verify that EC sends host event to AP. Change-Id: I10961ab60fb752e2e40a21d9351bd1ba98cc11da Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/221162 Reviewed-by: Todd Broch --- board/samus_pd/usb_pd_policy.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c index 94e18fbe8d..fe143668a9 100644 --- a/board/samus_pd/usb_pd_policy.c +++ b/board/samus_pd/usb_pd_policy.c @@ -150,6 +150,13 @@ int pd_board_checks(void) return EC_SUCCESS; } +/* Send host event up to AP */ +static void pd_send_host_event(void) +{ + atomic_or(&(pd_status.status), PD_STATUS_HOST_EVENT); + pd_send_ec_int(); +} + /* ----------------- Vendor Defined Messages ------------------ */ int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload) { @@ -171,6 +178,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload) case VDO_CMD_SEND_INFO: /* if last word is present, it contains lots of info */ if (cnt == 7) { + /* send host event */ + pd_send_host_event(); + dev_id = VDO_INFO_HW_DEV_ID(payload[6]); ccprintf("Dev:%d SW:%d RW:%d\n", dev_id, VDO_INFO_SW_DBG_VER(payload[6]), @@ -204,8 +214,7 @@ DECLARE_CONSOLE_COMMAND(ecint, command_ec_int, static int command_pd_host_event(int argc, char **argv) { - atomic_or(&(pd_status.status), PD_STATUS_HOST_EVENT); - pd_send_ec_int(); + pd_send_host_event(); return EC_SUCCESS; }