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

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

Merge "usb: dwc3: msm: Allow VBUS regulator to be optional"

parents 39f3a4f3 556b1d1d
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -10,11 +10,6 @@ Required properties :
	"hs_phy_irq" : Interrupt from HS PHY for asynchronous events in LPM.
	"pwr_event_irq" : Interrupt to controller for asynchronous events in LPM.
	Used for SS-USB power events.
- <supply-name>-supply: phandle to the regulator device tree node
  Required "supply-name" examples are:
	"vbus_dwc3" : vbus supply for host mode when DWC3 operating as DRD.
	This can be left as optional if "host-only-mode" is selected in the
	'dwc3' sub node for "DWC3-USB3 Core device".

Optional properties :
- reg: Additional registers
@@ -33,6 +28,7 @@ Optional properties :
    "pmic_id_irq" : Interrupt from PMIC for external ID pin notification.
- qcom,charging-disabled: If present then battery charging using USB
  is disabled.
- vbus_dwc3-supply: phandle to the 5V VBUS supply regulator used for host mode.
- USB3_GDSC-supply : phandle to the globally distributed switch controller
  regulator node to the USB controller.
- qcom,dwc-usb3-msm-tx-fifo-size: If present, represents RAM size available for
+19 −9
Original line number Diff line number Diff line
@@ -3103,13 +3103,20 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
	if (!dwc->xhci)
		return -EINVAL;

	/*
	 * The vbus_reg pointer could have multiple values
	 * NULL: regulator_get() hasn't been called, or was previously deferred
	 * IS_ERR: regulator could not be obtained, so skip using it
	 * Valid pointer otherwise
	 */
	if (!mdwc->vbus_reg) {
		mdwc->vbus_reg = devm_regulator_get(mdwc->dev, "vbus_dwc3");
		if (IS_ERR(mdwc->vbus_reg)) {
			dev_err(mdwc->dev, "Failed to get vbus regulator\n");
			ret = PTR_ERR(mdwc->vbus_reg);
			mdwc->vbus_reg = 0;
			return ret;
		mdwc->vbus_reg = devm_regulator_get_optional(mdwc->dev,
					"vbus_dwc3");
		if (IS_ERR(mdwc->vbus_reg) &&
				PTR_ERR(mdwc->vbus_reg) == -EPROBE_DEFER) {
			/* regulators may not be ready, so retry again later */
			mdwc->vbus_reg = NULL;
			return -EPROBE_DEFER;
		}
	}

@@ -3120,6 +3127,7 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
		dbg_event(0xFF, "StrtHost gync",
			atomic_read(&dwc->dev->power.usage_count));
		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(dwc->dev, "unable to enable vbus_reg\n");
@@ -3144,6 +3152,7 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
			dev_err(mdwc->dev,
				"%s: failed to add XHCI pdev ret=%d\n",
				__func__, ret);
			if (!IS_ERR(mdwc->vbus_reg))
				regulator_disable(mdwc->vbus_reg);
			pm_runtime_put_sync(dwc->dev);
			dbg_event(0xFF, "pdeverr psync",
@@ -3170,6 +3179,7 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
	} else {
		dev_dbg(dwc->dev, "%s: turn off host\n", __func__);

		if (!IS_ERR(mdwc->vbus_reg))
			ret = regulator_disable(mdwc->vbus_reg);
		if (ret) {
			dev_err(dwc->dev, "unable to disable vbus_reg\n");