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