aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-12-18 10:52:08 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:40:26 -0500
commit06daa1af4d207e93c9a8a3e54adef8635ba81c94 (patch)
treeca11a35ceab944222d99926c8ce50e470bb89565 /drivers
parentccab8a29040b4b57a45f2150c9b6e6115ebdbc44 (diff)
V4L/DVB (10090): soc-camera: let drivers decide upon supported field values
sh_mobile_ceu_camera.c is already prepared to support interlaced format, this patch moves the choice of a field type down to host and / or camera drivers. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/pxa_camera.c10
-rw-r--r--drivers/media/video/soc_camera.c19
2 files changed, 11 insertions, 18 deletions
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index c3c50de0aa50..b2d9fe5dfd61 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -1215,6 +1215,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
1215 const struct soc_camera_format_xlate *xlate; 1215 const struct soc_camera_format_xlate *xlate;
1216 struct v4l2_pix_format *pix = &f->fmt.pix; 1216 struct v4l2_pix_format *pix = &f->fmt.pix;
1217 __u32 pixfmt = pix->pixelformat; 1217 __u32 pixfmt = pix->pixelformat;
1218 enum v4l2_field field;
1218 int ret; 1219 int ret;
1219 1220
1220 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); 1221 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
@@ -1244,6 +1245,15 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
1244 ret = icd->ops->try_fmt(icd, f); 1245 ret = icd->ops->try_fmt(icd, f);
1245 pix->pixelformat = xlate->host_fmt->fourcc; 1246 pix->pixelformat = xlate->host_fmt->fourcc;
1246 1247
1248 field = pix->field;
1249
1250 if (field == V4L2_FIELD_ANY) {
1251 pix->field = V4L2_FIELD_NONE;
1252 } else if (field != V4L2_FIELD_NONE) {
1253 dev_err(&icd->dev, "Field type %d unsupported.\n", field);
1254 return -EINVAL;
1255 }
1256
1247 return ret; 1257 return ret;
1248} 1258}
1249 1259
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index e86e6bda1b7f..90077cb4fe66 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -98,28 +98,11 @@ static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv,
98 struct soc_camera_file *icf = file->private_data; 98 struct soc_camera_file *icf = file->private_data;
99 struct soc_camera_device *icd = icf->icd; 99 struct soc_camera_device *icd = icf->icd;
100 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 100 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
101 enum v4l2_field field;
102 int ret;
103 101
104 WARN_ON(priv != file->private_data); 102 WARN_ON(priv != file->private_data);
105 103
106 /*
107 * TODO: this might also have to migrate to host-drivers, if anyone
108 * wishes to support other fields
109 */
110 field = f->fmt.pix.field;
111
112 if (field == V4L2_FIELD_ANY) {
113 f->fmt.pix.field = V4L2_FIELD_NONE;
114 } else if (field != V4L2_FIELD_NONE) {
115 dev_err(&icd->dev, "Field type invalid.\n");
116 return -EINVAL;
117 }
118
119 /* limit format to hardware capabilities */ 104 /* limit format to hardware capabilities */
120 ret = ici->ops->try_fmt(icd, f); 105 return ici->ops->try_fmt(icd, f);
121
122 return ret;
123} 106}
124 107
125static int soc_camera_enum_input(struct file *file, void *priv, 108static int soc_camera_enum_input(struct file *file, void *priv,