summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/ov772x.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-03-13 10:08:20 +0100
committerGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-03-13 10:08:20 +0100
commitada365c021ff668eae8fa17042a39d33a4cdf4e1 (patch)
treef05e3e54edf9e37b36f2eeebde3ca19b84c0fd43 /linux/drivers/media/video/ov772x.c
parent7787613f5c5a3a00ebd6aca9893ef2c4ad679bc1 (diff)
downloadmediapointer-dvb-s2-ada365c021ff668eae8fa17042a39d33a4cdf4e1.tar.gz
mediapointer-dvb-s2-ada365c021ff668eae8fa17042a39d33a4cdf4e1.tar.bz2
soc-camera: separate S_FMT and S_CROP operations
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de> As host and camera drivers become more complex, differences between S_FMT and S_CROP functionality grow, this patch separates them. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> --- drivers/media/video/mt9m001.c | 19 +++- drivers/media/video/mt9m111.c | 56 +++++++--- drivers/media/video/mt9t031.c | 84 ++++++++++------ drivers/media/video/mt9v022.c | 62 +++++++---- drivers/media/video/mx3_camera.c | 157 +++++++++++++++++----------- drivers/media/video/ov772x.c | 31 +++++- drivers/media/video/pxa_camera.c | 67 +++++++++--- drivers/media/video/sh_mobile_ceu_camera.c | 17 ++- drivers/media/video/soc_camera.c | 20 ++-- drivers/media/video/soc_camera_platform.c | 9 ++- drivers/media/video/tw9910.c | 45 +++++--- include/media/soc_camera.h | 6 +- 12 files changed, 381 insertions(+), 192 deletions(-)
Diffstat (limited to 'linux/drivers/media/video/ov772x.c')
-rw-r--r--linux/drivers/media/video/ov772x.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/linux/drivers/media/video/ov772x.c b/linux/drivers/media/video/ov772x.c
index 2f3313524..73d447247 100644
--- a/linux/drivers/media/video/ov772x.c
+++ b/linux/drivers/media/video/ov772x.c
@@ -781,11 +781,9 @@ ov772x_select_win(u32 width, u32 height)
return win;
}
-static int ov772x_set_fmt(struct soc_camera_device *icd,
- __u32 pixfmt,
- struct v4l2_rect *rect)
+static int ov772x_set_params(struct ov772x_priv *priv, u32 width, u32 height,
+ u32 pixfmt)
{
- struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
int ret = -EINVAL;
u8 val;
int i;
@@ -806,7 +804,7 @@ static int ov772x_set_fmt(struct soc_camera_device *icd,
/*
* select win
*/
- priv->win = ov772x_select_win(rect->width, rect->height);
+ priv->win = ov772x_select_win(width, height);
/*
* reset hardware
@@ -870,6 +868,28 @@ ov772x_set_fmt_error:
return ret;
}
+static int ov772x_set_crop(struct soc_camera_device *icd,
+ struct v4l2_rect *rect)
+{
+ struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
+
+ if (!priv->fmt)
+ return -EINVAL;
+
+ return ov772x_set_params(priv, rect->width, rect->height,
+ priv->fmt->fourcc);
+}
+
+static int ov772x_set_fmt(struct soc_camera_device *icd,
+ struct v4l2_format *f)
+{
+ struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
+ struct v4l2_pix_format *pix = &f->fmt.pix;
+
+ return ov772x_set_params(priv, pix->width, pix->height,
+ pix->pixelformat);
+}
+
static int ov772x_try_fmt(struct soc_camera_device *icd,
struct v4l2_format *f)
{
@@ -959,6 +979,7 @@ static struct soc_camera_ops ov772x_ops = {
.release = ov772x_release,
.start_capture = ov772x_start_capture,
.stop_capture = ov772x_stop_capture,
+ .set_crop = ov772x_set_crop,
.set_fmt = ov772x_set_fmt,
.try_fmt = ov772x_try_fmt,
.set_bus_param = ov772x_set_bus_param,