usb: dwc3: Handle charging behavior when usb data is disabled

Bug: 221009551
Test: build, boot
Signed-off-by: Jimmy Hu <hhhuuu@google.com>
Change-Id: I82add2a6cb5e3060c930105b1b8b4f45da85f5f8
This commit is contained in:
Jimmy Hu 2022-05-26 08:50:30 +00:00 committed by Michael Bestas
parent af96efa607
commit f60138b6bc
No known key found for this signature in database
GPG key ID: CC95044519BE6669

View file

@ -4090,8 +4090,13 @@ static int dwc3_msm_vbus_notifier(struct notifier_block *nb,
if (!edev || !mdwc)
return NOTIFY_DONE;
if (!mdwc->usb_data_enabled)
if (!mdwc->usb_data_enabled) {
if (event)
dwc3_msm_gadget_vbus_draw(mdwc, 500);
else
dwc3_msm_gadget_vbus_draw(mdwc, 0);
return NOTIFY_DONE;
}
dwc = platform_get_drvdata(mdwc->dwc3);
@ -5834,7 +5839,8 @@ static void dwc3_otg_sm_work(struct work_struct *w)
mdwc->drd_state = DRD_STATE_PERIPHERAL;
work = true;
} else {
dwc3_msm_gadget_vbus_draw(mdwc, 0);
if (mdwc->usb_data_enabled)
dwc3_msm_gadget_vbus_draw(mdwc, 0);
dev_dbg(mdwc->dev, "Cable disconnected\n");
}
break;