aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthomas schorpp <t.schorpp@gmx.de>2005-09-09 16:03:06 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:44 -0400
commitf63f5346c943008fe8f6ac66a9026f6c35e24947 (patch)
tree1ec769716a18a5675348337155e46b3f609b2fcf
parent6d78933c291bd0b6292e2c631e2f5e346c14d3fa (diff)
[PATCH] dvb: av7110: Siemens DVB-C analog video input support
Add support for analog video inputs (CVBS and Y/C) of the analog module for the Siemens DVB-C card. Signed-off-by: thomas schorpp <t.schorpp@gmx.de> Signed-off-by: Johannes Stezenbach <js@linuxtv.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/media/dvb/ttpci/av7110_v4l.c74
1 files changed, 54 insertions, 20 deletions
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c
index e65fc36e2ce8..6af74f78b3e5 100644
--- a/drivers/media/dvb/ttpci/av7110_v4l.c
+++ b/drivers/media/dvb/ttpci/av7110_v4l.c
@@ -70,7 +70,7 @@ static int msp_readreg(struct av7110 *av7110, u8 dev, u16 reg, u16 *val)
70 return 0; 70 return 0;
71} 71}
72 72
73static struct v4l2_input inputs[2] = { 73static struct v4l2_input inputs[4] = {
74 { 74 {
75 .index = 0, 75 .index = 0,
76 .name = "DVB", 76 .name = "DVB",
@@ -87,6 +87,22 @@ static struct v4l2_input inputs[2] = {
87 .tuner = 0, 87 .tuner = 0,
88 .std = V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 88 .std = V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
89 .status = 0, 89 .status = 0,
90 }, {
91 .index = 2,
92 .name = "Video",
93 .type = V4L2_INPUT_TYPE_CAMERA,
94 .audioset = 0,
95 .tuner = 0,
96 .std = V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
97 .status = 0,
98 }, {
99 .index = 3,
100 .name = "Y/C",
101 .type = V4L2_INPUT_TYPE_CAMERA,
102 .audioset = 0,
103 .tuner = 0,
104 .std = V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
105 .status = 0,
90 } 106 }
91}; 107};
92 108
@@ -212,24 +228,44 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh)
212 } 228 }
213 229
214 if (0 != av7110->current_input) { 230 if (0 != av7110->current_input) {
231 dprintk(1, "switching to analog TV:\n");
215 adswitch = 1; 232 adswitch = 1;
216 source = SAA7146_HPS_SOURCE_PORT_B; 233 source = SAA7146_HPS_SOURCE_PORT_B;
217 sync = SAA7146_HPS_SYNC_PORT_B; 234 sync = SAA7146_HPS_SYNC_PORT_B;
218 memcpy(standard, analog_standard, sizeof(struct saa7146_standard) * 2); 235 memcpy(standard, analog_standard, sizeof(struct saa7146_standard) * 2);
219 dprintk(1, "switching to analog TV\n");
220 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source
221 msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source
222 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source
223 msp_writereg(av7110, MSP_WR_DSP, 0x000e, 0x3000); // FM matrix, mono
224 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x4f00); // loudspeaker + headphone
225 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x4f00); // SCART 1 volume
226 236
227 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { 237 switch (av7110->current_input) {
228 if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) 238 case 1:
229 dprintk(1, "setting band in demodulator failed.\n"); 239 dprintk(1, "switching SAA7113 to Analog Tuner Input.\n");
230 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 240 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source
231 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD) 241 msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source
232 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF) 242 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source
243 msp_writereg(av7110, MSP_WR_DSP, 0x000e, 0x3000); // FM matrix, mono
244 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x4f00); // loudspeaker + headphone
245 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x4f00); // SCART 1 volume
246
247 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) {
248 if (ves1820_writereg(dev, 0x09, 0x0f, 0x60))
249 dprintk(1, "setting band in demodulator failed.\n");
250 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
251 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD)
252 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF)
253 }
254 if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1)
255 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
256 break;
257 case 2:
258 dprintk(1, "switching SAA7113 to Video AV CVBS Input.\n");
259 if (i2c_writereg(av7110, 0x48, 0x02, 0xd2) != 1)
260 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
261 break;
262 case 3:
263 dprintk(1, "switching SAA7113 to Video AV Y/C Input.\n");
264 if (i2c_writereg(av7110, 0x48, 0x02, 0xd9) != 1)
265 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
266 break;
267 default:
268 dprintk(1, "switching SAA7113 to Input: AV7110: SAA7113: invalid input.\n");
233 } 269 }
234 } else { 270 } else {
235 adswitch = 0; 271 adswitch = 0;
@@ -300,7 +336,6 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
300 // FIXME: standard / stereo detection is still broken 336 // FIXME: standard / stereo detection is still broken
301 msp_readreg(av7110, MSP_RD_DEM, 0x007e, &stereo_det); 337 msp_readreg(av7110, MSP_RD_DEM, 0x007e, &stereo_det);
302 dprintk(1, "VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); 338 dprintk(1, "VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det);
303
304 msp_readreg(av7110, MSP_RD_DSP, 0x0018, &stereo_det); 339 msp_readreg(av7110, MSP_RD_DSP, 0x0018, &stereo_det);
305 dprintk(1, "VIDIOC_G_TUNER: msp3400 stereo detection: 0x%04x\n", stereo_det); 340 dprintk(1, "VIDIOC_G_TUNER: msp3400 stereo detection: 0x%04x\n", stereo_det);
306 stereo = (s8)(stereo_det >> 8); 341 stereo = (s8)(stereo_det >> 8);
@@ -310,7 +345,7 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
310 t->audmode = V4L2_TUNER_MODE_STEREO; 345 t->audmode = V4L2_TUNER_MODE_STEREO;
311 } 346 }
312 else if (stereo < -0x10) { 347 else if (stereo < -0x10) {
313 /* bilingual*/ 348 /* bilingual */
314 t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; 349 t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
315 t->audmode = V4L2_TUNER_MODE_LANG1; 350 t->audmode = V4L2_TUNER_MODE_LANG1;
316 } 351 }
@@ -344,7 +379,7 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
344 fm_matrix = 0x3000; // mono 379 fm_matrix = 0x3000; // mono
345 src = 0x0010; 380 src = 0x0010;
346 break; 381 break;
347 default: /* case V4L2_TUNER_MODE_MONO: {*/ 382 default: /* case V4L2_TUNER_MODE_MONO: */
348 dprintk(2, "VIDIOC_S_TUNER: TDA9840_SET_MONO\n"); 383 dprintk(2, "VIDIOC_S_TUNER: TDA9840_SET_MONO\n");
349 fm_matrix = 0x3000; // mono 384 fm_matrix = 0x3000; // mono
350 src = 0x0030; 385 src = 0x0030;
@@ -406,7 +441,7 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
406 dprintk(2, "VIDIOC_ENUMINPUT: %d\n", i->index); 441 dprintk(2, "VIDIOC_ENUMINPUT: %d\n", i->index);
407 442
408 if (av7110->analog_tuner_flags) { 443 if (av7110->analog_tuner_flags) {
409 if (i->index < 0 || i->index >= 2) 444 if (i->index < 0 || i->index >= 4)
410 return -EINVAL; 445 return -EINVAL;
411 } else { 446 } else {
412 if (i->index != 0) 447 if (i->index != 0)
@@ -433,10 +468,9 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
433 if (!av7110->analog_tuner_flags) 468 if (!av7110->analog_tuner_flags)
434 return 0; 469 return 0;
435 470
436 if (input < 0 || input >= 2) 471 if (input < 0 || input >= 4)
437 return -EINVAL; 472 return -EINVAL;
438 473
439 /* FIXME: switch inputs here */
440 av7110->current_input = input; 474 av7110->current_input = input;
441 return av7110_dvb_c_switch(fh); 475 return av7110_dvb_c_switch(fh);
442 } 476 }