media: video: tegra: avp_svc: Force memory bus to full when avp is enabled
authorColin Cross <ccross@android.com>
Wed, 8 Dec 2010 02:47:38 +0000 (18:47 -0800)
committerColin Cross <ccross@android.com>
Thu, 9 Dec 2010 03:44:29 +0000 (19:44 -0800)
Change-Id: I51382f58f296df939f99d60926ba97f0b4e04aed
Signed-off-by: Colin Cross <ccross@android.com>
drivers/media/video/tegra/avp/avp_svc.c

index 57cd8019c3051d91953cca2d74f9d269b507c1c8..2eed2891e556e5e4f849493a218b0e4a2c9afb9b 100644 (file)
@@ -82,6 +82,7 @@ struct avp_svc_info {
        struct avp_clk                  clks[NUM_CLK_REQUESTS];
        /* used for dvfs */
        struct clk                      *sclk;
+       struct clk                      *emcclk;
 
        struct mutex                    clk_lock;
 
@@ -352,6 +353,7 @@ static void do_svc_module_clock(struct avp_svc_info *avp_svc,
        aclk = &avp_svc->clks[mod->clk_req];
        if (msg->enable) {
                if (aclk->refcnt++ == 0) {
+                       clk_enable(avp_svc->emcclk);
                        clk_enable(avp_svc->sclk);
                        clk_enable(aclk->clk);
                }
@@ -362,6 +364,7 @@ static void do_svc_module_clock(struct avp_svc_info *avp_svc,
                } else if (--aclk->refcnt == 0) {
                        clk_disable(aclk->clk);
                        clk_disable(avp_svc->sclk);
+                       clk_disable(avp_svc->emcclk);
                }
        }
        mutex_unlock(&avp_svc->clk_lock);
@@ -631,8 +634,9 @@ void avp_svc_stop(struct avp_svc_info *avp_svc)
                        pr_info("%s: remote left clock '%s' on\n", __func__,
                                aclk->mod->name);
                        clk_disable(aclk->clk);
-                       /* sclk was enabled once for every clock */
+                       /* sclk/emcclk was enabled once for every clock */
                        clk_disable(avp_svc->sclk);
+                       clk_disable(avp_svc->emcclk);
                }
                aclk->refcnt = 0;
        }
@@ -682,6 +686,21 @@ struct avp_svc_info *avp_svc_init(struct platform_device *pdev,
                ret = -ENOENT;
                goto err_get_clks;
        }
+
+       avp_svc->emcclk = clk_get(&pdev->dev, "emc");
+       if (IS_ERR(avp_svc->emcclk)) {
+               pr_err("avp_svc: Couldn't get emcclk for dvfs\n");
+               ret = -ENOENT;
+               goto err_get_clks;
+       }
+
+       /*
+        * The emc is a shared clock, it will be set to the highest
+        * requested rate from any user.  Set the rate to ULONG_MAX to
+        * always request the max rate whenever this request is enabled
+        */
+       clk_set_rate(avp_svc->emcclk, ULONG_MAX);
+
        avp_svc->rpc_node = rpc_node;
 
        mutex_init(&avp_svc->clk_lock);
@@ -694,6 +713,8 @@ err_get_clks:
                        clk_put(avp_svc->clks[i].clk);
        if (!IS_ERR_OR_NULL(avp_svc->sclk))
                clk_put(avp_svc->sclk);
+       if (!IS_ERR_OR_NULL(avp_svc->emcclk))
+               clk_put(avp_svc->emcclk);
 err_alloc:
        return ERR_PTR(ret);
 }
@@ -705,6 +726,7 @@ void avp_svc_destroy(struct avp_svc_info *avp_svc)
        for (i = 0; i < NUM_CLK_REQUESTS; i++)
                clk_put(avp_svc->clks[i].clk);
        clk_put(avp_svc->sclk);
+       clk_put(avp_svc->emcclk);
 
        kfree(avp_svc);
 }