summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-omap-2.6.29/dss2/0043-DSS2-Swap-field-0-and-field-1-registers.patch
blob: 2e09335611f922068b8498efb10b0f0cfb13633c (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
From 35e88797e93b107ba602dee1e2ac8ea761dccd4b Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@nokia.com>
Date: Mon, 20 Apr 2009 16:26:20 +0200
Subject: [PATCH 43/69] DSS2: Swap field 0 and field 1 registers
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

The values for the registers which have alternate values for each field
were reveresed to what the hardware expects. For the hardware field 0
is the even field or the bottom field, field 1 is the odd field or the
top field. So simply swap the register values.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
---
 drivers/video/omap2/dss/dispc.c |   66 ++++++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 1c036c1..9bab6cf 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1072,12 +1072,16 @@ static void _dispc_set_scaling(enum omap_plane plane,
 
 	dispc_write_reg(dispc_reg_att[plane], l);
 
+	/*
+	 * field 0 = even field = bottom field
+	 * field 1 = odd field = top field
+	 */
 	if (ilace && !fieldmode) {
-		accu0 = 0;
-		accu1 = fir_vinc / 2;
-		if (accu1 >= 1024/2) {
-			accu0 = 1024/2;
-			accu1 -= accu0;
+		accu1 = 0;
+		accu0 = fir_vinc / 2;
+		if (accu0 >= 1024/2) {
+			accu1 = 1024/2;
+			accu0 -= accu1;
 		}
 	}
 
@@ -1266,34 +1270,38 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror,
 		fbh = width;
 	}
 
+	/*
+	 * field 0 = even field = bottom field
+	 * field 1 = odd field = top field
+	 */
 	switch (rotation + mirror * 4) {
 	case 0:
-		*offset0 = 0;
+		*offset1 = 0;
 		if (fieldmode)
-			*offset1 = screen_width * ps;
+			*offset0 = screen_width * ps;
 		else
-			*offset1 = 0;
+			*offset0 = 0;
 		*row_inc = pixinc(1 + (screen_width - fbw) +
 				(fieldmode ? screen_width : 0),
 				ps);
 		*pix_inc = pixinc(1, ps);
 		break;
 	case 1:
-		*offset0 = screen_width * (fbh - 1) * ps;
+		*offset1 = screen_width * (fbh - 1) * ps;
 		if (fieldmode)
-			*offset1 = *offset0 + ps;
+			*offset0 = *offset1 + ps;
 		else
-			*offset1 = *offset0;
+			*offset0 = *offset1;
 		*row_inc = pixinc(screen_width * (fbh - 1) + 1 +
 				(fieldmode ? 1 : 0), ps);
 		*pix_inc = pixinc(-screen_width, ps);
 		break;
 	case 2:
-		*offset0 = (screen_width * (fbh - 1) + fbw - 1) * ps;
+		*offset1 = (screen_width * (fbh - 1) + fbw - 1) * ps;
 		if (fieldmode)
-			*offset1 = *offset0 - screen_width * ps;
+			*offset0 = *offset1 - screen_width * ps;
 		else
-			*offset1 = *offset0;
+			*offset0 = *offset1;
 		*row_inc = pixinc(-1 -
 				(screen_width - fbw) -
 				(fieldmode ? screen_width : 0),
@@ -1301,11 +1309,11 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror,
 		*pix_inc = pixinc(-1, ps);
 		break;
 	case 3:
-		*offset0 = (fbw - 1) * ps;
+		*offset1 = (fbw - 1) * ps;
 		if (fieldmode)
-			*offset1 = *offset0 - ps;
+			*offset0 = *offset1 - ps;
 		else
-			*offset1 = *offset0;
+			*offset0 = *offset1;
 		*row_inc = pixinc(-screen_width * (fbh - 1) - 1 -
 				(fieldmode ? 1 : 0), ps);
 		*pix_inc = pixinc(screen_width, ps);
@@ -1313,11 +1321,11 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror,
 
 	/* mirroring */
 	case 0 + 4:
-		*offset0 = (fbw - 1) * ps;
+		*offset1 = (fbw - 1) * ps;
 		if (fieldmode)
-			*offset1 = *offset0 + screen_width * ps;
+			*offset0 = *offset1 + screen_width * ps;
 		else
-			*offset1 = *offset0;
+			*offset0 = *offset1;
 		*row_inc = pixinc(screen_width * 2 - 1 +
 				(fieldmode ? screen_width : 0),
 				ps);
@@ -1325,11 +1333,11 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror,
 		break;
 
 	case 1 + 4:
-		*offset0 = 0;
+		*offset1 = 0;
 		if (fieldmode)
-			*offset1 = *offset0 + screen_width * ps;
+			*offset0 = *offset1 + screen_width * ps;
 		else
-			*offset1 = *offset0;
+			*offset0 = *offset1;
 		*row_inc = pixinc(-screen_width * (fbh - 1) + 1 +
 				(fieldmode ? 1 : 0),
 				ps);
@@ -1337,11 +1345,11 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror,
 		break;
 
 	case 2 + 4:
-		*offset0 = screen_width * (fbh - 1) * ps;
+		*offset1 = screen_width * (fbh - 1) * ps;
 		if (fieldmode)
-			*offset1 = *offset0 + screen_width * ps;
+			*offset0 = *offset1 + screen_width * ps;
 		else
-			*offset1 = *offset0;
+			*offset0 = *offset1;
 		*row_inc = pixinc(1 - screen_width * 2 -
 				(fieldmode ? screen_width : 0),
 				ps);
@@ -1349,11 +1357,11 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror,
 		break;
 
 	case 3 + 4:
-		*offset0 = (screen_width * (fbh - 1) + fbw - 1) * ps;
+		*offset1 = (screen_width * (fbh - 1) + fbw - 1) * ps;
 		if (fieldmode)
-			*offset1 = *offset0 + screen_width * ps;
+			*offset0 = *offset1 + screen_width * ps;
 		else
-			*offset1 = *offset0;
+			*offset0 = *offset1;
 		*row_inc = pixinc(screen_width * (fbh - 1) - 1 -
 				(fieldmode ? 1 : 0),
 				ps);
-- 
1.6.2.4