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