Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 25bdeb88 authored by Jack Pham's avatar Jack Pham
Browse files

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: default avatarJack Pham <jackp@codeaurora.org>
parent cf0e3f24
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2361,6 +2361,16 @@ static void usbpd_sm(struct work_struct *w)
		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");