konica.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. /*
  2. * Driver for USB webcams based on Konica chipset. This
  3. * chipset is used in Intel YC76 camera.
  4. *
  5. * Copyright (C) 2010 Hans de Goede <hdegoede@redhat.com>
  6. *
  7. * Based on the usbvideo v4l1 konicawc driver which is:
  8. *
  9. * Copyright (C) 2002 Simon Evans <spse@secret.org.uk>
  10. *
  11. * The code for making gspca work with a webcam with 2 isoc endpoints was
  12. * taken from the benq gspca subdriver which is:
  13. *
  14. * Copyright (C) 2009 Jean-Francois Moine (http://moinejf.free.fr)
  15. *
  16. * This program is free software; you can redistribute it and/or modify
  17. * it under the terms of the GNU General Public License as published by
  18. * the Free Software Foundation; either version 2 of the License, or
  19. * any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29. */
  30. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  31. #define MODULE_NAME "konica"
  32. #include <linux/input.h>
  33. #include "gspca.h"
  34. MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
  35. MODULE_DESCRIPTION("Konica chipset USB Camera Driver");
  36. MODULE_LICENSE("GPL");
  37. #define WHITEBAL_REG 0x01
  38. #define BRIGHTNESS_REG 0x02
  39. #define SHARPNESS_REG 0x03
  40. #define CONTRAST_REG 0x04
  41. #define SATURATION_REG 0x05
  42. /* specific webcam descriptor */
  43. struct sd {
  44. struct gspca_dev gspca_dev; /* !! must be the first item */
  45. struct urb *last_data_urb;
  46. u8 snapshot_pressed;
  47. u8 brightness;
  48. u8 contrast;
  49. u8 saturation;
  50. u8 whitebal;
  51. u8 sharpness;
  52. };
  53. /* V4L2 controls supported by the driver */
  54. static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
  55. static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
  56. static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
  57. static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
  58. static int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val);
  59. static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val);
  60. static int sd_setwhitebal(struct gspca_dev *gspca_dev, __s32 val);
  61. static int sd_getwhitebal(struct gspca_dev *gspca_dev, __s32 *val);
  62. static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
  63. static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
  64. static const struct ctrl sd_ctrls[] = {
  65. #define SD_BRIGHTNESS 0
  66. {
  67. {
  68. .id = V4L2_CID_BRIGHTNESS,
  69. .type = V4L2_CTRL_TYPE_INTEGER,
  70. .name = "Brightness",
  71. .minimum = 0,
  72. .maximum = 9,
  73. .step = 1,
  74. #define BRIGHTNESS_DEFAULT 4
  75. .default_value = BRIGHTNESS_DEFAULT,
  76. .flags = 0,
  77. },
  78. .set = sd_setbrightness,
  79. .get = sd_getbrightness,
  80. },
  81. #define SD_CONTRAST 1
  82. {
  83. {
  84. .id = V4L2_CID_CONTRAST,
  85. .type = V4L2_CTRL_TYPE_INTEGER,
  86. .name = "Contrast",
  87. .minimum = 0,
  88. .maximum = 9,
  89. .step = 4,
  90. #define CONTRAST_DEFAULT 10
  91. .default_value = CONTRAST_DEFAULT,
  92. .flags = 0,
  93. },
  94. .set = sd_setcontrast,
  95. .get = sd_getcontrast,
  96. },
  97. #define SD_SATURATION 2
  98. {
  99. {
  100. .id = V4L2_CID_SATURATION,
  101. .type = V4L2_CTRL_TYPE_INTEGER,
  102. .name = "Saturation",
  103. .minimum = 0,
  104. .maximum = 9,
  105. .step = 1,
  106. #define SATURATION_DEFAULT 4
  107. .default_value = SATURATION_DEFAULT,
  108. .flags = 0,
  109. },
  110. .set = sd_setsaturation,
  111. .get = sd_getsaturation,
  112. },
  113. #define SD_WHITEBAL 3
  114. {
  115. {
  116. .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE,
  117. .type = V4L2_CTRL_TYPE_INTEGER,
  118. .name = "White Balance",
  119. .minimum = 0,
  120. .maximum = 33,
  121. .step = 1,
  122. #define WHITEBAL_DEFAULT 25
  123. .default_value = WHITEBAL_DEFAULT,
  124. .flags = 0,
  125. },
  126. .set = sd_setwhitebal,
  127. .get = sd_getwhitebal,
  128. },
  129. #define SD_SHARPNESS 4
  130. {
  131. {
  132. .id = V4L2_CID_SHARPNESS,
  133. .type = V4L2_CTRL_TYPE_INTEGER,
  134. .name = "Sharpness",
  135. .minimum = 0,
  136. .maximum = 9,
  137. .step = 1,
  138. #define SHARPNESS_DEFAULT 4
  139. .default_value = SHARPNESS_DEFAULT,
  140. .flags = 0,
  141. },
  142. .set = sd_setsharpness,
  143. .get = sd_getsharpness,
  144. },
  145. };
  146. /* .priv is what goes to register 8 for this mode, known working values:
  147. 0x00 -> 176x144, cropped
  148. 0x01 -> 176x144, cropped
  149. 0x02 -> 176x144, cropped
  150. 0x03 -> 176x144, cropped
  151. 0x04 -> 176x144, binned
  152. 0x05 -> 320x240
  153. 0x06 -> 320x240
  154. 0x07 -> 160x120, cropped
  155. 0x08 -> 160x120, cropped
  156. 0x09 -> 160x120, binned (note has 136 lines)
  157. 0x0a -> 160x120, binned (note has 136 lines)
  158. 0x0b -> 160x120, cropped
  159. */
  160. static const struct v4l2_pix_format vga_mode[] = {
  161. {160, 120, V4L2_PIX_FMT_KONICA420, V4L2_FIELD_NONE,
  162. .bytesperline = 160,
  163. .sizeimage = 160 * 136 * 3 / 2 + 960,
  164. .colorspace = V4L2_COLORSPACE_SRGB,
  165. .priv = 0x0a},
  166. {176, 144, V4L2_PIX_FMT_KONICA420, V4L2_FIELD_NONE,
  167. .bytesperline = 176,
  168. .sizeimage = 176 * 144 * 3 / 2 + 960,
  169. .colorspace = V4L2_COLORSPACE_SRGB,
  170. .priv = 0x04},
  171. {320, 240, V4L2_PIX_FMT_KONICA420, V4L2_FIELD_NONE,
  172. .bytesperline = 320,
  173. .sizeimage = 320 * 240 * 3 / 2 + 960,
  174. .colorspace = V4L2_COLORSPACE_SRGB,
  175. .priv = 0x05},
  176. };
  177. static void sd_isoc_irq(struct urb *urb);
  178. static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index)
  179. {
  180. struct usb_device *dev = gspca_dev->dev;
  181. int ret;
  182. if (gspca_dev->usb_err < 0)
  183. return;
  184. ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
  185. 0x02,
  186. USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  187. value,
  188. index,
  189. NULL,
  190. 0,
  191. 1000);
  192. if (ret < 0) {
  193. pr_err("reg_w err %d\n", ret);
  194. gspca_dev->usb_err = ret;
  195. }
  196. }
  197. static void reg_r(struct gspca_dev *gspca_dev, u16 value, u16 index)
  198. {
  199. struct usb_device *dev = gspca_dev->dev;
  200. int ret;
  201. if (gspca_dev->usb_err < 0)
  202. return;
  203. ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
  204. 0x03,
  205. USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  206. value,
  207. index,
  208. gspca_dev->usb_buf,
  209. 2,
  210. 1000);
  211. if (ret < 0) {
  212. pr_err("reg_w err %d\n", ret);
  213. gspca_dev->usb_err = ret;
  214. }
  215. }
  216. static void konica_stream_on(struct gspca_dev *gspca_dev)
  217. {
  218. reg_w(gspca_dev, 1, 0x0b);
  219. }
  220. static void konica_stream_off(struct gspca_dev *gspca_dev)
  221. {
  222. reg_w(gspca_dev, 0, 0x0b);
  223. }
  224. /* this function is called at probe time */
  225. static int sd_config(struct gspca_dev *gspca_dev,
  226. const struct usb_device_id *id)
  227. {
  228. struct sd *sd = (struct sd *) gspca_dev;
  229. gspca_dev->cam.cam_mode = vga_mode;
  230. gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode);
  231. gspca_dev->cam.no_urb_create = 1;
  232. /* The highest alt setting has an isoc packetsize of 0, so we
  233. don't want to use it */
  234. gspca_dev->nbalt--;
  235. sd->brightness = BRIGHTNESS_DEFAULT;
  236. sd->contrast = CONTRAST_DEFAULT;
  237. sd->saturation = SATURATION_DEFAULT;
  238. sd->whitebal = WHITEBAL_DEFAULT;
  239. sd->sharpness = SHARPNESS_DEFAULT;
  240. return 0;
  241. }
  242. /* this function is called at probe and resume time */
  243. static int sd_init(struct gspca_dev *gspca_dev)
  244. {
  245. /* HDG not sure if these 2 reads are needed */
  246. reg_r(gspca_dev, 0, 0x10);
  247. PDEBUG(D_PROBE, "Reg 0x10 reads: %02x %02x",
  248. gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]);
  249. reg_r(gspca_dev, 0, 0x10);
  250. PDEBUG(D_PROBE, "Reg 0x10 reads: %02x %02x",
  251. gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]);
  252. reg_w(gspca_dev, 0, 0x0d);
  253. return 0;
  254. }
  255. static int sd_start(struct gspca_dev *gspca_dev)
  256. {
  257. struct sd *sd = (struct sd *) gspca_dev;
  258. struct urb *urb;
  259. int i, n, packet_size;
  260. struct usb_host_interface *alt;
  261. struct usb_interface *intf;
  262. intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface);
  263. alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt);
  264. if (!alt) {
  265. pr_err("Couldn't get altsetting\n");
  266. return -EIO;
  267. }
  268. packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
  269. reg_w(gspca_dev, sd->brightness, BRIGHTNESS_REG);
  270. reg_w(gspca_dev, sd->whitebal, WHITEBAL_REG);
  271. reg_w(gspca_dev, sd->contrast, CONTRAST_REG);
  272. reg_w(gspca_dev, sd->saturation, SATURATION_REG);
  273. reg_w(gspca_dev, sd->sharpness, SHARPNESS_REG);
  274. n = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
  275. reg_w(gspca_dev, n, 0x08);
  276. konica_stream_on(gspca_dev);
  277. if (gspca_dev->usb_err)
  278. return gspca_dev->usb_err;
  279. /* create 4 URBs - 2 on endpoint 0x83 and 2 on 0x082 */
  280. #if MAX_NURBS < 4
  281. #error "Not enough URBs in the gspca table"
  282. #endif
  283. #define SD_NPKT 32
  284. for (n = 0; n < 4; n++) {
  285. i = n & 1 ? 0 : 1;
  286. packet_size =
  287. le16_to_cpu(alt->endpoint[i].desc.wMaxPacketSize);
  288. urb = usb_alloc_urb(SD_NPKT, GFP_KERNEL);
  289. if (!urb) {
  290. pr_err("usb_alloc_urb failed\n");
  291. return -ENOMEM;
  292. }
  293. gspca_dev->urb[n] = urb;
  294. urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev,
  295. packet_size * SD_NPKT,
  296. GFP_KERNEL,
  297. &urb->transfer_dma);
  298. if (urb->transfer_buffer == NULL) {
  299. pr_err("usb_buffer_alloc failed\n");
  300. return -ENOMEM;
  301. }
  302. urb->dev = gspca_dev->dev;
  303. urb->context = gspca_dev;
  304. urb->transfer_buffer_length = packet_size * SD_NPKT;
  305. urb->pipe = usb_rcvisocpipe(gspca_dev->dev,
  306. n & 1 ? 0x81 : 0x82);
  307. urb->transfer_flags = URB_ISO_ASAP
  308. | URB_NO_TRANSFER_DMA_MAP;
  309. urb->interval = 1;
  310. urb->complete = sd_isoc_irq;
  311. urb->number_of_packets = SD_NPKT;
  312. for (i = 0; i < SD_NPKT; i++) {
  313. urb->iso_frame_desc[i].length = packet_size;
  314. urb->iso_frame_desc[i].offset = packet_size * i;
  315. }
  316. }
  317. return 0;
  318. }
  319. static void sd_stopN(struct gspca_dev *gspca_dev)
  320. {
  321. struct sd *sd = (struct sd *) gspca_dev;
  322. konica_stream_off(gspca_dev);
  323. #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
  324. /* Don't keep the button in the pressed state "forever" if it was
  325. pressed when streaming is stopped */
  326. if (sd->snapshot_pressed) {
  327. input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
  328. input_sync(gspca_dev->input_dev);
  329. sd->snapshot_pressed = 0;
  330. }
  331. #endif
  332. }
  333. /* reception of an URB */
  334. static void sd_isoc_irq(struct urb *urb)
  335. {
  336. struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;
  337. struct sd *sd = (struct sd *) gspca_dev;
  338. struct urb *data_urb, *status_urb;
  339. u8 *data;
  340. int i, st;
  341. PDEBUG(D_PACK, "sd isoc irq");
  342. if (!gspca_dev->streaming)
  343. return;
  344. if (urb->status != 0) {
  345. if (urb->status == -ESHUTDOWN)
  346. return; /* disconnection */
  347. #ifdef CONFIG_PM
  348. if (gspca_dev->frozen)
  349. return;
  350. #endif
  351. PDEBUG(D_ERR, "urb status: %d", urb->status);
  352. st = usb_submit_urb(urb, GFP_ATOMIC);
  353. if (st < 0)
  354. pr_err("resubmit urb error %d\n", st);
  355. return;
  356. }
  357. /* if this is a data URB (ep 0x82), wait */
  358. if (urb->transfer_buffer_length > 32) {
  359. sd->last_data_urb = urb;
  360. return;
  361. }
  362. status_urb = urb;
  363. data_urb = sd->last_data_urb;
  364. sd->last_data_urb = NULL;
  365. if (!data_urb || data_urb->start_frame != status_urb->start_frame) {
  366. PDEBUG(D_ERR|D_PACK, "lost sync on frames");
  367. goto resubmit;
  368. }
  369. if (data_urb->number_of_packets != status_urb->number_of_packets) {
  370. PDEBUG(D_ERR|D_PACK,
  371. "no packets does not match, data: %d, status: %d",
  372. data_urb->number_of_packets,
  373. status_urb->number_of_packets);
  374. goto resubmit;
  375. }
  376. for (i = 0; i < status_urb->number_of_packets; i++) {
  377. if (data_urb->iso_frame_desc[i].status ||
  378. status_urb->iso_frame_desc[i].status) {
  379. PDEBUG(D_ERR|D_PACK,
  380. "pkt %d data-status %d, status-status %d", i,
  381. data_urb->iso_frame_desc[i].status,
  382. status_urb->iso_frame_desc[i].status);
  383. gspca_dev->last_packet_type = DISCARD_PACKET;
  384. continue;
  385. }
  386. if (status_urb->iso_frame_desc[i].actual_length != 1) {
  387. PDEBUG(D_ERR|D_PACK,
  388. "bad status packet length %d",
  389. status_urb->iso_frame_desc[i].actual_length);
  390. gspca_dev->last_packet_type = DISCARD_PACKET;
  391. continue;
  392. }
  393. st = *((u8 *)status_urb->transfer_buffer
  394. + status_urb->iso_frame_desc[i].offset);
  395. data = (u8 *)data_urb->transfer_buffer
  396. + data_urb->iso_frame_desc[i].offset;
  397. /* st: 0x80-0xff: frame start with frame number (ie 0-7f)
  398. * otherwise:
  399. * bit 0 0: keep packet
  400. * 1: drop packet (padding data)
  401. *
  402. * bit 4 0 button not clicked
  403. * 1 button clicked
  404. * button is used to `take a picture' (in software)
  405. */
  406. if (st & 0x80) {
  407. gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
  408. gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);
  409. } else {
  410. #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
  411. u8 button_state = st & 0x40 ? 1 : 0;
  412. if (sd->snapshot_pressed != button_state) {
  413. input_report_key(gspca_dev->input_dev,
  414. KEY_CAMERA,
  415. button_state);
  416. input_sync(gspca_dev->input_dev);
  417. sd->snapshot_pressed = button_state;
  418. }
  419. #endif
  420. if (st & 0x01)
  421. continue;
  422. }
  423. gspca_frame_add(gspca_dev, INTER_PACKET, data,
  424. data_urb->iso_frame_desc[i].actual_length);
  425. }
  426. resubmit:
  427. if (data_urb) {
  428. st = usb_submit_urb(data_urb, GFP_ATOMIC);
  429. if (st < 0)
  430. PDEBUG(D_ERR|D_PACK,
  431. "usb_submit_urb(data_urb) ret %d", st);
  432. }
  433. st = usb_submit_urb(status_urb, GFP_ATOMIC);
  434. if (st < 0)
  435. pr_err("usb_submit_urb(status_urb) ret %d\n", st);
  436. }
  437. static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
  438. {
  439. struct sd *sd = (struct sd *) gspca_dev;
  440. sd->brightness = val;
  441. if (gspca_dev->streaming) {
  442. konica_stream_off(gspca_dev);
  443. reg_w(gspca_dev, sd->brightness, BRIGHTNESS_REG);
  444. konica_stream_on(gspca_dev);
  445. }
  446. return 0;
  447. }
  448. static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
  449. {
  450. struct sd *sd = (struct sd *) gspca_dev;
  451. *val = sd->brightness;
  452. return 0;
  453. }
  454. static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
  455. {
  456. struct sd *sd = (struct sd *) gspca_dev;
  457. sd->contrast = val;
  458. if (gspca_dev->streaming) {
  459. konica_stream_off(gspca_dev);
  460. reg_w(gspca_dev, sd->contrast, CONTRAST_REG);
  461. konica_stream_on(gspca_dev);
  462. }
  463. return 0;
  464. }
  465. static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
  466. {
  467. struct sd *sd = (struct sd *) gspca_dev;
  468. *val = sd->contrast;
  469. return 0;
  470. }
  471. static int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val)
  472. {
  473. struct sd *sd = (struct sd *) gspca_dev;
  474. sd->saturation = val;
  475. if (gspca_dev->streaming) {
  476. konica_stream_off(gspca_dev);
  477. reg_w(gspca_dev, sd->saturation, SATURATION_REG);
  478. konica_stream_on(gspca_dev);
  479. }
  480. return 0;
  481. }
  482. static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val)
  483. {
  484. struct sd *sd = (struct sd *) gspca_dev;
  485. *val = sd->saturation;
  486. return 0;
  487. }
  488. static int sd_setwhitebal(struct gspca_dev *gspca_dev, __s32 val)
  489. {
  490. struct sd *sd = (struct sd *) gspca_dev;
  491. sd->whitebal = val;
  492. if (gspca_dev->streaming) {
  493. konica_stream_off(gspca_dev);
  494. reg_w(gspca_dev, sd->whitebal, WHITEBAL_REG);
  495. konica_stream_on(gspca_dev);
  496. }
  497. return 0;
  498. }
  499. static int sd_getwhitebal(struct gspca_dev *gspca_dev, __s32 *val)
  500. {
  501. struct sd *sd = (struct sd *) gspca_dev;
  502. *val = sd->whitebal;
  503. return 0;
  504. }
  505. static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
  506. {
  507. struct sd *sd = (struct sd *) gspca_dev;
  508. sd->sharpness = val;
  509. if (gspca_dev->streaming) {
  510. konica_stream_off(gspca_dev);
  511. reg_w(gspca_dev, sd->sharpness, SHARPNESS_REG);
  512. konica_stream_on(gspca_dev);
  513. }
  514. return 0;
  515. }
  516. static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
  517. {
  518. struct sd *sd = (struct sd *) gspca_dev;
  519. *val = sd->sharpness;
  520. return 0;
  521. }
  522. /* sub-driver description */
  523. static const struct sd_desc sd_desc = {
  524. .name = MODULE_NAME,
  525. .ctrls = sd_ctrls,
  526. .nctrls = ARRAY_SIZE(sd_ctrls),
  527. .config = sd_config,
  528. .init = sd_init,
  529. .start = sd_start,
  530. .stopN = sd_stopN,
  531. #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
  532. .other_input = 1,
  533. #endif
  534. };
  535. /* -- module initialisation -- */
  536. static const struct usb_device_id device_table[] = {
  537. {USB_DEVICE(0x04c8, 0x0720)}, /* Intel YC 76 */
  538. {}
  539. };
  540. MODULE_DEVICE_TABLE(usb, device_table);
  541. /* -- device connect -- */
  542. static int sd_probe(struct usb_interface *intf,
  543. const struct usb_device_id *id)
  544. {
  545. return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
  546. THIS_MODULE);
  547. }
  548. static struct usb_driver sd_driver = {
  549. .name = MODULE_NAME,
  550. .id_table = device_table,
  551. .probe = sd_probe,
  552. .disconnect = gspca_disconnect,
  553. #ifdef CONFIG_PM
  554. .suspend = gspca_suspend,
  555. .resume = gspca_resume,
  556. #endif
  557. };
  558. module_usb_driver(sd_driver);