]>
Commit | Line | Data |
---|---|---|
e2997a72 HG |
1 | /* |
2 | * Pixart PAC207BCA library | |
3 | * | |
1fddcf0e | 4 | * Copyright (C) 2008 Hans de Goede <hdegoede@redhat.com> |
e2997a72 HG |
5 | * Copyright (C) 2005 Thomas Kaiser thomas@kaiser-linux.li |
6 | * Copyleft (C) 2005 Michel Xhaard mxhaard@magic.fr | |
7 | * | |
8 | * V4L2 by Jean-Francois Moine <http://moinejf.free.fr> | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
e2997a72 HG |
20 | */ |
21 | ||
be612514 JP |
22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
23 | ||
e2997a72 HG |
24 | #define MODULE_NAME "pac207" |
25 | ||
937a6f54 | 26 | #include <linux/input.h> |
e2997a72 | 27 | #include "gspca.h" |
cd92c1a6 HG |
28 | /* Include pac common sof detection functions */ |
29 | #include "pac_common.h" | |
e2997a72 | 30 | |
1fddcf0e | 31 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); |
e2997a72 HG |
32 | MODULE_DESCRIPTION("Pixart PAC207"); |
33 | MODULE_LICENSE("GPL"); | |
34 | ||
35 | #define PAC207_CTRL_TIMEOUT 100 /* ms */ | |
36 | ||
37 | #define PAC207_BRIGHTNESS_MIN 0 | |
38 | #define PAC207_BRIGHTNESS_MAX 255 | |
0e4a9099 | 39 | #define PAC207_BRIGHTNESS_DEFAULT 46 |
cd92c1a6 | 40 | #define PAC207_BRIGHTNESS_REG 0x08 |
0e4a9099 HG |
41 | |
42 | #define PAC207_EXPOSURE_MIN 3 | |
69c00399 | 43 | #define PAC207_EXPOSURE_MAX 90 /* 1 sec expo time / 1 fps */ |
0e4a9099 | 44 | #define PAC207_EXPOSURE_DEFAULT 5 /* power on default: 3 */ |
cd92c1a6 | 45 | #define PAC207_EXPOSURE_REG 0x02 |
e2997a72 HG |
46 | |
47 | #define PAC207_GAIN_MIN 0 | |
48 | #define PAC207_GAIN_MAX 31 | |
69c00399 | 49 | #define PAC207_GAIN_DEFAULT 7 /* power on default: 9 */ |
cd92c1a6 | 50 | #define PAC207_GAIN_REG 0x0e |
e2997a72 HG |
51 | |
52 | #define PAC207_AUTOGAIN_DEADZONE 30 | |
e2997a72 | 53 | |
143dd345 HG |
54 | /* global parameters */ |
55 | static int led_invert; | |
56 | module_param(led_invert, int, 0644); | |
57 | MODULE_PARM_DESC(led_invert, "Invert led"); | |
58 | ||
e2997a72 HG |
59 | /* specific webcam descriptor */ |
60 | struct sd { | |
61 | struct gspca_dev gspca_dev; /* !! must be the first item */ | |
62 | ||
cd92c1a6 | 63 | struct v4l2_ctrl *brightness; |
e2997a72 | 64 | |
cd92c1a6 | 65 | u8 mode; |
e2997a72 | 66 | u8 sof_read; |
ab8f12cf | 67 | u8 header_read; |
e2997a72 HG |
68 | u8 autogain_ignore_frames; |
69 | ||
70 | atomic_t avg_lum; | |
71 | }; | |
72 | ||
cc611b8a | 73 | static const struct v4l2_pix_format sif_mode[] = { |
c2446b3e JFM |
74 | {176, 144, V4L2_PIX_FMT_PAC207, V4L2_FIELD_NONE, |
75 | .bytesperline = 176, | |
76 | .sizeimage = (176 + 2) * 144, | |
77 | /* uncompressed, add 2 bytes / line for line header */ | |
78 | .colorspace = V4L2_COLORSPACE_SRGB, | |
79 | .priv = 1}, | |
80 | {352, 288, V4L2_PIX_FMT_PAC207, V4L2_FIELD_NONE, | |
81 | .bytesperline = 352, | |
80544d3c HG |
82 | /* compressed, but only when needed (not compressed |
83 | when the framerate is low) */ | |
84 | .sizeimage = (352 + 2) * 288, | |
c2446b3e JFM |
85 | .colorspace = V4L2_COLORSPACE_SRGB, |
86 | .priv = 0}, | |
e2997a72 HG |
87 | }; |
88 | ||
89 | static const __u8 pac207_sensor_init[][8] = { | |
0e4a9099 HG |
90 | {0x10, 0x12, 0x0d, 0x12, 0x0c, 0x01, 0x29, 0x84}, |
91 | {0x49, 0x64, 0x64, 0x64, 0x04, 0x10, 0xf0, 0x30}, | |
e2997a72 | 92 | {0x00, 0x00, 0x00, 0x70, 0xa0, 0xf8, 0x00, 0x00}, |
1d00d6c1 | 93 | {0x32, 0x00, 0x96, 0x00, 0xa2, 0x02, 0xaf, 0x00}, |
e2997a72 HG |
94 | }; |
95 | ||
cb0988cb | 96 | static void pac207_write_regs(struct gspca_dev *gspca_dev, u16 index, |
e2997a72 HG |
97 | const u8 *buffer, u16 length) |
98 | { | |
99 | struct usb_device *udev = gspca_dev->dev; | |
100 | int err; | |
e2997a72 | 101 | |
cb0988cb HG |
102 | if (gspca_dev->usb_err < 0) |
103 | return; | |
104 | ||
739570bb | 105 | memcpy(gspca_dev->usb_buf, buffer, length); |
e2997a72 HG |
106 | |
107 | err = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x01, | |
108 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
739570bb JFM |
109 | 0x00, index, |
110 | gspca_dev->usb_buf, length, PAC207_CTRL_TIMEOUT); | |
cb0988cb | 111 | if (err < 0) { |
be612514 JP |
112 | pr_err("Failed to write registers to index 0x%04X, error %d\n", |
113 | index, err); | |
cb0988cb HG |
114 | gspca_dev->usb_err = err; |
115 | } | |
e2997a72 HG |
116 | } |
117 | ||
cb0988cb | 118 | static void pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value) |
e2997a72 HG |
119 | { |
120 | struct usb_device *udev = gspca_dev->dev; | |
121 | int err; | |
122 | ||
cb0988cb HG |
123 | if (gspca_dev->usb_err < 0) |
124 | return; | |
125 | ||
e2997a72 HG |
126 | err = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, |
127 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
128 | value, index, NULL, 0, PAC207_CTRL_TIMEOUT); | |
cb0988cb | 129 | if (err) { |
be612514 JP |
130 | pr_err("Failed to write a register (index 0x%04X, value 0x%02X, error %d)\n", |
131 | index, value, err); | |
cb0988cb HG |
132 | gspca_dev->usb_err = err; |
133 | } | |
e2997a72 HG |
134 | } |
135 | ||
903e10aa | 136 | static int pac207_read_reg(struct gspca_dev *gspca_dev, u16 index) |
e2997a72 HG |
137 | { |
138 | struct usb_device *udev = gspca_dev->dev; | |
e2997a72 HG |
139 | int res; |
140 | ||
cb0988cb HG |
141 | if (gspca_dev->usb_err < 0) |
142 | return 0; | |
143 | ||
e2997a72 HG |
144 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, |
145 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | |
739570bb JFM |
146 | 0x00, index, |
147 | gspca_dev->usb_buf, 1, PAC207_CTRL_TIMEOUT); | |
e2997a72 | 148 | if (res < 0) { |
be612514 JP |
149 | pr_err("Failed to read a register (index 0x%04X, error %d)\n", |
150 | index, res); | |
cb0988cb HG |
151 | gspca_dev->usb_err = res; |
152 | return 0; | |
e2997a72 HG |
153 | } |
154 | ||
739570bb | 155 | return gspca_dev->usb_buf[0]; |
e2997a72 HG |
156 | } |
157 | ||
e2997a72 HG |
158 | /* this function is called at probe time */ |
159 | static int sd_config(struct gspca_dev *gspca_dev, | |
160 | const struct usb_device_id *id) | |
161 | { | |
162 | struct cam *cam; | |
163 | u8 idreg[2]; | |
164 | ||
165 | idreg[0] = pac207_read_reg(gspca_dev, 0x0000); | |
166 | idreg[1] = pac207_read_reg(gspca_dev, 0x0001); | |
1d00d6c1 | 167 | idreg[0] = ((idreg[0] & 0x0f) << 4) | ((idreg[1] & 0xf0) >> 4); |
e2997a72 HG |
168 | idreg[1] = idreg[1] & 0x0f; |
169 | PDEBUG(D_PROBE, "Pixart Sensor ID 0x%02X Chips ID 0x%02X", | |
170 | idreg[0], idreg[1]); | |
171 | ||
172 | if (idreg[0] != 0x27) { | |
173 | PDEBUG(D_PROBE, "Error invalid sensor ID!"); | |
174 | return -ENODEV; | |
175 | } | |
176 | ||
e2997a72 | 177 | PDEBUG(D_PROBE, |
1ddc9f75 MCC |
178 | "Pixart PAC207BCA Image Processor and Control Chip detected (vid/pid 0x%04X:0x%04X)", |
179 | id->idVendor, id->idProduct); | |
e2997a72 HG |
180 | |
181 | cam = &gspca_dev->cam; | |
e2997a72 HG |
182 | cam->cam_mode = sif_mode; |
183 | cam->nmodes = ARRAY_SIZE(sif_mode); | |
184 | ||
185 | return 0; | |
186 | } | |
187 | ||
012d6b02 JFM |
188 | /* this function is called at probe and resume time */ |
189 | static int sd_init(struct gspca_dev *gspca_dev) | |
e2997a72 | 190 | { |
143dd345 HG |
191 | u8 mode; |
192 | ||
193 | /* mode: Image Format (Bit 0), LED (1), Compr. test mode (2) */ | |
194 | if (led_invert) | |
195 | mode = 0x02; | |
196 | else | |
197 | mode = 0x00; | |
198 | pac207_write_reg(gspca_dev, 0x41, mode); | |
66e4124f | 199 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ |
e2997a72 | 200 | |
cb0988cb | 201 | return gspca_dev->usb_err; |
e2997a72 HG |
202 | } |
203 | ||
cd92c1a6 HG |
204 | static void setcontrol(struct gspca_dev *gspca_dev, u16 reg, u16 val) |
205 | { | |
206 | pac207_write_reg(gspca_dev, reg, val); | |
207 | pac207_write_reg(gspca_dev, 0x13, 0x01); /* Bit 0, auto clear */ | |
208 | pac207_write_reg(gspca_dev, 0x1c, 0x01); /* not documented */ | |
209 | } | |
210 | ||
211 | static int sd_s_ctrl(struct v4l2_ctrl *ctrl) | |
212 | { | |
213 | struct gspca_dev *gspca_dev = | |
214 | container_of(ctrl->handler, struct gspca_dev, ctrl_handler); | |
215 | struct sd *sd = (struct sd *)gspca_dev; | |
216 | ||
217 | gspca_dev->usb_err = 0; | |
218 | ||
219 | if (ctrl->id == V4L2_CID_AUTOGAIN && ctrl->is_new && ctrl->val) { | |
220 | /* when switching to autogain set defaults to make sure | |
221 | we are on a valid point of the autogain gain / | |
222 | exposure knee graph, and give this change time to | |
223 | take effect before doing autogain. */ | |
224 | gspca_dev->exposure->val = PAC207_EXPOSURE_DEFAULT; | |
225 | gspca_dev->gain->val = PAC207_GAIN_DEFAULT; | |
226 | sd->autogain_ignore_frames = PAC_AUTOGAIN_IGNORE_FRAMES; | |
227 | } | |
228 | ||
229 | if (!gspca_dev->streaming) | |
230 | return 0; | |
231 | ||
232 | switch (ctrl->id) { | |
233 | case V4L2_CID_BRIGHTNESS: | |
234 | setcontrol(gspca_dev, PAC207_BRIGHTNESS_REG, ctrl->val); | |
235 | break; | |
236 | case V4L2_CID_AUTOGAIN: | |
237 | if (gspca_dev->exposure->is_new || (ctrl->is_new && ctrl->val)) | |
238 | setcontrol(gspca_dev, PAC207_EXPOSURE_REG, | |
239 | gspca_dev->exposure->val); | |
240 | if (gspca_dev->gain->is_new || (ctrl->is_new && ctrl->val)) | |
241 | setcontrol(gspca_dev, PAC207_GAIN_REG, | |
242 | gspca_dev->gain->val); | |
243 | break; | |
244 | default: | |
245 | return -EINVAL; | |
246 | } | |
247 | return gspca_dev->usb_err; | |
248 | } | |
249 | ||
250 | static const struct v4l2_ctrl_ops sd_ctrl_ops = { | |
251 | .s_ctrl = sd_s_ctrl, | |
252 | }; | |
253 | ||
254 | /* this function is called at probe time */ | |
255 | static int sd_init_controls(struct gspca_dev *gspca_dev) | |
256 | { | |
257 | struct sd *sd = (struct sd *) gspca_dev; | |
258 | struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; | |
259 | ||
260 | gspca_dev->vdev.ctrl_handler = hdl; | |
261 | v4l2_ctrl_handler_init(hdl, 4); | |
262 | ||
263 | sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | |
264 | V4L2_CID_BRIGHTNESS, | |
265 | PAC207_BRIGHTNESS_MIN, PAC207_BRIGHTNESS_MAX, | |
266 | 1, PAC207_BRIGHTNESS_DEFAULT); | |
267 | gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | |
268 | V4L2_CID_AUTOGAIN, 0, 1, 1, 1); | |
269 | gspca_dev->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | |
270 | V4L2_CID_EXPOSURE, | |
271 | PAC207_EXPOSURE_MIN, PAC207_EXPOSURE_MAX, | |
272 | 1, PAC207_EXPOSURE_DEFAULT); | |
273 | gspca_dev->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | |
274 | V4L2_CID_GAIN, | |
275 | PAC207_GAIN_MIN, PAC207_GAIN_MAX, | |
276 | 1, PAC207_GAIN_DEFAULT); | |
277 | if (hdl->error) { | |
278 | pr_err("Could not initialize controls\n"); | |
279 | return hdl->error; | |
280 | } | |
281 | v4l2_ctrl_auto_cluster(3, &gspca_dev->autogain, 0, false); | |
282 | return 0; | |
283 | } | |
284 | ||
e2997a72 | 285 | /* -- start the camera -- */ |
72ab97ce | 286 | static int sd_start(struct gspca_dev *gspca_dev) |
e2997a72 HG |
287 | { |
288 | struct sd *sd = (struct sd *) gspca_dev; | |
289 | __u8 mode; | |
290 | ||
291 | pac207_write_reg(gspca_dev, 0x0f, 0x10); /* Power control (Bit 6-0) */ | |
292 | pac207_write_regs(gspca_dev, 0x0002, pac207_sensor_init[0], 8); | |
293 | pac207_write_regs(gspca_dev, 0x000a, pac207_sensor_init[1], 8); | |
294 | pac207_write_regs(gspca_dev, 0x0012, pac207_sensor_init[2], 8); | |
c529e556 | 295 | pac207_write_regs(gspca_dev, 0x0042, pac207_sensor_init[3], 8); |
e2997a72 HG |
296 | |
297 | /* Compression Balance */ | |
1966bc2a | 298 | if (gspca_dev->pixfmt.width == 176) |
e2997a72 HG |
299 | pac207_write_reg(gspca_dev, 0x4a, 0xff); |
300 | else | |
0e4a9099 | 301 | pac207_write_reg(gspca_dev, 0x4a, 0x30); |
e2997a72 | 302 | pac207_write_reg(gspca_dev, 0x4b, 0x00); /* Sram test value */ |
cd92c1a6 | 303 | pac207_write_reg(gspca_dev, 0x08, v4l2_ctrl_g_ctrl(sd->brightness)); |
e2997a72 HG |
304 | |
305 | /* PGA global gain (Bit 4-0) */ | |
cd92c1a6 HG |
306 | pac207_write_reg(gspca_dev, 0x0e, |
307 | v4l2_ctrl_g_ctrl(gspca_dev->gain)); | |
308 | pac207_write_reg(gspca_dev, 0x02, | |
309 | v4l2_ctrl_g_ctrl(gspca_dev->exposure)); /* PXCK = 12MHz /n */ | |
e2997a72 | 310 | |
143dd345 HG |
311 | /* mode: Image Format (Bit 0), LED (1), Compr. test mode (2) */ |
312 | if (led_invert) | |
313 | mode = 0x00; | |
314 | else | |
315 | mode = 0x02; | |
1966bc2a | 316 | if (gspca_dev->pixfmt.width == 176) { /* 176x144 */ |
e2997a72 HG |
317 | mode |= 0x01; |
318 | PDEBUG(D_STREAM, "pac207_start mode 176x144"); | |
d43fa32f | 319 | } else { /* 352x288 */ |
e2997a72 | 320 | PDEBUG(D_STREAM, "pac207_start mode 352x288"); |
d43fa32f | 321 | } |
e2997a72 HG |
322 | pac207_write_reg(gspca_dev, 0x41, mode); |
323 | ||
324 | pac207_write_reg(gspca_dev, 0x13, 0x01); /* Bit 0, auto clear */ | |
325 | pac207_write_reg(gspca_dev, 0x1c, 0x01); /* not documented */ | |
6a7eba24 | 326 | msleep(10); |
e2997a72 HG |
327 | pac207_write_reg(gspca_dev, 0x40, 0x01); /* Start ISO pipe */ |
328 | ||
329 | sd->sof_read = 0; | |
330 | sd->autogain_ignore_frames = 0; | |
331 | atomic_set(&sd->avg_lum, -1); | |
cb0988cb | 332 | return gspca_dev->usb_err; |
e2997a72 HG |
333 | } |
334 | ||
335 | static void sd_stopN(struct gspca_dev *gspca_dev) | |
336 | { | |
143dd345 HG |
337 | u8 mode; |
338 | ||
339 | /* mode: Image Format (Bit 0), LED (1), Compr. test mode (2) */ | |
340 | if (led_invert) | |
341 | mode = 0x02; | |
342 | else | |
343 | mode = 0x00; | |
e2997a72 | 344 | pac207_write_reg(gspca_dev, 0x40, 0x00); /* Stop ISO pipe */ |
143dd345 | 345 | pac207_write_reg(gspca_dev, 0x41, mode); /* Turn off LED */ |
e2997a72 HG |
346 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ |
347 | } | |
348 | ||
8a5b2e90 | 349 | |
e2997a72 HG |
350 | static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) |
351 | { | |
352 | struct sd *sd = (struct sd *) gspca_dev; | |
e2997a72 HG |
353 | int avg_lum = atomic_read(&sd->avg_lum); |
354 | ||
dcef3237 | 355 | if (avg_lum == -1) |
e2997a72 HG |
356 | return; |
357 | ||
dcef3237 | 358 | if (sd->autogain_ignore_frames > 0) |
e2997a72 | 359 | sd->autogain_ignore_frames--; |
0413d3b2 HG |
360 | else if (gspca_coarse_grained_expo_autogain(gspca_dev, avg_lum, |
361 | 90, PAC207_AUTOGAIN_DEADZONE)) | |
8a5b2e90 | 362 | sd->autogain_ignore_frames = PAC_AUTOGAIN_IGNORE_FRAMES; |
e2997a72 HG |
363 | } |
364 | ||
e2997a72 | 365 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
76dd272b | 366 | u8 *data, |
e2997a72 HG |
367 | int len) |
368 | { | |
ab8f12cf | 369 | struct sd *sd = (struct sd *) gspca_dev; |
e2997a72 | 370 | unsigned char *sof; |
e2997a72 | 371 | |
c93396e1 | 372 | sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len); |
e2997a72 | 373 | if (sof) { |
ab8f12cf HG |
374 | int n; |
375 | ||
e2997a72 | 376 | /* finish decoding current frame */ |
ab8f12cf | 377 | n = sof - data; |
327c4abf HG |
378 | if (n > sizeof pac_sof_marker) |
379 | n -= sizeof pac_sof_marker; | |
ab8f12cf HG |
380 | else |
381 | n = 0; | |
76dd272b JFM |
382 | gspca_frame_add(gspca_dev, LAST_PACKET, |
383 | data, n); | |
ab8f12cf | 384 | sd->header_read = 0; |
76dd272b | 385 | gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0); |
e2997a72 HG |
386 | len -= sof - data; |
387 | data = sof; | |
388 | } | |
ab8f12cf HG |
389 | if (sd->header_read < 11) { |
390 | int needed; | |
e2997a72 | 391 | |
ab8f12cf HG |
392 | /* get average lumination from frame header (byte 5) */ |
393 | if (sd->header_read < 5) { | |
394 | needed = 5 - sd->header_read; | |
395 | if (len >= needed) | |
396 | atomic_set(&sd->avg_lum, data[needed - 1]); | |
397 | } | |
398 | /* skip the rest of the header */ | |
399 | needed = 11 - sd->header_read; | |
400 | if (len <= needed) { | |
401 | sd->header_read += len; | |
402 | return; | |
403 | } | |
404 | data += needed; | |
405 | len -= needed; | |
406 | sd->header_read = 11; | |
407 | } | |
e2997a72 | 408 | |
76dd272b | 409 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); |
e2997a72 HG |
410 | } |
411 | ||
4f4d1785 | 412 | #if IS_ENABLED(CONFIG_INPUT) |
937a6f54 HG |
413 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, |
414 | u8 *data, /* interrupt packet data */ | |
f58c91ce | 415 | int len) /* interrupt packet length */ |
937a6f54 HG |
416 | { |
417 | int ret = -EINVAL; | |
418 | ||
419 | if (len == 2 && data[0] == 0x5a && data[1] == 0x5a) { | |
420 | input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); | |
421 | input_sync(gspca_dev->input_dev); | |
422 | input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); | |
423 | input_sync(gspca_dev->input_dev); | |
424 | ret = 0; | |
425 | } | |
426 | ||
427 | return ret; | |
428 | } | |
429 | #endif | |
430 | ||
e2997a72 | 431 | /* sub-driver description */ |
a5ae2062 | 432 | static const struct sd_desc sd_desc = { |
e2997a72 | 433 | .name = MODULE_NAME, |
e2997a72 | 434 | .config = sd_config, |
012d6b02 | 435 | .init = sd_init, |
cd92c1a6 | 436 | .init_controls = sd_init_controls, |
e2997a72 HG |
437 | .start = sd_start, |
438 | .stopN = sd_stopN, | |
e2997a72 HG |
439 | .dq_callback = pac207_do_auto_gain, |
440 | .pkt_scan = sd_pkt_scan, | |
4f4d1785 | 441 | #if IS_ENABLED(CONFIG_INPUT) |
937a6f54 HG |
442 | .int_pkt_scan = sd_int_pkt_scan, |
443 | #endif | |
e2997a72 HG |
444 | }; |
445 | ||
446 | /* -- module initialisation -- */ | |
95c967c1 | 447 | static const struct usb_device_id device_table[] = { |
9d64fdb1 JFM |
448 | {USB_DEVICE(0x041e, 0x4028)}, |
449 | {USB_DEVICE(0x093a, 0x2460)}, | |
87945895 | 450 | {USB_DEVICE(0x093a, 0x2461)}, |
9d64fdb1 JFM |
451 | {USB_DEVICE(0x093a, 0x2463)}, |
452 | {USB_DEVICE(0x093a, 0x2464)}, | |
453 | {USB_DEVICE(0x093a, 0x2468)}, | |
454 | {USB_DEVICE(0x093a, 0x2470)}, | |
455 | {USB_DEVICE(0x093a, 0x2471)}, | |
456 | {USB_DEVICE(0x093a, 0x2472)}, | |
db91235e | 457 | {USB_DEVICE(0x093a, 0x2474)}, |
d654dca7 | 458 | {USB_DEVICE(0x093a, 0x2476)}, |
91711874 | 459 | {USB_DEVICE(0x145f, 0x013a)}, |
9d64fdb1 | 460 | {USB_DEVICE(0x2001, 0xf115)}, |
e2997a72 HG |
461 | {} |
462 | }; | |
463 | MODULE_DEVICE_TABLE(usb, device_table); | |
464 | ||
465 | /* -- device connect -- */ | |
466 | static int sd_probe(struct usb_interface *intf, | |
467 | const struct usb_device_id *id) | |
468 | { | |
d43fa32f JFM |
469 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), |
470 | THIS_MODULE); | |
e2997a72 HG |
471 | } |
472 | ||
473 | static struct usb_driver sd_driver = { | |
474 | .name = MODULE_NAME, | |
475 | .id_table = device_table, | |
476 | .probe = sd_probe, | |
477 | .disconnect = gspca_disconnect, | |
6a709749 JFM |
478 | #ifdef CONFIG_PM |
479 | .suspend = gspca_suspend, | |
480 | .resume = gspca_resume, | |
8bb58964 | 481 | .reset_resume = gspca_resume, |
6a709749 | 482 | #endif |
e2997a72 HG |
483 | }; |
484 | ||
ecb3b2b3 | 485 | module_usb_driver(sd_driver); |