summaryrefslogtreecommitdiff
path: root/patches/em8300-adv7170-wss.patch
blob: 454967605502ee939b7378ffe4253bc0b789a4bb (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
Wide screen signaling (WSS) patch for the em8300 driver by Seppo Ingalsuo.
Apply to: em8300 driver sources
More info: http://sf.net/mailarchive/forum.php?thread_id=6061108&forum_id=7173
Note: you'll probably want to apply vdr-dxr3-wss.patch too
  in order to get VDR(-dxr3) to use this functionality.


Index: em8300setup/em8300setup.c
===================================================================
RCS file: /cvsroot/dxr3/em8300/em8300setup/em8300setup.c,v
retrieving revision 1.3
diff -u -r1.3 em8300setup.c
--- em8300setup/em8300setup.c	8 Mar 2005 01:14:31 -0000	1.3
+++ em8300setup/em8300setup.c	24 May 2005 14:03:31 -0000
@@ -112,7 +112,7 @@
 	char ucode_file[200]; // bad hardcoded value ;-)
 
 	/* Vars to hold desired setings - init to -1 so we can see which were requested to be set explicitly by the user and which should be left alone */
-        int tvmode=-1, aspect=-1, audio=-1, spu=-1, upload=0, display_only=0;
+        int tvmode=-1, aspect=-1, audio=-1, spu=-1, upload=0, display_only=0, wssmode=-1;
 
 
 	char * devs[] = {"/dev/em8300-0","/dev/em8300-1","/dev/em8300-2","/dev/em8300-3"};
@@ -175,12 +175,45 @@
 							upload=1;
 							printf("Using microcode file %s\n",ucode_file);
 							break;
+					        case 'z':
+						        switch (opt[2]) {
+							case '0':
+							        wssmode = EM8300_WSS_OFF;
+								break;
+							case '1':
+							        wssmode = EM8300_WSS_4_3;
+								break;
+							case '2':
+							        wssmode = EM8300_WSS_14_9;
+								if (opt[3]=='l') wssmode = EM8300_WSS_14_9_LETTERBOX;
+								if (opt[3]=='t') wssmode = EM8300_WSS_14_9_LETTERBOX_TOP;
+								break;
+							case '3':
+							        wssmode = EM8300_WSS_16_9;
+								if (opt[3]=='l') wssmode = EM8300_WSS_16_9_LETTERBOX;
+								if (opt[3]=='t') wssmode = EM8300_WSS_16_9_LETTERBOX_TOP;
+								if (opt[3]=='p') wssmode = EM8300_WSS_16P_9_LETTERBOX;
+								break;
+							default:
+							        printf("Unknown option -z%c\n\n",opt[2]);;
+								exit(1);
+							}
+							break;
 						 default:
 							printf("Unknown option -%c \n\n",opt[1]);
 							printf("Usage: em8300setup [-q]|[all other options]\n\nWhere options are one of the following (latter options will override previously\nspecified options for the same control):\n\n");
 							printf("  -p, -p6, -n\tSet display mode to pal, pal60, ntsc\n");
 							printf("  -a, -d, -3\tSet audio mode to analog, digitalpcm, digital ac3\n");
 							printf("  -o, -w\tSet aspect ratio to normal[4:3], widescreen[16:9]\n");
+							printf("  -z0\t\tSet WSS to disabled\n");
+							printf("  -z1\t\tSet WSS to 4:3\n");
+							printf("  -z2\t\tSet WSS to 14:9\n");
+							printf("  -z2l\t\tSet WSS to 14:9 letterbox\n");
+							printf("  -z2t\t\tSet WSS to 14:9 letterbox top\n");
+							printf("  -z3\t\tSet WSS to 16:9\n");
+							printf("  -z3l\t\tSet WSS to 16:9 letterbox\n");
+							printf("  -z3t\t\tSet WSS to 16:9 letterbox top\n");
+							printf("  -z3p\t\tSet WSS to >16:9 letterbox\n");
 							printf("  -S, -s\tSet spu mode On(S), Off(s)\n");
 							printf("  -f <filename>\tSpecify alternate location of microcode\n\t\t(Defaults to /usr/share/misc/em8300.uc)\n");
 							printf("  -q\t\tQuery the current settings for all of the above and\n\t\texit without making any changes\n");
@@ -270,6 +303,12 @@
 			if(ioctl(DEV, EM8300_IOCTL_SET_ASPECTRATIO, &aspect) == -1) 
 				check_errno("Unable to set aspect ratio");
 		}
