aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ov772x.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-03-13 05:08:20 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:21 -0400
commit09e231b35173313cd92e27532e5028f2042dcee4 (patch)
tree3ecda063aa52f954d2f797921bdce131d7f1cc28 /drivers/media/video/ov772x.c
parent1cd3c0fa927084549005fc22e54d99684b314f14 (diff)
V4L/DVB (11024): soc-camera: separate S_FMT and S_CROP operations
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> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ov772x.c')
-rw-r--r--drivers/media/video/ov772x.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 880e51f0e9fd..8dd93b36c787 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -781,11 +781,9 @@ ov772x_select_win(u32 width, u32 height)
781 return win; 781 return win;
782} 782}
783 783
784static int ov772x_set_fmt(struct soc_camera_device *icd, 784static int ov772x_set_params(struct ov772x_priv *priv, u32 width, u32 height,
785 __u32 pixfmt, 785 u32 pixfmt)
786 struct v4l2_rect *rect)
787{ 786{
788 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
789 int ret = -EINVAL; 787 int ret = -EINVAL;
790 u8 val; 788 u8 val;
791 int i; 789 int i;
@@ -806,7 +804,7 @@ static int ov772x_set_fmt(struct soc_camera_device *icd,
806 /* 804 /*
807 * select win 805 * select win
808 */ 806 */
809 priv->win = ov772x_select_win(rect->width, rect->height); 807 priv->win = ov772x_select_win(width, height);
810 808
811 /* 809 /*
812 * reset hardware 810 * reset hardware
@@ -870,6 +868,28 @@ ov772x_set_fmt_error:
870 return ret; 868 return ret;
871} 869}
872 870
871static int ov772x_set_crop(struct soc_camera_device *icd,
872 struct v4l2_rect *rect)
873{
874 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
875
876 if (!priv->fmt)
877 return -EINVAL;
878
879 return ov772x_set_params(priv, rect->width, rect->height,
880 priv->fmt->fourcc);
881}
882
883static int ov772x_set_fmt(struct soc_camera_device *icd,
884 struct v4l2_format *f)
885{
886 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
887 struct v4l2_pix_format *pix = &f->fmt.pix;
888
889 return ov772x_set_params(priv, pix->width, pix->height,
890 pix->pixelformat);
891}
892
873static int ov772x_try_fmt(struct soc_camera_device *icd, 893static int ov772x_try_fmt(struct soc_camera_device *icd,
874 struct v4l2_format *f) 894 struct v4l2_format *f)
875{ 895{
@@ -959,6 +979,7 @@ static struct soc_camera_ops ov772x_ops = {
959 .release = ov772x_release, 979 .release = ov772x_release,
960 .start_capture = ov772x_start_capture, 980 .start_capture = ov772x_start_capture,
961 .stop_capture = ov772x_stop_capture, 981 .stop_capture = ov772x_stop_capture,
982 .set_crop = ov772x_set_crop,
962 .set_fmt = ov772x_set_fmt, 983 .set_fmt = ov772x_set_fmt,
963 .try_fmt = ov772x_try_fmt, 984 .try_fmt = ov772x_try_fmt,
964 .set_bus_param = ov772x_set_bus_param, 985 .set_bus_param = ov772x_set_bus_param,