Skip to content

Commit

Permalink
[media] mx2_camera: Use soc_mbus_image_size() instead of manual compu…
Browse files Browse the repository at this point in the history
…tation

Use the new soc_mbus_image_size() function to compute the image size.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed May 15, 2012
1 parent bed8d80 commit b0a461f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/media/video/mx2_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,8 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
xlate->host_fmt);
if (pix->bytesperline < 0)
return pix->bytesperline;
pix->sizeimage = pix->height * pix->bytesperline;
pix->sizeimage = soc_mbus_image_size(xlate->host_fmt,
pix->bytesperline, pix->height);
/* Check against the CSIRXCNT limit */
if (pix->sizeimage > 4 * 0x3ffff) {
/* Adjust geometry, preserve aspect ratio */
Expand All @@ -1406,7 +1407,8 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
pix->bytesperline = soc_mbus_bytes_per_line(pix->width,
xlate->host_fmt);
BUG_ON(pix->bytesperline < 0);
pix->sizeimage = pix->height * pix->bytesperline;
pix->sizeimage = soc_mbus_image_size(xlate->host_fmt,
pix->bytesperline, pix->height);
}
}

Expand Down

0 comments on commit b0a461f

Please sign in to comment.