All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/8] tda18212: add support for slave chip version
@ 2014-09-07  1:59 Antti Palosaari
  2014-09-07  1:59 ` [PATCH v2 2/8] tda18212: prepare for I2C client conversion Antti Palosaari
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Antti Palosaari @ 2014-09-07  1:59 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari

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>
---
 drivers/media/tuners/tda18212.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c
index 05a4ac9..15b09f8 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,
 {
 	struct tda18212_priv *priv = NULL;
 	int ret;
-	u8 val;
+	u8 chip_id = chip_id;
+	char *version;
 
 	priv = kzalloc(sizeof(struct tda18212_priv), GFP_KERNEL);
 	if (priv == NULL)
@@ -320,26 +321,38 @@ struct dvb_frontend *tda18212_attach(struct dvb_frontend *fe,
 		fe->ops.i2c_gate_ctrl(fe, 1); /* open I2C-gate */
 
 	/* check if the tuner is there */
-	ret = tda18212_rd_reg(priv, 0x00, &val);
+	ret = tda18212_rd_reg(priv, 0x00, &chip_id);
+	dev_dbg(&priv->i2c->dev, "%s: chip_id=%02x\n", __func__, chip_id);
 
 	if (fe->ops.i2c_gate_ctrl)
 		fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */
 
-	if (!ret)
-		dev_dbg(&priv->i2c->dev, "%s: chip id=%02x\n", __func__, val);
-	if (ret || val != 0xc7) {
-		kfree(priv);
-		return NULL;
+	if (ret)
+		goto err;
+
+	switch (chip_id) {
+	case 0xc7:
+		version = "M"; /* master */
+		break;
+	case 0x47:
+		version = "S"; /* slave */
+		break;
+	default:
+		goto err;
 	}
 
 	dev_info(&priv->i2c->dev,
-			"%s: NXP TDA18212HN successfully identified\n",
-			KBUILD_MODNAME);
+			"%s: NXP TDA18212HN/%s successfully identified\n",
+			KBUILD_MODNAME, version);
 
 	memcpy(&fe->ops.tuner_ops, &tda18212_tuner_ops,
 		sizeof(struct dvb_tuner_ops));
 
 	return fe;
+err:
+	dev_dbg(&i2c->dev, "%s: failed=%d\n", __func__, ret);
+	kfree(priv);
+	return NULL;
 }
 EXPORT_SYMBOL(tda18212_attach);
 
-- 
http://palosaari.fi/


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-09-21 21:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-07  1:59 [PATCH v2 1/8] tda18212: add support for slave chip version Antti Palosaari
2014-09-07  1:59 ` [PATCH v2 2/8] tda18212: prepare for I2C client conversion Antti Palosaari
2014-09-07  1:59 ` [PATCH v2 3/8] anysee: convert tda18212 tuner to I2C client Antti Palosaari
2014-09-18 12:31   ` Mauro Carvalho Chehab
2014-09-18 13:01     ` Antti Palosaari
2014-09-21 21:15       ` Mauro Carvalho Chehab
2014-09-07  1:59 ` [PATCH v2 4/8] em28xx: " Antti Palosaari
2014-09-07  1:59 ` [PATCH v2 5/8] tda18212: convert driver to I2C binding Antti Palosaari
2014-09-07  1:59 ` [PATCH v2 6/8] tda18212: clean logging Antti Palosaari
2014-09-07  1:59 ` [PATCH v2 7/8] tda18212: rename state from 'priv' to 'dev' Antti Palosaari
2014-09-07  2:00 ` [PATCH v2 8/8] tda18212: convert to RegMap API Antti Palosaari

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.