linux/drivers/media/usb/gspca/gspca.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Main USB camera driver
 *
 * Copyright (C) 2008-2011 Jean-François Moine <http://moinejf.free.fr>
 *
 * Camera button input handling by Márton Németh
 * Copyright (C) 2009-2010 Márton Németh <[email protected]>
 */

#define pr_fmt(fmt)

#define GSPCA_VERSION

#include <linux/init.h>
#include <linux/fs.h>
#include <linux/vmalloc.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/pagemap.h>
#include <linux/io.h>
#include <asm/page.h>
#include <linux/uaccess.h>
#include <linux/ktime.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-fh.h>
#include <media/v4l2-event.h>

#include "gspca.h"

#if IS_ENABLED(CONFIG_INPUT)
#include <linux/input.h>
#include <linux/usb/input.h>
#endif

/* global values */
#define DEF_NURBS
#if DEF_NURBS > MAX_NURBS
#error "DEF_NURBS too big"
#endif

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_VERSION();

int gspca_debug;
EXPORT_SYMBOL();

static void PDEBUG_MODE(struct gspca_dev *gspca_dev, int debug, char *txt,
			__u32 pixfmt, int w, int h)
{}

/* specific memory types - !! should be different from V4L2_MEMORY_xxx */
#define GSPCA_MEMORY_NO
#define GSPCA_MEMORY_READ

/*
 * Input and interrupt endpoint handling functions
 */
#if IS_ENABLED(CONFIG_INPUT)
static void int_irq(struct urb *urb)
{}

static int gspca_input_connect(struct gspca_dev *dev)
{}

static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev,
			  struct usb_endpoint_descriptor *ep)
{}

static void gspca_input_create_urb(struct gspca_dev *gspca_dev)
{}

static void gspca_input_destroy_urb(struct gspca_dev *gspca_dev)
{}
#else
static inline void gspca_input_destroy_urb(struct gspca_dev *gspca_dev)
{
}

static inline void gspca_input_create_urb(struct gspca_dev *gspca_dev)
{
}

static inline int gspca_input_connect(struct gspca_dev *dev)
{
	return 0;
}
#endif

/*
 * fill a video frame from an URB and resubmit
 */
static void fill_frame(struct gspca_dev *gspca_dev,
			struct urb *urb)
{}

/*
 * ISOC message interrupt from the USB device
 *
 * Analyse each packet and call the subdriver for copy to the frame buffer.
 */
static void isoc_irq(struct urb *urb)
{}

/*
 * bulk message interrupt from the USB device
 */
static void bulk_irq(struct urb *urb)
{}

/*
 * add data to the current frame
 *
 * This function is called by the subdrivers at interrupt level.
 *
 * To build a frame, these ones must add
 *	- one FIRST_PACKET
 *	- 0 or many INTER_PACKETs
 *	- one LAST_PACKET
 * DISCARD_PACKET invalidates the whole frame.
 */
void gspca_frame_add(struct gspca_dev *gspca_dev,
			enum gspca_packet_type packet_type,
			const u8 *data,
			int len)
{}
EXPORT_SYMBOL();

static void destroy_urbs(struct gspca_dev *gspca_dev)
{}

static int gspca_set_alt0(struct gspca_dev *gspca_dev)
{}

/*
 * look for an input transfer endpoint in an alternate setting.
 *
 * If xfer_ep is invalid, return the first valid ep found, otherwise
 * look for exactly the ep with address equal to xfer_ep.
 */
static struct usb_host_endpoint *alt_xfer(struct usb_host_interface *alt,
					  int xfer, int xfer_ep)
{}

/* compute the minimum bandwidth for the current transfer */
static u32 which_bandwidth(struct gspca_dev *gspca_dev)
{}

/* endpoint table */
#define MAX_ALT
struct ep_tb_s {};

/*
 * build the table of the endpoints
 * and compute the minimum bandwidth for the image transfer
 */
static int build_isoc_ep_tb(struct gspca_dev *gspca_dev,
			struct usb_interface *intf,
			struct ep_tb_s *ep_tb)
{}

/*
 * create the URBs for image transfer
 */
static int create_urbs(struct gspca_dev *gspca_dev,
			struct usb_host_endpoint *ep)
{}

/* Note: both the queue and the usb locks should be held when calling this */
static void gspca_stream_off(struct gspca_dev *gspca_dev)
{}

/*
 * start the USB transfer
 */
static int gspca_init_transfer(struct gspca_dev *gspca_dev)
{}

static void gspca_set_default_mode(struct gspca_dev *gspca_dev)
{}

static int wxh_to_mode(struct gspca_dev *gspca_dev,
			int width, int height, u32 pixelformat)
{}

