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

Commit d3a9050f authored by Abhinav Kumar's avatar Abhinav Kumar
Browse files

msm: ext_disp: re-initialize hpd completion before signaling events



Currently the HPD completion is re-initialized after signaling
to the audio/display userspace. This can cause race conditions
and we could end up missing the acknowledgment from audio or
display userspace completely.

Re-initialize the HPD completion before signaling to the userspace.

Change-Id: I96d466b2114f87c3b86a202f270e0bd218465c34
Signed-off-by: default avatarAbhinav Kumar <abhinavk@codeaurora.org>
parent 38d4aa7f
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -228,6 +228,8 @@ static int msm_ext_disp_process_display(struct msm_ext_disp *ext_disp,
	else
		ext_disp->current_disp = EXT_DISPLAY_TYPE_MAX;

	reinit_completion(&ext_disp->hpd_comp);

	ret = msm_ext_disp_send_cable_notification(ext_disp, state);

	/* positive ret value means audio node was switched */
@@ -237,7 +239,6 @@ static int msm_ext_disp_process_display(struct msm_ext_disp *ext_disp,
		goto end;
	}

	reinit_completion(&ext_disp->hpd_comp);
	ret = wait_for_completion_timeout(&ext_disp->hpd_comp, HZ * 5);
	if (!ret) {
		pr_err("display timeout\n");
@@ -262,6 +263,8 @@ static int msm_ext_disp_process_audio(struct msm_ext_disp *ext_disp,
		goto end;
	}

	reinit_completion(&ext_disp->hpd_comp);

	ret = msm_ext_disp_send_audio_notification(ext_disp, state);

	/* positive ret value means audio node was switched */
@@ -271,7 +274,6 @@ static int msm_ext_disp_process_audio(struct msm_ext_disp *ext_disp,
		goto end;
	}

	reinit_completion(&ext_disp->hpd_comp);
	ret = wait_for_completion_timeout(&ext_disp->hpd_comp, HZ * 2);
	if (!ret) {
		pr_err("audio timeout\n");