From patchwork Mon Apr 11 08:58:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 697761 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3B8wU2b021914 for ; Mon, 11 Apr 2011 08:58:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752732Ab1DKI62 (ORCPT ); Mon, 11 Apr 2011 04:58:28 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:65042 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752471Ab1DKI62 (ORCPT ); Mon, 11 Apr 2011 04:58:28 -0400 Received: from axis700.grange (pD9EB92DC.dip0.t-ipconnect.de [217.235.146.220]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MHci0-1QCWL83804-003OCB; Mon, 11 Apr 2011 10:58:26 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 4162A189B86; Mon, 11 Apr 2011 10:58:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 3BFE0189B85; Mon, 11 Apr 2011 10:58:26 +0200 (CEST) Date: Mon, 11 Apr 2011 10:58:26 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Linux Media Mailing List cc: Janusz Krzysztofik , Sergio Aguirre Subject: [PATCH] V4L: soc-camera: regression fix: calculate .sizeimage in soc_camera.c Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:7wBgB8ZXSzS3kdaIQLWxbD5g9tQue6ryeF8xnRkckQE T//Emz7nH+/biLLX8RKmOBKriXc3RR+QnOlDpz8lSyu5d2HDYN MBYleiPICrLsBia0scKnEzGc9BcpEmOmFPLc2xErLuViw69Xa3 /7lWdPF5n9VDDic4PpPxmHcL14o4IvNeKVcYfajKf0TIDjTCTd c01OCttcvlNjDR2SUItxnh+lb3FFhhKpCVLRSSHcOk= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 11 Apr 2011 08:58:30 +0000 (UTC) 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 --- -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;