diff options
author | Antti Palosaari <crope@iki.fi> | 2008-09-15 13:34:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:37:02 -0400 |
commit | 6e623433f7f566d8aca64c519a19c2f7bbb686be (patch) | |
tree | ac108a7fa65cd15560387d9c4e6b6a691254cfb3 | |
parent | ef80bfeb30f82fb718731a3323a75ae08396a4ea (diff) |
V4L/DVB (8970): mt2060: implement I2C-gate control
- implement I2C-gate control
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/common/tuners/mt2060.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/drivers/media/common/tuners/mt2060.c b/drivers/media/common/tuners/mt2060.c index 1305b0e63ce5..12206d75dd4e 100644 --- a/drivers/media/common/tuners/mt2060.c +++ b/drivers/media/common/tuners/mt2060.c | |||
@@ -170,6 +170,9 @@ static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame | |||
170 | b[0] = REG_LO1B1; | 170 | b[0] = REG_LO1B1; |
171 | b[1] = 0xFF; | 171 | b[1] = 0xFF; |
172 | 172 | ||
173 | if (fe->ops.i2c_gate_ctrl) | ||
174 | fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */ | ||
175 | |||
173 | mt2060_writeregs(priv,b,2); | 176 | mt2060_writeregs(priv,b,2); |
174 | 177 | ||
175 | freq = params->frequency / 1000; // Hz -> kHz | 178 | freq = params->frequency / 1000; // Hz -> kHz |
@@ -233,6 +236,9 @@ static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame | |||
233 | i++; | 236 | i++; |
234 | } while (i<10); | 237 | } while (i<10); |
235 | 238 | ||
239 | if (fe->ops.i2c_gate_ctrl) | ||
240 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | ||
241 | |||
236 | return ret; | 242 | return ret; |
237 | } | 243 | } |
238 | 244 | ||
@@ -296,13 +302,35 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | |||
296 | static int mt2060_init(struct dvb_frontend *fe) | 302 | static int mt2060_init(struct dvb_frontend *fe) |
297 | { | 303 | { |
298 | struct mt2060_priv *priv = fe->tuner_priv; | 304 | struct mt2060_priv *priv = fe->tuner_priv; |
299 | return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x33); | 305 | int ret; |
306 | |||
307 | if (fe->ops.i2c_gate_ctrl) | ||
308 | fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */ | ||
309 | |||
310 | ret = mt2060_writereg(priv, REG_VGAG, | ||
311 | (priv->cfg->clock_out << 6) | 0x33); | ||
312 | |||
313 | if (fe->ops.i2c_gate_ctrl) | ||
314 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | ||
315 | |||
316 | return ret; | ||
300 | } | 317 | } |
301 | 318 | ||
302 | static int mt2060_sleep(struct dvb_frontend *fe) | 319 | static int mt2060_sleep(struct dvb_frontend *fe) |
303 | { | 320 | { |
304 | struct mt2060_priv *priv = fe->tuner_priv; | 321 | struct mt2060_priv *priv = fe->tuner_priv; |
305 | return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30); | 322 | int ret; |
323 | |||
324 | if (fe->ops.i2c_gate_ctrl) | ||
325 | fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */ | ||
326 | |||
327 | ret = mt2060_writereg(priv, REG_VGAG, | ||
328 | (priv->cfg->clock_out << 6) | 0x30); | ||
329 | |||
330 | if (fe->ops.i2c_gate_ctrl) | ||
331 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | ||
332 | |||
333 | return ret; | ||
306 | } | 334 | } |
307 | 335 | ||
308 | static int mt2060_release(struct dvb_frontend *fe) | 336 | 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 | priv->i2c = i2c; | 372 | priv->i2c = i2c; |
345 | priv->if1_freq = if1; | 373 | priv->if1_freq = if1; |
346 | 374 | ||
375 | if (fe->ops.i2c_gate_ctrl) | ||
376 | fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */ | ||
377 | |||
347 | if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) { | 378 | if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) { |
348 | kfree(priv); | 379 | kfree(priv); |
349 | return NULL; | 380 | return NULL; |
@@ -360,6 +391,9 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter | |||
360 | 391 | ||
361 | mt2060_calibrate(priv); | 392 | mt2060_calibrate(priv); |
362 | 393 | ||
394 | if (fe->ops.i2c_gate_ctrl) | ||
395 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | ||
396 | |||
363 | return fe; | 397 | return fe; |
364 | } | 398 | } |
365 | EXPORT_SYMBOL(mt2060_attach); | 399 | EXPORT_SYMBOL(mt2060_attach); |