diff options
author | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2005-06-24 01:05:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:06:39 -0400 |
commit | 56fc08ca375491b965cb76fad65bfb98973e80d8 (patch) | |
tree | d19bb1d6e1d139dda8989188fae49cf124f3aaac /drivers/media/video/tda9887.c | |
parent | b45009b0288a96a3458f4f8e93cb776678d41875 (diff) |
[PATCH] v4l: update for tuner cards and some V4L chips
Tuner improvements and additions. TEA5767 FM tuner added. Several small
fixes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Nickolay V Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/tda9887.c')
-rw-r--r-- | drivers/media/video/tda9887.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 7e6e6dd966a2..33d6ee6cde48 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -33,6 +33,7 @@ static unsigned short normal_i2c[] = { | |||
33 | 0x96 >>1, | 33 | 0x96 >>1, |
34 | I2C_CLIENT_END, | 34 | I2C_CLIENT_END, |
35 | }; | 35 | }; |
36 | static unsigned short normal_i2c_range[] = {I2C_CLIENT_END,I2C_CLIENT_END}; | ||
36 | I2C_CLIENT_INSMOD; | 37 | I2C_CLIENT_INSMOD; |
37 | 38 | ||
38 | /* insmod options */ | 39 | /* insmod options */ |
@@ -53,6 +54,7 @@ struct tda9887 { | |||
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; |
57 | unsigned int radio_mode; | ||
56 | }; | 58 | }; |
57 | 59 | ||
58 | struct tvnorm { | 60 | struct tvnorm { |
@@ -212,12 +214,22 @@ static struct tvnorm tvnorms[] = { | |||
212 | } | 214 | } |
213 | }; | 215 | }; |
214 | 216 | ||
215 | static struct tvnorm radio = { | 217 | static struct tvnorm radio_stereo = { |
216 | .name = "radio", | 218 | .name = "Radio Stereo", |
219 | .b = ( cFmRadio | | ||
220 | cQSS ), | ||
221 | .c = ( cDeemphasisOFF | | ||
222 | cAudioGain6 ), | ||
223 | .e = ( cAudioIF_5_5 | | ||
224 | cRadioIF_38_90 ), | ||
225 | }; | ||
226 | |||
227 | static struct tvnorm radio_mono = { | ||
228 | .name = "Radio Mono", | ||
217 | .b = ( cFmRadio | | 229 | .b = ( cFmRadio | |
218 | cQSS ), | 230 | cQSS ), |
219 | .c = ( cDeemphasisON | | 231 | .c = ( cDeemphasisON | |
220 | cDeemphasis50 ), | 232 | cDeemphasis50), |
221 | .e = ( cAudioIF_5_5 | | 233 | .e = ( cAudioIF_5_5 | |
222 | cRadioIF_38_90 ), | 234 | cRadioIF_38_90 ), |
223 | }; | 235 | }; |
@@ -354,7 +366,10 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
354 | int i; | 366 | int i; |
355 | 367 | ||
356 | if (t->radio) { | 368 | if (t->radio) { |
357 | norm = &radio; | 369 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) |
370 | norm = &radio_mono; | ||
371 | else | ||
372 | norm = &radio_stereo; | ||
358 | } else { | 373 | } else { |
359 | for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { | 374 | for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { |
360 | if (tvnorms[i].std & t->std) { | 375 | if (tvnorms[i].std & t->std) { |
@@ -545,11 +560,14 @@ static int tda9887_configure(struct tda9887 *t) | |||
545 | 560 | ||
546 | memset(buf,0,sizeof(buf)); | 561 | memset(buf,0,sizeof(buf)); |
547 | tda9887_set_tvnorm(t,buf); | 562 | tda9887_set_tvnorm(t,buf); |
563 | |||
548 | buf[1] |= cOutputPort1Inactive; | 564 | buf[1] |= cOutputPort1Inactive; |
549 | buf[1] |= cOutputPort2Inactive; | 565 | buf[1] |= cOutputPort2Inactive; |
566 | |||
550 | if (UNSET != t->pinnacle_id) { | 567 | if (UNSET != t->pinnacle_id) { |
551 | tda9887_set_pinnacle(t,buf); | 568 | tda9887_set_pinnacle(t,buf); |
552 | } | 569 | } |
570 | |||
553 | tda9887_set_config(t,buf); | 571 | tda9887_set_config(t,buf); |
554 | tda9887_set_insmod(t,buf); | 572 | tda9887_set_insmod(t,buf); |
555 | 573 | ||
@@ -592,9 +610,12 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) | |||
592 | if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) | 610 | if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) |
593 | return -ENOMEM; | 611 | return -ENOMEM; |
594 | memset(t,0,sizeof(*t)); | 612 | memset(t,0,sizeof(*t)); |
613 | |||
595 | t->client = client_template; | 614 | t->client = client_template; |
596 | t->std = 0; | 615 | t->std = 0; |
597 | t->pinnacle_id = UNSET; | 616 | t->pinnacle_id = UNSET; |
617 | t->radio_mode = V4L2_TUNER_MODE_STEREO; | ||
618 | |||
598 | i2c_set_clientdata(&t->client, t); | 619 | i2c_set_clientdata(&t->client, t); |
599 | i2c_attach_client(&t->client); | 620 | i2c_attach_client(&t->client); |
600 | 621 | ||
@@ -733,6 +754,16 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
733 | } | 754 | } |
734 | break; | 755 | break; |
735 | } | 756 | } |
757 | case VIDIOC_S_TUNER: | ||
758 | { | ||
759 | struct v4l2_tuner* tuner = arg; | ||
760 | |||
761 | if (t->radio) { | ||
762 | t->radio_mode = tuner->audmode; | ||
763 | tda9887_configure (t); | ||
764 | } | ||
765 | break; | ||
766 | } | ||
736 | default: | 767 | default: |
737 | /* nothing */ | 768 | /* nothing */ |
738 | break; | 769 | break; |
@@ -740,7 +771,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
740 | return 0; | 771 | return 0; |
741 | } | 772 | } |
742 | 773 | ||
743 | static int tda9887_suspend(struct device * dev, pm_message_t state, u32 level) | 774 | static int tda9887_suspend(struct device * dev, u32 state, u32 level) |
744 | { | 775 | { |
745 | dprintk("tda9887: suspend\n"); | 776 | dprintk("tda9887: suspend\n"); |
746 | return 0; | 777 | return 0; |