Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fb71f9c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: Add core clock level selection in MDSS"

parents 753fc7c8 eed3f139
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -301,6 +301,12 @@ Optional properties:
				used to reduce the pending writes limit dynamically
				and can be tuned to match performance requirements
				depending upon system state.
- qcom,mdss-clk-levels:		This array indicates the mdp core clock level selection
				array. Core clock is calculated for each frame and
				hence depending upon calculated value, clock rate
				will be rounded up to the next level according to
				this table. Order of entries need to be ordered in
				ascending order.

Fudge Factors:			Fudge factors are used to boost demand for
				resources like bus bandswidth, clk rate etc. to
@@ -406,6 +412,9 @@ Example:
		qcom,mdss-ib-factor = <3 2>;		/* 1.5 times  */
		qcom,mdss-clk-factor = <5 4>;		/* 1.25 times */

		/* Clock levels */
		qcom,mdss-clk-levels = <92310000, 177780000, 200000000>;

		qcom,max-bandwidth-low-kbps = <2300000>;
		qcom,max-bandwidth-high-kbps = <3000000>;

+3 −0
Original line number Diff line number Diff line
@@ -159,6 +159,9 @@ struct mdss_data_type {
	struct mdss_fudge_factor ib_factor_overlap;
	struct mdss_fudge_factor clk_factor;

	u32 *clock_levels;
	u32 nclk_lvl;

	struct mdss_hw_settings *hw_settings;

	struct mdss_mdp_pipe *vig_pipes;
+17 −0
Original line number Diff line number Diff line
@@ -2385,6 +2385,23 @@ static int mdss_mdp_parse_dt_misc(struct platform_device *pdev)
	if (rc)
		pr_debug("max bandwidth (per pipe) property not specified\n");

	mdata->nclk_lvl = mdss_mdp_parse_dt_prop_len(pdev,
					"qcom,mdss-clk-levels");

	if (mdata->nclk_lvl) {
		mdata->clock_levels = kzalloc(sizeof(u32) * mdata->nclk_lvl,
							GFP_KERNEL);
		if (!mdata->clock_levels) {
			pr_err("no mem assigned for mdata clock_levels\n");
			return -ENOMEM;
		}

		rc = mdss_mdp_parse_dt_handler(pdev, "qcom,mdss-clk-levels",
			mdata->clock_levels, mdata->nclk_lvl);
		if (rc)
			pr_debug("clock levels not found\n");
	}

	return 0;
}

+25 −0
Original line number Diff line number Diff line
@@ -988,6 +988,29 @@ exit:
	mutex_unlock(&mdss_mdp_ctl_lock);
}

static int mdss_mdp_select_clk_lvl(struct mdss_mdp_ctl *ctl,
			u32 clk_rate)
{
	int i;
	struct mdss_data_type *mdata;

	if (!ctl)
		return -ENODEV;

	mdata = ctl->mdata;

	for (i = 0; i < mdata->nclk_lvl; i++) {
		if (clk_rate > mdata->clock_levels[i]) {
			continue;
		} else {
			clk_rate = mdata->clock_levels[i];
			break;
		}
	}

	return clk_rate;
}

static void mdss_mdp_ctl_perf_update(struct mdss_mdp_ctl *ctl,
		int params_changed)
{
@@ -1055,6 +1078,8 @@ static void mdss_mdp_ctl_perf_update(struct mdss_mdp_ctl *ctl,
				clk_rate = max(ctl->cur_perf.mdp_clk_rate,
					       clk_rate);
		}

		clk_rate  = mdss_mdp_select_clk_lvl(ctl, clk_rate);
		mdss_mdp_set_clk_rate(clk_rate);
		pr_debug("update clk rate = %d HZ\n", clk_rate);
	}