msm: mdss: clean-up terminology used for different bus bw votes
Current driver votes for bandwidth on two different kinds of buses, data (AXI) and register (AHB). However terminology used to track these voting is not consistent and easily lead to misunderstanding. Clean-up some of these terminology to make driver code more readable. Change-Id: I54d636125786876e8326d6c0279b5a76a1591ae9 Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
This commit is contained in:
parent
fdec367b00
commit
3f2675c9cd
5 changed files with 48 additions and 46 deletions
|
@ -285,11 +285,20 @@ struct mdss_data_type {
|
||||||
|
|
||||||
u32 rot_block_size;
|
u32 rot_block_size;
|
||||||
|
|
||||||
|
/* data bus (AXI) */
|
||||||
|
u32 bus_hdl;
|
||||||
|
u32 bus_ref_cnt;
|
||||||
|
struct mutex bus_lock;
|
||||||
|
|
||||||
|
/* register bus (AHB) */
|
||||||
|
u32 reg_bus_hdl;
|
||||||
|
u32 reg_bus_ref_cnt;
|
||||||
|
struct mutex reg_bus_lock;
|
||||||
|
|
||||||
u32 axi_port_cnt;
|
u32 axi_port_cnt;
|
||||||
u32 nrt_axi_port_cnt;
|
u32 nrt_axi_port_cnt;
|
||||||
u32 bus_channels;
|
u32 bus_channels;
|
||||||
u32 curr_bw_uc_idx;
|
u32 curr_bw_uc_idx;
|
||||||
u32 bus_hdl;
|
|
||||||
struct msm_bus_scale_pdata *bus_scale_table;
|
struct msm_bus_scale_pdata *bus_scale_table;
|
||||||
u32 max_bw_low;
|
u32 max_bw_low;
|
||||||
u32 max_bw_high;
|
u32 max_bw_high;
|
||||||
|
@ -297,10 +306,6 @@ struct mdss_data_type {
|
||||||
u32 *vbif_rt_qos;
|
u32 *vbif_rt_qos;
|
||||||
u32 *vbif_nrt_qos;
|
u32 *vbif_nrt_qos;
|
||||||
u32 npriority_lvl;
|
u32 npriority_lvl;
|
||||||
u32 bus_bw_cnt;
|
|
||||||
struct mutex bus_bw_lock;
|
|
||||||
|
|
||||||
u32 reg_bus_hdl;
|
|
||||||
|
|
||||||
struct mdss_fudge_factor ab_factor;
|
struct mdss_fudge_factor ab_factor;
|
||||||
struct mdss_fudge_factor ib_factor;
|
struct mdss_fudge_factor ib_factor;
|
||||||
|
@ -398,9 +403,6 @@ struct mdss_data_type {
|
||||||
struct mdss_mdp_dsc *dsc_off;
|
struct mdss_mdp_dsc *dsc_off;
|
||||||
u32 ndsc;
|
u32 ndsc;
|
||||||
|
|
||||||
struct mutex mdp_bus_lock;
|
|
||||||
u32 bus_ref_cnt;
|
|
||||||
|
|
||||||
struct mdss_max_bw_settings *max_bw_settings;
|
struct mdss_max_bw_settings *max_bw_settings;
|
||||||
u32 bw_mode_bitmap;
|
u32 bw_mode_bitmap;
|
||||||
u32 max_bw_settings_cnt;
|
u32 max_bw_settings_cnt;
|
||||||
|
@ -425,7 +427,7 @@ struct irq_info *mdss_intr_line(void);
|
||||||
void mdss_bus_bandwidth_ctrl(int enable);
|
void mdss_bus_bandwidth_ctrl(int enable);
|
||||||
int mdss_iommu_ctrl(int enable);
|
int mdss_iommu_ctrl(int enable);
|
||||||
int mdss_bus_scale_set_quota(int client, u64 ab_quota, u64 ib_quota);
|
int mdss_bus_scale_set_quota(int client, u64 ab_quota, u64 ib_quota);
|
||||||
int mdss_enable_bus_vote(int usecase_ndx);
|
int mdss_update_reg_bus_vote(int usecase_ndx);
|
||||||
|
|
||||||
struct mdss_util_intf {
|
struct mdss_util_intf {
|
||||||
bool mdp_probe_done;
|
bool mdp_probe_done;
|
||||||
|
|
|
@ -2199,7 +2199,7 @@ static int hdmi_tx_enable_power(struct hdmi_tx_ctrl *hdmi_ctrl,
|
||||||
__func__, hdmi_tx_pm_name(module), rc);
|
__func__, hdmi_tx_pm_name(module), rc);
|
||||||
goto disable_vreg;
|
goto disable_vreg;
|
||||||
}
|
}
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_19_MHZ);
|
mdss_update_reg_bus_vote(VOTE_INDEX_19_MHZ);
|
||||||
|
|
||||||
rc = msm_dss_clk_set_rate(power_data->clk_config,
|
rc = msm_dss_clk_set_rate(power_data->clk_config,
|
||||||
power_data->num_clk);
|
power_data->num_clk);
|
||||||
|
@ -2219,7 +2219,7 @@ static int hdmi_tx_enable_power(struct hdmi_tx_ctrl *hdmi_ctrl,
|
||||||
} else {
|
} else {
|
||||||
msm_dss_enable_clk(power_data->clk_config,
|
msm_dss_enable_clk(power_data->clk_config,
|
||||||
power_data->num_clk, 0);
|
power_data->num_clk, 0);
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_DISABLE);
|
mdss_update_reg_bus_vote(VOTE_INDEX_DISABLE);
|
||||||
msm_dss_enable_gpio(power_data->gpio_config,
|
msm_dss_enable_gpio(power_data->gpio_config,
|
||||||
power_data->num_gpio, 0);
|
power_data->num_gpio, 0);
|
||||||
hdmi_tx_pinctrl_set_state(hdmi_ctrl, module, 0);
|
hdmi_tx_pinctrl_set_state(hdmi_ctrl, module, 0);
|
||||||
|
@ -2230,7 +2230,7 @@ static int hdmi_tx_enable_power(struct hdmi_tx_ctrl *hdmi_ctrl,
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
disable_gpio:
|
disable_gpio:
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_DISABLE);
|
mdss_update_reg_bus_vote(VOTE_INDEX_DISABLE);
|
||||||
msm_dss_enable_gpio(power_data->gpio_config, power_data->num_gpio, 0);
|
msm_dss_enable_gpio(power_data->gpio_config, power_data->num_gpio, 0);
|
||||||
disable_vreg:
|
disable_vreg:
|
||||||
msm_dss_enable_vreg(power_data->vreg_config, power_data->num_vreg, 0);
|
msm_dss_enable_vreg(power_data->vreg_config, power_data->num_vreg, 0);
|
||||||
|
|
|
@ -303,7 +303,7 @@ static void mdss_mdp_bus_scale_unregister(struct mdss_data_type *mdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Caller needs to hold mdata->bus_bw_lock lock before calling this function.
|
* Caller needs to hold mdata->bus_lock lock before calling this function.
|
||||||
*/
|
*/
|
||||||
static int mdss_mdp_bus_scale_set_quota(u64 ab_quota_rt, u64 ab_quota_nrt,
|
static int mdss_mdp_bus_scale_set_quota(u64 ab_quota_rt, u64 ab_quota_nrt,
|
||||||
u64 ib_quota_rt, u64 ib_quota_nrt)
|
u64 ib_quota_rt, u64 ib_quota_nrt)
|
||||||
|
@ -398,7 +398,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->curr_bw_uc_idx = new_uc_idx;
|
||||||
|
|
||||||
if ((mdss_res->bus_bw_cnt == 0) && mdss_res->curr_bw_uc_idx) {
|
if ((mdss_res->bus_ref_cnt == 0) && mdss_res->curr_bw_uc_idx) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else { /* vote BW if bus_bw_cnt > 0 or uc_idx is zero */
|
} else { /* vote BW if bus_bw_cnt > 0 or uc_idx is zero */
|
||||||
ATRACE_BEGIN("msm_bus_scale_req");
|
ATRACE_BEGIN("msm_bus_scale_req");
|
||||||
|
@ -409,35 +409,35 @@ static int mdss_mdp_bus_scale_set_quota(u64 ab_quota_rt, u64 ab_quota_nrt,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mdss_enable_bus_vote(int usecase_ndx)
|
int mdss_update_reg_bus_vote(int usecase_ndx)
|
||||||
{
|
{
|
||||||
int changed = 0, ret = 0;
|
int changed = 0, ret = 0;
|
||||||
|
|
||||||
if (!mdss_res || !mdss_res->reg_bus_hdl)
|
if (!mdss_res || !mdss_res->reg_bus_hdl)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mutex_lock(&mdss_res->mdp_bus_lock);
|
mutex_lock(&mdss_res->reg_bus_lock);
|
||||||
if (usecase_ndx) {
|
if (usecase_ndx) {
|
||||||
if (mdss_res->bus_ref_cnt == 0)
|
if (mdss_res->reg_bus_ref_cnt == 0)
|
||||||
changed++;
|
changed++;
|
||||||
mdss_res->bus_ref_cnt++;
|
mdss_res->reg_bus_ref_cnt++;
|
||||||
} else {
|
} else {
|
||||||
if (mdss_res->bus_ref_cnt) {
|
if (mdss_res->reg_bus_ref_cnt) {
|
||||||
mdss_res->bus_ref_cnt--;
|
mdss_res->reg_bus_ref_cnt--;
|
||||||
if (mdss_res->bus_ref_cnt == 0)
|
if (mdss_res->reg_bus_ref_cnt == 0)
|
||||||
changed++;
|
changed++;
|
||||||
} else {
|
} else {
|
||||||
pr_err("Can not be turned off\n");
|
pr_err("Can not be turned off\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("%s: clk_cnt=%d changed=%d usecase_index=%d\n",
|
pr_debug("clk_cnt=%d changed=%d usecase_index=%d\n",
|
||||||
__func__, mdss_res->bus_ref_cnt, changed, usecase_ndx);
|
mdss_res->reg_bus_ref_cnt, changed, usecase_ndx);
|
||||||
if (changed)
|
if (changed)
|
||||||
ret = msm_bus_scale_client_update_request(mdss_res->reg_bus_hdl,
|
ret = msm_bus_scale_client_update_request(mdss_res->reg_bus_hdl,
|
||||||
usecase_ndx);
|
usecase_ndx);
|
||||||
|
|
||||||
mutex_unlock(&mdss_res->mdp_bus_lock);
|
mutex_unlock(&mdss_res->reg_bus_lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ int mdss_bus_scale_set_quota(int client, u64 ab_quota, u64 ib_quota)
|
||||||
u64 total_ab_rt = 0, total_ib_rt = 0;
|
u64 total_ab_rt = 0, total_ib_rt = 0;
|
||||||
u64 total_ab_nrt = 0, total_ib_nrt = 0;
|
u64 total_ab_nrt = 0, total_ib_nrt = 0;
|
||||||
|
|
||||||
mutex_lock(&mdss_res->bus_bw_lock);
|
mutex_lock(&mdss_res->bus_lock);
|
||||||
|
|
||||||
mdss_res->ab[client] = ab_quota;
|
mdss_res->ab[client] = ab_quota;
|
||||||
mdss_res->ib[client] = ib_quota;
|
mdss_res->ib[client] = ib_quota;
|
||||||
|
@ -468,7 +468,7 @@ int mdss_bus_scale_set_quota(int client, u64 ab_quota, u64 ib_quota)
|
||||||
rc = mdss_mdp_bus_scale_set_quota(total_ab_rt, total_ab_nrt,
|
rc = mdss_mdp_bus_scale_set_quota(total_ab_rt, total_ab_nrt,
|
||||||
total_ib_rt, total_ib_nrt);
|
total_ib_rt, total_ib_nrt);
|
||||||
|
|
||||||
mutex_unlock(&mdss_res->bus_bw_lock);
|
mutex_unlock(&mdss_res->bus_lock);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -780,15 +780,15 @@ void mdss_bus_bandwidth_ctrl(int enable)
|
||||||
struct mdss_data_type *mdata = mdss_mdp_get_mdata();
|
struct mdss_data_type *mdata = mdss_mdp_get_mdata();
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
|
|
||||||
mutex_lock(&mdata->bus_bw_lock);
|
mutex_lock(&mdata->bus_lock);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
if (mdata->bus_bw_cnt == 0)
|
if (mdata->bus_ref_cnt == 0)
|
||||||
changed++;
|
changed++;
|
||||||
mdata->bus_bw_cnt++;
|
mdata->bus_ref_cnt++;
|
||||||
} else {
|
} else {
|
||||||
if (mdata->bus_bw_cnt) {
|
if (mdata->bus_ref_cnt) {
|
||||||
mdata->bus_bw_cnt--;
|
mdata->bus_ref_cnt--;
|
||||||
if (mdata->bus_bw_cnt == 0)
|
if (mdata->bus_ref_cnt == 0)
|
||||||
changed++;
|
changed++;
|
||||||
} else {
|
} else {
|
||||||
pr_err("Can not be turned off\n");
|
pr_err("Can not be turned off\n");
|
||||||
|
@ -796,7 +796,7 @@ void mdss_bus_bandwidth_ctrl(int enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("bw_cnt=%d changed=%d enable=%d\n",
|
pr_debug("bw_cnt=%d changed=%d enable=%d\n",
|
||||||
mdata->bus_bw_cnt, changed, enable);
|
mdata->bus_ref_cnt, changed, enable);
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
if (!enable) {
|
if (!enable) {
|
||||||
|
@ -812,7 +812,7 @@ void mdss_bus_bandwidth_ctrl(int enable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&mdata->bus_bw_lock);
|
mutex_unlock(&mdata->bus_lock);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mdss_bus_bandwidth_ctrl);
|
EXPORT_SYMBOL(mdss_bus_bandwidth_ctrl);
|
||||||
|
|
||||||
|
@ -846,7 +846,7 @@ void mdss_mdp_clk_ctrl(int enable)
|
||||||
if (changed) {
|
if (changed) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
pm_runtime_get_sync(&mdata->pdev->dev);
|
pm_runtime_get_sync(&mdata->pdev->dev);
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_19_MHZ);
|
mdss_update_reg_bus_vote(VOTE_INDEX_19_MHZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
mdata->clk_ena = enable;
|
mdata->clk_ena = enable;
|
||||||
|
@ -859,7 +859,7 @@ void mdss_mdp_clk_ctrl(int enable)
|
||||||
mdss_mdp_clk_update(MDSS_CLK_MDP_VSYNC, enable);
|
mdss_mdp_clk_update(MDSS_CLK_MDP_VSYNC, enable);
|
||||||
|
|
||||||
if (!enable) {
|
if (!enable) {
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_DISABLE);
|
mdss_update_reg_bus_vote(VOTE_INDEX_DISABLE);
|
||||||
pm_runtime_mark_last_busy(&mdata->pdev->dev);
|
pm_runtime_mark_last_busy(&mdata->pdev->dev);
|
||||||
pm_runtime_put_autosuspend(&mdata->pdev->dev);
|
pm_runtime_put_autosuspend(&mdata->pdev->dev);
|
||||||
}
|
}
|
||||||
|
@ -901,7 +901,7 @@ static void __mdss_restore_sec_cfg(struct mdss_data_type *mdata)
|
||||||
|
|
||||||
pr_debug("restoring mdss secure config\n");
|
pr_debug("restoring mdss secure config\n");
|
||||||
|
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_19_MHZ);
|
mdss_update_reg_bus_vote(VOTE_INDEX_19_MHZ);
|
||||||
mdss_mdp_clk_update(MDSS_CLK_AHB, 1);
|
mdss_mdp_clk_update(MDSS_CLK_AHB, 1);
|
||||||
mdss_mdp_clk_update(MDSS_CLK_AXI, 1);
|
mdss_mdp_clk_update(MDSS_CLK_AXI, 1);
|
||||||
mdss_mdp_clk_update(MDSS_CLK_MDP_CORE, 1);
|
mdss_mdp_clk_update(MDSS_CLK_MDP_CORE, 1);
|
||||||
|
@ -912,7 +912,7 @@ static void __mdss_restore_sec_cfg(struct mdss_data_type *mdata)
|
||||||
ret, scm_ret);
|
ret, scm_ret);
|
||||||
|
|
||||||
mdss_mdp_clk_update(MDSS_CLK_AHB, 0);
|
mdss_mdp_clk_update(MDSS_CLK_AHB, 0);
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_DISABLE);
|
mdss_update_reg_bus_vote(VOTE_INDEX_DISABLE);
|
||||||
mdss_mdp_clk_update(MDSS_CLK_AXI, 0);
|
mdss_mdp_clk_update(MDSS_CLK_AXI, 0);
|
||||||
mdss_mdp_clk_update(MDSS_CLK_MDP_CORE, 0);
|
mdss_mdp_clk_update(MDSS_CLK_MDP_CORE, 0);
|
||||||
}
|
}
|
||||||
|
@ -1501,8 +1501,8 @@ static int mdss_mdp_probe(struct platform_device *pdev)
|
||||||
platform_set_drvdata(pdev, mdata);
|
platform_set_drvdata(pdev, mdata);
|
||||||
mdss_res = mdata;
|
mdss_res = mdata;
|
||||||
mutex_init(&mdata->reg_lock);
|
mutex_init(&mdata->reg_lock);
|
||||||
mutex_init(&mdata->mdp_bus_lock);
|
mutex_init(&mdata->reg_bus_lock);
|
||||||
mutex_init(&mdata->bus_bw_lock);
|
mutex_init(&mdata->bus_lock);
|
||||||
atomic_set(&mdata->sd_client_count, 0);
|
atomic_set(&mdata->sd_client_count, 0);
|
||||||
atomic_set(&mdata->active_intf_cnt, 0);
|
atomic_set(&mdata->active_intf_cnt, 0);
|
||||||
|
|
||||||
|
|
|
@ -113,18 +113,18 @@ static int mdss_smmu_enable_power(struct dss_module_power *mp, bool enable)
|
||||||
pr_err("vreg enable failed - rc:%d\n", rc);
|
pr_err("vreg enable failed - rc:%d\n", rc);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_19_MHZ);
|
mdss_update_reg_bus_vote(VOTE_INDEX_19_MHZ);
|
||||||
rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true);
|
rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
pr_err("clock enable failed - rc:%d\n", rc);
|
pr_err("clock enable failed - rc:%d\n", rc);
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_DISABLE);
|
mdss_update_reg_bus_vote(VOTE_INDEX_DISABLE);
|
||||||
msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg,
|
msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg,
|
||||||
false);
|
false);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msm_dss_enable_clk(mp->clk_config, mp->num_clk, false);
|
msm_dss_enable_clk(mp->clk_config, mp->num_clk, false);
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_DISABLE);
|
mdss_update_reg_bus_vote(VOTE_INDEX_DISABLE);
|
||||||
msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg, false);
|
msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg, false);
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
|
|
|
@ -945,7 +945,7 @@ static int mdss_dsi_bus_clk_start(struct mdss_dsi_ctrl_pdata *ctrl_pdata)
|
||||||
__func__, rc);
|
__func__, rc);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_19_MHZ);
|
mdss_update_reg_bus_vote(VOTE_INDEX_19_MHZ);
|
||||||
|
|
||||||
rc = clk_prepare_enable(ctrl_pdata->ahb_clk);
|
rc = clk_prepare_enable(ctrl_pdata->ahb_clk);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
@ -974,7 +974,7 @@ disable_axi_clk:
|
||||||
disable_ahb_clk:
|
disable_ahb_clk:
|
||||||
clk_disable_unprepare(ctrl_pdata->ahb_clk);
|
clk_disable_unprepare(ctrl_pdata->ahb_clk);
|
||||||
disable_core_clk:
|
disable_core_clk:
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_DISABLE);
|
mdss_update_reg_bus_vote(VOTE_INDEX_DISABLE);
|
||||||
clk_disable_unprepare(ctrl_pdata->mdp_core_clk);
|
clk_disable_unprepare(ctrl_pdata->mdp_core_clk);
|
||||||
error:
|
error:
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -986,7 +986,7 @@ static void mdss_dsi_bus_clk_stop(struct mdss_dsi_ctrl_pdata *ctrl_pdata)
|
||||||
clk_disable_unprepare(ctrl_pdata->mmss_misc_ahb_clk);
|
clk_disable_unprepare(ctrl_pdata->mmss_misc_ahb_clk);
|
||||||
clk_disable_unprepare(ctrl_pdata->axi_clk);
|
clk_disable_unprepare(ctrl_pdata->axi_clk);
|
||||||
clk_disable_unprepare(ctrl_pdata->ahb_clk);
|
clk_disable_unprepare(ctrl_pdata->ahb_clk);
|
||||||
mdss_enable_bus_vote(VOTE_INDEX_DISABLE);
|
mdss_update_reg_bus_vote(VOTE_INDEX_DISABLE);
|
||||||
clk_disable_unprepare(ctrl_pdata->mdp_core_clk);
|
clk_disable_unprepare(ctrl_pdata->mdp_core_clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue