aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0993-drm-amd-dal-Fix-Fiji-audio-lag-issue.patch
blob: 5d89c722a31d388a5b6a5dee328b5e58559e01ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From bfc9ee223b7426fa3fd81da89f445aa35a13069f Mon Sep 17 00:00:00 2001
From: Yongqiang Sun <yongqiang.sun@amd.com>
Date: Wed, 30 Mar 2016 11:53:00 -0400
Subject: [PATCH 0993/1110] drm/amd/dal: Fix Fiji audio lag issue.

Issue:
Play audio when DP and HDMI connected, if unplug HDMI, audio lag happened
on DP monitor.

Root cause:
In case of DP and HDMI connected or HDMI only, DCCG_AUDIO_DTO_SEL
is set to either dto0 or dto1, audio should work fine.
In case of DP connected only, DCCG_AUDIO_DTO_SEL should be dto1.
When HDMI unplugged, due to mode set optimization,
setup audio wall dto is bypassed, and DCCG_AUDIO_DTO_SEL is dto0,
audio lag happened.

Solution:
Not optimized audio wall dto setup. When mode set, iterate pipe_ctx,
find first available pipe with audio, setup audio wall DTO per topology
instead of per pipe.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/dal/dc/dce110/dce110_hw_sequencer.c    | 35 +++++++++++++++++-----
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
index 0673a1b..9ca604d 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
@@ -867,14 +867,6 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 		}
 	}
 
-	/* Setup audio rate clock source */
-	if (pipe_ctx->audio != NULL)
-		dal_audio_setup_audio_wall_dto(
-				pipe_ctx->audio,
-				pipe_ctx->signal,
-				&pipe_ctx->audio_output.crtc_info,
-				&pipe_ctx->audio_output.pll_info);
-
 	/* program blank color */
 	color_space = get_output_color_space(&stream->public.timing);
 	pipe_ctx->tg->funcs->set_blank_color(
@@ -1347,6 +1339,33 @@ static enum dc_status apply_ctx_to_hw(
 		if (DC_OK != status)
 			return status;
 	}
+
+	/* Setup audio rate clock source */
+	/* Issue:
+	 * Audio lag happened on DP monitor when unplug a HDMI monitor
+	 *
+	 * Cause:
+	 * In case of DP and HDMI connected or HDMI only, DCCG_AUDIO_DTO_SEL
+	 * is set to either dto0 or dto1, audio should work fine.
+	 * In case of DP connected only, DCCG_AUDIO_DTO_SEL should be dto1,
+	 * set to dto0 will cause audio lag.
+	 *
+	 * Solution:
+	 * Not optimized audio wall dto setup. When mode set, iterate pipe_ctx,
+	 * find first available pipe with audio, setup audio wall DTO per topology
+	 * instead of per pipe.
+	 */
+	for (i = 0; i < MAX_PIPES; i++) {
+		if (context->res_ctx.pipe_ctx[i].audio != NULL) {
+			dal_audio_setup_audio_wall_dto(
+					context->res_ctx.pipe_ctx[i].audio,
+					context->res_ctx.pipe_ctx[i].signal,
+					&context->res_ctx.pipe_ctx[i].audio_output.crtc_info,
+					&context->res_ctx.pipe_ctx[i].audio_output.pll_info);
+			break;
+		}
+	}
+
 	dc->hwss.set_displaymarks(dc, context);
 
 	update_bios_scratch_critical_state(context->res_ctx.pool.adapter_srv,
-- 
2.7.4