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

Commit 5a4b3611 authored by Sujeet Kumar's avatar Sujeet Kumar
Browse files

USB: phy-msm-usb: Remove old XO voting implementation



Now drivers need to explicitly enable or disable xo_clk
for voting for XO ON or OFF. Hence the old XO voting
APIs are not needed anymore. Also msm_xo header file
is not moved to common location.
Hence remove the old XO voting mechanism.

Change-Id: I8e313727aa44faf895ebbacf46538dcd28788572
Signed-off-by: default avatarSujeet Kumar <ksujeet@codeaurora.org>
parent 9b02e768
Loading
Loading
Loading
Loading
+3 −38
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@
#include <linux/usb/msm_hsusb.h>
#include <linux/of.h>

#include <mach/msm_xo.h>
#include <mach/msm_iomap.h>
#include <linux/debugfs.h>
#include <mach/rpm-regulator.h>
@@ -73,7 +72,6 @@ struct msm_hcd {
	struct regulator			*hsusb_3p3;
	struct regulator			*hsusb_1p8;
	struct regulator			*vbus;
	struct msm_xo_voter			*xo_handle;
	bool					vbus_on;
	atomic_t				in_lpm;
	int					pmic_gpio_dp_irq;
@@ -711,7 +709,6 @@ static int msm_ehci_suspend(struct msm_hcd *mhcd)
{
	struct usb_hcd *hcd = mhcd_to_hcd(mhcd);
	unsigned long timeout;
	int ret;
	u32 portsc;

	if (atomic_read(&mhcd->in_lpm)) {
@@ -785,14 +782,8 @@ static int msm_ehci_suspend(struct msm_hcd *mhcd)
	clk_disable_unprepare(mhcd->core_clk);

	/* usb phy does not require TCXO clock, hence vote for TCXO disable */
	if (mhcd->xo_clk) {
	if (mhcd->xo_clk)
		clk_disable_unprepare(mhcd->xo_clk);
	} else {
		ret = msm_xo_mode_vote(mhcd->xo_handle, MSM_XO_MODE_OFF);
		if (ret)
			dev_err(mhcd->dev, "%s failed to devote for TCXO %d\n",
								__func__, ret);
	}
	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);

	msm_ehci_config_vddcx(mhcd, 0);
@@ -832,7 +823,6 @@ static int msm_ehci_resume(struct msm_hcd *mhcd)
	struct usb_hcd *hcd = mhcd_to_hcd(mhcd);
	unsigned long timeout;
	unsigned temp;
	int ret;
	unsigned long flags;

	if (!atomic_read(&mhcd->in_lpm)) {
@@ -868,14 +858,8 @@ static int msm_ehci_resume(struct msm_hcd *mhcd)
	pm_stay_awake(mhcd->dev);

	/* Vote for TCXO when waking up the phy */
	if (mhcd->xo_clk) {
	if (mhcd->xo_clk)
		clk_prepare_enable(mhcd->xo_clk);
	} else {
		ret = msm_xo_mode_vote(mhcd->xo_handle, MSM_XO_MODE_ON);
		if (ret)
			dev_err(mhcd->dev, "%s failed to vote for TCXO D0 %d\n",
								__func__, ret);
	}

	clk_prepare_enable(mhcd->core_clk);
	clk_prepare_enable(mhcd->iface_clk);
@@ -1403,20 +1387,8 @@ static int ehci_msm2_probe(struct platform_device *pdev)
	}

	snprintf(pdev_name, PDEV_NAME_LEN, "%s.%d", pdev->name, pdev->id);
	if (mhcd->xo_clk) {
	if (mhcd->xo_clk)
		ret = clk_prepare_enable(mhcd->xo_clk);
	} else {
		mhcd->xo_handle = msm_xo_get(MSM_XO_TCXO_D0, pdev_name);
		if (IS_ERR(mhcd->xo_handle)) {
			dev_err(&pdev->dev, "%s fail to get handle for X0 D0\n",
								__func__);
			ret = PTR_ERR(mhcd->xo_handle);
			mhcd->xo_handle = NULL;
			goto free_async_irq;
		} else {
			ret = msm_xo_mode_vote(mhcd->xo_handle, MSM_XO_MODE_ON);
		}
	}
	if (ret) {
		dev_err(&pdev->dev, "%s failed to vote for TCXO %d\n",
								__func__, ret);
@@ -1583,16 +1555,11 @@ deinit_vddcx:
devote_xo_handle:
	if (mhcd->xo_clk)
		clk_disable_unprepare(mhcd->xo_clk);
	else
		msm_xo_mode_vote(mhcd->xo_handle, MSM_XO_MODE_OFF);
free_xo_handle:
	if (mhcd->xo_clk) {
		clk_put(mhcd->xo_clk);
		mhcd->xo_clk = NULL;
	} else {
		msm_xo_put(mhcd->xo_handle);
	}
free_async_irq:
	if (mhcd->async_irq)
		free_irq(mhcd->async_irq, mhcd);
unmap:
@@ -1638,8 +1605,6 @@ static int ehci_msm2_remove(struct platform_device *pdev)
	if (mhcd->xo_clk) {
		clk_disable_unprepare(mhcd->xo_clk);
		clk_put(mhcd->xo_clk);
	} else {
		msm_xo_put(mhcd->xo_handle);
	}
	msm_ehci_vbus_power(mhcd, 0);
	msm_ehci_init_vbus(mhcd, 0);
+5 −41
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@
#include <linux/mhl_8334.h>
#include <linux/qpnp/qpnp-adc.h>

#include <mach/msm_xo.h>
#include <mach/msm_bus.h>
#include <mach/rpm-regulator.h>

@@ -896,7 +895,6 @@ static int msm_otg_suspend(struct msm_otg *motg)
	bool host_bus_suspend, device_bus_suspend, dcp, prop_charger;
	bool floated_charger, sm_work_busy;
	u32 phy_ctrl_val = 0, cmd_val;
	unsigned ret;
	u32 portsc, config2;
	u32 func_ctrl;

@@ -1095,14 +1093,6 @@ static int msm_otg_suspend(struct msm_otg *motg)
		if (motg->xo_clk) {
			clk_disable_unprepare(motg->xo_clk);
			motg->lpm_flags |= XO_SHUTDOWN;
		} else {
			ret = msm_xo_mode_vote(motg->xo_handle,
							MSM_XO_MODE_OFF);
			if (ret)
				dev_err(phy->dev, "%s fail to devote XO %d\n",
								 __func__, ret);
			else
				motg->lpm_flags |= XO_SHUTDOWN;
		}
	}

@@ -1195,14 +1185,8 @@ static int msm_otg_resume(struct msm_otg *motg)

	/* Vote for TCXO when waking up the phy */
	if (motg->lpm_flags & XO_SHUTDOWN) {
		if (motg->xo_clk) {
		if (motg->xo_clk)
			clk_prepare_enable(motg->xo_clk);
		} else {
			ret = msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_ON);
			if (ret)
				dev_err(phy->dev, "%s fail to vote for XO %d\n",
								__func__, ret);
		}
		motg->lpm_flags &= ~XO_SHUTDOWN;
	}

@@ -4618,25 +4602,11 @@ static int __init msm_otg_probe(struct platform_device *pdev)
		motg->async_irq = 0;
	}

	if (!motg->xo_clk) {
		motg->xo_handle = msm_xo_get(MSM_XO_TCXO_D0, "usb");
		if (IS_ERR(motg->xo_handle)) {
			dev_err(&pdev->dev, "%s fail to get handle for TCXO\n",
								__func__);
			ret = PTR_ERR(motg->xo_handle);
			goto free_regs;
		} else {
			ret = msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_ON);
			if (ret) {
				dev_err(&pdev->dev, "%s XO voting failed %d\n",
								__func__, ret);
				goto free_xo_handle;
			}
		}
	} else {
	if (motg->xo_clk) {
		ret = clk_prepare_enable(motg->xo_clk);
		if (ret) {
			dev_err(&pdev->dev, "%s failed to vote for TCXO %d\n",
			dev_err(&pdev->dev,
				"%s failed to vote for TCXO %d\n",
					__func__, ret);
			goto free_xo_handle;
		}
@@ -4910,14 +4880,10 @@ devote_xo_handle:
	clk_disable_unprepare(motg->pclk);
	if (motg->xo_clk)
		clk_disable_unprepare(motg->xo_clk);
	else
		msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_OFF);
free_xo_handle:
	if (motg->xo_clk) {
		clk_put(motg->xo_clk);
		motg->xo_clk = NULL;
	} else {
		msm_xo_put(motg->xo_handle);
	}
free_regs:
	iounmap(motg->regs);
@@ -5021,8 +4987,6 @@ static int msm_otg_remove(struct platform_device *pdev)
	if (motg->xo_clk) {
		clk_disable_unprepare(motg->xo_clk);
		clk_put(motg->xo_clk);
	} else {
		msm_xo_put(motg->xo_handle);
	}

	if (!IS_ERR(motg->sleep_clk))