From patchwork Fri Nov 20 02:47:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 61534 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 nAK2ld9v007925 for ; Fri, 20 Nov 2009 02:47:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758238AbZKTCrc (ORCPT ); Thu, 19 Nov 2009 21:47:32 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758226AbZKTCrc (ORCPT ); Thu, 19 Nov 2009 21:47:32 -0500 Received: from mail.renesas.com ([202.234.163.13]:36882 "EHLO mail01.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758225AbZKTCrb (ORCPT ); Thu, 19 Nov 2009 21:47:31 -0500 X-AuditID: ac140384-00000005000004f6-5c-4b0603467304 Received: from guardian03.idc.renesas.com ([172.20.8.202]) by mail01.idc.renesas.com (sendmail) with ESMTP id nAK2lXc4019593; Fri, 20 Nov 2009 11:47:33 +0900 (JST) Received: (from root@localhost) by guardian03.idc.renesas.com with id nAK2lXpd015127; Fri, 20 Nov 2009 11:47:33 +0900 (JST) Received: from mta01.idc.renesas.com (localhost [127.0.0.1]) by mta01.idc.renesas.com with ESMTP id nAK2lXSa015669; Fri, 20 Nov 2009 11:47:33 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KTD00CAZZR93Z@ims05.idc.renesas.com>; Fri, 20 Nov 2009 11:47:33 +0900 (JST) Date: Fri, 20 Nov 2009 11:47:32 +0900 From: Kuninori Morimoto Subject: [PATCH] soc-camera: tw9910: Add sync polarity support To: Guennadi Cc: Linux-V4L2 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 diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c index a4ba720..243207d 100644 --- a/drivers/media/video/tw9910.c +++ b/drivers/media/video/tw9910.c @@ -166,7 +166,7 @@ #define VSSL_FIELD 0x20 /* 2 : FIELD */ #define VSSL_VVALID 0x30 /* 3 : VVALID */ #define VSSL_ZERO 0x70 /* 7 : 0 */ -#define HSP_LOW 0x00 /* 0 : HS pin output polarity is active low */ +#define HSP_LO 0x00 /* 0 : HS pin output polarity is active low */ #define HSP_HI 0x08 /* 1 : HS pin output polarity is active high.*/ /* HS pin output control */ #define HSSL_HACT 0x00 /* 0 : HACT */ @@ -175,6 +175,11 @@ #define HSSL_HLOCK 0x03 /* 3 : HLOCK */ #define HSSL_ASYNCW 0x04 /* 4 : ASYNCW */ #define HSSL_ZERO 0x07 /* 7 : 0 */ + /* xSSL_xVALID polarity */ +#define VSP_V_LO VSP_HI /* xSSL_xVALID case, polarity will be inverted */ +#define VSP_V_HI VSP_LO +#define HSP_V_LO HSP_HI +#define HSP_V_HI HSP_LO /* ACNTL1 */ #define SRESET 0x80 /* resets the device to its default state @@ -513,12 +518,22 @@ static int tw9910_set_bus_param(struct soc_camera_device *icd, { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct i2c_client *client = sd->priv; + u8 val = VSSL_VVALID | HSSL_DVALID; /* * set OUTCTR1 */ - return i2c_smbus_write_byte_data(client, OUTCTR1, - VSSL_VVALID | HSSL_DVALID); + if (flags & SOCAM_HSYNC_ACTIVE_LOW) + val |= HSP_V_LO; + else + val |= HSP_V_HI; + + if (flags & SOCAM_VSYNC_ACTIVE_LOW) + val |= VSP_V_LO; + else + val |= VSP_V_HI; + + return i2c_smbus_write_byte_data(client, OUTCTR1, val); } static unsigned long tw9910_query_bus_param(struct soc_camera_device *icd) @@ -528,6 +543,7 @@ static unsigned long tw9910_query_bus_param(struct soc_camera_device *icd) struct soc_camera_link *icl = to_soc_camera_link(icd); unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER | SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH | + SOCAM_VSYNC_ACTIVE_LOW | SOCAM_HSYNC_ACTIVE_LOW | SOCAM_DATA_ACTIVE_HIGH | priv->info->buswidth; return soc_camera_apply_sensor_flags(icl, flags);