aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tda8290.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-11-03 21:14:54 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:01:56 -0500
commitf1f32849d65ab1eacfedbabb624876ac06c1af9f (patch)
tree4470002d7a402c33236de694a94a05f33042ade2 /drivers/media/video/tda8290.c
parent9b15c0251ba9d20dd88a69b2c607a2f2e5f0133a (diff)
V4L/DVB (6543): tda8290: enable probing of tda8295
Prevent the tda8295 from falsely being detected as a tda9887 Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tda8290.c')
-rw-r--r--drivers/media/video/tda8290.c64
1 files changed, 49 insertions, 15 deletions
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index c7705cbab2fb..dd2399654654 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -632,6 +632,46 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
632 return 0; 632 return 0;
633} 633}
634 634
635static int tda8290_probe(struct tuner_i2c_props *i2c_props)
636{
637#define TDA8290_ID 0x89
638 unsigned char tda8290_id[] = { 0x1f, 0x00 };
639
640 /* detect tda8290 */
641 tuner_i2c_xfer_send(i2c_props, &tda8290_id[0], 1);
642 tuner_i2c_xfer_recv(i2c_props, &tda8290_id[1], 1);
643
644 if (tda8290_id[1] == TDA8290_ID) {
645 if (tuner_debug)
646 printk(KERN_DEBUG "%s: tda8290 detected @ %d-%04x\n",
647 __FUNCTION__, i2c_adapter_id(i2c_props->adap),
648 i2c_props->addr);
649 return 0;
650 }
651
652 return -1;
653}
654
655static int tda8295_probe(struct tuner_i2c_props *i2c_props)
656{
657#define TDA8295_ID 0x8a
658 unsigned char tda8295_id[] = { 0x2f, 0x00 };
659
660 /* detect tda8295 */
661 tuner_i2c_xfer_send(i2c_props, &tda8295_id[0], 1);
662 tuner_i2c_xfer_recv(i2c_props, &tda8295_id[1], 1);
663
664 if (tda8295_id[1] == TDA8295_ID) {
665 if (tuner_debug)
666 printk(KERN_DEBUG "%s: tda8295 detected @ %d-%04x\n",
667 __FUNCTION__, i2c_adapter_id(i2c_props->adap),
668 i2c_props->addr);
669 return 0;
670 }
671
672 return -1;
673}
674
635static struct analog_tuner_ops tda8290_tuner_ops = { 675static struct analog_tuner_ops tda8290_tuner_ops = {
636 .set_tv_freq = tda8290_set_freq, 676 .set_tv_freq = tda8290_set_freq,
637 .set_radio_freq = tda8290_set_freq, 677 .set_radio_freq = tda8290_set_freq,
@@ -655,11 +695,6 @@ int tda829x_attach(struct tuner *t)
655 struct dvb_frontend *fe = &t->fe; 695 struct dvb_frontend *fe = &t->fe;
656 struct tda8290_priv *priv = NULL; 696 struct tda8290_priv *priv = NULL;
657 697
658 unsigned char tda8290_id[] = { 0x1f, 0x00 };
659#define TDA8290_ID 0x89
660 unsigned char tda8295_id[] = { 0x2f, 0x00 };
661#define TDA8295_ID 0x8a
662
663 priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL); 698 priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL);
664 if (priv == NULL) 699 if (priv == NULL)
665 return -ENOMEM; 700 return -ENOMEM;
@@ -671,18 +706,12 @@ int tda829x_attach(struct tuner *t)
671 priv->cfg.tuner_callback = t->tuner_callback; 706 priv->cfg.tuner_callback = t->tuner_callback;
672 priv->t = t; 707 priv->t = t;
673 708
674 /* detect tda8290 */ 709 if (tda8290_probe(&priv->i2c_props) == 0) {
675 tuner_i2c_xfer_send(&priv->i2c_props, &tda8290_id[0], 1);
676 tuner_i2c_xfer_recv(&priv->i2c_props, &tda8290_id[1], 1);
677 if (tda8290_id[1] == TDA8290_ID) {
678 priv->ver = TDA8290; 710 priv->ver = TDA8290;
679 fe->ops.analog_demod_ops = &tda8290_tuner_ops; 711 fe->ops.analog_demod_ops = &tda8290_tuner_ops;
680 } 712 }
681 713
682 /* detect tda8295 */ 714 if (tda8295_probe(&priv->i2c_props) == 0) {
683 tuner_i2c_xfer_send(&priv->i2c_props, &tda8295_id[0], 1);
684 tuner_i2c_xfer_recv(&priv->i2c_props, &tda8295_id[1], 1);
685 if (tda8295_id[1] == TDA8295_ID) {
686 priv->ver = TDA8295; 715 priv->ver = TDA8295;
687 fe->ops.analog_demod_ops = &tda8295_tuner_ops; 716 fe->ops.analog_demod_ops = &tda8295_tuner_ops;
688 } 717 }
@@ -704,7 +733,7 @@ int tda829x_attach(struct tuner *t)
704} 733}
705EXPORT_SYMBOL_GPL(tda829x_attach); 734EXPORT_SYMBOL_GPL(tda829x_attach);
706 735
707int tda8290_probe(struct tuner *t) 736int tda829x_probe(struct tuner *t)
708{ 737{
709 struct tuner_i2c_props i2c_props = { 738 struct tuner_i2c_props i2c_props = {
710 .adap = t->i2c->adapter, 739 .adap = t->i2c->adapter,
@@ -718,6 +747,11 @@ int tda8290_probe(struct tuner *t)
718 unsigned char addr_dto_lsb = 0x07; 747 unsigned char addr_dto_lsb = 0x07;
719 unsigned char data; 748 unsigned char data;
720 749
750 if ((tda8290_probe(&i2c_props) == 0) ||
751 (tda8295_probe(&i2c_props) == 0))
752 return 0;
753
754 /* fall back to old probing method */
721 tuner_i2c_xfer_send(&i2c_props, easy_mode_b, 2); 755 tuner_i2c_xfer_send(&i2c_props, easy_mode_b, 2);
722 tuner_i2c_xfer_send(&i2c_props, soft_reset, 2); 756 tuner_i2c_xfer_send(&i2c_props, soft_reset, 2);
723 tuner_i2c_xfer_send(&i2c_props, &addr_dto_lsb, 1); 757 tuner_i2c_xfer_send(&i2c_props, &addr_dto_lsb, 1);
@@ -734,7 +768,7 @@ int tda8290_probe(struct tuner *t)
734 tuner_i2c_xfer_send(&i2c_props, restore_9886, 3); 768 tuner_i2c_xfer_send(&i2c_props, restore_9886, 3);
735 return -1; 769 return -1;
736} 770}
737EXPORT_SYMBOL_GPL(tda8290_probe); 771EXPORT_SYMBOL_GPL(tda829x_probe);
738 772
739MODULE_DESCRIPTION("Philips/NXP TDA8290/TDA8295 analog IF demodulator driver"); 773MODULE_DESCRIPTION("Philips/NXP TDA8290/TDA8295 analog IF demodulator driver");
740MODULE_AUTHOR("Gerd Knorr, Hartmut Hackmann, Michael Krufky"); 774MODULE_AUTHOR("Gerd Knorr, Hartmut Hackmann, Michael Krufky");