aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/uvc/uvc_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/uvc/uvc_driver.c')
-rw-r--r--drivers/media/video/uvc/uvc_driver.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index a0537464987e..20c16c4a62d1 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * uvc_driver.c -- USB Video Class driver 2 * uvc_driver.c -- USB Video Class driver
3 * 3 *
4 * Copyright (C) 2005-2008 4 * Copyright (C) 2005-2009
5 * Laurent Pinchart (laurent.pinchart@skynet.be) 5 * Laurent Pinchart (laurent.pinchart@skynet.be)
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -48,7 +48,7 @@ static unsigned int uvc_quirks_param;
48unsigned int uvc_trace_param; 48unsigned int uvc_trace_param;
49 49
50/* ------------------------------------------------------------------------ 50/* ------------------------------------------------------------------------
51 * Control, formats, ... 51 * Video formats
52 */ 52 */
53 53
54static struct uvc_format_desc uvc_fmts[] = { 54static struct uvc_format_desc uvc_fmts[] = {
@@ -473,7 +473,7 @@ static int uvc_parse_format(struct uvc_device *dev,
473 473
474 /* Several UVC chipsets screw up dwMaxVideoFrameBufferSize 474 /* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
475 * completely. Observed behaviours range from setting the 475 * completely. Observed behaviours range from setting the
476 * value to 1.1x the actual frame size of hardwiring the 476 * value to 1.1x the actual frame size to hardwiring the
477 * 16 low bits to 0. This results in a higher than necessary 477 * 16 low bits to 0. This results in a higher than necessary
478 * memory usage as well as a wrong image size information. For 478 * memory usage as well as a wrong image size information. For
479 * uncompressed formats this can be fixed by computing the 479 * uncompressed formats this can be fixed by computing the
@@ -486,7 +486,7 @@ static int uvc_parse_format(struct uvc_device *dev,
486 /* Some bogus devices report dwMinFrameInterval equal to 486 /* Some bogus devices report dwMinFrameInterval equal to
487 * dwMaxFrameInterval and have dwFrameIntervalStep set to 487 * dwMaxFrameInterval and have dwFrameIntervalStep set to
488 * zero. Setting all null intervals to 1 fixes the problem and 488 * zero. Setting all null intervals to 1 fixes the problem and
489 * some other divisions by zero which could happen. 489 * some other divisions by zero that could happen.
490 */ 490 */
491 for (i = 0; i < n; ++i) { 491 for (i = 0; i < n; ++i) {
492 interval = get_unaligned_le32(&buffer[26+4*i]); 492 interval = get_unaligned_le32(&buffer[26+4*i]);
@@ -1199,13 +1199,13 @@ static void uvc_unregister_video(struct uvc_device *dev)
1199 * Scan the UVC descriptors to locate a chain starting at an Output Terminal 1199 * Scan the UVC descriptors to locate a chain starting at an Output Terminal
1200 * and containing the following units: 1200 * and containing the following units:
1201 * 1201 *
1202 * - a USB Streaming Output Terminal 1202 * - one Output Terminal (USB Streaming or Display)
1203 * - zero or one Processing Unit 1203 * - zero or one Processing Unit
1204 * - zero, one or mode single-input Selector Units 1204 * - zero, one or mode single-input Selector Units
1205 * - zero or one multiple-input Selector Units, provided all inputs are 1205 * - zero or one multiple-input Selector Units, provided all inputs are
1206 * connected to input terminals 1206 * connected to input terminals
1207 * - zero, one or mode single-input Extension Units 1207 * - zero, one or mode single-input Extension Units
1208 * - one Camera Input Terminal, or one or more External terminals. 1208 * - one or more Input Terminals (Camera, External or USB Streaming)
1209 * 1209 *
1210 * A side forward scan is made on each detected entity to check for additional 1210 * A side forward scan is made on each detected entity to check for additional
1211 * extension units. 1211 * extension units.
@@ -1530,10 +1530,6 @@ static int uvc_register_video(struct uvc_device *dev)
1530 1530
1531 /* Set the driver data before calling video_register_device, otherwise 1531 /* Set the driver data before calling video_register_device, otherwise
1532 * uvc_v4l2_open might race us. 1532 * uvc_v4l2_open might race us.
1533 *
1534 * FIXME: usb_set_intfdata hasn't been called so far. Is that a
1535 * problem ? Does any function which could be called here get
1536 * a pointer to the usb_interface ?
1537 */ 1533 */
1538 dev->video.vdev = vdev; 1534 dev->video.vdev = vdev;
1539 video_set_drvdata(vdev, &dev->video); 1535 video_set_drvdata(vdev, &dev->video);
@@ -1568,7 +1564,7 @@ void uvc_delete(struct kref *kref)
1568 struct uvc_device *dev = container_of(kref, struct uvc_device, kref); 1564 struct uvc_device *dev = container_of(kref, struct uvc_device, kref);
1569 struct list_head *p, *n; 1565 struct list_head *p, *n;
1570 1566
1571 /* Unregister the video device */ 1567 /* Unregister the video device. */
1572 uvc_unregister_video(dev); 1568 uvc_unregister_video(dev);
1573 usb_put_intf(dev->intf); 1569 usb_put_intf(dev->intf);
1574 usb_put_dev(dev->udev); 1570 usb_put_dev(dev->udev);
@@ -1611,7 +1607,7 @@ static int uvc_probe(struct usb_interface *intf,
1611 uvc_trace(UVC_TRACE_PROBE, "Probing generic UVC device %s\n", 1607 uvc_trace(UVC_TRACE_PROBE, "Probing generic UVC device %s\n",
1612 udev->devpath); 1608 udev->devpath);
1613 1609
1614 /* Allocate memory for the device and initialize it */ 1610 /* Allocate memory for the device and initialize it. */
1615 if ((dev = kzalloc(sizeof *dev, GFP_KERNEL)) == NULL) 1611 if ((dev = kzalloc(sizeof *dev, GFP_KERNEL)) == NULL)
1616 return -ENOMEM; 1612 return -ENOMEM;
1617 1613
@@ -1632,7 +1628,7 @@ static int uvc_probe(struct usb_interface *intf,
1632 le16_to_cpu(udev->descriptor.idVendor), 1628 le16_to_cpu(udev->descriptor.idVendor),
1633 le16_to_cpu(udev->descriptor.idProduct)); 1629 le16_to_cpu(udev->descriptor.idProduct));
1634 1630
1635 /* Parse the Video Class control descriptor */ 1631 /* Parse the Video Class control descriptor. */
1636 if (uvc_parse_control(dev) < 0) { 1632 if (uvc_parse_control(dev) < 0) {
1637 uvc_trace(UVC_TRACE_PROBE, "Unable to parse UVC " 1633 uvc_trace(UVC_TRACE_PROBE, "Unable to parse UVC "
1638 "descriptors.\n"); 1634 "descriptors.\n");
@@ -1652,18 +1648,18 @@ static int uvc_probe(struct usb_interface *intf,
1652 "linux-uvc-devel mailing list.\n"); 1648 "linux-uvc-devel mailing list.\n");
1653 } 1649 }
1654 1650
1655 /* Initialize controls */ 1651 /* Initialize controls. */
1656 if (uvc_ctrl_init_device(dev) < 0) 1652 if (uvc_ctrl_init_device(dev) < 0)
1657 goto error; 1653 goto error;
1658 1654
1659 /* Register the video devices */ 1655 /* Register the video devices. */
1660 if (uvc_register_video(dev) < 0) 1656 if (uvc_register_video(dev) < 0)
1661 goto error; 1657 goto error;
1662 1658
1663 /* Save our data pointer in the interface data */ 1659 /* Save our data pointer in the interface data. */
1664 usb_set_intfdata(intf, dev); 1660 usb_set_intfdata(intf, dev);
1665 1661
1666 /* Initialize the interrupt URB */ 1662 /* Initialize the interrupt URB. */
1667 if ((ret = uvc_status_init(dev)) < 0) { 1663 if ((ret = uvc_status_init(dev)) < 0) {
1668 uvc_printk(KERN_INFO, "Unable to initialize the status " 1664 uvc_printk(KERN_INFO, "Unable to initialize the status "
1669 "endpoint (%d), status interrupt will not be " 1665 "endpoint (%d), status interrupt will not be "
@@ -1838,24 +1834,24 @@ static struct usb_device_id uvc_ids[] = {
1838 .bInterfaceSubClass = 1, 1834 .bInterfaceSubClass = 1,
1839 .bInterfaceProtocol = 0 }, 1835 .bInterfaceProtocol = 0 },
1840 /* Apple Built-In iSight */ 1836 /* Apple Built-In iSight */
1841 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE 1837 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1842 | USB_DEVICE_ID_MATCH_INT_INFO, 1838 | USB_DEVICE_ID_MATCH_INT_INFO,
1843 .idVendor = 0x05ac, 1839 .idVendor = 0x05ac,
1844 .idProduct = 0x8501, 1840 .idProduct = 0x8501,
1845 .bInterfaceClass = USB_CLASS_VIDEO, 1841 .bInterfaceClass = USB_CLASS_VIDEO,
1846 .bInterfaceSubClass = 1, 1842 .bInterfaceSubClass = 1,
1847 .bInterfaceProtocol = 0, 1843 .bInterfaceProtocol = 0,
1848 .driver_info = UVC_QUIRK_PROBE_MINMAX 1844 .driver_info = UVC_QUIRK_PROBE_MINMAX
1849 | UVC_QUIRK_BUILTIN_ISIGHT }, 1845 | UVC_QUIRK_BUILTIN_ISIGHT },
1850 /* Genesys Logic USB 2.0 PC Camera */ 1846 /* Genesys Logic USB 2.0 PC Camera */
1851 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE 1847 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1852 | USB_DEVICE_ID_MATCH_INT_INFO, 1848 | USB_DEVICE_ID_MATCH_INT_INFO,
1853 .idVendor = 0x05e3, 1849 .idVendor = 0x05e3,
1854 .idProduct = 0x0505, 1850 .idProduct = 0x0505,
1855 .bInterfaceClass = USB_CLASS_VIDEO, 1851 .bInterfaceClass = USB_CLASS_VIDEO,
1856 .bInterfaceSubClass = 1, 1852 .bInterfaceSubClass = 1,
1857 .bInterfaceProtocol = 0, 1853 .bInterfaceProtocol = 0,
1858 .driver_info = UVC_QUIRK_STREAM_NO_FID }, 1854 .driver_info = UVC_QUIRK_STREAM_NO_FID },
1859 /* MT6227 */ 1855 /* MT6227 */
1860 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE 1856 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1861 | USB_DEVICE_ID_MATCH_INT_INFO, 1857 | USB_DEVICE_ID_MATCH_INT_INFO,