summaryrefslogtreecommitdiff
path: root/drivers/media/video/uvc/uvcvideo.h
AgeCommit message (Collapse)Author
2012-08-15[media] rename most media/video usb drivers to media/usbMauro Carvalho Chehab
Rename all USB drivers with their own directory under drivers/media/video into drivers/media/usb and update the building system. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13[media] uvcvideo: Support 10bit, 12bit and alternate 8bit greyscale formatsStefan Muenzel
The SPCAM SP620U camera uses the alternate "Y8 " GUID for the 8-bit greyscale format, and supports a 12-bit greyscale format. Add support for those in the driver, as well as for 10-bit greyscale formats. Signed-off-by: Stefan Muenzel <stefanmuenzel@googlemail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-07[media] uvcvideo: Drop unused ctrl member from struct uvc_control_mappingHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-07[media] uvcvideo: Properly report the inactive flag for inactive controlsHans de Goede
Note the unused in this patch slave_ids addition to the mappings will get used in a follow up patch to generate control change events for the slave ctrls when their flags change due to the master control changing value. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-07[media] uvcvideo: Add support for control eventsHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11[media] uvcvideo: Fix integer overflow in uvc_ioctl_ctrl_map()Haogang Chen
There is a potential integer overflow in uvc_ioctl_ctrl_map(). When a large xmap->menu_count is passed from the userspace, the subsequent call to kmalloc() will allocate a buffer smaller than expected. map->menu_count and map->menu_info would later be used in a loop (e.g. in uvc_query_v4l2_ctrl), which leads to out-of-bound access. The patch checks the ioctl argument and returns -EINVAL for zero or too large values in xmap->menu_count. Signed-off-by: Haogang Chen <haogangchen@gmail.com> [laurent.pinchart@ideasonboard.com Prevent excessive memory consumption] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11[media] uvcvideo: Add UVC timestamps supportLaurent Pinchart
UVC devices transmit a device timestamp along with video frames. Convert the timestamp to a host timestamp and use it to fill the V4L2 buffer timestamp field. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11[media] uvcvideo: Extract timestamp-related statisticsLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11[media] uvcvideo: Extract video stream statisticsAlexey Fisher
Export the statistics through debugfs. Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11[media] uvcvideo: Add debugfs supportAlexey Fisher
Create a debugfs entry per UVC stream. This will be used to export stream statistics. Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [mchehab@redhat.com: add incude <linux/module.h> to avoid compilation breakage] Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11[media] uvcvideo: Ignore GET_RES error for XU controlsLaurent Pinchart
GET_RES request support is mandatory for extension units, but some cameras still choke on it (one example is the Logitech QuickCam PTZ that returns a single byte for the PTZ relative control instead of four). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11[media] uvcvideo: Make uvc_commit_video() staticLaurent Pinchart
The function is not used outside of its compilation unit. Make it static. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11[media] uvcvideo: Use videobuf2-vmallocLaurent Pinchart
Replace the current video buffers queue implementation with videobuf2-vmalloc. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-11[media] uvcvideo: Move fields from uvc_buffer::buf to uvc_bufferLaurent Pinchart
Add mem, length and bytesused fields to the uvc_buffer structure and use them instead of accessing the uvc_buffer::buf m.offset, length and bytesused fields directly. This prepares the driver to the conversion to videobuf2. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-23[media] uvcvideo: Add a mapping for H.264 payloadsStephan Lachowsky
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-23[media] uvcvideo: Remove deprecated UVCIOC ioctlsLaurent Pinchart
The UVCIOC_CTRL_ADD, UVCIOC_CTRL_MAP_OLD, UVCIOC_CTRL_GET and UVCIOC_CTRL_SET ioctls are deprecated and were scheduled for removal for v2.6.42. As v2.6.42 == v3.2, remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-08-06[media] uvcvideo: Set alternate setting 0 on resume if the bus has been resetMing Lei
If the bus has been reset on resume, set the alternate setting to 0. This should be the default value, but some devices crash or otherwise misbehave if they don't receive a SET_INTERFACE request before any other video control request. Microdia's 0c45:6437 camera has been found to require this change or it will stop sending video data after resume. uvc_video.c] Signed-off-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-07-27[media] uvcvideo: Use LINUX_VERSION_CODE for VIDIOC_QUERYCAPMauro Carvalho Chehab
uvcvideo doesn't use vidioc_ioctl2. As the API is changing to use a common version for all drivers, we need to expliticly fix this driver. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-25[media] uvcvideo: Connect video devices to media entitiesLaurent Pinchart
The video devices associated to USB streaming terminals must be connected to their associated terminal's media entity instead of being standalone entities. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-25[media] uvcvideo: Register subdevices for each entityLaurent Pinchart
Userspace applications can now discover the UVC device topology using the media controller API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-25[media] uvcvideo: Register a v4l2_deviceLaurent Pinchart
As a first step to the media controller integration register a v4l2_device for each UVC control interface and make the video_device a child of the v4l2_device. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] uvcvideo: Add M420 format supportHans de Goede
The M420 format is used by the Microsoft LifeCam Studio HD. Signed-off-by: Hans de Goede <hdegoede@redhat.com> [laurent.pinchart@ideasonboard.com: split into v4l/uvcvideo patches] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] uvcvideo: Add support for NOMMU archBob Liu
Add support to uvc driver for NOMMU arch including add function uvc_queue_get_unmapped_area() and make some changes in uvc_queue_mmap(). So that uvc camera can be used on nommu arch like blackfin. Signed-off-by: Bob Liu <lliubbo@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] uvcvideo: Make the API publicLaurent Pinchart
Move the public API definitions to include/linux/uvcvideo.h and bump the version number to 1.1.0. Compatibility with the old API is kept, application can still be compiled against the private header and will not break. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] uvcvideo: Add support for V4L2_PIX_FMT_RGB565Laurent Pinchart
The TomTom navigation system used in the Sony XNV 660BT and 770BT reports an RGB565 (RGBP) format, support it in the driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] uvcvideo: Rename UVC_CONTROL_* flags to UVC_CTRL_FLAG_*Laurent Pinchart
This makes the public driver API more uniform, in preparation of moving uvcvideo.h to include/linux. Keep the old names for backward compatibility with existing applications. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] uvcvideo: Add UVCIOC_CTRL_QUERY ioctlMartin Rubli
This ioctl extends UVCIOC_CTRL_GET/SET by not only allowing to get/set XU controls but to also send arbitrary UVC commands to XU controls, namely GET_CUR, SET_CUR, GET_MIN, GET_MAX, GET_RES, GET_LEN, GET_INFO and GET_DEF. This is required for applications to work with XU controls, so that they can properly query the size and allocate the necessary buffers. Signed-off-by: Martin Rubli <martin_rubli@logitech.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-01[media] uvcvideo: Lock stream mutex when accessing format-related informationLaurent Pinchart
The stream mutex protects access to the struct uvc_streaming ctrl, cur_format and cur_frame fields as well as to the hardware probe control. Lock it appropriately. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-01[media] uvcvideo: Move mmap() handler to uvc_queue.cLaurent Pinchart
The mmap() implementation belongs to the video buffers queue, move it there. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-01[media] uvcvideo: Lock controls mutex when querying menusLaurent Pinchart
uvc_find_control() must be called with the controls mutex locked. Fix uvc_query_v4l2_menu() accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21[media] uvcvideo: Fix uvc_query_v4l2_ctrl() and uvc_xu_ctrl_query() lockingLaurent Pinchart
Take the ctrl_mutex mutex before touching control information in those functions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21[media] uvcvideo: Embed uvc_control_info inside struct uvc_controlLaurent Pinchart
Now that control information structures are not shared between control instances, embed a uvc_control_info instance inside the uvc_control structure instead of storing a pointer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21[media] uvcvideo: Remove sysadmin requirements for UVCIOC_CTRL_MAPMartin Rubli
This patch removes the sysadmin requirements for UVCIOC_CTRL_MAP (and the stub implementation of UVCIOC_CTRL_ADD). This requirement no longer makes sense with the new XU control access mechanisms since XU controls can be accessed without adding control mappings first. A maximum number (currently 1024) of control mappings per device is enforced to avoid excess memory consumption caused by careless user space applications. Signed-off-by: Martin Rubli <martin_rubli@logitech.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21[media] uvcvideo: Hardcode the index/selector relationship for XU controlsLaurent Pinchart
Devices advertise XU controls using a bitmask, in which each bit corresponds to a control. The control selector, used to query the control, isn't available in the USB descriptors. All known UVC devices use control selectors equal to the control bit index plus one. Hardcode that relationship in the driver, making the UVCIOC_CTRL_ADD ioctl obsolete. All necessary information about XU controls can be obtained by the driver at enumeration time. The UVCIOC_CTRL_ADD ioctl is still supported for compatibility reasons, but now always returns -EEXIST. Finally, control mappings are now on a per-device basis and no longer global. As this changes the userspace interface, bump the driver version number to 1.0.0 (it was about time). Signed-off-by: Martin Rubli <martin_rubli@logitech.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21[media] uvcvideo: Generate discontinuous sequence numbers when frames are lostLaurent Pinchart
Increase the sequence number of the v4l2_buffer structure regardless of any buffer states, so that discontinuous sequence numbers allow applications to detect lost video frames. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-09-27V4L/DVB: uvcvideo: Restrict frame rates for Chicony CNF7129 webcamLaurent Pinchart
At all frame rates except 30fps and 5fps the camera produces very dark pictures. Auto-exposure is probably disabled by the camera at all frame rates except 30fps, making them pretty unusable. Work around the problem by introducing a new RESTRICT_FRAME_RATE quirk that disables all the frame rates except the default one. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: uvcvideo: Drop corrupted compressed framesLaurent Pinchart
Corrupted video frames are dropped by default by the driver for uncompressed formats. Data corruption is not less problematic for compressed formats, so frame drop should be enabled by default for those formats as well. Mark buffers as faulty when an isochronous packet loss is detected for any format, or when the buffer length doesn't match the image size for uncompressed formats. Drop erroneous buffers regardless of whether the format is compressed or uncompressed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: uvc: Move constants and structures definitions to linux/usb/video.hLaurent Pinchart
The UVC host and gadget drivers both define constants and structures in private header files. Move all those definitions to linux/usb/video.h where they can be shared by the two drivers (and be available for userspace applications). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: uvcvideo: Don't use stack-based buffers for USB transfersLaurent Pinchart
Data buffers on the stack are not allowed for USB I/O. Use dynamically allocated buffers instead when querying control length and control capabilities. The control capabilities are now also stored in the uvc_control structure. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: uvcvideo: Support menu controls in the control mapping APILaurent Pinchart
The UVCIOC_CTRL_MAP ioctl doesn't support menu entries for menu controls. As the uvc_xu_control_mapping structure has no reserved fields, this can't be fixed while keeping ABI compatibility. Modify the UVCIOC_CTRL_MAP ioctl to add menu entries support, and define UVCIOC_CTRL_MAP_OLD that supports the old ABI without any ability to add menu controls. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: uvcvideo: Add support for V4L2_PIX_FMT_Y16Laurent Pinchart
The Miricle 307K (17dc:0202) camera reports a 16-bit greyscale format, support it in the driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB: uvcvideo: Cache control min, max, res and def query resultsLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB: uvcvideo: Use %pUl printk format specifier to print GUIDsLaurent Pinchart
Replace the UVC_GUID_FORMAT and UVC_GUID_ARGS macros with the new %pUl printk format specifier. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB: uvcvideo: Increase the streaming control timeout to 5 secondsLaurent Pinchart
This fixes timeout issues with some Logitech webcams. The timeout value seems to match the one used in the Logitech Windows driver, so no further increase should be necessary. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13830): uvcvideo: add another YUYV format GUID for iSight camerasDaniel Ritz
For some unknown reason, on a MacBookPro5,3 the iSight sometimes report a different video format GUID. This patch add the other (wrong) GUID to the format table, making the iSight work always w/o other problems. What it should report: 32595559-0000-0010-8000-00aa00389b71 What it often reports: 32595559-0000-0010-8000-000000389b71 Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13827): uvcvideo: Switch to a monotonic clock for V4L2 buffers ↵Laurent Pinchart
timestamps The realtime clock provided by do_gettimeofday() is affected by time jumps caused by NTP or DST. Furthermore, preliminary investigation showed that SMP systems the realtime clock is based on the CPU TSC, and those could get slightly out of sync, resulting in jitter in the timestamps depending on which processor handles the USB interrupts. Instead of the realtime clock, use a monotonic high resolution clock to timestamp the buffer. As this could in theory introduce a regression with some userspace applications expecting a realtime clock timestamp, add a module parameter to switch back to the realtime clock. Thanks to Paulo Assis for pointing out and investigating the issue. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-01-17V4L/DVB (13831): uvcvideo: Fix oops caused by a race condition in buffer ↵Laurent Pinchart
dequeuing Buffers were marked as done before being removed from the IRQ queue. If a userspace application dequeued and requeued the buffer fast enough during that time window, the buffer could end up being deleted twice, generating an oops in interrupt context. Add a new state, UVC_BUF_STATE_READY, to mark buffers as ready for reuse but not yet removed from the queue, and transition to UVC_BUF_STATE_DONE only when the buffer is removed from the queue. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13506): uvcvideo: Factorize common field in uvc_entity structureLaurent Pinchart
The bNrInPins and baSourceID fields are common among all entities (some of use bSourceID but this is conceptually the same). Move those two fields out of entity type-specific unions into the uvc_entity structure top level. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13503): uvcvideo: Merge iterms, oterms and units linked listsLaurent Pinchart
All terminals and units are now added to a single linked list of entities per chain. This makes terminals and units handling code more generic. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13155): uvcvideo: Add a module parameter to set the streaming ↵Laurent Pinchart
control timeout The default streaming control timeout was found by Ondrej Zary to be too low for some Logitech webcams. With kernel 2.6.22 and newer they would timeout during initialization unles the audio function was initialized before the video function. Add a module parameter to set the streaming control timeout and increase the default value from 1000ms to 3000ms to fix the above problem. Thanks to Ondrej Zary for investigating the issue and providing an initial patch. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>