From patchwork Fri Nov 20 02:47:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 2124 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Fri, 20 Nov 2009 02:47:22 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Fri, 20 Nov 2009 09:02:41 -0200 (BRST) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NBJWr-0006u4-SI; Fri, 20 Nov 2009 02:47:22 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758232AbZKTCrL (ORCPT + 1 other); Thu, 19 Nov 2009 21:47:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758245AbZKTCrL (ORCPT ); Thu, 19 Nov 2009 21:47:11 -0500 Received: from mail.renesas.com ([202.234.163.13]:50443 "EHLO mail03.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758218AbZKTCrE (ORCPT ); Thu, 19 Nov 2009 21:47:04 -0500 X-AuditID: ac140386-0000000800003037-a3-4b06032a2d34 Received: from guardian01.idc.renesas.com ([172.20.8.200]) by mail03.idc.renesas.com (sendmail) with ESMTP id nAK2l6wi020289; Fri, 20 Nov 2009 11:47:06 +0900 (JST) Received: (from root@localhost) by guardian01.idc.renesas.com with id nAK2l7Br022593; Fri, 20 Nov 2009 11:47:07 +0900 (JST) Received: from mta03.idc.renesas.com (localhost [127.0.0.1]) by mta03.idc.renesas.com with ESMTP id nAK2l7gG004432; Fri, 20 Nov 2009 11:47:07 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KTD00C5DZQI3Z@ims05.idc.renesas.com>; Fri, 20 Nov 2009 11:47:06 +0900 (JST) Date: Fri, 20 Nov 2009 11:47:05 +0900 From: Kuninori Morimoto Subject: [PATCH] soc-camera: sh_mobile_ceu_camera: Add support sync polarity selection 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 Signed-off-by: Kuninori Morimoto --- drivers/media/video/sh_mobile_ceu_camera.c | 25 +++++++++++++++++++++++++ include/media/sh_mobile_ceu.h | 3 +++ 2 files changed, 28 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 746aed0..e5cee0f 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c @@ -660,6 +660,31 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, if (!common_flags) return -EINVAL; + /* Make choises, based on platform preferences */ + if ((common_flags & SOCAM_HSYNC_ACTIVE_HIGH) && + (common_flags & SOCAM_HSYNC_ACTIVE_LOW)) { + if (pcdev->pdata->flags & SH_CEU_FLAG_HSP) + common_flags &= ~SOCAM_HSYNC_ACTIVE_HIGH; + else + common_flags &= ~SOCAM_HSYNC_ACTIVE_LOW; + } + + if ((common_flags & SOCAM_VSYNC_ACTIVE_HIGH) && + (common_flags & SOCAM_VSYNC_ACTIVE_LOW)) { + if (pcdev->pdata->flags & SH_CEU_FLAG_VSP) + common_flags &= ~SOCAM_VSYNC_ACTIVE_HIGH; + else + common_flags &= ~SOCAM_VSYNC_ACTIVE_LOW; + } + + if ((common_flags & SOCAM_PCLK_SAMPLE_RISING) && + (common_flags & SOCAM_PCLK_SAMPLE_FALLING)) { + if (pcdev->pdata->flags & SH_CEU_FLAG_PCP) + common_flags &= ~SOCAM_PCLK_SAMPLE_RISING; + else + common_flags &= ~SOCAM_PCLK_SAMPLE_FALLING; + } + ret = icd->ops->set_bus_param(icd, common_flags); if (ret < 0) return ret; diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h index 0f3524c..3726daf 100644 --- a/include/media/sh_mobile_ceu.h +++ b/include/media/sh_mobile_ceu.h @@ -3,6 +3,9 @@ #define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */ #define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */ +#define SH_CEU_FLAG_PCP (1 << 2) /* Pixel clock polarity */ +#define SH_CEU_FLAG_HSP (1 << 3) /* Horizontal sync polarity */ +#define SH_CEU_FLAG_VSP (1 << 4) /* Vertical sync polarity */ struct sh_mobile_ceu_info { unsigned long flags;