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

Commit 25d646e8 authored by Huaibin Yang's avatar Huaibin Yang Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: extend mutex offlock for dfps updates



Extend mutex offlock for DFPS to avoid the race condition between dfps
updates and video stop. During dfps update, driver waits for vsync
done interrupt to program registers for new frame rate, however, at
the same time, if display is turned off for suspend, device may
crash. These two operations have to be mutually exclusive.

Change-Id: Ia0c8e037bb4316ec2ee51ac4f9f14463f6ac107a
Signed-off-by: default avatarHuaibin Yang <huaibiny@codeaurora.org>
parent e8e4eb94
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3362,11 +3362,15 @@ int mdss_mdp_ctl_update_fps(struct mdss_mdp_ctl *ctl, int fps)
	int ret = 0;
	struct mdss_mdp_ctl *sctl = NULL;

	mutex_lock(&ctl->offlock);

	sctl = mdss_mdp_get_split_ctl(ctl);

	if (ctl->ops.config_fps_fnc)
		ret = ctl->ops.config_fps_fnc(ctl, sctl, fps);

	mutex_unlock(&ctl->offlock);

	return ret;
}

+2 −2
Original line number Diff line number Diff line
@@ -430,7 +430,6 @@ static int mdss_mdp_video_ctx_stop(struct mdss_mdp_ctl *ctl,
	int rc = 0;
	u32 frame_rate = 0;

	mutex_lock(&ctl->offlock);
	if (ctx->timegen_en) {
		rc = mdss_mdp_ctl_intf_event(ctl, MDSS_EVENT_BLANK, NULL);
		if (rc == -EBUSY) {
@@ -460,7 +459,6 @@ static int mdss_mdp_video_ctx_stop(struct mdss_mdp_ctl *ctl,

	ctx->ref_cnt--;
end:
	mutex_unlock(&ctl->offlock);
	return rc;
}

@@ -524,6 +522,7 @@ static int mdss_mdp_video_stop(struct mdss_mdp_ctl *ctl, int panel_power_state)
{
	int intfs_num, ret = 0;

	mutex_lock(&ctl->offlock);
	intfs_num = ctl->intf_num - MDSS_MDP_INTF0;
	ret = mdss_mdp_video_intfs_stop(ctl, ctl->panel_data, intfs_num);
	if (IS_ERR_VALUE(ret)) {
@@ -535,6 +534,7 @@ static int mdss_mdp_video_stop(struct mdss_mdp_ctl *ctl, int panel_power_state)

	mdss_mdp_ctl_reset(ctl);
	ctl->intf_ctx[MASTER_CTX] = NULL;
	mutex_unlock(&ctl->offlock);

	return 0;
}