From d269be62d115c75cf4a531d55b7daf7de2dce27b Mon Sep 17 00:00:00 2001 From: Jameson Thies Date: Tue, 30 Aug 2022 17:36:36 +0000 Subject: usb_common: Move HPD Wake MKBP Source to TCPMv1/TCPMv2 common file MKBP sources are declared using DECLARE_EVENT_SOURCE. For the EC_MKBP_EVENT_DP_ALT_MODE_ENTERED MKBP event, the source is only declared in usb_pd_policy.c, which is a TCPMv1 file. For boards using TCPMv2, the source is never declared causing mkbp_get_next_event in mkbp_event.c to return EC_RES_ERROR (0x2). This CL will move the EC_MKBP_EVENT_DP_ALT_MODE_ENTERED MKBP event source declaration to usb_common.c so that it exists in both TCPMv1 and TCPMv2. BUG=b:220875780 TEST=make try_builds_boards. make runhosttests. Triggered HPD wake event on a TCPMv2 device and received no "HC 0x0067 err 2" message. BRANCH=None Signed-off-by: Jameson Thies Change-Id: Ib873b0b68fcf3bd1a191583d694bd6209d7205f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3866153 Reviewed-by: Aseda Aboagye --- common/usb_common.c | 9 +++++++++ common/usb_pd_policy.c | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/usb_common.c b/common/usb_common.c index 372d55d2a0..59eaf7946b 100644 --- a/common/usb_common.c +++ b/common/usb_common.c @@ -1065,6 +1065,15 @@ void pd_send_host_event(int mask) } #endif /* defined(HAS_TASK_HOSTCMD) && !defined(TEST_BUILD) */ +#ifdef CONFIG_MKBP_EVENT +static int dp_alt_mode_entry_get_next_event(uint8_t *data) +{ + return EC_SUCCESS; +} +DECLARE_EVENT_SOURCE(EC_MKBP_EVENT_DP_ALT_MODE_ENTERED, + dp_alt_mode_entry_get_next_event); +#endif /* CONFIG_MKBP_EVENT */ + __overridable void pd_notify_dp_alt_mode_entry(int port) { if (IS_ENABLED(CONFIG_MKBP_EVENT)) { diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index 3b2d6b4b8f..e07e028fc2 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -78,15 +78,6 @@ __overridable void pd_check_dr_role(int port, enum pd_data_role dr_role, pd_request_data_swap(port); } -#ifdef CONFIG_MKBP_EVENT -static int dp_alt_mode_entry_get_next_event(uint8_t *data) -{ - return EC_SUCCESS; -} -DECLARE_EVENT_SOURCE(EC_MKBP_EVENT_DP_ALT_MODE_ENTERED, - dp_alt_mode_entry_get_next_event); -#endif /* CONFIG_MKBP_EVENT */ - /* Last received source cap */ static uint32_t pd_src_caps[CONFIG_USB_PD_PORT_MAX_COUNT][PDO_MAX_OBJECTS]; static uint8_t pd_src_cap_cnt[CONFIG_USB_PD_PORT_MAX_COUNT]; -- cgit v1.2.1