diff options
Diffstat (limited to 'drivers/media/video/uvc/uvc_driver.c')
-rw-r--r-- | drivers/media/video/uvc/uvc_driver.c | 74 |
1 files changed, 55 insertions, 19 deletions
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index 391cccca7ffc..a814820a3f6e 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c | |||
@@ -43,8 +43,9 @@ | |||
43 | #define DRIVER_VERSION "v0.1.0" | 43 | #define DRIVER_VERSION "v0.1.0" |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | unsigned int uvc_clock_param = CLOCK_MONOTONIC; | ||
46 | unsigned int uvc_no_drop_param; | 47 | unsigned int uvc_no_drop_param; |
47 | static unsigned int uvc_quirks_param; | 48 | static unsigned int uvc_quirks_param = -1; |
48 | unsigned int uvc_trace_param; | 49 | unsigned int uvc_trace_param; |
49 | unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT; | 50 | unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT; |
50 | 51 | ||
@@ -59,6 +60,11 @@ static struct uvc_format_desc uvc_fmts[] = { | |||
59 | .fcc = V4L2_PIX_FMT_YUYV, | 60 | .fcc = V4L2_PIX_FMT_YUYV, |
60 | }, | 61 | }, |
61 | { | 62 | { |
63 | .name = "YUV 4:2:2 (YUYV)", | ||
64 | .guid = UVC_GUID_FORMAT_YUY2_ISIGHT, | ||
65 | .fcc = V4L2_PIX_FMT_YUYV, | ||
66 | }, | ||
67 | { | ||
62 | .name = "YUV 4:2:0 (NV12)", | 68 | .name = "YUV 4:2:0 (NV12)", |
63 | .guid = UVC_GUID_FORMAT_NV12, | 69 | .guid = UVC_GUID_FORMAT_NV12, |
64 | .fcc = V4L2_PIX_FMT_NV12, | 70 | .fcc = V4L2_PIX_FMT_NV12, |
@@ -309,11 +315,10 @@ static int uvc_parse_format(struct uvc_device *dev, | |||
309 | sizeof format->name); | 315 | sizeof format->name); |
310 | format->fcc = fmtdesc->fcc; | 316 | format->fcc = fmtdesc->fcc; |
311 | } else { | 317 | } else { |
312 | uvc_printk(KERN_INFO, "Unknown video format " | 318 | uvc_printk(KERN_INFO, "Unknown video format %pUl\n", |
313 | UVC_GUID_FORMAT "\n", | 319 | &buffer[5]); |
314 | UVC_GUID_ARGS(&buffer[5])); | 320 | snprintf(format->name, sizeof(format->name), "%pUl\n", |
315 | snprintf(format->name, sizeof format->name, | 321 | &buffer[5]); |
316 | UVC_GUID_FORMAT, UVC_GUID_ARGS(&buffer[5])); | ||
317 | format->fcc = 0; | 322 | format->fcc = 0; |
318 | } | 323 | } |
319 | 324 | ||
@@ -1750,7 +1755,8 @@ static int uvc_probe(struct usb_interface *intf, | |||
1750 | dev->udev = usb_get_dev(udev); | 1755 | dev->udev = usb_get_dev(udev); |
1751 | dev->intf = usb_get_intf(intf); | 1756 | dev->intf = usb_get_intf(intf); |
1752 | dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber; | 1757 | dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber; |
1753 | dev->quirks = id->driver_info | uvc_quirks_param; | 1758 | dev->quirks = (uvc_quirks_param == -1) |
1759 | ? id->driver_info : uvc_quirks_param; | ||
1754 | 1760 | ||
1755 | if (udev->product != NULL) | 1761 | if (udev->product != NULL) |
1756 | strlcpy(dev->name, udev->product, sizeof dev->name); | 1762 | strlcpy(dev->name, udev->product, sizeof dev->name); |
@@ -1773,9 +1779,9 @@ static int uvc_probe(struct usb_interface *intf, | |||
1773 | le16_to_cpu(udev->descriptor.idVendor), | 1779 | le16_to_cpu(udev->descriptor.idVendor), |
1774 | le16_to_cpu(udev->descriptor.idProduct)); | 1780 | le16_to_cpu(udev->descriptor.idProduct)); |
1775 | 1781 | ||
1776 | if (uvc_quirks_param != 0) { | 1782 | if (dev->quirks != id->driver_info) { |
1777 | uvc_printk(KERN_INFO, "Forcing device quirks 0x%x by module " | 1783 | uvc_printk(KERN_INFO, "Forcing device quirks to 0x%x by module " |
1778 | "parameter for testing purpose.\n", uvc_quirks_param); | 1784 | "parameter for testing purpose.\n", dev->quirks); |
1779 | uvc_printk(KERN_INFO, "Please report required quirks to the " | 1785 | uvc_printk(KERN_INFO, "Please report required quirks to the " |
1780 | "linux-uvc-devel mailing list.\n"); | 1786 | "linux-uvc-devel mailing list.\n"); |
1781 | } | 1787 | } |
@@ -1892,6 +1898,45 @@ static int uvc_reset_resume(struct usb_interface *intf) | |||
1892 | } | 1898 | } |
1893 | 1899 | ||
1894 | /* ------------------------------------------------------------------------ | 1900 | /* ------------------------------------------------------------------------ |
1901 | * Module parameters | ||
1902 | */ | ||
1903 | |||
1904 | static int uvc_clock_param_get(char *buffer, struct kernel_param *kp) | ||
1905 | { | ||
1906 | if (uvc_clock_param == CLOCK_MONOTONIC) | ||
1907 | return sprintf(buffer, "CLOCK_MONOTONIC"); | ||
1908 | else | ||
1909 | return sprintf(buffer, "CLOCK_REALTIME"); | ||
1910 | } | ||
1911 | |||
1912 | static int uvc_clock_param_set(const char *val, struct kernel_param *kp) | ||
1913 | { | ||
1914 | if (strncasecmp(val, "clock_", strlen("clock_")) == 0) | ||
1915 | val += strlen("clock_"); | ||
1916 | |||
1917 | if (strcasecmp(val, "monotonic") == 0) | ||
1918 | uvc_clock_param = CLOCK_MONOTONIC; | ||
1919 | else if (strcasecmp(val, "realtime") == 0) | ||
1920 | uvc_clock_param = CLOCK_REALTIME; | ||
1921 | else | ||
1922 | return -EINVAL; | ||
1923 | |||
1924 | return 0; | ||
1925 | } | ||
1926 | |||
1927 | module_param_call(clock, uvc_clock_param_set, uvc_clock_param_get, | ||
1928 | &uvc_clock_param, S_IRUGO|S_IWUSR); | ||
1929 | MODULE_PARM_DESC(clock, "Video buffers timestamp clock"); | ||
1930 | module_param_named(nodrop, uvc_no_drop_param, uint, S_IRUGO|S_IWUSR); | ||
1931 | MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames"); | ||
1932 | module_param_named(quirks, uvc_quirks_param, uint, S_IRUGO|S_IWUSR); | ||
1933 | MODULE_PARM_DESC(quirks, "Forced device quirks"); | ||
1934 | module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR); | ||
1935 | MODULE_PARM_DESC(trace, "Trace level bitmask"); | ||
1936 | module_param_named(timeout, uvc_timeout_param, uint, S_IRUGO|S_IWUSR); | ||
1937 | MODULE_PARM_DESC(timeout, "Streaming control requests timeout"); | ||
1938 | |||
1939 | /* ------------------------------------------------------------------------ | ||
1895 | * Driver initialization and cleanup | 1940 | * Driver initialization and cleanup |
1896 | */ | 1941 | */ |
1897 | 1942 | ||
@@ -2197,15 +2242,6 @@ static void __exit uvc_cleanup(void) | |||
2197 | module_init(uvc_init); | 2242 | module_init(uvc_init); |
2198 | module_exit(uvc_cleanup); | 2243 | module_exit(uvc_cleanup); |
2199 | 2244 | ||
2200 | module_param_named(nodrop, uvc_no_drop_param, uint, S_IRUGO|S_IWUSR); | ||
2201 | MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames"); | ||
2202 | module_param_named(quirks, uvc_quirks_param, uint, S_IRUGO|S_IWUSR); | ||
2203 | MODULE_PARM_DESC(quirks, "Forced device quirks"); | ||
2204 | module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR); | ||
2205 | MODULE_PARM_DESC(trace, "Trace level bitmask"); | ||
2206 | module_param_named(timeout, uvc_timeout_param, uint, S_IRUGO|S_IWUSR); | ||
2207 | MODULE_PARM_DESC(timeout, "Streaming control requests timeout"); | ||
2208 | |||
2209 | MODULE_AUTHOR(DRIVER_AUTHOR); | 2245 | MODULE_AUTHOR(DRIVER_AUTHOR); |
2210 | MODULE_DESCRIPTION(DRIVER_DESC); | 2246 | MODULE_DESCRIPTION(DRIVER_DESC); |
2211 | MODULE_LICENSE("GPL"); | 2247 | MODULE_LICENSE("GPL"); |