msm: mdss: move mdss fudge factors to device-tree
MDSS has a common driver for multiple chip-sets. Each of these chip-sets can have their own fudge factors for calculations of resource demand. Move these pre-defined fudge factors to device-tree since they are platform dependent. Change-Id: Ia558a2ad0a096b49cdabf41dd25cf30c843149c4 Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
This commit is contained in:
parent
c556651f22
commit
288c2f2bd4
4 changed files with 86 additions and 11 deletions
|
@ -185,6 +185,26 @@ Optional properties:
|
|||
any, following first one denotes indexes of MMBs
|
||||
to that RGB pipe.
|
||||
|
||||
Fudge Factors: Fudge factors are used to boost demand for
|
||||
resources like bus bandswidth, clk rate etc. to
|
||||
overcome system inefficiencies and avoid any
|
||||
glitches. These fudge factors are expressed in
|
||||
terms of numerator and denominator. First value
|
||||
is numerator followed by denominator. They all
|
||||
are optional but highly recommended.
|
||||
Ex:
|
||||
x = value to be fudged
|
||||
a = numerator, default value is 1
|
||||
b = denominator, default value is 1
|
||||
FUDGE(x, a, b) = ((x * a) / b)
|
||||
- qcom,mdss-ib-factor: This fudge factor is applied to calculated ib
|
||||
values in default conditions.
|
||||
- qcom,mdss-high-ib-factor: This fudge factor is applied to calculated ib
|
||||
values. Use of this factor is determined by the
|
||||
driver and open new use-cases.
|
||||
- qcom,mdss-clk-factor: This fudge factor is applied to calculated mdp
|
||||
clk rate in default conditions.
|
||||
|
||||
Optional subnodes:
|
||||
Child nodes representing the frame buffer virtual devices.
|
||||
|
||||
|
@ -242,6 +262,12 @@ Example:
|
|||
<22 512 0 6400000>, <23 512 0 6400000>,
|
||||
<22 512 0 6400000>, <23 512 0 6400000>;
|
||||
|
||||
/* Fudge factors */
|
||||
qcom,mdss-ab-factor = <2 1>; /* 2 times */
|
||||
qcom,mdss-ib-factor = <3 2>; /* 1.5 times */
|
||||
qcom,mdss-high-ib-factor = <2 1>; /* 2 times */
|
||||
qcom,mdss-clk-factor = <5 4>; /* 1.25 times */
|
||||
|
||||
qcom,max-clk-rate = <320000000>;
|
||||
qcom,vbif-settings = <0x0004 0x00000001>,
|
||||
<0x00D8 0x00000707>;
|
||||
|
|
|
@ -66,6 +66,11 @@ struct mdss_debug_inf {
|
|||
void (*debug_enable_clock)(int on);
|
||||
};
|
||||
|
||||
struct mdss_fudge_factor {
|
||||
u32 numer;
|
||||
u32 denom;
|
||||
};
|
||||
|
||||
struct mdss_data_type {
|
||||
u32 mdp_rev;
|
||||
struct clk *mdp_clk[MDSS_MAX_CLK];
|
||||
|
@ -112,6 +117,11 @@ struct mdss_data_type {
|
|||
u32 bus_hdl;
|
||||
struct msm_bus_scale_pdata *bus_scale_table;
|
||||
|
||||
struct mdss_fudge_factor ab_factor;
|
||||
struct mdss_fudge_factor ib_factor;
|
||||
struct mdss_fudge_factor high_ib_factor;
|
||||
struct mdss_fudge_factor clk_factor;
|
||||
|
||||
struct mdss_hw_settings *hw_settings;
|
||||
|
||||
struct mdss_mdp_pipe *vig_pipes;
|
||||
|
|
|
@ -1944,6 +1944,24 @@ static int mdss_mdp_parse_dt_smp(struct platform_device *pdev)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void mdss_mdp_parse_dt_fudge_factors(struct platform_device *pdev,
|
||||
char *prop_name, struct mdss_fudge_factor *ff)
|
||||
{
|
||||
int rc;
|
||||
u32 data[2] = {0, 0};
|
||||
|
||||
ff->numer = 1;
|
||||
ff->denom = 1;
|
||||
|
||||
rc = mdss_mdp_parse_dt_handler(pdev, prop_name, data, 2);
|
||||
if (rc) {
|
||||
pr_debug("err reading %s\n", prop_name);
|
||||
} else {
|
||||
ff->numer = data[0];
|
||||
ff->denom = data[1];
|
||||
}
|
||||
}
|
||||
|
||||
static int mdss_mdp_parse_dt_misc(struct platform_device *pdev)
|
||||
{
|
||||
struct mdss_data_type *mdata = platform_get_drvdata(pdev);
|
||||
|
@ -1968,6 +1986,15 @@ static int mdss_mdp_parse_dt_misc(struct platform_device *pdev)
|
|||
if (rc)
|
||||
pr_debug("Could not read optional property: highest bank bit\n");
|
||||
|
||||
mdss_mdp_parse_dt_fudge_factors(pdev, "qcom,mdss-ab-factor",
|
||||
&mdata->ab_factor);
|
||||
mdss_mdp_parse_dt_fudge_factors(pdev, "qcom,mdss-ib-factor",
|
||||
&mdata->ib_factor);
|
||||
mdss_mdp_parse_dt_fudge_factors(pdev, "qcom,mdss-high-ib-factor",
|
||||
&mdata->high_ib_factor);
|
||||
mdss_mdp_parse_dt_fudge_factors(pdev, "qcom,mdss-clk-factor",
|
||||
&mdata->clk_factor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,14 +24,26 @@
|
|||
|
||||
/* truncate at 1k */
|
||||
#define MDSS_MDP_BUS_FACTOR_SHIFT 10
|
||||
/* 1.5 bus fudge factor */
|
||||
#define MDSS_MDP_BUS_FUDGE_FACTOR_IB(val) (((val) / 2) * 3)
|
||||
#define MDSS_MDP_BUS_FUDGE_FACTOR_HIGH_IB(val) (val << 1)
|
||||
#define MDSS_MDP_BUS_FUDGE_FACTOR_AB(val) (val << 1)
|
||||
#define MDSS_MDP_BUS_FLOOR_BW (1600000000ULL >> MDSS_MDP_BUS_FACTOR_SHIFT)
|
||||
|
||||
/* 1.25 clock fudge factor */
|
||||
#define MDSS_MDP_CLK_FUDGE_FACTOR(val) (((val) * 5) / 4)
|
||||
static inline u64 fudge_factor(u64 val, u32 numer, u32 denom)
|
||||
{
|
||||
u64 result = (val * (u64)numer);
|
||||
do_div(result, denom);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define AB_FUDGE_FACTOR(val) fudge_factor((val), \
|
||||
(mdss_res->ab_factor.numer), (mdss_res->ab_factor.denom))
|
||||
|
||||
#define IB_FUDGE_FACTOR(val) fudge_factor((val), \
|
||||
(mdss_res->ib_factor.numer), (mdss_res->ib_factor.denom))
|
||||
|
||||
#define HIGH_IB_FUDGE_FACTOR(val) fudge_factor((val), \
|
||||
(mdss_res->high_ib_factor.numer), (mdss_res->high_ib_factor.denom))
|
||||
|
||||
#define CLK_FUDGE_FACTOR(val) fudge_factor((val), \
|
||||
(mdss_res->clk_factor.numer), (mdss_res->clk_factor.denom))
|
||||
|
||||
enum {
|
||||
MDSS_MDP_PERF_UPDATE_SKIP,
|
||||
|
@ -116,11 +128,11 @@ static void __mdss_mdp_ctrl_perf_ovrd(struct mdss_data_type *mdata,
|
|||
ctl->mixer_right, &npipe);
|
||||
}
|
||||
|
||||
*ab_quota = MDSS_MDP_BUS_FUDGE_FACTOR_AB(*ab_quota);
|
||||
*ab_quota = AB_FUDGE_FACTOR(*ab_quota);
|
||||
if (npipe > 1)
|
||||
*ib_quota = MDSS_MDP_BUS_FUDGE_FACTOR_HIGH_IB(*ib_quota);
|
||||
*ib_quota = HIGH_IB_FUDGE_FACTOR(*ib_quota);
|
||||
else
|
||||
*ib_quota = MDSS_MDP_BUS_FUDGE_FACTOR_IB(*ib_quota);
|
||||
*ib_quota = IB_FUDGE_FACTOR(*ib_quota);
|
||||
|
||||
if (ovrd && (*ib_quota < MDSS_MDP_BUS_FLOOR_BW)) {
|
||||
*ib_quota = MDSS_MDP_BUS_FLOOR_BW;
|
||||
|
@ -162,7 +174,7 @@ static int mdss_mdp_ctl_perf_commit(struct mdss_data_type *mdata, u32 flags)
|
|||
mdss_mdp_bus_scale_set_quota(bus_ab_quota, bus_ib_quota);
|
||||
}
|
||||
if (flags & MDSS_MDP_PERF_UPDATE_CLK) {
|
||||
clk_rate = MDSS_MDP_CLK_FUDGE_FACTOR(clk_rate);
|
||||
clk_rate = CLK_FUDGE_FACTOR(clk_rate);
|
||||
pr_debug("update clk rate = %lu HZ\n", clk_rate);
|
||||
mdss_mdp_set_clk_rate(clk_rate);
|
||||
}
|
||||
|
@ -274,7 +286,7 @@ static void mdss_mdp_perf_mixer_update(struct mdss_mdp_mixer *mixer,
|
|||
}
|
||||
*clk_rate = mixer->width * v_total * fps;
|
||||
if (pinfo && pinfo->lcdc.v_back_porch < MDP_MIN_VBP)
|
||||
*clk_rate = MDSS_MDP_CLK_FUDGE_FACTOR(*clk_rate);
|
||||
*clk_rate = CLK_FUDGE_FACTOR(*clk_rate);
|
||||
|
||||
if (!pinfo) {
|
||||
/* perf for bus writeback */
|
||||
|
|
Loading…
Add table
Reference in a new issue