konica.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  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. sd->brightness = BRIGHTNESS_DEFAULT;
  233. sd->contrast = CONTRAST_DEFAULT;
  234. sd->saturation = SATURATION_DEFAULT;
  235. sd->whitebal = WHITEBAL_DEFAULT;
  236. sd->sharpness = SHARPNESS_DEFAULT;
  237. return 0;
  238. }
  239. /* this function is called at probe and resume time */
  240. static int sd_init(struct gspca_dev *gspca_dev)
  241. {
  242. /* HDG not sure if these 2 reads are needed */
  243. reg_r(gspca_dev, 0, 0x10);
  244. PDEBUG(D_PROBE, "Reg 0x10 reads: %02x %02x",
  245. gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]);
  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_w(gspca_dev, 0, 0x0d);
  250. return 0;
  251. }
  252. static int sd_start(struct gspca_dev *gspca_dev)
  253. {
  254. struct sd *sd = (struct sd *) gspca_dev;
  255. struct urb *urb;
  256. int i, n, packet_size;
  257. struct usb_host_interface *alt;
  258. struct usb_interface *intf;
  259. intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface);
  260. alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt);
  261. if (!alt) {
  262. pr_err("Couldn't get altsetting\n");
  263. return -EIO;
  264. }
  265. packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
  266. reg_w(gspca_dev, sd->brightness, BRIGHTNESS_REG);
  267. reg_w(gspca_dev, sd->whitebal, WHITEBAL_REG);
  268. reg_w(gspca_dev, sd->contrast, CONTRAST_REG);
  269. reg_w(gspca_dev, sd->saturation, SATURATION_REG);
  270. reg_w(gspca_dev, sd->sharpness, SHARPNESS_REG);
  271. n = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
  272. reg_w(gspca_dev, n, 0x08);
  273. konica_stream_on(gspca_dev);
  274. if (gspca_dev->usb_err)
  275. return gspca_dev->usb_err;
  276. /* create 4 URBs - 2 on endpoint 0x83 and 2 on 0x082 */
  277. #if MAX_NURBS < 4
  278. #error "Not enough URBs in the gspca table"
  279. #endif
  280. #define SD_NPKT 32
  281. for (n = 0; n < 4; n++) {
  282. i = n & 1 ? 0 : 1;
  283. packet_size =
  284. le16_to_cpu(alt->endpoint[i].desc.wMaxPacketSize);
  285. urb = usb_alloc_urb(SD_NPKT, GFP_KERNEL);
  286. if (!urb) {
  287. pr_err("usb_alloc_urb failed\n");
  288. return -ENOMEM;
  289. }
  290. gspca_dev->urb[n] = urb;
  291. urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev,
  292. packet_size * SD_NPKT,
  293. GFP_KERNEL,
  294. &urb->transfer_dma);
  295. if (urb->transfer_buffer == NULL) {
  296. pr_err("usb_buffer_alloc failed\n");
  297. return -ENOMEM;
  298. }
  299. urb->dev = gspca_dev->dev;
  300. urb->context = gspca_dev;
  301. urb->transfer_buffer_length = packet_size * SD_NPKT;
  302. urb->pipe = usb_rcvisocpipe(gspca_dev->dev,
  303. n & 1 ? 0x81 : 0x82);
  304. urb->transfer_flags = URB_ISO_ASAP
  305. | URB_NO_TRANSFER_DMA_MAP;
  306. urb->interval = 1;
  307. urb->complete = sd_isoc_irq;
  308. urb->number_of_packets = SD_NPKT;
  309. for (i = 0; i < SD_NPKT; i++) {
  310. urb->iso_frame_desc[i].length = packet_size;
  311. urb->iso_frame_desc[i].offset = packet_size * i;
  312. }
  313. }
  314. return 0;
  315. }
  316. static void sd_stopN(struct gspca_dev *gspca_dev)
  317. {
  318. struct sd *sd = (struct sd *) gspca_dev;
  319. konica_stream_off(gspca_dev);
  320. #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
  321. /* Don't keep the button in the pressed state "forever" if it was
  322. pressed when streaming is stopped */
  323. if (sd->snapshot_pressed) {
  324. input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
  325. input_sync(gspca_dev->input_dev);
  326. sd->snapshot_pressed = 0;
  327. }
  328. #endif
  329. }
  330. /* reception of an URB */
  331. static void sd_isoc_irq(struct urb *urb)
  332. {
  333. struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;
  334. struct sd *sd = (struct sd *) gspca_dev;
  335. struct urb *data_urb, *status_urb;
  336. u8 *data;
  337. int i, st;
  338. PDEBUG(D_PACK, "sd isoc irq");
  339. if (!gspca_dev->streaming)
  340. return;
  341. if (urb->status != 0) {
  342. if (urb->status == -ESHUTDOWN)
  343. return; /* disconnection */
  344. #ifdef CONFIG_PM
  345. if (gspca_dev->frozen)
  346. return;
  347. #endif
  348. PDEBUG(D_ERR, "urb status: %d", urb->status);
  349. st = usb_submit_urb(urb, GFP_ATOMIC);
  350. if (st < 0)
  351. pr_err("resubmit urb error %d\n", st);
  352. return;
  353. }
  354. /* if this is a data URB (ep 0x82), wait */
  355. if (urb->transfer_buffer_length > 32) {
  356. sd->last_data_urb = urb;
  357. return;
  358. }
  359. status_urb = urb;
  360. data_urb = sd->last_data_urb;
  361. sd->last_data_urb = NULL;
  362. if (!data_urb || data_urb->start_frame != status_urb->start_frame) {
  363. PDEBUG(D_ERR|D_PACK, "lost sync on frames");
  364. goto resubmit;
  365. }
  366. if (data_urb->number_of_packets != status_urb->number_of_packets) {
  367. PDEBUG(D_ERR|D_PACK,
  368. "no packets does not match, data: %d, status: %d",
  369. data_urb->number_of_packets,
  370. status_urb->number_of_packets);
  371. goto resubmit;
  372. }
  373. for (i = 0; i < status_urb->number_of_packets; i++) {
  374. if (data_urb->iso_frame_desc[i].status ||
  375. status_urb->iso_frame_desc[i].status) {
  376. PDEBUG(D_ERR|D_PACK,
  377. "pkt %d data-status %d, status-status %d", i,
  378. data_urb->iso_frame_desc[i].status,
  379. status_urb->iso_frame_desc[i].status);
  380. gspca_dev->last_packet_type = DISCARD_PACKET;
  381. continue;
  382. }
  383. if (status_urb->iso_frame_desc[i].actual_length != 1) {
  384. PDEBUG(D_ERR|D_PACK,
  385. "bad status packet length %d",
  386. status_urb->iso_frame_desc[i].actual_length);
  387. gspca_dev->last_packet_type = DISCARD_PACKET;
  388. continue;
  389. }
  390. st = *((u8 *)status_urb->transfer_buffer
  391. + status_urb->iso_frame_desc[i].offset);
  392. data = (u8 *)data_urb->transfer_buffer
  393. + data_urb->iso_frame_desc[i].offset;
  394. /* st: 0x80-0xff: frame start with frame number (ie 0-7f)
  395. * otherwise:
  396. * bit 0 0: keep packet
  397. * 1: drop packet (padding data)
  398. *
  399. * bit 4 0 button not clicked
  400. * 1 button clicked
  401. * button is used to `take a picture' (in software)
  402. */
  403. if (st & 0x80) {
  404. gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
  405. gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);
  406. } else {
  407. #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
  408. u8 button_state = st & 0x40 ? 1 : 0;
  409. if (sd->snapshot_pressed != button_state) {
  410. input_report_key(gspca_dev->input_dev,
  411. KEY_CAMERA,
  412. button_state);
  413. input_sync(gspca_dev->input_dev);
  414. sd->snapshot_pressed = button_state;
  415. }
  416. #endif
  417. if (st & 0x01)
  418. continue;
  419. }
  420. gspca_frame_add(gspca_dev, INTER_PACKET, data,
  421. data_urb->iso_frame_desc[i].actual_length);
  422. }
  423. resubmit:
  424. if (data_urb) {
  425. st = usb_submit_urb(data_urb, GFP_ATOMIC);
  426. if (st < 0)
  427. PDEBUG(D_ERR|D_PACK,
  428. "usb_submit_urb(data_urb) ret %d", st);
  429. }
  430. st = usb_submit_urb(status_urb, GFP_ATOMIC);
  431. if (st < 0)
  432. pr_err("usb_submit_urb(status_urb) ret %d\n", st);
  433. }
  434. static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
  435. {
  436. struct sd *sd = (struct sd *) gspca_dev;
  437. sd->brightness = val;
  438. if (gspca_dev->streaming) {
  439. konica_stream_off(gspca_dev);
  440. reg_w(gspca_dev, sd->brightness, BRIGHTNESS_REG);
  441. konica_stream_on(gspca_dev);
  442. }
  443. return 0;
  444. }
  445. static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
  446. {
  447. struct sd *sd = (struct sd *) gspca_dev;
  448. *val = sd->brightness;
  449. return 0;
  450. }
  451. static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
  452. {
  453. struct sd *sd = (struct sd *) gspca_dev;
  454. sd->contrast = val;
  455. if (gspca_dev->streaming) {
  456. konica_stream_off(gspca_dev);
  457. reg_w(gspca_dev, sd->contrast, CONTRAST_REG);
  458. konica_stream_on(gspca_dev);
  459. }
  460. return 0;
  461. }
  462. static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
  463. {
  464. struct sd *sd = (struct sd *) gspca_dev;
  465. *val = sd->contrast;
  466. return 0;
  467. }
  468. static int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val)
  469. {
  470. struct sd *sd = (struct sd *) gspca_dev;
  471. sd->saturation = val;
  472. if (gspca_dev->streaming) {
  473. konica_stream_off(gspca_dev);
  474. reg_w(gspca_dev, sd->saturation, SATURATION_REG);
  475. konica_stream_on(gspca_dev);
  476. }
  477. return 0;
  478. }
  479. static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val)
  480. {
  481. struct sd *sd = (struct sd *) gspca_dev;
  482. *val = sd->saturation;
  483. return 0;
  484. }
  485. static int sd_setwhitebal(struct gspca_dev *gspca_dev, __s32 val)
  486. {
  487. struct sd *sd = (struct sd *) gspca_dev;
  488. sd->whitebal = val;
  489. if (gspca_dev->streaming) {
  490. konica_stream_off(gspca_dev);
  491. reg_w(gspca_dev, sd->whitebal, WHITEBAL_REG);
  492. konica_stream_on(gspca_dev);
  493. }
  494. return 0;
  495. }
  496. static int sd_getwhitebal(struct gspca_dev *gspca_dev, __s32 *val)
  497. {
  498. struct sd *sd = (struct sd *) gspca_dev;
  499. *val = sd->whitebal;
  500. return 0;
  501. }
  502. static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
  503. {
  504. struct sd *sd = (struct sd *) gspca_dev;
  505. sd->sharpness = val;
  506. if (gspca_dev->streaming) {
  507. konica_stream_off(gspca_dev);
  508. reg_w(gspca_dev, sd->sharpness, SHARPNESS_REG);
  509. konica_stream_on(gspca_dev);
  510. }
  511. return 0;
  512. }
  513. static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
  514. {
  515. struct sd *sd = (struct sd *) gspca_dev;
  516. *val = sd->sharpness;
  517. return 0;
  518. }
  519. /* sub-driver description */
  520. static const struct sd_desc sd_desc = {
  521. .name = MODULE_NAME,
  522. .ctrls = sd_ctrls,
  523. .nctrls = ARRAY_SIZE(sd_ctrls),
  524. .config = sd_config,
  525. .init = sd_init,
  526. .start = sd_start,
  527. .stopN = sd_stopN,
  528. #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
  529. .other_input = 1,
  530. #endif
  531. };
  532. /* -- module initialisation -- */
  533. static const struct usb_device_id device_table[] = {
  534. {USB_DEVICE(0x04c8, 0x0720)}, /* Intel YC 76 */
  535. {}
  536. };
  537. MODULE_DEVICE_TABLE(usb, device_table);
  538. /* -- device connect -- */
  539. static int sd_probe(struct usb_interface *intf,
  540. const struct usb_device_id *id)
  541. {
  542. return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
  543. THIS_MODULE);
  544. }
  545. static struct usb_driver sd_driver = {
  546. .name = MODULE_NAME,
  547. .id_table = device_table,
  548. .probe = sd_probe,
  549. .disconnect = gspca_disconnect,
  550. #ifdef CONFIG_PM
  551. .suspend = gspca_suspend,
  552. .resume = gspca_resume,
  553. #endif
  554. };
  555. module_usb_driver(sd_driver);