aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tda9887.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pretzel.yyz.us>2005-06-26 17:11:03 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-26 17:11:03 -0400
commit8b0ee07e108b2eefdab5bb73f33223f18926c3b2 (patch)
treef68ca04180c5488301a40ec212ef2eb2467cf56c /drivers/media/video/tda9887.c
parent4638aef40ba9ebb9734caeed1f373c24015259fd (diff)
parent8678887e7fb43cd6c9be6c9807b05e77848e0920 (diff)
Merge upstream (approx. 2.6.12-git8) into 'janitor' branch of netdev-2.6.
Diffstat (limited to 'drivers/media/video/tda9887.c')
-rw-r--r--drivers/media/video/tda9887.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index debef1910c37..39773633cc3c 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -33,7 +33,6 @@ static unsigned short normal_i2c[] = {
33 0x96 >>1, 33 0x96 >>1,
34 I2C_CLIENT_END, 34 I2C_CLIENT_END,
35}; 35};
36static unsigned short normal_i2c_range[] = {I2C_CLIENT_END,I2C_CLIENT_END};
37I2C_CLIENT_INSMOD; 36I2C_CLIENT_INSMOD;
38 37
39/* insmod options */ 38/* insmod options */
@@ -54,6 +53,7 @@ struct tda9887 {
54 unsigned int config; 53 unsigned int config;
55 unsigned int pinnacle_id; 54 unsigned int pinnacle_id;
56 unsigned int using_v4l2; 55 unsigned int using_v4l2;
56 unsigned int radio_mode;
57}; 57};
58 58
59struct tvnorm { 59struct tvnorm {
@@ -213,12 +213,22 @@ static struct tvnorm tvnorms[] = {
213 } 213 }
214}; 214};
215 215
216static struct tvnorm radio = { 216static struct tvnorm radio_stereo = {
217 .name = "radio", 217 .name = "Radio Stereo",
218 .b = ( cFmRadio |
219 cQSS ),
220 .c = ( cDeemphasisOFF |
221 cAudioGain6 ),
222 .e = ( cAudioIF_5_5 |
223 cRadioIF_38_90 ),
224};
225
226static struct tvnorm radio_mono = {
227 .name = "Radio Mono",
218 .b = ( cFmRadio | 228 .b = ( cFmRadio |
219 cQSS ), 229 cQSS ),
220 .c = ( cDeemphasisON | 230 .c = ( cDeemphasisON |
221 cDeemphasis50 ), 231 cDeemphasis50),
222 .e = ( cAudioIF_5_5 | 232 .e = ( cAudioIF_5_5 |
223 cRadioIF_38_90 ), 233 cRadioIF_38_90 ),
224}; 234};
@@ -355,7 +365,10 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf)
355 int i; 365 int i;
356 366
357 if (t->radio) { 367 if (t->radio) {
358 norm = &radio; 368 if (t->radio_mode == V4L2_TUNER_MODE_MONO)
369 norm = &radio_mono;
370 else
371 norm = &radio_stereo;
359 } else { 372 } else {
360 for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { 373 for (i = 0; i < ARRAY_SIZE(tvnorms); i++) {
361 if (tvnorms[i].std & t->std) { 374 if (tvnorms[i].std & t->std) {
@@ -546,11 +559,14 @@ static int tda9887_configure(struct tda9887 *t)
546 559
547 memset(buf,0,sizeof(buf)); 560 memset(buf,0,sizeof(buf));
548 tda9887_set_tvnorm(t,buf); 561 tda9887_set_tvnorm(t,buf);
562
549 buf[1] |= cOutputPort1Inactive; 563 buf[1] |= cOutputPort1Inactive;
550 buf[1] |= cOutputPort2Inactive; 564 buf[1] |= cOutputPort2Inactive;
565
551 if (UNSET != t->pinnacle_id) { 566 if (UNSET != t->pinnacle_id) {
552 tda9887_set_pinnacle(t,buf); 567 tda9887_set_pinnacle(t,buf);
553 } 568 }
569
554 tda9887_set_config(t,buf); 570 tda9887_set_config(t,buf);
555 tda9887_set_insmod(t,buf); 571 tda9887_set_insmod(t,buf);
556 572
@@ -593,9 +609,12 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind)
593 if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) 609 if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL)))
594 return -ENOMEM; 610 return -ENOMEM;
595 memset(t,0,sizeof(*t)); 611 memset(t,0,sizeof(*t));
612
596 t->client = client_template; 613 t->client = client_template;
597 t->std = 0; 614 t->std = 0;
598 t->pinnacle_id = UNSET; 615 t->pinnacle_id = UNSET;
616 t->radio_mode = V4L2_TUNER_MODE_STEREO;
617
599 i2c_set_clientdata(&t->client, t); 618 i2c_set_clientdata(&t->client, t);
600 i2c_attach_client(&t->client); 619 i2c_attach_client(&t->client);
601 620
@@ -734,6 +753,16 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
734 } 753 }
735 break; 754 break;
736 } 755 }
756 case VIDIOC_S_TUNER:
757 {
758 struct v4l2_tuner* tuner = arg;
759
760 if (t->radio) {
761 t->radio_mode = tuner->audmode;
762 tda9887_configure (t);
763 }
764 break;
765 }
737 default: 766 default:
738 /* nothing */ 767 /* nothing */
739 break; 768 break;
@@ -741,7 +770,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
741 return 0; 770 return 0;
742} 771}
743 772
744static int tda9887_suspend(struct device * dev, pm_message_t state, u32 level) 773static int tda9887_suspend(struct device * dev, u32 state, u32 level)
745{ 774{
746 dprintk("tda9887: suspend\n"); 775 dprintk("tda9887: suspend\n");
747 return 0; 776 return 0;