v4l: mx3_camera.c: correct 'sizeimage' value reporting

Message ID 1296478681-11119-1-git-send-email-agust@denx.de (mailing list archive)
State Superseded, archived
Headers

Commit Message

Anatolij Gustschin Jan. 31, 2011, 12:58 p.m. UTC
  The 'pix->width' field may be updated in mx3_camera_set_fmt() to
fulfill the IPU stride line alignment requirements. If this update
takes place, the 'fmt.pix.sizeimage' field in the struct v4l2_format
stucture returned by VIDIOC_S_FMT is wrong. We need to update the
'pix->sizeimage' field in the mx3_camera_set_fmt() function to fix
this issue.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/media/video/mx3_camera.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
  

Patch

diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c
index 7bcaaf7..6b0b25d 100644
--- a/drivers/media/video/mx3_camera.c
+++ b/drivers/media/video/mx3_camera.c
@@ -918,6 +918,12 @@  static int mx3_camera_set_fmt(struct soc_camera_device *icd,
 	pix->colorspace		= mf.colorspace;
 	icd->current_fmt	= xlate;
 
+	pix->bytesperline = soc_mbus_bytes_per_line(pix->width,
+						    xlate->host_fmt);
+	if (pix->bytesperline < 0)
+		return pix->bytesperline;
+	pix->sizeimage = pix->height * pix->bytesperline;
+
 	dev_dbg(icd->dev.parent, "Sensor set %dx%d\n", pix->width, pix->height);
 
 	return ret;