diff options
-rw-r--r-- | common/usbc/dp_alt_mode.c | 8 | ||||
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/common/usbc/dp_alt_mode.c b/common/usbc/dp_alt_mode.c index ff8909bbd6..f8ccc5f3c8 100644 --- a/common/usbc/dp_alt_mode.c +++ b/common/usbc/dp_alt_mode.c @@ -61,6 +61,14 @@ void dp_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count, pd_get_amode_data(port, type, USB_SID_DISPLAYPORT); const uint8_t vdm_cmd = PD_VDO_CMD(vdm[0]); + /* + * Handle the ACK of a request to exit alt mode. + */ + if (type == TCPC_TX_SOP && vdm_cmd == CMD_EXIT_MODE) { + dpm_init(port); + return; + } + if (type != TCPC_TX_SOP || next_vdm_cmd[port] != vdm_cmd) { print_unexpected_response(port, type, CMDT_RSP_ACK, vdm_cmd); dpm_set_mode_entry_done(port); diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index dadcfe02af..45e2ed4206 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -1152,7 +1152,9 @@ static bool common_src_snk_dpm_requests(int port) /* * Init VDM CMD_EXIT_MODE message. * alt_opos must be set with the opos to be sent. + * TODO: Convert this to use DPM_REQUEST_VDM. */ + pe[port].tx_type = TCPC_TX_SOP; pe[port].vdm_data[0] = VDO( USB_SID_DISPLAYPORT, 1, /* structured */ @@ -1162,6 +1164,8 @@ static bool common_src_snk_dpm_requests(int port) VDO_CMDT(CMDT_INIT) | CMD_EXIT_MODE); pe[port].vdm_cnt = 1; + set_state_pe(port, PE_VDM_REQUEST); + return true; } else if (PE_CHK_DPM_REQUEST(port, DPM_REQUEST_VDM)) { PE_CLR_DPM_REQUEST(port, DPM_REQUEST_VDM); @@ -4911,7 +4915,7 @@ static void pe_vdm_response_entry(int port) rx_payload[0] &= ~VDO_CMDT_MASK; if (cmd_type != CMDT_INIT) { - CPRINTF("ERR:CMDT:%d\n", vdo_cmd); + CPRINTF("ERR:CMDT:%d:%d\n", cmd_type, vdo_cmd); if (pe[port].power_role == PD_ROLE_SOURCE) set_state_pe(port, PE_SRC_READY); |