// SPDX-License-Identifier: GPL-2.0-or-later /* * Fujifilm Finepix subdriver * * Copyright (C) 2008 Frank Zago */ #define pr_fmt(fmt) … #define MODULE_NAME … #include "gspca.h" MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; /* Default timeout, in ms */ #define FPIX_TIMEOUT … /* Maximum transfer size to use. The windows driver reads by chunks of * 0x2000 bytes, so do the same. Note: reading more seems to work * too. */ #define FPIX_MAX_TRANSFER … /* Structure to hold all of our device specific stuff */ struct usb_fpix { … }; /* Delay after which claim the next frame. If the delay is too small, * the camera will return old frames. On the 4800Z, 20ms is bad, 25ms * will fail every 4 or 5 frames, but 30ms is perfect. On the A210, * 30ms is bad while 35ms is perfect. */ #define NEXT_FRAME_DELAY … /* These cameras only support 320x200. */ static const struct v4l2_pix_format fpix_mode[1] = …; /* send a command to the webcam */ static int command(struct gspca_dev *gspca_dev, int order) /* 0: reset, 1: frame request */ { … } /* * 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 camera doesn't provide any controls. */ static void dostream(struct work_struct *work) { … } /* this function is called at probe time */ 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) { … } /* start the camera */ 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) { … } /* 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(…) …;