diff options
author | Bryan Wu <pengw@nvidia.com> | 2013-06-03 14:40:25 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:40:29 -0700 |
commit | 6f37938ef5d32515a661a08cff7c54f50b0214bb (patch) | |
tree | 89c530852b78daed5549b9652e658d1d613b8a88 /drivers/media/platform/soc_camera | |
parent | 0b7416d63e52cffecd46b9c7ede59c6cbb30c74e (diff) |
media: tegra_v4l2: pass platform_data via soc_camera_link
soc_camera_link supports passing power on/off control callback to
soc_camera stack. So the power control can be handled by soc_camera
stack instead of our Tegra V4L2 host driver.
Also pass other platform_data fields via soc_camera_link instead of
a hacking nvhost_device_data struct.
Bug 1240806
Change-Id: I625c17680603ecd930f934bc37362a66705d90e5
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/246267
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.c | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/drivers/media/platform/soc_camera/tegra_v4l2_camera.c b/drivers/media/platform/soc_camera/tegra_v4l2_camera.c index bf2fbb50e946..180893938a3d 100644 --- a/drivers/media/platform/soc_camera/tegra_v4l2_camera.c +++ b/drivers/media/platform/soc_camera/tegra_v4l2_camera.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -976,9 +976,6 @@ static int tegra_camera_capture_stop(struct tegra_camera_dev *pcdev) static void tegra_camera_activate(struct tegra_camera_dev *pcdev) { - if (pcdev->pdata->enable_camera) - pcdev->pdata->enable_camera(pcdev->ndev); - nvhost_module_busy_ext(pcdev->ndev); /* Enable external power */ @@ -1033,9 +1030,6 @@ static void tegra_camera_deactivate(struct tegra_camera_dev *pcdev) regulator_disable(pcdev->reg); nvhost_module_idle_ext(pcdev->ndev); - - if (pcdev->pdata->disable_camera) - pcdev->pdata->disable_camera(pcdev->ndev); } static int tegra_camera_capture_frame(struct tegra_camera_dev *pcdev) @@ -1433,8 +1427,18 @@ static int tegra_camera_add_device(struct soc_camera_device *icd) struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct tegra_camera_dev *pcdev = ici->priv; - if (pcdev->icd) - return -EBUSY; + pcdev->pdata = icd->link->priv; + if (!pcdev->pdata) { + dev_err(icd->parent, "No platform data!\n"); + return -EINVAL; + } + + if (!tegra_camera_port_is_valid(pcdev->pdata->port)) { + dev_err(icd->parent, + "Invalid camera port %d in platform data\n", + pcdev->pdata->port); + return -EINVAL; + } pm_runtime_get_sync(ici->v4l2_dev.dev); @@ -1696,11 +1700,11 @@ static struct soc_camera_host_ops tegra_soc_camera_host_ops = { static struct of_device_id tegra_vi_of_match[] = { { .compatible = "nvidia,tegra20-vi", - .data = (struct nvhost_device_data *)&t20_camera_info }, + .data = (struct nvhost_device_data *)&t20_vi_info }, { .compatible = "nvidia,tegra30-vi", - .data = (struct nvhost_device_data *)&t30_camera_info }, + .data = (struct nvhost_device_data *)&t30_vi_info }, { .compatible = "nvidia,tegra114-vi", - .data = (struct nvhost_device_data *)&t11_camera_info }, + .data = (struct nvhost_device_data *)&t11_vi_info }, { }, }; @@ -1733,12 +1737,6 @@ static int tegra_camera_probe(struct platform_device *pdev) } pcdev->ndata = ndata; - pcdev->pdata = ndata->private_data; - if (!pcdev->pdata) { - dev_err(&pdev->dev, "No platform data!\n"); - err = -EINVAL; - goto exit_free_pcdev; - } pcdev->ndev = pdev; pcdev->ici.priv = pcdev; @@ -1752,12 +1750,6 @@ static int tegra_camera_probe(struct platform_device *pdev) spin_lock_init(&pcdev->videobuf_queue_lock); mutex_init(&pcdev->work_mutex); - if (!tegra_camera_port_is_valid(pcdev->pdata->port)) { - dev_err(&pdev->dev, "Invalid camera port %d in platform data\n", - pcdev->pdata->port); - goto exit_free_pcdev; - } - pcdev->clk_vi = clk_get(&pdev->dev, "vi"); if (IS_ERR_OR_NULL(pcdev->clk_vi)) { dev_err(&pdev->dev, "Failed to get vi clock.\n"); @@ -1926,9 +1918,6 @@ static int tegra_camera_suspend(struct platform_device *pdev, /* Suspend the camera sensor. */ WARN_ON(!pcdev->icd->ops->suspend); pcdev->icd->ops->suspend(pcdev->icd, state); - - /* Power off the camera subsystem. */ - pcdev->pdata->disable_camera(pcdev->ndev); } return 0; @@ -1942,9 +1931,6 @@ static int tegra_camera_resume(struct platform_device *pdev) /* We only need to do something if a camera sensor is attached. */ if (pcdev->icd) { - /* Power on the camera subsystem. */ - pcdev->pdata->enable_camera(pcdev->ndev); - /* Resume the camera host. */ tegra_camera_save_syncpts(pcdev); tegra_camera_capture_setup(pcdev); |