diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-01-22 05:18:48 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:33 -0400 |
commit | 82e2549102a11c6ffc09f960e2325fd092c002a3 (patch) | |
tree | 662db1234e7bf5a6d5874d74fdbc2077149991cb /drivers/media/video | |
parent | 5932028f749fe26292948d6d7d7ae1ee912350b3 (diff) |
V4L/DVB (10380): gspca - t613: Cleanup and optimize code.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/gspca/t613.c | 379 |
1 files changed, 182 insertions, 197 deletions
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 76ba2c9588d7..8e89024b9135 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c | |||
@@ -37,18 +37,18 @@ MODULE_LICENSE("GPL"); | |||
37 | struct sd { | 37 | struct sd { |
38 | struct gspca_dev gspca_dev; /* !! must be the first item */ | 38 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
39 | 39 | ||
40 | unsigned char brightness; | 40 | u8 brightness; |
41 | unsigned char contrast; | 41 | u8 contrast; |
42 | unsigned char colors; | 42 | u8 colors; |
43 | unsigned char autogain; | 43 | u8 autogain; |
44 | unsigned char gamma; | 44 | u8 gamma; |
45 | unsigned char sharpness; | 45 | u8 sharpness; |
46 | unsigned char freq; | 46 | u8 freq; |
47 | unsigned char whitebalance; | 47 | u8 whitebalance; |
48 | unsigned char mirror; | 48 | u8 mirror; |
49 | unsigned char effect; | 49 | u8 effect; |
50 | 50 | ||
51 | __u8 sensor; | 51 | u8 sensor; |
52 | #define SENSOR_TAS5130A 0 | 52 | #define SENSOR_TAS5130A 0 |
53 | #define SENSOR_OM6802 1 | 53 | #define SENSOR_OM6802 1 |
54 | }; | 54 | }; |
@@ -78,7 +78,6 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, | |||
78 | struct v4l2_querymenu *menu); | 78 | struct v4l2_querymenu *menu); |
79 | 79 | ||
80 | static struct ctrl sd_ctrls[] = { | 80 | static struct ctrl sd_ctrls[] = { |
81 | #define SD_BRIGHTNESS 0 | ||
82 | { | 81 | { |
83 | { | 82 | { |
84 | .id = V4L2_CID_BRIGHTNESS, | 83 | .id = V4L2_CID_BRIGHTNESS, |
@@ -87,12 +86,12 @@ static struct ctrl sd_ctrls[] = { | |||
87 | .minimum = 0, | 86 | .minimum = 0, |
88 | .maximum = 14, | 87 | .maximum = 14, |
89 | .step = 1, | 88 | .step = 1, |
90 | .default_value = 8, | 89 | #define BRIGHTNESS_DEF 8 |
90 | .default_value = BRIGHTNESS_DEF, | ||
91 | }, | 91 | }, |
92 | .set = sd_setbrightness, | 92 | .set = sd_setbrightness, |
93 | .get = sd_getbrightness, | 93 | .get = sd_getbrightness, |
94 | }, | 94 | }, |
95 | #define SD_CONTRAST 1 | ||
96 | { | 95 | { |
97 | { | 96 | { |
98 | .id = V4L2_CID_CONTRAST, | 97 | .id = V4L2_CID_CONTRAST, |
@@ -101,12 +100,12 @@ static struct ctrl sd_ctrls[] = { | |||
101 | .minimum = 0, | 100 | .minimum = 0, |
102 | .maximum = 0x0d, | 101 | .maximum = 0x0d, |
103 | .step = 1, | 102 | .step = 1, |
104 | .default_value = 0x07, | 103 | #define CONTRAST_DEF 0x07 |
104 | .default_value = CONTRAST_DEF, | ||
105 | }, | 105 | }, |
106 | .set = sd_setcontrast, | 106 | .set = sd_setcontrast, |
107 | .get = sd_getcontrast, | 107 | .get = sd_getcontrast, |
108 | }, | 108 | }, |
109 | #define SD_COLOR 2 | ||
110 | { | 109 | { |
111 | { | 110 | { |
112 | .id = V4L2_CID_SATURATION, | 111 | .id = V4L2_CID_SATURATION, |
@@ -115,7 +114,8 @@ static struct ctrl sd_ctrls[] = { | |||
115 | .minimum = 0, | 114 | .minimum = 0, |
116 | .maximum = 0x0f, | 115 | .maximum = 0x0f, |
117 | .step = 1, | 116 | .step = 1, |
118 | .default_value = 0x05, | 117 | #define COLORS_DEF 0x05 |
118 | .default_value = COLORS_DEF, | ||
119 | }, | 119 | }, |
120 | .set = sd_setcolors, | 120 | .set = sd_setcolors, |
121 | .get = sd_getcolors, | 121 | .get = sd_getcolors, |
@@ -135,7 +135,6 @@ static struct ctrl sd_ctrls[] = { | |||
135 | .set = sd_setgamma, | 135 | .set = sd_setgamma, |
136 | .get = sd_getgamma, | 136 | .get = sd_getgamma, |
137 | }, | 137 | }, |
138 | #define SD_AUTOGAIN 4 | ||
139 | { | 138 | { |
140 | { | 139 | { |
141 | .id = V4L2_CID_GAIN, /* here, i activate only the lowlight, | 140 | .id = V4L2_CID_GAIN, /* here, i activate only the lowlight, |
@@ -146,12 +145,12 @@ static struct ctrl sd_ctrls[] = { | |||
146 | .minimum = 0, | 145 | .minimum = 0, |
147 | .maximum = 1, | 146 | .maximum = 1, |
148 | .step = 1, | 147 | .step = 1, |
149 | .default_value = 0x01, | 148 | #define AUTOGAIN_DEF 0x01 |
149 | .default_value = AUTOGAIN_DEF, | ||
150 | }, | 150 | }, |
151 | .set = sd_setlowlight, | 151 | .set = sd_setlowlight, |
152 | .get = sd_getlowlight, | 152 | .get = sd_getlowlight, |
153 | }, | 153 | }, |
154 | #define SD_MIRROR 5 | ||
155 | { | 154 | { |
156 | { | 155 | { |
157 | .id = V4L2_CID_HFLIP, | 156 | .id = V4L2_CID_HFLIP, |
@@ -160,12 +159,12 @@ static struct ctrl sd_ctrls[] = { | |||
160 | .minimum = 0, | 159 | .minimum = 0, |
161 | .maximum = 1, | 160 | .maximum = 1, |
162 | .step = 1, | 161 | .step = 1, |
163 | .default_value = 0, | 162 | #define MIRROR_DEF 0 |
163 | .default_value = MIRROR_DEF, | ||
164 | }, | 164 | }, |
165 | .set = sd_setflip, | 165 | .set = sd_setflip, |
166 | .get = sd_getflip | 166 | .get = sd_getflip |
167 | }, | 167 | }, |
168 | #define SD_LIGHTFREQ 6 | ||
169 | { | 168 | { |
170 | { | 169 | { |
171 | .id = V4L2_CID_POWER_LINE_FREQUENCY, | 170 | .id = V4L2_CID_POWER_LINE_FREQUENCY, |
@@ -174,12 +173,12 @@ static struct ctrl sd_ctrls[] = { | |||
174 | .minimum = 1, /* 1 -> 0x50, 2->0x60 */ | 173 | .minimum = 1, /* 1 -> 0x50, 2->0x60 */ |
175 | .maximum = 2, | 174 | .maximum = 2, |
176 | .step = 1, | 175 | .step = 1, |
177 | .default_value = 1, | 176 | #define FREQ_DEF 1 |
177 | .default_value = FREQ_DEF, | ||
178 | }, | 178 | }, |
179 | .set = sd_setfreq, | 179 | .set = sd_setfreq, |
180 | .get = sd_getfreq}, | 180 | .get = sd_getfreq}, |
181 | 181 | ||
182 | #define SD_WHITE_BALANCE 7 | ||
183 | { | 182 | { |
184 | { | 183 | { |
185 | .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE, | 184 | .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE, |
@@ -188,12 +187,12 @@ static struct ctrl sd_ctrls[] = { | |||
188 | .minimum = 0, | 187 | .minimum = 0, |
189 | .maximum = 1, | 188 | .maximum = 1, |
190 | .step = 1, | 189 | .step = 1, |
191 | .default_value = 0, | 190 | #define WHITE_BALANCE_DEF 0 |
191 | .default_value = WHITE_BALANCE_DEF, | ||
192 | }, | 192 | }, |
193 | .set = sd_setwhitebalance, | 193 | .set = sd_setwhitebalance, |
194 | .get = sd_getwhitebalance | 194 | .get = sd_getwhitebalance |
195 | }, | 195 | }, |
196 | #define SD_SHARPNESS 8 /* (aka definition on win) */ | ||
197 | { | 196 | { |
198 | { | 197 | { |
199 | .id = V4L2_CID_SHARPNESS, | 198 | .id = V4L2_CID_SHARPNESS, |
@@ -202,12 +201,12 @@ static struct ctrl sd_ctrls[] = { | |||
202 | .minimum = 0, | 201 | .minimum = 0, |
203 | .maximum = 15, | 202 | .maximum = 15, |
204 | .step = 1, | 203 | .step = 1, |
205 | .default_value = 0x06, | 204 | #define SHARPNESS_DEF 0x06 |
205 | .default_value = SHARPNESS_DEF, | ||
206 | }, | 206 | }, |
207 | .set = sd_setsharpness, | 207 | .set = sd_setsharpness, |
208 | .get = sd_getsharpness, | 208 | .get = sd_getsharpness, |
209 | }, | 209 | }, |
210 | #define SD_EFFECTS 9 | ||
211 | { | 210 | { |
212 | { | 211 | { |
213 | .id = V4L2_CID_EFFECTS, | 212 | .id = V4L2_CID_EFFECTS, |
@@ -216,7 +215,8 @@ static struct ctrl sd_ctrls[] = { | |||
216 | .minimum = 0, | 215 | .minimum = 0, |
217 | .maximum = 4, | 216 | .maximum = 4, |
218 | .step = 1, | 217 | .step = 1, |
219 | .default_value = 0, | 218 | #define EFFECTS_DEF 0 |
219 | .default_value = EFFECTS_DEF, | ||
220 | }, | 220 | }, |
221 | .set = sd_seteffect, | 221 | .set = sd_seteffect, |
222 | .get = sd_geteffect | 222 | .get = sd_geteffect |
@@ -263,28 +263,22 @@ static const struct v4l2_pix_format vga_mode_t16[] = { | |||
263 | 263 | ||
264 | /* sensor specific data */ | 264 | /* sensor specific data */ |
265 | struct additional_sensor_data { | 265 | struct additional_sensor_data { |
266 | const __u8 data1[20]; | 266 | const u8 data1[10]; |
267 | const __u8 data2[18]; | 267 | const u8 data2[9]; |
268 | const __u8 data3[18]; | 268 | const u8 data3[9]; |
269 | const __u8 data4[4]; | 269 | const u8 data4[4]; |
270 | const __u8 data5[6]; | 270 | const u8 data5[6]; |
271 | const __u8 stream[4]; | 271 | const u8 stream[4]; |
272 | }; | 272 | }; |
273 | 273 | ||
274 | const static struct additional_sensor_data sensor_data[] = { | 274 | const static struct additional_sensor_data sensor_data[] = { |
275 | { /* TAS5130A */ | 275 | { /* TAS5130A */ |
276 | .data1 = | 276 | .data1 = |
277 | {0xd0, 0xbb, 0xd1, 0x28, 0xd2, 0x10, 0xd3, 0x10, | 277 | {0xbb, 0x28, 0x10, 0x10, 0xbb, 0x28, 0x1e, 0x27, |
278 | 0xd4, 0xbb, 0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27, | 278 | 0xc8, 0xfc}, |
279 | 0xd8, 0xc8, 0xd9, 0xfc}, | ||
280 | .data2 = | 279 | .data2 = |
281 | {0xe0, 0x60, 0xe1, 0xa8, 0xe2, 0xe0, 0xe3, 0x60, | 280 | {0x60, 0xa8, 0xe0, 0x60, 0xa8, 0xe0, 0x60, 0xa8, |
282 | 0xe4, 0xa8, 0xe5, 0xe0, 0xe6, 0x60, 0xe7, 0xa8, | 281 | 0xe0}, |
283 | 0xe8, 0xe0}, | ||
284 | .data3 = | ||
285 | {0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, | ||
286 | 0xcb, 0xa8, 0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8, | ||
287 | 0xcf, 0xe0}, | ||
288 | .data4 = /* Freq (50/60Hz). Splitted for test purpose */ | 282 | .data4 = /* Freq (50/60Hz). Splitted for test purpose */ |
289 | {0x66, 0x00, 0xa8, 0xe8}, | 283 | {0x66, 0x00, 0xa8, 0xe8}, |
290 | .data5 = | 284 | .data5 = |
@@ -294,17 +288,11 @@ const static struct additional_sensor_data sensor_data[] = { | |||
294 | }, | 288 | }, |
295 | { /* OM6802 */ | 289 | { /* OM6802 */ |
296 | .data1 = | 290 | .data1 = |
297 | {0xd0, 0xc2, 0xd1, 0x28, 0xd2, 0x0f, 0xd3, 0x22, | 291 | {0xc2, 0x28, 0x0f, 0x22, 0xcd, 0x27, 0x2c, 0x06, |
298 | 0xd4, 0xcd, 0xd5, 0x27, 0xd6, 0x2c, 0xd7, 0x06, | 292 | 0xb3, 0xfc}, |
299 | 0xd8, 0xb3, 0xd9, 0xfc}, | ||
300 | .data2 = | 293 | .data2 = |
301 | {0xe0, 0x80, 0xe1, 0xff, 0xe2, 0xff, 0xe3, 0x80, | 294 | {0x80, 0xff, 0xff, 0x80, 0xff, 0xff, 0x80, 0xff, |
302 | 0xe4, 0xff, 0xe5, 0xff, 0xe6, 0x80, 0xe7, 0xff, | 295 | 0xff}, |
303 | 0xe8, 0xff}, | ||
304 | .data3 = | ||
305 | {0xc7, 0x80, 0xc8, 0xff, 0xc9, 0xff, 0xca, 0x80, | ||
306 | 0xcb, 0xff, 0xcc, 0xff, 0xcd, 0x80, 0xce, 0xff, | ||
307 | 0xcf, 0xff}, | ||
308 | .data4 = /*Freq (50/60Hz). Splitted for test purpose */ | 296 | .data4 = /*Freq (50/60Hz). Splitted for test purpose */ |
309 | {0x66, 0xca, 0xa8, 0xf0 }, | 297 | {0x66, 0xca, 0xa8, 0xf0 }, |
310 | .data5 = /* this could be removed later */ | 298 | .data5 = /* this could be removed later */ |
@@ -317,7 +305,7 @@ const static struct additional_sensor_data sensor_data[] = { | |||
317 | #define MAX_EFFECTS 7 | 305 | #define MAX_EFFECTS 7 |
318 | /* easily done by soft, this table could be removed, | 306 | /* easily done by soft, this table could be removed, |
319 | * i keep it here just in case */ | 307 | * i keep it here just in case */ |
320 | static const __u8 effects_table[MAX_EFFECTS][6] = { | 308 | static const u8 effects_table[MAX_EFFECTS][6] = { |
321 | {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x00}, /* Normal */ | 309 | {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x00}, /* Normal */ |
322 | {0xa8, 0xc8, 0xc6, 0x52, 0xc0, 0x04}, /* Repujar */ | 310 | {0xa8, 0xc8, 0xc6, 0x52, 0xc0, 0x04}, /* Repujar */ |
323 | {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x20}, /* Monochrome */ | 311 | {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x20}, /* Monochrome */ |
@@ -327,90 +315,58 @@ static const __u8 effects_table[MAX_EFFECTS][6] = { | |||
327 | {0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x40}, /* Negative */ | 315 | {0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x40}, /* Negative */ |
328 | }; | 316 | }; |
329 | 317 | ||
330 | static const __u8 gamma_table[GAMMA_MAX][34] = { | 318 | static const u8 gamma_table[GAMMA_MAX][17] = { |
331 | {0x90, 0x00, 0x91, 0x3e, 0x92, 0x69, 0x93, 0x85, /* 0 */ | 319 | {0x00, 0x3e, 0x69, 0x85, 0x95, 0xa1, 0xae, 0xb9, /* 0 */ |
332 | 0x94, 0x95, 0x95, 0xa1, 0x96, 0xae, 0x97, 0xb9, | 320 | 0xc2, 0xcb, 0xd4, 0xdb, 0xe3, 0xea, 0xf1, 0xf8, |
333 | 0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdb, | 321 | 0xff}, |
334 | 0x9c, 0xe3, 0x9d, 0xea, 0x9e, 0xf1, 0x9f, 0xf8, | 322 | {0x00, 0x33, 0x5a, 0x75, 0x85, 0x93, 0xa1, 0xad, /* 1 */ |
335 | 0xa0, 0xff}, | 323 | 0xb7, 0xc2, 0xcb, 0xd4, 0xde, 0xe7, 0xf0, 0xf7, |
336 | {0x90, 0x00, 0x91, 0x33, 0x92, 0x5a, 0x93, 0x75, /* 1 */ | 324 | 0xff}, |
337 | 0x94, 0x85, 0x95, 0x93, 0x96, 0xa1, 0x97, 0xad, | 325 | {0x00, 0x2f, 0x51, 0x6b, 0x7c, 0x8a, 0x99, 0xa6, /* 2 */ |
338 | 0x98, 0xb7, 0x99, 0xc2, 0x9a, 0xcb, 0x9b, 0xd4, | 326 | 0xb1, 0xbc, 0xc6, 0xd0, 0xdb, 0xe4, 0xed, 0xf6, |
339 | 0x9c, 0xde, 0x9D, 0xe7, 0x9e, 0xf0, 0x9f, 0xf7, | 327 | 0xff}, |
340 | 0xa0, 0xff}, | 328 | {0x00, 0x29, 0x48, 0x60, 0x72, 0x81, 0x90, 0x9e, /* 3 */ |
341 | {0x90, 0x00, 0x91, 0x2f, 0x92, 0x51, 0x93, 0x6b, /* 2 */ | 329 | 0xaa, 0xb5, 0xbf, 0xcb, 0xd6, 0xe1, 0xeb, 0xf5, |
342 | 0x94, 0x7c, 0x95, 0x8a, 0x96, 0x99, 0x97, 0xa6, | 330 | 0xff}, |
343 | 0x98, 0xb1, 0x99, 0xbc, 0x9a, 0xc6, 0x9b, 0xd0, | 331 | {0x00, 0x23, 0x3f, 0x55, 0x68, 0x77, 0x86, 0x95, /* 4 */ |
344 | 0x9c, 0xdb, 0x9d, 0xe4, 0x9e, 0xed, 0x9f, 0xf6, | 332 | 0xa2, 0xad, 0xb9, 0xc6, 0xd2, 0xde, 0xe9, 0xf4, |
345 | 0xa0, 0xff}, | 333 | 0xff}, |
346 | {0x90, 0x00, 0x91, 0x29, 0x92, 0x48, 0x93, 0x60, /* 3 */ | 334 | {0x00, 0x1b, 0x33, 0x48, 0x59, 0x69, 0x79, 0x87, /* 5 */ |
347 | 0x94, 0x72, 0x95, 0x81, 0x96, 0x90, 0x97, 0x9e, | 335 | 0x96, 0xa3, 0xb1, 0xbe, 0xcc, 0xda, 0xe7, 0xf3, |
348 | 0x98, 0xaa, 0x99, 0xb5, 0x9a, 0xbf, 0x9b, 0xcb, | 336 | 0xff}, |
349 | 0x9c, 0xd6, 0x9d, 0xe1, 0x9e, 0xeb, 0x9f, 0xf5, | 337 | {0x00, 0x02, 0x10, 0x20, 0x32, 0x40, 0x57, 0x67, /* 6 */ |
350 | 0xa0, 0xff}, | 338 | 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, |
351 | {0x90, 0x00, 0x91, 0x23, 0x92, 0x3f, 0x93, 0x55, /* 4 */ | 339 | 0xff}, |
352 | 0x94, 0x68, 0x95, 0x77, 0x96, 0x86, 0x97, 0x95, | 340 | {0x00, 0x02, 0x14, 0x26, 0x38, 0x4a, 0x60, 0x70, /* 7 */ |
353 | 0x98, 0xa2, 0x99, 0xad, 0x9a, 0xb9, 0x9b, 0xc6, | 341 | 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, |
354 | 0x9c, 0xd2, 0x9d, 0xde, 0x9e, 0xe9, 0x9f, 0xf4, | 342 | 0xff}, |
355 | 0xa0, 0xff}, | 343 | {0x00, 0x10, 0x22, 0x35, 0x47, 0x5a, 0x69, 0x79, /* 8 */ |
356 | {0x90, 0x00, 0x91, 0x1b, 0x92, 0x33, 0x93, 0x48, /* 5 */ | 344 | 0x88, 0x97, 0xa7, 0xb6, 0xc4, 0xd3, 0xe0, 0xf0, |
357 | 0x94, 0x59, 0x95, 0x69, 0x96, 0x79, 0x97, 0x87, | 345 | 0xff}, |
358 | 0x98, 0x96, 0x99, 0xa3, 0x9a, 0xb1, 0x9b, 0xbe, | 346 | {0x00, 0x10, 0x26, 0x40, 0x54, 0x65, 0x75, 0x84, /* 9 */ |
359 | 0x9c, 0xcc, 0x9d, 0xda, 0x9e, 0xe7, 0x9f, 0xf3, | 347 | 0x93, 0xa1, 0xb0, 0xbd, 0xca, 0xd6, 0xe0, 0xf0, |
360 | 0xa0, 0xff}, | 348 | 0xff}, |
361 | {0x90, 0x00, 0x91, 0x02, 0x92, 0x10, 0x93, 0x20, /* 6 */ | 349 | {0x00, 0x18, 0x2b, 0x44, 0x60, 0x70, 0x80, 0x8e, /* 10 */ |
362 | 0x94, 0x32, 0x95, 0x40, 0x96, 0x57, 0x97, 0x67, | 350 | 0x9c, 0xaa, 0xb7, 0xc4, 0xd0, 0xd8, 0xe2, 0xf0, |
363 | 0x98, 0x77, 0x99, 0x88, 0x9a, 0x99, 0x9b, 0xaa, | 351 | 0xff}, |
364 | 0x9c, 0xbb, 0x9d, 0xcc, 0x9e, 0xdd, 0x9f, 0xee, | 352 | {0x00, 0x1a, 0x34, 0x52, 0x66, 0x7e, 0x8D, 0x9B, /* 11 */ |
365 | 0xa0, 0xff}, | 353 | 0xa8, 0xb4, 0xc0, 0xcb, 0xd6, 0xe1, 0xeb, 0xf5, |
366 | {0x90, 0x00, 0x91, 0x02, 0x92, 0x14, 0x93, 0x26, /* 7 */ | 354 | 0xff}, |
367 | 0x94, 0x38, 0x95, 0x4a, 0x96, 0x60, 0x97, 0x70, | 355 | {0x00, 0x3f, 0x5a, 0x6e, 0x7f, 0x8e, 0x9c, 0xa8, /* 12 */ |
368 | 0x98, 0x80, 0x99, 0x90, 0x9a, 0xa0, 0x9b, 0xb0, | 356 | 0xb4, 0xbf, 0xc9, 0xd3, 0xdc, 0xe5, 0xee, 0xf6, |
369 | 0x9c, 0xc0, 0x9D, 0xd0, 0x9e, 0xe0, 0x9f, 0xf0, | 357 | 0xff}, |
370 | 0xa0, 0xff}, | 358 | {0x00, 0x54, 0x6f, 0x83, 0x93, 0xa0, 0xad, 0xb7, /* 13 */ |
371 | {0x90, 0x00, 0x91, 0x10, 0x92, 0x22, 0x93, 0x35, /* 8 */ | 359 | 0xc2, 0xcb, 0xd4, 0xdc, 0xe4, 0xeb, 0xf2, 0xf9, |
372 | 0x94, 0x47, 0x95, 0x5a, 0x96, 0x69, 0x97, 0x79, | 360 | 0xff}, |
373 | 0x98, 0x88, 0x99, 0x97, 0x9a, 0xa7, 0x9b, 0xb6, | 361 | {0x00, 0x6e, 0x88, 0x9a, 0xa8, 0xb3, 0xbd, 0xc6, /* 14 */ |
374 | 0x9c, 0xc4, 0x9d, 0xd3, 0x9e, 0xe0, 0x9f, 0xf0, | 362 | 0xcf, 0xd6, 0xdd, 0xe3, 0xe9, 0xef, 0xf4, 0xfa, |
375 | 0xa0, 0xff}, | 363 | 0xff}, |
376 | {0x90, 0x00, 0x91, 0x10, 0x92, 0x26, 0x93, 0x40, /* 9 */ | 364 | {0x00, 0x93, 0xa8, 0xb7, 0xc1, 0xca, 0xd2, 0xd8, /* 15 */ |
377 | 0x94, 0x54, 0x95, 0x65, 0x96, 0x75, 0x97, 0x84, | 365 | 0xde, 0xe3, 0xe8, 0xed, 0xf1, 0xf5, 0xf8, 0xfc, |
378 | 0x98, 0x93, 0x99, 0xa1, 0x9a, 0xb0, 0x9b, 0xbd, | 366 | 0xff} |
379 | 0x9c, 0xca, 0x9d, 0xd6, 0x9e, 0xe0, 0x9f, 0xf0, | ||
380 | 0xa0, 0xff}, | ||
381 | {0x90, 0x00, 0x91, 0x18, 0x92, 0x2b, 0x93, 0x44, /* 10 */ | ||
382 | 0x94, 0x60, 0x95, 0x70, 0x96, 0x80, 0x97, 0x8e, | ||
383 | 0x98, 0x9c, 0x99, 0xaa, 0x9a, 0xb7, 0x9b, 0xc4, | ||
384 | 0x9c, 0xd0, 0x9d, 0xd8, 0x9e, 0xe2, 0x9f, 0xf0, | ||
385 | 0xa0, 0xff}, | ||
386 | {0x90, 0x00, 0x91, 0x1a, 0x92, 0x34, 0x93, 0x52, /* 11 */ | ||
387 | 0x94, 0x66, 0x95, 0x7e, 0x96, 0x8D, 0x97, 0x9B, | ||
388 | 0x98, 0xa8, 0x99, 0xb4, 0x9a, 0xc0, 0x9b, 0xcb, | ||
389 | 0x9c, 0xd6, 0x9d, 0xe1, 0x9e, 0xeb, 0x9f, 0xf5, | ||
390 | 0xa0, 0xff}, | ||
391 | {0x90, 0x00, 0x91, 0x3f, 0x92, 0x5a, 0x93, 0x6e, /* 12 */ | ||
392 | 0x94, 0x7f, 0x95, 0x8e, 0x96, 0x9c, 0x97, 0xa8, | ||
393 | 0x98, 0xb4, 0x99, 0xbf, 0x9a, 0xc9, 0x9b, 0xd3, | ||
394 | 0x9c, 0xdc, 0x9d, 0xe5, 0x9e, 0xee, 0x9f, 0xf6, | ||
395 | 0xa0, 0xff}, | ||
396 | {0x90, 0x00, 0x91, 0x54, 0x92, 0x6f, 0x93, 0x83, /* 13 */ | ||
397 | 0x94, 0x93, 0x95, 0xa0, 0x96, 0xad, 0x97, 0xb7, | ||
398 | 0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdc, | ||
399 | 0x9c, 0xe4, 0x9d, 0xeb, 0x9e, 0xf2, 0x9f, 0xf9, | ||
400 | 0xa0, 0xff}, | ||
401 | {0x90, 0x00, 0x91, 0x6e, 0x92, 0x88, 0x93, 0x9a, /* 14 */ | ||
402 | 0x94, 0xa8, 0x95, 0xb3, 0x96, 0xbd, 0x97, 0xc6, | ||
403 | 0x98, 0xcf, 0x99, 0xd6, 0x9a, 0xdd, 0x9b, 0xe3, | ||
404 | 0x9c, 0xe9, 0x9d, 0xef, 0x9e, 0xf4, 0x9f, 0xfa, | ||
405 | 0xa0, 0xff}, | ||
406 | {0x90, 0x00, 0x91, 0x93, 0x92, 0xa8, 0x93, 0xb7, /* 15 */ | ||
407 | 0x94, 0xc1, 0x95, 0xca, 0x96, 0xd2, 0x97, 0xd8, | ||
408 | 0x98, 0xde, 0x99, 0xe3, 0x9a, 0xe8, 0x9b, 0xed, | ||
409 | 0x9c, 0xf1, 0x9d, 0xf5, 0x9e, 0xf8, 0x9f, 0xfc, | ||
410 | 0xa0, 0xff} | ||
411 | }; | 367 | }; |
412 | 368 | ||
413 | static const __u8 tas5130a_sensor_init[][8] = { | 369 | static const u8 tas5130a_sensor_init[][8] = { |
414 | {0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09}, | 370 | {0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09}, |
415 | {0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09}, | 371 | {0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09}, |
416 | {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09}, | 372 | {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09}, |
@@ -418,11 +374,11 @@ static const __u8 tas5130a_sensor_init[][8] = { | |||
418 | {}, | 374 | {}, |
419 | }; | 375 | }; |
420 | 376 | ||
421 | static __u8 sensor_reset[] = {0x61, 0x68, 0x62, 0xff, 0x60, 0x07}; | 377 | static u8 sensor_reset[] = {0x61, 0x68, 0x62, 0xff, 0x60, 0x07}; |
422 | 378 | ||
423 | /* read 1 byte */ | 379 | /* read 1 byte */ |
424 | static int reg_r(struct gspca_dev *gspca_dev, | 380 | static u8 reg_r(struct gspca_dev *gspca_dev, |
425 | __u16 index) | 381 | u16 index) |
426 | { | 382 | { |
427 | usb_control_msg(gspca_dev->dev, | 383 | usb_control_msg(gspca_dev->dev, |
428 | usb_rcvctrlpipe(gspca_dev->dev, 0), | 384 | usb_rcvctrlpipe(gspca_dev->dev, 0), |
@@ -435,7 +391,7 @@ static int reg_r(struct gspca_dev *gspca_dev, | |||
435 | } | 391 | } |
436 | 392 | ||
437 | static void reg_w(struct gspca_dev *gspca_dev, | 393 | static void reg_w(struct gspca_dev *gspca_dev, |
438 | __u16 index) | 394 | u16 index) |
439 | { | 395 | { |
440 | usb_control_msg(gspca_dev->dev, | 396 | usb_control_msg(gspca_dev->dev, |
441 | usb_sndctrlpipe(gspca_dev->dev, 0), | 397 | usb_sndctrlpipe(gspca_dev->dev, 0), |
@@ -446,7 +402,7 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
446 | } | 402 | } |
447 | 403 | ||
448 | static void reg_w_buf(struct gspca_dev *gspca_dev, | 404 | static void reg_w_buf(struct gspca_dev *gspca_dev, |
449 | const __u8 *buffer, __u16 len) | 405 | const u8 *buffer, u16 len) |
450 | { | 406 | { |
451 | if (len <= USB_BUF_SZ) { | 407 | if (len <= USB_BUF_SZ) { |
452 | memcpy(gspca_dev->usb_buf, buffer, len); | 408 | memcpy(gspca_dev->usb_buf, buffer, len); |
@@ -457,7 +413,7 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, | |||
457 | 0x01, 0, | 413 | 0x01, 0, |
458 | gspca_dev->usb_buf, len, 500); | 414 | gspca_dev->usb_buf, len, 500); |
459 | } else { | 415 | } else { |
460 | __u8 *tmpbuf; | 416 | u8 *tmpbuf; |
461 | 417 | ||
462 | tmpbuf = kmalloc(len, GFP_KERNEL); | 418 | tmpbuf = kmalloc(len, GFP_KERNEL); |
463 | memcpy(tmpbuf, buffer, len); | 419 | memcpy(tmpbuf, buffer, len); |
@@ -471,14 +427,41 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, | |||
471 | } | 427 | } |
472 | } | 428 | } |
473 | 429 | ||
430 | /* write values to consecutive registers */ | ||
431 | static void reg_w_ixbuf(struct gspca_dev *gspca_dev, | ||
432 | u8 reg, | ||
433 | const u8 *buffer, u16 len) | ||
434 | { | ||
435 | int i; | ||
436 | u8 *p, *tmpbuf; | ||
437 | |||
438 | if (len * 2 <= USB_BUF_SZ) | ||
439 | p = tmpbuf = gspca_dev->usb_buf; | ||
440 | else | ||
441 | p = tmpbuf = kmalloc(len * 2, GFP_KERNEL); | ||
442 | i = len; | ||
443 | while (--i >= 0) { | ||
444 | *p++ = reg++; | ||
445 | *p++ = *buffer++; | ||
446 | } | ||
447 | usb_control_msg(gspca_dev->dev, | ||
448 | usb_sndctrlpipe(gspca_dev->dev, 0), | ||
449 | 0, | ||
450 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
451 | 0x01, 0, | ||
452 | tmpbuf, len * 2, 500); | ||
453 | if (len * 2 > USB_BUF_SZ) | ||
454 | kfree(tmpbuf); | ||
455 | } | ||
456 | |||
474 | /* Reported as OM6802*/ | 457 | /* Reported as OM6802*/ |
475 | static void om6802_sensor_init(struct gspca_dev *gspca_dev) | 458 | static void om6802_sensor_init(struct gspca_dev *gspca_dev) |
476 | { | 459 | { |
477 | int i; | 460 | int i; |
478 | const __u8 *p; | 461 | const u8 *p; |
479 | __u8 byte; | 462 | u8 byte; |
480 | __u8 val[6] = {0x62, 0, 0x64, 0, 0x60, 0x05}; | 463 | u8 val[6] = {0x62, 0, 0x64, 0, 0x60, 0x05}; |
481 | static const __u8 sensor_init[] = { | 464 | static const u8 sensor_init[] = { |
482 | 0xdf, 0x6d, | 465 | 0xdf, 0x6d, |
483 | 0xdd, 0x18, | 466 | 0xdd, 0x18, |
484 | 0x5a, 0xe0, | 467 | 0x5a, 0xe0, |
@@ -542,15 +525,16 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
542 | cam->cam_mode = vga_mode_t16; | 525 | cam->cam_mode = vga_mode_t16; |
543 | cam->nmodes = ARRAY_SIZE(vga_mode_t16); | 526 | cam->nmodes = ARRAY_SIZE(vga_mode_t16); |
544 | 527 | ||
545 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; | 528 | sd->brightness = BRIGHTNESS_DEF; |
546 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; | 529 | sd->contrast = CONTRAST_DEF; |
547 | sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; | 530 | sd->colors = COLORS_DEF; |
548 | sd->gamma = GAMMA_DEF; | 531 | sd->gamma = GAMMA_DEF; |
549 | sd->mirror = sd_ctrls[SD_MIRROR].qctrl.default_value; | 532 | sd->autogain = AUTOGAIN_DEF; |
550 | sd->freq = sd_ctrls[SD_LIGHTFREQ].qctrl.default_value; | 533 | sd->mirror = MIRROR_DEF; |
551 | sd->whitebalance = sd_ctrls[SD_WHITE_BALANCE].qctrl.default_value; | 534 | sd->freq = FREQ_DEF; |
552 | sd->sharpness = sd_ctrls[SD_SHARPNESS].qctrl.default_value; | 535 | sd->whitebalance = WHITE_BALANCE_DEF; |
553 | sd->effect = sd_ctrls[SD_EFFECTS].qctrl.default_value; | 536 | sd->sharpness = SHARPNESS_DEF; |
537 | sd->effect = EFFECTS_DEF; | ||
554 | return 0; | 538 | return 0; |
555 | } | 539 | } |
556 | 540 | ||
@@ -558,7 +542,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
558 | { | 542 | { |
559 | struct sd *sd = (struct sd *) gspca_dev; | 543 | struct sd *sd = (struct sd *) gspca_dev; |
560 | unsigned int brightness; | 544 | unsigned int brightness; |
561 | __u8 set6[4] = { 0x8f, 0x24, 0xc3, 0x00 }; | 545 | u8 set6[4] = { 0x8f, 0x24, 0xc3, 0x00 }; |
562 | 546 | ||
563 | brightness = sd->brightness; | 547 | brightness = sd->brightness; |
564 | if (brightness < 7) { | 548 | if (brightness < 7) { |
@@ -575,7 +559,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) | |||
575 | { | 559 | { |
576 | struct sd *sd = (struct sd *) gspca_dev; | 560 | struct sd *sd = (struct sd *) gspca_dev; |
577 | unsigned int contrast = sd->contrast; | 561 | unsigned int contrast = sd->contrast; |
578 | __u16 reg_to_write; | 562 | u16 reg_to_write; |
579 | 563 | ||
580 | if (contrast < 7) | 564 | if (contrast < 7) |
581 | reg_to_write = 0x8ea9 - contrast * 0x200; | 565 | reg_to_write = 0x8ea9 - contrast * 0x200; |
@@ -588,7 +572,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) | |||
588 | static void setcolors(struct gspca_dev *gspca_dev) | 572 | static void setcolors(struct gspca_dev *gspca_dev) |
589 | { | 573 | { |
590 | struct sd *sd = (struct sd *) gspca_dev; | 574 | struct sd *sd = (struct sd *) gspca_dev; |
591 | __u16 reg_to_write; | 575 | u16 reg_to_write; |
592 | 576 | ||
593 | reg_to_write = 0x80bb + sd->colors * 0x100; /* was 0xc0 */ | 577 | reg_to_write = 0x80bb + sd->colors * 0x100; /* was 0xc0 */ |
594 | reg_w(gspca_dev, reg_to_write); | 578 | reg_w(gspca_dev, reg_to_write); |
@@ -599,14 +583,15 @@ static void setgamma(struct gspca_dev *gspca_dev) | |||
599 | struct sd *sd = (struct sd *) gspca_dev; | 583 | struct sd *sd = (struct sd *) gspca_dev; |
600 | 584 | ||
601 | PDEBUG(D_CONF, "Gamma: %d", sd->gamma); | 585 | PDEBUG(D_CONF, "Gamma: %d", sd->gamma); |
602 | reg_w_buf(gspca_dev, gamma_table[sd->gamma], sizeof gamma_table[0]); | 586 | reg_w_ixbuf(gspca_dev, 0x90, |
587 | gamma_table[sd->gamma], sizeof gamma_table[0]); | ||
603 | } | 588 | } |
604 | 589 | ||
605 | static void setwhitebalance(struct gspca_dev *gspca_dev) | 590 | static void setwhitebalance(struct gspca_dev *gspca_dev) |
606 | { | 591 | { |
607 | struct sd *sd = (struct sd *) gspca_dev; | 592 | struct sd *sd = (struct sd *) gspca_dev; |
608 | 593 | ||
609 | __u8 white_balance[8] = | 594 | u8 white_balance[8] = |
610 | {0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38}; | 595 | {0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38}; |
611 | 596 | ||
612 | if (sd->whitebalance) | 597 | if (sd->whitebalance) |
@@ -618,7 +603,7 @@ static void setwhitebalance(struct gspca_dev *gspca_dev) | |||
618 | static void setsharpness(struct gspca_dev *gspca_dev) | 603 | static void setsharpness(struct gspca_dev *gspca_dev) |
619 | { | 604 | { |
620 | struct sd *sd = (struct sd *) gspca_dev; | 605 | struct sd *sd = (struct sd *) gspca_dev; |
621 | __u16 reg_to_write; | 606 | u16 reg_to_write; |
622 | 607 | ||
623 | reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness; | 608 | reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness; |
624 | 609 | ||
@@ -634,18 +619,18 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
634 | * to see the initial parameters.*/ | 619 | * to see the initial parameters.*/ |
635 | struct sd *sd = (struct sd *) gspca_dev; | 620 | struct sd *sd = (struct sd *) gspca_dev; |
636 | int i; | 621 | int i; |
637 | __u8 byte, test_byte; | 622 | u8 byte, test_byte; |
638 | 623 | ||
639 | static const __u8 read_indexs[] = | 624 | static const u8 read_indexs[] = |
640 | { 0x06, 0x07, 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5, | 625 | { 0x06, 0x07, 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5, |
641 | 0xa6, 0xa8, 0xbb, 0xbc, 0xc6, 0x00, 0x00 }; | 626 | 0xa6, 0xa8, 0xbb, 0xbc, 0xc6, 0x00 }; |
642 | static const __u8 n1[] = | 627 | static const u8 n1[] = |
643 | {0x08, 0x03, 0x09, 0x03, 0x12, 0x04}; | 628 | {0x08, 0x03, 0x09, 0x03, 0x12, 0x04}; |
644 | static const __u8 n2[] = | 629 | static const u8 n2[] = |
645 | {0x08, 0x00}; | 630 | {0x08, 0x00}; |
646 | static const __u8 n3[] = | 631 | static const u8 n3[] = |
647 | {0x61, 0x68, 0x65, 0x0a, 0x60, 0x04}; | 632 | {0x61, 0x68, 0x65, 0x0a, 0x60, 0x04}; |
648 | static const __u8 n4[] = | 633 | static const u8 n4[] = |
649 | {0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c, | 634 | {0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c, |
650 | 0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68, | 635 | 0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68, |
651 | 0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1, | 636 | 0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1, |
@@ -655,10 +640,10 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
655 | 0x65, 0x0a, 0xbb, 0x86, 0xaf, 0x58, 0xb0, 0x68, | 640 | 0x65, 0x0a, 0xbb, 0x86, 0xaf, 0x58, 0xb0, 0x68, |
656 | 0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40, | 641 | 0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40, |
657 | 0xac, 0x84, 0xad, 0x86, 0xaf, 0x46}; | 642 | 0xac, 0x84, 0xad, 0x86, 0xaf, 0x46}; |
658 | static const __u8 nset9[4] = | 643 | static const u8 nset8[6] = |
659 | { 0x0b, 0x04, 0x0a, 0x78 }; | ||
660 | static const __u8 nset8[6] = | ||
661 | { 0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00 }; | 644 | { 0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00 }; |
645 | static const u8 nset9[4] = | ||
646 | { 0x0b, 0x04, 0x0a, 0x78 }; | ||
662 | 647 | ||
663 | byte = reg_r(gspca_dev, 0x06); | 648 | byte = reg_r(gspca_dev, 0x06); |
664 | test_byte = reg_r(gspca_dev, 0x07); | 649 | test_byte = reg_r(gspca_dev, 0x07); |
@@ -703,11 +688,11 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
703 | reg_r(gspca_dev, 0x0080); | 688 | reg_r(gspca_dev, 0x0080); |
704 | reg_w(gspca_dev, 0x2c80); | 689 | reg_w(gspca_dev, 0x2c80); |
705 | 690 | ||
706 | reg_w_buf(gspca_dev, sensor_data[sd->sensor].data1, | 691 | reg_w_ixbuf(gspca_dev, 0xd0, sensor_data[sd->sensor].data1, |
707 | sizeof sensor_data[sd->sensor].data1); | 692 | sizeof sensor_data[sd->sensor].data1); |
708 | reg_w_buf(gspca_dev, sensor_data[sd->sensor].data3, | 693 | reg_w_ixbuf(gspca_dev, 0xc7, sensor_data[sd->sensor].data2, |
709 | sizeof sensor_data[sd->sensor].data3); | 694 | sizeof sensor_data[sd->sensor].data2); |
710 | reg_w_buf(gspca_dev, sensor_data[sd->sensor].data2, | 695 | reg_w_ixbuf(gspca_dev, 0xe0, sensor_data[sd->sensor].data2, |
711 | sizeof sensor_data[sd->sensor].data2); | 696 | sizeof sensor_data[sd->sensor].data2); |
712 | 697 | ||
713 | reg_w(gspca_dev, 0x3880); | 698 | reg_w(gspca_dev, 0x3880); |
@@ -734,11 +719,11 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
734 | 719 | ||
735 | reg_w(gspca_dev, 0x2880); | 720 | reg_w(gspca_dev, 0x2880); |
736 | 721 | ||
737 | reg_w_buf(gspca_dev, sensor_data[sd->sensor].data1, | 722 | reg_w_ixbuf(gspca_dev, 0xd0, sensor_data[sd->sensor].data1, |
738 | sizeof sensor_data[sd->sensor].data1); | 723 | sizeof sensor_data[sd->sensor].data1); |
739 | reg_w_buf(gspca_dev, sensor_data[sd->sensor].data3, | 724 | reg_w_ixbuf(gspca_dev, 0xc7, sensor_data[sd->sensor].data2, |
740 | sizeof sensor_data[sd->sensor].data3); | 725 | sizeof sensor_data[sd->sensor].data2); |
741 | reg_w_buf(gspca_dev, sensor_data[sd->sensor].data2, | 726 | reg_w_ixbuf(gspca_dev, 0xe0, sensor_data[sd->sensor].data2, |
742 | sizeof sensor_data[sd->sensor].data2); | 727 | sizeof sensor_data[sd->sensor].data2); |
743 | 728 | ||
744 | return 0; | 729 | return 0; |
@@ -747,7 +732,7 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
747 | static void setflip(struct gspca_dev *gspca_dev) | 732 | static void setflip(struct gspca_dev *gspca_dev) |
748 | { | 733 | { |
749 | struct sd *sd = (struct sd *) gspca_dev; | 734 | struct sd *sd = (struct sd *) gspca_dev; |
750 | __u8 flipcmd[8] = | 735 | u8 flipcmd[8] = |
751 | {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09}; | 736 | {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09}; |
752 | 737 | ||
753 | if (sd->mirror) | 738 | if (sd->mirror) |
@@ -777,7 +762,7 @@ static void seteffect(struct gspca_dev *gspca_dev) | |||
777 | static void setlightfreq(struct gspca_dev *gspca_dev) | 762 | static void setlightfreq(struct gspca_dev *gspca_dev) |
778 | { | 763 | { |
779 | struct sd *sd = (struct sd *) gspca_dev; | 764 | struct sd *sd = (struct sd *) gspca_dev; |
780 | __u8 freq[4] = { 0x66, 0x40, 0xa8, 0xe8 }; | 765 | u8 freq[4] = { 0x66, 0x40, 0xa8, 0xe8 }; |
781 | 766 | ||
782 | if (sd->freq == 2) /* 60hz */ | 767 | if (sd->freq == 2) /* 60hz */ |
783 | freq[1] = 0x00; | 768 | freq[1] = 0x00; |
@@ -790,17 +775,17 @@ static void setlightfreq(struct gspca_dev *gspca_dev) | |||
790 | static void poll_sensor(struct gspca_dev *gspca_dev) | 775 | static void poll_sensor(struct gspca_dev *gspca_dev) |
791 | { | 776 | { |
792 | struct sd *sd = (struct sd *) gspca_dev; | 777 | struct sd *sd = (struct sd *) gspca_dev; |
793 | static const __u8 poll1[] = | 778 | static const u8 poll1[] = |
794 | {0x67, 0x05, 0x68, 0x81, 0x69, 0x80, 0x6a, 0x82, | 779 | {0x67, 0x05, 0x68, 0x81, 0x69, 0x80, 0x6a, 0x82, |
795 | 0x6b, 0x68, 0x6c, 0x69, 0x72, 0xd9, 0x73, 0x34, | 780 | 0x6b, 0x68, 0x6c, 0x69, 0x72, 0xd9, 0x73, 0x34, |
796 | 0x74, 0x32, 0x75, 0x92, 0x76, 0x00, 0x09, 0x01, | 781 | 0x74, 0x32, 0x75, 0x92, 0x76, 0x00, 0x09, 0x01, |
797 | 0x60, 0x14}; | 782 | 0x60, 0x14}; |
798 | static const __u8 poll2[] = | 783 | static const u8 poll2[] = |
799 | {0x67, 0x02, 0x68, 0x71, 0x69, 0x72, 0x72, 0xa9, | 784 | {0x67, 0x02, 0x68, 0x71, 0x69, 0x72, 0x72, 0xa9, |
800 | 0x73, 0x02, 0x73, 0x02, 0x60, 0x14}; | 785 | 0x73, 0x02, 0x73, 0x02, 0x60, 0x14}; |
801 | static const __u8 poll3[] = | 786 | static const u8 poll3[] = |
802 | {0x87, 0x3f, 0x88, 0x20, 0x89, 0x2d}; | 787 | {0x87, 0x3f, 0x88, 0x20, 0x89, 0x2d}; |
803 | static const __u8 poll4[] = | 788 | static const u8 poll4[] = |
804 | {0xa6, 0x0a, 0xea, 0xcf, 0xbe, 0x26, 0xb1, 0x5f, | 789 | {0xa6, 0x0a, 0xea, 0xcf, 0xbe, 0x26, 0xb1, 0x5f, |
805 | 0xa1, 0xb1, 0xda, 0x6b, 0xdb, 0x98, 0xdf, 0x0c, | 790 | 0xa1, 0xb1, 0xda, 0x6b, 0xdb, 0x98, 0xdf, 0x0c, |
806 | 0xc2, 0x80, 0xc3, 0x10}; | 791 | 0xc2, 0x80, 0xc3, 0x10}; |
@@ -818,13 +803,14 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
818 | { | 803 | { |
819 | struct sd *sd = (struct sd *) gspca_dev; | 804 | struct sd *sd = (struct sd *) gspca_dev; |
820 | int i, mode; | 805 | int i, mode; |
821 | __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; | 806 | u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; |
822 | static const __u8 t3[] = | 807 | static const u8 t3[] = |
823 | { 0xb3, 0x07, 0xb4, 0x00, 0xb5, 0x88, 0xb6, 0x02, 0xb7, 0x06, | 808 | { 0x07, 0x00, 0x88, 0x02, 0x06, 0x00, 0xe7, 0x01 }; |
824 | 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 }; | ||
825 | 809 | ||
826 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. priv; | 810 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. priv; |
827 | switch (mode) { | 811 | switch (mode) { |
812 | case 0: /* 640x480 (0x00) */ | ||
813 | break; | ||
828 | case 1: /* 352x288 */ | 814 | case 1: /* 352x288 */ |
829 | t2[1] = 0x40; | 815 | t2[1] = 0x40; |
830 | break; | 816 | break; |
@@ -834,11 +820,10 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
834 | case 3: /* 176x144 */ | 820 | case 3: /* 176x144 */ |
835 | t2[1] = 0x50; | 821 | t2[1] = 0x50; |
836 | break; | 822 | break; |
837 | case 4: /* 160x120 */ | 823 | default: |
824 | /* case 4: * 160x120 */ | ||
838 | t2[1] = 0x20; | 825 | t2[1] = 0x20; |
839 | break; | 826 | break; |
840 | default: /* 640x480 (0x00) */ | ||
841 | break; | ||
842 | } | 827 | } |
843 | 828 | ||
844 | if (sd->sensor == SENSOR_TAS5130A) { | 829 | if (sd->sensor == SENSOR_TAS5130A) { |
@@ -860,7 +845,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
860 | sizeof sensor_data[sd->sensor].data4); | 845 | sizeof sensor_data[sd->sensor].data4); |
861 | reg_r(gspca_dev, 0x0012); | 846 | reg_r(gspca_dev, 0x0012); |
862 | reg_w_buf(gspca_dev, t2, sizeof t2); | 847 | reg_w_buf(gspca_dev, t2, sizeof t2); |
863 | reg_w_buf(gspca_dev, t3, sizeof t3); | 848 | reg_w_ixbuf(gspca_dev, 0xb3, t3, sizeof t3); |
864 | reg_w(gspca_dev, 0x0013); | 849 | reg_w(gspca_dev, 0x0013); |
865 | msleep(15); | 850 | msleep(15); |
866 | reg_w_buf(gspca_dev, sensor_data[sd->sensor].stream, | 851 | reg_w_buf(gspca_dev, sensor_data[sd->sensor].stream, |
@@ -890,10 +875,10 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
890 | 875 | ||
891 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 876 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
892 | struct gspca_frame *frame, /* target */ | 877 | struct gspca_frame *frame, /* target */ |
893 | __u8 *data, /* isoc packet */ | 878 | u8 *data, /* isoc packet */ |
894 | int len) /* iso packet length */ | 879 | int len) /* iso packet length */ |
895 | { | 880 | { |
896 | static __u8 ffd9[] = { 0xff, 0xd9 }; | 881 | static u8 ffd9[] = { 0xff, 0xd9 }; |
897 | 882 | ||
898 | if (data[0] == 0x5a) { | 883 | if (data[0] == 0x5a) { |
899 | /* Control Packet, after this came the header again, | 884 | /* Control Packet, after this came the header again, |