Commit 6e623433 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

V4L/DVB (8970): mt2060: implement I2C-gate control

- implement I2C-gate control
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ef80bfeb
...@@ -170,6 +170,9 @@ static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame ...@@ -170,6 +170,9 @@ static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame
b[0] = REG_LO1B1; b[0] = REG_LO1B1;
b[1] = 0xFF; b[1] = 0xFF;
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
mt2060_writeregs(priv,b,2); mt2060_writeregs(priv,b,2);
freq = params->frequency / 1000; // Hz -> kHz freq = params->frequency / 1000; // Hz -> kHz
...@@ -233,6 +236,9 @@ static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame ...@@ -233,6 +236,9 @@ static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame
i++; i++;
} while (i<10); } while (i<10);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
return ret; return ret;
} }
...@@ -296,13 +302,35 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) ...@@ -296,13 +302,35 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
static int mt2060_init(struct dvb_frontend *fe) static int mt2060_init(struct dvb_frontend *fe)
{ {
struct mt2060_priv *priv = fe->tuner_priv; struct mt2060_priv *priv = fe->tuner_priv;
return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x33); int ret;
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
ret = mt2060_writereg(priv, REG_VGAG,
(priv->cfg->clock_out << 6) | 0x33);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
return ret;
} }
static int mt2060_sleep(struct dvb_frontend *fe) static int mt2060_sleep(struct dvb_frontend *fe)
{ {
struct mt2060_priv *priv = fe->tuner_priv; struct mt2060_priv *priv = fe->tuner_priv;
return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30); int ret;
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
ret = mt2060_writereg(priv, REG_VGAG,
(priv->cfg->clock_out << 6) | 0x30);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
return ret;
} }
static int mt2060_release(struct dvb_frontend *fe) static int mt2060_release(struct dvb_frontend *fe)
...@@ -344,6 +372,9 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter ...@@ -344,6 +372,9 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter
priv->i2c = i2c; priv->i2c = i2c;
priv->if1_freq = if1; priv->if1_freq = if1;
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */
if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) { if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) {
kfree(priv); kfree(priv);
return NULL; return NULL;
...@@ -360,6 +391,9 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter ...@@ -360,6 +391,9 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter
mt2060_calibrate(priv); mt2060_calibrate(priv);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */
return fe; return fe;
} }
EXPORT_SYMBOL(mt2060_attach); EXPORT_SYMBOL(mt2060_attach);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment