aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mxb.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-03-17 08:37:02 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-21 11:53:57 -0500
commita8733ca5141c256322ab5ea9fd3074942a209bba (patch)
treeb1c197500cdeabe8e863d6aecb6c8e3740c25909 /drivers/media/video/mxb.c
parent4caba4261f2649215710ac0298bd7814080000ad (diff)
V4L/DVB (3537a): Whitespace cleanup
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/mxb.c')
-rw-r--r--drivers/media/video/mxb.c146
1 files changed, 73 insertions, 73 deletions
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 2f154f415bca..eb3b31867494 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -1,11 +1,11 @@
1/* 1/*
2 mxb - v4l2 driver for the Multimedia eXtension Board 2 mxb - v4l2 driver for the Multimedia eXtension Board
3 3
4 Copyright (C) 1998-2006 Michael Hunold <michael@mihu.de> 4 Copyright (C) 1998-2006 Michael Hunold <michael@mihu.de>
5 5
6 Visit http://www.mihu.de/linux/saa7146/mxb/ 6 Visit http://www.mihu.de/linux/saa7146/mxb/
7 for further details about this card. 7 for further details about this card.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or 11 the Free Software Foundation; either version 2 of the License, or
@@ -35,12 +35,12 @@
35 35
36#define I2C_SAA7111 0x24 36#define I2C_SAA7111 0x24
37 37
38#define MXB_BOARD_CAN_DO_VBI(dev) (dev->revision != 0) 38#define MXB_BOARD_CAN_DO_VBI(dev) (dev->revision != 0)
39 39
40/* global variable */ 40/* global variable */
41static int mxb_num = 0; 41static int mxb_num = 0;
42 42
43/* initial frequence the tuner will be tuned to. 43/* initial frequence the tuner will be tuned to.
44 in verden (lower saxony, germany) 4148 is a 44 in verden (lower saxony, germany) 4148 is a
45 channel called "phoenix" */ 45 channel called "phoenix" */
46static int freq = 4148; 46static int freq = 4148;
@@ -55,7 +55,7 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
55enum { TUNER, AUX1, AUX3, AUX3_YC }; 55enum { TUNER, AUX1, AUX3, AUX3_YC };
56 56
57static struct v4l2_input mxb_inputs[MXB_INPUTS] = { 57static struct v4l2_input mxb_inputs[MXB_INPUTS] = {
58 { TUNER, "Tuner", V4L2_INPUT_TYPE_TUNER, 1, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 }, 58 { TUNER, "Tuner", V4L2_INPUT_TYPE_TUNER, 1, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
59 { AUX1, "AUX1", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 }, 59 { AUX1, "AUX1", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
60 { AUX3, "AUX3 Composite", V4L2_INPUT_TYPE_CAMERA, 4, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 }, 60 { AUX3, "AUX3 Composite", V4L2_INPUT_TYPE_CAMERA, 4, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
61 { AUX3_YC, "AUX3 S-Video", V4L2_INPUT_TYPE_CAMERA, 4, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 }, 61 { AUX3_YC, "AUX3 S-Video", V4L2_INPUT_TYPE_CAMERA, 4, 0, V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, 0 },
@@ -66,7 +66,7 @@ static struct v4l2_input mxb_inputs[MXB_INPUTS] = {
66static struct { 66static struct {
67 int hps_source; 67 int hps_source;
68 int hps_sync; 68 int hps_sync;
69} input_port_selection[MXB_INPUTS] = { 69} input_port_selection[MXB_INPUTS] = {
70 { SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A }, 70 { SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A },
71 { SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A }, 71 { SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A },
72 { SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A }, 72 { SAA7146_HPS_SOURCE_PORT_A, SAA7146_HPS_SYNC_PORT_A },
@@ -81,7 +81,7 @@ static int video_audio_connect[MXB_INPUTS] =
81/* these are the necessary input-output-pins for bringing one audio source 81/* these are the necessary input-output-pins for bringing one audio source
82(see above) to the CD-output */ 82(see above) to the CD-output */
83static struct tea6420_multiplex TEA6420_cd[MXB_AUDIOS+1][2] = 83static struct tea6420_multiplex TEA6420_cd[MXB_AUDIOS+1][2] =
84 { 84 {
85 {{1,1,0},{1,1,0}}, /* Tuner */ 85 {{1,1,0},{1,1,0}}, /* Tuner */
86 {{5,1,0},{6,1,0}}, /* AUX 1 */ 86 {{5,1,0},{6,1,0}}, /* AUX 1 */
87 {{4,1,0},{6,1,0}}, /* AUX 2 */ 87 {{4,1,0},{6,1,0}}, /* AUX 2 */
@@ -122,8 +122,8 @@ static struct saa7146_extension_ioctls ioctls[] = {
122 { VIDIOC_S_FREQUENCY, SAA7146_EXCLUSIVE }, 122 { VIDIOC_S_FREQUENCY, SAA7146_EXCLUSIVE },
123 { VIDIOC_G_AUDIO, SAA7146_EXCLUSIVE }, 123 { VIDIOC_G_AUDIO, SAA7146_EXCLUSIVE },
124 { VIDIOC_S_AUDIO, SAA7146_EXCLUSIVE }, 124 { VIDIOC_S_AUDIO, SAA7146_EXCLUSIVE },
125 { MXB_S_AUDIO_CD, SAA7146_EXCLUSIVE }, /* custom control */ 125 { MXB_S_AUDIO_CD, SAA7146_EXCLUSIVE }, /* custom control */
126 { MXB_S_AUDIO_LINE, SAA7146_EXCLUSIVE }, /* custom control */ 126 { MXB_S_AUDIO_LINE, SAA7146_EXCLUSIVE }, /* custom control */
127 { 0, 0 } 127 { 0, 0 }
128}; 128};
129 129
@@ -132,7 +132,7 @@ struct mxb
132 struct video_device *video_dev; 132 struct video_device *video_dev;
133 struct video_device *vbi_dev; 133 struct video_device *vbi_dev;
134 134
135 struct i2c_adapter i2c_adapter; 135 struct i2c_adapter i2c_adapter;
136 136
137 struct i2c_client* saa7111a; 137 struct i2c_client* saa7111a;
138 struct i2c_client* tda9840; 138 struct i2c_client* tda9840;
@@ -200,15 +200,15 @@ static int mxb_probe(struct saa7146_dev* dev)
200 client = list_entry(item, struct i2c_client, list); 200 client = list_entry(item, struct i2c_client, list);
201 if( I2C_TEA6420_1 == client->addr ) 201 if( I2C_TEA6420_1 == client->addr )
202 mxb->tea6420_1 = client; 202 mxb->tea6420_1 = client;
203 if( I2C_TEA6420_2 == client->addr ) 203 if( I2C_TEA6420_2 == client->addr )
204 mxb->tea6420_2 = client; 204 mxb->tea6420_2 = client;
205 if( I2C_TEA6415C_2 == client->addr ) 205 if( I2C_TEA6415C_2 == client->addr )
206 mxb->tea6415c = client; 206 mxb->tea6415c = client;
207 if( I2C_TDA9840 == client->addr ) 207 if( I2C_TDA9840 == client->addr )
208 mxb->tda9840 = client; 208 mxb->tda9840 = client;
209 if( I2C_SAA7111 == client->addr ) 209 if( I2C_SAA7111 == client->addr )
210 mxb->saa7111a = client; 210 mxb->saa7111a = client;
211 if( 0x60 == client->addr ) 211 if( 0x60 == client->addr )
212 mxb->tuner = client; 212 mxb->tuner = client;
213 } 213 }
214 214
@@ -222,7 +222,7 @@ static int mxb_probe(struct saa7146_dev* dev)
222 return -ENODEV; 222 return -ENODEV;
223 } 223 }
224 224
225 /* all devices are present, probe was successful */ 225 /* all devices are present, probe was successful */
226 226
227 /* we store the pointer in our private data field */ 227 /* we store the pointer in our private data field */
228 dev->ext_priv = mxb; 228 dev->ext_priv = mxb;
@@ -230,7 +230,7 @@ static int mxb_probe(struct saa7146_dev* dev)
230 return 0; 230 return 0;
231} 231}
232 232
233/* some init data for the saa7740, the so-called 'sound arena module'. 233/* some init data for the saa7740, the so-called 'sound arena module'.
234 there are no specs available, so we simply use some init values */ 234 there are no specs available, so we simply use some init values */
235static struct { 235static struct {
236 int length; 236 int length;
@@ -330,7 +330,7 @@ static int mxb_init_done(struct saa7146_dev* dev)
330 v4l2_std_id std = V4L2_STD_PAL_BG; 330 v4l2_std_id std = V4L2_STD_PAL_BG;
331 331
332 int i = 0, err = 0; 332 int i = 0, err = 0;
333 struct tea6415c_multiplex vm; 333 struct tea6415c_multiplex vm;
334 334
335 /* select video mode in saa7111a */ 335 /* select video mode in saa7111a */
336 i = VIDEO_MODE_PAL; 336 i = VIDEO_MODE_PAL;
@@ -380,16 +380,16 @@ static int mxb_init_done(struct saa7146_dev* dev)
380 vm.in = 3; 380 vm.in = 3;
381 vm.out = 13; 381 vm.out = 13;
382 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); 382 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm);
383 383
384 /* the rest for mxb */ 384 /* the rest for mxb */
385 mxb->cur_input = 0; 385 mxb->cur_input = 0;
386 mxb->cur_mute = 1; 386 mxb->cur_mute = 1;
387 387
388 mxb->cur_mode = V4L2_TUNER_MODE_STEREO; 388 mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
389 mxb->tda9840->driver->command(mxb->tda9840, TDA9840_SWITCH, &mxb->cur_mode); 389 mxb->tda9840->driver->command(mxb->tda9840, TDA9840_SWITCH, &mxb->cur_mode);
390 390
391 /* check if the saa7740 (aka 'sound arena module') is present 391 /* check if the saa7740 (aka 'sound arena module') is present
392 on the mxb. if so, we must initialize it. due to lack of 392 on the mxb. if so, we must initialize it. due to lack of
393 informations about the saa7740, the values were reverse 393 informations about the saa7740, the values were reverse
394 engineered. */ 394 engineered. */
395 msg.addr = 0x1b; 395 msg.addr = 0x1b;
@@ -409,7 +409,7 @@ static int mxb_init_done(struct saa7146_dev* dev)
409 break; 409 break;
410 } 410 }
411 411
412 msg.len = mxb_saa7740_init[i].length; 412 msg.len = mxb_saa7740_init[i].length;
413 msg.buf = &mxb_saa7740_init[i].data[0]; 413 msg.buf = &mxb_saa7740_init[i].data[0];
414 if( 1 != (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) { 414 if( 1 != (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) {
415 DEB_D(("failed to initialize 'sound arena module'.\n")); 415 DEB_D(("failed to initialize 'sound arena module'.\n"));
@@ -418,12 +418,12 @@ static int mxb_init_done(struct saa7146_dev* dev)
418 } 418 }
419 INFO(("'sound arena module' detected.\n")); 419 INFO(("'sound arena module' detected.\n"));
420 } 420 }
421err: 421err:
422 /* the rest for saa7146: you should definitely set some basic values 422 /* the rest for saa7146: you should definitely set some basic values
423 for the input-port handling of the saa7146. */ 423 for the input-port handling of the saa7146. */
424 424
425 /* ext->saa has been filled by the core driver */ 425 /* ext->saa has been filled by the core driver */
426 426
427 /* some stuff is done via variables */ 427 /* some stuff is done via variables */
428 saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source, input_port_selection[mxb->cur_input].hps_sync); 428 saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source, input_port_selection[mxb->cur_input].hps_sync);
429 429
@@ -431,7 +431,7 @@ err:
431 431
432 /* this is ugly, but because of the fact that this is completely 432 /* this is ugly, but because of the fact that this is completely
433 hardware dependend, it should be done directly... */ 433 hardware dependend, it should be done directly... */
434 saa7146_write(dev, DD1_STREAM_B, 0x00000000); 434 saa7146_write(dev, DD1_STREAM_B, 0x00000000);
435 saa7146_write(dev, DD1_INIT, 0x02000200); 435 saa7146_write(dev, DD1_INIT, 0x02000200);
436 saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26)); 436 saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
437 437
@@ -453,7 +453,7 @@ static struct saa7146_ext_vv vv_data;
453static int mxb_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) 453static int mxb_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *info)
454{ 454{
455 struct mxb* mxb = (struct mxb*)dev->ext_priv; 455 struct mxb* mxb = (struct mxb*)dev->ext_priv;
456 456
457 DEB_EE(("dev:%p\n",dev)); 457 DEB_EE(("dev:%p\n",dev));
458 458
459 /* checking for i2c-devices can be omitted here, because we 459 /* checking for i2c-devices can be omitted here, because we
@@ -464,7 +464,7 @@ static int mxb_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data
464 ERR(("cannot register capture v4l2 device. skipping.\n")); 464 ERR(("cannot register capture v4l2 device. skipping.\n"));
465 return -1; 465 return -1;
466 } 466 }
467 467
468 /* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/ 468 /* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/
469 if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) { 469 if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) {
470 if( 0 != saa7146_register_device(&mxb->vbi_dev, dev, "mxb", VFL_TYPE_VBI)) { 470 if( 0 != saa7146_register_device(&mxb->vbi_dev, dev, "mxb", VFL_TYPE_VBI)) {
@@ -513,17 +513,17 @@ static int mxb_detach(struct saa7146_dev* dev)
513 return 0; 513 return 0;
514} 514}
515 515
516static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 516static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
517{ 517{
518 struct saa7146_dev *dev = fh->dev; 518 struct saa7146_dev *dev = fh->dev;
519 struct mxb* mxb = (struct mxb*)dev->ext_priv; 519 struct mxb* mxb = (struct mxb*)dev->ext_priv;
520 struct saa7146_vv *vv = dev->vv_data; 520 struct saa7146_vv *vv = dev->vv_data;
521 521
522 switch(cmd) { 522 switch(cmd) {
523 case VIDIOC_ENUMINPUT: 523 case VIDIOC_ENUMINPUT:
524 { 524 {
525 struct v4l2_input *i = arg; 525 struct v4l2_input *i = arg;
526 526
527 DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index)); 527 DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index));
528 if( i->index < 0 || i->index >= MXB_INPUTS) { 528 if( i->index < 0 || i->index >= MXB_INPUTS) {
529 return -EINVAL; 529 return -EINVAL;
@@ -559,11 +559,11 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
559 break; 559 break;
560 } 560 }
561 } 561 }
562 562
563 if( i < 0 ) { 563 if( i < 0 ) {
564 return -EAGAIN; 564 return -EAGAIN;
565 } 565 }
566 566
567 switch (vc->id ) { 567 switch (vc->id ) {
568 case V4L2_CID_AUDIO_MUTE: { 568 case V4L2_CID_AUDIO_MUTE: {
569 vc->value = mxb->cur_mute; 569 vc->value = mxb->cur_mute;
@@ -571,7 +571,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
571 return 0; 571 return 0;
572 } 572 }
573 } 573 }
574 574
575 DEB_EE(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n",vc->value)); 575 DEB_EE(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n",vc->value));
576 return 0; 576 return 0;
577 } 577 }
@@ -580,17 +580,17 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
580 { 580 {
581 struct v4l2_control *vc = arg; 581 struct v4l2_control *vc = arg;
582 int i = 0; 582 int i = 0;
583 583
584 for (i = MAXCONTROLS - 1; i >= 0; i--) { 584 for (i = MAXCONTROLS - 1; i >= 0; i--) {
585 if (mxb_controls[i].id == vc->id) { 585 if (mxb_controls[i].id == vc->id) {
586 break; 586 break;
587 } 587 }
588 } 588 }
589 589
590 if( i < 0 ) { 590 if( i < 0 ) {
591 return -EAGAIN; 591 return -EAGAIN;
592 } 592 }
593 593
594 switch (vc->id ) { 594 switch (vc->id ) {
595 case V4L2_CID_AUDIO_MUTE: { 595 case V4L2_CID_AUDIO_MUTE: {
596 mxb->cur_mute = vc->value; 596 mxb->cur_mute = vc->value;
@@ -614,12 +614,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
614 *input = mxb->cur_input; 614 *input = mxb->cur_input;
615 615
616 DEB_EE(("VIDIOC_G_INPUT %d.\n",*input)); 616 DEB_EE(("VIDIOC_G_INPUT %d.\n",*input));
617 return 0; 617 return 0;
618 } 618 }
619 case VIDIOC_S_INPUT: 619 case VIDIOC_S_INPUT:
620 { 620 {
621 int input = *(int *)arg; 621 int input = *(int *)arg;
622 struct tea6415c_multiplex vm; 622 struct tea6415c_multiplex vm;
623 int i = 0; 623 int i = 0;
624 624
625 DEB_EE(("VIDIOC_S_INPUT %d.\n",input)); 625 DEB_EE(("VIDIOC_S_INPUT %d.\n",input));
@@ -627,34 +627,34 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
627 if (input < 0 || input >= MXB_INPUTS) { 627 if (input < 0 || input >= MXB_INPUTS) {
628 return -EINVAL; 628 return -EINVAL;
629 } 629 }
630 630
631 /* fixme: locke das setzen des inputs mit hilfe des mutexes 631 /* fixme: locke das setzen des inputs mit hilfe des mutexes
632 mutex_lock(&dev->lock); 632 mutex_lock(&dev->lock);
633 video_mux(dev,*i); 633 video_mux(dev,*i);
634 mutex_unlock(&dev->lock); 634 mutex_unlock(&dev->lock);
635 */ 635 */
636 636
637 /* fixme: check if streaming capture 637 /* fixme: check if streaming capture
638 if ( 0 != dev->streaming ) { 638 if ( 0 != dev->streaming ) {
639 DEB_D(("VIDIOC_S_INPUT illegal while streaming.\n")); 639 DEB_D(("VIDIOC_S_INPUT illegal while streaming.\n"));
640 return -EPERM; 640 return -EPERM;
641 } 641 }
642 */ 642 */
643 643
644 mxb->cur_input = input; 644 mxb->cur_input = input;
645 645
646 saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source, input_port_selection[input].hps_sync); 646 saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source, input_port_selection[input].hps_sync);
647 647
648 /* prepare switching of tea6415c and saa7111a; 648 /* prepare switching of tea6415c and saa7111a;
649 have a look at the 'background'-file for further informations */ 649 have a look at the 'background'-file for further informations */
650 switch( input ) { 650 switch( input ) {
651 651
652 case TUNER: 652 case TUNER:
653 { 653 {
654 i = 0; 654 i = 0;
655 vm.in = 3; 655 vm.in = 3;
656 vm.out = 17; 656 vm.out = 17;
657 657
658 if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) { 658 if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) {
659 printk("VIDIOC_S_INPUT: could not address tea6415c #1\n"); 659 printk("VIDIOC_S_INPUT: could not address tea6415c #1\n");
660 return -EFAULT; 660 return -EFAULT;
@@ -662,7 +662,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
662 /* connect tuner-output always to multicable */ 662 /* connect tuner-output always to multicable */
663 vm.in = 3; 663 vm.in = 3;
664 vm.out = 13; 664 vm.out = 13;
665 break; 665 break;
666 } 666 }
667 case AUX3_YC: 667 case AUX3_YC:
668 { 668 {
@@ -703,11 +703,11 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
703 break; 703 break;
704 } 704 }
705 } 705 }
706 706
707 /* switch video in saa7111a */ 707 /* switch video in saa7111a */
708 if ( 0 != mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_INPUT, &i)) { 708 if ( 0 != mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_INPUT, &i)) {
709 printk("VIDIOC_S_INPUT: could not address saa7111a #1.\n"); 709 printk("VIDIOC_S_INPUT: could not address saa7111a #1.\n");
710 } 710 }
711 711
712 /* switch the audio-source only if necessary */ 712 /* switch the audio-source only if necessary */
713 if( 0 == mxb->cur_mute ) { 713 if( 0 == mxb->cur_mute ) {
@@ -738,11 +738,11 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
738 t->rangehigh = 13684; /* 855.25 MHz / 62.5 kHz = 13684 */ 738 t->rangehigh = 13684; /* 855.25 MHz / 62.5 kHz = 13684 */
739 /* FIXME: add the real signal strength here */ 739 /* FIXME: add the real signal strength here */
740 t->signal = 0xffff; 740 t->signal = 0xffff;
741 t->afc = 0; 741 t->afc = 0;
742 742
743 mxb->tda9840->driver->command(mxb->tda9840,TDA9840_DETECT, &byte); 743 mxb->tda9840->driver->command(mxb->tda9840,TDA9840_DETECT, &byte);
744 t->audmode = mxb->cur_mode; 744 t->audmode = mxb->cur_mode;
745 745
746 if( byte < 0 ) { 746 if( byte < 0 ) {
747 t->rxsubchans = V4L2_TUNER_SUB_MONO; 747 t->rxsubchans = V4L2_TUNER_SUB_MONO;
748 } else { 748 } else {
@@ -777,12 +777,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
777 struct v4l2_tuner *t = arg; 777 struct v4l2_tuner *t = arg;
778 int result = 0; 778 int result = 0;
779 int byte = 0; 779 int byte = 0;
780 780
781 if( 0 != t->index ) { 781 if( 0 != t->index ) {
782 DEB_D(("VIDIOC_S_TUNER: channel %d does not have a tuner attached.\n",t->index)); 782 DEB_D(("VIDIOC_S_TUNER: channel %d does not have a tuner attached.\n",t->index));
783 return -EINVAL; 783 return -EINVAL;
784 } 784 }
785 785
786 switch(t->audmode) { 786 switch(t->audmode) {
787 case V4L2_TUNER_MODE_STEREO: { 787 case V4L2_TUNER_MODE_STEREO: {
788 mxb->cur_mode = V4L2_TUNER_MODE_STEREO; 788 mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
@@ -813,7 +813,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
813 if( 0 != (result = mxb->tda9840->driver->command(mxb->tda9840, TDA9840_SWITCH, &byte))) { 813 if( 0 != (result = mxb->tda9840->driver->command(mxb->tda9840, TDA9840_SWITCH, &byte))) {
814 printk("VIDIOC_S_TUNER error. result:%d, byte:%d\n",result,byte); 814 printk("VIDIOC_S_TUNER error. result:%d, byte:%d\n",result,byte);
815 } 815 }
816 816
817 return 0; 817 return 0;
818 } 818 }
819 case VIDIOC_G_FREQUENCY: 819 case VIDIOC_G_FREQUENCY:
@@ -839,7 +839,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
839 839
840 if (V4L2_TUNER_ANALOG_TV != f->type) 840 if (V4L2_TUNER_ANALOG_TV != f->type)
841 return -EINVAL; 841 return -EINVAL;
842 842
843 if(0 != mxb->cur_input) { 843 if(0 != mxb->cur_input) {
844 DEB_D(("VIDIOC_S_FREQ: channel %d does not have a tuner!\n",mxb->cur_input)); 844 DEB_D(("VIDIOC_S_FREQ: channel %d does not have a tuner!\n",mxb->cur_input));
845 return -EINVAL; 845 return -EINVAL;
@@ -848,7 +848,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
848 mxb->cur_freq = *f; 848 mxb->cur_freq = *f;
849 DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n", mxb->cur_freq.frequency)); 849 DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n", mxb->cur_freq.frequency));
850 850
851 /* tune in desired frequency */ 851 /* tune in desired frequency */
852 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY, &mxb->cur_freq); 852 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY, &mxb->cur_freq);
853 853
854 /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */ 854 /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */
@@ -861,12 +861,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
861 case MXB_S_AUDIO_CD: 861 case MXB_S_AUDIO_CD:
862 { 862 {
863 int i = *(int*)arg; 863 int i = *(int*)arg;
864 864
865 if( i < 0 || i >= MXB_AUDIOS ) { 865 if( i < 0 || i >= MXB_AUDIOS ) {
866 DEB_D(("illegal argument to MXB_S_AUDIO_CD: i:%d.\n",i)); 866 DEB_D(("illegal argument to MXB_S_AUDIO_CD: i:%d.\n",i));
867 return -EINVAL; 867 return -EINVAL;
868 } 868 }
869 869
870 DEB_EE(("MXB_S_AUDIO_CD: i:%d.\n",i)); 870 DEB_EE(("MXB_S_AUDIO_CD: i:%d.\n",i));
871 871
872 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_cd[i][0]); 872 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_cd[i][0]);
@@ -877,12 +877,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
877 case MXB_S_AUDIO_LINE: 877 case MXB_S_AUDIO_LINE:
878 { 878 {
879 int i = *(int*)arg; 879 int i = *(int*)arg;
880 880
881 if( i < 0 || i >= MXB_AUDIOS ) { 881 if( i < 0 || i >= MXB_AUDIOS ) {
882 DEB_D(("illegal argument to MXB_S_AUDIO_LINE: i:%d.\n",i)); 882 DEB_D(("illegal argument to MXB_S_AUDIO_LINE: i:%d.\n",i));
883 return -EINVAL; 883 return -EINVAL;
884 } 884 }
885 885
886 DEB_EE(("MXB_S_AUDIO_LINE: i:%d.\n",i)); 886 DEB_EE(("MXB_S_AUDIO_LINE: i:%d.\n",i));
887 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[i][0]); 887 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[i][0]);
888 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[i][1]); 888 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[i][1]);
@@ -894,13 +894,13 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
894 struct v4l2_audio *a = arg; 894 struct v4l2_audio *a = arg;
895 895
896 if( a->index < 0 || a->index > MXB_INPUTS ) { 896 if( a->index < 0 || a->index > MXB_INPUTS ) {
897 DEB_D(("VIDIOC_G_AUDIO %d out of range.\n",a->index)); 897 DEB_D(("VIDIOC_G_AUDIO %d out of range.\n",a->index));
898 return -EINVAL; 898 return -EINVAL;
899 } 899 }
900 900
901 DEB_EE(("VIDIOC_G_AUDIO %d.\n",a->index)); 901 DEB_EE(("VIDIOC_G_AUDIO %d.\n",a->index));
902 memcpy(a, &mxb_audios[video_audio_connect[mxb->cur_input]], sizeof(struct v4l2_audio)); 902 memcpy(a, &mxb_audios[video_audio_connect[mxb->cur_input]], sizeof(struct v4l2_audio));
903 903
904 return 0; 904 return 0;
905 } 905 }
906 case VIDIOC_S_AUDIO: 906 case VIDIOC_S_AUDIO:
@@ -908,7 +908,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
908 struct v4l2_audio *a = arg; 908 struct v4l2_audio *a = arg;
909 DEB_D(("VIDIOC_S_AUDIO %d.\n",a->index)); 909 DEB_D(("VIDIOC_S_AUDIO %d.\n",a->index));
910 return 0; 910 return 0;
911 } 911 }
912 default: 912 default:
913/* 913/*
914 DEB2(printk("does not handle this ioctl.\n")); 914 DEB2(printk("does not handle this ioctl.\n"));
@@ -928,7 +928,7 @@ static int std_callback(struct saa7146_dev* dev, struct saa7146_standard *std)
928 v4l2_std_id std = V4L2_STD_PAL_I; 928 v4l2_std_id std = V4L2_STD_PAL_I;
929 DEB_D(("VIDIOC_S_STD: setting mxb for PAL_I.\n")); 929 DEB_D(("VIDIOC_S_STD: setting mxb for PAL_I.\n"));
930 /* set the 7146 gpio register -- I don't know what this does exactly */ 930 /* set the 7146 gpio register -- I don't know what this does exactly */
931 saa7146_write(dev, GPIO_CTRL, 0x00404050); 931 saa7146_write(dev, GPIO_CTRL, 0x00404050);
932 /* unset the 7111 gpio register -- I don't know what this does exactly */ 932 /* unset the 7111 gpio register -- I don't know what this does exactly */
933 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &zero); 933 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &zero);
934 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); 934 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std);
@@ -936,7 +936,7 @@ static int std_callback(struct saa7146_dev* dev, struct saa7146_standard *std)
936 v4l2_std_id std = V4L2_STD_PAL_BG; 936 v4l2_std_id std = V4L2_STD_PAL_BG;
937 DEB_D(("VIDIOC_S_STD: setting mxb for PAL/NTSC/SECAM.\n")); 937 DEB_D(("VIDIOC_S_STD: setting mxb for PAL/NTSC/SECAM.\n"));
938 /* set the 7146 gpio register -- I don't know what this does exactly */ 938 /* set the 7146 gpio register -- I don't know what this does exactly */
939 saa7146_write(dev, GPIO_CTRL, 0x00404050); 939 saa7146_write(dev, GPIO_CTRL, 0x00404050);
940 /* set the 7111 gpio register -- I don't know what this does exactly */ 940 /* set the 7111 gpio register -- I don't know what this does exactly */
941 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &one); 941 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &one);
942 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); 942 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std);
@@ -969,8 +969,8 @@ static struct saa7146_standard standard[] = {
969}; 969};
970 970
971static struct saa7146_pci_extension_data mxb = { 971static struct saa7146_pci_extension_data mxb = {
972 .ext_priv = "Multimedia eXtension Board", 972 .ext_priv = "Multimedia eXtension Board",
973 .ext = &extension, 973 .ext = &extension,
974}; 974};
975 975
976static struct pci_device_id pci_tbl[] = { 976static struct pci_device_id pci_tbl[] = {
@@ -992,7 +992,7 @@ static struct saa7146_ext_vv vv_data = {
992 .capabilities = V4L2_CAP_TUNER | V4L2_CAP_VBI_CAPTURE, 992 .capabilities = V4L2_CAP_TUNER | V4L2_CAP_VBI_CAPTURE,
993 .stds = &standard[0], 993 .stds = &standard[0],
994 .num_stds = sizeof(standard)/sizeof(struct saa7146_standard), 994 .num_stds = sizeof(standard)/sizeof(struct saa7146_standard),
995 .std_callback = &std_callback, 995 .std_callback = &std_callback,
996 .ioctls = &ioctls[0], 996 .ioctls = &ioctls[0],
997 .ioctl = mxb_ioctl, 997 .ioctl = mxb_ioctl,
998}; 998};
@@ -1000,7 +1000,7 @@ static struct saa7146_ext_vv vv_data = {
1000static struct saa7146_extension extension = { 1000static struct saa7146_extension extension = {
1001 .name = MXB_IDENTIFIER, 1001 .name = MXB_IDENTIFIER,
1002 .flags = SAA7146_USE_I2C_IRQ, 1002 .flags = SAA7146_USE_I2C_IRQ,
1003 1003
1004 .pci_tbl = &pci_tbl[0], 1004 .pci_tbl = &pci_tbl[0],
1005 .module = THIS_MODULE, 1005 .module = THIS_MODULE,
1006 1006
@@ -1010,7 +1010,7 @@ static struct saa7146_extension extension = {
1010 1010
1011 .irq_mask = 0, 1011 .irq_mask = 0,
1012 .irq_func = NULL, 1012 .irq_func = NULL,
1013}; 1013};
1014 1014
1015static int __init mxb_init_module(void) 1015static int __init mxb_init_module(void)
1016{ 1016{
@@ -1018,7 +1018,7 @@ static int __init mxb_init_module(void)
1018 DEB_S(("failed to register extension.\n")); 1018 DEB_S(("failed to register extension.\n"));
1019 return -ENODEV; 1019 return -ENODEV;
1020 } 1020 }
1021 1021
1022 return 0; 1022 return 0;
1023} 1023}
1024 1024