Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93607
b: refs/heads/master
c: b9ef6bb
h: refs/heads/master
i:
  93605: 111e4ad
  93603: 2e1e4a7
  93599: 4fe9897
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Apr 26, 2008
1 parent 6b80095 commit 5a3d806
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 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: 0e3cbe81d52d18d83d068935512bd623a8765c12
refs/heads/master: b9ef6bbbbeaf65c6a452fe3c75c196f86e0d984d
92 changes: 46 additions & 46 deletions trunk/drivers/media/video/tuner-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,19 +369,13 @@ static void set_type(struct i2c_client *c, unsigned int type,
break;
}
case TUNER_TEA5767:
if (tea5767_attach(&t->fe, t->i2c->adapter, t->i2c->addr) == NULL) {
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;
return;
}
if (!tea5767_attach(&t->fe, t->i2c->adapter, t->i2c->addr))
goto attach_failed;
t->mode_mask = T_RADIO;
break;
case TUNER_TEA5761:
if (tea5761_attach(&t->fe, t->i2c->adapter, t->i2c->addr) == NULL) {
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;
return;
}
if (!tea5761_attach(&t->fe, t->i2c->adapter, t->i2c->addr))
goto attach_failed;
t->mode_mask = T_RADIO;
break;
case TUNER_PHILIPS_FMD1216ME_MK3:
Expand All @@ -394,25 +388,19 @@ static void set_type(struct i2c_client *c, unsigned int type,
buffer[2] = 0x86;
buffer[3] = 0x54;
i2c_master_send(c, buffer, 4);
if (simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr,
t->type) == NULL) {
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;
return;
}
if (!simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr,
t->type))
goto attach_failed;
break;
case TUNER_PHILIPS_TD1316:
buffer[0] = 0x0b;
buffer[1] = 0xdc;
buffer[2] = 0x86;
buffer[3] = 0xa4;
i2c_master_send(c,buffer,4);
if (simple_tuner_attach(&t->fe, t->i2c->adapter,
t->i2c->addr, t->type) == NULL) {
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;
return;
}
if (!simple_tuner_attach(&t->fe, t->i2c->adapter,
t->i2c->addr, t->type))
goto attach_failed;
break;
case TUNER_XC2028:
{
Expand All @@ -421,40 +409,34 @@ static void set_type(struct i2c_client *c, unsigned int type,
.i2c_addr = t->i2c->addr,
.callback = t->tuner_callback,
};
if (!xc2028_attach(&t->fe, &cfg)) {
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;
return;
}
if (!xc2028_attach(&t->fe, &cfg))
goto attach_failed;
break;
}
case TUNER_TDA9887:
tda9887_attach(&t->fe, t->i2c->adapter, t->i2c->addr);
break;
case TUNER_XC5000:
{
struct dvb_tuner_ops *xc_tuner_ops;

xc5000_cfg.i2c_address = t->i2c->addr;
xc5000_cfg.if_khz = 5380;
xc5000_cfg.priv = c->adapter->algo_data;
xc5000_cfg.tuner_callback = t->tuner_callback;
if (!xc5000_attach(&t->fe, t->i2c->adapter, &xc5000_cfg)) {
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;
return;
}
{
struct dvb_tuner_ops *xc_tuner_ops;
if (!xc5000_attach(&t->fe, t->i2c->adapter, &xc5000_cfg))
goto attach_failed;

xc_tuner_ops = &t->fe.ops.tuner_ops;
if(xc_tuner_ops->init != NULL)
if (xc_tuner_ops->init)
xc_tuner_ops->init(&t->fe);
}
break;
}
default:
if (simple_tuner_attach(&t->fe, t->i2c->adapter,
t->i2c->addr, t->type) == NULL) {
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;
return;
}
if (!simple_tuner_attach(&t->fe, t->i2c->adapter,
t->i2c->addr, t->type))
goto attach_failed;

break;
}

Expand All @@ -476,11 +458,27 @@ static void set_type(struct i2c_client *c, unsigned int type,
if (t->mode_mask == T_UNINITIALIZED)
t->mode_mask = new_mode_mask;

set_freq(c, (V4L2_TUNER_RADIO == t->mode) ? t->radio_freq : t->tv_freq);
/* xc2028/3028 and xc5000 requires a firmware to be set-up later
trying to set a frequency here will just fail
FIXME: better to move set_freq to the tuner code. This is needed
on analog tuners for PLL to properly work
*/
if (t->type != TUNER_XC2028 && t->type != TUNER_XC5000)
set_freq(c, (V4L2_TUNER_RADIO == t->mode) ?
t->radio_freq : t->tv_freq);

tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
c->adapter->name, c->driver->driver.name, c->addr << 1, type,
t->mode_mask);
tuner_i2c_address_check(t);
return;

attach_failed:
tuner_dbg("Tuner attach for type = %d failed.\n", t->type);
t->type = TUNER_ABSENT;
t->mode_mask = T_UNINITIALIZED;

return;
}

/*
Expand All @@ -495,14 +493,16 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
{
struct tuner *t = i2c_get_clientdata(c);

tuner_dbg("set addr for type %i\n", t->type);

if ( (t->type == UNSET && ((tun_setup->addr == ADDR_UNSET) &&
(t->mode_mask & tun_setup->mode_mask))) ||
(tun_setup->addr == c->addr)) {
set_type(c, tun_setup->type, tun_setup->mode_mask,
tun_setup->config, tun_setup->tuner_callback);
}
} else
tuner_dbg("set addr discarded for type %i, mask %x. "
"Asked to change tuner at addr 0x%02x, with mask %x\n",
t->type, t->mode_mask,
tun_setup->addr, tun_setup->mode_mask);
}

static inline int check_mode(struct tuner *t, char *cmd)
Expand Down

0 comments on commit 5a3d806

Please sign in to comment.