aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/i2c/saa7115.c36
-rw-r--r--include/media/v4l2-chip-ident.h2
2 files changed, 38 insertions, 0 deletions
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 289f460801db..ca2a863a6d3e 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,
1640 } 1640 }
1641 } 1641 }
1642 1642
1643 /* Check if it is a gm7113c */
1644 if (!memcmp(name, "0000", 4)) {
1645 chip_id = 0;
1646 for (i = 0; i < 4; i++) {
1647 chip_id = chip_id << 1;
1648 chip_id |= (chip_ver[i] & 0x80) ? 1 : 0;
1649 }
1650
1651 /*
1652 * Note: From the datasheet, only versions 1 and 2
1653 * exists. However, tests on a device labeled as:
1654 * "GM7113C 1145" returned "10" on all 16 chip
1655 * version (reg 0x00) reads. So, we need to also
1656 * accept at least verion 0. For now, let's just
1657 * assume that a device that returns "0000" for
1658 * the lower nibble is a gm7113c.
1659 */
1660
1661 strlcpy(name, "gm7113c", size);
1662
1663 if (!autodetect && strcmp(name, id->name))
1664 return -EINVAL;
1665
1666 v4l_dbg(1, debug, client,
1667 "It seems to be a %s chip (%*ph) @ 0x%x.\n",
1668 name, 16, chip_ver, client->addr << 1);
1669
1670 return V4L2_IDENT_GM7113C;
1671 }
1672
1643 /* Chip was not discovered. Return its ID and don't bind */ 1673 /* Chip was not discovered. Return its ID and don't bind */
1644 v4l_dbg(1, debug, client, "chip %*ph @ 0x%x is unknown.\n", 1674 v4l_dbg(1, debug, client, "chip %*ph @ 0x%x is unknown.\n",
1645 16, chip_ver, client->addr << 1); 1675 16, chip_ver, client->addr << 1);
@@ -1669,6 +1699,11 @@ static int saa711x_probe(struct i2c_client *client,
1669 if (ident < 0) 1699 if (ident < 0)
1670 return ident; 1700 return ident;
1671 1701
1702 if (ident == V4L2_IDENT_GM7113C) {
1703 v4l_warn(client, "%s not yet supported\n", name);
1704 return -ENODEV;
1705 }
1706
1672 strlcpy(client->name, name, sizeof(client->name)); 1707 strlcpy(client->name, name, sizeof(client->name));
1673 1708
1674 state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); 1709 state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);
@@ -1754,6 +1789,7 @@ static const struct i2c_device_id saa711x_id[] = {
1754 { "saa7114", 0 }, 1789 { "saa7114", 0 },
1755 { "saa7115", 0 }, 1790 { "saa7115", 0 },
1756 { "saa7118", 0 }, 1791 { "saa7118", 0 },
1792 { "gm7113c", 0 },
1757 { } 1793 { }
1758}; 1794};
1759MODULE_DEVICE_TABLE(i2c, saa711x_id); 1795MODULE_DEVICE_TABLE(i2c, saa711x_id);
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index c259b36bf1e9..543f89c18896 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -52,6 +52,8 @@ enum {
52 V4L2_IDENT_SAA7115 = 105, 52 V4L2_IDENT_SAA7115 = 105,
53 V4L2_IDENT_SAA7118 = 108, 53 V4L2_IDENT_SAA7118 = 108,
54 54
55 V4L2_IDENT_GM7113C = 140,
56
55 /* module saa7127: reserved range 150-199 */ 57 /* module saa7127: reserved range 150-199 */
56 V4L2_IDENT_SAA7127 = 157, 58 V4L2_IDENT_SAA7127 = 157,
57 V4L2_IDENT_SAA7129 = 159, 59 V4L2_IDENT_SAA7129 = 159,