msm: pil-q6v4: Migrate to clk APIs for XO voting
Use the clock APIs instead of the msm_xo APIs to vote on CXO and
PXO. This removes one more msm specific api from this driver and
will allow us to move XO control into the rpm clock driver.
Change-Id: I57cece3891eef8a8dace1a8465dbe3737ccd0e27
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/pil-q6v4.c b/arch/arm/mach-msm/pil-q6v4.c
index 75606be..511377d 100644
--- a/arch/arm/mach-msm/pil-q6v4.c
+++ b/arch/arm/mach-msm/pil-q6v4.c
@@ -20,10 +20,10 @@
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/workqueue.h>
+#include <linux/clk.h>
#include <mach/msm_bus.h>
#include <mach/msm_iomap.h>
-#include <mach/msm_xo.h>
#include "peripheral-loader.h"
#include "pil-q6v4.h"
@@ -71,7 +71,7 @@
struct regulator *vreg;
struct regulator *pll_supply;
bool vreg_enabled;
- struct msm_xo_voter *xo;
+ struct clk *xo;
struct delayed_work work;
};
@@ -89,18 +89,29 @@
return 0;
}
-static void pil_q6v4_make_proxy_votes(struct device *dev)
+static int pil_q6v4_make_proxy_votes(struct device *dev)
{
struct q6v4_data *drv = dev_get_drvdata(dev);
int ret;
- msm_xo_mode_vote(drv->xo, MSM_XO_MODE_ON);
+ ret = clk_prepare_enable(drv->xo);
+ if (ret) {
+ dev_err(dev, "Failed to enable XO\n");
+ goto err;
+ }
if (drv->pll_supply) {
ret = regulator_enable(drv->pll_supply);
- if (ret)
- dev_err(dev, "failed to enable pll supply\n");
+ if (ret) {
+ dev_err(dev, "Failed to enable pll supply\n");
+ goto err_regulator;
+ }
}
schedule_delayed_work(&drv->work, msecs_to_jiffies(PROXY_VOTE_TIMEOUT));
+ return 0;
+err_regulator:
+ clk_disable_unprepare(drv->xo);
+err:
+ return ret;
}
static void pil_q6v4_remove_proxy_votes(struct work_struct *work)
@@ -108,7 +119,7 @@
struct q6v4_data *drv = container_of(work, struct q6v4_data, work.work);
if (drv->pll_supply)
regulator_disable(drv->pll_supply);
- msm_xo_mode_vote(drv->xo, MSM_XO_MODE_OFF);
+ clk_disable_unprepare(drv->xo);
}
static void pil_q6v4_remove_proxy_votes_now(struct device *dev)
@@ -191,7 +202,9 @@
const struct q6v4_data *drv = dev_get_drvdata(pil->dev);
const struct pil_q6v4_pdata *pdata = pil->dev->platform_data;
- pil_q6v4_make_proxy_votes(pil->dev);
+ err = pil_q6v4_make_proxy_votes(pil->dev);
+ if (err)
+ return err;
err = pil_q6v4_power_up(pil->dev);
if (err)
@@ -331,7 +344,9 @@
const struct pil_q6v4_pdata *pdata = pil->dev->platform_data;
int err;
- pil_q6v4_make_proxy_votes(pil->dev);
+ err = pil_q6v4_make_proxy_votes(pil->dev);
+ if (err)
+ return err;
err = pil_q6v4_power_up(pil->dev);
if (err)
@@ -442,7 +457,7 @@
goto err;
}
- drv->xo = msm_xo_get(pdata->xo_id, pdata->name);
+ drv->xo = clk_get(&pdev->dev, "xo");
if (IS_ERR(drv->xo)) {
ret = PTR_ERR(drv->xo);
goto err_xo;
@@ -455,7 +470,7 @@
return 0;
err_pil:
flush_delayed_work_sync(&drv->work);
- msm_xo_put(drv->xo);
+ clk_put(drv->xo);
err_xo:
regulator_put(drv->vreg);
err:
@@ -467,7 +482,7 @@
{
struct q6v4_data *drv = platform_get_drvdata(pdev);
flush_delayed_work_sync(&drv->work);
- msm_xo_put(drv->xo);
+ clk_put(drv->xo);
regulator_put(drv->vreg);
regulator_put(drv->pll_supply);
return 0;