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

Commit 804dcb3b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: pd: force disconnect upon unexpected SRC->SNK transition"

parents 16eb1366 48c003b0
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -1617,7 +1617,6 @@ static void usbpd_sm(struct work_struct *w)
		else if (pd->current_dr == DR_DFP)
		else if (pd->current_dr == DR_DFP)
			stop_usb_host(pd);
			stop_usb_host(pd);


		pd->current_pr = PR_NONE;
		pd->current_dr = DR_NONE;
		pd->current_dr = DR_NONE;


		reset_vdm_state(pd);
		reset_vdm_state(pd);
@@ -2480,6 +2479,16 @@ static int psy_changed(struct notifier_block *nb, unsigned long evt, void *ptr)
		if (pd->current_pr == PR_SINK)
		if (pd->current_pr == PR_SINK)
			return 0;
			return 0;


		/*
		 * Unexpected if not in PR swap; need to force disconnect from
		 * source so we can turn off VBUS, Vconn, PD PHY etc.
		 */
		if (pd->current_pr == PR_SRC) {
			usbpd_info(&pd->dev, "Forcing disconnect from source mode\n");
			pd->current_pr = PR_NONE;
			break;
		}

		pd->current_pr = PR_SINK;
		pd->current_pr = PR_SINK;
		break;
		break;