From b36899058e52830a48bdaabfbadfe777dc03672f Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Thu, 15 Feb 2018 10:50:26 +0100 Subject: pd: retry DR_SWAP after a WAIT If the other side answers our DR_SWAP request with a WAIT message (as bizarre as it might be), we want to retry later rather than giving up. Set again the PD_FLAGS_CHECK_DR_ROLE flag in order to do so. Signed-off-by: Vincent Palatin BRANCH=fizz BUG=chromium:814098 TEST=do repeated cold reset on Fizz connected to the 'interesting' USB-C screen and see the DP alternate mode negotiated. Change-Id: Icfb9fa209ce8cbe3c42c1e6946b43464544bdaea Reviewed-on: https://chromium-review.googlesource.com/921141 Commit-Ready: Vincent Palatin Tested-by: Vincent Palatin Reviewed-by: Aseda Aboagye Reviewed-by: Daisuke Nojiri Reviewed-by: Benson Leung (cherry picked from commit 00ac58809990a041b0ffff442398008b4c4e0adf) Reviewed-on: https://chromium-review.googlesource.com/932522 Commit-Queue: Daisuke Nojiri Tested-by: Daisuke Nojiri --- common/usb_pd_protocol.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index dda616d4b7..89885c3e84 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1353,8 +1353,11 @@ static void handle_ctrl_request(int port, uint16_t head, #endif case PD_CTRL_REJECT: case PD_CTRL_WAIT: - if (pd[port].task_state == PD_STATE_DR_SWAP) + if (pd[port].task_state == PD_STATE_DR_SWAP) { + if (type == PD_CTRL_WAIT) /* try again ... */ + pd[port].flags |= PD_FLAGS_CHECK_DR_ROLE; set_state(port, READY_RETURN_STATE(port)); + } #ifdef CONFIG_USBC_VCONN_SWAP else if (pd[port].task_state == PD_STATE_VCONN_SWAP_SEND) set_state(port, READY_RETURN_STATE(port)); -- cgit v1.2.1