diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-07-04 10:16:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:16:53 -0400 |
commit | a5ae2062252e697d38e53dbbeb91460252208914 (patch) | |
tree | 38706e9f36e2d93cd3dee8eea639bb74a17b3efa /drivers/media/video/gspca/conex.c | |
parent | 54ab92ca05550550bcec2462de2605f35d079b66 (diff) |
V4L/DVB (8195): gspca: Input buffer overwritten in spca561 + cleanup code.
spca561: Input buffer may be changed on reg write.
(all sd): Cleanup code, 'const' added.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca/conex.c')
-rw-r--r-- | drivers/media/video/gspca/conex.c | 98 |
1 files changed, 52 insertions, 46 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c index 473bea750b5f..6d50247b7ad2 100644 --- a/drivers/media/video/gspca/conex.c +++ b/drivers/media/video/gspca/conex.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #define CONEX_CAM 1 /* special JPEG header */ | 25 | #define CONEX_CAM 1 /* special JPEG header */ |
26 | #include "jpeg.h" | 26 | #include "jpeg.h" |
27 | 27 | ||
28 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) | 28 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) |
29 | static const char version[] = "2.1.3"; | 29 | static const char version[] = "2.1.4"; |
30 | 30 | ||
31 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); | 31 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); |
32 | MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); | 32 | MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); |
@@ -229,7 +229,7 @@ static void cx11646_fw(struct gspca_dev*gspca_dev) | |||
229 | reg_w(gspca_dev->dev, 0x006a, &val, 1); | 229 | reg_w(gspca_dev->dev, 0x006a, &val, 1); |
230 | } | 230 | } |
231 | 231 | ||
232 | static __u8 cxsensor[] = { | 232 | static const __u8 cxsensor[] = { |
233 | 0x88, 0x12, 0x70, 0x01, | 233 | 0x88, 0x12, 0x70, 0x01, |
234 | 0x88, 0x0d, 0x02, 0x01, | 234 | 0x88, 0x0d, 0x02, 0x01, |
235 | 0x88, 0x0f, 0x00, 0x01, | 235 | 0x88, 0x0f, 0x00, 0x01, |
@@ -244,24 +244,24 @@ static __u8 cxsensor[] = { | |||
244 | 0x00 | 244 | 0x00 |
245 | }; | 245 | }; |
246 | 246 | ||
247 | static __u8 reg20[] = { 0x10, 0x42, 0x81, 0x19, 0xd3, 0xff, 0xa7, 0xff }; | 247 | static const __u8 reg20[] = { 0x10, 0x42, 0x81, 0x19, 0xd3, 0xff, 0xa7, 0xff }; |
248 | static __u8 reg28[] = { 0x87, 0x00, 0x87, 0x00, 0x8f, 0xff, 0xea, 0xff }; | 248 | static const __u8 reg28[] = { 0x87, 0x00, 0x87, 0x00, 0x8f, 0xff, 0xea, 0xff }; |
249 | static __u8 reg10[] = { 0xb1, 0xb1 }; | 249 | static const __u8 reg10[] = { 0xb1, 0xb1 }; |
250 | static __u8 reg71a[] = { 0x08, 0x18, 0x0a, 0x1e }; /* 640 */ | 250 | static const __u8 reg71a[] = { 0x08, 0x18, 0x0a, 0x1e }; /* 640 */ |
251 | static __u8 reg71b[] = { 0x04, 0x0c, 0x05, 0x0f }; | 251 | static const __u8 reg71b[] = { 0x04, 0x0c, 0x05, 0x0f }; |
252 | /* 352{0x04,0x0a,0x06,0x12}; //352{0x05,0x0e,0x06,0x11}; //352 */ | 252 | /* 352{0x04,0x0a,0x06,0x12}; //352{0x05,0x0e,0x06,0x11}; //352 */ |
253 | static __u8 reg71c[] = { 0x02, 0x07, 0x03, 0x09 }; | 253 | static const __u8 reg71c[] = { 0x02, 0x07, 0x03, 0x09 }; |
254 | /* 320{0x04,0x0c,0x05,0x0f}; //320 */ | 254 | /* 320{0x04,0x0c,0x05,0x0f}; //320 */ |
255 | static __u8 reg71d[] = { 0x02, 0x07, 0x03, 0x09 }; /* 176 */ | 255 | static const __u8 reg71d[] = { 0x02, 0x07, 0x03, 0x09 }; /* 176 */ |
256 | static __u8 reg7b[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }; | 256 | static const __u8 reg7b[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }; |
257 | 257 | ||
258 | static void cx_sensor(struct gspca_dev*gspca_dev) | 258 | static void cx_sensor(struct gspca_dev*gspca_dev) |
259 | { | 259 | { |
260 | __u8 val = 0; | 260 | __u8 val; |
261 | int i = 0; | 261 | int i = 0; |
262 | __u8 bufread[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; | 262 | __u8 bufread[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; |
263 | int length = 0; | 263 | int length; |
264 | __u8 *ptsensor = cxsensor; | 264 | const __u8 *ptsensor = cxsensor; |
265 | 265 | ||
266 | reg_w(gspca_dev->dev, 0x0020, reg20, 8); | 266 | reg_w(gspca_dev->dev, 0x0020, reg20, 8); |
267 | reg_w(gspca_dev->dev, 0x0028, reg28, 8); | 267 | reg_w(gspca_dev->dev, 0x0028, reg28, 8); |
@@ -305,7 +305,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev) | |||
305 | reg_r(gspca_dev->dev, 0x00e7, bufread, 8); | 305 | reg_r(gspca_dev->dev, 0x00e7, bufread, 8); |
306 | } | 306 | } |
307 | 307 | ||
308 | static __u8 cx_inits_176[] = { | 308 | static const __u8 cx_inits_176[] = { |
309 | 0x33, 0x81, 0xB0, 0x00, 0x90, 0x00, 0x0A, 0x03, /* 176x144 */ | 309 | 0x33, 0x81, 0xB0, 0x00, 0x90, 0x00, 0x0A, 0x03, /* 176x144 */ |
310 | 0x00, 0x03, 0x03, 0x03, 0x1B, 0x05, 0x30, 0x03, | 310 | 0x00, 0x03, 0x03, 0x03, 0x1B, 0x05, 0x30, 0x03, |
311 | 0x65, 0x15, 0x18, 0x25, 0x03, 0x25, 0x08, 0x30, | 311 | 0x65, 0x15, 0x18, 0x25, 0x03, 0x25, 0x08, 0x30, |
@@ -314,7 +314,7 @@ static __u8 cx_inits_176[] = { | |||
314 | 0xF7, 0xFF, 0x88, 0xFF, 0x66, 0x02, 0x28, 0x02, | 314 | 0xF7, 0xFF, 0x88, 0xFF, 0x66, 0x02, 0x28, 0x02, |
315 | 0x1E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 315 | 0x1E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
316 | }; | 316 | }; |
317 | static __u8 cx_inits_320[] = { | 317 | static const __u8 cx_inits_320[] = { |
318 | 0x7f, 0x7f, 0x40, 0x01, 0xf0, 0x00, 0x02, 0x01, | 318 | 0x7f, 0x7f, 0x40, 0x01, 0xf0, 0x00, 0x02, 0x01, |
319 | 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x02, 0x01, | 319 | 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x02, 0x01, |
320 | 0x65, 0x45, 0xfa, 0x4c, 0x2c, 0xdf, 0xb9, 0x81, | 320 | 0x65, 0x45, 0xfa, 0x4c, 0x2c, 0xdf, 0xb9, 0x81, |
@@ -323,7 +323,7 @@ static __u8 cx_inits_320[] = { | |||
323 | 0xf5, 0xff, 0x6d, 0xff, 0xf6, 0x01, 0x43, 0x02, | 323 | 0xf5, 0xff, 0x6d, 0xff, 0xf6, 0x01, 0x43, 0x02, |
324 | 0xd3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 324 | 0xd3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
325 | }; | 325 | }; |
326 | static __u8 cx_inits_352[] = { | 326 | static const __u8 cx_inits_352[] = { |
327 | 0x2e, 0x7c, 0x60, 0x01, 0x20, 0x01, 0x05, 0x03, | 327 | 0x2e, 0x7c, 0x60, 0x01, 0x20, 0x01, 0x05, 0x03, |
328 | 0x00, 0x06, 0x03, 0x06, 0x1b, 0x10, 0x05, 0x3b, | 328 | 0x00, 0x06, 0x03, 0x06, 0x1b, 0x10, 0x05, 0x3b, |
329 | 0x30, 0x25, 0x18, 0x25, 0x08, 0x30, 0x03, 0x25, | 329 | 0x30, 0x25, 0x18, 0x25, 0x08, 0x30, 0x03, 0x25, |
@@ -332,7 +332,7 @@ static __u8 cx_inits_352[] = { | |||
332 | 0xf5, 0xff, 0x6b, 0xff, 0xee, 0x01, 0x43, 0x02, | 332 | 0xf5, 0xff, 0x6b, 0xff, 0xee, 0x01, 0x43, 0x02, |
333 | 0xe4, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 333 | 0xe4, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
334 | }; | 334 | }; |
335 | static __u8 cx_inits_640[] = { | 335 | static const __u8 cx_inits_640[] = { |
336 | 0x7e, 0x7e, 0x80, 0x02, 0xe0, 0x01, 0x01, 0x01, | 336 | 0x7e, 0x7e, 0x80, 0x02, 0xe0, 0x01, 0x01, 0x01, |
337 | 0x00, 0x02, 0x01, 0x02, 0x10, 0x30, 0x01, 0x01, | 337 | 0x00, 0x02, 0x01, 0x02, 0x10, 0x30, 0x01, 0x01, |
338 | 0x65, 0x45, 0xf7, 0x52, 0x2c, 0xdf, 0xb9, 0x81, | 338 | 0x65, 0x45, 0xf7, 0x52, 0x2c, 0xdf, 0xb9, 0x81, |
@@ -344,7 +344,7 @@ static __u8 cx_inits_640[] = { | |||
344 | 344 | ||
345 | static int cx11646_initsize(struct gspca_dev *gspca_dev) | 345 | static int cx11646_initsize(struct gspca_dev *gspca_dev) |
346 | { | 346 | { |
347 | __u8 *cxinit; | 347 | const __u8 *cxinit; |
348 | __u8 val; | 348 | __u8 val; |
349 | static const __u8 reg12[] = { 0x08, 0x05, 0x07, 0x04, 0x24 }; | 349 | static const __u8 reg12[] = { 0x08, 0x05, 0x07, 0x04, 0x24 }; |
350 | static const __u8 reg17[] = | 350 | static const __u8 reg17[] = |
@@ -396,7 +396,7 @@ static int cx11646_initsize(struct gspca_dev *gspca_dev) | |||
396 | return val; | 396 | return val; |
397 | } | 397 | } |
398 | 398 | ||
399 | static __u8 cx_jpeg_init[][8] = { | 399 | static const __u8 cx_jpeg_init[][8] = { |
400 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x15}, /* 1 */ | 400 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x15}, /* 1 */ |
401 | {0x0f, 0x10, 0x12, 0x10, 0x0d, 0x15, 0x12, 0x11}, | 401 | {0x0f, 0x10, 0x12, 0x10, 0x0d, 0x15, 0x12, 0x11}, |
402 | {0x12, 0x18, 0x16, 0x15, 0x19, 0x20, 0x35, 0x22}, | 402 | {0x12, 0x18, 0x16, 0x15, 0x19, 0x20, 0x35, 0x22}, |
@@ -479,7 +479,7 @@ static __u8 cx_jpeg_init[][8] = { | |||
479 | }; | 479 | }; |
480 | 480 | ||
481 | 481 | ||
482 | static __u8 cxjpeg_640[][8] = { | 482 | static const __u8 cxjpeg_640[][8] = { |
483 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x10}, /* 1 */ | 483 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x10}, /* 1 */ |
484 | {0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e, 0x0d}, | 484 | {0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e, 0x0d}, |
485 | {0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28, 0x1a}, | 485 | {0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28, 0x1a}, |
@@ -508,7 +508,7 @@ static __u8 cxjpeg_640[][8] = { | |||
508 | {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, | 508 | {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, |
509 | {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /* 27 */ | 509 | {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /* 27 */ |
510 | }; | 510 | }; |
511 | static __u8 cxjpeg_352[][8] = { | 511 | static const __u8 cxjpeg_352[][8] = { |
512 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d}, | 512 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d}, |
513 | {0x09, 0x09, 0x0b, 0x09, 0x08, 0x0D, 0x0b, 0x0a}, | 513 | {0x09, 0x09, 0x0b, 0x09, 0x08, 0x0D, 0x0b, 0x0a}, |
514 | {0x0b, 0x0e, 0x0d, 0x0d, 0x0f, 0x13, 0x1f, 0x14}, | 514 | {0x0b, 0x0e, 0x0d, 0x0d, 0x0f, 0x13, 0x1f, 0x14}, |
@@ -537,7 +537,7 @@ static __u8 cxjpeg_352[][8] = { | |||
537 | {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, | 537 | {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, |
538 | {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} | 538 | {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} |
539 | }; | 539 | }; |
540 | static __u8 cxjpeg_320[][8] = { | 540 | static const __u8 cxjpeg_320[][8] = { |
541 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x05}, | 541 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x05}, |
542 | {0x03, 0x04, 0x04, 0x04, 0x03, 0x05, 0x04, 0x04}, | 542 | {0x03, 0x04, 0x04, 0x04, 0x03, 0x05, 0x04, 0x04}, |
543 | {0x04, 0x05, 0x05, 0x05, 0x06, 0x07, 0x0c, 0x08}, | 543 | {0x04, 0x05, 0x05, 0x05, 0x06, 0x07, 0x0c, 0x08}, |
@@ -566,7 +566,7 @@ static __u8 cxjpeg_320[][8] = { | |||
566 | {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, | 566 | {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, |
567 | {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /* 27 */ | 567 | {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /* 27 */ |
568 | }; | 568 | }; |
569 | static __u8 cxjpeg_176[][8] = { | 569 | static const __u8 cxjpeg_176[][8] = { |
570 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d}, | 570 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d}, |
571 | {0x09, 0x09, 0x0B, 0x09, 0x08, 0x0D, 0x0B, 0x0A}, | 571 | {0x09, 0x09, 0x0B, 0x09, 0x08, 0x0D, 0x0B, 0x0A}, |
572 | {0x0B, 0x0E, 0x0D, 0x0D, 0x0F, 0x13, 0x1F, 0x14}, | 572 | {0x0B, 0x0E, 0x0D, 0x0D, 0x0F, 0x13, 0x1F, 0x14}, |
@@ -595,7 +595,8 @@ static __u8 cxjpeg_176[][8] = { | |||
595 | {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, | 595 | {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, |
596 | {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} | 596 | {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} |
597 | }; | 597 | }; |
598 | static __u8 cxjpeg_qtable[][8] = { /* 640 take with the zcx30x part */ | 598 | /* 640 take with the zcx30x part */ |
599 | static const __u8 cxjpeg_qtable[][8] = { | ||
599 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x08}, | 600 | {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x08}, |
600 | {0x06, 0x06, 0x07, 0x06, 0x05, 0x08, 0x07, 0x07}, | 601 | {0x06, 0x06, 0x07, 0x06, 0x05, 0x08, 0x07, 0x07}, |
601 | {0x07, 0x09, 0x09, 0x08, 0x0a, 0x0c, 0x14, 0x0a}, | 602 | {0x07, 0x09, 0x09, 0x08, 0x0a, 0x0c, 0x14, 0x0a}, |
@@ -641,22 +642,23 @@ static void cx11646_jpegInit(struct gspca_dev*gspca_dev) | |||
641 | reg_w(gspca_dev->dev, 0x0055, &val, 1); | 642 | reg_w(gspca_dev->dev, 0x0055, &val, 1); |
642 | } | 643 | } |
643 | 644 | ||
644 | static __u8 reg12[] = { 0x0a, 0x05, 0x07, 0x04, 0x19 }; | 645 | static const __u8 reg12[] = { 0x0a, 0x05, 0x07, 0x04, 0x19 }; |
645 | static __u8 regE5_8[] = { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 }; | 646 | static const __u8 regE5_8[] = |
646 | static __u8 regE5a[] = { 0x88, 0x0a, 0x0c, 0x01 }; | 647 | { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 }; |
647 | static __u8 regE5b[] = { 0x88, 0x0b, 0x12, 0x01 }; | 648 | static const __u8 regE5a[] = { 0x88, 0x0a, 0x0c, 0x01 }; |
648 | static __u8 regE5c[] = { 0x88, 0x05, 0x01, 0x01 }; | 649 | static const __u8 regE5b[] = { 0x88, 0x0b, 0x12, 0x01 }; |
649 | static __u8 reg51[] = { 0x77, 0x03 }; | 650 | static const __u8 regE5c[] = { 0x88, 0x05, 0x01, 0x01 }; |
650 | static __u8 reg70 = 0x03; | 651 | static const __u8 reg51[] = { 0x77, 0x03 }; |
652 | static const __u8 reg70 = 0x03; | ||
651 | 653 | ||
652 | static void cx11646_jpeg(struct gspca_dev*gspca_dev) | 654 | static void cx11646_jpeg(struct gspca_dev*gspca_dev) |
653 | { | 655 | { |
654 | __u8 val; | 656 | __u8 val; |
655 | int i; | 657 | int i; |
656 | int length = 8; | 658 | int length; |
657 | __u8 Reg55 = 0x14; | 659 | __u8 Reg55; |
658 | __u8 bufread[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; | 660 | __u8 bufread[8]; |
659 | int retry = 50; | 661 | int retry; |
660 | 662 | ||
661 | val = 0x01; | 663 | val = 0x01; |
662 | reg_w(gspca_dev->dev, 0x00c0, &val, 1); | 664 | reg_w(gspca_dev->dev, 0x00c0, &val, 1); |
@@ -665,6 +667,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) | |||
665 | val = 0x00; | 667 | val = 0x00; |
666 | reg_w(gspca_dev->dev, 0x00c0, &val, 1); | 668 | reg_w(gspca_dev->dev, 0x00c0, &val, 1); |
667 | reg_r(gspca_dev->dev, 0x0001, &val, 1); | 669 | reg_r(gspca_dev->dev, 0x0001, &val, 1); |
670 | length = 8; | ||
668 | switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { | 671 | switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { |
669 | case 0: | 672 | case 0: |
670 | for (i = 0; i < 27; i++) { | 673 | for (i = 0; i < 27; i++) { |
@@ -719,6 +722,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) | |||
719 | val = 0x00; | 722 | val = 0x00; |
720 | reg_w(gspca_dev->dev, 0x0000, &val, 1); | 723 | reg_w(gspca_dev->dev, 0x0000, &val, 1); |
721 | /* wait for completion */ | 724 | /* wait for completion */ |
725 | retry = 50; | ||
722 | while (retry--) { | 726 | while (retry--) { |
723 | reg_r(gspca_dev->dev, 0x0002, &val, 1); | 727 | reg_r(gspca_dev->dev, 0x0002, &val, 1); |
724 | /* 0x07 until 0x00 */ | 728 | /* 0x07 until 0x00 */ |
@@ -796,8 +800,8 @@ static void cx11646_init1(struct gspca_dev *gspca_dev) | |||
796 | reg_w(gspca_dev->dev, 0x003f, &val, 1); | 800 | reg_w(gspca_dev->dev, 0x003f, &val, 1); |
797 | val = 0x40; | 801 | val = 0x40; |
798 | reg_w(gspca_dev->dev, 0x003d, &val, 1); | 802 | reg_w(gspca_dev->dev, 0x003d, &val, 1); |
799 | /* val= 0x60; */ | 803 | /* val= 0x60; */ |
800 | /* reg_w(gspca_dev->dev,0x00,0x00,0x003d,&val,1); */ | 804 | /* reg_w(gspca_dev->dev, 0x00, 0x00, 0x003d, &val, 1); */ |
801 | reg_r(gspca_dev->dev, 0x0099, &val, 1); /* ->0x07 */ | 805 | reg_r(gspca_dev->dev, 0x0099, &val, 1); /* ->0x07 */ |
802 | 806 | ||
803 | while (cx_sensor_init[i][0]) { | 807 | while (cx_sensor_init[i][0]) { |
@@ -827,7 +831,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
827 | cam->cam_mode = vga_mode; | 831 | cam->cam_mode = vga_mode; |
828 | cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; | 832 | cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; |
829 | 833 | ||
830 | sd->qindex = 0; /* set the quantization table */ | 834 | sd->qindex = 0; /* set the quantization */ |
831 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; | 835 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; |
832 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; | 836 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; |
833 | sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; | 837 | sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; |
@@ -891,7 +895,7 @@ static void sd_close(struct gspca_dev *gspca_dev) | |||
891 | 895 | ||
892 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 896 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
893 | struct gspca_frame *frame, /* target */ | 897 | struct gspca_frame *frame, /* target */ |
894 | unsigned char *data, /* isoc packet */ | 898 | __u8 *data, /* isoc packet */ |
895 | int len) /* iso packet length */ | 899 | int len) /* iso packet length */ |
896 | { | 900 | { |
897 | if (data[0] == 0xff && data[1] == 0xd8) { | 901 | if (data[0] == 0xff && data[1] == 0xd8) { |
@@ -914,21 +918,22 @@ static void setbrightness(struct gspca_dev*gspca_dev) | |||
914 | { | 918 | { |
915 | struct sd *sd = (struct sd *) gspca_dev; | 919 | struct sd *sd = (struct sd *) gspca_dev; |
916 | __u8 regE5cbx[] = { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 }; | 920 | __u8 regE5cbx[] = { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 }; |
917 | __u8 reg51c[] = { 0x77, 0x03 }; | 921 | __u8 reg51c[2]; |
918 | __u8 bright; | 922 | __u8 bright; |
919 | __u8 colors; | 923 | __u8 colors; |
920 | __u8 val; | 924 | __u8 val; |
921 | __u8 bufread[8]; | 925 | __u8 bufread[8]; |
922 | 926 | ||
923 | bright = sd->brightness; | 927 | bright = sd->brightness; |
924 | colors = sd->colors; | ||
925 | regE5cbx[2] = bright; | 928 | regE5cbx[2] = bright; |
926 | reg51c[1] = colors; | ||
927 | reg_w(gspca_dev->dev, 0x00e5, regE5cbx, 8); | 929 | reg_w(gspca_dev->dev, 0x00e5, regE5cbx, 8); |
928 | reg_r(gspca_dev->dev, 0x00e8, bufread, 8); | 930 | reg_r(gspca_dev->dev, 0x00e8, bufread, 8); |
929 | reg_w(gspca_dev->dev, 0x00e5, regE5c, 4); | 931 | reg_w(gspca_dev->dev, 0x00e5, regE5c, 4); |
930 | reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ | 932 | reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ |
931 | 933 | ||
934 | colors = sd->colors; | ||
935 | reg51c[0] = 0x77; | ||
936 | reg51c[1] = colors; | ||
932 | reg_w(gspca_dev->dev, 0x0051, reg51c, 2); | 937 | reg_w(gspca_dev->dev, 0x0051, reg51c, 2); |
933 | reg_w(gspca_dev->dev, 0x0010, reg10, 2); | 938 | reg_w(gspca_dev->dev, 0x0010, reg10, 2); |
934 | reg_w(gspca_dev->dev, 0x0070, ®70, 1); | 939 | reg_w(gspca_dev->dev, 0x0070, ®70, 1); |
@@ -938,14 +943,15 @@ static void setcontrast(struct gspca_dev*gspca_dev) | |||
938 | { | 943 | { |
939 | struct sd *sd = (struct sd *) gspca_dev; | 944 | struct sd *sd = (struct sd *) gspca_dev; |
940 | __u8 regE5acx[] = { 0x88, 0x0a, 0x0c, 0x01 }; /* seem MSB */ | 945 | __u8 regE5acx[] = { 0x88, 0x0a, 0x0c, 0x01 }; /* seem MSB */ |
941 | /* __u8 regE5bcx[]={0x88,0x0b,0x12,0x01}; // LSB */ | 946 | /* __u8 regE5bcx[] = { 0x88, 0x0b, 0x12, 0x01}; * LSB */ |
942 | __u8 reg51c[] = { 0x77, 0x03 }; | 947 | __u8 reg51c[2]; |
943 | __u8 val; | 948 | __u8 val; |
944 | 949 | ||
945 | reg51c[1] = sd->colors; | ||
946 | regE5acx[2] = sd->contrast; | 950 | regE5acx[2] = sd->contrast; |
947 | reg_w(gspca_dev->dev, 0x00e5, regE5acx, 4); | 951 | reg_w(gspca_dev->dev, 0x00e5, regE5acx, 4); |
948 | reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ | 952 | reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ |
953 | reg51c[0] = 0x77; | ||
954 | reg51c[1] = sd->colors; | ||
949 | reg_w(gspca_dev->dev, 0x0051, reg51c, 2); | 955 | reg_w(gspca_dev->dev, 0x0051, reg51c, 2); |
950 | reg_w(gspca_dev->dev, 0x0010, reg10, 2); | 956 | reg_w(gspca_dev->dev, 0x0010, reg10, 2); |
951 | reg_w(gspca_dev->dev, 0x0070, ®70, 1); | 957 | reg_w(gspca_dev->dev, 0x0070, ®70, 1); |