Hi André, On Mon, Dec 16, 2024 at 10:00:47PM +0100, André Apitzsch via B4 Relay wrote: > @@ -604,34 +568,23 @@ static int imx214_set_format(struct v4l2_subdev *sd, > struct v4l2_rect *__crop; > const struct imx214_mode *mode; > > - mutex_lock(&imx214->mutex); > - > - __crop = __imx214_get_pad_crop(imx214, sd_state, format->pad, > - format->which); > - > mode = v4l2_find_nearest_size(imx214_modes, > ARRAY_SIZE(imx214_modes), width, height, > format->format.width, > format->format.height); > > - __crop->width = mode->width; > - __crop->height = mode->height; > + imx214_update_pad_format(imx214, mode, &format->format, > + format->format.code); > + __format = v4l2_subdev_state_get_format(sd_state, 0); > > - __format = __imx214_get_pad_format(imx214, sd_state, format->pad, > - format->which); > - __format->width = __crop->width; > - __format->height = __crop->height; > - __format->code = IMX214_MBUS_CODE; > - __format->field = V4L2_FIELD_NONE; > - __format->colorspace = V4L2_COLORSPACE_SRGB; > - __format->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(__format->colorspace); > - __format->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true, > - __format->colorspace, __format->ycbcr_enc); > - __format->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(__format->colorspace); > + *__format = format->format; > > - format->format = *__format; > + __crop = v4l2_subdev_state_get_crop(sd_state, 0); > + __crop->width = mode->width; > + __crop->height = mode->height; > > - mutex_unlock(&imx214->mutex); > + if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) > + imx214->cur_mode = mode; While the patch is a major improvement as of now, it'd be nice to get rid of the cur_mode field. Could you instead obtai nthe mode using v4l2_find_nearest_size()? I'm fine with changing this in a new patch on top of the set. -- Regards, Sakari Ailus