From patchwork Sat Nov 7 09:41:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOpbWV0aCBNw6FydG9u?= X-Patchwork-Id: 1982 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sat, 07 Nov 2009 09:41:31 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Sat, 07 Nov 2009 08:49:26 -0200 (BRST) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1N6hnW-0003YZ-VB; Sat, 07 Nov 2009 09:41:31 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751271AbZKGJlT (ORCPT + 1 other); Sat, 7 Nov 2009 04:41:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751267AbZKGJlT (ORCPT ); Sat, 7 Nov 2009 04:41:19 -0500 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 Received: from [192.168.1.64] (dsl5402C46E.pool.t-online.hu [84.2.196.110]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail01d.mail.t-online.hu (Postfix) with ESMTPSA id 24C62758623; Sat, 7 Nov 2009 10:41:02 +0100 (CET) Message-ID: <4AF540BF.8000905@freemail.hu> Date: Sat, 07 Nov 2009 10:41:19 +0100 From: =?ISO-8859-2?Q?N=E9meth_M=E1rton?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; hu-HU; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16 MIME-Version: 1.0 To: Jean-Francois Moine , V4L Mailing List Subject: [PATCH] gspca pac7302: simplify init sequence X-DCC-mail.t-online.hu-Metrics: mail01d.mail.t-online.hu 32711; Body=2 Fuz1=2 Fuz2=2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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,