mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier@osg.samsung.com>
To: linux-kernel@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	linux-media@vger.kernel.org,
	Javier Martinez Canillas <javier@osg.samsung.com>
Subject: [PATCH 4/8] [media] tvp5150: store dev id and rom version
Date: Fri,  5 Feb 2016 16:09:54 -0300	[thread overview]
Message-ID: <1454699398-8581-5-git-send-email-javier@osg.samsung.com> (raw)
In-Reply-To: <1454699398-8581-1-git-send-email-javier@osg.samsung.com>

Not all tvp5150 variants support the same, for example some have an
internal signal generator that can output a black screen.

So the device id and rom version have to be stored in the driver's
state to know what variant is a given device.

While being there, remove some redundant comments about the device
version since there is already calls to v4l2_info() with that info.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/i2c/tvp5150.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index c7eeb59a999b..093ff80f944c 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -49,6 +49,9 @@ struct tvp5150 {
 	u32 output;
 	int enable;
 
+	u16 dev_id;
+	u16 rom_ver;
+
 	enum v4l2_mbus_type mbus_type;
 };
 
@@ -1180,8 +1183,6 @@ static int tvp5150_detect_version(struct tvp5150 *core)
 	struct v4l2_subdev *sd = &core->sd;
 	struct i2c_client *c = v4l2_get_subdevdata(sd);
 	unsigned int i;
-	u16 dev_id;
-	u16 rom_ver;
 	u8 regs[4];
 	int res;
 
@@ -1196,23 +1197,25 @@ static int tvp5150_detect_version(struct tvp5150 *core)
 		regs[i] = res;
 	}
 
-	dev_id = (regs[0] << 8) | regs[1];
-	rom_ver = (regs[2] << 8) | regs[3];
+	core->dev_id = (regs[0] << 8) | regs[1];
+	core->rom_ver = (regs[2] << 8) | regs[3];
 
 	v4l2_info(sd, "tvp%04x (%u.%u) chip found @ 0x%02x (%s)\n",
-		  dev_id, regs[2], regs[3], c->addr << 1, c->adapter->name);
+		  core->dev_id, regs[2], regs[3], c->addr << 1,
+		  c->adapter->name);
 
-	if (dev_id == 0x5150 && rom_ver == 0x0321) { /* TVP51510A */
+	if (core->dev_id == 0x5150 && core->rom_ver == 0x0321) {
 		v4l2_info(sd, "tvp5150a detected.\n");
-	} else if (dev_id == 0x5150 && rom_ver == 0x0400) { /* TVP5150AM1 */
+	} else if (core->dev_id == 0x5150 && core->rom_ver == 0x0400) {
 		v4l2_info(sd, "tvp5150am1 detected.\n");
 
 		/* ITU-T BT.656.4 timing */
 		tvp5150_write(sd, TVP5150_REV_SELECT, 0);
-	} else if (dev_id == 0x5151 && rom_ver == 0x0100) { /* TVP5151 */
+	} else if (core->dev_id == 0x5151 && core->rom_ver == 0x0100) {
 		v4l2_info(sd, "tvp5151 detected.\n");
 	} else {
-		v4l2_info(sd, "*** unknown tvp%04x chip detected.\n", dev_id);
+		v4l2_info(sd, "*** unknown tvp%04x chip detected.\n",
+			  core->dev_id);
 	}
 
 	return 0;
-- 
2.5.0

  parent reply	other threads:[~2016-02-05 19:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 19:09 [PATCH 0/8] [media] tvp5150: add HW input connectors support Javier Martinez Canillas
2016-02-05 19:09 ` [PATCH 1/8] [media] v4l2-subdev: add registered_async subdev core operation Javier Martinez Canillas
2016-02-05 19:09 ` [PATCH 2/8] [media] v4l2-async: call registered_async after subdev registration Javier Martinez Canillas
2016-08-11 11:10   ` Sakari Ailus
2016-08-11 11:18     ` Sakari Ailus
2016-08-11 16:14       ` Javier Martinez Canillas
2016-08-11 19:28         ` Sakari Ailus
2016-02-05 19:09 ` [PATCH 3/8] [media] tvp5150: put endpoint node on error Javier Martinez Canillas
2016-02-05 19:09 ` Javier Martinez Canillas [this message]
2016-02-05 19:09 ` [PATCH 5/8] [media] tvp5150: add internal signal generator to HW input list Javier Martinez Canillas
2016-02-05 19:09 ` [PATCH 6/8] [media] tvp5150: move input definition header to dt-bindings Javier Martinez Canillas
2016-02-05 19:09 ` [PATCH 7/8] [media] tvp5150: document input connectors DT bindings Javier Martinez Canillas
2016-02-08 18:23   ` Javier Martinez Canillas
2016-02-05 19:09 ` [PATCH 8/8] [media] tvp5150: add HW input connectors support Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454699398-8581-5-git-send-email-javier@osg.samsung.com \
    --to=javier@osg.samsung.com \
    --cc=hans.verkuil@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®