From patchwork Tue Jan 5 04:36:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 2410 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Tue, 05 Jan 2010 04:36:54 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Tue, 05 Jan 2010 12:06:32 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NS1A6-0004HL-Op; Tue, 05 Jan 2010 04:36:54 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752702Ab0AEEgx (ORCPT + 1 other); Mon, 4 Jan 2010 23:36:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754096Ab0AEEgx (ORCPT ); Mon, 4 Jan 2010 23:36:53 -0500 Received: from mail.renesas.com ([202.234.163.13]:52756 "EHLO mail01.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751612Ab0AEEgw (ORCPT ); Mon, 4 Jan 2010 23:36:52 -0500 X-AuditID: ac140384-00000009000004f6-d8-4b42c1df5157 Received: from guardian02.idc.renesas.com ([172.20.8.201]) by mail01.idc.renesas.com (sendmail) with ESMTP id o054alEC010647; Tue, 5 Jan 2010 13:36:47 +0900 (JST) Received: (from root@localhost) by guardian02.idc.renesas.com with id o054al8T025899; Tue, 5 Jan 2010 13:36:47 +0900 (JST) Received: from mta02.idc.renesas.com (localhost [127.0.0.1]) by mta02.idc.renesas.com with ESMTP id o054amRR009530; Tue, 5 Jan 2010 13:36:48 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KVR00LTJBH8I9@ims05.idc.renesas.com>; Tue, 05 Jan 2010 13:36:46 +0900 (JST) Date: Tue, 05 Jan 2010 13:36:43 +0900 From: Kuninori Morimoto Subject: [PATCH] soc-camera: ov772x: Add buswidth selection flags for platform To: Guennadi Cc: Paul Mundt , 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 This patch remove "buswidth" struct member and add new flags for ov772x_camera_info. And it also modify ap325rxa/migor setup.c Signed-off-by: Kuninori Morimoto --- arch/sh/boards/mach-ap325rxa/setup.c | 4 ++-- arch/sh/boards/mach-migor/setup.c | 2 +- drivers/media/video/ov772x.c | 28 ++++++++++++---------------- include/media/ov772x.h | 7 ++++--- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c index 1f5fa5c..71f556f 100644 --- a/arch/sh/boards/mach-ap325rxa/setup.c +++ b/arch/sh/boards/mach-ap325rxa/setup.c @@ -471,8 +471,8 @@ static struct i2c_board_info ap325rxa_i2c_camera[] = { }; static struct ov772x_camera_info ov7725_info = { - .buswidth = SOCAM_DATAWIDTH_8, - .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP, + .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP | \ + OV772X_FLAG_8BIT, .edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0), }; diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c index 507c77b..9b4676f 100644 --- a/arch/sh/boards/mach-migor/setup.c +++ b/arch/sh/boards/mach-migor/setup.c @@ -431,7 +431,7 @@ static struct i2c_board_info migor_i2c_camera[] = { }; static struct ov772x_camera_info ov7725_info = { - .buswidth = SOCAM_DATAWIDTH_8, + .flags = OV772X_FLAG_8BIT, }; static struct soc_camera_link ov7725_link = { diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c index 3a45e94..12cb66f 100644 --- a/drivers/media/video/ov772x.c +++ b/drivers/media/video/ov772x.c @@ -547,7 +547,6 @@ static const struct v4l2_queryctrl ov772x_controls[] = { }, }; - /* * general function */ @@ -634,9 +633,18 @@ static unsigned long ov772x_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_DATA_ACTIVE_HIGH | priv->info->buswidth; + SOCAM_DATA_ACTIVE_HIGH; + + if (priv->info->flags & OV772X_FLAG_8BIT) + flags |= SOCAM_DATAWIDTH_8; + + if (priv->info->flags & OV772X_FLAG_10BIT) + flags |= SOCAM_DATAWIDTH_10; - return soc_camera_apply_sensor_flags(icl, flags); + if (flags & SOCAM_DATAWIDTH_MASK) + return soc_camera_apply_sensor_flags(icl, flags); + + return 0; } static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) @@ -1040,15 +1048,6 @@ static int ov772x_video_probe(struct soc_camera_device *icd, return -ENODEV; /* - * ov772x only use 8 or 10 bit bus width - */ - if (SOCAM_DATAWIDTH_10 != priv->info->buswidth && - SOCAM_DATAWIDTH_8 != priv->info->buswidth) { - dev_err(&client->dev, "bus width error\n"); - return -ENODEV; - } - - /* * check and show product ID and manufacturer ID */ pid = i2c_smbus_read_byte_data(client, PID); @@ -1130,7 +1129,6 @@ static int ov772x_probe(struct i2c_client *client, const struct i2c_device_id *did) { struct ov772x_priv *priv; - struct ov772x_camera_info *info; struct soc_camera_device *icd = client->dev.platform_data; struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); struct soc_camera_link *icl; @@ -1145,8 +1143,6 @@ static int ov772x_probe(struct i2c_client *client, if (!icl || !icl->priv) return -EINVAL; - info = icl->priv; - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { dev_err(&adapter->dev, "I2C-Adapter doesn't support " @@ -1158,7 +1154,7 @@ static int ov772x_probe(struct i2c_client *client, if (!priv) return -ENOMEM; - priv->info = info; + priv->info = icl->priv; v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops); diff --git a/include/media/ov772x.h b/include/media/ov772x.h index 14c77ef..7e83745 100644 --- a/include/media/ov772x.h +++ b/include/media/ov772x.h @@ -15,8 +15,10 @@ #include /* for flags */ -#define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ -#define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ +#define OV772X_FLAG_VFLIP (1 << 0) /* Vertical flip image */ +#define OV772X_FLAG_HFLIP (1 << 1) /* Horizontal flip image */ +#define OV772X_FLAG_8BIT (1 << 2) /* 8bit buswidth */ +#define OV772X_FLAG_10BIT (1 << 3) /* 10bit buswidth */ /* * for Edge ctrl @@ -53,7 +55,6 @@ struct ov772x_edge_ctrl { * ov772x camera info */ struct ov772x_camera_info { - unsigned long buswidth; unsigned long flags; struct ov772x_edge_ctrl edgectrl; };