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

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

Merge "usb: phy-msm-hsusb: Add support to vote for 3.15 V in Host mode"

parents ef38e6d3 be43b9f1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on)
		dev_dbg(otg->phy->dev, "%s: turn on host\n", __func__);

		dwc3_otg_notify_host_mode(otg, on);
		usb_phy_notify_connect(dotg->dwc->usb2_phy, USB_SPEED_HIGH);
		ret = regulator_enable(dotg->vbus_otg);
		if (ret) {
			dev_err(otg->phy->dev, "unable to enable vbus_otg\n");
@@ -136,6 +137,7 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on)

		dbg_event(0xFF, "StHost get", 0);
		pm_runtime_get(dwc->dev);
		usb_phy_notify_disconnect(dotg->dwc->usb2_phy, USB_SPEED_HIGH);
		dwc3_otg_notify_host_mode(otg, on);
		dwc3_otg_set_host(otg, NULL);
		platform_device_del(dwc->xhci);
+31 −3
Original line number Diff line number Diff line
@@ -35,7 +35,8 @@ MODULE_PARM_DESC(override_phy_init, "Override HSPHY Init Seq");

/* QSCRATCH register settings differ based on MSM core ver */
#define MSM_CORE_VER_120		0x10020061

#define MSM_CORE_VER_160		0x10060000
#define MSM_CORE_VER_161		0x10060001

/* QSCRATCH register offsets */
#define GENERAL_CFG_REG			(0x08)
@@ -108,6 +109,7 @@ MODULE_PARM_DESC(override_phy_init, "Override HSPHY Init Seq");
#define USB_HSPHY_3P3_VOL_MIN			3050000 /* uV */
#define USB_HSPHY_3P3_VOL_MAX			3300000 /* uV */
#define USB_HSPHY_3P3_HPM_LOAD			16000	/* uA */
#define USB_HSPHY_3P3_VOL_FSHOST		3150000 /* uV */

#define USB_HSPHY_1P8_VOL_MIN			1800000 /* uV */
#define USB_HSPHY_1P8_VOL_MAX			1800000 /* uV */
@@ -542,12 +544,27 @@ static int msm_hsphy_set_suspend(struct usb_phy *uphy, int suspend)
static int msm_hsphy_notify_connect(struct usb_phy *uphy,
				    enum usb_device_speed speed)
{
	int rc = 0;
	struct msm_hsphy *phy = container_of(uphy, struct msm_hsphy, phy);

	phy->cable_connected = true;

	if (uphy->flags & PHY_HOST_MODE)
	if (uphy->flags & PHY_HOST_MODE) {
		if (phy->core_ver == MSM_CORE_VER_160 ||
			phy->core_ver == MSM_CORE_VER_161) {
			/* Some snps usb2 picophy revisions require 3.15 V to
			 * operate correctly during full speed host mode at
			 * sub zero temperature.
			 */
			rc = regulator_set_voltage(phy->vdda33,
					USB_HSPHY_3P3_VOL_FSHOST,
					USB_HSPHY_3P3_VOL_MAX);
			if (rc)
				dev_err(phy->phy.dev,
					"unable to set voltage for vdda33\n");
		}
		return 0;
	}

	if (!(uphy->flags & PHY_VBUS_VALID_OVERRIDE))
		return 0;
@@ -584,12 +601,23 @@ static int msm_hsphy_notify_connect(struct usb_phy *uphy,
static int msm_hsphy_notify_disconnect(struct usb_phy *uphy,
				       enum usb_device_speed speed)
{
	int rc = 0;
	struct msm_hsphy *phy = container_of(uphy, struct msm_hsphy, phy);

	phy->cable_connected = false;

	if (uphy->flags & PHY_HOST_MODE)
	if (uphy->flags & PHY_HOST_MODE) {
		if (phy->core_ver == MSM_CORE_VER_160 ||
			phy->core_ver == MSM_CORE_VER_161) {
			rc = regulator_set_voltage(phy->vdda33,
					USB_HSPHY_3P3_VOL_MIN,
					USB_HSPHY_3P3_VOL_MAX);
			if (rc)
				dev_err(phy->phy.dev,
					"unable to set voltage for vdda33\n");
		}
		return 0;
	}

	if (!(uphy->flags & PHY_VBUS_VALID_OVERRIDE))
		return 0;