diff options
Diffstat (limited to 'drivers/media/video/tda9887.c')
-rw-r--r-- | drivers/media/video/tda9887.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index d60fc562aecd..79e0bd1aa70f 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -49,7 +49,7 @@ MODULE_LICENSE("GPL"); | |||
49 | struct tda9887 { | 49 | struct tda9887 { |
50 | struct i2c_client client; | 50 | struct i2c_client client; |
51 | v4l2_std_id std; | 51 | v4l2_std_id std; |
52 | unsigned int radio; | 52 | enum tuner_mode mode; |
53 | unsigned int config; | 53 | unsigned int config; |
54 | unsigned int pinnacle_id; | 54 | unsigned int pinnacle_id; |
55 | unsigned int using_v4l2; | 55 | unsigned int using_v4l2; |
@@ -196,7 +196,7 @@ static struct tvnorm tvnorms[] = { | |||
196 | .b = ( cNegativeFmTV | | 196 | .b = ( cNegativeFmTV | |
197 | cQSS ), | 197 | cQSS ), |
198 | .c = ( cDeemphasisON | | 198 | .c = ( cDeemphasisON | |
199 | cDeemphasis50 ), | 199 | cDeemphasis75 ), |
200 | .e = ( cGating_36 | | 200 | .e = ( cGating_36 | |
201 | cAudioIF_4_5 | | 201 | cAudioIF_4_5 | |
202 | cVideoIF_45_75 ), | 202 | cVideoIF_45_75 ), |
@@ -364,7 +364,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
364 | struct tvnorm *norm = NULL; | 364 | struct tvnorm *norm = NULL; |
365 | int i; | 365 | int i; |
366 | 366 | ||
367 | if (t->radio) { | 367 | if (t->mode == T_RADIO) { |
368 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) | 368 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) |
369 | norm = &radio_mono; | 369 | norm = &radio_mono; |
370 | else | 370 | else |
@@ -378,7 +378,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
378 | } | 378 | } |
379 | } | 379 | } |
380 | if (NULL == norm) { | 380 | if (NULL == norm) { |
381 | dprintk(PREFIX "Oops: no tvnorm entry found\n"); | 381 | dprintk(PREFIX "Unsupported tvnorm entry - audio muted\n"); |
382 | return -1; | 382 | return -1; |
383 | } | 383 | } |
384 | 384 | ||
@@ -569,6 +569,10 @@ static int tda9887_configure(struct tda9887 *t) | |||
569 | tda9887_set_config(t,buf); | 569 | tda9887_set_config(t,buf); |
570 | tda9887_set_insmod(t,buf); | 570 | tda9887_set_insmod(t,buf); |
571 | 571 | ||
572 | if (t->mode == T_STANDBY) { | ||
573 | buf[1] |= cForcedMuteAudioON; | ||
574 | } | ||
575 | |||
572 | 576 | ||
573 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", | 577 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", |
574 | buf[1],buf[2],buf[3]); | 578 | buf[1],buf[2],buf[3]); |
@@ -653,10 +657,17 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
653 | 657 | ||
654 | /* --- configuration --- */ | 658 | /* --- configuration --- */ |
655 | case AUDC_SET_RADIO: | 659 | case AUDC_SET_RADIO: |
656 | t->radio = 1; | 660 | { |
661 | t->mode = T_RADIO; | ||
657 | tda9887_configure(t); | 662 | tda9887_configure(t); |
658 | break; | 663 | break; |
659 | 664 | } | |
665 | case TUNER_SET_STANDBY: | ||
666 | { | ||
667 | t->mode = T_STANDBY; | ||
668 | tda9887_configure(t); | ||
669 | break; | ||
670 | } | ||
660 | case AUDC_CONFIG_PINNACLE: | 671 | case AUDC_CONFIG_PINNACLE: |
661 | { | 672 | { |
662 | int *i = arg; | 673 | int *i = arg; |
@@ -689,7 +700,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
689 | struct video_channel *vc = arg; | 700 | struct video_channel *vc = arg; |
690 | 701 | ||
691 | CHECK_V4L2; | 702 | CHECK_V4L2; |
692 | t->radio = 0; | 703 | t->mode = T_ANALOG_TV; |
693 | if (vc->norm < ARRAY_SIZE(map)) | 704 | if (vc->norm < ARRAY_SIZE(map)) |
694 | t->std = map[vc->norm]; | 705 | t->std = map[vc->norm]; |
695 | tda9887_fixup_std(t); | 706 | tda9887_fixup_std(t); |
@@ -701,7 +712,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
701 | v4l2_std_id *id = arg; | 712 | v4l2_std_id *id = arg; |
702 | 713 | ||
703 | SWITCH_V4L2; | 714 | SWITCH_V4L2; |
704 | t->radio = 0; | 715 | t->mode = T_ANALOG_TV; |
705 | t->std = *id; | 716 | t->std = *id; |
706 | tda9887_fixup_std(t); | 717 | tda9887_fixup_std(t); |
707 | tda9887_configure(t); | 718 | tda9887_configure(t); |
@@ -713,14 +724,14 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
713 | 724 | ||
714 | SWITCH_V4L2; | 725 | SWITCH_V4L2; |
715 | if (V4L2_TUNER_ANALOG_TV == f->type) { | 726 | if (V4L2_TUNER_ANALOG_TV == f->type) { |
716 | if (t->radio == 0) | 727 | if (t->mode == T_ANALOG_TV) |
717 | return 0; | 728 | return 0; |
718 | t->radio = 0; | 729 | t->mode = T_ANALOG_TV; |
719 | } | 730 | } |
720 | if (V4L2_TUNER_RADIO == f->type) { | 731 | if (V4L2_TUNER_RADIO == f->type) { |
721 | if (t->radio == 1) | 732 | if (t->mode == T_RADIO) |
722 | return 0; | 733 | return 0; |
723 | t->radio = 1; | 734 | t->mode = T_RADIO; |
724 | } | 735 | } |
725 | tda9887_configure(t); | 736 | tda9887_configure(t); |
726 | break; | 737 | break; |
@@ -735,7 +746,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
735 | }; | 746 | }; |
736 | struct v4l2_tuner* tuner = arg; | 747 | struct v4l2_tuner* tuner = arg; |
737 | 748 | ||
738 | if (t->radio) { | 749 | if (t->mode == T_RADIO) { |
739 | __u8 reg = 0; | 750 | __u8 reg = 0; |
740 | tuner->afc=0; | 751 | tuner->afc=0; |
741 | if (1 == i2c_master_recv(&t->client,®,1)) | 752 | if (1 == i2c_master_recv(&t->client,®,1)) |
@@ -747,7 +758,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
747 | { | 758 | { |
748 | struct v4l2_tuner* tuner = arg; | 759 | struct v4l2_tuner* tuner = arg; |
749 | 760 | ||
750 | if (t->radio) { | 761 | if (t->mode == T_RADIO) { |
751 | t->radio_mode = tuner->audmode; | 762 | t->radio_mode = tuner->audmode; |
752 | tda9887_configure (t); | 763 | tda9887_configure (t); |
753 | } | 764 | } |