blob: 232b330d2dd3717c493e1b9aebd218fff9ad9f58 [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
Joe Perches133a9fe2011-08-21 19:56:57 -030022#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030024#define MODULE_NAME "spca505"
25
26#include "gspca.h"
27
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030028MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver");
30MODULE_LICENSE("GPL");
31
32/* specific webcam descriptor */
33struct sd {
34 struct gspca_dev gspca_dev; /* !! must be the first item */
35
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
Jean-Francois Moinecc611b82008-12-29 07:49:41 -030041static const struct v4l2_pix_format vga_mode[] = {
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030042 {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030043 .bytesperline = 160,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030044 .sizeimage = 160 * 120 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030045 .colorspace = V4L2_COLORSPACE_SRGB,
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -030046 .priv = 4},
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030047 {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030048 .bytesperline = 176,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030049 .sizeimage = 176 * 144 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030050 .colorspace = V4L2_COLORSPACE_SRGB,
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -030051 .priv = 3},
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030052 {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030053 .bytesperline = 320,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030054 .sizeimage = 320 * 240 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030055 .colorspace = V4L2_COLORSPACE_SRGB,
56 .priv = 2},
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030057 {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030058 .bytesperline = 352,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030059 .sizeimage = 352 * 288 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030060 .colorspace = V4L2_COLORSPACE_SRGB,
61 .priv = 1},
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030062 {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
Jean-Francois Moine00b27ce2008-07-30 05:47:54 -030063 .bytesperline = 640,
Jean-Francois Moine1250ac62008-07-26 08:02:47 -030064 .sizeimage = 640 * 480 * 3 / 2,
Jean-Francois Moinec2446b32008-07-05 11:49:20 -030065 .colorspace = V4L2_COLORSPACE_SRGB,
66 .priv = 0},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030067};
68
69#define SPCA50X_OFFSET_DATA 10
70
71#define SPCA50X_REG_USB 0x02 /* spca505 501 */
72
73#define SPCA50X_USB_CTRL 0x00 /* spca505 */
74#define SPCA50X_CUSB_ENABLE 0x01 /* spca505 */
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -030075
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030076#define SPCA50X_REG_GLOBAL 0x03 /* spca505 */
77#define SPCA50X_GMISC0_IDSEL 0x01 /* Global control device ID select spca505 */
78#define SPCA50X_GLOBAL_MISC0 0x00 /* Global control miscellaneous 0 spca505 */
79
80#define SPCA50X_GLOBAL_MISC1 0x01 /* 505 */
81#define SPCA50X_GLOBAL_MISC3 0x03 /* 505 */
82#define SPCA50X_GMISC3_SAA7113RST 0x20 /* Not sure about this one spca505 */
83
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -030084/* Image format and compression control */
85#define SPCA50X_REG_COMPRESS 0x04
86
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030087/*
88 * Data to initialize a SPCA505. Common to the CCD and external modes
89 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -030090static const u8 spca505_init_data[][3] = {
91 /* bmRequest,value,index */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030092 {SPCA50X_REG_GLOBAL, SPCA50X_GMISC3_SAA7113RST, SPCA50X_GLOBAL_MISC3},
93 /* Sensor reset */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -030094 {SPCA50X_REG_GLOBAL, 0x00, SPCA50X_GLOBAL_MISC3},
95 {SPCA50X_REG_GLOBAL, 0x00, SPCA50X_GLOBAL_MISC1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030096 /* Block USB reset */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -030097 {SPCA50X_REG_GLOBAL, SPCA50X_GMISC0_IDSEL, SPCA50X_GLOBAL_MISC0},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -030098
Jean-Francois Moine16631aed2009-01-22 14:56:42 -030099 {0x05, 0x01, 0x10},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300100 /* Maybe power down some stuff */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300101 {0x05, 0x0f, 0x11},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300102
103 /* Setup internal CCD ? */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300104 {0x06, 0x10, 0x08},
105 {0x06, 0x00, 0x09},
106 {0x06, 0x00, 0x0a},
107 {0x06, 0x00, 0x0b},
108 {0x06, 0x10, 0x0c},
109 {0x06, 0x00, 0x0d},
110 {0x06, 0x00, 0x0e},
111 {0x06, 0x00, 0x0f},
112 {0x06, 0x10, 0x10},
113 {0x06, 0x02, 0x11},
114 {0x06, 0x00, 0x12},
115 {0x06, 0x04, 0x13},
116 {0x06, 0x02, 0x14},
117 {0x06, 0x8a, 0x51},
118 {0x06, 0x40, 0x52},
119 {0x06, 0xb6, 0x53},
120 {0x06, 0x3d, 0x54},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300121 {}
122};
123
124/*
125 * Data to initialize the camera using the internal CCD
126 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300127static const u8 spca505_open_data_ccd[][3] = {
128 /* bmRequest,value,index */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300129 /* Internal CCD data set */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300130 {0x03, 0x04, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300131 /* This could be a reset */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300132 {0x03, 0x00, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300133
134 /* Setup compression and image registers. 0x6 and 0x7 seem to be
135 related to H&V hold, and are resolution mode specific */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300136 {0x04, 0x10, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300137 /* DIFF(0x50), was (0x10) */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300138 {0x04, 0x00, 0x04},
139 {0x04, 0x00, 0x05},
140 {0x04, 0x20, 0x06},
141 {0x04, 0x20, 0x07},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300142
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300143 {0x08, 0x0a, 0x00},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300144 /* DIFF (0x4a), was (0xa) */
145
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300146 {0x05, 0x00, 0x10},
147 {0x05, 0x00, 0x11},
148 {0x05, 0x00, 0x00},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300149 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300150 {0x05, 0x00, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300151 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300152 {0x05, 0x00, 0x02},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300153 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300154 {0x05, 0x00, 0x03},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300155 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300156 {0x05, 0x00, 0x04},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300157 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300158 {0x05, 0x80, 0x05},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300159 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300160 {0x05, 0xe0, 0x06},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300161 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300162 {0x05, 0x20, 0x07},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300163 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300164 {0x05, 0xa0, 0x08},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300165 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300166 {0x05, 0x0, 0x12},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300167 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300168 {0x05, 0x02, 0x0f},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300169 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300170 {0x05, 0x10, 0x46},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300171 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300172 {0x05, 0x8, 0x4a},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300173 /* DIFF not written */
174
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300175 {0x03, 0x08, 0x03},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300176 /* DIFF (0x3,0x28,0x3) */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300177 {0x03, 0x08, 0x01},
178 {0x03, 0x0c, 0x03},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300179 /* DIFF not written */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300180 {0x03, 0x21, 0x00},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300181 /* DIFF (0x39) */
182
183/* Extra block copied from init to hopefully ensure CCD is in a sane state */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300184 {0x06, 0x10, 0x08},
185 {0x06, 0x00, 0x09},
186 {0x06, 0x00, 0x0a},
187 {0x06, 0x00, 0x0b},
188 {0x06, 0x10, 0x0c},
189 {0x06, 0x00, 0x0d},
190 {0x06, 0x00, 0x0e},
191 {0x06, 0x00, 0x0f},
192 {0x06, 0x10, 0x10},
193 {0x06, 0x02, 0x11},
194 {0x06, 0x00, 0x12},
195 {0x06, 0x04, 0x13},
196 {0x06, 0x02, 0x14},
197 {0x06, 0x8a, 0x51},
198 {0x06, 0x40, 0x52},
199 {0x06, 0xb6, 0x53},
200 {0x06, 0x3d, 0x54},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300201 /* End of extra block */
202
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300203 {0x06, 0x3f, 0x1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300204 /* Block skipped */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300205 {0x06, 0x10, 0x02},
206 {0x06, 0x64, 0x07},
207 {0x06, 0x10, 0x08},
208 {0x06, 0x00, 0x09},
209 {0x06, 0x00, 0x0a},
210 {0x06, 0x00, 0x0b},
211 {0x06, 0x10, 0x0c},
212 {0x06, 0x00, 0x0d},
213 {0x06, 0x00, 0x0e},
214 {0x06, 0x00, 0x0f},
215 {0x06, 0x10, 0x10},
216 {0x06, 0x02, 0x11},
217 {0x06, 0x00, 0x12},
218 {0x06, 0x04, 0x13},
219 {0x06, 0x02, 0x14},
220 {0x06, 0x8a, 0x51},
221 {0x06, 0x40, 0x52},
222 {0x06, 0xb6, 0x53},
223 {0x06, 0x3d, 0x54},
224 {0x06, 0x60, 0x57},
225 {0x06, 0x20, 0x58},
226 {0x06, 0x15, 0x59},
227 {0x06, 0x05, 0x5a},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300228
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300229 {0x05, 0x01, 0xc0},
230 {0x05, 0x10, 0xcb},
231 {0x05, 0x80, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300232 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300233 {0x05, 0x0, 0xc2},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300234 /* 4 was 0 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300235 {0x05, 0x00, 0xca},
236 {0x05, 0x80, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300237 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300238 {0x05, 0x04, 0xc2},
239 {0x05, 0x00, 0xca},
240 {0x05, 0x0, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300241 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300242 {0x05, 0x00, 0xc2},
243 {0x05, 0x00, 0xca},
244 {0x05, 0x40, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300245 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300246 {0x05, 0x17, 0xc2},
247 {0x05, 0x00, 0xca},
248 {0x05, 0x80, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300249 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300250 {0x05, 0x06, 0xc2},
251 {0x05, 0x00, 0xca},
252 {0x05, 0x80, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300253 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300254 {0x05, 0x04, 0xc2},
255 {0x05, 0x00, 0xca},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300256
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300257 {0x03, 0x4c, 0x3},
258 {0x03, 0x18, 0x1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300259
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300260 {0x06, 0x70, 0x51},
261 {0x06, 0xbe, 0x53},
262 {0x06, 0x71, 0x57},
263 {0x06, 0x20, 0x58},
264 {0x06, 0x05, 0x59},
265 {0x06, 0x15, 0x5a},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300266
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300267 {0x04, 0x00, 0x08},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300268 /* Compress = OFF (0x1 to turn on) */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300269 {0x04, 0x12, 0x09},
270 {0x04, 0x21, 0x0a},
271 {0x04, 0x10, 0x0b},
272 {0x04, 0x21, 0x0c},
273 {0x04, 0x05, 0x00},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300274 /* was 5 (Image Type ? ) */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300275 {0x04, 0x00, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300276
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300277 {0x06, 0x3f, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300278
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300279 {0x04, 0x00, 0x04},
280 {0x04, 0x00, 0x05},
281 {0x04, 0x40, 0x06},
282 {0x04, 0x40, 0x07},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300283
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300284 {0x06, 0x1c, 0x17},
285 {0x06, 0xe2, 0x19},
286 {0x06, 0x1c, 0x1b},
287 {0x06, 0xe2, 0x1d},
288 {0x06, 0xaa, 0x1f},
289 {0x06, 0x70, 0x20},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300290
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300291 {0x05, 0x01, 0x10},
292 {0x05, 0x00, 0x11},
293 {0x05, 0x01, 0x00},
294 {0x05, 0x05, 0x01},
295 {0x05, 0x00, 0xc1},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300296 /* */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300297 {0x05, 0x00, 0xc2},
298 {0x05, 0x00, 0xca},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300299
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300300 {0x06, 0x70, 0x51},
301 {0x06, 0xbe, 0x53},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300302 {}
303};
304
305/*
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300306 * Made by Tomasz Zablocki (skalamandra@poczta.onet.pl)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300307 * SPCA505b chip based cameras initialization data
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300308 */
309/* jfm */
310#define initial_brightness 0x7f /* 0x0(white)-0xff(black) */
311/* #define initial_brightness 0x0 //0x0(white)-0xff(black) */
312/*
313 * Data to initialize a SPCA505. Common to the CCD and external modes
314 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300315static const u8 spca505b_init_data[][3] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300316/* start */
317 {0x02, 0x00, 0x00}, /* init */
318 {0x02, 0x00, 0x01},
319 {0x02, 0x00, 0x02},
320 {0x02, 0x00, 0x03},
321 {0x02, 0x00, 0x04},
322 {0x02, 0x00, 0x05},
323 {0x02, 0x00, 0x06},
324 {0x02, 0x00, 0x07},
325 {0x02, 0x00, 0x08},
326 {0x02, 0x00, 0x09},
327 {0x03, 0x00, 0x00},
328 {0x03, 0x00, 0x01},
329 {0x03, 0x00, 0x02},
330 {0x03, 0x00, 0x03},
331 {0x03, 0x00, 0x04},
332 {0x03, 0x00, 0x05},
333 {0x03, 0x00, 0x06},
334 {0x04, 0x00, 0x00},
335 {0x04, 0x00, 0x02},
336 {0x04, 0x00, 0x04},
337 {0x04, 0x00, 0x05},
338 {0x04, 0x00, 0x06},
339 {0x04, 0x00, 0x07},
340 {0x04, 0x00, 0x08},
341 {0x04, 0x00, 0x09},
342 {0x04, 0x00, 0x0a},
343 {0x04, 0x00, 0x0b},
344 {0x04, 0x00, 0x0c},
345 {0x07, 0x00, 0x00},
346 {0x07, 0x00, 0x03},
347 {0x08, 0x00, 0x00},
348 {0x08, 0x00, 0x01},
349 {0x08, 0x00, 0x02},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300350 {0x06, 0x18, 0x08},
351 {0x06, 0xfc, 0x09},
352 {0x06, 0xfc, 0x0a},
353 {0x06, 0xfc, 0x0b},
354 {0x06, 0x18, 0x0c},
355 {0x06, 0xfc, 0x0d},
356 {0x06, 0xfc, 0x0e},
357 {0x06, 0xfc, 0x0f},
358 {0x06, 0x18, 0x10},
359 {0x06, 0xfe, 0x12},
360 {0x06, 0x00, 0x11},
361 {0x06, 0x00, 0x14},
362 {0x06, 0x00, 0x13},
363 {0x06, 0x28, 0x51},
364 {0x06, 0xff, 0x53},
365 {0x02, 0x00, 0x08},
366
367 {0x03, 0x00, 0x03},
368 {0x03, 0x10, 0x03},
369 {}
370};
371
372/*
373 * Data to initialize the camera using the internal CCD
374 */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300375static const u8 spca505b_open_data_ccd[][3] = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300376
377/* {0x02,0x00,0x00}, */
378 {0x03, 0x04, 0x01}, /* rst */
379 {0x03, 0x00, 0x01},
380 {0x03, 0x00, 0x00},
381 {0x03, 0x21, 0x00},
382 {0x03, 0x00, 0x04},
383 {0x03, 0x00, 0x03},
384 {0x03, 0x18, 0x03},
385 {0x03, 0x08, 0x01},
386 {0x03, 0x1c, 0x03},
387 {0x03, 0x5c, 0x03},
388 {0x03, 0x5c, 0x03},
389 {0x03, 0x18, 0x01},
390
391/* same as 505 */
392 {0x04, 0x10, 0x01},
393 {0x04, 0x00, 0x04},
394 {0x04, 0x00, 0x05},
395 {0x04, 0x20, 0x06},
396 {0x04, 0x20, 0x07},
397
398 {0x08, 0x0a, 0x00},
399
400 {0x05, 0x00, 0x10},
401 {0x05, 0x00, 0x11},
402 {0x05, 0x00, 0x12},
403 {0x05, 0x6f, 0x00},
Jean-Francois Moine92e8c912009-02-02 16:25:38 -0300404 {0x05, initial_brightness >> 6, 0x00},
405 {0x05, (initial_brightness << 2) & 0xff, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300406 {0x05, 0x00, 0x02},
407 {0x05, 0x01, 0x03},
408 {0x05, 0x00, 0x04},
409 {0x05, 0x03, 0x05},
410 {0x05, 0xe0, 0x06},
411 {0x05, 0x20, 0x07},
412 {0x05, 0xa0, 0x08},
413 {0x05, 0x00, 0x12},
414 {0x05, 0x02, 0x0f},
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300415 {0x05, 0x80, 0x14}, /* max exposure off (0=on) */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300416 {0x05, 0x01, 0xb0},
417 {0x05, 0x01, 0xbf},
418 {0x03, 0x02, 0x06},
419 {0x05, 0x10, 0x46},
420 {0x05, 0x08, 0x4a},
421
422 {0x06, 0x00, 0x01},
423 {0x06, 0x10, 0x02},
424 {0x06, 0x64, 0x07},
425 {0x06, 0x18, 0x08},
426 {0x06, 0xfc, 0x09},
427 {0x06, 0xfc, 0x0a},
428 {0x06, 0xfc, 0x0b},
429 {0x04, 0x00, 0x01},
430 {0x06, 0x18, 0x0c},
431 {0x06, 0xfc, 0x0d},
432 {0x06, 0xfc, 0x0e},
433 {0x06, 0xfc, 0x0f},
434 {0x06, 0x11, 0x10}, /* contrast */
435 {0x06, 0x00, 0x11},
436 {0x06, 0xfe, 0x12},
437 {0x06, 0x00, 0x13},
438 {0x06, 0x00, 0x14},
439 {0x06, 0x9d, 0x51},
440 {0x06, 0x40, 0x52},
441 {0x06, 0x7c, 0x53},
442 {0x06, 0x40, 0x54},
443 {0x06, 0x02, 0x57},
444 {0x06, 0x03, 0x58},
445 {0x06, 0x15, 0x59},
446 {0x06, 0x05, 0x5a},
447 {0x06, 0x03, 0x56},
448 {0x06, 0x02, 0x3f},
449 {0x06, 0x00, 0x40},
450 {0x06, 0x39, 0x41},
451 {0x06, 0x69, 0x42},
452 {0x06, 0x87, 0x43},
453 {0x06, 0x9e, 0x44},
454 {0x06, 0xb1, 0x45},
455 {0x06, 0xbf, 0x46},
456 {0x06, 0xcc, 0x47},
457 {0x06, 0xd5, 0x48},
458 {0x06, 0xdd, 0x49},
459 {0x06, 0xe3, 0x4a},
460 {0x06, 0xe8, 0x4b},
461 {0x06, 0xed, 0x4c},
462 {0x06, 0xf2, 0x4d},
463 {0x06, 0xf7, 0x4e},
464 {0x06, 0xfc, 0x4f},
465 {0x06, 0xff, 0x50},
466
467 {0x05, 0x01, 0xc0},
468 {0x05, 0x10, 0xcb},
469 {0x05, 0x40, 0xc1},
470 {0x05, 0x04, 0xc2},
471 {0x05, 0x00, 0xca},
472 {0x05, 0x40, 0xc1},
473 {0x05, 0x09, 0xc2},
474 {0x05, 0x00, 0xca},
475 {0x05, 0xc0, 0xc1},
476 {0x05, 0x09, 0xc2},
477 {0x05, 0x00, 0xca},
478 {0x05, 0x40, 0xc1},
479 {0x05, 0x59, 0xc2},
480 {0x05, 0x00, 0xca},
481 {0x04, 0x00, 0x01},
482 {0x05, 0x80, 0xc1},
483 {0x05, 0xec, 0xc2},
484 {0x05, 0x0, 0xca},
485
486 {0x06, 0x02, 0x57},
487 {0x06, 0x01, 0x58},
488 {0x06, 0x15, 0x59},
489 {0x06, 0x0a, 0x5a},
490 {0x06, 0x01, 0x57},
491 {0x06, 0x8a, 0x03},
492 {0x06, 0x0a, 0x6c},
493 {0x06, 0x30, 0x01},
494 {0x06, 0x20, 0x02},
495 {0x06, 0x00, 0x03},
496
497 {0x05, 0x8c, 0x25},
498
499 {0x06, 0x4d, 0x51}, /* maybe saturation (4d) */
500 {0x06, 0x84, 0x53}, /* making green (84) */
501 {0x06, 0x00, 0x57}, /* sharpness (1) */
502 {0x06, 0x18, 0x08},
503 {0x06, 0xfc, 0x09},
504 {0x06, 0xfc, 0x0a},
505 {0x06, 0xfc, 0x0b},
506 {0x06, 0x18, 0x0c}, /* maybe hue (18) */
507 {0x06, 0xfc, 0x0d},
508 {0x06, 0xfc, 0x0e},
509 {0x06, 0xfc, 0x0f},
510 {0x06, 0x18, 0x10}, /* maybe contrast (18) */
511
512 {0x05, 0x01, 0x02},
513
514 {0x04, 0x00, 0x08}, /* compression */
515 {0x04, 0x12, 0x09},
516 {0x04, 0x21, 0x0a},
517 {0x04, 0x10, 0x0b},
518 {0x04, 0x21, 0x0c},
519 {0x04, 0x1d, 0x00}, /* imagetype (1d) */
520 {0x04, 0x41, 0x01}, /* hardware snapcontrol */
521
522 {0x04, 0x00, 0x04},
523 {0x04, 0x00, 0x05},
524 {0x04, 0x10, 0x06},
525 {0x04, 0x10, 0x07},
526 {0x04, 0x40, 0x06},
527 {0x04, 0x40, 0x07},
528 {0x04, 0x00, 0x04},
529 {0x04, 0x00, 0x05},
530
531 {0x06, 0x1c, 0x17},
532 {0x06, 0xe2, 0x19},
533 {0x06, 0x1c, 0x1b},
534 {0x06, 0xe2, 0x1d},
535 {0x06, 0x5f, 0x1f},
536 {0x06, 0x32, 0x20},
537
Jean-Francois Moine92e8c912009-02-02 16:25:38 -0300538 {0x05, initial_brightness >> 6, 0x00},
539 {0x05, (initial_brightness << 2) & 0xff, 0x01},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300540 {0x05, 0x06, 0xc1},
541 {0x05, 0x58, 0xc2},
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300542 {0x05, 0x00, 0xca},
543 {0x05, 0x00, 0x11},
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300544 {}
545};
546
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300547static int reg_write(struct gspca_dev *gspca_dev,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300548 u16 req, u16 index, u16 value)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300549{
550 int ret;
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300551 struct usb_device *dev = gspca_dev->dev;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300552
553 ret = usb_control_msg(dev,
554 usb_sndctrlpipe(dev, 0),
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300555 req,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300556 USB_TYPE_VENDOR | USB_RECIP_DEVICE,
557 value, index, NULL, 0, 500);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300558 PDEBUG(D_USBO, "reg write: 0x%02x,0x%02x:0x%02x, %d",
559 req, index, value, ret);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300560 if (ret < 0)
Joe Perches133a9fe2011-08-21 19:56:57 -0300561 pr_err("reg write: error %d\n", ret);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300562 return ret;
563}
564
565/* returns: negative is error, pos or zero is data */
Jean-Francois Moine739570b2008-07-14 09:38:29 -0300566static int reg_read(struct gspca_dev *gspca_dev,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300567 u16 req, /* bRequest */
568 u16 index) /* wIndex */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300569{
570 int ret;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300571
Jean-Francois Moine739570b2008-07-14 09:38:29 -0300572 ret = usb_control_msg(gspca_dev->dev,
573 usb_rcvctrlpipe(gspca_dev->dev, 0),
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300574 req,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300575 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300576 0, /* value */
577 index,
578 gspca_dev->usb_buf, 2,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300579 500); /* timeout */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300580 if (ret < 0)
581 return ret;
Jean-Francois Moine739570b2008-07-14 09:38:29 -0300582 return (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0];
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300583}
584
585static int write_vector(struct gspca_dev *gspca_dev,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300586 const u8 data[][3])
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300587{
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300588 int ret, i = 0;
589
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300590 while (data[i][0] != 0) {
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300591 ret = reg_write(gspca_dev, data[i][0], data[i][2],
592 data[i][1]);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300593 if (ret < 0)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300594 return ret;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300595 i++;
596 }
597 return 0;
598}
599
600/* this function is called at probe time */
601static int sd_config(struct gspca_dev *gspca_dev,
602 const struct usb_device_id *id)
603{
604 struct sd *sd = (struct sd *) gspca_dev;
605 struct cam *cam;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300606
607 cam = &gspca_dev->cam;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300608 cam->cam_mode = vga_mode;
Jean-Francois Moine9d64fdb2008-07-25 08:53:03 -0300609 sd->subtype = id->driver_info;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300610 if (sd->subtype != IntelPCCameraPro)
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300611 cam->nmodes = ARRAY_SIZE(vga_mode);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300612 else /* no 640x480 for IntelPCCameraPro */
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300613 cam->nmodes = ARRAY_SIZE(vga_mode) - 1;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300614
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300615 return 0;
616}
617
Jean-Francois Moine012d6b02008-09-03 17:12:16 -0300618/* this function is called at probe and resume time */
619static int sd_init(struct gspca_dev *gspca_dev)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300620{
Jean-Francois Moine253f13d2009-05-29 04:46:12 -0300621 struct sd *sd = (struct sd *) gspca_dev;
622
623 if (write_vector(gspca_dev,
624 sd->subtype == Nxultra
625 ? spca505b_init_data
626 : spca505_init_data))
627 return -EIO;
Jean-Francois Moine1de1ddf2009-01-24 15:42:50 -0300628 return 0;
629}
630
Hans Verkuil2aed6c12012-05-16 07:41:33 -0300631static void setbrightness(struct gspca_dev *gspca_dev, s32 brightness)
Jean-Francois Moine1de1ddf2009-01-24 15:42:50 -0300632{
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300633 reg_write(gspca_dev, 0x05, 0x00, (255 - brightness) >> 6);
634 reg_write(gspca_dev, 0x05, 0x01, (255 - brightness) << 2);
Jean-Francois Moine1de1ddf2009-01-24 15:42:50 -0300635}
636
637static int sd_start(struct gspca_dev *gspca_dev)
638{
639 struct sd *sd = (struct sd *) gspca_dev;
Jean-Francois Moine1de1ddf2009-01-24 15:42:50 -0300640 int ret, mode;
641 static u8 mode_tb[][3] = {
642 /* r00 r06 r07 */
643 {0x00, 0x10, 0x10}, /* 640x480 */
644 {0x01, 0x1a, 0x1a}, /* 352x288 */
645 {0x02, 0x1c, 0x1d}, /* 320x240 */
646 {0x04, 0x34, 0x34}, /* 176x144 */
647 {0x05, 0x40, 0x40} /* 160x120 */
648 };
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300649
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300650 if (sd->subtype == Nxultra)
651 write_vector(gspca_dev, spca505b_open_data_ccd);
652 else
653 write_vector(gspca_dev, spca505_open_data_ccd);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300654 ret = reg_read(gspca_dev, 0x06, 0x16);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300655
656 if (ret < 0) {
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300657 PERR("register read failed err: %d", ret);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300658 return ret;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300659 }
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300660 if (ret != 0x0101) {
Joe Perches133a9fe2011-08-21 19:56:57 -0300661 pr_err("After vector read returns 0x%04x should be 0x0101\n",
662 ret);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300663 }
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300664
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300665 ret = reg_write(gspca_dev, 0x06, 0x16, 0x0a);
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300666 if (ret < 0)
667 return ret;
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300668 reg_write(gspca_dev, 0x05, 0xc2, 0x12);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300669
670 /* necessary because without it we can see stream
671 * only once after loading module */
672 /* stopping usb registers Tomasz change */
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300673 reg_write(gspca_dev, 0x02, 0x00, 0x00);
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -0300674
675 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300676 reg_write(gspca_dev, SPCA50X_REG_COMPRESS, 0x00, mode_tb[mode][0]);
677 reg_write(gspca_dev, SPCA50X_REG_COMPRESS, 0x06, mode_tb[mode][1]);
678 reg_write(gspca_dev, SPCA50X_REG_COMPRESS, 0x07, mode_tb[mode][2]);
Jean-Francois Moinea5df5c12009-01-23 14:42:03 -0300679
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300680 return reg_write(gspca_dev, SPCA50X_REG_USB,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300681 SPCA50X_USB_CTRL,
682 SPCA50X_CUSB_ENABLE);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300683}
684
685static void sd_stopN(struct gspca_dev *gspca_dev)
686{
687 /* Disable ISO packet machine */
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300688 reg_write(gspca_dev, 0x02, 0x00, 0x00);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300689}
690
Jean-Francois Moine98522a72008-11-18 06:33:08 -0300691/* called on streamoff with alt 0 and on disconnect */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300692static void sd_stop0(struct gspca_dev *gspca_dev)
693{
Jean-Francois Moine98522a72008-11-18 06:33:08 -0300694 if (!gspca_dev->present)
695 return;
696
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300697 /* This maybe reset or power control */
Theodore Kilgorec93396e2013-02-04 13:17:55 -0300698 reg_write(gspca_dev, 0x03, 0x03, 0x20);
699 reg_write(gspca_dev, 0x03, 0x01, 0x00);
700 reg_write(gspca_dev, 0x03, 0x00, 0x01);
701 reg_write(gspca_dev, 0x05, 0x10, 0x01);
702 reg_write(gspca_dev, 0x05, 0x11, 0x0f);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300703}
704
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300705static void sd_pkt_scan(struct gspca_dev *gspca_dev,
Jean-Francois Moine16631aed2009-01-22 14:56:42 -0300706 u8 *data, /* isoc packet */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300707 int len) /* iso packet length */
708{
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300709 switch (data[0]) {
710 case 0: /* start of frame */
Jean-Francois Moine76dd2722009-11-13 09:21:03 -0300711 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300712 data += SPCA50X_OFFSET_DATA;
713 len -= SPCA50X_OFFSET_DATA;
Jean-Francois Moine76dd2722009-11-13 09:21:03 -0300714 gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
Jean-Francois Moine1250ac62008-07-26 08:02:47 -0300715 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300716 case 0xff: /* drop */
Jean-Francois Moine1250ac62008-07-26 08:02:47 -0300717 break;
718 default:
719 data += 1;
720 len -= 1;
Jean-Francois Moine76dd2722009-11-13 09:21:03 -0300721 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
Jean-Francois Moine1250ac62008-07-26 08:02:47 -0300722 break;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300723 }
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300724}
725
Hans Verkuil2aed6c12012-05-16 07:41:33 -0300726static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300727{
Hans Verkuil2aed6c12012-05-16 07:41:33 -0300728 struct gspca_dev *gspca_dev =
729 container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300730
Hans Verkuil2aed6c12012-05-16 07:41:33 -0300731 gspca_dev->usb_err = 0;
732
733 if (!gspca_dev->streaming)
734 return 0;
735
736 switch (ctrl->id) {
737 case V4L2_CID_BRIGHTNESS:
738 setbrightness(gspca_dev, ctrl->val);
739 break;
740 }
741 return gspca_dev->usb_err;
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300742}
743
Hans Verkuil2aed6c12012-05-16 07:41:33 -0300744static const struct v4l2_ctrl_ops sd_ctrl_ops = {
745 .s_ctrl = sd_s_ctrl,
746};
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300747
Hans Verkuil2aed6c12012-05-16 07:41:33 -0300748static int sd_init_controls(struct gspca_dev *gspca_dev)
749{
750 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
751
752 gspca_dev->vdev.ctrl_handler = hdl;
753 v4l2_ctrl_handler_init(hdl, 5);
754 v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
755 V4L2_CID_BRIGHTNESS, 0, 255, 1, 127);
756
757 if (hdl->error) {
758 pr_err("Could not initialize controls\n");
759 return hdl->error;
760 }
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300761 return 0;
762}
763
764/* sub-driver description */
Jean-Francois Moinea5ae2062008-07-04 11:16:16 -0300765static const struct sd_desc sd_desc = {
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300766 .name = MODULE_NAME,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300767 .config = sd_config,
Hans Verkuil2aed6c12012-05-16 07:41:33 -0300768 .init_controls = sd_init_controls,
Jean-Francois Moine012d6b02008-09-03 17:12:16 -0300769 .init = sd_init,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300770 .start = sd_start,
771 .stopN = sd_stopN,
772 .stop0 = sd_stop0,
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300773 .pkt_scan = sd_pkt_scan,
774};
775
776/* -- module initialisation -- */
Jean-François Moine95c967c2011-01-13 05:20:29 -0300777static const struct usb_device_id device_table[] = {
Jean-Francois Moine87581aa2008-07-26 14:30:01 -0300778 {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra},
779 {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro},
Jean-Francois Moine9d64fdb2008-07-25 08:53:03 -0300780/*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300781 {}
782};
783MODULE_DEVICE_TABLE(usb, device_table);
784
785/* -- device connect -- */
786static int sd_probe(struct usb_interface *intf,
787 const struct usb_device_id *id)
788{
Jean-Francois Moine956e42d2008-07-01 10:03:42 -0300789 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300790 THIS_MODULE);
791}
792
793static struct usb_driver sd_driver = {
794 .name = MODULE_NAME,
795 .id_table = device_table,
796 .probe = sd_probe,
797 .disconnect = gspca_disconnect,
Jean-Francois Moine6a709742008-09-03 16:48:10 -0300798#ifdef CONFIG_PM
799 .suspend = gspca_suspend,
800 .resume = gspca_resume,
Hans de Goede8bb58962012-06-30 06:44:47 -0300801 .reset_resume = gspca_resume,
Jean-Francois Moine6a709742008-09-03 16:48:10 -0300802#endif
Jean-Francois Moine6a7eba22008-06-30 15:50:11 -0300803};
804
Greg Kroah-Hartmanecb3b2b2011-11-18 09:46:12 -0800805module_usb_driver(sd_driver);