Re: [PATCH v6 1/2] sta2x11_vip: convert to videobuf2, control framework, file handler

Hans Verkuil
2013-02-04T10:58:22Z

On Wed January 23 2013 15:07:06 Federico Vaga wrote:
> This patch re-write the driver and use the videobuf2
> interface instead of the old videobuf. Moreover, it uses also
> the control framework which allows the driver to inherit
> controls from its subdevice (ADV7180). Finally the driver does not
> implement custom file operation but it uses the generic ones from
> videobuf2 and v4l2_fh
>
> Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
> Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
> ---
> drivers/media/pci/sta2x11/Kconfig | 2 +-
> drivers/media/pci/sta2x11/sta2x11_vip.c | 1071 +++++++++++++------------------
> 2 file modificati, 432 inserzioni(+), 641 rimozioni(-)
>
> @@ -797,12 +601,11 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
> static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
> struct v4l2_format *f)
> {
> - struct video_device *dev = priv;
> - struct sta2x11_vip *vip = video_get_drvdata(dev);
> + struct sta2x11_vip *vip = video_drvdata(file);
> int interlace_lim;
>
> if (V4L2_PIX_FMT_UYVY != f->fmt.pix.pixelformat)
> - return -EINVAL;
> + v4l2_warn(&vip->v4l2_dev, "Invalid format, only UYVY supported\n");

As mentioned in my v4 review, keep the return -EINVAL here. As long as it is
uncertain what try_fmt should do with unsupported pixelformats we shouldn't
change this behavior.

Regards,

Hans

>
> if (V4L2_STD_525_60 & vip->std)
> interlace_lim = 240;
> @@ -810,6 +613,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
> interlace_lim = 288;
>
> switch (f->fmt.pix.field) {
> + default:
> case V4L2_FIELD_ANY:
> if (interlace_lim < f->fmt.pix.height)
> f->fmt.pix.field = V4L2_FIELD_INTERLACED;
> @@ -823,10 +627,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
> break;
> case V4L2_FIELD_INTERLACED:
> break;
> - default:
> - return -EINVAL;
> }
>
> + /* It is the only supported format */
> + f->fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
> f->fmt.pix.height &= ~1;
> if (2 * interlace_lim < f->fmt.pix.height)
> f->fmt.pix.height = 2 * interlace_lim;