]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
tegra: dc: enable emc.la clock before setting
authorArun Swain <arswain@nvidia.com>
Tue, 28 Oct 2014 21:42:22 +0000 (14:42 -0700)
committerMitch Luban <mluban@nvidia.com>
Fri, 23 Jan 2015 19:46:02 +0000 (11:46 -0800)
For the emc.la floor to have effect, enable the
emc.la clock if not enabled already.

Bug 200048302

Change-Id: I616e640ed7eec854b71fb26da60037311d9b4247
Reviewed-on: http://git-master/r/590924
(cherry picked from commit 4b479fd903b8158ff1802ba0b572e102c98342bb)
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: http://git-master/r/594987
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Tested-by: Mitch Luban <mluban@nvidia.com>
drivers/video/tegra/dc/bandwidth.c
drivers/video/tegra/dc/dc.c
drivers/video/tegra/dc/dc_priv_defs.h

index ed7ea372324397bab33ee3f0229057a16f7ebc92..f4c56834167c5ba8ffe3764d5485c519efbfeb94 100644 (file)
@@ -601,8 +601,7 @@ static void tegra_dc_set_latency_allowance(struct tegra_dc *dc,
                                bw,
                                disp_params);
                if (!err) {
-                       struct clk *emc_la_clk = clk_get(&dc->ndev->dev, "emc.la");
-                       clk_set_rate(emc_la_clk, emc_freq_hz);
+                       clk_set_rate(dc->emc_la_clk, emc_freq_hz);
                        break;
                }
 
index b0c85b7f2798c1d38039a3c23c177b41a8efa9c7..d86bdeb5c0a4f184501606d93e398f966c34c7e1 100644 (file)
@@ -3197,6 +3197,8 @@ static bool _tegra_dc_controller_enable(struct tegra_dc *dc)
 
        tegra_dc_put(dc);
 
+       clk_prepare_enable(dc->emc_la_clk);
+
        return true;
 }
 #endif
@@ -3414,6 +3416,8 @@ static void _tegra_dc_controller_disable(struct tegra_dc *dc)
                tegra_dc_clk_disable(dc);
        else
                tegra_dvfs_set_rate(dc->clk, 0);
+
+       clk_disable_unprepare(dc->emc_la_clk);
 }
 
 void tegra_dc_stats_enable(struct tegra_dc *dc, bool enable)
@@ -3733,6 +3737,7 @@ static int tegra_dc_probe(struct platform_device *ndev)
 #else
        int isomgr_client_id = -1;
 #endif
+       struct clk *emc_la_clk;
        struct device_node *np = ndev->dev.of_node;
        struct resource *res;
        struct resource dt_res;
@@ -4065,6 +4070,18 @@ static int tegra_dc_probe(struct platform_device *ndev)
                }
                dc->emc_clk = emc_clk;
 #endif
+               /*
+                * The emc_la clock is being added to set the floor value
+                * for emc depending on the LA calculaions for each window
+                */
+               emc_la_clk = clk_get(&ndev->dev, "emc.la");
+               if (IS_ERR_OR_NULL(emc_la_clk)) {
+                       dev_err(&ndev->dev, "can't get emc.la clock\n");
+                       ret = -ENOENT;
+                       goto err_put_clk;
+               }
+               dc->emc_la_clk = emc_la_clk;
+               clk_set_rate(dc->emc_la_clk, 0);
 
 #ifdef CONFIG_TEGRA_DC_EXTENSIONS
        dc->ext = tegra_dc_ext_register(ndev, dc);
@@ -4243,6 +4260,7 @@ err_disable_dc:
 #else
        clk_put(emc_clk);
 #endif
+       clk_put(dc->emc_la_clk);
 err_put_clk:
 #ifdef CONFIG_SWITCH
        if (dc->switchdev_registered)
@@ -4320,6 +4338,8 @@ static int tegra_dc_remove(struct platform_device *ndev)
 #else
        clk_put(dc->emc_clk);
 #endif
+       clk_put(dc->emc_la_clk);
+
        clk_put(dc->clk);
        iounmap(dc->base);
        if (dc->fb_mem)
index edd1c4ea41c7a7b9c1676e1b948c73f6afc50da3..0d593082c8dc08e506033d33b4ab6648eebff726 100644 (file)
@@ -161,6 +161,7 @@ struct tegra_dc {
 #else
        struct clk                      *emc_clk;
 #endif
+       struct clk                      *emc_la_clk;
        long                            bw_kbps; /* bandwidth in KBps */
        long                            new_bw_kbps;
        struct tegra_dc_shift_clk_div   shift_clk_div;