diff options
Diffstat (limited to 'drivers/media/video/tda9887.c')
| -rw-r--r-- | drivers/media/video/tda9887.c | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index d60fc562aecd..0456dda2624d 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | TDA9887 (world), TDA9885 (USA) | 23 | TDA9887 (world), TDA9885 (USA) |
| 24 | Note: OP2 of tda988x must be set to 1, else MT2032 is disabled! | 24 | Note: OP2 of tda988x must be set to 1, else MT2032 is disabled! |
| 25 | - KNC One TV-Station RDS (saa7134) | 25 | - KNC One TV-Station RDS (saa7134) |
| 26 | - Hauppauge PVR-150/500 (possibly more) | ||
| 26 | */ | 27 | */ |
| 27 | 28 | ||
| 28 | 29 | ||
| @@ -49,7 +50,7 @@ MODULE_LICENSE("GPL"); | |||
| 49 | struct tda9887 { | 50 | struct tda9887 { |
| 50 | struct i2c_client client; | 51 | struct i2c_client client; |
| 51 | v4l2_std_id std; | 52 | v4l2_std_id std; |
| 52 | unsigned int radio; | 53 | enum tuner_mode mode; |
| 53 | unsigned int config; | 54 | unsigned int config; |
| 54 | unsigned int pinnacle_id; | 55 | unsigned int pinnacle_id; |
| 55 | unsigned int using_v4l2; | 56 | unsigned int using_v4l2; |
| @@ -196,7 +197,7 @@ static struct tvnorm tvnorms[] = { | |||
| 196 | .b = ( cNegativeFmTV | | 197 | .b = ( cNegativeFmTV | |
| 197 | cQSS ), | 198 | cQSS ), |
| 198 | .c = ( cDeemphasisON | | 199 | .c = ( cDeemphasisON | |
| 199 | cDeemphasis50 ), | 200 | cDeemphasis75 ), |
| 200 | .e = ( cGating_36 | | 201 | .e = ( cGating_36 | |
| 201 | cAudioIF_4_5 | | 202 | cAudioIF_4_5 | |
| 202 | cVideoIF_45_75 ), | 203 | cVideoIF_45_75 ), |
| @@ -364,7 +365,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
| 364 | struct tvnorm *norm = NULL; | 365 | struct tvnorm *norm = NULL; |
| 365 | int i; | 366 | int i; |
| 366 | 367 | ||
| 367 | if (t->radio) { | 368 | if (t->mode == T_RADIO) { |
| 368 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) | 369 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) |
| 369 | norm = &radio_mono; | 370 | norm = &radio_mono; |
| 370 | else | 371 | else |
| @@ -378,7 +379,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
| 378 | } | 379 | } |
| 379 | } | 380 | } |
| 380 | if (NULL == norm) { | 381 | if (NULL == norm) { |
| 381 | dprintk(PREFIX "Oops: no tvnorm entry found\n"); | 382 | dprintk(PREFIX "Unsupported tvnorm entry - audio muted\n"); |
| 382 | return -1; | 383 | return -1; |
| 383 | } | 384 | } |
| 384 | 385 | ||
| @@ -519,6 +520,12 @@ static int tda9887_fixup_std(struct tda9887 *t) | |||
| 519 | dprintk(PREFIX "insmod fixup: PAL => PAL-DK\n"); | 520 | dprintk(PREFIX "insmod fixup: PAL => PAL-DK\n"); |
| 520 | t->std = V4L2_STD_PAL_DK; | 521 | t->std = V4L2_STD_PAL_DK; |
| 521 | break; | 522 | break; |
| 523 | case '-': | ||
| 524 | /* default parameter, do nothing */ | ||
| 525 | break; | ||
| 526 | default: | ||
| 527 | printk(PREFIX "pal= argument not recognised\n"); | ||
| 528 | break; | ||
| 522 | } | 529 | } |
| 523 | } | 530 | } |
| 524 | if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { | 531 | if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { |
| @@ -535,6 +542,12 @@ static int tda9887_fixup_std(struct tda9887 *t) | |||
| 535 | dprintk(PREFIX "insmod fixup: SECAM => SECAM-L\n"); | 542 | dprintk(PREFIX "insmod fixup: SECAM => SECAM-L\n"); |
| 536 | t->std = V4L2_STD_SECAM_L; | 543 | t->std = V4L2_STD_SECAM_L; |
| 537 | break; | 544 | break; |
| 545 | case '-': | ||
| 546 | /* default parameter, do nothing */ | ||
| 547 | break; | ||
| 548 | default: | ||
| 549 | printk(PREFIX "secam= argument not recognised\n"); | ||
| 550 | break; | ||
| 538 | } | 551 | } |
| 539 | } | 552 | } |
| 540 | return 0; | 553 | return 0; |
| @@ -569,6 +582,10 @@ static int tda9887_configure(struct tda9887 *t) | |||
| 569 | tda9887_set_config(t,buf); | 582 | tda9887_set_config(t,buf); |
| 570 | tda9887_set_insmod(t,buf); | 583 | tda9887_set_insmod(t,buf); |
| 571 | 584 | ||
| 585 | if (t->mode == T_STANDBY) { | ||
| 586 | buf[1] |= cForcedMuteAudioON; | ||
| 587 | } | ||
| 588 | |||
| 572 | 589 | ||
| 573 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", | 590 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", |
| 574 | buf[1],buf[2],buf[3]); | 591 | buf[1],buf[2],buf[3]); |
| @@ -653,10 +670,17 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 653 | 670 | ||
| 654 | /* --- configuration --- */ | 671 | /* --- configuration --- */ |
| 655 | case AUDC_SET_RADIO: | 672 | case AUDC_SET_RADIO: |
| 656 | t->radio = 1; | 673 | { |
| 674 | t->mode = T_RADIO; | ||
| 657 | tda9887_configure(t); | 675 | tda9887_configure(t); |
| 658 | break; | 676 | break; |
| 659 | 677 | } | |
| 678 | case TUNER_SET_STANDBY: | ||
| 679 | { | ||
| 680 | t->mode = T_STANDBY; | ||
| 681 | tda9887_configure(t); | ||
| 682 | break; | ||
| 683 | } | ||
| 660 | case AUDC_CONFIG_PINNACLE: | 684 | case AUDC_CONFIG_PINNACLE: |
| 661 | { | 685 | { |
| 662 | int *i = arg; | 686 | int *i = arg; |
| @@ -689,7 +713,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 689 | struct video_channel *vc = arg; | 713 | struct video_channel *vc = arg; |
| 690 | 714 | ||
| 691 | CHECK_V4L2; | 715 | CHECK_V4L2; |
| 692 | t->radio = 0; | 716 | t->mode = T_ANALOG_TV; |
| 693 | if (vc->norm < ARRAY_SIZE(map)) | 717 | if (vc->norm < ARRAY_SIZE(map)) |
| 694 | t->std = map[vc->norm]; | 718 | t->std = map[vc->norm]; |
| 695 | tda9887_fixup_std(t); | 719 | tda9887_fixup_std(t); |
| @@ -701,7 +725,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 701 | v4l2_std_id *id = arg; | 725 | v4l2_std_id *id = arg; |
| 702 | 726 | ||
| 703 | SWITCH_V4L2; | 727 | SWITCH_V4L2; |
| 704 | t->radio = 0; | 728 | t->mode = T_ANALOG_TV; |
| 705 | t->std = *id; | 729 | t->std = *id; |
| 706 | tda9887_fixup_std(t); | 730 | tda9887_fixup_std(t); |
| 707 | tda9887_configure(t); | 731 | tda9887_configure(t); |
| @@ -713,14 +737,14 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 713 | 737 | ||
| 714 | SWITCH_V4L2; | 738 | SWITCH_V4L2; |
| 715 | if (V4L2_TUNER_ANALOG_TV == f->type) { | 739 | if (V4L2_TUNER_ANALOG_TV == f->type) { |
| 716 | if (t->radio == 0) | 740 | if (t->mode == T_ANALOG_TV) |
| 717 | return 0; | 741 | return 0; |
| 718 | t->radio = 0; | 742 | t->mode = T_ANALOG_TV; |
| 719 | } | 743 | } |
| 720 | if (V4L2_TUNER_RADIO == f->type) { | 744 | if (V4L2_TUNER_RADIO == f->type) { |
| 721 | if (t->radio == 1) | 745 | if (t->mode == T_RADIO) |
| 722 | return 0; | 746 | return 0; |
| 723 | t->radio = 1; | 747 | t->mode = T_RADIO; |
| 724 | } | 748 | } |
| 725 | tda9887_configure(t); | 749 | tda9887_configure(t); |
| 726 | break; | 750 | break; |
| @@ -735,7 +759,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 735 | }; | 759 | }; |
| 736 | struct v4l2_tuner* tuner = arg; | 760 | struct v4l2_tuner* tuner = arg; |
| 737 | 761 | ||
| 738 | if (t->radio) { | 762 | if (t->mode == T_RADIO) { |
| 739 | __u8 reg = 0; | 763 | __u8 reg = 0; |
| 740 | tuner->afc=0; | 764 | tuner->afc=0; |
| 741 | if (1 == i2c_master_recv(&t->client,®,1)) | 765 | if (1 == i2c_master_recv(&t->client,®,1)) |
| @@ -747,7 +771,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 747 | { | 771 | { |
| 748 | struct v4l2_tuner* tuner = arg; | 772 | struct v4l2_tuner* tuner = arg; |
| 749 | 773 | ||
| 750 | if (t->radio) { | 774 | if (t->mode == T_RADIO) { |
| 751 | t->radio_mode = tuner->audmode; | 775 | t->radio_mode = tuner->audmode; |
| 752 | tda9887_configure (t); | 776 | tda9887_configure (t); |
| 753 | } | 777 | } |
