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

Commit dc6fbf3f authored by Adrian Salido-Moreno's avatar Adrian Salido-Moreno
Browse files

msm: mdss: fix concurrency between add vsync handler and stop



If command mode interface is being stopped, adding vsync handler can
cause the clocks to go on and cause improper state after.
There are checks for panel off inside add_vsync_handler however, there
needs to be synchronization while the stop is in progress.

Change-Id: I99bfca53a18bc818eecc94007357abdf4a251e50
Signed-off-by: default avatarAdrian Salido-Moreno <adrianm@codeaurora.org>
parent 77813844
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1171,11 +1171,14 @@ static int mdss_mdp_cmd_add_vsync_handler(struct mdss_mdp_ctl *ctl,
	struct mdss_mdp_cmd_ctx *ctx, *sctx = NULL;
	unsigned long flags;
	bool enable_rdptr = false;
	int ret = 0;

	mutex_lock(&ctl->offlock);
	ctx = (struct mdss_mdp_cmd_ctx *) ctl->intf_ctx[MASTER_CTX];
	if (!ctx) {
		pr_err("%s: invalid ctx\n", __func__);
		return -ENODEV;
		ret = -ENODEV;
		goto done;
	}

	pr_debug("%pS->%s ctl:%d\n",
@@ -1206,7 +1209,10 @@ static int mdss_mdp_cmd_add_vsync_handler(struct mdss_mdp_ctl *ctl,
			mutex_unlock(&cmd_clk_mtx);
	}

	return 0;
done:
	mutex_unlock(&ctl->offlock);

	return ret;
}

static int mdss_mdp_cmd_remove_vsync_handler(struct mdss_mdp_ctl *ctl,