gspca pac7302: simplify init sequence
PATCH 1/1 gspca pac7302: simplify init sequence
From: Márton Németh <[email protected]>
The init sequence contains register writes which are overwritten later. Remove these redundant writes from the init sequence.
The patch was tested together with Labtec Webcam 2200 (USB ID 093a:2626).
---
linux/drivers/media/video/gspca/pac7302.c +40 -25
@@ -49,6 +49,18 @@-/0x27 Seems to toggle various gains on / off, Setting bit 7 seems to completely disable the analog amplification block. Set to 0x68 for max gain, 0x14 for minimal gain. + +The registers are accessed in the following functions: + +Page | Register | Function +-----+------------+--------------------------------------------------- +0 | 0x0f..0x20 | setcolors() +0 | 0xa2..0xab | setbrightcont() +0 | 0xdc | setbrightcont(), setcolors() +3 | 0x02 | setexposure() +3 | 0x10 | setgain() +3 | 0x11 | setcolors(), setgain(), setexposure(), sethvflip() +3 | 0x21 | sethvflip() */ #define MODULE_NAME "pac7302"
@@ -247,9 +259,8 @@ static const __u8 start_7302[] = {0xff ,1 ,0x00 ,/* page 0 */ 0x00 ,12 ,0x01 ,0x40 ,0x40 ,0x40 ,0x01 ,0xe0 ,0x02 ,0x80 ,0x00 ,0x00 ,0x00 ,0x00 , -0x0d ,24 ,0x03 ,0x01 ,0x00 ,0xb5 ,0x07 ,0xcb ,0x00 ,0x00 , -0x07 ,0xc8 ,0x00 ,0xea ,0x07 ,0xcf ,0x07 ,0xf7 , -0x07 ,0x7e ,0x01 ,0x0b ,0x00 ,0x00 ,0x00 ,0x11 , +0x0d ,2 ,0x03 ,0x01 , +0x21 ,4 ,0x00 ,0x00 ,0x00 ,0x11 ,0x26 ,2 ,0xaa ,0xaa ,0x2e ,1 ,0x31 , 0x38, 1, 0x01,
@@ -264,8 +275,6 @@ static const __u8 start_7302[] = {0x7d ,23 ,0x01 ,0x01 ,0x58 ,0x46 ,0x50 ,0x3c ,0x50 ,0x3c ,0x54 ,0x46 ,0x54 ,0x56 ,0x52 ,0x50 ,0x52 ,0x50 ,0x56 ,0x64 ,0xa4 ,0x00 ,0xda ,0x00 ,0x00 , -0xa2 ,10 ,0x22 ,0x2c ,0x3c ,0x54 ,0x69 ,0x7c ,0x9c ,0xb9 , -0xd2 ,0xeb ,0xaf ,1 ,0x02 ,0xb5 ,2 ,0x08 ,0x08 , 0xb8, 2, 0x08, 0x88,
@@ -309,26 +318,32 @@ static const __u8 start_7302[] = {#define SKIP 0xaa/* page 3 - the value SKIP says skip the index - see reg_w_page() */ static const __u8 page3_7302[] = { -0x90 ,0x40 ,0x03 ,0x50 ,0xc2 ,0x01 ,0x14 ,0x16 , -0x14 ,0x12 ,0x00 ,0x00 ,0x00 ,0x02 ,0x33 ,0x00 , -0x0f ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , -0x00 ,0x00 ,0x00 ,0x47 ,0x01 ,0xb3 ,0x01 ,0x00 , -0x00 ,0x08 ,0x00 ,0x00 ,0x0d ,0x00 ,0x00 ,0x21 , -0x00 ,0x00 ,0x00 ,0x54 ,0xf4 ,0x02 ,0x52 ,0x54 , -0xa4 ,0xb8 ,0xe0 ,0x2a ,0xf6 ,0x00 ,0x00 ,0x00 , -0x00 ,0x1e ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , -0x00 ,0xfc ,0x00 ,0xf2 ,0x1f ,0x04 ,0x00 ,0x00 , -0x00 ,0x00 ,0x00 ,0xc0 ,0xc0 ,0x10 ,0x00 ,0x00 , -0x00 ,0x40 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , -0x00 ,0x40 ,0xff ,0x03 ,0x19 ,0x00 ,0x00 ,0x00 , -0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , -0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0xc8 ,0xc8 ,0xc8 , -0xc8 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x50 , -0x08 ,0x10 ,0x24 ,0x40 ,0x00 ,0x00 ,0x00 ,0x00 , -0x01 ,0x00 ,0x02 ,0x47 ,0x00 ,0x00 ,0x00 ,0x00 , -0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , -0x00 ,0x02 ,0xfa ,0x00 ,0x64 ,0x5a ,0x28 ,0x00 , -0x00 +/* 0x00 */ 0x90 ,0x40 , +SKIP ,/* accessed in setexposure() */ +0x50 ,0xc2 ,0x01 ,0x14 ,0x16 , +/* 0x08 */ 0x14 ,0x12 ,0x00 ,0x00 ,0x00 ,0x02 ,0x33 ,0x00 , +/* 0x10 */ SKIP ,/* accessed in setgain() */ +SKIP ,/* accessed in setcolors() */ +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +/* 0x18 */ 0x00 ,0x00 ,0x00 ,0x47 ,0x01 ,0xb3 ,0x01 ,0x00 , +/* 0x20 */ 0x00 , +SKIP ,/* accessed in sethvflip() */ +0x00 ,0x00 ,0x0d ,0x00 ,0x00 ,0x21 , +/* 0x28 */ 0x00 ,0x00 ,0x00 ,0x54 ,0xf4 ,0x02 ,0x52 ,0x54 , +/* 0x30 */ 0xa4 ,0xb8 ,0xe0 ,0x2a ,0xf6 ,0x00 ,0x00 ,0x00 , +/* 0x38 */ 0x00 ,0x1e ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +/* 0x40 */ 0x00 ,0xfc ,0x00 ,0xf2 ,0x1f ,0x04 ,0x00 ,0x00 , +/* 0x48 */ 0x00 ,0x00 ,0x00 ,0xc0 ,0xc0 ,0x10 ,0x00 ,0x00 , +/* 0x50 */ 0x00 ,0x40 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +/* 0x58 */ 0x00 ,0x40 ,0xff ,0x03 ,0x19 ,0x00 ,0x00 ,0x00 , +/* 0x60 */ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +/* 0x68 */ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0xc8 ,0xc8 ,0xc8 , +/* 0x70 */ 0xc8 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x50 , +/* 0x78 */ 0x08 ,0x10 ,0x24 ,0x40 ,0x00 ,0x00 ,0x00 ,0x00 , +/* 0x80 */ 0x01 ,0x00 ,0x02 ,0x47 ,0x00 ,0x00 ,0x00 ,0x00 , +/* 0x88 */ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +/* 0x90 */ 0x00 ,0x02 ,0xfa ,0x00 ,0x64 ,0x5a ,0x28 ,0x00 , +/* 0x98 */ 0x00 }; static int reg_w_buf(struct gspca_dev *gspca_dev,
Quoted 2 lines · On Sat, 07 Nov 2009 10:41:19 +0100 Németh Márton <[email protected]> wrote:
The init sequence contains register writes which are overwritten later. Remove these redundant writes from the init sequence.
[snip]
Hello Németh,
I am not sure it is a good idea. The webcam may need some initialization values to start working before the control are applied. Also, if any problem occurs, it is not easy to find the differences with the ms-win traces.
Cheers.
Signature · 2 lines
Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/
Hi Jef,
Quoted 5 lines · Jean-Francois Moine
Quoted 2 lines · On Sat, 07 Nov 2009 10:41:19 +0100 Németh Márton <[email protected]> wrote:
The init sequence contains register writes which are overwritten later. Remove these redundant writes from the init sequence.
Quoted 8 lines
[snip]Hello Németh,
I am not sure it is a good idea. The webcam may need some initialization values to start working before the control are applied. Also, if any problem occurs, it is not easy to find the differences with the ms-win traces.
OK, maybe this change was made too early. I also reverted this change and I'll send my next patch without modifying the init sequence.
Regards,
Márton Németh