// SPDX-License-Identifier: GPL-2.0-or-later /* * gspca ViCam subdriver * * Copyright (C) 2011 Hans de Goede <[email protected]> * * Based on the usbvideo vicam driver, which is: * * Copyright (c) 2002 Joe Burks ([email protected]), * Chris Cheney ([email protected]), * Pavel Machek ([email protected]), * John Tyner ([email protected]), * Monroe Williams ([email protected]) */ #define pr_fmt(fmt) … #define MODULE_NAME … #define HEADER_SIZE … #include <linux/workqueue.h> #include <linux/slab.h> #include <linux/firmware.h> #include <linux/ihex.h> #include "gspca.h" #define VICAM_FIRMWARE … MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_FIRMWARE(…); struct sd { … }; /* The vicam sensor has a resolution of 512 x 244, with I believe square pixels, but this is forced to a 4:3 ratio by optics. So it has non square pixels :( */ static struct v4l2_pix_format vicam_mode[] = …; static int vicam_control_msg(struct gspca_dev *gspca_dev, u8 request, u16 value, u16 index, u8 *data, u16 len) { … } static int vicam_set_camera_power(struct gspca_dev *gspca_dev, int state) { … } /* * request and read a block of data */ static int vicam_read_frame(struct gspca_dev *gspca_dev, u8 *data, int size) { … } /* * This function is called as a workqueue function and runs whenever the camera * is streaming data. Because it is a workqueue function it is allowed to sleep * so we can use synchronous USB calls. To avoid possible collisions with other * threads attempting to use gspca_dev->usb_buf we take the usb_lock when * performing USB operations using it. In practice we don't really need this * as the cameras controls are only written from the workqueue. */ static void vicam_dostream(struct work_struct *work) { … } /* This function is called at probe time just before sd_init */ static int sd_config(struct gspca_dev *gspca_dev, const struct usb_device_id *id) { … } /* this function is called at probe and resume time */ static int sd_init(struct gspca_dev *gspca_dev) { … } /* Set up for getting frames. */ static int sd_start(struct gspca_dev *gspca_dev) { … } /* called on streamoff with alt==0 and on disconnect */ /* the usb_lock is held at entry - restore on exit */ static void sd_stop0(struct gspca_dev *gspca_dev) { … } static int sd_init_controls(struct gspca_dev *gspca_dev) { … } /* Table of supported USB devices */ static const struct usb_device_id device_table[] = …; MODULE_DEVICE_TABLE(usb, device_table); /* sub-driver description */ static const struct sd_desc sd_desc = …; /* -- device connect -- */ static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id) { … } static struct usb_driver sd_driver = …; module_usb_driver(…) …;