From patchwork Mon Feb 2 23:51:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 487 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Thu, 05 Feb 2009 07:35:20 +0000 Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LUylb-0006WG-Lb for mchehab@infradead.org; Thu, 05 Feb 2009 07:35:19 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752478AbZBEHfS (ORCPT ); Thu, 5 Feb 2009 02:35:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752057AbZBEHfS (ORCPT ); Thu, 5 Feb 2009 02:35:18 -0500 Received: from mail.renesas.com ([202.234.163.13]:43798 "EHLO mail01.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752478AbZBEHfR (ORCPT ); Thu, 5 Feb 2009 02:35:17 -0500 X-AuditID: ac140384-00000008000004f6-0c-498a96ac0fdb Received: from guardian01.idc.renesas.com ([172.20.8.200]) by mail01.idc.renesas.com (sendmail) with ESMTP id n157Z8IF001560; Thu, 5 Feb 2009 16:35:08 +0900 (JST) Received: (from root@localhost) by guardian01.idc.renesas.com with id n157Z9xq005044; Thu, 5 Feb 2009 16:35:09 +0900 (JST) Received: from mta03.idc.renesas.com (localhost [127.0.0.1]) by mta03.idc.renesas.com with ESMTP id n157Z8A3029380; Thu, 5 Feb 2009 16:35:08 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KEL000OI12KOQ@ims05.idc.renesas.com>; Thu, 05 Feb 2009 16:35:08 +0900 (JST) Date: Tue, 03 Feb 2009 08:51:50 +0900 From: Kuninori Morimoto Subject: [PATCH v2] sh_mobile_ceu: SOCAM flags are prepared at itself To: Guennadi Liakhovetski Cc: Magnus , Linux Media 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.1 (i386-mingw-nt5.1.2600) MULE/5.0 (SAKAKI) Meadow/3.00-dev (KIKU) X-Brightmail-Tracker: AAAAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From 32fde76488032405b48afa4ed0b30c9184e855b5 Mon Sep 17 00: 00:00 2001 sh_mobile_ceu can supports bus width 8, 16 and other flags. But it can not support SOCAM_SLAVE, because it does not support any clocks. Signed-off-by: Kuninori Morimoto --- v1 -> v2 o change SLAVE -> MASTER drivers/media/video/sh_mobile_ceu_camera.c | 27 +++++++++++++++++++++++++-- include/media/sh_mobile_ceu.h | 5 +++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 9a2586b..aa20745 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c @@ -101,6 +101,29 @@ struct sh_mobile_ceu_dev { const struct soc_camera_data_format *camera_fmt; }; +static unsigned long make_bus_param(struct sh_mobile_ceu_dev *pcdev) +{ + unsigned long flags; + + flags = SOCAM_MASTER | + SOCAM_PCLK_SAMPLE_RISING | + SOCAM_HSYNC_ACTIVE_HIGH | + SOCAM_HSYNC_ACTIVE_LOW | + SOCAM_VSYNC_ACTIVE_HIGH | + SOCAM_VSYNC_ACTIVE_LOW; + + if (pcdev->pdata->flags & SH_CEU_FLAG_USE_8BIT_BUS) + flags |= SOCAM_DATAWIDTH_8; + + if (pcdev->pdata->flags & SH_CEU_FLAG_USE_16BIT_BUS) + flags |= SOCAM_DATAWIDTH_16; + + if (flags & SOCAM_DATAWIDTH_MASK) + return flags; + + return 0; +} + static void ceu_write(struct sh_mobile_ceu_dev *priv, unsigned long reg_offs, u32 data) { @@ -396,7 +419,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, camera_flags = icd->ops->query_bus_param(icd); common_flags = soc_camera_bus_param_compatible(camera_flags, - pcdev->pdata->flags); + make_bus_param(pcdev)); if (!common_flags) return -EINVAL; @@ -517,7 +540,7 @@ static int sh_mobile_ceu_try_bus_param(struct soc_camera_device *icd) camera_flags = icd->ops->query_bus_param(icd); common_flags = soc_camera_bus_param_compatible(camera_flags, - pcdev->pdata->flags); + make_bus_param(pcdev)); if (!common_flags) return -EINVAL; diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h index b5dbefe..0f3524c 100644 --- a/include/media/sh_mobile_ceu.h +++ b/include/media/sh_mobile_ceu.h @@ -1,10 +1,11 @@ #ifndef __ASM_SH_MOBILE_CEU_H__ #define __ASM_SH_MOBILE_CEU_H__ -#include +#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 */ struct sh_mobile_ceu_info { - unsigned long flags; /* SOCAM_... */ + unsigned long flags; }; #endif /* __ASM_SH_MOBILE_CEU_H__ */