aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2009-07-10 19:03:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-07-24 13:03:29 -0400
commita2f5a8117cb185fc347f35e369a6320e6aa9d82d (patch)
tree97ca712abcf107ff7900cb6e50fa00580a42f7c6 /drivers/media
parent27954930f047df73a16253db2750345034e56c40 (diff)
V4L/DVB (12269): af9013: auto-detect parameters in case of garbage given by app
Request demodulator auto-detect transmission parameters in case of garbage parameters provided by application for compatibility. That's needed at least for MPlayer compatibility currently. Thanks to Jelle de Jong for reporting issue and providing SSH access to Devin for debugging. Thanks to Devin Heitmueller for hard debug work he did to find that bug. Cc: Devin Heitmueller <dheitmueller@kernellabs.com> Cc: Jelle de Jong <jelledejong@powercraft.nl> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/af9013.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/af9013.c b/drivers/media/dvb/frontends/af9013.c
index 136c5863d81b..12e018b4107d 100644
--- a/drivers/media/dvb/frontends/af9013.c
+++ b/drivers/media/dvb/frontends/af9013.c
@@ -527,6 +527,10 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
527 u8 i, buf[3] = {0, 0, 0}; 527 u8 i, buf[3] = {0, 0, 0};
528 *auto_mode = 0; /* set if parameters are requested to auto set */ 528 *auto_mode = 0; /* set if parameters are requested to auto set */
529 529
530 /* Try auto-detect transmission parameters in case of AUTO requested or
531 garbage parameters given by application for compatibility.
532 MPlayer seems to provide garbage parameters currently. */
533
530 switch (params->transmission_mode) { 534 switch (params->transmission_mode) {
531 case TRANSMISSION_MODE_AUTO: 535 case TRANSMISSION_MODE_AUTO:
532 *auto_mode = 1; 536 *auto_mode = 1;
@@ -536,7 +540,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
536 buf[0] |= (1 << 0); 540 buf[0] |= (1 << 0);
537 break; 541 break;
538 default: 542 default:
539 return -EINVAL; 543 deb_info("%s: invalid transmission_mode\n", __func__);
544 *auto_mode = 1;
540 } 545 }
541 546
542 switch (params->guard_interval) { 547 switch (params->guard_interval) {
@@ -554,7 +559,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
554 buf[0] |= (3 << 2); 559 buf[0] |= (3 << 2);
555 break; 560 break;
556 default: 561 default:
557 return -EINVAL; 562 deb_info("%s: invalid guard_interval\n", __func__);
563 *auto_mode = 1;
558 } 564 }
559 565
560 switch (params->hierarchy_information) { 566 switch (params->hierarchy_information) {
@@ -572,7 +578,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
572 buf[0] |= (3 << 4); 578 buf[0] |= (3 << 4);
573 break; 579 break;
574 default: 580 default:
575 return -EINVAL; 581 deb_info("%s: invalid hierarchy_information\n", __func__);
582 *auto_mode = 1;
576 }; 583 };
577 584
578 switch (params->constellation) { 585 switch (params->constellation) {
@@ -587,7 +594,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
587 buf[1] |= (2 << 6); 594 buf[1] |= (2 << 6);
588 break; 595 break;
589 default: 596 default:
590 return -EINVAL; 597 deb_info("%s: invalid constellation\n", __func__);
598 *auto_mode = 1;
591 } 599 }
592 600
593 /* Use HP. How and which case we can switch to LP? */ 601 /* Use HP. How and which case we can switch to LP? */
@@ -611,7 +619,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
611 buf[2] |= (4 << 0); 619 buf[2] |= (4 << 0);
612 break; 620 break;
613 default: 621 default:
614 return -EINVAL; 622 deb_info("%s: invalid code_rate_HP\n", __func__);
623 *auto_mode = 1;
615 } 624 }
616 625
617 switch (params->code_rate_LP) { 626 switch (params->code_rate_LP) {
@@ -638,7 +647,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
638 if (params->hierarchy_information == HIERARCHY_AUTO) 647 if (params->hierarchy_information == HIERARCHY_AUTO)
639 break; 648 break;
640 default: 649 default:
641 return -EINVAL; 650 deb_info("%s: invalid code_rate_LP\n", __func__);
651 *auto_mode = 1;
642 } 652 }
643 653
644 switch (params->bandwidth) { 654 switch (params->bandwidth) {
@@ -651,7 +661,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
651 buf[1] |= (2 << 2); 661 buf[1] |= (2 << 2);
652 break; 662 break;
653 default: 663 default:
654 return -EINVAL; 664 deb_info("%s: invalid bandwidth\n", __func__);
665 buf[1] |= (2 << 2); /* cannot auto-detect BW, try 8 MHz */
655 } 666 }
656 667
657 /* program */ 668 /* program */