[PATCH V10 2/2] media: i2c: ov02a10: Add OV02A10 image sensor driver

Tomasz Figa tfiga at chromium.org
Mon Jun 22 11:23:50 EDT 2020


On Sat, Jun 20, 2020 at 03:48:04PM +0800, Dongchun Zhu wrote:
> Hi Tomasz,
> 
> Thanks for the review.
> 
> On Thu, 2020-06-18 at 19:10 +0000, Tomasz Figa wrote:
> > Hi Dongchun,
> > 
> > On Mon, Jun 15, 2020 at 08:29:37PM +0800, Dongchun Zhu wrote:
> > > Add a V4L2 sub-device driver for OV02A10 image sensor.
> > > 
> > > Signed-off-by: Dongchun Zhu <dongchun.zhu at mediatek.com>
> > > ---
> > >  MAINTAINERS                 |    1 +
> > >  drivers/media/i2c/Kconfig   |   13 +
> > >  drivers/media/i2c/Makefile  |    1 +
> > >  drivers/media/i2c/ov02a10.c | 1042 +++++++++++++++++++++++++++++++++++++++++++
> > >  4 files changed, 1057 insertions(+)
> > >  create mode 100644 drivers/media/i2c/ov02a10.c
> > > 
> > 
> > Thank you for the patch. Please see my comments inline.
> > 
> > [snip]
> > > +static int ov02a10_set_fmt(struct v4l2_subdev *sd,
> > > +			   struct v4l2_subdev_pad_config *cfg,
> > > +			   struct v4l2_subdev_format *fmt)
> > > +{
> > > +	struct ov02a10 *ov02a10 = to_ov02a10(sd);
> > > +	struct v4l2_mbus_framefmt *mbus_fmt = &fmt->format;
> > > +
> > > +	mutex_lock(&ov02a10->mutex);
> > > +
> > > +	if (ov02a10->streaming) {
> > > +		mutex_unlock(&ov02a10->mutex);
> > > +		return -EBUSY;
> > > +	}
> > > +
> > > +	/* Only one sensor mode supported */
> > > +	mbus_fmt->code = ov02a10->fmt.code;
> > > +	ov02a10_fill_fmt(ov02a10->cur_mode, mbus_fmt);
> > > +	ov02a10->fmt = fmt->format;
> > > +
> > > +	if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
> > > +		*v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format;
> > 
> > If fmt->which is V4L2_SUBDEV_FORMAT_TRY, the internal driver state must not
> > be affected. It also should not depend on whether the sensor is streaming
> > or not. Basically it should be considered a special "candidate" format,
> > which isn't programmed to the hardware, but just stored aside.
> > 
> 
> Hmm. Maybe we shall use FORMAT_TRY like this:
> struct v4l2_mbus_framefmt *frame_fmt;
> ...
> if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
> 	frame_fmt = v4l2_subdev_get_try_format(sd, cfg, 0);
> else
> 	frame_fmt = &ov02a10->fmt;
> 
> *frame_fmt = *mbus_fmt;
> 
> (Remove 'ov02a10->fmt = fmt->format;' above)
>

Yes, I guess that should work. Also the ov02a10->streaming condition
shouldn't be checked if fmt->which is V4L2_SUBDEV_FORMAT_TRY).

Best regards,
Tomasz



More information about the Linux-mediatek mailing list