+		if(wssmode!=-1) {
+			printf("Setting WSS = %i\n",wssmode);
+			if(ioctl(DEV, EM8300_IOCTL_SET_WSS, &wssmode) == -1) 
+				check_errno("Unable to set wss");
+		}
+
 		if(audio!=-1) {
 			printf("Setting audio = %i\n",audio);
 			if(ioctl(DEV, EM8300_IOCTL_SET_AUDIOMODE, &audio) == -1) 
Index: include/linux/em8300.h
===================================================================
RCS file: /cvsroot/dxr3/em8300/include/linux/em8300.h,v
retrieving revision 1.38
diff -u -r1.38 em8300.h
--- include/linux/em8300.h	17 May 2005 19:25:53 -0000	1.38
+++ include/linux/em8300.h	24 May 2005 14:03:32 -0000
@@ -80,6 +80,7 @@
 #define EM8300_IOCTL_SCR_SETSPEED _IOW('C',17,unsigned)
 #define EM8300_IOCTL_FLUSH _IOW('C',18,int)
 #define EM8300_IOCTL_VBI _IOW('C',19,struct timeval)
+#define EM8300_IOCTL_SET_WSS _IOW('C',20,int)
 
 #define EM8300_OVERLAY_SIGNAL_ONLY 1
 #define EM8300_OVERLAY_SIGNAL_WITH_VGA 2
@@ -97,6 +98,16 @@
 #define EM8300_ASPECTRATIO_16_9 1
 #define EM8300_ASPECTRATIO_LAST 1
 
+#define EM8300_WSS_OFF 0
+#define EM8300_WSS_4_3 8
+#define EM8300_WSS_14_9_LETTERBOX 1
+#define EM8300_WSS_14_9_LETTERBOX_TOP 2
+#define EM8300_WSS_16_9_LETTERBOX 11
+#define EM8300_WSS_16_9_LETTERBOX_TOP 4
+#define EM8300_WSS_16P_9_LETTERBOX 13
+#define EM8300_WSS_14_9 14
+#define EM8300_WSS_16_9 7
+
 #define EM8300_VIDEOMODE_PAL	0
 #define EM8300_VIDEOMODE_PAL60	1
 #define EM8300_VIDEOMODE_NTSC	2
@@ -454,6 +465,7 @@
 int em8300_control_ioctl(struct em8300_s *em, int cmd, unsigned long arg);
 int em8300_ioctl_setvideomode(struct em8300_s *em, int mode);
 int em8300_ioctl_setaspectratio(struct em8300_s *em, int ratio);
+int em8300_ioctl_setwss(struct em8300_s *em, int wsscode);
 int em8300_ioctl_getstatus(struct em8300_s *em, char *usermsg);
 int em8300_ioctl_init(struct em8300_s *em, em8300_microcode_t *useruc);
 void em8300_ioctl_enable_videoout(struct em8300_s *em, int mode);
Index: modules/adv717x.c
===================================================================
RCS file: /cvsroot/dxr3/em8300/modules/adv717x.c,v
retrieving revision 1.45
diff -u -r1.45 adv717x.c
--- modules/adv717x.c	9 Apr 2005 20:23:54 -0000	1.45
+++ modules/adv717x.c	24 May 2005 14:03:34 -0000
@@ -112,6 +112,7 @@
 	int pp_ntsc;
 	int pd_adj_pal;
 	int pd_adj_ntsc;
+	int wsscode;
 
 	unsigned char config[32];
 	int configlen;
@@ -298,6 +299,63 @@
 		if (data->rgbmode) {
 			tmpconfig[3] |= 0x10;
 		}
+
+		switch (data->wsscode) {
+		case 0x08:
+			/* 4:3 full */
+			tmpconfig[22] = 0x80;
+			tmpconfig[23] = 0x00;
+			tmpconfig[24] = 0x08;
+			break;
+		case 0x01:
+			/* 14:9 letterbox center */
+			tmpconfig[22] = 0x80;
+			tmpconfig[23] = 0x00;
+			tmpconfig[24] = 0x01;
+			break;
+		case 0x02:
+			/* 14:9 letterbox top */
+			tmpconfig[22] = 0x80;
+			tmpconfig[23] = 0x00;
+			tmpconfig[24] = 0x02;
+			break;
+		case 0x0b:
+			/* 16:9 letterbox center */
+			tmpconfig[22] = 0x80;
+			tmpconfig[23] = 0x00;
+			tmpconfig[24] = 0x0b;
+			break;
+		case 0x04:
+			/* 16:9 letterbox top */
+			tmpconfig[22] = 0x80;
+			tmpconfig[23] = 0x00;
+			tmpconfig[24] = 0x04;
+			break;
+		case 0x0d:
+			/* >16:9 letterbox center */
+			tmpconfig[22] = 0x80;
+			tmpconfig[23] = 0x00;
+			tmpconfig[24] = 0x0d;
+			break;
+		case 0x0e:
+			/* 14:9 full */
+			tmpconfig[22] = 0x80;
+			tmpconfig[23] = 0x00;
+			tmpconfig[24] = 0x0e;
+			break;
+		case 0x07:
+			/* 16:9 full */
+			tmpconfig[22] = 0x80;
+			tmpconfig[23] = 0x00;
+			tmpconfig[24] = 0x07;
+			break;
+		default:
+			tmpconfig[22] = 0x00;
+			tmpconfig[23] = 0x00;
+			tmpconfig[24] = 0x00;
+			break;
+		}
+
 		break;
 	}
 
