2 * SPCA508 chip based cameras subdriver
4 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
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
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.
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
21 #define MODULE_NAME "spca508"
25 MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
26 MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver");
27 MODULE_LICENSE("GPL");
29 /* specific webcam descriptor */
31 struct gspca_dev gspca_dev; /* !! must be the first item */
34 unsigned char tmpbuf[352 * 288 * 3 / 2]; /* YUVY per line */
35 unsigned char tmpbuf2[352 * 288 * 2]; /* YUYV */
37 unsigned char brightness;
40 #define CreativeVista 0
41 #define HamaUSBSightcam 1
42 #define HamaUSBSightcam2 2
43 #define IntelEasyPCCamera 3
44 #define MicroInnovationIC200 4
45 #define ViewQuestVQ110 5
48 /* V4L2 controls supported by the driver */
49 static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
50 static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
52 static struct ctrl sd_ctrls[] = {
55 .id = V4L2_CID_BRIGHTNESS,
56 .type = V4L2_CTRL_TYPE_INTEGER,
61 #define BRIGHTNESS_DEF 128
62 .default_value = BRIGHTNESS_DEF,
64 .set = sd_setbrightness,
65 .get = sd_getbrightness,
69 static struct v4l2_pix_format sif_mode[] = {
70 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
71 .bytesperline = 160 * 2,
72 .sizeimage = 160 * 120 * 2,
73 .colorspace = V4L2_COLORSPACE_SRGB,
75 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
76 .bytesperline = 176 * 2,
77 .sizeimage = 176 * 144 * 2,
78 .colorspace = V4L2_COLORSPACE_SRGB,
80 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
81 .bytesperline = 320 * 2,
82 .sizeimage = 320 * 240 * 2,
83 .colorspace = V4L2_COLORSPACE_SRGB,
85 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
86 .bytesperline = 352 * 2,
87 .sizeimage = 352 * 288 * 2,
88 .colorspace = V4L2_COLORSPACE_SRGB,
92 /* Frame packet header offsets for the spca508 */
93 #define SPCA508_OFFSET_TYPE 1
94 #define SPCA508_OFFSET_COMPRESS 2
95 #define SPCA508_OFFSET_FRAMSEQ 8
96 #define SPCA508_OFFSET_WIN1LUM 11
97 #define SPCA508_OFFSET_DATA 37
99 #define SPCA508_SNAPBIT 0x20
100 #define SPCA508_SNAPCTRL 0x40
101 /*************** I2c ****************/
102 #define SPCA508_INDEX_I2C_BASE 0x8800
105 * Initialization data: this is the first set-up data written to the
106 * device (before the open data).
108 static const __u16 spca508_init_data[][3] =
109 #define IGN(x) /* nothing */
111 /* line URB value, index */
112 /* 44274 1804 */ {0x0000, 0x870b},
114 /* 44299 1805 */ {0x0020, 0x8112},
115 /* Video drop enable, ISO streaming disable */
116 /* 44324 1806 */ {0x0003, 0x8111},
117 /* Reset compression & memory */
118 /* 44349 1807 */ {0x0000, 0x8110},
119 /* Disable all outputs */
120 /* 44372 1808 */ /* READ {0x0000, 0x8114} -> 0000: 00 */
121 /* 44398 1809 */ {0x0000, 0x8114},
123 /* 44423 1810 */ {0x0008, 0x8110},
124 /* Enable charge pump output */
125 /* 44527 1811 */ {0x0002, 0x8116},
126 /* 200 kHz pump clock */
128 /* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE:) */
129 /* 44590 1813 */ {0x0003, 0x8111},
130 /* Reset compression & memory */
131 /* 44615 1814 */ {0x0000, 0x8111},
132 /* Normal mode (not reset) */
133 /* 44640 1815 */ {0x0098, 0x8110},
134 /* Enable charge pump output, sync.serial,external 2x clock */
135 /* 44665 1816 */ {0x000d, 0x8114},
137 /* 44690 1817 */ {0x0002, 0x8116},
138 /* 200 kHz pump clock */
139 /* 44715 1818 */ {0x0020, 0x8112},
140 /* Video drop enable, ISO streaming disable */
141 /* --------------------------------------- */
142 /* 44740 1819 */ {0x000f, 0x8402},
144 /* 44765 1820 */ {0x0000, 0x8403},
146 /* --------------------------------------- */
147 /* 0x88__ is Synchronous Serial Interface. */
148 /* TBD: This table could be expressed more compactly */
149 /* using spca508_write_i2c_vector(). */
150 /* TBD: Should see if the values in spca50x_i2c_data */
151 /* would work with the VQ110 instead of the values */
153 /* 44790 1821 */ {0x00c0, 0x8804},
155 /* 44815 1822 */ {0x0008, 0x8802},
156 /* 375 Khz SSI clock */
157 /* 44838 1823 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
158 /* 44862 1824 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
159 /* 44888 1825 */ {0x0008, 0x8802},
160 /* 375 Khz SSI clock */
161 /* 44913 1826 */ {0x0012, 0x8801},
163 /* 44938 1827 */ {0x0080, 0x8800},
164 /* SSI data to write */
165 /* 44961 1828 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
166 /* 44985 1829 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
167 /* 45009 1830 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
168 /* 45035 1831 */ {0x0008, 0x8802},
169 /* 375 Khz SSI clock */
170 /* 45060 1832 */ {0x0012, 0x8801},
172 /* 45085 1833 */ {0x0000, 0x8800},
173 /* SSI data to write */
174 /* 45108 1834 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
175 /* 45132 1835 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
176 /* 45156 1836 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
177 /* 45182 1837 */ {0x0008, 0x8802},
178 /* 375 Khz SSI clock */
179 /* 45207 1838 */ {0x0011, 0x8801},
181 /* 45232 1839 */ {0x0040, 0x8800},
182 /* SSI data to write */
183 /* 45255 1840 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
184 /* 45279 1841 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
185 /* 45303 1842 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
186 /* 45329 1843 */ {0x0008, 0x8802},
187 /* 45354 1844 */ {0x0013, 0x8801},
188 /* 45379 1845 */ {0x0000, 0x8800},
189 /* 45402 1846 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
190 /* 45426 1847 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
191 /* 45450 1848 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
192 /* 45476 1849 */ {0x0008, 0x8802},
193 /* 45501 1850 */ {0x0014, 0x8801},
194 /* 45526 1851 */ {0x0000, 0x8800},
195 /* 45549 1852 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
196 /* 45573 1853 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
197 /* 45597 1854 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
198 /* 45623 1855 */ {0x0008, 0x8802},
199 /* 45648 1856 */ {0x0015, 0x8801},
200 /* 45673 1857 */ {0x0001, 0x8800},
201 /* 45696 1858 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
202 /* 45720 1859 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
203 /* 45744 1860 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
204 /* 45770 1861 */ {0x0008, 0x8802},
205 /* 45795 1862 */ {0x0016, 0x8801},
206 /* 45820 1863 */ {0x0003, 0x8800},
207 /* 45843 1864 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
208 /* 45867 1865 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
209 /* 45891 1866 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
210 /* 45917 1867 */ {0x0008, 0x8802},
211 /* 45942 1868 */ {0x0017, 0x8801},
212 /* 45967 1869 */ {0x0036, 0x8800},
213 /* 45990 1870 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
214 /* 46014 1871 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
215 /* 46038 1872 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
216 /* 46064 1873 */ {0x0008, 0x8802},
217 /* 46089 1874 */ {0x0018, 0x8801},
218 /* 46114 1875 */ {0x00ec, 0x8800},
219 /* 46137 1876 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
220 /* 46161 1877 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
221 /* 46185 1878 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
222 /* 46211 1879 */ {0x0008, 0x8802},
223 /* 46236 1880 */ {0x001a, 0x8801},
224 /* 46261 1881 */ {0x0094, 0x8800},
225 /* 46284 1882 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
226 /* 46308 1883 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
227 /* 46332 1884 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
228 /* 46358 1885 */ {0x0008, 0x8802},
229 /* 46383 1886 */ {0x001b, 0x8801},
230 /* 46408 1887 */ {0x0000, 0x8800},
231 /* 46431 1888 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
232 /* 46455 1889 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
233 /* 46479 1890 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
234 /* 46505 1891 */ {0x0008, 0x8802},
235 /* 46530 1892 */ {0x0027, 0x8801},
236 /* 46555 1893 */ {0x00a2, 0x8800},
237 /* 46578 1894 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
238 /* 46602 1895 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
239 /* 46626 1896 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
240 /* 46652 1897 */ {0x0008, 0x8802},
241 /* 46677 1898 */ {0x0028, 0x8801},
242 /* 46702 1899 */ {0x0040, 0x8800},
243 /* 46725 1900 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
244 /* 46749 1901 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
245 /* 46773 1902 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
246 /* 46799 1903 */ {0x0008, 0x8802},
247 /* 46824 1904 */ {0x002a, 0x8801},
248 /* 46849 1905 */ {0x0084, 0x8800},
249 /* 46872 1906 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
250 /* 46896 1907 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
251 /* 46920 1908 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
252 /* 46946 1909 */ {0x0008, 0x8802},
253 /* 46971 1910 */ {0x002b, 0x8801},
254 /* 46996 1911 */ {0x00a8, 0x8800},
255 /* 47019 1912 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
256 /* 47043 1913 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
257 /* 47067 1914 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
258 /* 47093 1915 */ {0x0008, 0x8802},
259 /* 47118 1916 */ {0x002c, 0x8801},
260 /* 47143 1917 */ {0x00fe, 0x8800},
261 /* 47166 1918 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
262 /* 47190 1919 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
263 /* 47214 1920 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
264 /* 47240 1921 */ {0x0008, 0x8802},
265 /* 47265 1922 */ {0x002d, 0x8801},
266 /* 47290 1923 */ {0x0003, 0x8800},
267 /* 47313 1924 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
268 /* 47337 1925 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
269 /* 47361 1926 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
270 /* 47387 1927 */ {0x0008, 0x8802},
271 /* 47412 1928 */ {0x0038, 0x8801},
272 /* 47437 1929 */ {0x0083, 0x8800},
273 /* 47460 1930 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
274 /* 47484 1931 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
275 /* 47508 1932 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
276 /* 47534 1933 */ {0x0008, 0x8802},
277 /* 47559 1934 */ {0x0033, 0x8801},
278 /* 47584 1935 */ {0x0081, 0x8800},
279 /* 47607 1936 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
280 /* 47631 1937 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
281 /* 47655 1938 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
282 /* 47681 1939 */ {0x0008, 0x8802},
283 /* 47706 1940 */ {0x0034, 0x8801},
284 /* 47731 1941 */ {0x004a, 0x8800},
285 /* 47754 1942 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
286 /* 47778 1943 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
287 /* 47802 1944 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
288 /* 47828 1945 */ {0x0008, 0x8802},
289 /* 47853 1946 */ {0x0039, 0x8801},
290 /* 47878 1947 */ {0x0000, 0x8800},
291 /* 47901 1948 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
292 /* 47925 1949 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
293 /* 47949 1950 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
294 /* 47975 1951 */ {0x0008, 0x8802},
295 /* 48000 1952 */ {0x0010, 0x8801},
296 /* 48025 1953 */ {0x00a8, 0x8800},
297 /* 48048 1954 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
298 /* 48072 1955 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
299 /* 48096 1956 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
300 /* 48122 1957 */ {0x0008, 0x8802},
301 /* 48147 1958 */ {0x0006, 0x8801},
302 /* 48172 1959 */ {0x0058, 0x8800},
303 /* 48195 1960 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
304 /* 48219 1961 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
305 /* 48243 1962 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
306 /* 48269 1963 */ {0x0008, 0x8802},
307 /* 48294 1964 */ {0x0000, 0x8801},
308 /* 48319 1965 */ {0x0004, 0x8800},
309 /* 48342 1966 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
310 /* 48366 1967 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
311 /* 48390 1968 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
312 /* 48416 1969 */ {0x0008, 0x8802},
313 /* 48441 1970 */ {0x0040, 0x8801},
314 /* 48466 1971 */ {0x0080, 0x8800},
315 /* 48489 1972 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
316 /* 48513 1973 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
317 /* 48537 1974 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
318 /* 48563 1975 */ {0x0008, 0x8802},
319 /* 48588 1976 */ {0x0041, 0x8801},
320 /* 48613 1977 */ {0x000c, 0x8800},
321 /* 48636 1978 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
322 /* 48660 1979 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
323 /* 48684 1980 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
324 /* 48710 1981 */ {0x0008, 0x8802},
325 /* 48735 1982 */ {0x0042, 0x8801},
326 /* 48760 1983 */ {0x000c, 0x8800},
327 /* 48783 1984 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
328 /* 48807 1985 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
329 /* 48831 1986 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
330 /* 48857 1987 */ {0x0008, 0x8802},
331 /* 48882 1988 */ {0x0043, 0x8801},
332 /* 48907 1989 */ {0x0028, 0x8800},
333 /* 48930 1990 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
334 /* 48954 1991 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
335 /* 48978 1992 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
336 /* 49004 1993 */ {0x0008, 0x8802},
337 /* 49029 1994 */ {0x0044, 0x8801},
338 /* 49054 1995 */ {0x0080, 0x8800},
339 /* 49077 1996 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
340 /* 49101 1997 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
341 /* 49125 1998 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
342 /* 49151 1999 */ {0x0008, 0x8802},
343 /* 49176 2000 */ {0x0045, 0x8801},
344 /* 49201 2001 */ {0x0020, 0x8800},
345 /* 49224 2002 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
346 /* 49248 2003 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
347 /* 49272 2004 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
348 /* 49298 2005 */ {0x0008, 0x8802},
349 /* 49323 2006 */ {0x0046, 0x8801},
350 /* 49348 2007 */ {0x0020, 0x8800},
351 /* 49371 2008 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
352 /* 49395 2009 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
353 /* 49419 2010 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
354 /* 49445 2011 */ {0x0008, 0x8802},
355 /* 49470 2012 */ {0x0047, 0x8801},
356 /* 49495 2013 */ {0x0080, 0x8800},
357 /* 49518 2014 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
358 /* 49542 2015 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
359 /* 49566 2016 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
360 /* 49592 2017 */ {0x0008, 0x8802},
361 /* 49617 2018 */ {0x0048, 0x8801},
362 /* 49642 2019 */ {0x004c, 0x8800},
363 /* 49665 2020 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
364 /* 49689 2021 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
365 /* 49713 2022 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
366 /* 49739 2023 */ {0x0008, 0x8802},
367 /* 49764 2024 */ {0x0049, 0x8801},
368 /* 49789 2025 */ {0x0084, 0x8800},
369 /* 49812 2026 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
370 /* 49836 2027 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
371 /* 49860 2028 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
372 /* 49886 2029 */ {0x0008, 0x8802},
373 /* 49911 2030 */ {0x004a, 0x8801},
374 /* 49936 2031 */ {0x0084, 0x8800},
375 /* 49959 2032 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
376 /* 49983 2033 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
377 /* 50007 2034 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
378 /* 50033 2035 */ {0x0008, 0x8802},
379 /* 50058 2036 */ {0x004b, 0x8801},
380 /* 50083 2037 */ {0x0084, 0x8800},
381 /* 50106 2038 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
382 /* --------------------------------------- */
383 /* 50132 2039 */ {0x0012, 0x8700},
384 /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */
385 /* 50157 2040 */ {0x0000, 0x8701},
386 /* CKx1 clock delay adj */
387 /* 50182 2041 */ {0x0000, 0x8701},
388 /* CKx1 clock delay adj */
389 /* 50207 2042 */ {0x0001, 0x870c},
391 /* --------------------------------------- */
392 /* 50232 2043 */ {0x0080, 0x8600},
393 /* Line memory read counter (L) */
394 /* 50257 2044 */ {0x0001, 0x8606},
396 /* 50282 2045 */ {0x0064, 0x8607},
397 /* Line memory read counter (H) 0x6480=25,728 */
398 /* 50307 2046 */ {0x002a, 0x8601},
399 /* CDSP sharp interpolation mode,
400 * line sel for color sep, edge enhance enab */
401 /* 50332 2047 */ {0x0000, 0x8602},
402 /* optical black level for user settng = 0 */
403 /* 50357 2048 */ {0x0080, 0x8600},
404 /* Line memory read counter (L) */
405 /* 50382 2049 */ {0x000a, 0x8603},
406 /* optical black level calc mode: auto; optical black offset = 10 */
407 /* 50407 2050 */ {0x00df, 0x865b},
408 /* Horiz offset for valid pixels (L)=0xdf */
409 /* 50432 2051 */ {0x0012, 0x865c},
410 /* Vert offset for valid lines (L)=0x12 */
412 /* The following two lines seem to be the "wrong" resolution. */
413 /* But perhaps these indicate the actual size of the sensor */
414 /* rather than the size of the current video mode. */
415 /* 50457 2052 */ {0x0058, 0x865d},
416 /* Horiz valid pixels (*4) (L) = 352 */
417 /* 50482 2053 */ {0x0048, 0x865e},
418 /* Vert valid lines (*4) (L) = 288 */
420 /* 50507 2054 */ {0x0015, 0x8608},
422 /* 50532 2055 */ {0x0030, 0x8609},
423 /* 50557 2056 */ {0x00fb, 0x860a},
424 /* 50582 2057 */ {0x003e, 0x860b},
425 /* 50607 2058 */ {0x00ce, 0x860c},
426 /* 50632 2059 */ {0x00f4, 0x860d},
427 /* 50657 2060 */ {0x00eb, 0x860e},
428 /* 50682 2061 */ {0x00dc, 0x860f},
429 /* 50707 2062 */ {0x0039, 0x8610},
430 /* 50732 2063 */ {0x0001, 0x8611},
431 /* R offset for white balance ... */
432 /* 50757 2064 */ {0x0000, 0x8612},
433 /* 50782 2065 */ {0x0001, 0x8613},
434 /* 50807 2066 */ {0x0000, 0x8614},
435 /* 50832 2067 */ {0x005b, 0x8651},
436 /* R gain for white balance ... */
437 /* 50857 2068 */ {0x0040, 0x8652},
438 /* 50882 2069 */ {0x0060, 0x8653},
439 /* 50907 2070 */ {0x0040, 0x8654},
440 /* 50932 2071 */ {0x0000, 0x8655},
441 /* 50957 2072 */ {0x0001, 0x863f},
442 /* Fixed gamma correction enable, USB control,
443 * lum filter disable, lum noise clip disable */
444 /* 50982 2073 */ {0x00a1, 0x8656},
445 /* Window1 size 256x256, Windows2 size 64x64,
446 * gamma look-up disable, new edge enhancement enable */
447 /* 51007 2074 */ {0x0018, 0x8657},
448 /* Edge gain high thresh */
449 /* 51032 2075 */ {0x0020, 0x8658},
450 /* Edge gain low thresh */
451 /* 51057 2076 */ {0x000a, 0x8659},
452 /* Edge bandwidth high threshold */
453 /* 51082 2077 */ {0x0005, 0x865a},
454 /* Edge bandwidth low threshold */
455 /* -------------------------------- */
456 /* 51107 2078 */ {0x0030, 0x8112},
457 /* Video drop enable, ISO streaming enable */
458 /* 51130 2079 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
459 /* 51154 2080 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
460 /* 51180 2081 */ {0xa908, 0x8802},
461 /* 51205 2082 */ {0x0034, 0x8801},
463 /* 51230 2083 */ {0x00ca, 0x8800},
464 /* SSI data to write */
465 /* 51253 2084 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
466 /* 51277 2085 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
467 /* 51301 2086 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
468 /* 51327 2087 */ {0x1f08, 0x8802},
469 /* 51352 2088 */ {0x0006, 0x8801},
470 /* 51377 2089 */ {0x0080, 0x8800},
471 /* 51400 2090 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
473 /* ----- Read back coefs we wrote earlier. */
474 /* 51424 2091 */ /* READ { 0, 0x0000, 0x8608 } -> 0000: 15 */
475 /* 51448 2092 */ /* READ { 0, 0x0000, 0x8609 } -> 0000: 30 */
476 /* 51472 2093 */ /* READ { 0, 0x0000, 0x860a } -> 0000: fb */
477 /* 51496 2094 */ /* READ { 0, 0x0000, 0x860b } -> 0000: 3e */
478 /* 51520 2095 */ /* READ { 0, 0x0000, 0x860c } -> 0000: ce */
479 /* 51544 2096 */ /* READ { 0, 0x0000, 0x860d } -> 0000: f4 */
480 /* 51568 2097 */ /* READ { 0, 0x0000, 0x860e } -> 0000: eb */
481 /* 51592 2098 */ /* READ { 0, 0x0000, 0x860f } -> 0000: dc */
482 /* 51616 2099 */ /* READ { 0, 0x0000, 0x8610 } -> 0000: 39 */
483 /* 51640 2100 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
484 /* 51664 2101 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
485 /* 51690 2102 */ {0xb008, 0x8802},
486 /* 51715 2103 */ {0x0006, 0x8801},
487 /* 51740 2104 */ {0x007d, 0x8800},
488 /* 51763 2105 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
491 /* This chunk is seemingly redundant with */
492 /* earlier commands (A11 Coef...), but if I disable it, */
493 /* the image appears too dark. Maybe there was some kind of */
494 /* reset since the earlier commands, so this is necessary again. */
495 /* 51789 2106 */ {0x0015, 0x8608},
496 /* 51814 2107 */ {0x0030, 0x8609},
497 /* 51839 2108 */ {0xfffb, 0x860a},
498 /* 51864 2109 */ {0x003e, 0x860b},
499 /* 51889 2110 */ {0xffce, 0x860c},
500 /* 51914 2111 */ {0xfff4, 0x860d},
501 /* 51939 2112 */ {0xffeb, 0x860e},
502 /* 51964 2113 */ {0xffdc, 0x860f},
503 /* 51989 2114 */ {0x0039, 0x8610},
504 /* 52014 2115 */ {0x0018, 0x8657},
506 /* 52039 2116 */ {0x0000, 0x8508},
507 /* Disable compression. */
508 /* Previous line was:
509 * 52039 2116 * { 0, 0x0021, 0x8508 }, * Enable compression. */
510 /* 52064 2117 */ {0x0032, 0x850b},
511 /* compression stuff */
512 /* 52089 2118 */ {0x0003, 0x8509},
513 /* compression stuff */
514 /* 52114 2119 */ {0x0011, 0x850a},
515 /* compression stuff */
516 /* 52139 2120 */ {0x0021, 0x850d},
517 /* compression stuff */
518 /* 52164 2121 */ {0x0010, 0x850c},
519 /* compression stuff */
520 /* 52189 2122 */ {0x0003, 0x8500},
521 /* *** Video mode: 160x120 */
522 /* 52214 2123 */ {0x0001, 0x8501},
523 /* Hardware-dominated snap control */
524 /* 52239 2124 */ {0x0061, 0x8656},
525 /* Window1 size 128x128, Windows2 size 128x128,
526 * gamma look-up disable, new edge enhancement enable */
527 /* 52264 2125 */ {0x0018, 0x8617},
528 /* Window1 start X (*2) */
529 /* 52289 2126 */ {0x0008, 0x8618},
530 /* Window1 start Y (*2) */
531 /* 52314 2127 */ {0x0061, 0x8656},
532 /* Window1 size 128x128, Windows2 size 128x128,
533 * gamma look-up disable, new edge enhancement enable */
534 /* 52339 2128 */ {0x0058, 0x8619},
535 /* Window2 start X (*2) */
536 /* 52364 2129 */ {0x0008, 0x861a},
537 /* Window2 start Y (*2) */
538 /* 52389 2130 */ {0x00ff, 0x8615},
539 /* High lum thresh for white balance */
540 /* 52414 2131 */ {0x0000, 0x8616},
541 /* Low lum thresh for white balance */
542 /* 52439 2132 */ {0x0012, 0x8700},
543 /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */
544 /* 52464 2133 */ {0x0012, 0x8700},
545 /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */
546 /* 52487 2134 */ /* READ { 0, 0x0000, 0x8656 } -> 0000: 61 */
547 /* 52513 2135 */ {0x0028, 0x8802},
548 /* 375 Khz SSI clock, SSI r/w sync with VSYNC */
549 /* 52536 2136 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
550 /* 52560 2137 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 28 */
551 /* 52586 2138 */ {0x1f28, 0x8802},
552 /* 375 Khz SSI clock, SSI r/w sync with VSYNC */
553 /* 52611 2139 */ {0x0010, 0x8801},
555 /* 52636 2140 */ {0x003e, 0x8800},
556 /* SSI data to write */
557 /* 52659 2141 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
558 /* 52685 2142 */ {0x0028, 0x8802},
559 /* 52708 2143 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
560 /* 52732 2144 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 28 */
561 /* 52758 2145 */ {0x1f28, 0x8802},
562 /* 52783 2146 */ {0x0000, 0x8801},
563 /* 52808 2147 */ {0x001f, 0x8800},
564 /* 52831 2148 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
565 /* 52857 2149 */ {0x0001, 0x8602},
566 /* optical black level for user settning = 1 */
569 /* 52882 2150 */ {0x0023, 0x8700},
570 /* Clock speed 48Mhz/(3+2)/4= 2.4 Mhz */
571 /* 52907 2151 */ {0x000f, 0x8602},
572 /* optical black level for user settning = 15 */
574 /* 52932 2152 */ {0x0028, 0x8802},
575 /* 52955 2153 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
576 /* 52979 2154 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 28 */
577 /* 53005 2155 */ {0x1f28, 0x8802},
578 /* 53030 2156 */ {0x0010, 0x8801},
579 /* 53055 2157 */ {0x007b, 0x8800},
580 /* 53078 2158 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
581 /* 53104 2159 */ {0x002f, 0x8651},
582 /* R gain for white balance ... */
583 /* 53129 2160 */ {0x0080, 0x8653},
584 /* 53152 2161 */ /* READ { 0, 0x0000, 0x8655 } -> 0000: 00 */
585 /* 53178 2162 */ {0x0000, 0x8655},
587 /* 53203 2163 */ {0x0030, 0x8112},
588 /* Video drop enable, ISO streaming enable */
589 /* 53228 2164 */ {0x0020, 0x8112},
590 /* Video drop enable, ISO streaming disable */
592 /* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE: (ALT=0) ) */
598 * Initialization data for Intel EasyPC Camera CS110
600 static const __u16 spca508cs110_init_data[][3] = {
601 {0x0000, 0x870b}, /* Reset CTL3 */
602 {0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */
603 {0x0000, 0x8111}, /* Normal operation on reset */
605 /* External Clock 2x & Synchronous Serial Interface Output */
606 {0x0020, 0x8112}, /* Video Drop packet enable */
607 {0x0000, 0x8114}, /* Software GPIO output data */
613 /* Initial sequence Synchronous Serial Interface */
614 {0x000f, 0x8402}, /* Memory bank Address */
615 {0x0000, 0x8403}, /* Memory bank Address */
616 {0x00ba, 0x8804}, /* SSI Slave address */
617 {0x0010, 0x8802}, /* 93.75kHz SSI Clock Two DataByte */
618 {0x0010, 0x8802}, /* 93.75kHz SSI Clock two DataByte */
621 {0x000a, 0x8805},/* a - NWG: Dunno what this is about */
655 {0x0002, 0x8704}, /* External input CKIx1 */
656 {0x0001, 0x8606}, /* 1 Line memory Read Counter (H) Result: (d)410 */
657 {0x009a, 0x8600}, /* Line memory Read Counter (L) */
658 {0x0001, 0x865b}, /* 1 Horizontal Offset for Valid Pixel(L) */
659 {0x0003, 0x865c}, /* 3 Vertical Offset for Valid Lines(L) */
660 {0x0058, 0x865d}, /* 58 Horizontal Valid Pixel Window(L) */
662 {0x0006, 0x8660}, /* Nibble data + input order */
664 {0x000a, 0x8602}, /* Optical black level set to 0x0a */
665 /* 1945 */ {0x0000, 0x8603}, /* Optical black level Offset */
667 /* 1962 * {0, 0x0000, 0x8611}, * 0 R Offset for white Balance */
668 /* 1963 * {0, 0x0000, 0x8612}, * 1 Gr Offset for white Balance */
669 /* 1964 * {0, 0x0000, 0x8613}, * 1f B Offset for white Balance */
670 /* 1965 * {0, 0x0000, 0x8614}, * f0 Gb Offset for white Balance */
672 {0x0040, 0x8651}, /* 2b BLUE gain for white balance good at all 60 */
673 {0x0030, 0x8652}, /* 41 Gr Gain for white Balance (L) */
674 {0x0035, 0x8653}, /* 26 RED gain for white balance */
675 {0x0035, 0x8654}, /* 40Gb Gain for white Balance (L) */
677 /* Fixed Gamma correction enabled (makes colours look better) */
679 /* 2422 */ {0x0000, 0x8655},
680 /* High bits for white balance*****brightness control*** */
684 static const __u16 spca508_sightcam_init_data[][3] = {
685 /* This line seems to setup the frame/canvas */
686 /*368 */ {0x000f, 0x8402},
688 /* Theese 6 lines are needed to startup the webcam */
689 /*398 */ {0x0090, 0x8110},
690 /*399 */ {0x0001, 0x8114},
691 /*400 */ {0x0001, 0x8114},
692 /*401 */ {0x0001, 0x8114},
693 /*402 */ {0x0003, 0x8114},
694 /*403 */ {0x0080, 0x8804},
696 /* This part seems to make the pictures darker? (autobrightness?) */
697 /*436 */ {0x0001, 0x8801},
698 /*437 */ {0x0004, 0x8800},
699 /*439 */ {0x0003, 0x8801},
700 /*440 */ {0x00e0, 0x8800},
701 /*442 */ {0x0004, 0x8801},
702 /*443 */ {0x00b4, 0x8800},
703 /*445 */ {0x0005, 0x8801},
704 /*446 */ {0x0000, 0x8800},
706 /*448 */ {0x0006, 0x8801},
707 /*449 */ {0x00e0, 0x8800},
708 /*451 */ {0x0007, 0x8801},
709 /*452 */ {0x000c, 0x8800},
711 /* This section is just needed, it probably
712 * does something like the previous section,
713 * but the cam won't start if it's not included.
715 /*484 */ {0x0014, 0x8801},
716 /*485 */ {0x0008, 0x8800},
717 /*487 */ {0x0015, 0x8801},
718 /*488 */ {0x0067, 0x8800},
719 /*490 */ {0x0016, 0x8801},
720 /*491 */ {0x0000, 0x8800},
721 /*493 */ {0x0017, 0x8801},
722 /*494 */ {0x0020, 0x8800},
723 /*496 */ {0x0018, 0x8801},
724 /*497 */ {0x0044, 0x8800},
726 /* Makes the picture darker - and the
727 * cam won't start if not included
729 /*505 */ {0x001e, 0x8801},
730 /*506 */ {0x00ea, 0x8800},
731 /*508 */ {0x001f, 0x8801},
732 /*509 */ {0x0001, 0x8800},
733 /*511 */ {0x0003, 0x8801},
734 /*512 */ {0x00e0, 0x8800},
736 /* seems to place the colors ontop of each other #1 */
737 /*517 */ {0x0006, 0x8704},
738 /*518 */ {0x0001, 0x870c},
739 /*519 */ {0x0016, 0x8600},
740 /*520 */ {0x0002, 0x8606},
742 /* if not included the pictures becomes _very_ dark */
743 /*521 */ {0x0064, 0x8607},
744 /*522 */ {0x003a, 0x8601},
745 /*523 */ {0x0000, 0x8602},
747 /* seems to place the colors ontop of each other #2 */
748 /*524 */ {0x0016, 0x8600},
749 /*525 */ {0x0018, 0x8617},
750 /*526 */ {0x0008, 0x8618},
751 /*527 */ {0x00a1, 0x8656},
753 /* webcam won't start if not included */
754 /*528 */ {0x0007, 0x865b},
755 /*529 */ {0x0001, 0x865c},
756 /*530 */ {0x0058, 0x865d},
757 /*531 */ {0x0048, 0x865e},
759 /* adjusts the colors */
760 /*541 */ {0x0049, 0x8651},
761 /*542 */ {0x0040, 0x8652},
762 /*543 */ {0x004c, 0x8653},
763 /*544 */ {0x0040, 0x8654},
767 static const __u16 spca508_sightcam2_init_data[][3] = {
768 /* 35 */ {0x0020, 0x8112},
770 /* 36 */ {0x000f, 0x8402},
771 /* 37 */ {0x0000, 0x8403},
773 /* 38 */ {0x0008, 0x8201},
774 /* 39 */ {0x0008, 0x8200},
775 /* 40 */ {0x0001, 0x8200},
776 /* 43 */ {0x0009, 0x8201},
777 /* 44 */ {0x0008, 0x8200},
778 /* 45 */ {0x0001, 0x8200},
779 /* 48 */ {0x000a, 0x8201},
780 /* 49 */ {0x0008, 0x8200},
781 /* 50 */ {0x0001, 0x8200},
782 /* 53 */ {0x000b, 0x8201},
783 /* 54 */ {0x0008, 0x8200},
784 /* 55 */ {0x0001, 0x8200},
785 /* 58 */ {0x000c, 0x8201},
786 /* 59 */ {0x0008, 0x8200},
787 /* 60 */ {0x0001, 0x8200},
788 /* 63 */ {0x000d, 0x8201},
789 /* 64 */ {0x0008, 0x8200},
790 /* 65 */ {0x0001, 0x8200},
791 /* 68 */ {0x000e, 0x8201},
792 /* 69 */ {0x0008, 0x8200},
793 /* 70 */ {0x0001, 0x8200},
794 /* 73 */ {0x0007, 0x8201},
795 /* 74 */ {0x0008, 0x8200},
796 /* 75 */ {0x0001, 0x8200},
797 /* 78 */ {0x000f, 0x8201},
798 /* 79 */ {0x0008, 0x8200},
799 /* 80 */ {0x0001, 0x8200},
801 /* 84 */ {0x0018, 0x8660},
802 /* 85 */ {0x0010, 0x8201},
804 /* 86 */ {0x0008, 0x8200},
805 /* 87 */ {0x0001, 0x8200},
806 /* 90 */ {0x0011, 0x8201},
807 /* 91 */ {0x0008, 0x8200},
808 /* 92 */ {0x0001, 0x8200},
810 /* 95 */ {0x0000, 0x86b0},
811 /* 96 */ {0x0034, 0x86b1},
812 /* 97 */ {0x0000, 0x86b2},
813 /* 98 */ {0x0049, 0x86b3},
814 /* 99 */ {0x0000, 0x86b4},
815 /* 100 */ {0x0000, 0x86b4},
817 /* 101 */ {0x0012, 0x8201},
818 /* 102 */ {0x0008, 0x8200},
819 /* 103 */ {0x0001, 0x8200},
820 /* 106 */ {0x0013, 0x8201},
821 /* 107 */ {0x0008, 0x8200},
822 /* 108 */ {0x0001, 0x8200},
824 /* 111 */ {0x0001, 0x86b0},
825 /* 112 */ {0x00aa, 0x86b1},
826 /* 113 */ {0x0000, 0x86b2},
827 /* 114 */ {0x00e4, 0x86b3},
828 /* 115 */ {0x0000, 0x86b4},
829 /* 116 */ {0x0000, 0x86b4},
831 /* 118 */ {0x0018, 0x8660},
833 /* 119 */ {0x0090, 0x8110},
834 /* 120 */ {0x0001, 0x8114},
835 /* 121 */ {0x0001, 0x8114},
836 /* 122 */ {0x0001, 0x8114},
837 /* 123 */ {0x0003, 0x8114},
839 /* 124 */ {0x0080, 0x8804},
840 /* 157 */ {0x0003, 0x8801},
841 /* 158 */ {0x0012, 0x8800},
842 /* 160 */ {0x0004, 0x8801},
843 /* 161 */ {0x0005, 0x8800},
844 /* 163 */ {0x0005, 0x8801},
845 /* 164 */ {0x0000, 0x8800},
846 /* 166 */ {0x0006, 0x8801},
847 /* 167 */ {0x0000, 0x8800},
848 /* 169 */ {0x0007, 0x8801},
849 /* 170 */ {0x0000, 0x8800},
850 /* 172 */ {0x0008, 0x8801},
851 /* 173 */ {0x0005, 0x8800},
852 /* 175 */ {0x000a, 0x8700},
853 /* 176 */ {0x000e, 0x8801},
854 /* 177 */ {0x0004, 0x8800},
855 /* 179 */ {0x0005, 0x8801},
856 /* 180 */ {0x0047, 0x8800},
857 /* 182 */ {0x0006, 0x8801},
858 /* 183 */ {0x0000, 0x8800},
859 /* 185 */ {0x0007, 0x8801},
860 /* 186 */ {0x00c0, 0x8800},
861 /* 188 */ {0x0008, 0x8801},
862 /* 189 */ {0x0003, 0x8800},
863 /* 191 */ {0x0013, 0x8801},
864 /* 192 */ {0x0001, 0x8800},
865 /* 194 */ {0x0009, 0x8801},
866 /* 195 */ {0x0000, 0x8800},
867 /* 197 */ {0x000a, 0x8801},
868 /* 198 */ {0x0000, 0x8800},
869 /* 200 */ {0x000b, 0x8801},
870 /* 201 */ {0x0000, 0x8800},
871 /* 203 */ {0x000c, 0x8801},
872 /* 204 */ {0x0000, 0x8800},
873 /* 206 */ {0x000e, 0x8801},
874 /* 207 */ {0x0004, 0x8800},
875 /* 209 */ {0x000f, 0x8801},
876 /* 210 */ {0x0000, 0x8800},
877 /* 212 */ {0x0010, 0x8801},
878 /* 213 */ {0x0006, 0x8800},
879 /* 215 */ {0x0011, 0x8801},
880 /* 216 */ {0x0006, 0x8800},
881 /* 218 */ {0x0012, 0x8801},
882 /* 219 */ {0x0000, 0x8800},
883 /* 221 */ {0x0013, 0x8801},
884 /* 222 */ {0x0001, 0x8800},
886 /* 224 */ {0x000a, 0x8700},
887 /* 225 */ {0x0000, 0x8702},
888 /* 226 */ {0x0000, 0x8703},
889 /* 227 */ {0x00c2, 0x8704},
890 /* 228 */ {0x0001, 0x870c},
892 /* 229 */ {0x0044, 0x8600},
893 /* 230 */ {0x0002, 0x8606},
894 /* 231 */ {0x0064, 0x8607},
895 /* 232 */ {0x003a, 0x8601},
896 /* 233 */ {0x0008, 0x8602},
897 /* 234 */ {0x0044, 0x8600},
898 /* 235 */ {0x0018, 0x8617},
899 /* 236 */ {0x0008, 0x8618},
900 /* 237 */ {0x00a1, 0x8656},
901 /* 238 */ {0x0004, 0x865b},
902 /* 239 */ {0x0002, 0x865c},
903 /* 240 */ {0x0058, 0x865d},
904 /* 241 */ {0x0048, 0x865e},
905 /* 242 */ {0x0012, 0x8608},
906 /* 243 */ {0x002c, 0x8609},
907 /* 244 */ {0x0002, 0x860a},
908 /* 245 */ {0x002c, 0x860b},
909 /* 246 */ {0x00db, 0x860c},
910 /* 247 */ {0x00f9, 0x860d},
911 /* 248 */ {0x00f1, 0x860e},
912 /* 249 */ {0x00e3, 0x860f},
913 /* 250 */ {0x002c, 0x8610},
914 /* 251 */ {0x006c, 0x8651},
915 /* 252 */ {0x0041, 0x8652},
916 /* 253 */ {0x0059, 0x8653},
917 /* 254 */ {0x0040, 0x8654},
918 /* 255 */ {0x00fa, 0x8611},
919 /* 256 */ {0x00ff, 0x8612},
920 /* 257 */ {0x00f8, 0x8613},
921 /* 258 */ {0x0000, 0x8614},
922 /* 259 */ {0x0001, 0x863f},
923 /* 260 */ {0x0000, 0x8640},
924 /* 261 */ {0x0026, 0x8641},
925 /* 262 */ {0x0045, 0x8642},
926 /* 263 */ {0x0060, 0x8643},
927 /* 264 */ {0x0075, 0x8644},
928 /* 265 */ {0x0088, 0x8645},
929 /* 266 */ {0x009b, 0x8646},
930 /* 267 */ {0x00b0, 0x8647},
931 /* 268 */ {0x00c5, 0x8648},
932 /* 269 */ {0x00d2, 0x8649},
933 /* 270 */ {0x00dc, 0x864a},
934 /* 271 */ {0x00e5, 0x864b},
935 /* 272 */ {0x00eb, 0x864c},
936 /* 273 */ {0x00f0, 0x864d},
937 /* 274 */ {0x00f6, 0x864e},
938 /* 275 */ {0x00fa, 0x864f},
939 /* 276 */ {0x00ff, 0x8650},
940 /* 277 */ {0x0060, 0x8657},
941 /* 278 */ {0x0010, 0x8658},
942 /* 279 */ {0x0018, 0x8659},
943 /* 280 */ {0x0005, 0x865a},
944 /* 281 */ {0x0018, 0x8660},
945 /* 282 */ {0x0003, 0x8509},
946 /* 283 */ {0x0011, 0x850a},
947 /* 284 */ {0x0032, 0x850b},
948 /* 285 */ {0x0010, 0x850c},
949 /* 286 */ {0x0021, 0x850d},
950 /* 287 */ {0x0001, 0x8500},
951 /* 288 */ {0x0000, 0x8508},
952 /* 289 */ {0x0012, 0x8608},
953 /* 290 */ {0x002c, 0x8609},
954 /* 291 */ {0x0002, 0x860a},
955 /* 292 */ {0x0039, 0x860b},
956 /* 293 */ {0x00d0, 0x860c},
957 /* 294 */ {0x00f7, 0x860d},
958 /* 295 */ {0x00ed, 0x860e},
959 /* 296 */ {0x00db, 0x860f},
960 /* 297 */ {0x0039, 0x8610},
961 /* 298 */ {0x0012, 0x8657},
962 /* 299 */ {0x000c, 0x8619},
963 /* 300 */ {0x0004, 0x861a},
964 /* 301 */ {0x00a1, 0x8656},
965 /* 302 */ {0x00c8, 0x8615},
966 /* 303 */ {0x0032, 0x8616},
968 /* 306 */ {0x0030, 0x8112},
969 /* 313 */ {0x0020, 0x8112},
970 /* 314 */ {0x0020, 0x8112},
971 /* 315 */ {0x000f, 0x8402},
972 /* 316 */ {0x0000, 0x8403},
974 /* 317 */ {0x0090, 0x8110},
975 /* 318 */ {0x0001, 0x8114},
976 /* 319 */ {0x0001, 0x8114},
977 /* 320 */ {0x0001, 0x8114},
978 /* 321 */ {0x0003, 0x8114},
979 /* 322 */ {0x0080, 0x8804},
981 /* 355 */ {0x0003, 0x8801},
982 /* 356 */ {0x0012, 0x8800},
983 /* 358 */ {0x0004, 0x8801},
984 /* 359 */ {0x0005, 0x8800},
985 /* 361 */ {0x0005, 0x8801},
986 /* 362 */ {0x0047, 0x8800},
987 /* 364 */ {0x0006, 0x8801},
988 /* 365 */ {0x0000, 0x8800},
989 /* 367 */ {0x0007, 0x8801},
990 /* 368 */ {0x00c0, 0x8800},
991 /* 370 */ {0x0008, 0x8801},
992 /* 371 */ {0x0003, 0x8800},
993 /* 373 */ {0x000a, 0x8700},
994 /* 374 */ {0x000e, 0x8801},
995 /* 375 */ {0x0004, 0x8800},
996 /* 377 */ {0x0005, 0x8801},
997 /* 378 */ {0x0047, 0x8800},
998 /* 380 */ {0x0006, 0x8801},
999 /* 381 */ {0x0000, 0x8800},
1000 /* 383 */ {0x0007, 0x8801},
1001 /* 384 */ {0x00c0, 0x8800},
1002 /* 386 */ {0x0008, 0x8801},
1003 /* 387 */ {0x0003, 0x8800},
1004 /* 389 */ {0x0013, 0x8801},
1005 /* 390 */ {0x0001, 0x8800},
1006 /* 392 */ {0x0009, 0x8801},
1007 /* 393 */ {0x0000, 0x8800},
1008 /* 395 */ {0x000a, 0x8801},
1009 /* 396 */ {0x0000, 0x8800},
1010 /* 398 */ {0x000b, 0x8801},
1011 /* 399 */ {0x0000, 0x8800},
1012 /* 401 */ {0x000c, 0x8801},
1013 /* 402 */ {0x0000, 0x8800},
1014 /* 404 */ {0x000e, 0x8801},
1015 /* 405 */ {0x0004, 0x8800},
1016 /* 407 */ {0x000f, 0x8801},
1017 /* 408 */ {0x0000, 0x8800},
1018 /* 410 */ {0x0010, 0x8801},
1019 /* 411 */ {0x0006, 0x8800},
1020 /* 413 */ {0x0011, 0x8801},
1021 /* 414 */ {0x0006, 0x8800},
1022 /* 416 */ {0x0012, 0x8801},
1023 /* 417 */ {0x0000, 0x8800},
1024 /* 419 */ {0x0013, 0x8801},
1025 /* 420 */ {0x0001, 0x8800},
1026 /* 422 */ {0x000a, 0x8700},
1027 /* 423 */ {0x0000, 0x8702},
1028 /* 424 */ {0x0000, 0x8703},
1029 /* 425 */ {0x00c2, 0x8704},
1030 /* 426 */ {0x0001, 0x870c},
1031 /* 427 */ {0x0044, 0x8600},
1032 /* 428 */ {0x0002, 0x8606},
1033 /* 429 */ {0x0064, 0x8607},
1034 /* 430 */ {0x003a, 0x8601},
1035 /* 431 */ {0x0008, 0x8602},
1036 /* 432 */ {0x0044, 0x8600},
1037 /* 433 */ {0x0018, 0x8617},
1038 /* 434 */ {0x0008, 0x8618},
1039 /* 435 */ {0x00a1, 0x8656},
1040 /* 436 */ {0x0004, 0x865b},
1041 /* 437 */ {0x0002, 0x865c},
1042 /* 438 */ {0x0058, 0x865d},
1043 /* 439 */ {0x0048, 0x865e},
1044 /* 440 */ {0x0012, 0x8608},
1045 /* 441 */ {0x002c, 0x8609},
1046 /* 442 */ {0x0002, 0x860a},
1047 /* 443 */ {0x002c, 0x860b},
1048 /* 444 */ {0x00db, 0x860c},
1049 /* 445 */ {0x00f9, 0x860d},
1050 /* 446 */ {0x00f1, 0x860e},
1051 /* 447 */ {0x00e3, 0x860f},
1052 /* 448 */ {0x002c, 0x8610},
1053 /* 449 */ {0x006c, 0x8651},
1054 /* 450 */ {0x0041, 0x8652},
1055 /* 451 */ {0x0059, 0x8653},
1056 /* 452 */ {0x0040, 0x8654},
1057 /* 453 */ {0x00fa, 0x8611},
1058 /* 454 */ {0x00ff, 0x8612},
1059 /* 455 */ {0x00f8, 0x8613},
1060 /* 456 */ {0x0000, 0x8614},
1061 /* 457 */ {0x0001, 0x863f},
1062 /* 458 */ {0x0000, 0x8640},
1063 /* 459 */ {0x0026, 0x8641},
1064 /* 460 */ {0x0045, 0x8642},
1065 /* 461 */ {0x0060, 0x8643},
1066 /* 462 */ {0x0075, 0x8644},
1067 /* 463 */ {0x0088, 0x8645},
1068 /* 464 */ {0x009b, 0x8646},
1069 /* 465 */ {0x00b0, 0x8647},
1070 /* 466 */ {0x00c5, 0x8648},
1071 /* 467 */ {0x00d2, 0x8649},
1072 /* 468 */ {0x00dc, 0x864a},
1073 /* 469 */ {0x00e5, 0x864b},
1074 /* 470 */ {0x00eb, 0x864c},
1075 /* 471 */ {0x00f0, 0x864d},
1076 /* 472 */ {0x00f6, 0x864e},
1077 /* 473 */ {0x00fa, 0x864f},
1078 /* 474 */ {0x00ff, 0x8650},
1079 /* 475 */ {0x0060, 0x8657},
1080 /* 476 */ {0x0010, 0x8658},
1081 /* 477 */ {0x0018, 0x8659},
1082 /* 478 */ {0x0005, 0x865a},
1083 /* 479 */ {0x0018, 0x8660},
1084 /* 480 */ {0x0003, 0x8509},
1085 /* 481 */ {0x0011, 0x850a},
1086 /* 482 */ {0x0032, 0x850b},
1087 /* 483 */ {0x0010, 0x850c},
1088 /* 484 */ {0x0021, 0x850d},
1089 /* 485 */ {0x0001, 0x8500},
1090 /* 486 */ {0x0000, 0x8508},
1092 /* 487 */ {0x0012, 0x8608},
1093 /* 488 */ {0x002c, 0x8609},
1094 /* 489 */ {0x0002, 0x860a},
1095 /* 490 */ {0x0039, 0x860b},
1096 /* 491 */ {0x00d0, 0x860c},
1097 /* 492 */ {0x00f7, 0x860d},
1098 /* 493 */ {0x00ed, 0x860e},
1099 /* 494 */ {0x00db, 0x860f},
1100 /* 495 */ {0x0039, 0x8610},
1101 /* 496 */ {0x0012, 0x8657},
1102 /* 497 */ {0x0064, 0x8619},
1104 /* This line starts it all, it is not needed here */
1105 /* since it has been build into the driver */
1106 /* jfm: don't start now */
1107 /* 590 * {0x0030, 0x8112}, */
1112 * Initialization data for Creative Webcam Vista
1114 static const __u16 spca508_vista_init_data[][3] = {
1115 {0x0008, 0x8200}, /* Clear register */
1116 {0x0000, 0x870b}, /* Reset CTL3 */
1117 {0x0020, 0x8112}, /* Video Drop packet enable */
1118 {0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */
1119 {0x0000, 0x8110}, /* Disable everything */
1120 {0x0000, 0x8114}, /* Software GPIO output data */
1125 {0x0090, 0x8110}, /* Enable: SSI output, External 2X clock output */
1133 {0x000f, 0x8402}, /* Memory bank Address */
1134 {0x0000, 0x8403}, /* Memory bank Address */
1135 {0x00ba, 0x8804}, /* SSI Slave address */
1136 {0x0010, 0x8802}, /* 93.75kHz SSI Clock Two DataByte */
1138 /* READ { 0, 0x0001, 0x8803 } ->
1140 /* READ { 0, 0x0001, 0x8802 } ->
1142 {0x0010, 0x8802}, /* Will write 2 bytes (DATA1+DATA2) */
1143 {0x0020, 0x8801}, /* Register address for SSI read/write */
1144 {0x0044, 0x8805}, /* DATA2 */
1145 {0x0004, 0x8800}, /* DATA1 -> write triggered */
1146 /* READ { 0, 0x0001, 0x8803 } ->
1149 /* READ { 0, 0x0001, 0x8803 } ->
1151 /* READ { 0, 0x0001, 0x8802 } ->
1157 /* READ { 0, 0x0001, 0x8803 } ->
1160 /* READ { 0, 0x0001, 0x8803 } ->
1162 /* READ { 0, 0x0001, 0x8802 } ->
1168 /* READ { 0, 0x0001, 0x8803 } ->
1171 /* READ { 0, 0x0001, 0x8803 } ->
1173 /* READ { 0, 0x0001, 0x8802 } ->
1179 /* READ { 0, 0x0001, 0x8803 } ->
1182 /* READ { 0, 0x0001, 0x8803 } ->
1184 /* READ { 0, 0x0001, 0x8802 } ->
1190 /* READ { 0, 0x0001, 0x8803 } ->
1193 /* READ { 0, 0x0001, 0x8803 } ->
1195 /* READ { 0, 0x0001, 0x8802 } ->
1201 /* READ { 0, 0x0001, 0x8803 } ->
1204 /* READ { 0, 0x0001, 0x8803 } ->
1206 /* READ { 0, 0x0001, 0x8802 } ->
1212 /* READ { 0, 0x0001, 0x8803 } ->
1215 /* READ { 0, 0x0001, 0x8803 } ->
1217 /* READ { 0, 0x0001, 0x8802 } ->
1223 /* READ { 0, 0x0001, 0x8803 } ->
1226 /* READ { 0, 0x0001, 0x8803 } ->
1228 /* READ { 0, 0x0001, 0x8802 } ->
1234 /* READ { 0, 0x0001, 0x8803 } ->
1237 /* READ { 0, 0x0001, 0x8803 } ->
1239 /* READ { 0, 0x0001, 0x8802 } ->
1245 /* READ { 0, 0x0001, 0x8803 } ->
1248 /* READ { 0, 0x0001, 0x8803 } ->
1250 /* READ { 0, 0x0001, 0x8802 } ->
1256 /* READ { 0, 0x0001, 0x8803 } ->
1259 /* READ { 0, 0x0001, 0x8803 } ->
1261 /* READ { 0, 0x0001, 0x8802 } ->
1267 /* READ { 0, 0x0001, 0x8803 } ->
1270 /* READ { 0, 0x0001, 0x8803 } ->
1272 /* READ { 0, 0x0001, 0x8802 } ->
1278 /* READ { 0, 0x0001, 0x8803 } ->
1281 /* READ { 0, 0x0001, 0x8803 } ->
1283 /* READ { 0, 0x0001, 0x8802 } ->
1289 /* READ { 0, 0x0001, 0x8803 } ->
1292 /* READ { 0, 0x0001, 0x8803 } ->
1294 /* READ { 0, 0x0001, 0x8802 } ->
1300 /* READ { 0, 0x0001, 0x8803 } ->
1303 /* READ { 0, 0x0001, 0x8803 } ->
1305 /* READ { 0, 0x0001, 0x8802 } ->
1311 /* READ { 0, 0x0001, 0x8803 } ->
1315 {0x0002, 0x8704}, /* External input CKIx1 */
1316 {0x0001, 0x870C}, /* Select CKOx2 output */
1317 {0x009A, 0x8600}, /* Line memory Read Counter (L) */
1318 {0x0001, 0x8606}, /* 1 Line memory Read Counter (H) Result: (d)410 */
1323 {0x0001, 0x865B}, /* 1 Horizontal Offset for Valid Pixel(L) */
1324 {0x0003, 0x865C}, /* Vertical offset for valid lines (L) */
1325 {0x0058, 0x865D}, /* Horizontal valid pixels window (L) */
1326 {0x0048, 0x865E}, /* Vertical valid lines window (L) */
1330 /* Enable nibble data input, select nibble input order */
1332 {0x0013, 0x8608}, /* A11 Coeficients for color correction */
1334 /* Note: these values are confirmed at the end of array */
1335 {0x0005, 0x860A}, /* ... */
1341 {0x0025, 0x8610}, /* A33 Coef. */
1342 {0x00FC, 0x8611}, /* White balance offset: R */
1343 {0x0001, 0x8612}, /* White balance offset: Gr */
1344 {0x00FE, 0x8613}, /* White balance offset: B */
1345 {0x0000, 0x8614}, /* White balance offset: Gb */
1347 {0x0064, 0x8651}, /* R gain for white balance (L) */
1348 {0x0040, 0x8652}, /* Gr gain for white balance (L) */
1349 {0x0066, 0x8653}, /* B gain for white balance (L) */
1350 {0x0040, 0x8654}, /* Gb gain for white balance (L) */
1351 {0x0001, 0x863F}, /* Enable fixed gamma correction */
1353 {0x00A1, 0x8656}, /* Size - Window1: 256x256, Window2: 128x128 */
1354 /* UV division: UV no change, Enable New edge enhancement */
1355 {0x0018, 0x8657}, /* Edge gain high threshold */
1356 {0x0020, 0x8658}, /* Edge gain low threshold */
1357 {0x000A, 0x8659}, /* Edge bandwidth high threshold */
1358 {0x0005, 0x865A}, /* Edge bandwidth low threshold */
1359 {0x0064, 0x8607}, /* UV filter enable */
1362 {0x0000, 0x86B0}, /* Bad pixels compensation address */
1363 {0x00DC, 0x86B1}, /* X coord for bad pixels compensation (L) */
1365 {0x0009, 0x86B3}, /* Y coord for bad pixels compensation (L) */
1393 /* READ { 0, 0x0000, 0x8608 } ->
1395 /* READ { 0, 0x0000, 0x8609 } ->
1397 /* READ { 0, 0x0000, 0x8610 } ->
1399 /* READ { 0, 0x0000, 0x8611 } ->
1401 /* READ { 0, 0x0000, 0x8612 } ->
1403 /* READ { 0, 0x0000, 0x8613 } ->
1405 /* READ { 0, 0x0000, 0x8614 } ->
1407 /* READ { 0, 0x0000, 0x8615 } ->
1409 /* READ { 0, 0x0000, 0x8616 } ->
1414 static int reg_write(struct usb_device *dev,
1415 __u16 index, __u16 value)
1419 ret = usb_control_msg(dev,
1420 usb_sndctrlpipe(dev, 0),
1422 USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1423 value, index, NULL, 0, 500);
1424 PDEBUG(D_USBO, "reg write i:0x%04x = 0x%02x",
1427 PDEBUG(D_ERR|D_USBO, "reg write: error %d", ret);
1432 /* returns: negative is error, pos or zero is data */
1433 static int reg_read(struct gspca_dev *gspca_dev,
1434 __u16 index) /* wIndex */
1438 ret = usb_control_msg(gspca_dev->dev,
1439 usb_rcvctrlpipe(gspca_dev->dev, 0),
1441 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1444 gspca_dev->usb_buf, 1,
1446 PDEBUG(D_USBI, "reg read i:%04x --> %02x",
1447 index, gspca_dev->usb_buf[0]);
1449 PDEBUG(D_ERR|D_USBI, "reg_read err %d", ret);
1452 return gspca_dev->usb_buf[0];
1455 static int write_vector(struct gspca_dev *gspca_dev,
1456 const __u16 data[][3])
1458 struct usb_device *dev = gspca_dev->dev;
1461 while (data[i][1] != 0) {
1462 ret = reg_write(dev, data[i][1], data[i][0]);
1470 /* this function is called at probe time */
1471 static int sd_config(struct gspca_dev *gspca_dev,
1472 const struct usb_device_id *id)
1474 struct sd *sd = (struct sd *) gspca_dev;
1478 /* Read from global register the USB product and vendor IDs, just to
1479 * prove that we can communicate with the device. This works, which
1480 * confirms at we are communicating properly and that the device
1482 data1 = reg_read(gspca_dev, 0x8104);
1483 data2 = reg_read(gspca_dev, 0x8105);
1484 PDEBUG(D_PROBE, "Webcam Vendor ID: 0x%02x%02x", data2, data1);
1486 data1 = reg_read(gspca_dev, 0x8106);
1487 data2 = reg_read(gspca_dev, 0x8107);
1488 PDEBUG(D_PROBE, "Webcam Product ID: 0x%02x%02x", data2, data1);
1490 data1 = reg_read(gspca_dev, 0x8621);
1491 PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1);
1493 cam = &gspca_dev->cam;
1495 cam->cam_mode = sif_mode;
1496 cam->nmodes = ARRAY_SIZE(sif_mode);
1498 sd->subtype = id->driver_info;
1499 sd->brightness = BRIGHTNESS_DEF;
1501 switch (sd->subtype) {
1502 case ViewQuestVQ110:
1503 if (write_vector(gspca_dev, spca508_init_data))
1507 /* case MicroInnovationIC200: */
1508 /* case IntelEasyPCCamera: */
1509 if (write_vector(gspca_dev, spca508cs110_init_data))
1512 case HamaUSBSightcam:
1513 if (write_vector(gspca_dev, spca508_sightcam_init_data))
1516 case HamaUSBSightcam2:
1517 if (write_vector(gspca_dev, spca508_sightcam2_init_data))
1521 if (write_vector(gspca_dev, spca508_vista_init_data))
1525 return 0; /* success */
1528 /* this function is called at open time */
1529 static int sd_open(struct gspca_dev *gspca_dev)
1531 /* write_vector(gspca_dev, spca508_open_data); */
1535 static void sd_start(struct gspca_dev *gspca_dev)
1539 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
1540 reg_write(gspca_dev->dev, 0x8500, mode);
1544 reg_write(gspca_dev->dev, 0x8700, 0x28); /* clock */
1549 reg_write(gspca_dev->dev, 0x8700, 0x23); /* clock */
1552 reg_write(gspca_dev->dev, 0x8112, 0x10 | 0x20);
1555 static void sd_stopN(struct gspca_dev *gspca_dev)
1557 /* Video ISO disable, Video Drop Packet enable: */
1558 reg_write(gspca_dev->dev, 0x8112, 0x20);
1561 static void sd_stop0(struct gspca_dev *gspca_dev)
1565 /* this function is called at close time */
1566 static void sd_close(struct gspca_dev *gspca_dev)
1570 /* convert YUVY per line to YUYV (YUV 4:2:2) */
1571 static void yuvy_decode(unsigned char *out,
1576 unsigned char *Ui, *Vi, *yi, *yi1;
1577 unsigned char *out1;
1581 for (i = height / 2; --i >= 0; ) {
1582 out1 = out + width * 2; /* next line */
1584 Vi = Ui + width / 2;
1585 yi1 = Vi + width / 2;
1586 for (j = width / 2; --j >= 0; ) {
1587 *out++ = 128 + *yi++;
1589 *out++ = 128 + *yi++;
1592 *out1++ = 128 + *yi1++;
1593 *out1++ = 128 + *Ui++;
1594 *out1++ = 128 + *yi1++;
1595 *out1++ = 128 + *Vi++;
1602 static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1603 struct gspca_frame *frame, /* target */
1604 __u8 *data, /* isoc packet */
1605 int len) /* iso packet length */
1607 struct sd *sd = (struct sd *) gspca_dev;
1610 case 0: /* start of frame */
1611 if (gspca_dev->last_packet_type == FIRST_PACKET) {
1612 yuvy_decode(sd->tmpbuf2, sd->tmpbuf,
1615 frame = gspca_frame_add(gspca_dev,
1623 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
1625 data += SPCA508_OFFSET_DATA;
1626 len -= SPCA508_OFFSET_DATA;
1628 memcpy(sd->tmpbuf, data, len);
1633 case 0xff: /* drop */
1634 /* gspca_dev->last_packet_type = DISCARD_PACKET; */
1639 memcpy(&sd->tmpbuf[sd->buflen], data, len);
1643 static void setbrightness(struct gspca_dev *gspca_dev)
1645 struct sd *sd = (struct sd *) gspca_dev;
1646 __u8 brightness = sd->brightness;
1648 /* MX seem contrast */
1649 reg_write(gspca_dev->dev, 0x8651, brightness);
1650 reg_write(gspca_dev->dev, 0x8652, brightness);
1651 reg_write(gspca_dev->dev, 0x8653, brightness);
1652 reg_write(gspca_dev->dev, 0x8654, brightness);
1655 static void getbrightness(struct gspca_dev *gspca_dev)
1657 struct sd *sd = (struct sd *) gspca_dev;
1659 sd->brightness = reg_read(gspca_dev, 0x8651);
1662 static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
1664 struct sd *sd = (struct sd *) gspca_dev;
1666 sd->brightness = val;
1667 if (gspca_dev->streaming)
1668 setbrightness(gspca_dev);
1672 static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
1674 struct sd *sd = (struct sd *) gspca_dev;
1676 getbrightness(gspca_dev);
1677 *val = sd->brightness;
1681 /* sub-driver description */
1682 static const struct sd_desc sd_desc = {
1683 .name = MODULE_NAME,
1685 .nctrls = ARRAY_SIZE(sd_ctrls),
1686 .config = sd_config,
1692 .pkt_scan = sd_pkt_scan,
1695 /* -- module initialisation -- */
1696 static const __devinitdata struct usb_device_id device_table[] = {
1697 {USB_DEVICE(0x0130, 0x0130), HamaUSBSightcam},
1698 {USB_DEVICE(0x041e, 0x4018), CreativeVista},
1699 {USB_DEVICE(0x0461, 0x0815), MicroInnovationIC200},
1700 {USB_DEVICE(0x0733, 0x0110), ViewQuestVQ110},
1701 {USB_DEVICE(0x0af9, 0x0010), HamaUSBSightcam},
1702 {USB_DEVICE(0x0af9, 0x0011), HamaUSBSightcam2},
1703 {USB_DEVICE(0x8086, 0x0110), IntelEasyPCCamera},
1706 MODULE_DEVICE_TABLE(usb, device_table);
1708 /* -- device connect -- */
1709 static int sd_probe(struct usb_interface *intf,
1710 const struct usb_device_id *id)
1712 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
1716 static struct usb_driver sd_driver = {
1717 .name = MODULE_NAME,
1718 .id_table = device_table,
1720 .disconnect = gspca_disconnect,
1723 /* -- module insert / remove -- */
1724 static int __init sd_mod_init(void)
1726 if (usb_register(&sd_driver) < 0)
1728 PDEBUG(D_PROBE, "registered");
1731 static void __exit sd_mod_exit(void)
1733 usb_deregister(&sd_driver);
1734 PDEBUG(D_PROBE, "deregistered");
1737 module_init(sd_mod_init);
1738 module_exit(sd_mod_exit);