18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * SQ905C subdriver 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2009 Theodore Kilgore 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/* 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * This driver uses work done in 118c2ecf20Sopenharmony_ci * libgphoto2/camlibs/digigr8, Copyright (C) Theodore Kilgore. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * This driver has also used as a base the sq905c driver 148c2ecf20Sopenharmony_ci * and may contain code fragments from it. 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define MODULE_NAME "sq905c" 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include <linux/workqueue.h> 228c2ecf20Sopenharmony_ci#include <linux/slab.h> 238c2ecf20Sopenharmony_ci#include "gspca.h" 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ciMODULE_AUTHOR("Theodore Kilgore <kilgota@auburn.edu>"); 268c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("GSPCA/SQ905C USB Camera Driver"); 278c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL"); 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* Default timeouts, in ms */ 308c2ecf20Sopenharmony_ci#define SQ905C_CMD_TIMEOUT 500 318c2ecf20Sopenharmony_ci#define SQ905C_DATA_TIMEOUT 1000 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* Maximum transfer size to use. */ 348c2ecf20Sopenharmony_ci#define SQ905C_MAX_TRANSFER 0x8000 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define FRAME_HEADER_LEN 0x50 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* Commands. These go in the "value" slot. */ 398c2ecf20Sopenharmony_ci#define SQ905C_CLEAR 0xa0 /* clear everything */ 408c2ecf20Sopenharmony_ci#define SQ905C_GET_ID 0x14f4 /* Read version number */ 418c2ecf20Sopenharmony_ci#define SQ905C_CAPTURE_LOW 0xa040 /* Starts capture at 160x120 */ 428c2ecf20Sopenharmony_ci#define SQ905C_CAPTURE_MED 0x1440 /* Starts capture at 320x240 */ 438c2ecf20Sopenharmony_ci#define SQ905C_CAPTURE_HI 0x2840 /* Starts capture at 320x240 */ 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* For capture, this must go in the "index" slot. */ 468c2ecf20Sopenharmony_ci#define SQ905C_CAPTURE_INDEX 0x110f 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* Structure to hold all of our device specific stuff */ 498c2ecf20Sopenharmony_cistruct sd { 508c2ecf20Sopenharmony_ci struct gspca_dev gspca_dev; /* !! must be the first item */ 518c2ecf20Sopenharmony_ci const struct v4l2_pix_format *cap_mode; 528c2ecf20Sopenharmony_ci /* Driver stuff */ 538c2ecf20Sopenharmony_ci struct work_struct work_struct; 548c2ecf20Sopenharmony_ci struct workqueue_struct *work_thread; 558c2ecf20Sopenharmony_ci}; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* 588c2ecf20Sopenharmony_ci * Most of these cameras will do 640x480 and 320x240. 160x120 works 598c2ecf20Sopenharmony_ci * in theory but gives very poor output. Therefore, not supported. 608c2ecf20Sopenharmony_ci * The 0x2770:0x9050 cameras have max resolution of 320x240. 618c2ecf20Sopenharmony_ci */ 628c2ecf20Sopenharmony_cistatic struct v4l2_pix_format sq905c_mode[] = { 638c2ecf20Sopenharmony_ci { 320, 240, V4L2_PIX_FMT_SQ905C, V4L2_FIELD_NONE, 648c2ecf20Sopenharmony_ci .bytesperline = 320, 658c2ecf20Sopenharmony_ci .sizeimage = 320 * 240, 668c2ecf20Sopenharmony_ci .colorspace = V4L2_COLORSPACE_SRGB, 678c2ecf20Sopenharmony_ci .priv = 0}, 688c2ecf20Sopenharmony_ci { 640, 480, V4L2_PIX_FMT_SQ905C, V4L2_FIELD_NONE, 698c2ecf20Sopenharmony_ci .bytesperline = 640, 708c2ecf20Sopenharmony_ci .sizeimage = 640 * 480, 718c2ecf20Sopenharmony_ci .colorspace = V4L2_COLORSPACE_SRGB, 728c2ecf20Sopenharmony_ci .priv = 0} 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci/* Send a command to the camera. */ 768c2ecf20Sopenharmony_cistatic int sq905c_command(struct gspca_dev *gspca_dev, u16 command, u16 index) 778c2ecf20Sopenharmony_ci{ 788c2ecf20Sopenharmony_ci int ret; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci ret = usb_control_msg(gspca_dev->dev, 818c2ecf20Sopenharmony_ci usb_sndctrlpipe(gspca_dev->dev, 0), 828c2ecf20Sopenharmony_ci USB_REQ_SYNCH_FRAME, /* request */ 838c2ecf20Sopenharmony_ci USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 848c2ecf20Sopenharmony_ci command, index, NULL, 0, 858c2ecf20Sopenharmony_ci SQ905C_CMD_TIMEOUT); 868c2ecf20Sopenharmony_ci if (ret < 0) { 878c2ecf20Sopenharmony_ci pr_err("%s: usb_control_msg failed (%d)\n", __func__, ret); 888c2ecf20Sopenharmony_ci return ret; 898c2ecf20Sopenharmony_ci } 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci return 0; 928c2ecf20Sopenharmony_ci} 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_cistatic int sq905c_read(struct gspca_dev *gspca_dev, u16 command, u16 index, 958c2ecf20Sopenharmony_ci int size) 968c2ecf20Sopenharmony_ci{ 978c2ecf20Sopenharmony_ci int ret; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci ret = usb_control_msg(gspca_dev->dev, 1008c2ecf20Sopenharmony_ci usb_rcvctrlpipe(gspca_dev->dev, 0), 1018c2ecf20Sopenharmony_ci USB_REQ_SYNCH_FRAME, /* request */ 1028c2ecf20Sopenharmony_ci USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 1038c2ecf20Sopenharmony_ci command, index, gspca_dev->usb_buf, size, 1048c2ecf20Sopenharmony_ci SQ905C_CMD_TIMEOUT); 1058c2ecf20Sopenharmony_ci if (ret < 0) { 1068c2ecf20Sopenharmony_ci pr_err("%s: usb_control_msg failed (%d)\n", __func__, ret); 1078c2ecf20Sopenharmony_ci return ret; 1088c2ecf20Sopenharmony_ci } 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci return 0; 1118c2ecf20Sopenharmony_ci} 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci/* 1148c2ecf20Sopenharmony_ci * This function is called as a workqueue function and runs whenever the camera 1158c2ecf20Sopenharmony_ci * is streaming data. Because it is a workqueue function it is allowed to sleep 1168c2ecf20Sopenharmony_ci * so we can use synchronous USB calls. To avoid possible collisions with other 1178c2ecf20Sopenharmony_ci * threads attempting to use gspca_dev->usb_buf we take the usb_lock when 1188c2ecf20Sopenharmony_ci * performing USB operations using it. In practice we don't really need this 1198c2ecf20Sopenharmony_ci * as the camera doesn't provide any controls. 1208c2ecf20Sopenharmony_ci */ 1218c2ecf20Sopenharmony_cistatic void sq905c_dostream(struct work_struct *work) 1228c2ecf20Sopenharmony_ci{ 1238c2ecf20Sopenharmony_ci struct sd *dev = container_of(work, struct sd, work_struct); 1248c2ecf20Sopenharmony_ci struct gspca_dev *gspca_dev = &dev->gspca_dev; 1258c2ecf20Sopenharmony_ci int bytes_left; /* bytes remaining in current frame. */ 1268c2ecf20Sopenharmony_ci int data_len; /* size to use for the next read. */ 1278c2ecf20Sopenharmony_ci int act_len; 1288c2ecf20Sopenharmony_ci int packet_type; 1298c2ecf20Sopenharmony_ci int ret; 1308c2ecf20Sopenharmony_ci u8 *buffer; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci buffer = kmalloc(SQ905C_MAX_TRANSFER, GFP_KERNEL); 1338c2ecf20Sopenharmony_ci if (!buffer) { 1348c2ecf20Sopenharmony_ci pr_err("Couldn't allocate USB buffer\n"); 1358c2ecf20Sopenharmony_ci goto quit_stream; 1368c2ecf20Sopenharmony_ci } 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci while (gspca_dev->present && gspca_dev->streaming) { 1398c2ecf20Sopenharmony_ci#ifdef CONFIG_PM 1408c2ecf20Sopenharmony_ci if (gspca_dev->frozen) 1418c2ecf20Sopenharmony_ci break; 1428c2ecf20Sopenharmony_ci#endif 1438c2ecf20Sopenharmony_ci /* Request the header, which tells the size to download */ 1448c2ecf20Sopenharmony_ci ret = usb_bulk_msg(gspca_dev->dev, 1458c2ecf20Sopenharmony_ci usb_rcvbulkpipe(gspca_dev->dev, 0x81), 1468c2ecf20Sopenharmony_ci buffer, FRAME_HEADER_LEN, &act_len, 1478c2ecf20Sopenharmony_ci SQ905C_DATA_TIMEOUT); 1488c2ecf20Sopenharmony_ci gspca_dbg(gspca_dev, D_STREAM, 1498c2ecf20Sopenharmony_ci "Got %d bytes out of %d for header\n", 1508c2ecf20Sopenharmony_ci act_len, FRAME_HEADER_LEN); 1518c2ecf20Sopenharmony_ci if (ret < 0 || act_len < FRAME_HEADER_LEN) 1528c2ecf20Sopenharmony_ci goto quit_stream; 1538c2ecf20Sopenharmony_ci /* size is read from 4 bytes starting 0x40, little endian */ 1548c2ecf20Sopenharmony_ci bytes_left = buffer[0x40]|(buffer[0x41]<<8)|(buffer[0x42]<<16) 1558c2ecf20Sopenharmony_ci |(buffer[0x43]<<24); 1568c2ecf20Sopenharmony_ci gspca_dbg(gspca_dev, D_STREAM, "bytes_left = 0x%x\n", 1578c2ecf20Sopenharmony_ci bytes_left); 1588c2ecf20Sopenharmony_ci /* We keep the header. It has other information, too. */ 1598c2ecf20Sopenharmony_ci packet_type = FIRST_PACKET; 1608c2ecf20Sopenharmony_ci gspca_frame_add(gspca_dev, packet_type, 1618c2ecf20Sopenharmony_ci buffer, FRAME_HEADER_LEN); 1628c2ecf20Sopenharmony_ci while (bytes_left > 0 && gspca_dev->present) { 1638c2ecf20Sopenharmony_ci data_len = bytes_left > SQ905C_MAX_TRANSFER ? 1648c2ecf20Sopenharmony_ci SQ905C_MAX_TRANSFER : bytes_left; 1658c2ecf20Sopenharmony_ci ret = usb_bulk_msg(gspca_dev->dev, 1668c2ecf20Sopenharmony_ci usb_rcvbulkpipe(gspca_dev->dev, 0x81), 1678c2ecf20Sopenharmony_ci buffer, data_len, &act_len, 1688c2ecf20Sopenharmony_ci SQ905C_DATA_TIMEOUT); 1698c2ecf20Sopenharmony_ci if (ret < 0 || act_len < data_len) 1708c2ecf20Sopenharmony_ci goto quit_stream; 1718c2ecf20Sopenharmony_ci gspca_dbg(gspca_dev, D_STREAM, 1728c2ecf20Sopenharmony_ci "Got %d bytes out of %d for frame\n", 1738c2ecf20Sopenharmony_ci data_len, bytes_left); 1748c2ecf20Sopenharmony_ci bytes_left -= data_len; 1758c2ecf20Sopenharmony_ci if (bytes_left == 0) 1768c2ecf20Sopenharmony_ci packet_type = LAST_PACKET; 1778c2ecf20Sopenharmony_ci else 1788c2ecf20Sopenharmony_ci packet_type = INTER_PACKET; 1798c2ecf20Sopenharmony_ci gspca_frame_add(gspca_dev, packet_type, 1808c2ecf20Sopenharmony_ci buffer, data_len); 1818c2ecf20Sopenharmony_ci } 1828c2ecf20Sopenharmony_ci } 1838c2ecf20Sopenharmony_ciquit_stream: 1848c2ecf20Sopenharmony_ci if (gspca_dev->present) { 1858c2ecf20Sopenharmony_ci mutex_lock(&gspca_dev->usb_lock); 1868c2ecf20Sopenharmony_ci sq905c_command(gspca_dev, SQ905C_CLEAR, 0); 1878c2ecf20Sopenharmony_ci mutex_unlock(&gspca_dev->usb_lock); 1888c2ecf20Sopenharmony_ci } 1898c2ecf20Sopenharmony_ci kfree(buffer); 1908c2ecf20Sopenharmony_ci} 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci/* This function is called at probe time just before sd_init */ 1938c2ecf20Sopenharmony_cistatic int sd_config(struct gspca_dev *gspca_dev, 1948c2ecf20Sopenharmony_ci const struct usb_device_id *id) 1958c2ecf20Sopenharmony_ci{ 1968c2ecf20Sopenharmony_ci struct cam *cam = &gspca_dev->cam; 1978c2ecf20Sopenharmony_ci struct sd *dev = (struct sd *) gspca_dev; 1988c2ecf20Sopenharmony_ci int ret; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci gspca_dbg(gspca_dev, D_PROBE, 2018c2ecf20Sopenharmony_ci "SQ9050 camera detected (vid/pid 0x%04X:0x%04X)\n", 2028c2ecf20Sopenharmony_ci id->idVendor, id->idProduct); 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci ret = sq905c_command(gspca_dev, SQ905C_GET_ID, 0); 2058c2ecf20Sopenharmony_ci if (ret < 0) { 2068c2ecf20Sopenharmony_ci gspca_err(gspca_dev, "Get version command failed\n"); 2078c2ecf20Sopenharmony_ci return ret; 2088c2ecf20Sopenharmony_ci } 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci ret = sq905c_read(gspca_dev, 0xf5, 0, 20); 2118c2ecf20Sopenharmony_ci if (ret < 0) { 2128c2ecf20Sopenharmony_ci gspca_err(gspca_dev, "Reading version command failed\n"); 2138c2ecf20Sopenharmony_ci return ret; 2148c2ecf20Sopenharmony_ci } 2158c2ecf20Sopenharmony_ci /* Note we leave out the usb id and the manufacturing date */ 2168c2ecf20Sopenharmony_ci gspca_dbg(gspca_dev, D_PROBE, 2178c2ecf20Sopenharmony_ci "SQ9050 ID string: %02x - %*ph\n", 2188c2ecf20Sopenharmony_ci gspca_dev->usb_buf[3], 6, gspca_dev->usb_buf + 14); 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci cam->cam_mode = sq905c_mode; 2218c2ecf20Sopenharmony_ci cam->nmodes = 2; 2228c2ecf20Sopenharmony_ci if (gspca_dev->usb_buf[15] == 0) 2238c2ecf20Sopenharmony_ci cam->nmodes = 1; 2248c2ecf20Sopenharmony_ci /* We don't use the buffer gspca allocates so make it small. */ 2258c2ecf20Sopenharmony_ci cam->bulk_size = 32; 2268c2ecf20Sopenharmony_ci cam->bulk = 1; 2278c2ecf20Sopenharmony_ci INIT_WORK(&dev->work_struct, sq905c_dostream); 2288c2ecf20Sopenharmony_ci return 0; 2298c2ecf20Sopenharmony_ci} 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci/* called on streamoff with alt==0 and on disconnect */ 2328c2ecf20Sopenharmony_ci/* the usb_lock is held at entry - restore on exit */ 2338c2ecf20Sopenharmony_cistatic void sd_stop0(struct gspca_dev *gspca_dev) 2348c2ecf20Sopenharmony_ci{ 2358c2ecf20Sopenharmony_ci struct sd *dev = (struct sd *) gspca_dev; 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci /* wait for the work queue to terminate */ 2388c2ecf20Sopenharmony_ci mutex_unlock(&gspca_dev->usb_lock); 2398c2ecf20Sopenharmony_ci /* This waits for sq905c_dostream to finish */ 2408c2ecf20Sopenharmony_ci destroy_workqueue(dev->work_thread); 2418c2ecf20Sopenharmony_ci dev->work_thread = NULL; 2428c2ecf20Sopenharmony_ci mutex_lock(&gspca_dev->usb_lock); 2438c2ecf20Sopenharmony_ci} 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci/* this function is called at probe and resume time */ 2468c2ecf20Sopenharmony_cistatic int sd_init(struct gspca_dev *gspca_dev) 2478c2ecf20Sopenharmony_ci{ 2488c2ecf20Sopenharmony_ci /* connect to the camera and reset it. */ 2498c2ecf20Sopenharmony_ci return sq905c_command(gspca_dev, SQ905C_CLEAR, 0); 2508c2ecf20Sopenharmony_ci} 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci/* Set up for getting frames. */ 2538c2ecf20Sopenharmony_cistatic int sd_start(struct gspca_dev *gspca_dev) 2548c2ecf20Sopenharmony_ci{ 2558c2ecf20Sopenharmony_ci struct sd *dev = (struct sd *) gspca_dev; 2568c2ecf20Sopenharmony_ci int ret; 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci dev->cap_mode = gspca_dev->cam.cam_mode; 2598c2ecf20Sopenharmony_ci /* "Open the shutter" and set size, to start capture */ 2608c2ecf20Sopenharmony_ci switch (gspca_dev->pixfmt.width) { 2618c2ecf20Sopenharmony_ci case 640: 2628c2ecf20Sopenharmony_ci gspca_dbg(gspca_dev, D_STREAM, "Start streaming at high resolution\n"); 2638c2ecf20Sopenharmony_ci dev->cap_mode++; 2648c2ecf20Sopenharmony_ci ret = sq905c_command(gspca_dev, SQ905C_CAPTURE_HI, 2658c2ecf20Sopenharmony_ci SQ905C_CAPTURE_INDEX); 2668c2ecf20Sopenharmony_ci break; 2678c2ecf20Sopenharmony_ci default: /* 320 */ 2688c2ecf20Sopenharmony_ci gspca_dbg(gspca_dev, D_STREAM, "Start streaming at medium resolution\n"); 2698c2ecf20Sopenharmony_ci ret = sq905c_command(gspca_dev, SQ905C_CAPTURE_MED, 2708c2ecf20Sopenharmony_ci SQ905C_CAPTURE_INDEX); 2718c2ecf20Sopenharmony_ci } 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci if (ret < 0) { 2748c2ecf20Sopenharmony_ci gspca_err(gspca_dev, "Start streaming command failed\n"); 2758c2ecf20Sopenharmony_ci return ret; 2768c2ecf20Sopenharmony_ci } 2778c2ecf20Sopenharmony_ci /* Start the workqueue function to do the streaming */ 2788c2ecf20Sopenharmony_ci dev->work_thread = create_singlethread_workqueue(MODULE_NAME); 2798c2ecf20Sopenharmony_ci if (!dev->work_thread) 2808c2ecf20Sopenharmony_ci return -ENOMEM; 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci queue_work(dev->work_thread, &dev->work_struct); 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci return 0; 2858c2ecf20Sopenharmony_ci} 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci/* Table of supported USB devices */ 2888c2ecf20Sopenharmony_cistatic const struct usb_device_id device_table[] = { 2898c2ecf20Sopenharmony_ci {USB_DEVICE(0x2770, 0x905c)}, 2908c2ecf20Sopenharmony_ci {USB_DEVICE(0x2770, 0x9050)}, 2918c2ecf20Sopenharmony_ci {USB_DEVICE(0x2770, 0x9051)}, 2928c2ecf20Sopenharmony_ci {USB_DEVICE(0x2770, 0x9052)}, 2938c2ecf20Sopenharmony_ci {USB_DEVICE(0x2770, 0x913d)}, 2948c2ecf20Sopenharmony_ci {} 2958c2ecf20Sopenharmony_ci}; 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(usb, device_table); 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* sub-driver description */ 3008c2ecf20Sopenharmony_cistatic const struct sd_desc sd_desc = { 3018c2ecf20Sopenharmony_ci .name = MODULE_NAME, 3028c2ecf20Sopenharmony_ci .config = sd_config, 3038c2ecf20Sopenharmony_ci .init = sd_init, 3048c2ecf20Sopenharmony_ci .start = sd_start, 3058c2ecf20Sopenharmony_ci .stop0 = sd_stop0, 3068c2ecf20Sopenharmony_ci}; 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci/* -- device connect -- */ 3098c2ecf20Sopenharmony_cistatic int sd_probe(struct usb_interface *intf, 3108c2ecf20Sopenharmony_ci const struct usb_device_id *id) 3118c2ecf20Sopenharmony_ci{ 3128c2ecf20Sopenharmony_ci return gspca_dev_probe(intf, id, 3138c2ecf20Sopenharmony_ci &sd_desc, 3148c2ecf20Sopenharmony_ci sizeof(struct sd), 3158c2ecf20Sopenharmony_ci THIS_MODULE); 3168c2ecf20Sopenharmony_ci} 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cistatic struct usb_driver sd_driver = { 3198c2ecf20Sopenharmony_ci .name = MODULE_NAME, 3208c2ecf20Sopenharmony_ci .id_table = device_table, 3218c2ecf20Sopenharmony_ci .probe = sd_probe, 3228c2ecf20Sopenharmony_ci .disconnect = gspca_disconnect, 3238c2ecf20Sopenharmony_ci#ifdef CONFIG_PM 3248c2ecf20Sopenharmony_ci .suspend = gspca_suspend, 3258c2ecf20Sopenharmony_ci .resume = gspca_resume, 3268c2ecf20Sopenharmony_ci .reset_resume = gspca_resume, 3278c2ecf20Sopenharmony_ci#endif 3288c2ecf20Sopenharmony_ci}; 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_cimodule_usb_driver(sd_driver); 331