Setting the format on the sink pad of the binner or the scaler only updated the crop and compose rectangles of the sub-device and its source pad, the format itself was never stored in the sub-device state. Reading the format back returned the one set up by ccs_init_state(), i.e. the size of the pixel array, and the selection rectangles, which depend on the size of the sink pad format, were bounded by it. Link validation then fails with -EPIPE for any readout mode that does not output the full pixel array: the scaler's sink pad format is the pixel array size whereas the binner's source pad format is the binned size, and there is no way to make the two match from user space since setting the sink format has no effect. Before the sub-device active state was used, the active sink format was stored in struct ccs_subdev (sink_fmt) in ccs_set_format(). The switch to the sub-device state dropped storing it. Store it in the state again. Fixes: d8bca3ed1d70 ("media: ccs: Use sub-device active state") Cc: stable@vger.kernel.org Signed-off-by: Gianluca Boiano --- drivers/media/i2c/ccs/ccs-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index 1cc435085..a4af27de5 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -2275,6 +2275,9 @@ static int ccs_set_format(struct v4l2_subdev *subdev, CCS_LIM(sensor, MIN_Y_OUTPUT_SIZE), CCS_LIM(sensor, MAX_Y_OUTPUT_SIZE)); + *v4l2_subdev_state_get_format(sd_state, ssd->sink_pad, + CCS_STREAM_PIXEL) = fmt->format; + crop = v4l2_subdev_state_get_crop(sd_state, ssd->sink_pad, CCS_STREAM_PIXEL); -- 2.56.1