Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 271715
b: refs/heads/master
c: 0db4bf4
h: refs/heads/master
i:
  271713: 54a9145
  271711: 5eeabcb
v: v3
  • Loading branch information
Steve Kerrison authored and Mauro Carvalho Chehab committed Sep 3, 2011
1 parent e58a4e7 commit f87ff6c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 86 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: 6fb2bdfa068676f436fd333c460549ed64549c5e
refs/heads/master: 0db4bf42baae95ddd457b0c4911e851c9169750e
9 changes: 0 additions & 9 deletions trunk/drivers/media/dvb/frontends/cxd2820r.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ extern struct dvb_frontend *cxd2820r_attach(
struct i2c_adapter *i2c,
struct dvb_frontend *fe
);
extern struct i2c_adapter *cxd2820r_get_tuner_i2c_adapter(
struct dvb_frontend *fe
);
#else
static inline struct dvb_frontend *cxd2820r_attach(
const struct cxd2820r_config *config,
Expand All @@ -106,12 +103,6 @@ static inline struct dvb_frontend *cxd2820r_attach(
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
static inline struct i2c_adapter *cxd2820r_get_tuner_i2c_adapter(
struct dvb_frontend *fe
)
{
return NULL;
}

#endif

Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/dvb/frontends/cxd2820r_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,3 @@ int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe,

return 0;
}

76 changes: 8 additions & 68 deletions trunk/drivers/media/dvb/frontends/cxd2820r_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,70 +727,20 @@ static void cxd2820r_release(struct dvb_frontend *fe)
struct cxd2820r_priv *priv = fe->demodulator_priv;
dbg("%s", __func__);

if (fe->ops.info.type == FE_OFDM) {
i2c_del_adapter(&priv->tuner_i2c_adapter);
if (fe->ops.info.type == FE_OFDM)
kfree(priv);
}

return;
}

static u32 cxd2820r_tuner_i2c_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_I2C;
}

static int cxd2820r_tuner_i2c_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msg[], int num)
{
struct cxd2820r_priv *priv = i2c_get_adapdata(i2c_adap);
int ret;
u8 *obuf = kmalloc(msg[0].len + 2, GFP_KERNEL);
struct i2c_msg msg2[2] = {
{
.addr = priv->cfg.i2c_address,
.flags = 0,
.len = msg[0].len + 2,
.buf = obuf,
}, {
.addr = priv->cfg.i2c_address,
.flags = I2C_M_RD,
.len = msg[1].len,
.buf = msg[1].buf,
}
};

if (!obuf)
return -ENOMEM;

obuf[0] = 0x09;
obuf[1] = (msg[0].addr << 1);
if (num == 2) { /* I2C read */
obuf[1] = (msg[0].addr << 1) | I2C_M_RD; /* I2C RD flag */
msg2[0].len = msg[0].len + 2 - 1; /* '-1' maybe HW bug ? */
}
memcpy(&obuf[2], msg[0].buf, msg[0].len);

ret = i2c_transfer(priv->i2c, msg2, num);
if (ret < 0)
warn("tuner i2c failed ret:%d", ret);

kfree(obuf);

return ret;
}

static struct i2c_algorithm cxd2820r_tuner_i2c_algo = {
.master_xfer = cxd2820r_tuner_i2c_xfer,
.functionality = cxd2820r_tuner_i2c_func,
};

struct i2c_adapter *cxd2820r_get_tuner_i2c_adapter(struct dvb_frontend *fe)
static int cxd2820r_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
return &priv->tuner_i2c_adapter;
dbg("%s: %d", __func__, enable);

/* Bit 0 of reg 0xdb in bank 0x00 controls I2C repeater */
return cxd2820r_wr_reg_mask(priv, 0xdb, enable ? 1 : 0, 0x1);
}
EXPORT_SYMBOL(cxd2820r_get_tuner_i2c_adapter);

static struct dvb_frontend_ops cxd2820r_ops[2];

Expand Down Expand Up @@ -831,18 +781,6 @@ struct dvb_frontend *cxd2820r_attach(const struct cxd2820r_config *cfg,
priv->fe[0].demodulator_priv = priv;
priv->fe[1].demodulator_priv = priv;

/* create tuner i2c adapter */
strlcpy(priv->tuner_i2c_adapter.name,
"CXD2820R tuner I2C adapter",
sizeof(priv->tuner_i2c_adapter.name));
priv->tuner_i2c_adapter.algo = &cxd2820r_tuner_i2c_algo;
priv->tuner_i2c_adapter.algo_data = NULL;
i2c_set_adapdata(&priv->tuner_i2c_adapter, priv);
if (i2c_add_adapter(&priv->tuner_i2c_adapter) < 0) {
err("tuner I2C bus could not be initialized");
goto error;
}

return &priv->fe[0];

} else {
Expand Down Expand Up @@ -883,6 +821,7 @@ static struct dvb_frontend_ops cxd2820r_ops[2] = {
.sleep = cxd2820r_sleep,

.get_tune_settings = cxd2820r_get_tune_settings,
.i2c_gate_ctrl = cxd2820r_i2c_gate_ctrl,

.get_frontend = cxd2820r_get_frontend,

Expand Down Expand Up @@ -911,6 +850,7 @@ static struct dvb_frontend_ops cxd2820r_ops[2] = {
.sleep = cxd2820r_sleep,

.get_tune_settings = cxd2820r_get_tune_settings,
.i2c_gate_ctrl = cxd2820r_i2c_gate_ctrl,

.set_frontend = cxd2820r_set_frontend,
.get_frontend = cxd2820r_get_frontend,
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/dvb/frontends/cxd2820r_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ struct cxd2820r_priv {
struct i2c_adapter *i2c;
struct dvb_frontend fe[2];
struct cxd2820r_config cfg;
struct i2c_adapter tuner_i2c_adapter;

struct mutex fe_lock; /* FE lock */
int active_fe:2; /* FE lock, -1=NONE, 0=DVB-T/T2, 1=DVB-C */
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/dvb/frontends/cxd2820r_t.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,4 +446,3 @@ int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe,

return 0;
}

1 change: 0 additions & 1 deletion trunk/drivers/media/dvb/frontends/cxd2820r_t2.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,4 +420,3 @@ int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe,

return 0;
}

7 changes: 3 additions & 4 deletions trunk/drivers/media/video/em28xx/em28xx-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ static struct cxd2820r_config em28xx_cxd2820r_config = {

static struct tda18271_config em28xx_cxd2820r_tda18271_config = {
.output_opt = TDA18271_OUTPUT_LT_OFF,
.gate = TDA18271_GATE_DIGITAL,
};

/* ------------------------------------------------------------------ */
Expand Down Expand Up @@ -751,11 +752,9 @@ static int em28xx_dvb_init(struct em28xx *dev)
dvb->fe[0] = dvb_attach(cxd2820r_attach,
&em28xx_cxd2820r_config, &dev->i2c_adap, NULL);
if (dvb->fe[0]) {
struct i2c_adapter *i2c_tuner;
i2c_tuner = cxd2820r_get_tuner_i2c_adapter(dvb->fe[0]);
/* FE 0 attach tuner */
if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
i2c_tuner, &em28xx_cxd2820r_tda18271_config)) {
&dev->i2c_adap, &em28xx_cxd2820r_tda18271_config)) {
dvb_frontend_detach(dvb->fe[0]);
result = -EINVAL;
goto out_free;
Expand All @@ -766,7 +765,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
dvb->fe[1]->id = 1;
/* FE 1 attach tuner */
if (!dvb_attach(tda18271_attach, dvb->fe[1], 0x60,
i2c_tuner, &em28xx_cxd2820r_tda18271_config)) {
&dev->i2c_adap, &em28xx_cxd2820r_tda18271_config)) {
dvb_frontend_detach(dvb->fe[1]);
/* leave FE 0 still active */
}
Expand Down

0 comments on commit f87ff6c

Please sign in to comment.