@@ -440,6 +498,7 @@
 	data->bars = color_bars[em->card_nr];
 	data->rgbmode = 0;
 	data->enableoutput = 0;
+	data->wsscode = 0;
 
 	adv717x_setmode(ENCODER_MODE_PAL60, client);
 
@@ -549,6 +608,42 @@
 		data->enableoutput = (long int) arg;
 		adv717x_update(client);
 		break;
+	case ENCODER_CMD_WSS_4_3:
+		data->wsscode = 8; 
+		adv717x_update(client);
+		break;
+	case ENCODER_CMD_WSS_14_9_LETTERBOX:
+		data->wsscode = 1; 
+		adv717x_update(client);
+		break;
+	case ENCODER_CMD_WSS_14_9_LETTERBOX_TOP:
+		data->wsscode = 2; 
+		adv717x_update(client);
+		break;
+	case ENCODER_CMD_WSS_16_9_LETTERBOX:
+		data->wsscode = 11; 
+		adv717x_update(client);
+		break;
+	case ENCODER_CMD_WSS_16_9_LETTERBOX_TOP:
+		data->wsscode = 4; 
+		adv717x_update(client);
+		break;
+	case ENCODER_CMD_WSS_16P_9_LETTERBOX:
+		data->wsscode = 13; 
+		adv717x_update(client);
+		break;
+	case ENCODER_CMD_WSS_14_9:
+		data->wsscode = 14; 
+		adv717x_update(client);
+		break;
+	case ENCODER_CMD_WSS_16_9:
+		data->wsscode = 7; 
+		adv717x_update(client);
+		break;
+	case ENCODER_CMD_WSS_OFF:
+		data->wsscode = 0; 
+		adv717x_update(client);
+		break;
 	default:
 		return -EINVAL;
 		break;
Index: modules/em8300_ioctl.c
===================================================================
RCS file: /cvsroot/dxr3/em8300/modules/em8300_ioctl.c,v
retrieving revision 1.48
diff -u -r1.48 em8300_ioctl.c
--- modules/em8300_ioctl.c	23 May 2005 23:44:12 -0000	1.48
+++ modules/em8300_ioctl.c	24 May 2005 14:03:35 -0000
@@ -188,6 +188,18 @@
 		}
 		break;
 
+	case _IOC_NR(EM8300_IOCTL_SET_WSS):
+		if (!em->ucodeloaded) {
+			return -ENOTTY;
+		}
+
+		if (_IOC_DIR(cmd) & _IOC_WRITE) {
+			get_user(val, (int *) arg);
+			em8300_ioctl_setwss(em, val);
+		}
+
+		break;
+
 	case _IOC_NR(EM8300_IOCTL_GET_AUDIOMODE):
 		if (!em->ucodeloaded) {
 			return -ENOTTY;
@@ -539,6 +551,52 @@
 	return 0;
 }
 
