Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 76373
b: refs/heads/master
c: f1f3284
h: refs/heads/master
i:
  76371: 983200e
v: v3
  • Loading branch information
Michael Krufky authored and Mauro Carvalho Chehab committed Jan 25, 2008
1 parent 0c4ad0e commit f586dcd
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b15c0251ba9d20dd88a69b2c607a2f2e5f0133a
refs/heads/master: f1f32849d65ab1eacfedbabb624876ac06c1af9f
64 changes: 49 additions & 15 deletions trunk/drivers/media/video/tda8290.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,46 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
return 0;
}

static int tda8290_probe(struct tuner_i2c_props *i2c_props)
{
#define TDA8290_ID 0x89
unsigned char tda8290_id[] = { 0x1f, 0x00 };

/* detect tda8290 */
tuner_i2c_xfer_send(i2c_props, &tda8290_id[0], 1);
tuner_i2c_xfer_recv(i2c_props, &tda8290_id[1], 1);

if (tda8290_id[1] == TDA8290_ID) {
if (tuner_debug)
printk(KERN_DEBUG "%s: tda8290 detected @ %d-%04x\n",
__FUNCTION__, i2c_adapter_id(i2c_props->adap),
i2c_props->addr);
return 0;
}

return -1;
}

static int tda8295_probe(struct tuner_i2c_props *i2c_props)
{
#define TDA8295_ID 0x8a
unsigned char tda8295_id[] = { 0x2f, 0x00 };

/* detect tda8295 */
tuner_i2c_xfer_send(i2c_props, &tda8295_id[0], 1);
tuner_i2c_xfer_recv(i2c_props, &tda8295_id[1], 1);

if (tda8295_id[1] == TDA8295_ID) {
if (tuner_debug)
printk(KERN_DEBUG "%s: tda8295 detected @ %d-%04x\n",
__FUNCTION__, i2c_adapter_id(i2c_props->adap),
i2c_props->addr);
return 0;
}

return -1;
}

static struct analog_tuner_ops tda8290_tuner_ops = {
.set_tv_freq = tda8290_set_freq,
.set_radio_freq = tda8290_set_freq,
Expand All @@ -655,11 +695,6 @@ int tda829x_attach(struct tuner *t)
struct dvb_frontend *fe = &t->fe;
struct tda8290_priv *priv = NULL;

unsigned char tda8290_id[] = { 0x1f, 0x00 };
#define TDA8290_ID 0x89
unsigned char tda8295_id[] = { 0x2f, 0x00 };
#define TDA8295_ID 0x8a

priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;
Expand All @@ -671,18 +706,12 @@ int tda829x_attach(struct tuner *t)
priv->cfg.tuner_callback = t->tuner_callback;
priv->t = t;

/* detect tda8290 */
tuner_i2c_xfer_send(&priv->i2c_props, &tda8290_id[0], 1);
tuner_i2c_xfer_recv(&priv->i2c_props, &tda8290_id[1], 1);
if (tda8290_id[1] == TDA8290_ID) {
if (tda8290_probe(&priv->i2c_props) == 0) {
priv->ver = TDA8290;
fe->ops.analog_demod_ops = &tda8290_tuner_ops;
}

/* detect tda8295 */
tuner_i2c_xfer_send(&priv->i2c_props, &tda8295_id[0], 1);
tuner_i2c_xfer_recv(&priv->i2c_props, &tda8295_id[1], 1);
if (tda8295_id[1] == TDA8295_ID) {
if (tda8295_probe(&priv->i2c_props) == 0) {
priv->ver = TDA8295;
fe->ops.analog_demod_ops = &tda8295_tuner_ops;
}
Expand All @@ -704,7 +733,7 @@ int tda829x_attach(struct tuner *t)
}
EXPORT_SYMBOL_GPL(tda829x_attach);

int tda8290_probe(struct tuner *t)
int tda829x_probe(struct tuner *t)
{
struct tuner_i2c_props i2c_props = {
.adap = t->i2c->adapter,
Expand All @@ -718,6 +747,11 @@ int tda8290_probe(struct tuner *t)
unsigned char addr_dto_lsb = 0x07;
unsigned char data;

if ((tda8290_probe(&i2c_props) == 0) ||
(tda8295_probe(&i2c_props) == 0))
return 0;

/* fall back to old probing method */
tuner_i2c_xfer_send(&i2c_props, easy_mode_b, 2);
tuner_i2c_xfer_send(&i2c_props, soft_reset, 2);
tuner_i2c_xfer_send(&i2c_props, &addr_dto_lsb, 1);
Expand All @@ -734,7 +768,7 @@ int tda8290_probe(struct tuner *t)
tuner_i2c_xfer_send(&i2c_props, restore_9886, 3);
return -1;
}
EXPORT_SYMBOL_GPL(tda8290_probe);
EXPORT_SYMBOL_GPL(tda829x_probe);

MODULE_DESCRIPTION("Philips/NXP TDA8290/TDA8295 analog IF demodulator driver");
MODULE_AUTHOR("Gerd Knorr, Hartmut Hackmann, Michael Krufky");
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/media/video/tda8290.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include "tuner-driver.h"

#if defined(CONFIG_TUNER_TDA8290) || (defined(CONFIG_TUNER_TDA8290_MODULE) && defined(MODULE))
extern int tda8290_probe(struct tuner *t);
extern int tda829x_probe(struct tuner *t);

extern int tda829x_attach(struct tuner *t);
#else
static inline int tda8290_probe(struct tuner *t)
static inline int tda829x_probe(struct tuner *t)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
return -EINVAL;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/media/video/tuner-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
case 0x4b:
/* If chip is not tda8290, don't register.
since it can be tda9887*/
if (tda8290_probe(t) == 0) {
tuner_dbg("chip at addr %x is a tda8290\n", addr);
if (tda829x_probe(t) == 0) {
tuner_dbg("tda829x detected\n");
} else {
/* Default is being tda9887 */
t->type = TUNER_TDA9887;
Expand Down

0 comments on commit f586dcd

Please sign in to comment.