From 75bb23a67b6d16f715fd6f46ec73cc6e64547f3e Mon Sep 17 00:00:00 2001 From: Ingrid Gallardo Date: Wed, 17 Jun 2015 12:39:18 -0700 Subject: [PATCH] msm: mdss: switch mdp context between active-only and active+sleep This change modifies MDP vote to go to Active-Only in an early stage when bandwidth is not needed and updates the vote to Active+Sleep when bandwidth must be guaranteed. Change-Id: I6ccb7a225f97416128518c990d881fa139ec1963 Signed-off-by: Ingrid Gallardo --- drivers/video/fbdev/msm/mdss.h | 1 + drivers/video/fbdev/msm/mdss_mdp.c | 16 +++++++++++++++- drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/msm/mdss.h b/drivers/video/fbdev/msm/mdss.h index 69541598c54c..86c9902245dd 100644 --- a/drivers/video/fbdev/msm/mdss.h +++ b/drivers/video/fbdev/msm/mdss.h @@ -316,6 +316,7 @@ struct mdss_data_type { u32 nrt_axi_port_cnt; u32 bus_channels; u32 curr_bw_uc_idx; + u32 ao_bw_uc_idx; /* active only idx */ struct msm_bus_scale_pdata *bus_scale_table; u32 max_bw_low; u32 max_bw_high; diff --git a/drivers/video/fbdev/msm/mdss_mdp.c b/drivers/video/fbdev/msm/mdss_mdp.c index cafe4abebab6..b9173af180e0 100644 --- a/drivers/video/fbdev/msm/mdss_mdp.c +++ b/drivers/video/fbdev/msm/mdss_mdp.c @@ -397,6 +397,7 @@ static int mdss_mdp_bus_scale_set_quota(u64 ab_quota_rt, u64 ab_quota_nrt, } } mdss_res->curr_bw_uc_idx = new_uc_idx; + mdss_res->ao_bw_uc_idx = new_uc_idx; if ((mdss_res->bus_ref_cnt == 0) && mdss_res->curr_bw_uc_idx) { rc = 0; @@ -833,9 +834,11 @@ void mdss_bus_bandwidth_ctrl(int enable) if (changed) { if (!enable) { - if (!mdata->handoff_pending) + if (!mdata->handoff_pending) { msm_bus_scale_client_update_request( mdata->bus_hdl, 0); + mdata->ao_bw_uc_idx = 0; + } pm_runtime_mark_last_busy(&mdata->pdev->dev); pm_runtime_put_autosuspend(&mdata->pdev->dev); } else { @@ -880,8 +883,13 @@ void mdss_mdp_clk_ctrl(int enable) if (changed) { if (enable) { pm_runtime_get_sync(&mdata->pdev->dev); + mdss_update_reg_bus_vote(mdata->reg_bus_clt, VOTE_INDEX_19_MHZ); + + /* Active+Sleep */ + msm_bus_scale_client_update_context(mdata->bus_hdl, + false, mdata->curr_bw_uc_idx); } mdata->clk_ena = enable; @@ -893,8 +901,14 @@ void mdss_mdp_clk_ctrl(int enable) mdss_mdp_clk_update(MDSS_CLK_MDP_VSYNC, enable); if (!enable) { + + /* Active-Only */ + msm_bus_scale_client_update_context(mdata->bus_hdl, + true, mdata->ao_bw_uc_idx); + mdss_update_reg_bus_vote(mdata->reg_bus_clt, VOTE_INDEX_DISABLE); + pm_runtime_mark_last_busy(&mdata->pdev->dev); pm_runtime_put_autosuspend(&mdata->pdev->dev); } diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c b/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c index 467e8dea3029..3dfee1ec1e23 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c +++ b/drivers/video/fbdev/msm/mdss_mdp_intf_cmd.c @@ -485,6 +485,9 @@ int mdss_mdp_resource_control(struct mdss_mdp_ctl *ctl, u32 sw_event) * cancel as well. */ + /* update the active only vote */ + mdata->ao_bw_uc_idx = mdata->curr_bw_uc_idx; + /* Cancel GATE Work Item */ if (cancel_work_sync(&ctx->gate_clk_work)) { pr_debug("%s gate work canceled\n", __func__);