From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail01d.mail.t-online.hu ([84.2.42.6]:62298 "EHLO mail01d.mail.t-online.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751254AbZKGJlS (ORCPT ); Sat, 7 Nov 2009 04:41:18 -0500 Message-ID: <4AF540BF.8000905@freemail.hu> Date: Sat, 07 Nov 2009 10:41:19 +0100 From: =?ISO-8859-2?Q?N=E9meth_M=E1rton?= MIME-Version: 1.0 To: Jean-Francois Moine , V4L Mailing List Subject: [PATCH] gspca pac7302: simplify init sequence Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit Sender: linux-media-owner@vger.kernel.org List-ID: From: Márton Németh 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 --- 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,