blob: e5bf865147d7a5ec4ffb0f43e2acff3bb1909816 [file] [log] [blame]
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -03001/*
2 * SPCA505 chip based cameras initialization data
3 *
4 * V4L2 by Jean-Francis Moine <http://moinejf.free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#define MODULE_NAME "spca505"
23
24#include "gspca.h"
25
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030026MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
27MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver");
28MODULE_LICENSE("GPL");
29
30/* specific webcam descriptor */
31struct sd {
32 struct gspca_dev gspca_dev; /* !! must be the first item */
33
Jean-Francois Moine16631aed2009-01-22 14:56:42 -030034 u8 brightness;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030035
Jean-Francois Moine16631aed2009-01-22 14:56:42 -030036 u8 subtype;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030037#define IntelPCCameraPro 0
38#define Nxultra 1
39};
40
41/* V4L2 controls supported by the driver */
42static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
43static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
44
Marton Nemeth7e64dc42009-12-30 09:12:41 -030045static const struct ctrl sd_ctrls[] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030046 {
47 {
48 .id = V4L2_CID_BRIGHTNESS,
49 .type = V4L2_CTRL_TYPE_INTEGER,
50 .name = "Brightness",
51 .minimum = 0,
52 .maximum = 255,
53 .step = 1,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -030054#define BRIGHTNESS_DEF 127
55 .default_value = BRIGHTNESS_DEF,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030056 },
57 .set = sd_setbrightness,
58 .get = sd_getbrightness,
59 },
60};
61
Jean-Francois Moinecc611b82008-12-29 07:49:41 -030062static const struct v4l2_pix_format vga_mode[] = {
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030063 {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030064 .bytesperline = 160,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030065 .sizeimage = 160 * 120 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030066 .colorspace = V4L2_COLORSPACE_SRGB,
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -030067 .priv = 4},
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030068 {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030069 .bytesperline = 176,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030070 .sizeimage = 176 * 144 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030071 .colorspace = V4L2_COLORSPACE_SRGB,
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -030072 .priv = 3},
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030073 {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030074 .bytesperline = 320,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030075 .sizeimage = 320 * 240 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030076 .colorspace = V4L2_COLORSPACE_SRGB,
77 .priv = 2},
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030078 {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030079 .bytesperline = 352,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030080 .sizeimage = 352 * 288 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030081 .colorspace = V4L2_COLORSPACE_SRGB,
82 .priv = 1},
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030083 {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030084 .bytesperline = 640,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030085 .sizeimage = 640 * 480 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030086 .colorspace = V4L2_COLORSPACE_SRGB,
87 .priv = 0},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030088};
89
90#define SPCA50X_OFFSET_DATA 10
91
92#define SPCA50X_REG_USB 0x02 /* spca505 501 */
93
94#define SPCA50X_USB_CTRL 0x00 /* spca505 */
95#define SPCA50X_CUSB_ENABLE 0x01 /* spca505 */
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -030096
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030097#define SPCA50X_REG_GLOBAL 0x03 /* spca505 */
98#define SPCA50X_GMISC0_IDSEL 0x01 /* Global control device ID select spca505 */
99#define SPCA50X_GLOBAL_MISC0 0x00 /* Global control miscellaneous 0 spca505 */
100
101#define SPCA50X_GLOBAL_MISC1 0x01 /* 505 */
102#define SPCA50X_GLOBAL_MISC3 0x03 /* 505 */
103#define SPCA50X_GMISC3_SAA7113RST 0x20 /* Not sure about this one spca505 */
104
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -0300105/* Image format and compression control */
106#define SPCA50X_REG_COMPRESS 0x04
107
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300108/*
109 * Data to initialize a SPCA505. Common to the CCD and external modes
110 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300111static const u8 spca505_init_data[][3] = {
112 /* bmRequest,value,index */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300113 {SPCA50X_REG_GLOBAL, SPCA50X_GMISC3_SAA7113RST, SPCA50X_GLOBAL_MISC3},
114 /* Sensor reset */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300115 {SPCA50X_REG_GLOBAL, 0x00, SPCA50X_GLOBAL_MISC3},
116 {SPCA50X_REG_GLOBAL, 0x00, SPCA50X_GLOBAL_MISC1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300117 /* Block USB reset */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300118 {SPCA50X_REG_GLOBAL, SPCA50X_GMISC0_IDSEL, SPCA50X_GLOBAL_MISC0},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300119
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300120 {0x05, 0x01, 0x10},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300121 /* Maybe power down some stuff */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300122 {0x05, 0x0f, 0x11},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300123
124 /* Setup internal CCD ? */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300125 {0x06, 0x10, 0x08},
126 {0x06, 0x00, 0x09},
127 {0x06, 0x00, 0x0a},
128 {0x06, 0x00, 0x0b},
129 {0x06, 0x10, 0x0c},
130 {0x06, 0x00, 0x0d},
131 {0x06, 0x00, 0x0e},
132 {0x06, 0x00, 0x0f},
133 {0x06, 0x10, 0x10},
134 {0x06, 0x02, 0x11},
135 {0x06, 0x00, 0x12},
136 {0x06, 0x04, 0x13},
137 {0x06, 0x02, 0x14},
138 {0x06, 0x8a, 0x51},
139 {0x06, 0x40, 0x52},
140 {0x06, 0xb6, 0x53},
141 {0x06, 0x3d, 0x54},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300142 {}
143};
144
145/*
146 * Data to initialize the camera using the internal CCD
147 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300148static const u8 spca505_open_data_ccd[][3] = {
149 /* bmRequest,value,index */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300150 /* Internal CCD data set */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300151 {0x03, 0x04, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300152 /* This could be a reset */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300153 {0x03, 0x00, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300154
155 /* Setup compression and image registers. 0x6 and 0x7 seem to be
156 related to H&V hold, and are resolution mode specific */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300157 {0x04, 0x10, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300158 /* DIFF(0x50), was (0x10) */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300159 {0x04, 0x00, 0x04},
160 {0x04, 0x00, 0x05},
161 {0x04, 0x20, 0x06},
162 {0x04, 0x20, 0x07},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300163
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300164 {0x08, 0x0a, 0x00},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300165 /* DIFF (0x4a), was (0xa) */
166
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300167 {0x05, 0x00, 0x10},
168 {0x05, 0x00, 0x11},
169 {0x05, 0x00, 0x00},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300170 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300171 {0x05, 0x00, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300172 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300173 {0x05, 0x00, 0x02},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300174 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300175 {0x05, 0x00, 0x03},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300176 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300177 {0x05, 0x00, 0x04},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300178 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300179 {0x05, 0x80, 0x05},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300180 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300181 {0x05, 0xe0, 0x06},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300182 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300183 {0x05, 0x20, 0x07},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300184 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300185 {0x05, 0xa0, 0x08},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300186 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300187 {0x05, 0x0, 0x12},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300188 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300189 {0x05, 0x02, 0x0f},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300190 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300191 {0x05, 0x10, 0x46},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300192 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300193 {0x05, 0x8, 0x4a},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300194 /* DIFF not written */
195
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300196 {0x03, 0x08, 0x03},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300197 /* DIFF (0x3,0x28,0x3) */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300198 {0x03, 0x08, 0x01},
199 {0x03, 0x0c, 0x03},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300200 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300201 {0x03, 0x21, 0x00},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300202 /* DIFF (0x39) */
203
204/* Extra block copied from init to hopefully ensure CCD is in a sane state */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300205 {0x06, 0x10, 0x08},
206 {0x06, 0x00, 0x09},
207 {0x06, 0x00, 0x0a},
208 {0x06, 0x00, 0x0b},
209 {0x06, 0x10, 0x0c},
210 {0x06, 0x00, 0x0d},
211 {0x06, 0x00, 0x0e},
212 {0x06, 0x00, 0x0f},
213 {0x06, 0x10, 0x10},
214 {0x06, 0x02, 0x11},
215 {0x06, 0x00, 0x12},
216 {0x06, 0x04, 0x13},
217 {0x06, 0x02, 0x14},
218 {0x06, 0x8a, 0x51},
219 {0x06, 0x40, 0x52},
220 {0x06, 0xb6, 0x53},
221 {0x06, 0x3d, 0x54},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300222 /* End of extra block */
223
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300224 {0x06, 0x3f, 0x1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300225 /* Block skipped */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300226 {0x06, 0x10, 0x02},
227 {0x06, 0x64, 0x07},
228 {0x06, 0x10, 0x08},
229 {0x06, 0x00, 0x09},
230 {0x06, 0x00, 0x0a},
231 {0x06, 0x00, 0x0b},
232 {0x06, 0x10, 0x0c},
233 {0x06, 0x00, 0x0d},
234 {0x06, 0x00, 0x0e},
235 {0x06, 0x00, 0x0f},
236 {0x06, 0x10, 0x10},
237 {0x06, 0x02, 0x11},
238 {0x06, 0x00, 0x12},
239 {0x06, 0x04, 0x13},
240 {0x06, 0x02, 0x14},
241 {0x06, 0x8a, 0x51},
242 {0x06, 0x40, 0x52},
243 {0x06, 0xb6, 0x53},
244 {0x06, 0x3d, 0x54},
245 {0x06, 0x60, 0x57},
246 {0x06, 0x20, 0x58},
247 {0x06, 0x15, 0x59},
248 {0x06, 0x05, 0x5a},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300249
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300250 {0x05, 0x01, 0xc0},
251 {0x05, 0x10, 0xcb},
252 {0x05, 0x80, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300253 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300254 {0x05, 0x0, 0xc2},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300255 /* 4 was 0 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300256 {0x05, 0x00, 0xca},
257 {0x05, 0x80, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300258 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300259 {0x05, 0x04, 0xc2},
260 {0x05, 0x00, 0xca},
261 {0x05, 0x0, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300262 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300263 {0x05, 0x00, 0xc2},
264 {0x05, 0x00, 0xca},
265 {0x05, 0x40, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300266 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300267 {0x05, 0x17, 0xc2},
268 {0x05, 0x00, 0xca},
269 {0x05, 0x80, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300270 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300271 {0x05, 0x06, 0xc2},
272 {0x05, 0x00, 0xca},
273 {0x05, 0x80, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300274 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300275 {0x05, 0x04, 0xc2},
276 {0x05, 0x00, 0xca},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300277
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300278 {0x03, 0x4c, 0x3},
279 {0x03, 0x18, 0x1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300280
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300281 {0x06, 0x70, 0x51},
282 {0x06, 0xbe, 0x53},
283 {0x06, 0x71, 0x57},
284 {0x06, 0x20, 0x58},
285 {0x06, 0x05, 0x59},
286 {0x06, 0x15, 0x5a},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300287
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300288 {0x04, 0x00, 0x08},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300289 /* Compress = OFF (0x1 to turn on) */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300290 {0x04, 0x12, 0x09},
291 {0x04, 0x21, 0x0a},
292 {0x04, 0x10, 0x0b},
293 {0x04, 0x21, 0x0c},
294 {0x04, 0x05, 0x00},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300295 /* was 5 (Image Type ? ) */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300296 {0x04, 0x00, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300297
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300298 {0x06, 0x3f, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300299
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300300 {0x04, 0x00, 0x04},
301 {0x04, 0x00, 0x05},
302 {0x04, 0x40, 0x06},
303 {0x04, 0x40, 0x07},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300304
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300305 {0x06, 0x1c, 0x17},
306 {0x06, 0xe2, 0x19},
307 {0x06, 0x1c, 0x1b},
308 {0x06, 0xe2, 0x1d},
309 {0x06, 0xaa, 0x1f},
310 {0x06, 0x70, 0x20},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300311
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300312 {0x05, 0x01, 0x10},
313 {0x05, 0x00, 0x11},
314 {0x05, 0x01, 0x00},
315 {0x05, 0x05, 0x01},
316 {0x05, 0x00, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300317 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300318 {0x05, 0x00, 0xc2},
319 {0x05, 0x00, 0xca},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300320
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300321 {0x06, 0x70, 0x51},
322 {0x06, 0xbe, 0x53},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300323 {}
324};
325
326/*
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300327 * Made by Tomasz Zablocki (skalamandra@poczta.onet.pl)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300328 * SPCA505b chip based cameras initialization data
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300329 */
330/* jfm */
331#define initial_brightness 0x7f /* 0x0(white)-0xff(black) */
332/* #define initial_brightness 0x0 //0x0(white)-0xff(black) */
333/*
334 * Data to initialize a SPCA505. Common to the CCD and external modes
335 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300336static const u8 spca505b_init_data[][3] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300337/* start */
338 {0x02, 0x00, 0x00}, /* init */
339 {0x02, 0x00, 0x01},
340 {0x02, 0x00, 0x02},
341 {0x02, 0x00, 0x03},
342 {0x02, 0x00, 0x04},
343 {0x02, 0x00, 0x05},
344 {0x02, 0x00, 0x06},
345 {0x02, 0x00, 0x07},
346 {0x02, 0x00, 0x08},
347 {0x02, 0x00, 0x09},
348 {0x03, 0x00, 0x00},
349 {0x03, 0x00, 0x01},
350 {0x03, 0x00, 0x02},
351 {0x03, 0x00, 0x03},
352 {0x03, 0x00, 0x04},
353 {0x03, 0x00, 0x05},
354 {0x03, 0x00, 0x06},
355 {0x04, 0x00, 0x00},
356 {0x04, 0x00, 0x02},
357 {0x04, 0x00, 0x04},
358 {0x04, 0x00, 0x05},
359 {0x04, 0x00, 0x06},
360 {0x04, 0x00, 0x07},
361 {0x04, 0x00, 0x08},
362 {0x04, 0x00, 0x09},
363 {0x04, 0x00, 0x0a},
364 {0x04, 0x00, 0x0b},
365 {0x04, 0x00, 0x0c},
366 {0x07, 0x00, 0x00},
367 {0x07, 0x00, 0x03},
368 {0x08, 0x00, 0x00},
369 {0x08, 0x00, 0x01},
370 {0x08, 0x00, 0x02},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300371 {0x06, 0x18, 0x08},
372 {0x06, 0xfc, 0x09},
373 {0x06, 0xfc, 0x0a},
374 {0x06, 0xfc, 0x0b},
375 {0x06, 0x18, 0x0c},
376 {0x06, 0xfc, 0x0d},
377 {0x06, 0xfc, 0x0e},
378 {0x06, 0xfc, 0x0f},
379 {0x06, 0x18, 0x10},
380 {0x06, 0xfe, 0x12},
381 {0x06, 0x00, 0x11},
382 {0x06, 0x00, 0x14},
383 {0x06, 0x00, 0x13},
384 {0x06, 0x28, 0x51},
385 {0x06, 0xff, 0x53},
386 {0x02, 0x00, 0x08},
387
388 {0x03, 0x00, 0x03},
389 {0x03, 0x10, 0x03},
390 {}
391};
392
393/*
394 * Data to initialize the camera using the internal CCD
395 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300396static const u8 spca505b_open_data_ccd[][3] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300397
398/* {0x02,0x00,0x00}, */
399 {0x03, 0x04, 0x01}, /* rst */
400 {0x03, 0x00, 0x01},
401 {0x03, 0x00, 0x00},
402 {0x03, 0x21, 0x00},
403 {0x03, 0x00, 0x04},
404 {0x03, 0x00, 0x03},
405 {0x03, 0x18, 0x03},
406 {0x03, 0x08, 0x01},
407 {0x03, 0x1c, 0x03},
408 {0x03, 0x5c, 0x03},
409 {0x03, 0x5c, 0x03},
410 {0x03, 0x18, 0x01},
411
412/* same as 505 */
413 {0x04, 0x10, 0x01},
414 {0x04, 0x00, 0x04},
415 {0x04, 0x00, 0x05},
416 {0x04, 0x20, 0x06},
417 {0x04, 0x20, 0x07},
418
419 {0x08, 0x0a, 0x00},
420
421 {0x05, 0x00, 0x10},
422 {0x05, 0x00, 0x11},
423 {0x05, 0x00, 0x12},
424 {0x05, 0x6f, 0x00},
Jean-Francois Moine92e8c912009-02-02 16:25:38 -0300425 {0x05, initial_brightness >> 6, 0x00},
426 {0x05, (initial_brightness << 2) & 0xff, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300427 {0x05, 0x00, 0x02},
428 {0x05, 0x01, 0x03},
429 {0x05, 0x00, 0x04},
430 {0x05, 0x03, 0x05},
431 {0x05, 0xe0, 0x06},
432 {0x05, 0x20, 0x07},
433 {0x05, 0xa0, 0x08},
434 {0x05, 0x00, 0x12},
435 {0x05, 0x02, 0x0f},
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300436 {0x05, 0x80, 0x14}, /* max exposure off (0=on) */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300437 {0x05, 0x01, 0xb0},
438 {0x05, 0x01, 0xbf},
439 {0x03, 0x02, 0x06},
440 {0x05, 0x10, 0x46},
441 {0x05, 0x08, 0x4a},
442
443 {0x06, 0x00, 0x01},
444 {0x06, 0x10, 0x02},
445 {0x06, 0x64, 0x07},
446 {0x06, 0x18, 0x08},
447 {0x06, 0xfc, 0x09},
448 {0x06, 0xfc, 0x0a},
449 {0x06, 0xfc, 0x0b},
450 {0x04, 0x00, 0x01},
451 {0x06, 0x18, 0x0c},
452 {0x06, 0xfc, 0x0d},
453 {0x06, 0xfc, 0x0e},
454 {0x06, 0xfc, 0x0f},
455 {0x06, 0x11, 0x10}, /* contrast */
456 {0x06, 0x00, 0x11},
457 {0x06, 0xfe, 0x12},
458 {0x06, 0x00, 0x13},
459 {0x06, 0x00, 0x14},
460 {0x06, 0x9d, 0x51},
461 {0x06, 0x40, 0x52},
462 {0x06, 0x7c, 0x53},
463 {0x06, 0x40, 0x54},
464 {0x06, 0x02, 0x57},
465 {0x06, 0x03, 0x58},
466 {0x06, 0x15, 0x59},
467 {0x06, 0x05, 0x5a},
468 {0x06, 0x03, 0x56},
469 {0x06, 0x02, 0x3f},
470 {0x06, 0x00, 0x40},
471 {0x06, 0x39, 0x41},
472 {0x06, 0x69, 0x42},
473 {0x06, 0x87, 0x43},
474 {0x06, 0x9e, 0x44},
475 {0x06, 0xb1, 0x45},
476 {0x06, 0xbf, 0x46},
477 {0x06, 0xcc, 0x47},
478 {0x06, 0xd5, 0x48},
479 {0x06, 0xdd, 0x49},
480 {0x06, 0xe3, 0x4a},
481 {0x06, 0xe8, 0x4b},
482 {0x06, 0xed, 0x4c},
483 {0x06, 0xf2, 0x4d},
484 {0x06, 0xf7, 0x4e},
485 {0x06, 0xfc, 0x4f},
486 {0x06, 0xff, 0x50},
487
488 {0x05, 0x01, 0xc0},
489 {0x05, 0x10, 0xcb},
490 {0x05, 0x40, 0xc1},
491 {0x05, 0x04, 0xc2},
492 {0x05, 0x00, 0xca},
493 {0x05, 0x40, 0xc1},
494 {0x05, 0x09, 0xc2},
495 {0x05, 0x00, 0xca},
496 {0x05, 0xc0, 0xc1},
497 {0x05, 0x09, 0xc2},
498 {0x05, 0x00, 0xca},
499 {0x05, 0x40, 0xc1},
500 {0x05, 0x59, 0xc2},
501 {0x05, 0x00, 0xca},
502 {0x04, 0x00, 0x01},
503 {0x05, 0x80, 0xc1},
504 {0x05, 0xec, 0xc2},
505 {0x05, 0x0, 0xca},
506
507 {0x06, 0x02, 0x57},
508 {0x06, 0x01, 0x58},
509 {0x06, 0x15, 0x59},
510 {0x06, 0x0a, 0x5a},
511 {0x06, 0x01, 0x57},
512 {0x06, 0x8a, 0x03},
513 {0x06, 0x0a, 0x6c},
514 {0x06, 0x30, 0x01},
515 {0x06, 0x20, 0x02},
516 {0x06, 0x00, 0x03},
517
518 {0x05, 0x8c, 0x25},
519
520 {0x06, 0x4d, 0x51}, /* maybe saturation (4d) */
521 {0x06, 0x84, 0x53}, /* making green (84) */
522 {0x06, 0x00, 0x57}, /* sharpness (1) */
523 {0x06, 0x18, 0x08},
524 {0x06, 0xfc, 0x09},
525 {0x06, 0xfc, 0x0a},
526 {0x06, 0xfc, 0x0b},
527 {0x06, 0x18, 0x0c}, /* maybe hue (18) */
528 {0x06, 0xfc, 0x0d},
529 {0x06, 0xfc, 0x0e},
530 {0x06, 0xfc, 0x0f},
531 {0x06, 0x18, 0x10}, /* maybe contrast (18) */
532
533 {0x05, 0x01, 0x02},
534
535 {0x04, 0x00, 0x08}, /* compression */
536 {0x04, 0x12, 0x09},
537 {0x04, 0x21, 0x0a},
538 {0x04, 0x10, 0x0b},
539 {0x04, 0x21, 0x0c},
540 {0x04, 0x1d, 0x00}, /* imagetype (1d) */
541 {0x04, 0x41, 0x01}, /* hardware snapcontrol */
542
543 {0x04, 0x00, 0x04},
544 {0x04, 0x00, 0x05},
545 {0x04, 0x10, 0x06},
546 {0x04, 0x10, 0x07},
547 {0x04, 0x40, 0x06},
548 {0x04, 0x40, 0x07},
549 {0x04, 0x00, 0x04},
550 {0x04, 0x00, 0x05},
551
552 {0x06, 0x1c, 0x17},
553 {0x06, 0xe2, 0x19},
554 {0x06, 0x1c, 0x1b},
555 {0x06, 0xe2, 0x1d},
556 {0x06, 0x5f, 0x1f},
557 {0x06, 0x32, 0x20},
558
Jean-Francois Moine92e8c912009-02-02 16:25:38 -0300559 {0x05, initial_brightness >> 6, 0x00},
560 {0x05, (initial_brightness << 2) & 0xff, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300561 {0x05, 0x06, 0xc1},
562 {0x05, 0x58, 0xc2},
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300563 {0x05, 0x00, 0xca},
564 {0x05, 0x00, 0x11},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300565 {}
566};
567
568static int reg_write(struct usb_device *dev,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300569 u16 req, u16 index, u16 value)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300570{
571 int ret;
572
573 ret = usb_control_msg(dev,
574 usb_sndctrlpipe(dev, 0),
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300575 req,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300576 USB_TYPE_VENDOR | USB_RECIP_DEVICE,
577 value, index, NULL, 0, 500);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300578 PDEBUG(D_USBO, "reg write: 0x%02x,0x%02x:0x%02x, %d",
579 req, index, value, ret);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300580 if (ret < 0)
Jean-François Moine0b656322010-09-13 05:19:58 -0300581 err("reg write: error %d", ret);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300582 return ret;
583}
584
585/* returns: negative is error, pos or zero is data */
Jean-Francois Moine739570b2008-07-14 09:38:29 -0300586static int reg_read(struct gspca_dev *gspca_dev,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300587 u16 req, /* bRequest */
588 u16 index) /* wIndex */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300589{
590 int ret;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300591
Jean-Francois Moine739570b2008-07-14 09:38:29 -0300592 ret = usb_control_msg(gspca_dev->dev,
593 usb_rcvctrlpipe(gspca_dev->dev, 0),
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300594 req,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300595 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300596 0, /* value */
597 index,
598 gspca_dev->usb_buf, 2,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300599 500); /* timeout */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300600 if (ret < 0)
601 return ret;
Jean-Francois Moine739570b2008-07-14 09:38:29 -0300602 return (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0];
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300603}
604
605static int write_vector(struct gspca_dev *gspca_dev,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300606 const u8 data[][3])
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300607{
608 struct usb_device *dev = gspca_dev->dev;
609 int ret, i = 0;
610
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300611 while (data[i][0] != 0) {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300612 ret = reg_write(dev, data[i][0], data[i][2], data[i][1]);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300613 if (ret < 0)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300614 return ret;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300615 i++;
616 }
617 return 0;
618}
619
620/* this function is called at probe time */
621static int sd_config(struct gspca_dev *gspca_dev,
622 const struct usb_device_id *id)
623{
624 struct sd *sd = (struct sd *) gspca_dev;
625 struct cam *cam;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300626
627 cam = &gspca_dev->cam;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300628 cam->cam_mode = vga_mode;
Jean-Francois Moine9d64fdb2008-07-25 08:53:03 -0300629 sd->subtype = id->driver_info;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300630 if (sd->subtype != IntelPCCameraPro)
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300631 cam->nmodes = ARRAY_SIZE(vga_mode);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300632 else /* no 640x480 for IntelPCCameraPro */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300633 cam->nmodes = ARRAY_SIZE(vga_mode) - 1;
634 sd->brightness = BRIGHTNESS_DEF;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300635
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300636 return 0;
637}
638
Jean-Francois Moine012d6b02008-09-03 17:12:16 -0300639/* this function is called at probe and resume time */
640static int sd_init(struct gspca_dev *gspca_dev)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300641{
Jean-Francois Moine253f13d2009-05-29 04:46:12 -0300642 struct sd *sd = (struct sd *) gspca_dev;
643
644 if (write_vector(gspca_dev,
645 sd->subtype == Nxultra
646 ? spca505b_init_data
647 : spca505_init_data))
648 return -EIO;
Jean-Francois Moine1de1ddf2009-01-24 15:42:50 -0300649 return 0;
650}
651
652static void setbrightness(struct gspca_dev *gspca_dev)
653{
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300654 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moine1de1ddf2009-01-24 15:42:50 -0300655 u8 brightness = sd->brightness;
656
657 reg_write(gspca_dev->dev, 0x05, 0x00, (255 - brightness) >> 6);
658 reg_write(gspca_dev->dev, 0x05, 0x01, (255 - brightness) << 2);
659}
660
661static int sd_start(struct gspca_dev *gspca_dev)
662{
663 struct sd *sd = (struct sd *) gspca_dev;
664 struct usb_device *dev = gspca_dev->dev;
665 int ret, mode;
666 static u8 mode_tb[][3] = {
667 /* r00 r06 r07 */
668 {0x00, 0x10, 0x10}, /* 640x480 */
669 {0x01, 0x1a, 0x1a}, /* 352x288 */
670 {0x02, 0x1c, 0x1d}, /* 320x240 */
671 {0x04, 0x34, 0x34}, /* 176x144 */
672 {0x05, 0x40, 0x40} /* 160x120 */
673 };
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300674
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300675 if (sd->subtype == Nxultra)
676 write_vector(gspca_dev, spca505b_open_data_ccd);
677 else
678 write_vector(gspca_dev, spca505_open_data_ccd);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300679 ret = reg_read(gspca_dev, 0x06, 0x16);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300680
681 if (ret < 0) {
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300682 PDEBUG(D_ERR|D_CONF,
683 "register read failed err: %d",
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300684 ret);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300685 return ret;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300686 }
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300687 if (ret != 0x0101) {
Jean-François Moine0b656322010-09-13 05:19:58 -0300688 err("After vector read returns 0x%04x should be 0x0101",
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300689 ret);
690 }
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300691
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300692 ret = reg_write(gspca_dev->dev, 0x06, 0x16, 0x0a);
693 if (ret < 0)
694 return ret;
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -0300695 reg_write(gspca_dev->dev, 0x05, 0xc2, 0x12);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300696
697 /* necessary because without it we can see stream
698 * only once after loading module */
699 /* stopping usb registers Tomasz change */
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -0300700 reg_write(dev, 0x02, 0x00, 0x00);
701
702 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
703 reg_write(dev, SPCA50X_REG_COMPRESS, 0x00, mode_tb[mode][0]);
704 reg_write(dev, SPCA50X_REG_COMPRESS, 0x06, mode_tb[mode][1]);
705 reg_write(dev, SPCA50X_REG_COMPRESS, 0x07, mode_tb[mode][2]);
706
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300707 ret = reg_write(dev, SPCA50X_REG_USB,
708 SPCA50X_USB_CTRL,
709 SPCA50X_CUSB_ENABLE);
710
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -0300711 setbrightness(gspca_dev);
712
Jean-Francois Moine72ab97c2008-09-20 06:39:08 -0300713 return ret;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300714}
715
716static void sd_stopN(struct gspca_dev *gspca_dev)
717{
718 /* Disable ISO packet machine */
719 reg_write(gspca_dev->dev, 0x02, 0x00, 0x00);
720}
721
Jean-Francois Moine98522a72008-11-18 06:33:08 -0300722/* called on streamoff with alt 0 and on disconnect */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300723static void sd_stop0(struct gspca_dev *gspca_dev)
724{
Jean-Francois Moine98522a72008-11-18 06:33:08 -0300725 if (!gspca_dev->present)
726 return;
727
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300728 /* This maybe reset or power control */
729 reg_write(gspca_dev->dev, 0x03, 0x03, 0x20);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300730 reg_write(gspca_dev->dev, 0x03, 0x01, 0x00);
731 reg_write(gspca_dev->dev, 0x03, 0x00, 0x01);
732 reg_write(gspca_dev->dev, 0x05, 0x10, 0x01);
733 reg_write(gspca_dev->dev, 0x05, 0x11, 0x0f);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300734}
735
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300736static void sd_pkt_scan(struct gspca_dev *gspca_dev,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300737 u8 *data, /* isoc packet */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300738 int len) /* iso packet length */
739{
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300740 switch (data[0]) {
741 case 0: /* start of frame */
Jean-Francois Moine76dd2722009-11-13 09:21:03 -0300742 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300743 data += SPCA50X_OFFSET_DATA;
744 len -= SPCA50X_OFFSET_DATA;
Jean-Francois Moine76dd2722009-11-13 09:21:03 -0300745 gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
Jean-Francois Moine1250ac62008-07-26 08:02:47 -0300746 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300747 case 0xff: /* drop */
Jean-Francois Moine1250ac62008-07-26 08:02:47 -0300748 break;
749 default:
750 data += 1;
751 len -= 1;
Jean-Francois Moine76dd2722009-11-13 09:21:03 -0300752 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
Jean-Francois Moine1250ac62008-07-26 08:02:47 -0300753 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300754 }
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300755}
756
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300757static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
758{
759 struct sd *sd = (struct sd *) gspca_dev;
760
761 sd->brightness = val;
762 if (gspca_dev->streaming)
763 setbrightness(gspca_dev);
764 return 0;
765}
766
767static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
768{
769 struct sd *sd = (struct sd *) gspca_dev;
770
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300771 *val = sd->brightness;
772 return 0;
773}
774
775/* sub-driver description */
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300776static const struct sd_desc sd_desc = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300777 .name = MODULE_NAME,
778 .ctrls = sd_ctrls,
779 .nctrls = ARRAY_SIZE(sd_ctrls),
780 .config = sd_config,
Jean-Francois Moine012d6b02008-09-03 17:12:16 -0300781 .init = sd_init,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300782 .start = sd_start,
783 .stopN = sd_stopN,
784 .stop0 = sd_stop0,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300785 .pkt_scan = sd_pkt_scan,
786};
787
788/* -- module initialisation -- */
Jean-François Moine95c967c2011-01-13 05:20:29 -0300789static const struct usb_device_id device_table[] = {
Jean-Francois Moine87581aa2008-07-26 14:30:01 -0300790 {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra},
791 {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro},
Jean-Francois Moine9d64fdb2008-07-25 08:53:03 -0300792/*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300793 {}
794};
795MODULE_DEVICE_TABLE(usb, device_table);
796
797/* -- device connect -- */
798static int sd_probe(struct usb_interface *intf,
799 const struct usb_device_id *id)
800{
Jean-Francois Moine956e42d2008-07-01 10:03:42 -0300801 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300802 THIS_MODULE);
803}
804
805static struct usb_driver sd_driver = {
806 .name = MODULE_NAME,
807 .id_table = device_table,
808 .probe = sd_probe,
809 .disconnect = gspca_disconnect,
Jean-Francois Moine6a709742008-09-03 16:48:10 -0300810#ifdef CONFIG_PM
811 .suspend = gspca_suspend,
812 .resume = gspca_resume,
813#endif
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300814};
815
816/* -- module insert / remove -- */
817static int __init sd_mod_init(void)
818{
Jean-François Moine54826432010-09-13 04:53:03 -0300819 return usb_register(&sd_driver);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300820}
821static void __exit sd_mod_exit(void)
822{
823 usb_deregister(&sd_driver);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300824}
825
826module_init(sd_mod_init);
827module_exit(sd_mod_exit);