From patchwork Tue Mar 8 00:49:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aguirre Rodriguez, Sergio Alberto" X-Patchwork-Id: 6031 Return-path: Envelope-to: mchehab@pedra Delivery-date: Tue, 08 Mar 2011 07:29:05 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1PwuA5-00062i-15 for mchehab@pedra; Tue, 08 Mar 2011 07:29:05 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Tue, 08 Mar 2011 07:29:05 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Pwl7o-0002Ay-MU; Tue, 08 Mar 2011 00:50:09 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756852Ab1CHAty (ORCPT + 1 other); Mon, 7 Mar 2011 19:49:54 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:56353 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756695Ab1CHAtx (ORCPT ); Mon, 7 Mar 2011 19:49:53 -0500 Received: from dlep35.itg.ti.com ([157.170.170.118]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id p280npTt021362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 7 Mar 2011 18:49:51 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id p280npg0019849; Mon, 7 Mar 2011 18:49:51 -0600 (CST) Received: from localhost (x0091359-ubuntu-3.am.dhcp.ti.com [10.247.18.164]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id p280npf28389; Mon, 7 Mar 2011 18:49:51 -0600 (CST) From: Sergio Aguirre To: g.liakhovetski@gmx.de Cc: linux-media@vger.kernel.org, Sergio Aguirre Subject: [PATCH] v4l: soc-camera: Store negotiated buffer settings Date: Mon, 7 Mar 2011 18:49:48 -0600 Message-Id: <1299545388-717-1-git-send-email-saaguirre@ti.com> X-Mailer: git-send-email 1.7.1 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: This fixes the problem in which a host driver sets a personalized sizeimage or bytesperline field, and gets ignored when doing G_FMT. Signed-off-by: Sergio Aguirre --- drivers/media/video/soc_camera.c | 9 ++++----- include/media/soc_camera.h | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index a66811b..59dc71d 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -363,6 +363,8 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, icd->user_width = pix->width; icd->user_height = pix->height; icd->colorspace = pix->colorspace; + icd->bytesperline = pix->bytesperline; + icd->sizeimage = pix->sizeimage; icd->vb_vidq.field = icd->field = pix->field; @@ -608,12 +610,9 @@ static int soc_camera_g_fmt_vid_cap(struct file *file, void *priv, pix->height = icd->user_height; pix->field = icd->vb_vidq.field; pix->pixelformat = icd->current_fmt->host_fmt->fourcc; - pix->bytesperline = soc_mbus_bytes_per_line(pix->width, - icd->current_fmt->host_fmt); + pix->bytesperline = icd->bytesperline; pix->colorspace = icd->colorspace; - if (pix->bytesperline < 0) - return pix->bytesperline; - pix->sizeimage = pix->height * pix->bytesperline; + pix->sizeimage = icd->sizeimage; dev_dbg(&icd->dev, "current_fmt->fourcc: 0x%08x\n", icd->current_fmt->host_fmt->fourcc); return 0; diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 9386db8..de81370 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -30,6 +30,8 @@ struct soc_camera_device { s32 user_width; s32 user_height; enum v4l2_colorspace colorspace; + __u32 bytesperline; /* for padding, zero if unused */ + __u32 sizeimage; unsigned char iface; /* Host number */ unsigned char devnum; /* Device number per host */ struct soc_camera_sense *sense; /* See comment in struct definition */