summaryrefslogtreecommitdiff
path: root/drivers/media/platform/soc_camera
diff options
context:
space:
mode:
authorBryan Wu <pengw@nvidia.com>2013-03-20 16:42:03 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 13:15:20 -0700
commit9fa06987634f9cf62c9f1179254adf4bd3a3aa87 (patch)
tree82dd4f4a6264901892b770d1045c8322c5f9aeea /drivers/media/platform/soc_camera
parent5ee9b97251ebfe7bcd440f7e3af2509236ae78c0 (diff)
media: tegra: add regulator control in V4L2 driver instead of board file
Change-Id: Id983aa121be984143679a198496245a22cc81d61 Signed-off-by: Bryan Wu <pengw@nvidia.com> Reviewed-on: http://git-master/r/226467 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Allen Martin <amartin@nvidia.com>
Diffstat (limited to 'drivers/media/platform/soc_camera')
-rw-r--r--drivers/media/platform/soc_camera/tegra_v4l2_camera.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/media/platform/soc_camera/tegra_v4l2_camera.c b/drivers/media/platform/soc_camera/tegra_v4l2_camera.c
index b37f3ef4b407..418461ed6650 100644
--- a/drivers/media/platform/soc_camera/tegra_v4l2_camera.c
+++ b/drivers/media/platform/soc_camera/tegra_v4l2_camera.c
@@ -275,6 +275,8 @@ struct tegra_camera_dev {
struct clk *clk_isp;
struct clk *clk_csus;
+ struct regulator *reg;
+
void __iomem *vi_base;
spinlock_t videobuf_queue_lock;
struct list_head capture;
@@ -1062,6 +1064,9 @@ static void tegra_camera_activate(struct tegra_camera_dev *pcdev)
{
nvhost_module_busy_ext(pcdev->ndev);
+ /* Enable external power */
+ regulator_enable(pcdev->reg);
+
/* Turn on relevant clocks. */
clk_prepare_enable(pcdev->clk_vi);
clk_prepare_enable(pcdev->clk_vi_sensor);
@@ -1093,6 +1098,9 @@ static void tegra_camera_deactivate(struct tegra_camera_dev *pcdev)
clk_disable_unprepare(pcdev->clk_isp);
clk_disable_unprepare(pcdev->clk_csus);
+ /* Disable external power */
+ regulator_disable(pcdev->reg);
+
nvhost_module_idle_ext(pcdev->ndev);
}
@@ -1718,10 +1726,22 @@ static int tegra_camera_probe(struct platform_device *pdev)
clk_set_rate(pcdev->clk_vi, 150000000);
clk_set_rate(pcdev->clk_vi_sensor, 24000000);
+ /* Get regulator pointer */
+#ifdef CONFIG_ARCH_TEGRA_2x_SOC
+ pcdev->reg = regulator_get(&pdev->dev, "vcsi");
+#else
+ pcdev->reg = regulator_get(&pdev->dev, "avdd_dsi_csi");
+#endif
+ if (IS_ERR_OR_NULL(pcdev->reg)) {
+ dev_err(&pdev->dev, "%s: couldn't get regulator\n",
+ __func__);
+ goto exit_put_clk_csus;
+ }
+
platform_set_drvdata(pdev, ndata);
err = nvhost_client_device_get_resources(pdev);
if (err)
- goto exit_put_clk_csus;
+ goto exit_put_regulator;
nvhost_client_device_init(pdev);
@@ -1751,6 +1771,8 @@ exit_cleanup_alloc_ctx:
exit_put_resources:
pm_runtime_disable(&pdev->dev);
nvhost_client_device_put_resources(pdev);
+exit_put_regulator:
+ regulator_put(pcdev->reg);
exit_put_clk_csus:
clk_put(pcdev->clk_csus);
exit_put_clk_isp:
@@ -1786,6 +1808,8 @@ static int tegra_camera_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
+ regulator_put(pcdev->reg);
+
clk_put(pcdev->clk_csus);
clk_put(pcdev->clk_isp);
clk_put(pcdev->clk_csi);