+int em8300_ioctl_setwss(struct em8300_s *em, int wsscode)
+{
+	int wsscmd;
+
+	switch (wsscode) {
+	case EM8300_WSS_OFF:
+		wsscmd = ENCODER_CMD_WSS_OFF;
+		break;
+	case EM8300_WSS_4_3:
+		wsscmd = ENCODER_CMD_WSS_4_3;
+		break;
+	case EM8300_WSS_14_9_LETTERBOX:
+		wsscmd = ENCODER_CMD_WSS_14_9_LETTERBOX;
+		break;
+	case EM8300_WSS_14_9_LETTERBOX_TOP:
+		wsscmd = ENCODER_CMD_WSS_14_9_LETTERBOX_TOP;
+		break;
+	case EM8300_WSS_16_9_LETTERBOX:
+		wsscmd = ENCODER_CMD_WSS_16_9_LETTERBOX;
+		break;
+	case EM8300_WSS_16_9_LETTERBOX_TOP:
+		wsscmd = ENCODER_CMD_WSS_16_9_LETTERBOX_TOP;
+		break;
+	case EM8300_WSS_16P_9_LETTERBOX:
+		wsscmd = ENCODER_CMD_WSS_16P_9_LETTERBOX;
+		break;
+	case EM8300_WSS_14_9:
+		wsscmd = ENCODER_CMD_WSS_14_9;
+		break;
+	case EM8300_WSS_16_9:
+		wsscmd = ENCODER_CMD_WSS_16_9;
+		break;
+	default:
+		return -1;
+	}
+
+	em8300_dicom_disable(em);
+	if (em->encoder) {
+		em->encoder->driver->command(em->encoder, wsscmd, (void *) 0 );
+	}
+
+	em8300_dicom_enable(em);
+	em8300_dicom_update(em);
+	return 0;
+}
+
 int em8300_ioctl_setplaymode(struct em8300_s *em, int mode)
 {
 	switch (mode) {
Index: modules/encoder.h
===================================================================
RCS file: /cvsroot/dxr3/em8300/modules/encoder.h,v
retrieving revision 1.8
diff -u -r1.8 encoder.h
--- modules/encoder.h	14 Jan 2002 21:41:31 -0000	1.8
+++ modules/encoder.h	24 May 2005 14:03:35 -0000
@@ -13,6 +13,15 @@
 
 #define ENCODER_CMD_SETMODE      1
 #define ENCODER_CMD_ENABLEOUTPUT 2
+#define ENCODER_CMD_WSS_4_3                3
+#define ENCODER_CMD_WSS_14_9_LETTERBOX     4
+#define ENCODER_CMD_WSS_14_9_LETTERBOX_TOP 5
+#define ENCODER_CMD_WSS_16_9_LETTERBOX     6
+#define ENCODER_CMD_WSS_16_9_LETTERBOX_TOP 7
+#define ENCODER_CMD_WSS_16P_9_LETTERBOX    8
+#define ENCODER_CMD_WSS_14_9               9
+#define ENCODER_CMD_WSS_16_9               10
+#define ENCODER_CMD_WSS_OFF                11
 
 #endif
 
Index: em8300setup/em8300setup.1
===================================================================
RCS file: /cvsroot/dxr3/em8300/em8300setup/em8300setup.1,v
retrieving revision 1.2
diff -u -r1.2 em8300setup.1
--- em8300setup/em8300setup.1	28 Apr 2005 23:18:33 -0000	1.2
+++ em8300setup/em8300setup.1	24 May 2005 14:03:31 -0000
@@ -27,6 +27,33 @@
 \fB-o\fR, \fB-w\fR
 Set aspect ratio to respectively normal (4:3) or wide-screen (16:9).
 .TP
+\fB-z0\fR
+Set WSS to disabled.
+.TP
+\fB-z1\fR
+Set WSS to 4:3.
+.TP
+\fB-z2\fR
+Set WSS to 14:9.
+.TP
+\fB-z2l\fR
+Set WSS to 14:9 letterbox.
+.TP
+\fB-z2t\fR
+Set WSS to 14:9 letterbox top.
+.TP
+\fB-z3\fR
+Set WSS to 16:9.
+.TP
+\fB-z3l\fR
+Set WSS to 16:9 letterbox.
+.TP
+\fB-z3t\fR
+Set WSS to 16:9 letterbox top.
+.TP
+\fB-z3p\fR
+Set WSS to >16:9 letterbox.
+.TP
 \fB-S\fR, \fB-s\fR
 Set sub-pictures respectively on or off.
 .TP