From patchwork Tue Mar 24 01:43:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 564 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Tue, 24 Mar 2009 09:07:40 +0000 Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Lm2bj-0004xn-Nz; Tue, 24 Mar 2009 09:07:40 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751919AbZCXJHj (ORCPT + 1 other); Tue, 24 Mar 2009 05:07:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754919AbZCXJHj (ORCPT ); Tue, 24 Mar 2009 05:07:39 -0400 Received: from mail.renesas.com ([202.234.163.13]:60110 "EHLO mail06.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751919AbZCXJHi (ORCPT ); Tue, 24 Mar 2009 05:07:38 -0400 X-AuditID: ac14038a-0000000900001ca1-64-49c8a2d33531 Received: from guardian01.idc.renesas.com ([172.20.8.200]) by mail06.idc.renesas.com (sendmail) with ESMTP id n2O97VtB015150; Tue, 24 Mar 2009 18:07:31 +0900 (JST) Received: (from root@localhost) by guardian01.idc.renesas.com with id n2O97VQf012988; Tue, 24 Mar 2009 18:07:31 +0900 (JST) Received: from mta03.idc.renesas.com (localhost [127.0.0.1]) by mta03.idc.renesas.com with ESMTP id n2O97Vjx013639; Tue, 24 Mar 2009 18:07:31 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KH0000TB6OISD@ims05.idc.renesas.com>; Tue, 24 Mar 2009 18:07:31 +0900 (JST) Date: Tue, 24 Mar 2009 10:43:56 +0900 From: Kuninori Morimoto Subject: [PATCH v3] 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 --- v2 -> v3 o use edgectrl.strength for judge Sorry for my miss-understanding. This patch use edgectrl.strength for judgement. And the explain in the comment has all. My datasheet doesn't have details more than this explain. drivers/media/video/ov772x.c | 25 +++++++++++++++++++++++++ include/media/ov772x.h | 21 +++++++++++++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c index 34c9819..3226c43 100644 --- a/drivers/media/video/ov772x.c +++ b/drivers/media/video/ov772x.c @@ -816,6 +816,31 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 width, u32 height, ov772x_reset(priv->client); /* + * set Edge Ctrl + */ + if (priv->info->edgectrl.strength) { + ret = ov772x_mask_set(priv->client, EDGE0, 0x1F, + priv->info->edgectrl.strength); + if (ret < 0) + goto ov772x_set_fmt_error; + + ret = ov772x_mask_set(priv->client, EDGE1, 0x0F, + priv->info->edgectrl.threshold); + if (ret < 0) + goto ov772x_set_fmt_error; + + ret = ov772x_mask_set(priv->client, EDGE2, 0xFF, + priv->info->edgectrl.upper); + if (ret < 0) + goto ov772x_set_fmt_error; + + ret = ov772x_mask_set(priv->client, EDGE3, 0xFF, + priv->info->edgectrl.lower); + 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..cfdd80e 100644 --- a/include/media/ov772x.h +++ b/include/media/ov772x.h @@ -17,10 +17,31 @@ #define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ #define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ +/* + * for Edge ctrl + */ +struct ov772x_edge_ctrl { + unsigned char strength; /* strength control */ + unsigned char threshold; /* threshold detection */ + unsigned char upper; /* strength upper limit */ + unsigned char lower; /* strength lower limit */ +}; + +#define OV772X_EDGECTRL(s, t, u, l) \ + {.strength = (s & 0x1F),\ + .threshold = (t & 0x0F),\ + .upper = (u & 0xFF),\ + .lower = (l & 0xFF),\ + } + +/* + * ov772x camera info + */ struct ov772x_camera_info { unsigned long buswidth; unsigned long flags; struct soc_camera_link link; + struct ov772x_edge_ctrl edgectrl; }; #endif /* __OV772X_H__ */