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

Commit e24f2f46 authored by Samantha Tran's avatar Samantha Tran Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm: handle rsc jitter time based on rsc state



This change adds state parameter to rsc timer calculations.
If state is in command mode, factor jitter time into static
wakeup time. In all other states, do not take jitter
into consideration.

Change-Id: I83b96a83cdf66556cf61130cd2ad2036fe3a24be
Signed-off-by: default avatarSamantha Tran <samtran@codeaurora.org>
parent a56f17dc
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ static int sde_rsc_clk_enable(struct sde_power_handle *phandle,
}

static u32 sde_rsc_timer_calculate(struct sde_rsc_priv *rsc,
	struct sde_rsc_cmd_config *cmd_config)
	struct sde_rsc_cmd_config *cmd_config, enum sde_rsc_state state)
{
	const u32 cxo_period_ns = 52;
	u64 rsc_backoff_time_ns = rsc->backoff_time_ns;
@@ -387,7 +387,12 @@ static u32 sde_rsc_timer_calculate(struct sde_rsc_priv *rsc,
	line_time_ns = div_u64(line_time_ns, rsc->cmd_config.vtotal);
	prefill_time_ns = line_time_ns * rsc->cmd_config.prefill_lines;

	/* only take jitter into account for CMD mode */
	if (state == SDE_RSC_CMD_STATE)
		total = frame_time_ns - frame_jitter - prefill_time_ns;
	else
		total = frame_time_ns - prefill_time_ns;

	if (total < 0) {
		pr_err("invalid total time period time:%llu jiter_time:%llu blanking time:%llu\n",
			frame_time_ns, frame_jitter, prefill_time_ns);
@@ -468,7 +473,7 @@ static int sde_rsc_switch_to_cmd(struct sde_rsc_priv *rsc,

	/* update timers - might not be available at next switch */
	if (config)
		sde_rsc_timer_calculate(rsc, config);
		sde_rsc_timer_calculate(rsc, config, SDE_RSC_CMD_STATE);

	/**
	 * rsc clients can still send config at any time. If a config is
@@ -608,7 +613,7 @@ static int sde_rsc_switch_to_vid(struct sde_rsc_priv *rsc,

	/* update timers - might not be available at next switch */
	if (config)
		sde_rsc_timer_calculate(rsc, config);
		sde_rsc_timer_calculate(rsc, config, SDE_RSC_VID_STATE);

	/**
	 * rsc clients can still send config at any time. If a config is
@@ -1548,7 +1553,7 @@ static int sde_rsc_probe(struct platform_device *pdev)
		goto sde_rsc_fail;
	}

	if (sde_rsc_timer_calculate(rsc, NULL))
	if (sde_rsc_timer_calculate(rsc, NULL, SDE_RSC_IDLE_STATE))
		goto sde_rsc_fail;

	sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, false);