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

This commit is contained in:
Linux Build Service Account 2017-08-21 20:01:09 -07:00 committed by Gerrit - the friendly Code Review server
commit a11dada42d

View file

@ -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;