aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mxb.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-09-06 16:24:30 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:37:00 -0400
commit2633812f897cc354071699e86ea82e3bfd77cddc (patch)
treeafc1d056f4b723a1e0b239db2a702c82dafc62ad /drivers/media/video/mxb.c
parent707ecf4603a9439dcf409e13c5e9ed4e164ddfff (diff)
V4L/DVB (8942): mxb: coding style cleanups
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mxb.c')
-rw-r--r--drivers/media/video/mxb.c252
1 files changed, 119 insertions, 133 deletions
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 621d17408297..b2dae5062e65 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -137,12 +137,12 @@ struct mxb
137 137
138 struct i2c_adapter i2c_adapter; 138 struct i2c_adapter i2c_adapter;
139 139
140 struct i2c_client* saa7111a; 140 struct i2c_client *saa7111a;
141 struct i2c_client* tda9840; 141 struct i2c_client *tda9840;
142 struct i2c_client* tea6415c; 142 struct i2c_client *tea6415c;
143 struct i2c_client* tuner; 143 struct i2c_client *tuner;
144 struct i2c_client* tea6420_1; 144 struct i2c_client *tea6420_1;
145 struct i2c_client* tea6420_2; 145 struct i2c_client *tea6420_2;
146 146
147 int cur_mode; /* current audio mode (mono, stereo, ...) */ 147 int cur_mode; /* current audio mode (mono, stereo, ...) */
148 int cur_input; /* current input */ 148 int cur_input; /* current input */
@@ -154,7 +154,7 @@ static struct saa7146_extension extension;
154 154
155static int mxb_check_clients(struct device *dev, void *data) 155static int mxb_check_clients(struct device *dev, void *data)
156{ 156{
157 struct mxb* mxb = data; 157 struct mxb *mxb = data;
158 struct i2c_client *client = i2c_verify_client(dev); 158 struct i2c_client *client = i2c_verify_client(dev);
159 159
160 if (!client) 160 if (!client)
@@ -298,7 +298,7 @@ static struct {
298 { 9, { 0x1d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } }, 298 { 9, { 0x1d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } },
299 { 9, { 0x3d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } }, 299 { 9, { 0x3d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } },
300 { 3, { 0x80, 0xb3, 0x0a } }, 300 { 3, { 0x80, 0xb3, 0x0a } },
301 {-1, { 0} } 301 {-1, { 0 } }
302}; 302};
303 303
304/* bring hardware to a sane state. this has to be done, just in case someone 304/* bring hardware to a sane state. this has to be done, just in case someone
@@ -314,10 +314,9 @@ static int mxb_init_done(struct saa7146_dev* dev)
314 struct v4l2_routing route; 314 struct v4l2_routing route;
315 315
316 int i = 0, err = 0; 316 int i = 0, err = 0;
317 struct tea6415c_multiplex vm; 317 struct tea6415c_multiplex vm;
318 318
319 /* select video mode in saa7111a */ 319 /* select video mode in saa7111a */
320 /* fixme: currently pointless: gets overwritten by configuration below */
321 mxb->saa7111a->driver->command(mxb->saa7111a, VIDIOC_S_STD, &std); 320 mxb->saa7111a->driver->command(mxb->saa7111a, VIDIOC_S_STD, &std);
322 321
323 /* select tuner-output on saa7111a */ 322 /* select tuner-output on saa7111a */
@@ -342,20 +341,20 @@ static int mxb_init_done(struct saa7146_dev* dev)
342 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); 341 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std);
343 342
344 /* mute audio on tea6420s */ 343 /* mute audio on tea6420s */
345 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); 344 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH, &TEA6420_line[6][0]);
346 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]); 345 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH, &TEA6420_line[6][1]);
347 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_cd[6][0]); 346 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH, &TEA6420_cd[6][0]);
348 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_cd[6][1]); 347 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH, &TEA6420_cd[6][1]);
349 348
350 /* switch to tuner-channel on tea6415c*/ 349 /* switch to tuner-channel on tea6415c*/
351 vm.out = 17; 350 vm.out = 17;
352 vm.in = 3; 351 vm.in = 3;
353 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); 352 mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm);
354 353
355 /* select tuner-output on multicable on tea6415c*/ 354 /* select tuner-output on multicable on tea6415c*/
356 vm.in = 3; 355 vm.in = 3;
357 vm.out = 13; 356 vm.out = 13;
358 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); 357 mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm);
359 358
360 /* the rest for mxb */ 359 /* the rest for mxb */
361 mxb->cur_input = 0; 360 mxb->cur_input = 0;
@@ -372,21 +371,22 @@ static int mxb_init_done(struct saa7146_dev* dev)
372 msg.len = mxb_saa7740_init[0].length; 371 msg.len = mxb_saa7740_init[0].length;
373 msg.buf = &mxb_saa7740_init[0].data[0]; 372 msg.buf = &mxb_saa7740_init[0].data[0];
374 373
375 if( 1 == (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) { 374 err = i2c_transfer(&mxb->i2c_adapter, &msg, 1);
375 if (err == 1) {
376 /* the sound arena module is a pos, that's probably the reason 376 /* the sound arena module is a pos, that's probably the reason
377 philips refuses to hand out a datasheet for the saa7740... 377 philips refuses to hand out a datasheet for the saa7740...
378 it seems to screw up the i2c bus, so we disable fast irq 378 it seems to screw up the i2c bus, so we disable fast irq
379 based i2c transactions here and rely on the slow and safe 379 based i2c transactions here and rely on the slow and safe
380 polling method ... */ 380 polling method ... */
381 extension.flags &= ~SAA7146_USE_I2C_IRQ; 381 extension.flags &= ~SAA7146_USE_I2C_IRQ;
382 for(i = 1;;i++) { 382 for (i = 1; ; i++) {
383 if( -1 == mxb_saa7740_init[i].length ) { 383 if (-1 == mxb_saa7740_init[i].length)
384 break; 384 break;
385 }
386 385
387 msg.len = mxb_saa7740_init[i].length; 386 msg.len = mxb_saa7740_init[i].length;
388 msg.buf = &mxb_saa7740_init[i].data[0]; 387 msg.buf = &mxb_saa7740_init[i].data[0];
389 if( 1 != (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) { 388 err = i2c_transfer(&mxb->i2c_adapter, &msg, 1);
389 if (err != 1) {
390 DEB_D(("failed to initialize 'sound arena module'.\n")); 390 DEB_D(("failed to initialize 'sound arena module'.\n"));
391 goto err; 391 goto err;
392 } 392 }
@@ -400,7 +400,8 @@ err:
400 /* ext->saa has been filled by the core driver */ 400 /* ext->saa has been filled by the core driver */
401 401
402 /* some stuff is done via variables */ 402 /* some stuff is done via variables */
403 saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source, input_port_selection[mxb->cur_input].hps_sync); 403 saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source,
404 input_port_selection[mxb->cur_input].hps_sync);
404 405
405 /* some stuff is done via direct write to the registers */ 406 /* some stuff is done via direct write to the registers */
406 407
@@ -425,11 +426,11 @@ void mxb_irq_bh(struct saa7146_dev* dev, u32* irq_mask)
425static struct saa7146_ext_vv vv_data; 426static struct saa7146_ext_vv vv_data;
426 427
427/* this function only gets called when the probing was successful */ 428/* this function only gets called when the probing was successful */
428static int mxb_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) 429static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
429{ 430{
430 struct mxb* mxb = (struct mxb*)dev->ext_priv; 431 struct mxb *mxb = (struct mxb *)dev->ext_priv;
431 432
432 DEB_EE(("dev:%p\n",dev)); 433 DEB_EE(("dev:%p\n", dev));
433 434
434 /* checking for i2c-devices can be omitted here, because we 435 /* checking for i2c-devices can be omitted here, because we
435 already did this in "mxb_vl42_probe" */ 436 already did this in "mxb_vl42_probe" */
@@ -461,11 +462,11 @@ static int mxb_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data
461 return 0; 462 return 0;
462} 463}
463 464
464static int mxb_detach(struct saa7146_dev* dev) 465static int mxb_detach(struct saa7146_dev *dev)
465{ 466{
466 struct mxb* mxb = (struct mxb*)dev->ext_priv; 467 struct mxb *mxb = (struct mxb *)dev->ext_priv;
467 468
468 DEB_EE(("dev:%p\n",dev)); 469 DEB_EE(("dev:%p\n", dev));
469 470
470 i2c_release_client(mxb->tea6420_1); 471 i2c_release_client(mxb->tea6420_1);
471 i2c_release_client(mxb->tea6420_2); 472 i2c_release_client(mxb->tea6420_2);
@@ -475,9 +476,8 @@ static int mxb_detach(struct saa7146_dev* dev)
475 i2c_release_client(mxb->tuner); 476 i2c_release_client(mxb->tuner);
476 477
477 saa7146_unregister_device(&mxb->video_dev,dev); 478 saa7146_unregister_device(&mxb->video_dev,dev);
478 if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) { 479 if (MXB_BOARD_CAN_DO_VBI(dev))
479 saa7146_unregister_device(&mxb->vbi_dev,dev); 480 saa7146_unregister_device(&mxb->vbi_dev, dev);
480 }
481 saa7146_vv_release(dev); 481 saa7146_vv_release(dev);
482 482
483 mxb_num--; 483 mxb_num--;
@@ -491,7 +491,7 @@ static int mxb_detach(struct saa7146_dev* dev)
491static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 491static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
492{ 492{
493 struct saa7146_dev *dev = fh->dev; 493 struct saa7146_dev *dev = fh->dev;
494 struct mxb* mxb = (struct mxb*)dev->ext_priv; 494 struct mxb *mxb = (struct mxb *)dev->ext_priv;
495 struct saa7146_vv *vv = dev->vv_data; 495 struct saa7146_vv *vv = dev->vv_data;
496 496
497 switch(cmd) { 497 switch(cmd) {
@@ -500,11 +500,9 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
500 struct v4l2_input *i = arg; 500 struct v4l2_input *i = arg;
501 501
502 DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index)); 502 DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index));
503 if( i->index < 0 || i->index >= MXB_INPUTS) { 503 if (i->index < 0 || i->index >= MXB_INPUTS)
504 return -EINVAL; 504 return -EINVAL;
505 }
506 memcpy(i, &mxb_inputs[i->index], sizeof(struct v4l2_input)); 505 memcpy(i, &mxb_inputs[i->index], sizeof(struct v4l2_input));
507
508 return 0; 506 return 0;
509 } 507 }
510 /* the saa7146 provides some controls (brightness, contrast, saturation) 508 /* the saa7146 provides some controls (brightness, contrast, saturation)
@@ -518,7 +516,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
518 for (i = MAXCONTROLS - 1; i >= 0; i--) { 516 for (i = MAXCONTROLS - 1; i >= 0; i--) {
519 if (mxb_controls[i].id == qc->id) { 517 if (mxb_controls[i].id == qc->id) {
520 *qc = mxb_controls[i]; 518 *qc = mxb_controls[i];
521 DEB_D(("VIDIOC_QUERYCTRL %d.\n",qc->id)); 519 DEB_D(("VIDIOC_QUERYCTRL %d.\n", qc->id));
522 return 0; 520 return 0;
523 } 521 }
524 } 522 }
@@ -530,56 +528,51 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
530 int i; 528 int i;
531 529
532 for (i = MAXCONTROLS - 1; i >= 0; i--) { 530 for (i = MAXCONTROLS - 1; i >= 0; i--) {
533 if (mxb_controls[i].id == vc->id) { 531 if (mxb_controls[i].id == vc->id)
534 break; 532 break;
535 }
536 } 533 }
537 534
538 if( i < 0 ) { 535 if (i < 0)
539 return -EAGAIN; 536 return -EAGAIN;
540 }
541 537
542 switch (vc->id ) { 538 if (vc->id == V4L2_CID_AUDIO_MUTE) {
543 case V4L2_CID_AUDIO_MUTE: { 539 vc->value = mxb->cur_mute;
544 vc->value = mxb->cur_mute; 540 DEB_D(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n", vc->value));
545 DEB_D(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n",vc->value)); 541 return 0;
546 return 0;
547 }
548 } 542 }
549 543
550 DEB_EE(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n",vc->value)); 544 DEB_EE(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n", vc->value));
551 return 0; 545 return 0;
552 } 546 }
553 547
554 case VIDIOC_S_CTRL: 548 case VIDIOC_S_CTRL:
555 { 549 {
556 struct v4l2_control *vc = arg; 550 struct v4l2_control *vc = arg;
557 int i = 0; 551 int i = 0;
558 552
559 for (i = MAXCONTROLS - 1; i >= 0; i--) { 553 for (i = MAXCONTROLS - 1; i >= 0; i--) {
560 if (mxb_controls[i].id == vc->id) { 554 if (mxb_controls[i].id == vc->id)
561 break; 555 break;
562 }
563 } 556 }
564 557
565 if( i < 0 ) { 558 if (i < 0)
566 return -EAGAIN; 559 return -EAGAIN;
567 }
568 560
569 switch (vc->id ) { 561 if (vc->id == V4L2_CID_AUDIO_MUTE) {
570 case V4L2_CID_AUDIO_MUTE: { 562 mxb->cur_mute = vc->value;
571 mxb->cur_mute = vc->value; 563 if (!vc->value) {
572 if( 0 == vc->value ) { 564 /* switch the audio-source */
573 /* switch the audio-source */ 565 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH,
574 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[mxb->cur_input]][0]); 566 &TEA6420_line[video_audio_connect[mxb->cur_input]][0]);
575 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[mxb->cur_input]][1]); 567 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH,
576 } else { 568 &TEA6420_line[video_audio_connect[mxb->cur_input]][1]);
577 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); 569 } else {
578 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]); 570 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH,
579 } 571 &TEA6420_line[6][0]);
580 DEB_EE(("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d.\n",vc->value)); 572 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH,
581 break; 573 &TEA6420_line[6][1]);
582 } 574 }
575 DEB_EE(("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d.\n", vc->value));
583 } 576 }
584 return 0; 577 return 0;
585 } 578 }
@@ -588,7 +581,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
588 int *input = (int *)arg; 581 int *input = (int *)arg;
589 *input = mxb->cur_input; 582 *input = mxb->cur_input;
590 583
591 DEB_EE(("VIDIOC_G_INPUT %d.\n",*input)); 584 DEB_EE(("VIDIOC_G_INPUT %d.\n", *input));
592 return 0; 585 return 0;
593 } 586 }
594 case VIDIOC_S_INPUT: 587 case VIDIOC_S_INPUT:
@@ -598,73 +591,60 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
598 struct v4l2_routing route; 591 struct v4l2_routing route;
599 int i = 0; 592 int i = 0;
600 593
601 DEB_EE(("VIDIOC_S_INPUT %d.\n",input)); 594 DEB_EE(("VIDIOC_S_INPUT %d.\n", input));
602 595
603 if (input < 0 || input >= MXB_INPUTS) { 596 if (input < 0 || input >= MXB_INPUTS)
604 return -EINVAL; 597 return -EINVAL;
605 }
606 598
607 mxb->cur_input = input; 599 mxb->cur_input = input;
608 600
609 saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source, input_port_selection[input].hps_sync); 601 saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source,
602 input_port_selection[input].hps_sync);
610 603
611 /* prepare switching of tea6415c and saa7111a; 604 /* prepare switching of tea6415c and saa7111a;
612 have a look at the 'background'-file for further informations */ 605 have a look at the 'background'-file for further informations */
613 switch( input ) { 606 switch (input) {
614 607 case TUNER:
615 case TUNER: 608 i = SAA7115_COMPOSITE0;
616 { 609 vm.in = 3;
617 i = SAA7115_COMPOSITE0; 610 vm.out = 17;
618 vm.in = 3; 611
619 vm.out = 17; 612 if (mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm)) {
620 613 printk(KERN_ERR "VIDIOC_S_INPUT: could not address tea6415c #1\n");
621 if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) { 614 return -EFAULT;
622 printk("VIDIOC_S_INPUT: could not address tea6415c #1\n");
623 return -EFAULT;
624 }
625 /* connect tuner-output always to multicable */
626 vm.in = 3;
627 vm.out = 13;
628 break;
629 }
630 case AUX3_YC:
631 {
632 /* nothing to be done here. aux3_yc is
633 directly connected to the saa711a */
634 i = SAA7115_SVIDEO1;
635 break;
636 }
637 case AUX3:
638 {
639 /* nothing to be done here. aux3 is
640 directly connected to the saa711a */
641 i = SAA7115_COMPOSITE1;
642 break;
643 }
644 case AUX1:
645 {
646 i = SAA7115_COMPOSITE0;
647 vm.in = 1;
648 vm.out = 17;
649 break;
650 } 615 }
616 /* connect tuner-output always to multicable */
617 vm.in = 3;
618 vm.out = 13;
619 break;
620 case AUX3_YC:
621 /* nothing to be done here. aux3_yc is
622 directly connected to the saa711a */
623 i = SAA7115_SVIDEO1;
624 break;
625 case AUX3:
626 /* nothing to be done here. aux3 is
627 directly connected to the saa711a */
628 i = SAA7115_COMPOSITE1;
629 break;
630 case AUX1:
631 i = SAA7115_COMPOSITE0;
632 vm.in = 1;
633 vm.out = 17;
634 break;
651 } 635 }
652 636
653 /* switch video in tea6415c only if necessary */ 637 /* switch video in tea6415c only if necessary */
654 switch( input ) { 638 switch (input) {
655 case TUNER: 639 case TUNER:
656 case AUX1: 640 case AUX1:
657 { 641 if (mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm)) {
658 if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) { 642 printk(KERN_ERR "VIDIOC_S_INPUT: could not address tea6415c #3\n");
659 printk("VIDIOC_S_INPUT: could not address tea6415c #3\n"); 643 return -EFAULT;
660 return -EFAULT;
661 }
662 break;
663 }
664 default:
665 {
666 break;
667 } 644 }
645 break;
646 default:
647 break;
668 } 648 }
669 649
670 /* switch video in saa7111a */ 650 /* switch video in saa7111a */
@@ -675,8 +655,10 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
675 655
676 /* switch the audio-source only if necessary */ 656 /* switch the audio-source only if necessary */
677 if( 0 == mxb->cur_mute ) { 657 if( 0 == mxb->cur_mute ) {
678 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[input]][0]); 658 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH,
679 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[input]][1]); 659 &TEA6420_line[video_audio_connect[input]][0]);
660 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH,
661 &TEA6420_line[video_audio_connect[input]][1]);
680 } 662 }
681 663
682 return 0; 664 return 0;
@@ -719,8 +701,9 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
719 { 701 {
720 struct v4l2_frequency *f = arg; 702 struct v4l2_frequency *f = arg;
721 703
722 if(0 != mxb->cur_input) { 704 if (mxb->cur_input) {
723 DEB_D(("VIDIOC_G_FREQ: channel %d does not have a tuner!\n",mxb->cur_input)); 705 DEB_D(("VIDIOC_G_FREQ: channel %d does not have a tuner!\n",
706 mxb->cur_input));
724 return -EINVAL; 707 return -EINVAL;
725 } 708 }
726 709
@@ -733,7 +716,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
733 { 716 {
734 struct v4l2_frequency *f = arg; 717 struct v4l2_frequency *f = arg;
735 718
736 if (0 != f->tuner) 719 if (f->tuner)
737 return -EINVAL; 720 return -EINVAL;
738 721
739 if (V4L2_TUNER_ANALOG_TV != f->type) 722 if (V4L2_TUNER_ANALOG_TV != f->type)
@@ -761,7 +744,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
761 { 744 {
762 int i = *(int*)arg; 745 int i = *(int*)arg;
763 746
764 if( i < 0 || i >= MXB_AUDIOS ) { 747 if (i < 0 || i >= MXB_AUDIOS) {
765 DEB_D(("illegal argument to MXB_S_AUDIO_CD: i:%d.\n",i)); 748 DEB_D(("illegal argument to MXB_S_AUDIO_CD: i:%d.\n",i));
766 return -EINVAL; 749 return -EINVAL;
767 } 750 }
@@ -777,7 +760,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
777 { 760 {
778 int i = *(int*)arg; 761 int i = *(int*)arg;
779 762
780 if( i < 0 || i >= MXB_AUDIOS ) { 763 if (i < 0 || i >= MXB_AUDIOS) {
781 DEB_D(("illegal argument to MXB_S_AUDIO_LINE: i:%d.\n",i)); 764 DEB_D(("illegal argument to MXB_S_AUDIO_LINE: i:%d.\n",i));
782 return -EINVAL; 765 return -EINVAL;
783 } 766 }
@@ -792,12 +775,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
792 { 775 {
793 struct v4l2_audio *a = arg; 776 struct v4l2_audio *a = arg;
794 777
795 if( a->index < 0 || a->index > MXB_INPUTS ) { 778 if (a->index < 0 || a->index > MXB_INPUTS) {
796 DEB_D(("VIDIOC_G_AUDIO %d out of range.\n",a->index)); 779 DEB_D(("VIDIOC_G_AUDIO %d out of range.\n", a->index));
797 return -EINVAL; 780 return -EINVAL;
798 } 781 }
799 782
800 DEB_EE(("VIDIOC_G_AUDIO %d.\n",a->index)); 783 DEB_EE(("VIDIOC_G_AUDIO %d.\n", a->index));
801 memcpy(a, &mxb_audios[video_audio_connect[mxb->cur_input]], sizeof(struct v4l2_audio)); 784 memcpy(a, &mxb_audios[video_audio_connect[mxb->cur_input]], sizeof(struct v4l2_audio));
802 785
803 return 0; 786 return 0;
@@ -805,13 +788,16 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
805 case VIDIOC_S_AUDIO: 788 case VIDIOC_S_AUDIO:
806 { 789 {
807 struct v4l2_audio *a = arg; 790 struct v4l2_audio *a = arg;
808 DEB_D(("VIDIOC_S_AUDIO %d.\n",a->index)); 791
792 DEB_D(("VIDIOC_S_AUDIO %d.\n", a->index));
809 return 0; 793 return 0;
810 } 794 }
795#ifdef CONFIG_VIDEO_ADV_DEBUG
811 case VIDIOC_DBG_S_REGISTER: 796 case VIDIOC_DBG_S_REGISTER:
812 case VIDIOC_DBG_G_REGISTER: 797 case VIDIOC_DBG_G_REGISTER:
813 i2c_clients_command(&mxb->i2c_adapter, cmd, arg); 798 i2c_clients_command(&mxb->i2c_adapter, cmd, arg);
814 break; 799 return 0;
800#endif
815 default: 801 default:
816/* 802/*
817 DEB2(printk("does not handle this ioctl.\n")); 803 DEB2(printk("does not handle this ioctl.\n"));
@@ -919,7 +905,7 @@ static struct saa7146_extension extension = {
919 905
920static int __init mxb_init_module(void) 906static int __init mxb_init_module(void)
921{ 907{
922 if( 0 != saa7146_register_extension(&extension)) { 908 if (saa7146_register_extension(&extension)) {
923 DEB_S(("failed to register extension.\n")); 909 DEB_S(("failed to register extension.\n"));
924 return -ENODEV; 910 return -ENODEV;
925 } 911 }