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
commit 15dea9f17f
No known key found for this signature in database
GPG key ID: CC95044519BE6669

View file

@ -3293,8 +3293,13 @@ static int dwc3_msm_vbus_notifier(struct notifier_block *nb,
struct dwc3_msm *mdwc = container_of(nb, struct dwc3_msm, vbus_nb);
struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
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;
}
dev_dbg(mdwc->dev, "vbus:%ld event received\n", event);
@ -4709,7 +4714,8 @@ static void dwc3_otg_sm_work(struct work_struct *w)
mdwc->drd_state = DRD_STATE_PERIPHERAL;
work = 1;
} 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");
#ifdef CONFIG_VXR200_XR_MISC
vxr7200_usb_event(false);