From patchwork Wed May 27 16:10:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Towle X-Patchwork-Id: 29873 X-Patchwork-Delegate: g.liakhovetski@gmx.de Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Yxdva-0003nf-Ts; Wed, 27 May 2015 18:11:34 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-6) with esmtp id 1YxdvY-0000ve-49; Wed, 27 May 2015 18:11:33 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752344AbbE0QLR (ORCPT + 1 other); Wed, 27 May 2015 12:11:17 -0400 Received: from 82-70-136-246.dsl.in-addr.zen.co.uk ([82.70.136.246]:52409 "EHLO xk120.dyn.ducie.codethink.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752347AbbE0QLA (ORCPT ); Wed, 27 May 2015 12:11:00 -0400 Received: from william by xk120.dyn.ducie.codethink.co.uk with local (Exim 4.80) (envelope-from ) id 1Yxdv0-0005GV-Pp; Wed, 27 May 2015 17:10:58 +0100 From: William Towle To: linux-media@vger.kernel.org, linux-kernel@lists.codethink.co.uk Cc: Guennadi Liakhovetski , Sergei Shtylyov , Hans Verkuil Subject: [PATCH 11/15] media: soc_camera: soc_scale_crop: Use correct pad when calling subdev try_fmt Date: Wed, 27 May 2015 17:10:49 +0100 Message-Id: <1432743053-13479-12-git-send-email-william.towle@codethink.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1432743053-13479-1-git-send-email-william.towle@codethink.co.uk> References: <1432743053-13479-1-git-send-email-william.towle@codethink.co.uk> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.5.27.160616 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, REFERENCES 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __REFERENCES 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' From: Rob Taylor Fix calls to subdev try_fmt to use correct pad. Fixes failures with subdevs that care about having the right pad number set. Signed-off-by: William Towle Reviewed-by: Rob Taylor --- drivers/media/platform/soc_camera/soc_scale_crop.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/media/platform/soc_camera/soc_scale_crop.c b/drivers/media/platform/soc_camera/soc_scale_crop.c index bda29bc..d2b377f 100644 --- a/drivers/media/platform/soc_camera/soc_scale_crop.c +++ b/drivers/media/platform/soc_camera/soc_scale_crop.c @@ -224,6 +224,12 @@ static int client_set_fmt(struct soc_camera_device *icd, struct v4l2_cropcap cap; bool host_1to1; int ret; +#if defined(CONFIG_MEDIA_CONTROLLER) + struct media_pad *remote_pad; + + remote_pad = media_entity_remote_pad(&icd->vdev->entity.pads[0]); + format->pad = remote_pad->index; +#endif ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd), pad, @@ -261,10 +267,21 @@ static int client_set_fmt(struct soc_camera_device *icd, /* width <= max_width && height <= max_height - guaranteed by try_fmt */ while ((width > tmp_w || height > tmp_h) && tmp_w < max_width && tmp_h < max_height) { +#if defined(CONFIG_MEDIA_CONTROLLER) + struct media_pad *remote_pad; +#endif + tmp_w = min(2 * tmp_w, max_width); tmp_h = min(2 * tmp_h, max_height); mf->width = tmp_w; mf->height = tmp_h; + +#if defined(CONFIG_MEDIA_CONTROLLER) + remote_pad = media_entity_remote_pad( + &icd->vdev->entity.pads[0]); + format->pad = remote_pad->index; +#endif + ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd), pad, set_fmt, NULL, format);