linux/drivers/usb/gadget/function/uvc_v4l2.c

// SPDX-License-Identifier: GPL-2.0+
/*
 *	uvc_v4l2.c  --  USB Video Class Gadget driver
 *
 *	Copyright (C) 2009-2010
 *	    Laurent Pinchart ([email protected])
 */

#include <linux/device.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/usb/g_uvc.h>
#include <linux/usb/uvc.h>
#include <linux/videodev2.h>
#include <linux/vmalloc.h>
#include <linux/wait.h>

#include <media/v4l2-dev.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>

#include "f_uvc.h"
#include "uvc.h"
#include "uvc_queue.h"
#include "uvc_video.h"
#include "uvc_v4l2.h"
#include "uvc_configfs.h"

static const struct uvc_format_desc *to_uvc_format(struct uvcg_format *uformat)
{}

static int uvc_v4l2_get_bytesperline(struct uvcg_format *uformat,
			      struct uvcg_frame *uframe)
{}

static int uvc_get_frame_size(struct uvcg_format *uformat,
		       struct uvcg_frame *uframe)
{}

static struct uvcg_format *find_format_by_index(struct uvc_device *uvc, int index)
{}

static struct uvcg_frame *find_frame_by_index(struct uvc_device *uvc,
				       struct uvcg_format *uformat,
				       int index)
{}

static struct uvcg_format *find_format_by_pix(struct uvc_device *uvc,
					      u32 pixelformat)
{}

static struct uvcg_frame *find_closest_frame_by_size(struct uvc_device *uvc,
					   struct uvcg_format *uformat,
					   u16 rw, u16 rh)
{}

/* --------------------------------------------------------------------------
 * Requests handling
 */

static int
uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data)
{}

/* --------------------------------------------------------------------------
 * V4L2 ioctls
 */

static int
uvc_v4l2_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
{}

static int
uvc_v4l2_get_format(struct file *file, void *fh, struct v4l2_format *fmt)
{}

static int
uvc_v4l2_try_format(struct file *file, void *fh, struct v4l2_format *fmt)
{}

static int
uvc_v4l2_set_format(struct file *file, void *fh, struct v4l2_format *fmt)
{}

static int
uvc_v4l2_enum_frameintervals(struct file *file, void *fh,
		struct v4l2_frmivalenum *fival)
{}

static int
uvc_v4l2_enum_framesizes(struct file *file, void *fh,
		struct v4l2_frmsizeenum *fsize)
{}

static int
uvc_v4l2_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *f)
{}

static int
uvc_v4l2_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *b)
{}

static int
uvc_v4l2_querybuf(struct file *file, void *fh, struct v4l2_buffer *b)
{}

static int
uvc_v4l2_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)
{}

static int
uvc_v4l2_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)
{}

static int
uvc_v4l2_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
{}

static int
uvc_v4l2_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
{}

static int
uvc_v4l2_subscribe_event(struct v4l2_fh *fh,
			 const struct v4l2_event_subscription *sub)
{}

static void uvc_v4l2_disable(struct uvc_device *uvc)
{}

static int
uvc_v4l2_unsubscribe_event(struct v4l2_fh *fh,
			   const struct v4l2_event_subscription *sub)
{}

static long
uvc_v4l2_ioctl_default(struct file *file, void *fh, bool valid_prio,
		       unsigned int cmd, void *arg)
{}

const struct v4l2_ioctl_ops uvc_v4l2_ioctl_ops =;

/* --------------------------------------------------------------------------
 * V4L2
 */

static int
uvc_v4l2_open(struct file *file)
{}

static int
uvc_v4l2_release(struct file *file)
{}

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 uvcg_v4l2_get_unmapped_area(struct file *file,
		unsigned long addr, unsigned long len, unsigned long pgoff,
		unsigned long flags)
{
	struct video_device *vdev = video_devdata(file);
	struct uvc_device *uvc = video_get_drvdata(vdev);

	return uvcg_queue_get_unmapped_area(&uvc->video.queue, pgoff);
}
#endif

const struct v4l2_file_operations uvc_v4l2_fops =;