aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2014-07-31 15:35:56 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-09-21 15:42:40 -0400
commit976bcb2f6f9c9fb11f0aad7b7c87953e9c3f0116 (patch)
tree94f77253446f5ab902307cdf09b02a0766e64b80 /drivers/media/tuners
parent8e417224dfb397633601a04214841df12cd470b0 (diff)
[media] tda18212: add support for slave chip version
There is 2 different versions of that chip available, master and slave. Slave is used only on dual tuner devices with master tuner. Laser printing top of chip is 18212/M or 18212/S according to chip version. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/tuners')
-rw-r--r--drivers/media/tuners/tda18212.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c
index 05a4ac9edb6b..15b09f8d85c0 100644
--- a/drivers/media/tuners/tda18212.c
+++ b/drivers/media/tuners/tda18212.c
@@ -306,7 +306,8 @@ struct dvb_frontend *tda18212_attach(struct dvb_frontend *fe,
306{ 306{
307 struct tda18212_priv *priv = NULL; 307 struct tda18212_priv *priv = NULL;
308 int ret; 308 int ret;
309 u8 val; 309 u8 chip_id = chip_id;
310 char *version;
310 311
311 priv = kzalloc(sizeof(struct tda18212_priv), GFP_KERNEL); 312 priv = kzalloc(sizeof(struct tda18212_priv), GFP_KERNEL);
312 if (priv == NULL) 313 if (priv == NULL)
@@ -320,26 +321,38 @@ struct dvb_frontend *tda18212_attach(struct dvb_frontend *fe,
320 fe->ops.i2c_gate_ctrl(fe, 1); /* open I2C-gate */ 321 fe->ops.i2c_gate_ctrl(fe, 1); /* open I2C-gate */
321 322
322 /* check if the tuner is there */ 323 /* check if the tuner is there */
323 ret = tda18212_rd_reg(priv, 0x00, &val); 324 ret = tda18212_rd_reg(priv, 0x00, &chip_id);
325 dev_dbg(&priv->i2c->dev, "%s: chip_id=%02x\n", __func__, chip_id);
324 326
325 if (fe->ops.i2c_gate_ctrl) 327 if (fe->ops.i2c_gate_ctrl)
326 fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */ 328 fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */
327 329
328 if (!ret) 330 if (ret)
329 dev_dbg(&priv->i2c->dev, "%s: chip id=%02x\n", __func__, val); 331 goto err;
330 if (ret || val != 0xc7) { 332
331 kfree(priv); 333 switch (chip_id) {
332 return NULL; 334 case 0xc7:
335 version = "M"; /* master */
336 break;
337 case 0x47:
338 version = "S"; /* slave */
339 break;
340 default:
341 goto err;
333 } 342 }
334 343
335 dev_info(&priv->i2c->dev, 344 dev_info(&priv->i2c->dev,
336 "%s: NXP TDA18212HN successfully identified\n", 345 "%s: NXP TDA18212HN/%s successfully identified\n",
337 KBUILD_MODNAME); 346 KBUILD_MODNAME, version);
338 347
339 memcpy(&fe->ops.tuner_ops, &tda18212_tuner_ops, 348 memcpy(&fe->ops.tuner_ops, &tda18212_tuner_ops,
340 sizeof(struct dvb_tuner_ops)); 349 sizeof(struct dvb_tuner_ops));
341 350
342 return fe; 351 return fe;
352err:
353 dev_dbg(&i2c->dev, "%s: failed=%d\n", __func__, ret);
354 kfree(priv);
355 return NULL;
343} 356}
344EXPORT_SYMBOL(tda18212_attach); 357EXPORT_SYMBOL(tda18212_attach);
345 358