Re: [PATCH v2 1/3] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2019年1月11日(金) 0:28 Akinobu Mita <akinobu.mita@xxxxxxxxx>:
</akinobu.mita@xxxxxxxxx>
>
> The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize
> V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE
> is specified.
>
> Cc: Enrico Scholz <enrico.scholz@xxxxxxxxxxxxxxxxx>
> Cc: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
> Cc: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
> Cc: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
> Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
> ---
> * v2
> - Use format->pad for the argument of v4l2_subdev_get_try_format().
>
>  drivers/media/i2c/mt9m111.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>
> diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
> index d639b9b..eb5bf71 100644
> --- a/drivers/media/i2c/mt9m111.c
> +++ b/drivers/media/i2c/mt9m111.c
> @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd,
>         if (format->pad)
>                 return -EINVAL;
>
> +       if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
> +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
> +               mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
> +               format->format = *mf;
> +               return 0;
> +#else
> +               return -ENOTTY;
> +#endif
> +       }
> +
>         mf->width       = mt9m111->width;
>         mf->height      = mt9m111->height;
>         mf->code        = mt9m111->fmt->code;
> @@ -1089,6 +1099,26 @@ static int mt9m111_s_stream(struct v4l2_subdev *sd, int enable)
>         return 0;
>  }
>
> +static int mt9m111_init_cfg(struct v4l2_subdev *sd,
> +                           struct v4l2_subdev_pad_config *cfg)
> +{
> +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
> +       struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev);
> +       struct v4l2_mbus_framefmt *format =
> +               v4l2_subdev_get_try_format(sd, cfg, 0);
> +
> +       format->width   = mt9m111->width;
> +       format->height  = mt9m111->height;
> +       format->code    = mt9m111->fmt->code;
> +       format->colorspace      = mt9m111->fmt->colorspace;

Oops, I made the same mistake that I did for mt9m001 driver.
This should be the default configuration instead of current one.




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux