public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gspca pac7302: simplify init sequence
@ 2009-11-07  9:41 Németh Márton
  2009-11-07 10:54 ` Jean-Francois Moine
  0 siblings, 1 reply; 3+ messages in thread
From: Németh Márton @ 2009-11-07  9:41 UTC (permalink / raw)
  To: Jean-Francois Moine, V4L Mailing List

From: Márton Németh <nm127@freemail.hu>

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).

Signed-off-by: Márton Németh <nm127@freemail.hu>
---
diff -upr b/linux/drivers/media/video/gspca/pac7302.c c/linux/drivers/media/video/gspca/pac7302.c
--- b/linux/drivers/media/video/gspca/pac7302.c	2009-11-07 09:08:16.000000000 +0100
+++ c/linux/drivers/media/video/gspca/pac7302.c	2009-11-07 10:33:57.000000000 +0100
@@ -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,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gspca pac7302: simplify init sequence
  2009-11-07  9:41 [PATCH] gspca pac7302: simplify init sequence Németh Márton
@ 2009-11-07 10:54 ` Jean-Francois Moine
  2009-11-07 11:30   ` Németh Márton
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Francois Moine @ 2009-11-07 10:54 UTC (permalink / raw)
  To: Németh Márton; +Cc: V4L Mailing List

On Sat, 07 Nov 2009 10:41:19 +0100
Németh Márton <nm127@freemail.hu> 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.

-- 
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gspca pac7302: simplify init sequence
  2009-11-07 10:54 ` Jean-Francois Moine
@ 2009-11-07 11:30   ` Németh Márton
  0 siblings, 0 replies; 3+ messages in thread
From: Németh Márton @ 2009-11-07 11:30 UTC (permalink / raw)
  To: Jean-Francois Moine; +Cc: V4L Mailing List

Hi Jef,
Jean-Francois Moine wrote:
> On Sat, 07 Nov 2009 10:41:19 +0100
> Németh Márton <nm127@freemail.hu> 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.

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-07 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-07  9:41 [PATCH] gspca pac7302: simplify init sequence Németh Márton
2009-11-07 10:54 ` Jean-Francois Moine
2009-11-07 11:30   ` Németh Márton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox