usb: pd: Don't retry sending Source Capabilities if PD capable

If connected to a sink that we already know is PD capable, the
next time Source Capabilities is sent, whether due to reset or
in response Get_Source_Capabilities, upon failure should not
retry for nCapsCount times. Instead, simply issue a Soft Reset.

Change-Id: I5a53073f5473575e7206e1fdd344b8f14affddc2
Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
Jack Pham
2018-10-10 17:14:43 -07:00
parent 9f42ab89a9
commit 7be40e0583

View File

@ -1915,6 +1915,16 @@ static void handle_state_src_send_capabilities(struct usbpd *pd,
ret = pd_send_msg(pd, MSG_SOURCE_CAPABILITIES, default_src_caps,
ARRAY_SIZE(default_src_caps), SOP_MSG);
if (ret) {
if (pd->pd_connected) {
usbpd_set_state(pd, PE_SEND_SOFT_RESET);
break;
}
/*
* Technically this is PE_SRC_Discovery, but we can
* handle it by setting a timer to come back to the
* same state for the next retry.
*/
pd->caps_count++;
if (pd->caps_count >= PD_CAPS_COUNT) {
usbpd_dbg(&pd->dev, "Src CapsCounter exceeded, disabling PD\n");