Re: [V8, 2/2] media: i2c: ov02a10: Add OV02A10 image sensor driver

Dongchun Zhu
2020-05-11T12:08:04Z

Hi Andy,

Thanks for the kindly review.

On Mon, 2020-05-11 at 12:33 +0300, Andy Shevchenko wrote:
> On Sat, May 09, 2020 at 04:06:27PM +0800, Dongchun Zhu wrote:
> > Add a V4L2 sub-device driver for OV02A10 image sensor.
>
> ...
>
> > +#define OV02A10_ID(_msb, _lsb) ((_msb) << 8 | (_lsb))
>
> How often do you use this macro?
>

Just once.
I would try to use the macro function directly in next release.

> ...
>
> > +static int ov02a10_read_smbus(struct ov02a10 *ov02a10, unsigned char reg,
> > + unsigned char *val)
> > +{
> > + struct i2c_client *client = v4l2_get_subdevdata(&ov02a10->subdev);
> > + int ret;
> > +
> > + ret = i2c_smbus_read_byte_data(client, reg);
>
> > +
>
> Extra blank line.
>

Thanks for the carefully reminder.
This error can easily be neglected.
I would remove it in next release.

> > + if (ret < 0)
> > + return ret;
> > +
> > + *val = (unsigned char)ret;
> > +
> > + return 0;
> > +}
>
> ...
>
> > +static int ov02a10_entity_init_cfg(struct v4l2_subdev *sd,
> > + struct v4l2_subdev_pad_config *cfg)
> > +{
> > + struct v4l2_subdev_format fmt = {
>
> > + .which = cfg ? V4L2_SUBDEV_FORMAT_TRY
> > + : V4L2_SUBDEV_FORMAT_ACTIVE,
>
> I think it would be fine to have it on one line.
>

Got it.
Fixed in next release.

> > + .format = {
> > + .width = 1600,
> > + .height = 1200,
> > + }
> > + };
> > +
> > + ov02a10_set_fmt(sd, cfg, &fmt);
> > +
> > + return 0;
> > +}
>
> ...
>
> > + if (!ret) {
> > + if (rotation == 180) {
>
> if (a) {
> if (b) {
> ...
> }
> }
>
> ==
>
> if (a && b) {
> ...
> }
>

Thanks for the reminder :-)
Next release would use:
if (!ret && rotation == 180) {
...
}

> > + ov02a10->upside_down = true;
> > + ov02a10->fmt.code = MEDIA_BUS_FMT_SRGGB10_1X10;
> > + }
> > + }