aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/mt2060.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common/tuners/mt2060.c')
-rw-r--r--drivers/media/common/tuners/mt2060.c38
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)
296static int mt2060_init(struct dvb_frontend *fe) 302static 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
302static int mt2060_sleep(struct dvb_frontend *fe) 319static 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
308static int mt2060_release(struct dvb_frontend *fe) 336static 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}
365EXPORT_SYMBOL(mt2060_attach); 399EXPORT_SYMBOL(mt2060_attach);