Commit 06daa1af authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

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: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ccab8a29
...@@ -1215,6 +1215,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, ...@@ -1215,6 +1215,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
const struct soc_camera_format_xlate *xlate; const struct soc_camera_format_xlate *xlate;
struct v4l2_pix_format *pix = &f->fmt.pix; struct v4l2_pix_format *pix = &f->fmt.pix;
__u32 pixfmt = pix->pixelformat; __u32 pixfmt = pix->pixelformat;
enum v4l2_field field;
int ret; int ret;
xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
...@@ -1244,6 +1245,15 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, ...@@ -1244,6 +1245,15 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
ret = icd->ops->try_fmt(icd, f); ret = icd->ops->try_fmt(icd, f);
pix->pixelformat = xlate->host_fmt->fourcc; 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; return ret;
} }
......
...@@ -98,28 +98,11 @@ static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, ...@@ -98,28 +98,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_file *icf = file->private_data;
struct soc_camera_device *icd = icf->icd; struct soc_camera_device *icd = icf->icd;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
enum v4l2_field field;
int ret;
WARN_ON(priv != file->private_data); 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 */ /* limit format to hardware capabilities */
ret = ici->ops->try_fmt(icd, f); return ici->ops->try_fmt(icd, f);
return ret;
} }
static int soc_camera_enum_input(struct file *file, void *priv, static int soc_camera_enum_input(struct file *file, void *priv,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment