From patchwork Mon Mar 23 05:27:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 557 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Mon, 23 Mar 2009 05:33:10 +0000 Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Llcmc-0005cH-6l; Mon, 23 Mar 2009 05:33:10 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751891AbZCWFcn (ORCPT + 1 other); Mon, 23 Mar 2009 01:32:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753439AbZCWFcn (ORCPT ); Mon, 23 Mar 2009 01:32:43 -0400 Received: from mail.renesas.com ([202.234.163.13]:50574 "EHLO mail05.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751891AbZCWFcm (ORCPT ); Mon, 23 Mar 2009 01:32:42 -0400 X-AuditID: ac140388-0000000400006b18-4b-49c71ef247c6 Received: from guardian03.idc.renesas.com ([172.20.8.202]) by mail05.idc.renesas.com (sendmail) with ESMTP id n2N5WYu1026342; Mon, 23 Mar 2009 14:32:34 +0900 (JST) Received: (from root@localhost) by guardian03.idc.renesas.com with id n2N5Wadt016902; Mon, 23 Mar 2009 14:32:36 +0900 (JST) Received: from mta02.idc.renesas.com (localhost [127.0.0.1]) by mta02.idc.renesas.com with ESMTP id n2N5WbSL023904; Mon, 23 Mar 2009 14:32:37 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KGY00IG8229T9@ims05.idc.renesas.com>; Mon, 23 Mar 2009 14:32:35 +0900 (JST) Date: Mon, 23 Mar 2009 14:27:18 +0900 From: Kuninori Morimoto Subject: [PATCH] ov772x: add edge contrl support To: Guennadi Liakhovetski Cc: 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 Signed-off-by: Kuninori Morimoto --- This patch is 1st step for extra settings drivers/media/video/ov772x.c | 34 ++++++++++++++++++++++++++++++++++ include/media/ov772x.h | 25 +++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c index 34c9819..a951327 100644 --- a/drivers/media/video/ov772x.c +++ b/drivers/media/video/ov772x.c @@ -358,6 +358,15 @@ #define VOSZ_VGA 0xF0 #define VOSZ_QVGA 0x78 +/* EDGE CTRL + * see alse + * ov772x.h :: for Edge ctrl + */ +#define EDGE0CTRL(param) (((param) >> 24) & 0x1F) +#define EDGE1CTRL(param) (((param) >> 16) & 0x0F) +#define EDGE2CTRL(param) (((param) >> 8) & 0xFF) +#define EDGE3CTRL(param) (((param) >> 0) & 0xFF) + /* * ID */ @@ -816,6 +825,31 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 width, u32 height, ov772x_reset(priv->client); /* + * set Edge Ctrl if platform has edgectrl + */ + if (priv->info->edgectrl & OV772X_EDGECTRL_ENABLE) { + ret = ov772x_mask_set(priv->client, + EDGE0, 0x1F, EDGE0CTRL(priv->info->edgectrl)); + if (ret < 0) + goto ov772x_set_fmt_error; + + ret = ov772x_mask_set(priv->client, + EDGE1, 0x0F, EDGE1CTRL(priv->info->edgectrl)); + if (ret < 0) + goto ov772x_set_fmt_error; + + ret = ov772x_mask_set(priv->client, + EDGE2, 0xFF, EDGE2CTRL(priv->info->edgectrl)); + if (ret < 0) + goto ov772x_set_fmt_error; + + ret = ov772x_mask_set(priv->client, + EDGE3, 0xFF, EDGE3CTRL(priv->info->edgectrl)); + if (ret < 0) + goto ov772x_set_fmt_error; + } + + /* * set size format */ ret = ov772x_write_array(priv->client, priv->win->regs); diff --git a/include/media/ov772x.h b/include/media/ov772x.h index 57db48d..5b083dc 100644 --- a/include/media/ov772x.h +++ b/include/media/ov772x.h @@ -17,9 +17,34 @@ #define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ #define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ +/* + * for Edge ctrl + * + * strength : (for EDGE0) Edge enhancement strength control + * threshold : (for EDGE1) Edge enhancement threshold control + * low : (for EDGE2) Edge enhancement strength Low point control + * high : (for EDGE3) Edge enhancement strength High point control + * + * Meaning of edgectrl bit + * + * Exx0 0000 xxxx 1111 2222 2222 3333 3333 + * + * E: use edgectrl or not (OV772X_EDGECTRL_ENABLE) + * 0: for Edge0 ctrl + * 1: for Edge1 ctrl + * 2: for Edge2 ctrl + * 3: for Edge3 ctrl + */ +#define OV772X_EDGECTRL_ENABLE 0x80000000 +#define OV772X_EDGECTRL(strength, threshold, low, high) \ + (OV772X_EDGECTRL_ENABLE | \ + (strength & 0x1F) << 24 | (threshold & 0x0F) << 16 | \ + (low & 0xFF) << 8 | (high & 0xFF) << 0) + struct ov772x_camera_info { unsigned long buswidth; unsigned long flags; + unsigned long edgectrl; struct soc_camera_link link; };