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);
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;
}
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,