On Mon, May 29, 2023 at 1:38 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote: > > Having an init_cfg to initialize the passed in subdev-state is > important to make which == V4L2_SUBDEV_FORMAT_TRY ops work when > userspace is talking to a /dev/v4l2-subdev# node. > > Copy the ov2680_init_cfg() from the standard drivers/media/i2c/ov2680.c > driver. > > This is esp. relevant once support for cropping is added where > the v4l2_subdev_state.pads[pad].try_crop rectangle needs to be set > correctly for set_fmt which == V4L2_SUBDEV_FORMAT_TRY calls to work. ... > +static int ov2680_init_cfg(struct v4l2_subdev *sd, > + struct v4l2_subdev_state *sd_state) > +{ > + struct v4l2_subdev_format fmt = { > + .which = sd_state ? V4L2_SUBDEV_FORMAT_TRY > + : V4L2_SUBDEV_FORMAT_ACTIVE, > + .format = { > + .width = 800, > + .height = 600, > + } I would keep a trailing comma here. > + }; > + > + return ov2680_set_fmt(sd, sd_state, &fmt); > +} -- With Best Regards, Andy Shevchenko