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

Commit c5a1d2a4 authored by Lloyd Atkinson's avatar Lloyd Atkinson
Browse files

drm/msm/sde: take spin lock around encoder vblank registration



Take sde phyiscal encoder spin lock around the vblank irq
control logic to protect against race conditions between idle
power collapse and the crtc both trying to control vblank irq
registrations.

Change-Id: Ie67e0ae921ad1123585ef9b5e31079a320648273
Signed-off-by: default avatarLloyd Atkinson <latkinso@codeaurora.org>
parent dd8fa8a1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -526,6 +526,7 @@ static int sde_encoder_phys_cmd_control_vblank_irq(
{
	struct sde_encoder_phys_cmd *cmd_enc =
		to_sde_encoder_phys_cmd(phys_enc);
	unsigned long lock_flags;
	int ret = 0;

	if (!phys_enc) {
@@ -541,6 +542,8 @@ static int sde_encoder_phys_cmd_control_vblank_irq(
			__builtin_return_address(0),
			enable, atomic_read(&phys_enc->vblank_refcount));

	spin_lock_irqsave(phys_enc->enc_spinlock, lock_flags);

	SDE_EVT32(DRMID(phys_enc->parent), phys_enc->hw_pp->idx - PINGPONG_0,
			enable, atomic_read(&phys_enc->vblank_refcount));

@@ -550,6 +553,8 @@ static int sde_encoder_phys_cmd_control_vblank_irq(
		ret = sde_encoder_helper_unregister_irq(phys_enc,
				INTR_IDX_RDPTR);

	spin_unlock_irqrestore(phys_enc->enc_spinlock, lock_flags);

end:
	if (ret)
		SDE_ERROR_CMDENC(cmd_enc,
+5 −0
Original line number Diff line number Diff line
@@ -476,6 +476,7 @@ static int sde_encoder_phys_vid_control_vblank_irq(
{
	int ret = 0;
	struct sde_encoder_phys_vid *vid_enc;
	unsigned long lock_flags;

	if (!phys_enc) {
		SDE_ERROR("invalid encoder\n");
@@ -492,6 +493,8 @@ static int sde_encoder_phys_vid_control_vblank_irq(
			__builtin_return_address(0),
			enable, atomic_read(&phys_enc->vblank_refcount));

	spin_lock_irqsave(phys_enc->enc_spinlock, lock_flags);

	SDE_EVT32(DRMID(phys_enc->parent), enable,
			atomic_read(&phys_enc->vblank_refcount));

@@ -501,6 +504,8 @@ static int sde_encoder_phys_vid_control_vblank_irq(
		ret = sde_encoder_helper_unregister_irq(phys_enc,
				INTR_IDX_VSYNC);

	spin_unlock_irqrestore(phys_enc->enc_spinlock, lock_flags);

	if (ret)
		SDE_ERROR_VIDENC(vid_enc,
				"control vblank irq error %d, enable %d\n",