From patchwork Tue Oct 13 05:49:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 1833 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Tue, 13 Oct 2009 05:53:53 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Tue, 13 Oct 2009 16:49:23 -0300 (BRT) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MxaKX-0004PK-Ap; Tue, 13 Oct 2009 05:53:53 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755669AbZJMFuP (ORCPT + 1 other); Tue, 13 Oct 2009 01:50:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755507AbZJMFuP (ORCPT ); Tue, 13 Oct 2009 01:50:15 -0400 Received: from mail.renesas.com ([202.234.163.13]:59126 "EHLO mail03.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754120AbZJMFuO (ORCPT ); Tue, 13 Oct 2009 01:50:14 -0400 X-AuditID: ac140386-0000000500003037-02-4ad414ee01ed Received: from guardian02.idc.renesas.com ([172.20.8.201]) by mail03.idc.renesas.com (sendmail) with ESMTP id n9D5nY9o015937; Tue, 13 Oct 2009 14:49:34 +0900 (JST) Received: (from root@localhost) by guardian02.idc.renesas.com with id n9D5nYuX004046; Tue, 13 Oct 2009 14:49:34 +0900 (JST) Received: from mta04.idc.renesas.com (localhost [127.0.0.1]) by mta04.idc.renesas.com with ESMTP id n9D5nXH2008830; Tue, 13 Oct 2009 14:49:33 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KRF00H4ZUUMSH@ims05.idc.renesas.com>; Tue, 13 Oct 2009 14:49:34 +0900 (JST) Date: Tue, 13 Oct 2009 14:49:34 +0900 From: Kuninori Morimoto Subject: [PATCH 5/5] soc-camera: tw9910: Add revision control on tw9910_set_hsync To: Guennadi Liakhovetski Cc: Linux Media Mailing List Message-id: MIME-version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-type: text/plain; charset=US-ASCII User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.7 Emacs/22.3 (i386-msvc-nt5.1.2600) MULE/5.0 (SAKAKI) Meadow/3.02-dev (RINDOU) (2009-06-17 Rev.4261) X-Brightmail-Tracker: AAAAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 10 - 3 bit hsync control are same as Rev0/Rev1. But only rev1 can control more 3 bit for hsync. This patch modify this problem Signed-off-by: Kuninori Morimoto --- drivers/media/video/tw9910.c | 26 +++++++++++++++++--------- 1 files changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c index 59158bb..a688c11 100644 --- a/drivers/media/video/tw9910.c +++ b/drivers/media/video/tw9910.c @@ -349,6 +349,7 @@ static int tw9910_set_scale(struct i2c_client *client, static int tw9910_set_hsync(struct i2c_client *client, const u16 start, const u16 end) { + struct tw9910_priv *priv = to_tw9910(client); int ret; /* bit 10 - 3 */ @@ -363,15 +364,22 @@ static int tw9910_set_hsync(struct i2c_client *client, if (ret < 0) return ret; - /* bit 2 - 0 */ - ret = i2c_smbus_read_byte_data(client, HSLOWCTL); - if (ret < 0) - return ret; + /* FIXME + * + * So far only revisions 0 and 1 have been seen + */ + if (1 == priv->rev) { - ret = i2c_smbus_write_byte_data(client, HSLOWCTL, - (ret & 0x88) | - (start & 0x0007) << 4 | - (end & 0x0007)); + /* bit 2 - 0 */ + ret = i2c_smbus_read_byte_data(client, HSLOWCTL); + if (ret < 0) + return ret; + + ret = i2c_smbus_write_byte_data(client, HSLOWCTL, + (ret & 0x88) | + (start & 0x0007) << 4 | + (end & 0x0007)); + } return ret; }