Hi Jacopo, On Wed, Feb 23, 2022 at 03:55:54PM +0100, Jacopo Mondi wrote: > Implement the init_cfg pad operation to initialize the subdev state > format to the default one. > > Signed-off-by: Jacopo Mondi <jacopo@xxxxxxxxxx> > Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > --- > drivers/media/i2c/ov5640.c | 34 ++++++++++++++++++++++++---------- > 1 file changed, 24 insertions(+), 10 deletions(-) > > diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c > index 6c2c76b61140..c1fc2ab1e0cf 100644 > --- a/drivers/media/i2c/ov5640.c > +++ b/drivers/media/i2c/ov5640.c > @@ -408,6 +408,18 @@ static inline bool ov5640_is_csi2(const struct ov5640_dev *sensor) > * over i2c. > */ > /* YUV422 UYVY VGA@30fps */ > + > +static const struct v4l2_mbus_framefmt ov5640_default_fmt = { > + .code = MEDIA_BUS_FMT_UYVY8_2X8, > + .width = 640, > + .height = 480, > + .colorspace = V4L2_COLORSPACE_SRGB, > + .ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(V4L2_COLORSPACE_SRGB), > + .quantization = V4L2_QUANTIZATION_FULL_RANGE, > + .xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(V4L2_COLORSPACE_SRGB), > + .field = V4L2_FIELD_NONE, > +}; > + > static const struct reg_value ov5640_init_setting[] = { > {0x3103, 0x11, 0, 0}, {0x3008, 0x82, 0, 5}, {0x3008, 0x42, 0, 0}, > {0x3103, 0x03, 0, 0}, {0x3630, 0x36, 0, 0}, > @@ -3515,6 +3527,16 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable) > return ret; > } > > +static int ov5640_init_cfg(struct v4l2_subdev *sd, > + struct v4l2_subdev_state *state) > +{ > + struct v4l2_mbus_framefmt *fmt = v4l2_subdev_get_try_format(sd, state, 0); Could you run $ ./scripts/checkpatch.pl --strict --max-line-length=80 on the entire set, and see what else is trivial to fix? > + > + *fmt = ov5640_default_fmt; > + > + return 0; > +} > + > static const struct v4l2_subdev_core_ops ov5640_core_ops = { > .s_power = ov5640_s_power, > .log_status = v4l2_ctrl_subdev_log_status, -- Regards, Sakari Ailus