A recent patch has given individual soc-camera host drivers a possibility to calculate .sizeimage and .bytesperline pixel format fields internally, however, some drivers relied on the core calculating these values for them, following a default algorithm. This patch restores the default calculation for such drivers. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx> --- diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 4628448..0918c48 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -376,6 +376,9 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, dev_dbg(&icd->dev, "S_FMT(%c%c%c%c, %ux%u)\n", pixfmtstr(pix->pixelformat), pix->width, pix->height); + pix->bytesperline = 0; + pix->sizeimage = 0; + /* We always call try_fmt() before set_fmt() or set_crop() */ ret = ici->ops->try_fmt(icd, f); if (ret < 0) @@ -391,6 +394,17 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, return -EINVAL; } + if (!pix->sizeimage) { + if (!pix->bytesperline) { + ret = soc_mbus_bytes_per_line(pix->width, + icd->current_fmt->host_fmt); + if (ret > 0) + pix->bytesperline = ret; + } + if (pix->bytesperline) + pix->sizeimage = pix->bytesperline * pix->height; + } + icd->user_width = pix->width; icd->user_height = pix->height; icd->bytesperline = pix->bytesperline; -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html