From patchwork Mon Jan 31 12:58:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 5767 Return-path: Envelope-to: mchehab@pedra Delivery-date: Mon, 31 Jan 2011 10:57:42 -0200 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1PjtKA-0006U1-CA for mchehab@pedra; Mon, 31 Jan 2011 10:57:42 -0200 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Mon, 31 Jan 2011 10:57:42 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PjtJh-00069s-NJ; Mon, 31 Jan 2011 12:57:14 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755391Ab1AaM5L (ORCPT + 1 other); Mon, 31 Jan 2011 07:57:11 -0500 Received: from mail-out.m-online.net ([212.18.0.10]:49614 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753736Ab1AaM5L (ORCPT ); Mon, 31 Jan 2011 07:57:11 -0500 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 1F728188A182; Mon, 31 Jan 2011 13:57:10 +0100 (CET) X-Auth-Info: HQVPmNaqpIclEsbDtpz0qSCpRfh0ZTMR827NRvE3tAo= Received: from localhost (p4FE3DF32.dip.t-dialin.net [79.227.223.50]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 5378E1C0010D; Mon, 31 Jan 2011 13:57:10 +0100 (CET) From: Anatolij Gustschin To: linux-media@vger.kernel.org Cc: Guennadi Liakhovetski , Markus Niebel Subject: [PATCH] v4l: mx3_camera.c: correct 'sizeimage' value reporting Date: Mon, 31 Jan 2011 13:58:01 +0100 Message-Id: <1296478681-11119-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: 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 --- drivers/media/video/mx3_camera.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) 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;