diff options
author | Bryan Wu <pengw@nvidia.com> | 2013-12-06 16:38:52 -0800 |
---|---|---|
committer | Bryan Wu <pengw@nvidia.com> | 2013-12-20 13:58:32 -0800 |
commit | 3d741e27e573c4b8a525fefea717aa64f2e3942c (patch) | |
tree | 28410819252865203aa5743cf6a8e4dc5eabddc4 /drivers/media/platform/soc_camera | |
parent | 2066b36b8beae7ec188a4b459a3f8822d755f118 (diff) |
media: tegra_camera: fix module loading issues
nvhost_module_init() should be called before
nvhost_client_device_init(), since nvhost_module_deinit() will be
called during module unloading
Remove pm_runtime operations, since they are handled by nvhost core.
Bug 1421146
Change-Id: I3f8876dd76b6366c7641f0a087f61e13a6d664ee
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/339528
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
Reviewed-by: Allen Martin <amartin@nvidia.com>
Diffstat (limited to 'drivers/media/platform/soc_camera')
-rw-r--r-- | drivers/media/platform/soc_camera/tegra_camera/common.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/media/platform/soc_camera/tegra_camera/common.c b/drivers/media/platform/soc_camera/tegra_camera/common.c index 9f1e23343e17..d257115258b9 100644 --- a/drivers/media/platform/soc_camera/tegra_camera/common.c +++ b/drivers/media/platform/soc_camera/tegra_camera/common.c @@ -18,7 +18,6 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> -#include <linux/pm_runtime.h> #include <linux/nvhost.h> #include <linux/of.h> #include <linux/of_device.h> @@ -34,6 +33,7 @@ #include "dev.h" #include "bus_client.h" +#include "nvhost_acm.h" #include "t114/t114.h" #include "t124/t124.h" @@ -123,12 +123,16 @@ static const struct soc_mbus_pixelfmt tegra_camera_formats[] = { static void tegra_camera_activate(struct tegra_camera_dev *cam) { struct tegra_camera_ops *cam_ops = cam->ops; + int ret; nvhost_module_busy_ext(cam->ndev); /* Enable external power */ - if (cam->reg) - regulator_enable(cam->reg); + if (cam->reg) { + ret = regulator_enable(cam->reg); + if (ret) + dev_err(&cam->ndev->dev, "enabling regulator failed\n"); + } if (cam_ops->activate) cam_ops->activate(cam); @@ -549,7 +553,6 @@ static int tegra_camera_add_device(struct soc_camera_device *icd) struct tegra_camera_dev *cam = ici->priv; if (!cam->enable_refcnt) { - pm_runtime_get_sync(ici->v4l2_dev.dev); tegra_camera_activate(cam); cam->num_frames = 0; } @@ -568,7 +571,6 @@ static void tegra_camera_remove_device(struct soc_camera_device *icd) if (!cam->enable_refcnt) { cancel_work_sync(&cam->work); tegra_camera_deactivate(cam); - pm_runtime_put_sync(ici->v4l2_dev.dev); } } @@ -863,6 +865,7 @@ static int tegra_camera_probe(struct platform_device *pdev) goto exit_deinit_clk; } + mutex_init(&ndata->lock); platform_set_drvdata(pdev, ndata); err = nvhost_client_device_get_resources(pdev); if (err) { @@ -879,6 +882,8 @@ static int tegra_camera_probe(struct platform_device *pdev) goto exit_deinit_clk; } + nvhost_module_init(pdev); + err = nvhost_client_device_init(pdev); if (err) { dev_err(&pdev->dev, "%s: nvhost init failed %d\n", @@ -886,15 +891,10 @@ static int tegra_camera_probe(struct platform_device *pdev) goto exit_deinit_clk; } - tegra_pd_add_device(&pdev->dev); - pm_runtime_use_autosuspend(&pdev->dev); - pm_runtime_set_autosuspend_delay(&pdev->dev, ndata->clockgate_delay); - pm_runtime_enable(&pdev->dev); - cam->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); if (IS_ERR(cam->alloc_ctx)) { err = PTR_ERR(cam->alloc_ctx); - goto exit_pm_disable; + goto exit_deinit_clk; } platform_set_drvdata(pdev, cam); @@ -909,8 +909,6 @@ static int tegra_camera_probe(struct platform_device *pdev) exit_cleanup_alloc_ctx: platform_set_drvdata(pdev, cam->ndata); vb2_dma_contig_cleanup_ctx(cam->alloc_ctx); -exit_pm_disable: - pm_runtime_disable(&pdev->dev); exit_deinit_clk: cam->ops->clks_deinit(cam); kfree(cam); @@ -928,11 +926,10 @@ static int tegra_camera_remove(struct platform_device *pdev) platform_set_drvdata(pdev, cam->ndata); nvhost_client_device_release(pdev); + cam->ndata->aperture[0] = NULL; vb2_dma_contig_cleanup_ctx(cam->alloc_ctx); - pm_runtime_disable(&pdev->dev); - if (cam->ops) cam->ops->clks_deinit(cam); |