aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-04-26 10:22:48 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-05-21 08:24:31 -0300
commitb11460b0532dd22830a9f2fcdcad91b790c6b35b (patch)
tree8f74e1f2b7f6fe23105acbdbb096fda9963c6d63 /drivers/media/i2c
parente090901e48ba75508caaa1b98fdbb65591c1163f (diff)
downloadkernel_goldelico_gta04-b11460b0532dd22830a9f2fcdcad91b790c6b35b.zip
kernel_goldelico_gta04-b11460b0532dd22830a9f2fcdcad91b790c6b35b.tar.gz
kernel_goldelico_gta04-b11460b0532dd22830a9f2fcdcad91b790c6b35b.tar.bz2
[media] saa7115: add detection code for gm7113c
Adds a code that (auto)detects gm7113c clones. The auto-detection here is not perfect, as, on contrary to what it would be expected by looking into its datasheets some devices would return, instead: saa7115 0-0025: chip 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 @ 0x4a is unknown (found on a device labeled as GM7113C 1145 by Ezequiel Garcia) Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Jon Arne Jørgensen <jonarne@jonarne.no> Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/saa7115.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 289f460..ca2a863 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1640,6 +1640,36 @@ static int saa711x_detect_chip(struct i2c_client *client,
}
}
+ /* Check if it is a gm7113c */
+ if (!memcmp(name, "0000", 4)) {
+ chip_id = 0;
+ for (i = 0; i < 4; i++) {
+ chip_id = chip_id << 1;
+ chip_id |= (chip_ver[i] & 0x80) ? 1 : 0;
+ }
+
+ /*
+ * Note: From the datasheet, only versions 1 and 2
+ * exists. However, tests on a device labeled as:
+ * "GM7113C 1145" returned "10" on all 16 chip
+ * version (reg 0x00) reads. So, we need to also
+ * accept at least verion 0. For now, let's just
+ * assume that a device that returns "0000" for
+ * the lower nibble is a gm7113c.
+ */
+
+ strlcpy(name, "gm7113c", size);
+
+ if (!autodetect && strcmp(name, id->name))
+ return -EINVAL;
+
+ v4l_dbg(1, debug, client,
+ "It seems to be a %s chip (%*ph) @ 0x%x.\n",
+ name, 16, chip_ver, client->addr << 1);
+
+ return V4L2_IDENT_GM7113C;
+ }
+
/* Chip was not discovered. Return its ID and don't bind */
v4l_dbg(1, debug, client, "chip %*ph @ 0x%x is unknown.\n",
16, chip_ver, client->addr << 1);
@@ -1669,6 +1699,11 @@ static int saa711x_probe(struct i2c_client *client,
if (ident < 0)
return ident;
+ if (ident == V4L2_IDENT_GM7113C) {
+ v4l_warn(client, "%s not yet supported\n", name);
+ return -ENODEV;
+ }
+
strlcpy(client->name, name, sizeof(client->name));
state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);
@@ -1754,6 +1789,7 @@ static const struct i2c_device_id saa711x_id[] = {
{ "saa7114", 0 },
{ "saa7115", 0 },
{ "saa7118", 0 },
+ { "gm7113c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, saa711x_id);