From patchwork Sat Oct 31 23:14:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TsODwqltZXRoIE3Dg8KhcnRvbg==?= X-Patchwork-Id: 56802 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9VNDr6j029151 for ; Sat, 31 Oct 2009 23:14:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933363AbZJaXOU (ORCPT ); Sat, 31 Oct 2009 19:14:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933349AbZJaXOT (ORCPT ); Sat, 31 Oct 2009 19:14:19 -0400 Received: from mail02d.mail.t-online.hu ([84.2.42.7]:52332 "EHLO mail02d.mail.t-online.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933336AbZJaXOT (ORCPT ); Sat, 31 Oct 2009 19:14:19 -0400 X-Authuid: nmarci Received: from [192.168.1.64] (dsl5402C4D0.pool.t-online.hu [84.2.196.208]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail02d.mail.t-online.hu (Postfix) with ESMTPSA id CDA95758643; Sun, 1 Nov 2009 00:14:15 +0100 (CET) Message-ID: <4AECC4C9.5080709@freemail.hu> Date: Sun, 01 Nov 2009 00:14:17 +0100 From: =?UTF-8?B?TsOpbWV0aCBNw6FydG9u?= 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 , Hans de Goede , V4L Mailing List CC: Thomas Kaiser , Theodore Kilgore , Kyle Guinn Subject: [PATCH 06/21] gspca pac7302/pac7311: separate start X-DCC-mail.t-online.hu-Metrics: mail02d.mail.t-online.hu 32721; Body=6 Fuz1=6 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org diff -uprN f/drivers/media/video/gspca/pac7311.c g/drivers/media/video/gspca/pac7311.c --- f/drivers/media/video/gspca/pac7311.c 2009-10-30 18:04:30.000000000 +0100 +++ g/drivers/media/video/gspca/pac7311.c 2009-10-30 18:03:15.000000000 +0100 @@ -714,20 +714,40 @@ static int pac7311_sd_init(struct gspca_ return 0; } -static int sd_start(struct gspca_dev *gspca_dev) +static int pac7302_sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; sd->sof_read = 0; - if (sd->sensor == SENSOR_PAC7302) { - reg_w_var(gspca_dev, start_7302); - pac7302_setbrightcont(gspca_dev); - pac7302_setcolors(gspca_dev); - } else { - reg_w_var(gspca_dev, start_7311); - pac7311_setcontrast(gspca_dev); - } + reg_w_var(gspca_dev, start_7302); + pac7302_setbrightcont(gspca_dev); + pac7302_setcolors(gspca_dev); + setgain(gspca_dev); + setexposure(gspca_dev); + sethvflip(gspca_dev); + + /* only resolution 640x480 is supported for pac7302 */ + + sd->sof_read = 0; + sd->autogain_ignore_frames = 0; + atomic_set(&sd->avg_lum, -1); + + /* start stream */ + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x78, 0x01); + + return 0; +} + +static int pac7311_sd_start(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->sof_read = 0; + + reg_w_var(gspca_dev, start_7311); + pac7311_setcontrast(gspca_dev); setgain(gspca_dev); setexposure(gspca_dev); sethvflip(gspca_dev); @@ -745,8 +765,6 @@ static int sd_start(struct gspca_dev *gs reg_w(gspca_dev, 0x87, 0x11); break; case 0: /* 640x480 */ - if (sd->sensor == SENSOR_PAC7302) - break; reg_w(gspca_dev, 0xff, 0x01); reg_w(gspca_dev, 0x17, 0x00); reg_w(gspca_dev, 0x87, 0x12); @@ -759,10 +777,8 @@ static int sd_start(struct gspca_dev *gs /* start stream */ reg_w(gspca_dev, 0xff, 0x01); - if (sd->sensor == SENSOR_PAC7302) - reg_w(gspca_dev, 0x78, 0x01); - else - reg_w(gspca_dev, 0x78, 0x05); + reg_w(gspca_dev, 0x78, 0x05); + return 0; } @@ -1160,7 +1176,7 @@ static struct sd_desc pac7302_sd_desc = .nctrls = ARRAY_SIZE(sd_ctrls), .config = pac7302_sd_config, .init = pac7302_sd_init, - .start = sd_start, + .start = pac7302_sd_start, .stopN = sd_stopN, .stop0 = sd_stop0, .pkt_scan = pac7302_sd_pkt_scan, @@ -1174,7 +1190,7 @@ static struct sd_desc pac7311_sd_desc = .nctrls = ARRAY_SIZE(sd_ctrls), .config = pac7311_sd_config, .init = pac7311_sd_init, - .start = sd_start, + .start = pac7311_sd_start, .stopN = sd_stopN, .stop0 = sd_stop0, .pkt_scan = pac7311_sd_pkt_scan,