blob: a1c31bc53a3dce4fd82496e2029d49c29b748341 [file] [log] [blame]
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -03001/*
2 * ov534/ov772x gspca driver
3 * Copyright (C) 2008 Antonio Ospite <ospite@studenti.unina.it>
4 *
5 * Based on a prototype written by Mark Ferrell <majortrips@gmail.com>
6 * USB protocol reverse engineered by Jim Paris <jim@jtan.com>
7 * https://jim.sh/svn/jim/devl/playstation/ps3/eye/test/
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#define MODULE_NAME "ov534"
25
26#include "gspca.h"
27
28#define OV534_REG_ADDRESS 0xf1 /* ? */
29#define OV534_REG_SUBADDR 0xf2
30#define OV534_REG_WRITE 0xf3
31#define OV534_REG_READ 0xf4
32#define OV534_REG_OPERATION 0xf5
33#define OV534_REG_STATUS 0xf6
34
35#define OV534_OP_WRITE_3 0x37
36#define OV534_OP_WRITE_2 0x33
37#define OV534_OP_READ_2 0xf9
38
39#define CTRL_TIMEOUT 500
40
41MODULE_AUTHOR("Antonio Ospite <ospite@studenti.unina.it>");
42MODULE_DESCRIPTION("GSPCA/OV534 USB Camera Driver");
43MODULE_LICENSE("GPL");
44
45/* global parameters */
46static int frame_rate;
47
48/* specific webcam descriptor */
49struct sd {
50 struct gspca_dev gspca_dev; /* !! must be the first item */
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -030051};
52
53/* V4L2 controls supported by the driver */
54static struct ctrl sd_ctrls[] = {
55};
56
57static struct v4l2_pix_format vga_mode[] = {
58 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
59 .bytesperline = 640 * 2,
60 .sizeimage = 640 * 480 * 2,
61 .colorspace = V4L2_COLORSPACE_JPEG,
62 .priv = 0},
63};
64
Antonio Ospite9e1e7b02008-12-03 14:10:01 -030065static void ov534_reg_write(struct usb_device *udev, u16 reg, u8 val)
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -030066{
Antonio Ospite9e1e7b02008-12-03 14:10:01 -030067 u8 data = val;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -030068 int ret;
69
Antonio Ospite9e1e7b02008-12-03 14:10:01 -030070 PDEBUG(D_USBO, "reg=0x%04x, val=0%02x", reg, val);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -030071 ret = usb_control_msg(udev,
72 usb_sndctrlpipe(udev, 0),
73 0x1,
74 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
75 0x0, reg, &data, 1, CTRL_TIMEOUT);
76 if (ret < 0)
77 PDEBUG(D_ERR, "write failed");
78}
79
Antonio Ospite9e1e7b02008-12-03 14:10:01 -030080static u8 ov534_reg_read(struct usb_device *udev, u16 reg)
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -030081{
Antonio Ospite9e1e7b02008-12-03 14:10:01 -030082 u8 data;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -030083 int ret;
84
85 ret = usb_control_msg(udev,
86 usb_rcvctrlpipe(udev, 0),
87 0x1,
88 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
89 0x0, reg, &data, 1, CTRL_TIMEOUT);
Antonio Ospite9e1e7b02008-12-03 14:10:01 -030090 PDEBUG(D_USBI, "reg=0x%04x, data=0x%02x", reg, data);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -030091 if (ret < 0)
92 PDEBUG(D_ERR, "read failed");
93 return data;
94}
95
Antonio Ospite9e1e7b02008-12-03 14:10:01 -030096static void ov534_reg_verify_write(struct usb_device *udev, u16 reg, u8 val)
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -030097{
Antonio Ospite9e1e7b02008-12-03 14:10:01 -030098 u8 data;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -030099
100 ov534_reg_write(udev, reg, val);
101 data = ov534_reg_read(udev, reg);
102 if (data != val) {
103 PDEBUG(D_ERR | D_USBO,
Antonio Ospite9e1e7b02008-12-03 14:10:01 -0300104 "unexpected result from read: 0x%02x != 0x%02x", val,
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300105 data);
106 }
107}
108
109/* Two bits control LED: 0x21 bit 7 and 0x23 bit 7.
110 * (direction and output)? */
111static void ov534_set_led(struct usb_device *udev, int status)
112{
Antonio Ospite9e1e7b02008-12-03 14:10:01 -0300113 u8 data;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300114
115 PDEBUG(D_CONF, "led status: %d", status);
116
117 data = ov534_reg_read(udev, 0x21);
118 data |= 0x80;
119 ov534_reg_write(udev, 0x21, data);
120
121 data = ov534_reg_read(udev, 0x23);
122 if (status)
123 data |= 0x80;
124 else
125 data &= ~(0x80);
126
127 ov534_reg_write(udev, 0x23, data);
128}
129
130static int sccb_check_status(struct usb_device *udev)
131{
Antonio Ospite9e1e7b02008-12-03 14:10:01 -0300132 u8 data;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300133 int i;
134
135 for (i = 0; i < 5; i++) {
136 data = ov534_reg_read(udev, OV534_REG_STATUS);
137
Antonio Ospite9e1e7b02008-12-03 14:10:01 -0300138 switch (data) {
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300139 case 0x00:
140 return 1;
141 case 0x04:
142 return 0;
143 case 0x03:
144 break;
145 default:
146 PDEBUG(D_ERR, "sccb status 0x%02x, attempt %d/5\n",
147 data, i + 1);
148 }
149 }
150 return 0;
151}
152
Antonio Ospite9e1e7b02008-12-03 14:10:01 -0300153static void sccb_reg_write(struct usb_device *udev, u16 reg, u8 val)
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300154{
Antonio Ospite9e1e7b02008-12-03 14:10:01 -0300155 PDEBUG(D_USBO, "reg: 0x%04x, val: 0x%02x", reg, val);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300156 ov534_reg_write(udev, OV534_REG_SUBADDR, reg);
157 ov534_reg_write(udev, OV534_REG_WRITE, val);
158 ov534_reg_write(udev, OV534_REG_OPERATION, OV534_OP_WRITE_3);
159
160 if (!sccb_check_status(udev))
161 PDEBUG(D_ERR, "sccb_reg_write failed");
162}
163
164/* setup method */
165static void ov534_setup(struct usb_device *udev)
166{
167 ov534_reg_verify_write(udev, 0xe7, 0x3a);
168
169 ov534_reg_write(udev, OV534_REG_ADDRESS, 0x60);
170 ov534_reg_write(udev, OV534_REG_ADDRESS, 0x60);
171 ov534_reg_write(udev, OV534_REG_ADDRESS, 0x60);
172 ov534_reg_write(udev, OV534_REG_ADDRESS, 0x42);
173
174 ov534_reg_verify_write(udev, 0xc2, 0x0c);
175 ov534_reg_verify_write(udev, 0x88, 0xf8);
176 ov534_reg_verify_write(udev, 0xc3, 0x69);
177 ov534_reg_verify_write(udev, 0x89, 0xff);
178 ov534_reg_verify_write(udev, 0x76, 0x03);
179 ov534_reg_verify_write(udev, 0x92, 0x01);
180 ov534_reg_verify_write(udev, 0x93, 0x18);
181 ov534_reg_verify_write(udev, 0x94, 0x10);
182 ov534_reg_verify_write(udev, 0x95, 0x10);
183 ov534_reg_verify_write(udev, 0xe2, 0x00);
184 ov534_reg_verify_write(udev, 0xe7, 0x3e);
185
186 ov534_reg_write(udev, 0x1c, 0x0a);
187 ov534_reg_write(udev, 0x1d, 0x22);
188 ov534_reg_write(udev, 0x1d, 0x06);
189
190 ov534_reg_verify_write(udev, 0x96, 0x00);
191
192 ov534_reg_write(udev, 0x97, 0x20);
193 ov534_reg_write(udev, 0x97, 0x20);
194 ov534_reg_write(udev, 0x97, 0x20);
195 ov534_reg_write(udev, 0x97, 0x0a);
196 ov534_reg_write(udev, 0x97, 0x3f);
197 ov534_reg_write(udev, 0x97, 0x4a);
198 ov534_reg_write(udev, 0x97, 0x20);
199 ov534_reg_write(udev, 0x97, 0x15);
200 ov534_reg_write(udev, 0x97, 0x0b);
201
202 ov534_reg_verify_write(udev, 0x8e, 0x40);
203 ov534_reg_verify_write(udev, 0x1f, 0x81);
204 ov534_reg_verify_write(udev, 0x34, 0x05);
205 ov534_reg_verify_write(udev, 0xe3, 0x04);
206 ov534_reg_verify_write(udev, 0x88, 0x00);
207 ov534_reg_verify_write(udev, 0x89, 0x00);
208 ov534_reg_verify_write(udev, 0x76, 0x00);
209 ov534_reg_verify_write(udev, 0xe7, 0x2e);
210 ov534_reg_verify_write(udev, 0x31, 0xf9);
211 ov534_reg_verify_write(udev, 0x25, 0x42);
212 ov534_reg_verify_write(udev, 0x21, 0xf0);
213
214 ov534_reg_write(udev, 0x1c, 0x00);
215 ov534_reg_write(udev, 0x1d, 0x40);
216 ov534_reg_write(udev, 0x1d, 0x02);
217 ov534_reg_write(udev, 0x1d, 0x00);
218 ov534_reg_write(udev, 0x1d, 0x02);
219 ov534_reg_write(udev, 0x1d, 0x57);
220 ov534_reg_write(udev, 0x1d, 0xff);
221
222 ov534_reg_verify_write(udev, 0x8d, 0x1c);
223 ov534_reg_verify_write(udev, 0x8e, 0x80);
224 ov534_reg_verify_write(udev, 0xe5, 0x04);
225
226 ov534_set_led(udev, 1);
227
228 sccb_reg_write(udev, 0x12, 0x80);
229 sccb_reg_write(udev, 0x11, 0x01);
230 sccb_reg_write(udev, 0x11, 0x01);
231 sccb_reg_write(udev, 0x11, 0x01);
232 sccb_reg_write(udev, 0x11, 0x01);
233 sccb_reg_write(udev, 0x11, 0x01);
234 sccb_reg_write(udev, 0x11, 0x01);
235 sccb_reg_write(udev, 0x11, 0x01);
236 sccb_reg_write(udev, 0x11, 0x01);
237 sccb_reg_write(udev, 0x11, 0x01);
238 sccb_reg_write(udev, 0x11, 0x01);
239 sccb_reg_write(udev, 0x11, 0x01);
240
241 ov534_set_led(udev, 0);
242
243 sccb_reg_write(udev, 0x3d, 0x03);
244 sccb_reg_write(udev, 0x17, 0x26);
245 sccb_reg_write(udev, 0x18, 0xa0);
246 sccb_reg_write(udev, 0x19, 0x07);
247 sccb_reg_write(udev, 0x1a, 0xf0);
248 sccb_reg_write(udev, 0x32, 0x00);
249 sccb_reg_write(udev, 0x29, 0xa0);
250 sccb_reg_write(udev, 0x2c, 0xf0);
251 sccb_reg_write(udev, 0x65, 0x20);
252 sccb_reg_write(udev, 0x11, 0x01);
253 sccb_reg_write(udev, 0x42, 0x7f);
254 sccb_reg_write(udev, 0x63, 0xe0);
255 sccb_reg_write(udev, 0x64, 0xff);
256 sccb_reg_write(udev, 0x66, 0x00);
257 sccb_reg_write(udev, 0x13, 0xf0);
258 sccb_reg_write(udev, 0x0d, 0x41);
259 sccb_reg_write(udev, 0x0f, 0xc5);
260 sccb_reg_write(udev, 0x14, 0x11);
261
262 ov534_set_led(udev, 1);
263
264 sccb_reg_write(udev, 0x22, 0x7f);
265 sccb_reg_write(udev, 0x23, 0x03);
266 sccb_reg_write(udev, 0x24, 0x40);
267 sccb_reg_write(udev, 0x25, 0x30);
268 sccb_reg_write(udev, 0x26, 0xa1);
269 sccb_reg_write(udev, 0x2a, 0x00);
270 sccb_reg_write(udev, 0x2b, 0x00);
271 sccb_reg_write(udev, 0x6b, 0xaa);
272 sccb_reg_write(udev, 0x13, 0xff);
273
274 ov534_set_led(udev, 0);
275
276 sccb_reg_write(udev, 0x90, 0x05);
277 sccb_reg_write(udev, 0x91, 0x01);
278 sccb_reg_write(udev, 0x92, 0x03);
279 sccb_reg_write(udev, 0x93, 0x00);
280 sccb_reg_write(udev, 0x94, 0x60);
281 sccb_reg_write(udev, 0x95, 0x3c);
282 sccb_reg_write(udev, 0x96, 0x24);
283 sccb_reg_write(udev, 0x97, 0x1e);
284 sccb_reg_write(udev, 0x98, 0x62);
285 sccb_reg_write(udev, 0x99, 0x80);
286 sccb_reg_write(udev, 0x9a, 0x1e);
287 sccb_reg_write(udev, 0x9b, 0x08);
288 sccb_reg_write(udev, 0x9c, 0x20);
289 sccb_reg_write(udev, 0x9e, 0x81);
290
291 ov534_set_led(udev, 1);
292
293 sccb_reg_write(udev, 0xa6, 0x04);
294 sccb_reg_write(udev, 0x7e, 0x0c);
295 sccb_reg_write(udev, 0x7f, 0x16);
296 sccb_reg_write(udev, 0x80, 0x2a);
297 sccb_reg_write(udev, 0x81, 0x4e);
298 sccb_reg_write(udev, 0x82, 0x61);
299 sccb_reg_write(udev, 0x83, 0x6f);
300 sccb_reg_write(udev, 0x84, 0x7b);
301 sccb_reg_write(udev, 0x85, 0x86);
302 sccb_reg_write(udev, 0x86, 0x8e);
303 sccb_reg_write(udev, 0x87, 0x97);
304 sccb_reg_write(udev, 0x88, 0xa4);
305 sccb_reg_write(udev, 0x89, 0xaf);
306 sccb_reg_write(udev, 0x8a, 0xc5);
307 sccb_reg_write(udev, 0x8b, 0xd7);
308 sccb_reg_write(udev, 0x8c, 0xe8);
309 sccb_reg_write(udev, 0x8d, 0x20);
310
311 sccb_reg_write(udev, 0x0c, 0x90);
312
313 ov534_reg_verify_write(udev, 0xc0, 0x50);
314 ov534_reg_verify_write(udev, 0xc1, 0x3c);
315 ov534_reg_verify_write(udev, 0xc2, 0x0c);
316
317 ov534_set_led(udev, 1);
318
319 sccb_reg_write(udev, 0x2b, 0x00);
320 sccb_reg_write(udev, 0x22, 0x7f);
321 sccb_reg_write(udev, 0x23, 0x03);
322 sccb_reg_write(udev, 0x11, 0x01);
323 sccb_reg_write(udev, 0x0c, 0xd0);
324 sccb_reg_write(udev, 0x64, 0xff);
325 sccb_reg_write(udev, 0x0d, 0x41);
326
327 sccb_reg_write(udev, 0x14, 0x41);
328 sccb_reg_write(udev, 0x0e, 0xcd);
329 sccb_reg_write(udev, 0xac, 0xbf);
330 sccb_reg_write(udev, 0x8e, 0x00);
331 sccb_reg_write(udev, 0x0c, 0xd0);
332
333 ov534_reg_write(udev, 0xe0, 0x09);
334 ov534_set_led(udev, 0);
335}
336
337/* this function is called at probe time */
338static int sd_config(struct gspca_dev *gspca_dev,
339 const struct usb_device_id *id)
340{
341 struct cam *cam;
342
343 cam = &gspca_dev->cam;
344
345 cam->epaddr = 0x01;
346 cam->cam_mode = vga_mode;
347 cam->nmodes = ARRAY_SIZE(vga_mode);
348
Antonio Ospite442a43f2008-12-03 16:21:08 -0300349 /*
350 * On some architectures we need contiguous memory for urb buffers, and
351 * in low memory situation 'sizeimage' can be too much.
352 * 16kiB chunks should be available even when we are low in memory.
353 * TODO: CHECK this description: is the problem arch-dependent or more
354 * general?
355 */
356 cam->bulk_size = 16 * 1024;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300357 cam->bulk_nurbs = 2;
358
359 PDEBUG(D_PROBE, "bulk_size = %d", cam->bulk_size);
360
361 return 0;
362}
363
364/* this function is called at probe and resume time */
365static int sd_init(struct gspca_dev *gspca_dev)
366{
Antonio Ospite3adba442008-12-03 14:01:54 -0300367 int fr;
368
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300369 ov534_setup(gspca_dev->dev);
370
Antonio Ospite3adba442008-12-03 14:01:54 -0300371 fr = frame_rate;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300372
Antonio Ospite3adba442008-12-03 14:01:54 -0300373 switch (fr) {
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300374 case 50:
375 sccb_reg_write(gspca_dev->dev, 0x11, 0x01);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300376 sccb_reg_write(gspca_dev->dev, 0x0d, 0x41);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300377 ov534_reg_verify_write(gspca_dev->dev, 0xe5, 0x02);
378 break;
379 case 40:
380 sccb_reg_write(gspca_dev->dev, 0x11, 0x02);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300381 sccb_reg_write(gspca_dev->dev, 0x0d, 0xc1);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300382 ov534_reg_verify_write(gspca_dev->dev, 0xe5, 0x04);
383 break;
Antonio Ospite3adba442008-12-03 14:01:54 -0300384/* case 30: */
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300385 default:
Antonio Ospite3adba442008-12-03 14:01:54 -0300386 fr = 30;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300387 sccb_reg_write(gspca_dev->dev, 0x11, 0x04);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300388 sccb_reg_write(gspca_dev->dev, 0x0d, 0x81);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300389 ov534_reg_verify_write(gspca_dev->dev, 0xe5, 0x02);
390 break;
391 case 15:
392 sccb_reg_write(gspca_dev->dev, 0x11, 0x03);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300393 sccb_reg_write(gspca_dev->dev, 0x0d, 0x41);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300394 ov534_reg_verify_write(gspca_dev->dev, 0xe5, 0x04);
395 break;
Antonio Ospite3adba442008-12-03 14:01:54 -0300396 }
397
398 PDEBUG(D_PROBE, "frame_rate: %d", fr);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300399
400 return 0;
401}
402
403static int sd_start(struct gspca_dev *gspca_dev)
404{
Antonio Ospite442a43f2008-12-03 16:21:08 -0300405 struct gspca_frame *frame;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300406
407 /* start streaming data */
408 ov534_set_led(gspca_dev->dev, 1);
409 ov534_reg_write(gspca_dev->dev, 0xe0, 0x00);
410
Antonio Ospite442a43f2008-12-03 16:21:08 -0300411 frame = gspca_get_i_frame(gspca_dev);
412 if (frame == NULL) {
413 PDEBUG(D_ERR, "NULL frame!");
414 return -1;
415 }
416 gspca_frame_add(gspca_dev, FIRST_PACKET, frame, gspca_dev->usb_buf, 0);
417
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300418 return 0;
419}
420
421static void sd_stopN(struct gspca_dev *gspca_dev)
422{
423 /* stop streaming data */
424 ov534_reg_write(gspca_dev->dev, 0xe0, 0x09);
425 ov534_set_led(gspca_dev->dev, 0);
426}
427
428static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame,
429 __u8 *data, int len)
430{
431 /*
432 * The current camera setup doesn't stream the last pixel, so we set it
433 * to a dummy value
434 */
Antonio Ospite442a43f2008-12-03 16:21:08 -0300435 __u8 last[4] = { 0, 0, 0, 0 };
436 int framesize = frame->v4l2_buf.length;
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300437
Antonio Ospite442a43f2008-12-03 16:21:08 -0300438 PDEBUG(D_PACK, "");
439 PDEBUG(D_PACK, "** packet len = %d, framesize = %d", len, framesize);
440 PDEBUG(D_PACK, "** frame->data_end - frame->data + len = %d",
441 frame->data_end - frame->data + len);
442
443 if (frame->data_end - frame->data + len == framesize - 4) {
444 PDEBUG(D_PACK, " end of frame!");
445 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
446 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, last, 4);
447 gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, 0);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300448 } else
Antonio Ospite442a43f2008-12-03 16:21:08 -0300449 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
Antonio Ospitefbb4c6d2008-11-22 05:23:39 -0300450}
451
452/* sub-driver description */
453static const struct sd_desc sd_desc = {
454 .name = MODULE_NAME,
455 .ctrls = sd_ctrls,
456 .nctrls = ARRAY_SIZE(sd_ctrls),
457 .config = sd_config,
458 .init = sd_init,
459 .start = sd_start,
460 .stopN = sd_stopN,
461 .pkt_scan = sd_pkt_scan,
462};
463
464/* -- module initialisation -- */
465static const __devinitdata struct usb_device_id device_table[] = {
466 {USB_DEVICE(0x06f8, 0x3002)}, /* Hercules Blog Webcam */
467 {USB_DEVICE(0x06f8, 0x3003)}, /* Hercules Dualpix HD Weblog */
468 {USB_DEVICE(0x1415, 0x2000)}, /* Sony HD Eye for PS3 (SLEH 00201) */
469 {}
470};
471
472MODULE_DEVICE_TABLE(usb, device_table);
473
474/* -- device connect -- */
475static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id)
476{
477 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
478 THIS_MODULE);
479}
480
481static struct usb_driver sd_driver = {
482 .name = MODULE_NAME,
483 .id_table = device_table,
484 .probe = sd_probe,
485 .disconnect = gspca_disconnect,
486#ifdef CONFIG_PM
487 .suspend = gspca_suspend,
488 .resume = gspca_resume,
489#endif
490};
491
492/* -- module insert / remove -- */
493static int __init sd_mod_init(void)
494{
495 if (usb_register(&sd_driver) < 0)
496 return -1;
497 PDEBUG(D_PROBE, "registered");
498 return 0;
499}
500
501static void __exit sd_mod_exit(void)
502{
503 usb_deregister(&sd_driver);
504 PDEBUG(D_PROBE, "deregistered");
505}
506
507module_init(sd_mod_init);
508module_exit(sd_mod_exit);
509
510module_param(frame_rate, int, 0644);
511MODULE_PARM_DESC(frame_rate, "Frame rate (15, 30, 40, 50)");