Skip to contentSkip to conversation

ov772x: add edge contrl support

PATCH Superseded Kuninori Morimoto 2 participants 2 messages Mar 23, 2009 Media (V4L/DVB)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ov772x: add edge contrl support

---
I used flags to judge though
I said I use edge_threshold un-used 4 bit.

v1 -> v2
o add struct ov772x_edge_ctrl
o add new flags

 drivers/media/video/ov772x.c |   31 +++++++++++++++++++++++++++++++
 include/media/ov772x.h       |   26 +++++++++++++++++++++++---
 2 files changed, 54 insertions(+), 3 deletions(-)
drivers/media/video/ov772x.c +31 -0
index 34c9819..ae832e6 100644
@@ -816,6 +816,37 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 width, u32 height,
 	ov772x_reset(priv->client);
 
 	/*
+	 * set Edge Ctrl
+	 */
+	if (priv->info->flags & OV772X_FLAG_EDGE_STRENGTH) {
+		ret = ov772x_mask_set(priv->client, EDGE0, 0x1F,
+				      priv->info->edgectrl.strength);
+		if (ret < 0)
+			goto ov772x_set_fmt_error;
+	}
+
+	if (priv->info->flags & OV772X_FLAG_EDGE_THRESHOLD) {
+		ret = ov772x_mask_set(priv->client, EDGE1, 0x0F,
+				      priv->info->edgectrl.threshold);
+		if (ret < 0)
+			goto ov772x_set_fmt_error;
+	}
+
+	if (priv->info->flags & OV772X_FLAG_EDGE_LOW) {
+		ret = ov772x_mask_set(priv->client, EDGE2, 0xFF,
+				      priv->info->edgectrl.low);
+		if (ret < 0)
+			goto ov772x_set_fmt_error;
+	}
+
+	if (priv->info->flags & OV772X_FLAG_EDGE_HIGH) {
+		ret = ov772x_mask_set(priv->client, EDGE3, 0xFF,
+				      priv->info->edgectrl.high);
+		if (ret < 0)
+			goto ov772x_set_fmt_error;
+	}
+
+	/*
 	 * set size format
 	 */
 	ret = ov772x_write_array(priv->client, priv->win->regs);
include/media/ov772x.h +23 -3
index 57db48d..c5051c7 100644
@@ -13,14 +13,34 @@
 
 #include <media/soc_camera.h>
 
-/* for flags */
-#define OV772X_FLAG_VFLIP     0x00000001 /* Vertical flip image */
-#define OV772X_FLAG_HFLIP     0x00000002 /* Horizontal flip image */
+/*
+ * for flags
+ */
+#define OV772X_FLAG_VFLIP		(1 << 0) /* Vertical flip image */
+#define OV772X_FLAG_HFLIP		(1 << 1) /* Horizontal flip image */
+#define OV772X_FLAG_EDGE_STRENGTH	(1 << 2) /* Edge Ctrl strength */
+#define OV772X_FLAG_EDGE_THRESHOLD	(1 << 3) /* Edge ctrl threshold */
+#define OV772X_FLAG_EDGE_LOW		(1 << 4) /* Edge ctrl low */
+#define OV772X_FLAG_EDGE_HIGH		(1 << 5) /* Edge ctrl high */
 
+/*
+ * for Edge ctrl
+ */
+struct ov772x_edge_ctrl {
+	unsigned char strength;  /* strength control */
+	unsigned char threshold; /* threshold control */
+	unsigned char low;       /* strength Low point control */
+	unsigned char high;      /* strength High point control */
+};
+
+/*
+ * 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__ */
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 41 lines · Kuninori Morimoto

---
I used flags to judge though
I said I use edge_threshold un-used 4 bit.

v1 -> v2
o add struct ov772x_edge_ctrl
o add new flags

 drivers/media/video/ov772x.c |   31 +++++++++++++++++++++++++++++++
 include/media/ov772x.h       |   26 +++++++++++++++++++++++---
 2 files changed, 54 insertions(+), 3 deletions(-)
drivers/media/video/ov772x.c +19 -0
index 34c9819..ae832e6 100644
@@ -816,6 +816,37 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 width, u32 height,
 	ov772x_reset(priv->client);
 
 	/*
+	 * set Edge Ctrl
+	 */
+	if (priv->info->flags & OV772X_FLAG_EDGE_STRENGTH) {
+		ret = ov772x_mask_set(priv->client, EDGE0, 0x1F,
+				      priv->info->edgectrl.strength);
+		if (ret < 0)
+			goto ov772x_set_fmt_error;
+	}
+
+	if (priv->info->flags & OV772X_FLAG_EDGE_THRESHOLD) {
+		ret = ov772x_mask_set(priv->client, EDGE1, 0x0F,
+				      priv->info->edgectrl.threshold);
+		if (ret < 0)
+			goto ov772x_set_fmt_error;
+	}
+
+	if (priv->info->flags & OV772X_FLAG_EDGE_LOW) {
+		ret = ov772x_mask_set(priv->client, EDGE2, 0xFF,
+				      priv->info->edgectrl.low);

drivers/media/video/ov772x.c static int ov772x_set_params(struct ov772x_priv *priv, u32 width, u32 height, · line 847

Quoted 10 lines
drivers/media/video/ov772x.c +10 -0
+		if (ret < 0)
+			goto ov772x_set_fmt_error;
+	}
+
+	if (priv->info->flags & OV772X_FLAG_EDGE_HIGH) {
+		ret = ov772x_mask_set(priv->client, EDGE3, 0xFF,
+				      priv->info->edgectrl.high);
+		if (ret < 0)
+			goto ov772x_set_fmt_error;
+	}

No idea, does it really make sense to set low edge without setting high? or to set threshold without strength?

Quoted 19 lines
drivers/media/video/ov772x.c +2 -0
+
+	/*
 	 * set size format
 	 */
 	ret = ov772x_write_array(priv->client, priv->win->regs);
include/media/ov772x.h +3 -3
index 57db48d..c5051c7 100644
@@ -13,14 +13,34 @@
 
 #include <media/soc_camera.h>
 
-/* for flags */
-#define OV772X_FLAG_VFLIP     0x00000001 /* Vertical flip image */
-#define OV772X_FLAG_HFLIP     0x00000002 /* Horizontal flip image */
+/*
+ * for flags
+ */

include/media/ov772x.h line 28

Quoted 10 lines
include/media/ov772x.h +9 -0
+#define OV772X_FLAG_VFLIP		(1 << 0) /* Vertical flip image */
+#define OV772X_FLAG_HFLIP		(1 << 1) /* Horizontal flip image */
+#define OV772X_FLAG_EDGE_STRENGTH	(1 << 2) /* Edge Ctrl strength */
+#define OV772X_FLAG_EDGE_THRESHOLD	(1 << 3) /* Edge ctrl threshold */
+#define OV772X_FLAG_EDGE_LOW		(1 << 4) /* Edge ctrl low */
+#define OV772X_FLAG_EDGE_HIGH		(1 << 5) /* Edge ctrl high */
 
+/*
+ * for Edge ctrl
+ */

Please, explain in the comment what this edge controls are good for, at least approximately, so people without the datasheet have a chance to understand what's going on here.

Quoted 21 lines
include/media/ov772x.h +11 -0
+struct ov772x_edge_ctrl {
+	unsigned char strength;  /* strength control */
+	unsigned char threshold; /* threshold control */
+	unsigned char low;       /* strength Low point control */
+	unsigned char high;      /* strength High point control */
+};
+
+/*
+ * 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__ */
Signature · 1 line
1.5.6.3

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer