#include <linux/bits.h>
#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/videodev2.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/wait.h>
#include <linux/atomic.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include "uvcvideo.h"
static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
struct uvc_control_mapping *map,
const struct uvc_xu_control_mapping *xmap)
{ … }
static int uvc_ioctl_xu_ctrl_map(struct uvc_video_chain *chain,
struct uvc_xu_control_mapping *xmap)
{ … }
static u32 uvc_try_frame_interval(const struct uvc_frame *frame, u32 interval)
{ … }
static u32 uvc_v4l2_get_bytesperline(const struct uvc_format *format,
const struct uvc_frame *frame)
{ … }
static int uvc_v4l2_try_format(struct uvc_streaming *stream,
struct v4l2_format *fmt, struct uvc_streaming_control *probe,
const struct uvc_format **uvc_format,
const struct uvc_frame **uvc_frame)
{ … }
static int uvc_v4l2_get_format(struct uvc_streaming *stream,
struct v4l2_format *fmt)
{ … }
static int uvc_v4l2_set_format(struct uvc_streaming *stream,
struct v4l2_format *fmt)
{ … }
static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream,
struct v4l2_streamparm *parm)
{ … }
static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
struct v4l2_streamparm *parm)
{ … }
static int uvc_acquire_privileges(struct uvc_fh *handle)
{ … }
static void uvc_dismiss_privileges(struct uvc_fh *handle)
{ … }
static int uvc_has_privileges(struct uvc_fh *handle)
{ … }
static int uvc_v4l2_open(struct file *file)
{ … }
static int uvc_v4l2_release(struct file *file)
{ … }
static int uvc_ioctl_querycap(struct file *file, void *fh,
struct v4l2_capability *cap)
{ … }
static int uvc_ioctl_enum_fmt(struct uvc_streaming *stream,
struct v4l2_fmtdesc *fmt)
{ … }
static int uvc_ioctl_enum_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_fmtdesc *fmt)
{ … }
static int uvc_ioctl_enum_fmt_vid_out(struct file *file, void *fh,
struct v4l2_fmtdesc *fmt)
{ … }
static int uvc_ioctl_g_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *fmt)
{ … }
static int uvc_ioctl_g_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *fmt)
{ … }
static int uvc_ioctl_s_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *fmt)
{ … }
static int uvc_ioctl_s_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *fmt)
{ … }
static int uvc_ioctl_try_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *fmt)
{ … }
static int uvc_ioctl_try_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *fmt)
{ … }
static int uvc_ioctl_reqbufs(struct file *file, void *fh,
struct v4l2_requestbuffers *rb)
{ … }
static int uvc_ioctl_querybuf(struct file *file, void *fh,
struct v4l2_buffer *buf)
{ … }
static int uvc_ioctl_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
{ … }
static int uvc_ioctl_expbuf(struct file *file, void *fh,
struct v4l2_exportbuffer *exp)
{ … }
static int uvc_ioctl_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
{ … }
static int uvc_ioctl_create_bufs(struct file *file, void *fh,
struct v4l2_create_buffers *cb)
{ … }
static int uvc_ioctl_streamon(struct file *file, void *fh,
enum v4l2_buf_type type)
{ … }
static int uvc_ioctl_streamoff(struct file *file, void *fh,
enum v4l2_buf_type type)
{ … }
static int uvc_ioctl_enum_input(struct file *file, void *fh,
struct v4l2_input *input)
{ … }
static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *input)
{ … }
static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input)
{ … }
static int uvc_ioctl_queryctrl(struct file *file, void *fh,
struct v4l2_queryctrl *qc)
{ … }
static int uvc_ioctl_query_ext_ctrl(struct file *file, void *fh,
struct v4l2_query_ext_ctrl *qec)
{ … }
static int uvc_ctrl_check_access(struct uvc_video_chain *chain,
struct v4l2_ext_controls *ctrls,
unsigned long ioctl)
{ … }
static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh,
struct v4l2_ext_controls *ctrls)
{ … }
static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
struct v4l2_ext_controls *ctrls,
unsigned long ioctl)
{ … }
static int uvc_ioctl_s_ext_ctrls(struct file *file, void *fh,
struct v4l2_ext_controls *ctrls)
{ … }
static int uvc_ioctl_try_ext_ctrls(struct file *file, void *fh,
struct v4l2_ext_controls *ctrls)
{ … }
static int uvc_ioctl_querymenu(struct file *file, void *fh,
struct v4l2_querymenu *qm)
{ … }
static int uvc_ioctl_g_selection(struct file *file, void *fh,
struct v4l2_selection *sel)
{ … }
static int uvc_ioctl_g_parm(struct file *file, void *fh,
struct v4l2_streamparm *parm)
{ … }
static int uvc_ioctl_s_parm(struct file *file, void *fh,
struct v4l2_streamparm *parm)
{ … }
static int uvc_ioctl_enum_framesizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *fsize)
{ … }
static int uvc_ioctl_enum_frameintervals(struct file *file, void *fh,
struct v4l2_frmivalenum *fival)
{ … }
static int uvc_ioctl_subscribe_event(struct v4l2_fh *fh,
const struct v4l2_event_subscription *sub)
{ … }
static long uvc_ioctl_default(struct file *file, void *fh, bool valid_prio,
unsigned int cmd, void *arg)
{ … }
#ifdef CONFIG_COMPAT
struct uvc_xu_control_mapping32 { … };
static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp,
const struct uvc_xu_control_mapping32 __user *up)
{ … }
static int uvc_v4l2_put_xu_mapping(const struct uvc_xu_control_mapping *kp,
struct uvc_xu_control_mapping32 __user *up)
{ … }
struct uvc_xu_control_query32 { … };
static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp,
const struct uvc_xu_control_query32 __user *up)
{ … }
static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,
struct uvc_xu_control_query32 __user *up)
{ … }
#define UVCIOC_CTRL_MAP32 …
#define UVCIOC_CTRL_QUERY32 …
static long uvc_v4l2_compat_ioctl32(struct file *file,
unsigned int cmd, unsigned long arg)
{ … }
#endif
static ssize_t uvc_v4l2_read(struct file *file, char __user *data,
size_t count, loff_t *ppos)
{ … }
static int uvc_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
{ … }
static __poll_t uvc_v4l2_poll(struct file *file, poll_table *wait)
{ … }
#ifndef CONFIG_MMU
static unsigned long uvc_v4l2_get_unmapped_area(struct file *file,
unsigned long addr, unsigned long len, unsigned long pgoff,
unsigned long flags)
{
struct uvc_fh *handle = file->private_data;
struct uvc_streaming *stream = handle->stream;
uvc_dbg(stream->dev, CALLS, "%s\n", __func__);
return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
}
#endif
const struct v4l2_ioctl_ops uvc_ioctl_ops = …;
const struct v4l2_file_operations uvc_fops = …;