summaryrefslogtreecommitdiff
path: root/common/usbc/usb_tc_drp_acc_trysrc_sm.c
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-01-22 08:04:56 -0700
committerCommit Bot <commit-bot@chromium.org>2021-01-25 17:40:39 +0000
commit24c5daa48c94cdf6160ee111d346690817238413 (patch)
treef29f8416f21cece43d6a1fdffaa050cb49f307b6 /common/usbc/usb_tc_drp_acc_trysrc_sm.c
parenteb3d6b6b4f857f6525d1fa251ef22b8dc342f09d (diff)
downloadchrome-ec-24c5daa48c94cdf6160ee111d346690817238413.tar.gz
tcpmv2: ensure the USB mux state is only changed in the PD task
The USB mux code does not provide any mutex protection. In addition the virtual USB mux code must be run from the PD task to handle synchronization of the EC_CMD_USB_PD_MUX_ACK host command. Move the USB mux updates into the common power state handler for the type-C state machine. BUG=b:178186846 BRANCH=volteer TEST=make buildall TEST=Connect Gatkex to Voxel, execute EC reboot and verify assertion is fixed. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I0a18d0f5c51eedb4ecb0c275ea1235f7838246a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2644843 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Tested-by: Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.corp-partner.google.com>
Diffstat (limited to 'common/usbc/usb_tc_drp_acc_trysrc_sm.c')
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index f63fd5075f..293f5bf1fa 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1734,14 +1734,13 @@ __maybe_unused static void handle_new_power_state(int port)
* boots up
*/
dpm_set_mode_exit_request(port);
-
- /*
- * The following function will disconnect both USB and
- * DP mux, as the chipset is transitioning to OFF.
- */
- set_usb_mux_with_current_data_role(port);
}
}
+ /*
+ * Set the USB mux according to the new power state. If the chipset
+ * is transitioning to OFF, this disconnects USB and DP mux.
+ */
+ set_usb_mux_with_current_data_role(port);
}
#if defined(CONFIG_USB_PD_ALT_MODE) && !defined(CONFIG_USB_PD_ALT_MODE_DFP)
@@ -3604,7 +3603,6 @@ static void pd_chipset_startup(void)
int i;
for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
- set_usb_mux_with_current_data_role(i);
pd_set_dual_role_and_event(i,
pd_get_drp_state_in_suspend(),
PD_EVENT_UPDATE_DUAL_ROLE