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

Commit 1ff4e011 authored by Azhar Shaikh's avatar Azhar Shaikh
Browse files

usb: ehci-msm2: Add pm_qos voting during suspend/resume



Allow USB host to vote for pm_qos during suspend/resume.

Change-Id: Ib43c7c4c8e8ce1b45fbe98039968f55cd1acfaf9
Signed-off-by: default avatarAzhar Shaikh <azhars@codeaurora.org>
parent 1a5ba2af
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -241,6 +241,10 @@ Optional properties :
  ext-hub-reset-gpio GPIO. It should be driven LOW to RESET the HUB.
- qcom,usb2-enable-uicc: If present, usb2 port will be used for uicc card connection.
- usb-phy: phandle for the PHY device, if described as a separate device tree node
- qcom,pm-qos-latency: This property represents the maximum tolerable CPU latency in
  microsecs, which is used as a vote to keep the CPUs in a high enough power state when
  USB bus is in use (not suspended).


Example MSM HSUSB EHCI controller device node :
	ehci: qcom,ehci-host@f9a55000 {
+15 −2
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ struct msm_hcd {
	int					wakeup_irq;
	void __iomem				*usb_phy_ctrl_reg;
	struct pinctrl				*hsusb_pinctrl;
	struct pm_qos_request			pm_qos_req_dma;
};

static inline struct msm_hcd *hcd_to_mhcd(struct usb_hcd *hcd)
@@ -810,6 +811,9 @@ static int msm_ehci_suspend(struct msm_hcd *mhcd)
		enable_irq_wake(mhcd->async_irq);
		enable_irq(mhcd->async_irq);
	}

	pm_qos_update_request(&mhcd->pm_qos_req_dma, PM_QOS_DEFAULT_VALUE);

	pm_relax(mhcd->dev);

	dev_info(mhcd->dev, "EHCI USB in low power mode\n");
@@ -862,6 +866,10 @@ static int msm_ehci_resume(struct msm_hcd *mhcd)

	pm_stay_awake(mhcd->dev);

	pdata = mhcd->dev->platform_data;
	if (pdata)
		pm_qos_update_request(&mhcd->pm_qos_req_dma,
			pdata->pm_qos_latency + 1);
	/* Vote for TCXO when waking up the phy */
	if (mhcd->xo_clk)
		clk_prepare_enable(mhcd->xo_clk);
@@ -898,8 +906,7 @@ static int msm_ehci_resume(struct msm_hcd *mhcd)
	}

skip_phy_resume:
	pdata = mhcd->dev->platform_data;
	if (pdata && pdata->is_uicc) {
	if (pdata->is_uicc) {
		/* put the controller in normal mode */
		func_ctrl = msm_ulpi_read(mhcd, ULPI_FUNC_CTRL);
		func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK;
@@ -1311,6 +1318,8 @@ struct msm_usb_host_platform_data *ehci_msm2_dt_to_pdata(
					"qcom,ext-hub-reset-gpio", 0);
	pdata->is_uicc = of_property_read_bool(node,
					"qcom,usb2-enable-uicc");
	of_property_read_u32(node, "qcom,pm-qos-latency",
				&pdata->pm_qos_latency);

	return pdata;
}
@@ -1605,6 +1614,10 @@ static int ehci_msm2_probe(struct platform_device *pdev)
			mhcd->pmic_gpio_dp_irq = 0;
		}
	}

	pm_qos_add_request(&mhcd->pm_qos_req_dma, PM_QOS_CPU_DMA_LATENCY,
			pdata->pm_qos_latency + 1);

	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);

+1 −0
Original line number Diff line number Diff line
@@ -608,6 +608,7 @@ struct msm_usb_host_platform_data {
	int resume_gpio;
	int ext_hub_reset_gpio;
	bool is_uicc;
	int pm_qos_latency;
};

/**