diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2008-12-18 16:52:08 +0100 |
---|---|---|
committer | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2008-12-18 16:52:08 +0100 |
commit | 6f64ac25be69891e1d26e499e739acf8bb52a275 (patch) | |
tree | 3b615f384d1a329bf7234cd711bb71795bd1b0c7 /linux/drivers | |
parent | 7c1e3aaa81179bb1423e03962dbdeae2cb9ceef3 (diff) | |
download | mediapointer-dvb-s2-6f64ac25be69891e1d26e499e739acf8bb52a275.tar.gz mediapointer-dvb-s2-6f64ac25be69891e1d26e499e739acf8bb52a275.tar.bz2 |
soc-camera: let drivers decide upon supported field values
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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>
---
drivers/media/video/pxa_camera.c | 10 ++++++++++
drivers/media/video/soc_camera.c | 19 +------------------
2 files changed, 11 insertions(+), 18 deletions(-)
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/video/pxa_camera.c | 10 | ||||
-rw-r--r-- | linux/drivers/media/video/soc_camera.c | 19 |
2 files changed, 11 insertions, 18 deletions
diff --git a/linux/drivers/media/video/pxa_camera.c b/linux/drivers/media/video/pxa_camera.c index 484d474b3..bb151032b 100644 --- a/linux/drivers/media/video/pxa_camera.c +++ b/linux/drivers/media/video/pxa_camera.c @@ -1220,6 +1220,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, const struct soc_camera_format_xlate *xlate; struct v4l2_pix_format *pix = &f->fmt.pix; __u32 pixfmt = pix->pixelformat; + enum v4l2_field field; int ret; xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); @@ -1249,6 +1250,15 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, ret = icd->ops->try_fmt(icd, f); pix->pixelformat = xlate->host_fmt->fourcc; + field = pix->field; + + if (field == V4L2_FIELD_ANY) { + pix->field = V4L2_FIELD_NONE; + } else if (field != V4L2_FIELD_NONE) { + dev_err(&icd->dev, "Field type %d unsupported.\n", field); + return -EINVAL; + } + return ret; } diff --git a/linux/drivers/media/video/soc_camera.c b/linux/drivers/media/video/soc_camera.c index 61a72f5ef..ba28c844f 100644 --- a/linux/drivers/media/video/soc_camera.c +++ b/linux/drivers/media/video/soc_camera.c @@ -99,28 +99,11 @@ static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, struct soc_camera_file *icf = file->private_data; struct soc_camera_device *icd = icf->icd; struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); - enum v4l2_field field; - int ret; WARN_ON(priv != file->private_data); - /* - * TODO: this might also have to migrate to host-drivers, if anyone - * wishes to support other fields - */ - field = f->fmt.pix.field; - - if (field == V4L2_FIELD_ANY) { - f->fmt.pix.field = V4L2_FIELD_NONE; - } else if (field != V4L2_FIELD_NONE) { - dev_err(&icd->dev, "Field type invalid.\n"); - return -EINVAL; - } - /* limit format to hardware capabilities */ - ret = ici->ops->try_fmt(icd, f); - - return ret; + return ici->ops->try_fmt(icd, f); } static int soc_camera_enum_input(struct file *file, void *priv, |