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

Commit 2a57c3be authored by Jack Pham's avatar Jack Pham Committed by Gerrit - the friendly Code Review server
Browse files

usb: dwc3-msm: Set PHY_HOST_MODE flags when entering host mode



commit d84aa6ac ("usb: dwc3-msm: Remove POWER_SUPPLY_PROP_SCOPE
from USB") had inadvertently removed setting of the PHY_HOST_MODE
flags for the HS and SS PHYs when entering host mode, and clearing
them upon exiting. Add them back, as the PHYs may need to handle
low power mode settings differently versus peripheral mode.

Change-Id: Ia39f95bfaf2155a19b1cb33bd58667566959bf13
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 6f19e644
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -2931,16 +2931,13 @@ static int dwc3_msm_probe(struct platform_device *pdev)
		local_irq_save(flags);
		mdwc->id_state = !!irq_read_line(mdwc->pmic_id_irq);
		if (mdwc->id_state == DWC3_ID_GROUND)
			schedule_work(&mdwc->resume_work.work);
			dwc3_ext_event_notify(mdwc);
		local_irq_restore(flags);
		enable_irq_wake(mdwc->pmic_id_irq);
	}

	if (!dwc->is_drd && host_mode) {
		dev_dbg(&pdev->dev, "DWC3 in host only mode\n");
		mdwc->in_host_mode = true;
		mdwc->hs_phy->flags |= PHY_HOST_MODE;
		mdwc->ss_phy->flags |= PHY_HOST_MODE;
		mdwc->id_state = DWC3_ID_GROUND;
		dwc3_ext_event_notify(mdwc);
	}
@@ -3071,11 +3068,15 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
		pm_runtime_get_sync(mdwc->dev);
		dbg_event(0xFF, "StrtHost gync",
			atomic_read(&mdwc->dev->power.usage_count));
		mdwc->hs_phy->flags |= PHY_HOST_MODE;
		mdwc->ss_phy->flags |= PHY_HOST_MODE;
		usb_phy_notify_connect(mdwc->hs_phy, USB_SPEED_HIGH);
		if (!IS_ERR(mdwc->vbus_reg))
			ret = regulator_enable(mdwc->vbus_reg);
		if (ret) {
			dev_err(mdwc->dev, "unable to enable vbus_reg\n");
			mdwc->hs_phy->flags &= ~PHY_HOST_MODE;
			mdwc->ss_phy->flags &= ~PHY_HOST_MODE;
			pm_runtime_put_sync(mdwc->dev);
			dbg_event(0xFF, "vregerr psync",
				atomic_read(&mdwc->dev->power.usage_count));
@@ -3099,6 +3100,8 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
				__func__, ret);
			if (!IS_ERR(mdwc->vbus_reg))
				regulator_disable(mdwc->vbus_reg);
			mdwc->hs_phy->flags &= ~PHY_HOST_MODE;
			mdwc->ss_phy->flags &= ~PHY_HOST_MODE;
			pm_runtime_put_sync(mdwc->dev);
			dbg_event(0xFF, "pdeverr psync",
				atomic_read(&mdwc->dev->power.usage_count));
@@ -3135,6 +3138,8 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
		dbg_event(0xFF, "StopHost gsync",
			atomic_read(&mdwc->dev->power.usage_count));
		usb_phy_notify_disconnect(mdwc->hs_phy, USB_SPEED_HIGH);
		mdwc->hs_phy->flags &= ~PHY_HOST_MODE;
		mdwc->ss_phy->flags &= ~PHY_HOST_MODE;
		platform_device_del(dwc->xhci);

		/*