From patchwork Wed Sep 9 21:29:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Blanford X-Patchwork-Id: 46466 X-Patchwork-Delegate: dougsland@redhat.com 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 n89LYpuk009117 for ; Wed, 9 Sep 2009 21:34:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753836AbZIIVer (ORCPT ); Wed, 9 Sep 2009 17:34:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753816AbZIIVer (ORCPT ); Wed, 9 Sep 2009 17:34:47 -0400 Received: from mail-qy0-f181.google.com ([209.85.221.181]:43185 "EHLO mail-qy0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752603AbZIIVeq (ORCPT ); Wed, 9 Sep 2009 17:34:46 -0400 Received: by qyk11 with SMTP id 11so4197813qyk.1 for ; Wed, 09 Sep 2009 14:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:x-mailer:mime-version:content-type :content-transfer-encoding; bh=b5ogDl6S222e9EysdBGnl0WTIDBOn93D6LuFGJgcvgk=; b=cL+pepP+nBucJuumT+01Zz7H5r7tkLv8SPagn8p7x04pW2bwTE5Nb4eqnEoGcmSPmQ FgvTCo/XAkoOxjKdlVbsPEEECxk1PI9nhh2UcvPp5rFp+kAWkRMyEg5MFEoaO1oLon0P vD/yeRlriPOSwU6U5CNpwTFw4pioM2OxB260M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:x-mailer:mime-version:content-type :content-transfer-encoding; b=bPQdSWf3eoSeDOsuyDMX8F0PyG0JCeEp3fFNyaAnmHM7VlVmIHPzXA1YMf1Wtolttl 7FhPwPg+Fn5mAMn0Io6JZQL1TNmi7992e5GTugWL+g42r/n16a8iU1yndJ2iqEolHdRv 8R28vm3rSKyGLT0fvwqEYorkpR0GYN67YCFqo= Received: by 10.224.83.211 with SMTP id g19mr798495qal.76.1252531781396; Wed, 09 Sep 2009 14:29:41 -0700 (PDT) Received: from blackbart.localnet.prv (adsl-99-19-46-38.dsl.klmzmi.sbcglobal.net [99.19.46.38]) by mx.google.com with ESMTPS id 6sm87088qwk.51.2009.09.09.14.29.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 09 Sep 2009 14:29:41 -0700 (PDT) Date: Wed, 9 Sep 2009 17:29:38 -0400 From: James Blanford To: linux-media@vger.kernel.org, Erik =?ISO-8859-1?Q?Andr=E9n?= Subject: [Patch 1/2] stv06xx webcams with HDCS 1xxx sensors Message-ID: <20090909172938.56cf7105@blackbart.localnet.prv> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.16.5; i486-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Quickcam Express 046d:0840 and maybe others Driver version: v 2.60 from 2.6.31-rc7 Initialize image size before it's used to initialize exposure. Work around lack of exposure set hardware latch with a sequence of register writes in a single I2C command packet. Signed-off-by: James Blanford Acked-by: Erik Andrén --- 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 --- a/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c 2009-09-01 09:45:42.000000000 -0400 +++ b/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c 2009-09-09 14:59:35.000000000 -0400 @@ -252,7 +252,7 @@ static int hdcs_set_exposure(struct gspc within the column processing period */ int mnct; int cycles, err; - u8 exp[4]; + u8 exp[14]; cycles = val * HDCS_CLK_FREQ_MHZ; @@ -288,24 +288,37 @@ static int hdcs_set_exposure(struct gspc srowexp = max_srowexp; if (IS_1020(sd)) { - exp[0] = rowexp & 0xff; - exp[1] = rowexp >> 8; - exp[2] = (srowexp >> 2) & 0xff; - /* this clears exposure error flag */ - exp[3] = 0x1; - err = hdcs_reg_write_seq(sd, HDCS_ROWEXPL, exp, 4); + exp[0] = HDCS20_CONTROL; + exp[1] = 0x00; /* Stop streaming */ + exp[2] = HDCS_ROWEXPL; + exp[3] = rowexp & 0xff; + exp[4] = HDCS_ROWEXPH; + exp[5] = rowexp >> 8; + exp[6] = HDCS20_SROWEXP; + exp[7] = (srowexp >> 2) & 0xff; + exp[8] = HDCS20_ERROR; + exp[9] = 0x10; /* Clear exposure error flag*/ + exp[10] = HDCS20_CONTROL; + exp[11] = 0x04; /* Restart streaming */ + err = stv06xx_write_sensor_bytes(sd, exp, 6); } else { - exp[0] = rowexp & 0xff; - exp[1] = rowexp >> 8; - exp[2] = srowexp & 0xff; - exp[3] = srowexp >> 8; - err = hdcs_reg_write_seq(sd, HDCS_ROWEXPL, exp, 4); + exp[0] = HDCS00_CONTROL; + exp[1] = 0x00; /* Stop streaming */ + exp[2] = HDCS_ROWEXPL; + exp[3] = rowexp & 0xff; + exp[4] = HDCS_ROWEXPH; + exp[5] = rowexp >> 8; + exp[6] = HDCS00_SROWEXPL; + exp[7] = srowexp & 0xff; + exp[8] = HDCS00_SROWEXPH; + exp[9] = srowexp >> 8; + exp[10] = HDCS_STATUS; + exp[11] = 0x10; /* Clear exposure error flag*/ + exp[12] = HDCS00_CONTROL; + exp[13] = 0x04; /* Restart streaming */ + err = stv06xx_write_sensor_bytes(sd, exp, 7); if (err < 0) return err; - - /* clear exposure error flag */ - err = stv06xx_write_sensor(sd, - HDCS_STATUS, BIT(4)); } PDEBUG(D_V4L2, "Writing exposure %d, rowexp %d, srowexp %d", val, rowexp, srowexp); @@ -577,11 +590,11 @@ static int hdcs_init(struct sd *sd) if (err < 0) return err; - err = hdcs_set_exposure(&sd->gspca_dev, HDCS_DEFAULT_EXPOSURE); + err = hdcs_set_size(sd, hdcs->array.width, hdcs->array.height); if (err < 0) return err; - err = hdcs_set_size(sd, hdcs->array.width, hdcs->array.height); + err = hdcs_set_exposure(&sd->gspca_dev, HDCS_DEFAULT_EXPOSURE); return err; }