static int wxh_to_nearest_mode(struct gspca_dev *gspca_dev,
			int width, int height, u32 pixelformat)
{}

/*
 * search a mode with the right pixel format
 */
static int gspca_get_mode(struct gspca_dev *gspca_dev,
			int mode,
			int pixfmt)
{}

#ifdef CONFIG_VIDEO_ADV_DEBUG
static int vidioc_g_chip_info(struct file *file, void *priv,
				struct v4l2_dbg_chip_info *chip)
{}

static int vidioc_g_register(struct file *file, void *priv,
		struct v4l2_dbg_register *reg)
{}

static int vidioc_s_register(struct file *file, void *priv,
		const struct v4l2_dbg_register *reg)
{}
#endif

static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
				struct v4l2_fmtdesc *fmtdesc)
{}

static int vidioc_g_fmt_vid_cap(struct file *file, void *_priv,
				struct v4l2_format *fmt)
{}

static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
			struct v4l2_format *fmt)
{}

static int vidioc_try_fmt_vid_cap(struct file *file, void *_priv,
				  struct v4l2_format *fmt)
{}

static int vidioc_s_fmt_vid_cap(struct file *file, void *_priv,
				struct v4l2_format *fmt)
{}

static int vidioc_enum_framesizes(struct file *file, void *priv,
				  struct v4l2_frmsizeenum *fsize)
{}

static int vidioc_enum_frameintervals(struct file *filp, void *priv,
				      struct v4l2_frmivalenum *fival)
{}

static void gspca_release(struct v4l2_device *v4l2_device)
{}

static int vidioc_querycap(struct file *file, void  *priv,
			   struct v4l2_capability *cap)
{}

static int vidioc_enum_input(struct file *file, void *priv,
				struct v4l2_input *input)
{}

static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
{}

static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
{}

static int vidioc_g_jpegcomp(struct file *file, void *priv,
			struct v4l2_jpegcompression *jpegcomp)
{}

static int vidioc_s_jpegcomp(struct file *file, void *priv,
			const struct v4l2_jpegcompression *jpegcomp)
{}

static int vidioc_g_parm(struct file *filp, void *priv,
			struct v4l2_streamparm *parm)
{}

static int vidioc_s_parm(struct file *filp, void *priv,
			struct v4l2_streamparm *parm)
{}

static int gspca_queue_setup(struct vb2_queue *vq,
			     unsigned int *nbuffers, unsigned int *nplanes,
			     unsigned int sizes[], struct device *alloc_devs[])
{}

static int gspca_buffer_prepare(struct vb2_buffer *vb)
{}

static void gspca_buffer_finish(struct vb2_buffer *vb)
{}

static void gspca_buffer_queue(struct vb2_buffer *vb)
{}

static void gspca_return_all_buffers(struct gspca_dev *gspca_dev,
				     enum vb2_buffer_state state)
{}

static int gspca_start_streaming(struct vb2_queue *vq, unsigned int count)
{}

static void gspca_stop_streaming(struct vb2_queue *vq)
{}

static const struct vb2_ops gspca_qops =;

static const struct v4l2_file_operations dev_fops =;

static const struct v4l2_ioctl_ops dev_ioctl_ops =;

static const struct video_device gspca_template =;

/*
 * probe and create a new gspca device
 *
 * This function must be called by the sub-driver when it is
 * called for probing a new device.
 */
int gspca_dev_probe2(struct usb_interface *intf,
		const struct usb_device_id *id,
		const struct sd_desc *sd_desc,
		int dev_size,
		struct module *module)
{}
EXPORT_SYMBOL();

/* same function as the previous one, but check the interface */
int gspca_dev_probe(struct usb_interface *intf,
		const struct usb_device_id *id,
		const struct sd_desc *sd_desc,
		int dev_size,
		struct module *module)
{}
EXPORT_SYMBOL();

/*
 * USB disconnection
 *
 * This function must be called by the sub-driver
 * when the device disconnects, after the specific resources are freed.
 */
void gspca_disconnect(struct usb_interface *intf)
{}
EXPORT_SYMBOL();

#ifdef CONFIG_PM
int gspca_suspend(struct usb_interface *intf, pm_message_t message)
{}
EXPORT_SYMBOL();

int gspca_resume(struct usb_interface *intf)
{}
EXPORT_SYMBOL();
#endif

/* -- module insert / remove -- */
static int __init gspca_init(void)
{}
static void __exit gspca_exit(void)
{}

module_init();
module_exit(gspca_exit);

module_param_named(debug, gspca_debug, int, 0644);
MODULE_PARM_DESC();