aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-07-03 14:36:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-07-05 18:21:47 -0400
commit791a08fc01aaa293a73c9dce260327fdee288faf (patch)
treeccee80b85c897a45f049052f2e775e41d0242e5f /drivers/media
parent58fc1ce37aba8e6371e1ec8a90d650b1965ee6c8 (diff)
V4L/DVB (12172): em28xx: Add autodetection code for Silvercrest 1.3 mpix
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c44
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c2
2 files changed, 45 insertions, 1 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 01fbb7d2e569..8366c521921d 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -58,6 +58,8 @@ static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
58module_param_array(card, int, NULL, 0444); 58module_param_array(card, int, NULL, 0444);
59MODULE_PARM_DESC(card, "card type"); 59MODULE_PARM_DESC(card, "card type");
60 60
61#define MT9V011_VERSION 0x8243
62
61/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */ 63/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */
62static unsigned long em28xx_devused; 64static unsigned long em28xx_devused;
63 65
@@ -1702,6 +1704,46 @@ static inline void em28xx_set_model(struct em28xx *dev)
1702 EM28XX_I2C_FREQ_100_KHZ; 1704 EM28XX_I2C_FREQ_100_KHZ;
1703} 1705}
1704 1706
1707/* HINT method: webcam I2C chips
1708 *
1709 * This method work for webcams with Micron sensors
1710 */
1711static int em28xx_hint_sensor(struct em28xx *dev)
1712{
1713 int rc;
1714 char *sensor_name;
1715 unsigned char cmd;
1716 __be16 version_be;
1717 u16 version;
1718
1719 if (dev->model != EM2820_BOARD_UNKNOWN)
1720 return 0;
1721
1722 dev->i2c_client.addr = 0xba >> 1;
1723 cmd = 0;
1724 i2c_master_send(&dev->i2c_client, &cmd, 1);
1725 rc = i2c_master_recv(&dev->i2c_client, (char *)&version_be, 2);
1726 if (rc != 2)
1727 return -EINVAL;
1728
1729 version = be16_to_cpu(version_be);
1730
1731 switch (version) {
1732 case MT9V011_VERSION:
1733 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;
1734 sensor_name = "mt9v011";
1735 break;
1736 default:
1737 printk("Unknown Sensor 0x%04x\n", be16_to_cpu(version));
1738 return -EINVAL;
1739 }
1740
1741 em28xx_errdev("Sensor is %s, assuming that webcam is %s\n",
1742 sensor_name, em28xx_boards[dev->model].name);
1743
1744 return 0;
1745}
1746
1705/* Since em28xx_pre_card_setup() requires a proper dev->model, 1747/* Since em28xx_pre_card_setup() requires a proper dev->model,
1706 * this won't work for boards with generic PCI IDs 1748 * this won't work for boards with generic PCI IDs
1707 */ 1749 */
@@ -2368,6 +2410,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
2368 return errCode; 2410 return errCode;
2369 } 2411 }
2370 2412
2413 em28xx_hint_sensor(dev);
2414
2371 /* Do board specific init and eeprom reading */ 2415 /* Do board specific init and eeprom reading */
2372 em28xx_card_setup(dev); 2416 em28xx_card_setup(dev);
2373 2417
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 2c86fcf089f5..27e33a287dfc 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -483,7 +483,7 @@ static char *i2c_devs[128] = {
483 [0xa0 >> 1] = "eeprom", 483 [0xa0 >> 1] = "eeprom",
484 [0xb0 >> 1] = "tda9874", 484 [0xb0 >> 1] = "tda9874",
485 [0xb8 >> 1] = "tvp5150a", 485 [0xb8 >> 1] = "tvp5150a",
486 [0xba >> 1] = "tvp5150a", 486 [0xba >> 1] = "webcam sensor or tvp5150a",
487 [0xc0 >> 1] = "tuner (analog)", 487 [0xc0 >> 1] = "tuner (analog)",
488 [0xc2 >> 1] = "tuner (analog)", 488 [0xc2 >> 1] = "tuner (analog)",
489 [0xc4 >> 1] = "tuner (analog)", 489 [0xc4 >> 1] = "tuner (analog)",