]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
drivers: Fix camera clock flow
authorBhanu Murthy V <bmurthyv@nvidia.com>
Thu, 2 Jun 2016 19:40:35 +0000 (12:40 -0700)
committerWenjia Zhou <wenjiaz@nvidia.com>
Wed, 27 Jul 2016 22:25:12 +0000 (15:25 -0700)
Check if the clock enable is successful.
use the misc device instead of platform device
in tegra_camera_platform to aquire the clocks.

Bug 1763471

Change-Id: I469d863411863f75286cad42d589774f170b637e
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Reviewed-on: http://git-master/r/1158283

drivers/media/platform/tegra/camera/mc_common.c
drivers/video/tegra/camera/tegra_camera_platform.c

index 5be7d71b21b0f536dac09867a941c9a3e77fd14c..2d4e3760a61c44802fa384244f1b79cdf3f1ae79 100644 (file)
@@ -76,7 +76,12 @@ int tegra_vi_power_on(struct tegra_mc_vi *vi)
        }
 
        /* clock settings */
-       clk_prepare_enable(vi->clk);
+       ret = clk_prepare_enable(vi->clk);
+       if (ret) {
+               dev_err(vi->dev, "failed to enable vi clock\n");
+               goto error_clk_enable;
+       }
+
        ret = clk_set_rate(vi->clk, 0);
        if (ret) {
                dev_err(vi->dev, "failed to set vi clock\n");
@@ -89,8 +94,9 @@ int tegra_vi_power_on(struct tegra_mc_vi *vi)
 
        return 0;
 err_emc_enable:
-       clk_disable_unprepare(vi->clk);
 error_clk_set_rate:
+       clk_disable_unprepare(vi->clk);
+error_clk_enable:
        tegra_powergate_partition(TEGRA_POWERGATE_VENC);
 error_unpowergate:
        regulator_disable(vi->reg);
index 61047ea906386806f1e3bfc5a2b4baa17be00d23..a21dc615e7cb16939eb63e58a9b242f9c861f235 100644 (file)
@@ -66,7 +66,8 @@ static const struct of_device_id tegra_camera_of_ids[] = {
 
 static struct miscdevice tegra_camera_misc;
 
-static int tegra_camera_isomgr_register(struct tegra_camera_info *info)
+static int tegra_camera_isomgr_register(struct tegra_camera_info *info,
+                                       struct device *dev)
 {
 #if defined(CONFIG_TEGRA_ISOMGR)
        int ret = 0;
@@ -80,7 +81,7 @@ static int tegra_camera_isomgr_register(struct tegra_camera_info *info)
        u32 isp_bpp = 0;
        u64 isp_iso_bw = 0;
        u32 isp_margin_pct = 0;
-       struct device_node *np = info->dev->of_node;
+       struct device_node *np = dev->of_node;
 
        dev_dbg(info->dev, "%s++\n", __func__);
 
@@ -480,7 +481,8 @@ static int tegra_camera_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        strcpy(info->devname, tegra_camera_misc.name);
-       info->dev = &pdev->dev;
+       info->dev = tegra_camera_misc.this_device;
+
 #if !defined(CONFIG_TEGRA_BWMGR)
        info->emc = devm_clk_get(info->dev, "emc");
        if (IS_ERR(info->emc)) {
@@ -497,7 +499,7 @@ static int tegra_camera_probe(struct platform_device *pdev)
 #endif
        mutex_init(&info->update_bw_lock);
        /* Register Camera as isomgr client. */
-       ret = tegra_camera_isomgr_register(info);
+       ret = tegra_camera_isomgr_register(info, &pdev->dev);
        if (ret) {
                dev_err(info->dev,
                "%s: failed to register CAMERA as isomgr client\n",