summaryrefslogtreecommitdiff
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMayuresh Kulkarni <mkulkarni@nvidia.com>2011-09-19 17:23:58 +0530
committerSimone Willett <swillett@nvidia.com>2011-09-26 10:47:18 -0700
commit5c01c2e99b44ed52cda27695b2a70a2beb5b7d45 (patch)
treed8209f8bcaae1ec416567a08805328fce5d464f2 /drivers/media/video
parent9dc6277e84a504d30dd5c07853301decf66c3060 (diff)
video: tegra: avp: set emc to max if avp clock is max
this change ensures that emc clock is set to maximum when avp clock goes maximum. it over-rides the emc clock send by platform data when avp clock is maximum. it restores the platform specific emc clock (if any) when the next non-maximum avp clock request comes. if no emc platform specific clock is specified, it restores the maximum emc clock for bug 876402 Change-Id: Id5e454a5a63b1679906d8612c6e24958bace1663 Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-on: http://git-master/r/53193 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: Mohan Nimaje <mnimaje@nvidia.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/tegra/avp/avp_svc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/media/video/tegra/avp/avp_svc.c b/drivers/media/video/tegra/avp/avp_svc.c
index 37a8ecdf7d0a..9b253e1cbe4d 100644
--- a/drivers/media/video/tegra/avp/avp_svc.c
+++ b/drivers/media/video/tegra/avp/avp_svc.c
@@ -100,6 +100,8 @@ struct avp_svc_info {
/* client for remote allocations, for easy tear down */
struct nvmap_client *nvmap_remote;
struct trpc_node *rpc_node;
+ unsigned long max_avp_rate;
+ unsigned long emc_rate;
};
static void do_svc_nvmap_create(struct avp_svc_info *avp_svc,
@@ -462,6 +464,18 @@ static void do_svc_module_clock_set(struct avp_svc_info *avp_svc,
mutex_lock(&avp_svc->clk_lock);
if (msg->module_id == AVP_MODULE_ID_AVP) {
+ /* check if max avp clock is asked and set max emc frequency */
+ if (msg->clk_freq >= avp_svc->max_avp_rate) {
+ clk_set_rate(avp_svc->emcclk, ULONG_MAX);
+ }
+ else {
+ /* if no, set emc frequency as per platform data.
+ * if no platform data is send, set it to maximum */
+ if (avp_svc->emc_rate)
+ clk_set_rate(avp_svc->emcclk, avp_svc->emc_rate);
+ else
+ clk_set_rate(avp_svc->emcclk, ULONG_MAX);
+ }
ret = clk_set_rate(avp_svc->sclk, msg->clk_freq);
} else {
aclk = &avp_svc->clks[mod->clk_req];
@@ -806,6 +820,7 @@ struct avp_svc_info *avp_svc_init(struct platform_device *pdev,
ret = -ENOENT;
goto err_get_clks;
}
+ avp_svc->max_avp_rate = clk_round_rate(avp_svc->sclk, ULONG_MAX);
clk_set_rate(avp_svc->sclk, 0);
avp_svc->emcclk = clk_get(&pdev->dev, "emc");
@@ -820,8 +835,11 @@ struct avp_svc_info *avp_svc_init(struct platform_device *pdev,
* requested in platform data. Set the rate to ULONG_MAX
* if platform data is NULL.
*/
- if (pdata)
+ avp_svc->emc_rate = 0;
+ if (pdata) {
clk_set_rate(avp_svc->emcclk, pdata->emc_clk_rate);
+ avp_svc->emc_rate = pdata->emc_clk_rate;
+ }
else
clk_set_rate(avp_svc->emcclk, ULONG_MAX);