From patchwork Thu Dec 9 20:42:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 396132 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB9KnKZF017557 for ; Thu, 9 Dec 2010 20:49:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757266Ab0LIUtS (ORCPT ); Thu, 9 Dec 2010 15:49:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56913 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757012Ab0LIUtR (ORCPT ); Thu, 9 Dec 2010 15:49:17 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB9KnBdT005553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 Dec 2010 15:49:11 -0500 Received: from pedra (vpn-232-79.phx2.redhat.com [10.3.232.79]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB9Kgsu1009833; Thu, 9 Dec 2010 15:49:09 -0500 Date: Thu, 9 Dec 2010 18:42:38 -0200 From: Mauro Carvalho Chehab To: Jean-Francois Moine , Brian Johnson , Linux Media Mailing List Subject: [PATCH 5/6] [media] gspca/sonixj: Fix support for sn9c105+0v7660 Message-ID: <20101209184238.78a2c2fd@pedra> In-Reply-To: References: Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 09 Dec 2010 20:49:20 +0000 (UTC) diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 2229847..681f64b 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c @@ -1766,6 +1766,7 @@ static void bridge_init(struct gspca_dev *gspca_dev, static const u8 reg9a_spec[] = {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; static const u8 regd4[] = {0x60, 0x00, 0x00}; + u8 reg1_inv_powerdown = 0x02; /* sensor clock already enabled in sd_init */ /* reg_w1(gspca_dev, 0xf1, 0x00); */ @@ -1779,6 +1780,14 @@ static void bridge_init(struct gspca_dev *gspca_dev, reg_w(gspca_dev, 0x01, reg0102, 2); reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); + + /* + * This combination doesn't use an inverted powerdown + * Tested with USB ID = 0c45:60fb + */ + if (sd->sensor == SENSOR_OV7660 && sd->bridge == BRIDGE_SN9C105) + reg1_inv_powerdown = 0; + switch (sd->sensor) { case SENSOR_GC0307: case SENSOR_OV7660: @@ -1798,6 +1807,11 @@ static void bridge_init(struct gspca_dev *gspca_dev, reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); + /* + * FIXME: most of the info on this table is due to inverse + * powerdown. The better is to add this information on a per-type + * config, and remove this ugly hack + */ switch (sd->sensor) { case SENSOR_ADCM1700: reg_w1(gspca_dev, 0x01, 0x43); @@ -1864,10 +1878,10 @@ static void bridge_init(struct gspca_dev *gspca_dev, break; case SENSOR_PO2030N: case SENSOR_OV7660: - reg_w1(gspca_dev, 0x01, 0x63); + reg_w1(gspca_dev, 0x01, 0x61 | reg1_inv_powerdown); reg_w1(gspca_dev, 0x17, 0x20); - reg_w1(gspca_dev, 0x01, 0x62); - reg_w1(gspca_dev, 0x01, 0x42); + reg_w1(gspca_dev, 0x01, 0x60 | reg1_inv_powerdown); + reg_w1(gspca_dev, 0x01, 0x40 | reg1_inv_powerdown); break; case SENSOR_SP80708: reg_w1(gspca_dev, 0x01, 0x63); @@ -2606,6 +2620,9 @@ static int sd_start(struct gspca_dev *gspca_dev) reg17 = 0xa2; reg1 = 0x44; /* 48 Mhz, video trf eneble */ } + } else if (sd->bridge == BRIDGE_SN9C105) { + reg17 = 0xa2; + reg1 = 0x44; /* 48 Mhz, video trf eneble */ } else { reg17 = 0x22; reg1 = 0x06; /* 24 Mhz, video trf eneble