aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0610-drm-amd-dal-clean-MST-payload-hw-table-on-update.patch
blob: 986ce8cb82f92f62fa0f9030ffd06890c797a06f (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
From 65612b6c62b3271dcbf8bb112d0da22291e53ed6 Mon Sep 17 00:00:00 2001
From: Mykola Lysenko <Mykola.Lysenko@amd.com>
Date: Fri, 11 Dec 2015 20:12:41 +0800
Subject: [PATCH 0610/1110] drm/amd/dal: clean MST payload hw table on update

On each update of HW payloads table from SW it should be clean.
Consider situation when configuration changes from 2 displays
to 1. SW table contains 1 row. HW table contains 2 rows. Only 1st
row updated.

After this change HW table always consistent with SW

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland<harry.wentland@amd.com>
---
 .../drm/amd/dal/dc/dce110/dce110_link_encoder.c    | 93 ++++++++++++++--------
 1 file changed, 58 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.c
index 3d902f3..8ddccdf 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.c
@@ -1637,17 +1637,22 @@ void dce110_link_encoder_update_mst_stream_allocation_table(
 {
 	struct dce110_link_encoder *enc110 = TO_DCE110_LINK_ENC(enc);
 	struct dc_context *ctx = enc110->base.ctx;
-	uint32_t value0;
-	uint32_t value1;
+	uint32_t value0 = 0;
+	uint32_t value1 = 0;
+	uint32_t slots = 0;
+	uint32_t src = 0;
 	uint32_t retries = 0;
 	struct core_stream *core_stream = NULL;
 
+
 	/* For CZ, there are only 3 pipes. So Virtual channel is up 3.*/
 
 	/* --- Set MSE Stream Attribute -
 	 * Setup VC Payload Table on Tx Side,
 	 * Issue allocation change trigger
 	 * to commit payload on both tx and rx side */
+
+	/* we should clean-up table each time */
 	value0 = dal_read_reg(ctx, DP_REG(mmDP_MSE_SAT0));
 	value1 = dal_read_reg(ctx, DP_REG(mmDP_MSE_SAT1));
 
@@ -1655,53 +1660,71 @@ void dce110_link_encoder_update_mst_stream_allocation_table(
 		core_stream =
 			DC_STREAM_TO_CORE(table->stream_allocations[0].stream);
 
-		set_reg_field_value(
-			value0,
-			core_stream->stream_enc->id,
-			DP_MSE_SAT0,
-			DP_MSE_SAT_SRC0);
-
-		set_reg_field_value(
-			value0,
-			table->stream_allocations[0].slot_count,
-			DP_MSE_SAT0,
-			DP_MSE_SAT_SLOT_COUNT0);
+		src = core_stream->stream_enc->id;
+		slots = table->stream_allocations[0].slot_count;
+	} else {
+		src = 0;
+		slots = 0;
 	}
 
+	set_reg_field_value(
+		value0,
+		src,
+		DP_MSE_SAT0,
+		DP_MSE_SAT_SRC0);
+
+	set_reg_field_value(
+		value0,
+		slots,
+		DP_MSE_SAT0,
+		DP_MSE_SAT_SLOT_COUNT0);
+
 	if (table->stream_count >= 2) {
 		core_stream =
 			DC_STREAM_TO_CORE(table->stream_allocations[1].stream);
 
-		set_reg_field_value(
-			value0,
-			core_stream->stream_enc->id,
-			DP_MSE_SAT0,
-			DP_MSE_SAT_SRC1);
-
-		set_reg_field_value(
-			value0,
-			table->stream_allocations[1].slot_count,
-			DP_MSE_SAT0,
-			DP_MSE_SAT_SLOT_COUNT1);
+		src = core_stream->stream_enc->id;
+		slots = table->stream_allocations[1].slot_count;
+	} else {
+		src = 0;
+		slots = 0;
 	}
 
+	set_reg_field_value(
+		value0,
+		src,
+		DP_MSE_SAT0,
+		DP_MSE_SAT_SRC1);
+
+	set_reg_field_value(
+		value0,
+		slots,
+		DP_MSE_SAT0,
+		DP_MSE_SAT_SLOT_COUNT1);
+
 	if (table->stream_count >= 3) {
 		core_stream =
 			DC_STREAM_TO_CORE(table->stream_allocations[2].stream);
 
-		set_reg_field_value(
-			value1,
-			core_stream->stream_enc->id,
-			DP_MSE_SAT1,
-			DP_MSE_SAT_SRC2);
-
-		set_reg_field_value(
-			value1,
-			table->stream_allocations[2].slot_count,
-			DP_MSE_SAT1,
-			DP_MSE_SAT_SLOT_COUNT2);
+		src = core_stream->stream_enc->id;
+		slots = table->stream_allocations[2].slot_count;
+	} else {
+		src = 0;
+		slots = 0;
 	}
 
+	set_reg_field_value(
+		value1,
+		src,
+		DP_MSE_SAT1,
+		DP_MSE_SAT_SRC2);
+
+	set_reg_field_value(
+		value1,
+		slots,
+		DP_MSE_SAT1,
+		DP_MSE_SAT_SLOT_COUNT2);
+
 	/* update ASIC MSE stream allocation table */
 	dal_write_reg(ctx, DP_REG(mmDP_MSE_SAT0), value0);
 	dal_write_reg(ctx, DP_REG(mmDP_MSE_SAT1), value1);
-- 
2.7.4