linux/drivers/media/usb/pwc/pwc-if.c

// SPDX-License-Identifier: GPL-2.0-or-later
/* Linux driver for Philips webcam
   USB and Video4Linux interface part.
   (C) 1999-2004 Nemosoft Unv.
   (C) 2004-2006 Luc Saillard ([email protected])
   (C) 2011 Hans de Goede <[email protected]>

   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
   driver and thus may have bugs that are not present in the original version.
   Please send bug reports and support requests to <[email protected]>.
   The decompression routines have been implemented by reverse-engineering the
   Nemosoft binary pwcx module. Caveat emptor.


*/

/*
   This code forms the interface between the USB layers and the Philips
   specific stuff. Some adanved stuff of the driver falls under an
   NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and
   is thus not distributed in source form. The binary pwcx.o module
   contains the code that falls under the NDA.

   In case you're wondering: 'pwc' stands for "Philips WebCam", but
   I really didn't want to type 'philips_web_cam' every time (I'm lazy as
   any Linux kernel hacker, but I don't like uncomprehensible abbreviations
   without explanation).

   Oh yes, convention: to disctinguish between all the various pointers to
   device-structures, I use these names for the pointer variables:
   udev: struct usb_device *
   vdev: struct video_device (member of pwc_dev)
   pdev: struct pwc_devive *
*/

/* Contributors:
   - Alvarado: adding whitebalance code
   - Alistar Moire: QuickCam 3000 Pro device/product ID
   - Tony Hoyle: Creative Labs Webcam 5 device/product ID
   - Mark Burazin: solving hang in VIDIOCSYNC when camera gets unplugged
   - Jk Fang: Sotec Afina Eye ID
   - Xavier Roche: QuickCam Pro 4000 ID
   - Jens Knudsen: QuickCam Zoom ID
   - J. Debert: QuickCam for Notebooks ID
   - Pham Thanh Nam: webcam snapshot button as an event input device
*/

#include <linux/errno.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/slab.h>
#ifdef CONFIG_USB_PWC_INPUT_EVDEV
#include <linux/usb/input.h>
#endif
#include <linux/vmalloc.h>
#include <asm/io.h>
#include <linux/kernel.h>		/* simple_strtol() */

#include "pwc.h"
#include "pwc-kiara.h"
#include "pwc-timon.h"
#include "pwc-dec23.h"
#include "pwc-dec1.h"

#define CREATE_TRACE_POINTS
#include <trace/events/pwc.h>

/* Function prototypes and driver templates */

/* hotplug device table support */
static const struct usb_device_id pwc_device_table [] =;
MODULE_DEVICE_TABLE(usb, pwc_device_table);

static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id *id);
static void usb_pwc_disconnect(struct usb_interface *intf);
static void pwc_isoc_cleanup(struct pwc_device *pdev);

static struct usb_driver pwc_driver =;

#define MAX_DEV_HINTS
#define MAX_ISOC_ERRORS

#ifdef CONFIG_USB_PWC_DEBUG
	int pwc_trace =;
#endif
static int power_save =;
static int leds[2] =;

/***/

static const struct v4l2_file_operations pwc_fops =;
static const struct video_device pwc_template =;

/***************************************************************************/
/* Private functions */

static void *pwc_alloc_urb_buffer(struct usb_device *dev,
				  size_t size, dma_addr_t *dma_handle)
{}

static void pwc_free_urb_buffer(struct usb_device *dev,
				size_t size,
				void *buffer,
				dma_addr_t dma_handle)
{}

static struct pwc_frame_buf *pwc_get_next_fill_buf(struct pwc_device *pdev)
{}

static void pwc_snapshot_button(struct pwc_device *pdev, int down)
{}

static void pwc_frame_complete(struct pwc_device *pdev)
{}

/* This gets called for the Isochronous pipe (video). This is done in
 * interrupt time, so it has to be fast, not crash, and not stall. Neat.
 */
static void pwc_isoc_handler(struct urb *urb)
{}

/* Both v4l2_lock and vb_queue_lock should be locked when calling this */
static int pwc_isoc_init(struct pwc_device *pdev)
{}

static void pwc_iso_stop(struct pwc_device *pdev)
{}

static void pwc_iso_free(struct pwc_device *pdev)
{}

/* Both v4l2_lock and vb_queue_lock should be locked when calling this */
static void pwc_isoc_cleanup(struct pwc_device *pdev)
{}

/* Must be called with vb_queue_lock hold */
static void pwc_cleanup_queued_bufs(struct pwc_device *pdev,
				    enum vb2_buffer_state state)
{}

#ifdef CONFIG_USB_PWC_DEBUG
static const char *pwc_sensor_type_to_string(unsigned int sensor_type)
{}
#endif

/***************************************************************************/
/* Video4Linux functions */

static void pwc_video_release(struct v4l2_device *v)
{}

/***************************************************************************/
/* Videobuf2 operations */

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

static int buffer_init(struct vb2_buffer *vb)
{}

static int buffer_prepare(struct vb2_buffer *vb)
{}

static void buffer_finish(struct vb2_buffer *vb)
{}

static void buffer_cleanup(struct vb2_buffer *vb)
{}

static void buffer_queue(struct vb2_buffer *vb)
{}

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

static void stop_streaming(struct vb2_queue *vq)
{}

static const struct vb2_ops pwc_vb_queue_ops =;

/***************************************************************************/
/* USB functions */

/* This function gets called when a new device is plugged in or the usb core
 * is loaded.
 */

static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id *id)
{}

/* The user yanked out the cable... */
static void usb_pwc_disconnect(struct usb_interface *intf)
{}


/*
 * Initialization code & module stuff
 */

static unsigned int leds_nargs;

#ifdef CONFIG_USB_PWC_DEBUG
module_param_named(trace, pwc_trace, int, 0644);
#endif
module_param(power_save, int, 0644);
module_param_array();

#ifdef CONFIG_USB_PWC_DEBUG
MODULE_PARM_DESC();
#endif
MODULE_PARM_DESC();
MODULE_PARM_DESC();

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

module_usb_driver();