From patchwork Thu Jul 26 11:59:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jones X-Patchwork-Id: 13493 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1SuMh2-0002Is-8Y for patchwork@linuxtv.org; Thu, 26 Jul 2012 13:57:24 +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.75/mailfrontend-3) with esmtp for id 1SuMh1-0001Zh-FF; Thu, 26 Jul 2012 13:57:24 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752603Ab2GZL5R (ORCPT ); Thu, 26 Jul 2012 07:57:17 -0400 Received: from mail1.matrix-vision.com ([78.47.19.71]:39145 "EHLO mail1.matrix-vision.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343Ab2GZL5Q (ORCPT ); Thu, 26 Jul 2012 07:57:16 -0400 Received: from mail1.matrix-vision.com (localhost [127.0.0.1]) by mail1.matrix-vision.com (Postfix) with ESMTP id 02FF772356; Thu, 26 Jul 2012 13:57:15 +0200 (CEST) Received: from erinome (g2.matrix-vision.com [80.152.136.245]) by mail1.matrix-vision.com (Postfix) with ESMTPA id CAE7D721CD; Thu, 26 Jul 2012 13:57:14 +0200 (CEST) Received: from erinome (localhost [127.0.0.1]) by erinome (Postfix) with ESMTP id 4B9996F8A; Thu, 26 Jul 2012 13:57:14 +0200 (CEST) Received: by erinome (Postfix, from userid 108) id 3F0516F9C; Thu, 26 Jul 2012 13:57:14 +0200 (CEST) Received: from ap437-joe.intern.matrix-vision.de (host65-86.intern.matrix-vision.de [192.168.65.86]) by erinome (Postfix) with ESMTPA id 2DD666F8A; Thu, 26 Jul 2012 13:57:14 +0200 (CEST) From: Michael Jones To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Sakari Ailus Subject: [PATCH 2/2] [media] omap3isp: support G_FMT Date: Thu, 26 Jul 2012 13:59:56 +0200 Message-Id: <1343303996-16025-3-git-send-email-michael.jones@matrix-vision.de> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1343303996-16025-1-git-send-email-michael.jones@matrix-vision.de> References: <1343303996-16025-1-git-send-email-michael.jones@matrix-vision.de> X-MV-Disclaimer: true (erinome) X-AV-Checked: ClamAV using ClamSMTP (erinome) X-AV-Checked: ClamAV using ClamSMTP (mail1) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.7.26.114533 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, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' This allows a V4L2 application which has no knowledge of the media controller to open a video device node of the already-configured ISP and query what it will deliver. Previously, G_FMT only worked after a S_FMT had already been done. Signed-off-by: Michael Jones --- drivers/media/video/omap3isp/ispvideo.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index d1d2c14..955211b 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -1244,6 +1244,7 @@ static int isp_video_open(struct file *file) { struct isp_video *video = video_drvdata(file); struct isp_video_fh *handle; + struct media_pad *src_pad; int ret = 0; handle = kzalloc(sizeof(*handle), GFP_KERNEL); @@ -1273,6 +1274,32 @@ static int isp_video_open(struct file *file) handle->format.type = video->type; handle->timeperframe.denominator = 1; + src_pad = media_entity_remote_source(&video->pad); + + if (src_pad) { /* it's on an active link */ + struct v4l2_subdev_format srcfmt = { + .pad = src_pad->index, + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct v4l2_subdev *src_subdev = + isp_video_remote_subdev(video, NULL); + pr_debug("%s src_subdev=\"%s\"\n", __func__, src_subdev->name); + + ret = v4l2_subdev_call(src_subdev, pad, get_fmt, NULL, &srcfmt); + if (ret) + goto done; + pr_debug("%s MBUS format %dx%d code:%x\n", __func__, + srcfmt.format.width, srcfmt.format.height, + srcfmt.format.code); + + isp_video_mbus_to_pix(video, &srcfmt.format, + &handle->format.fmt.pix); + pr_debug("%s V4L format %dx%d 4CC:%x\n", __func__, + handle->format.fmt.pix.width, + handle->format.fmt.pix.height, + handle->format.fmt.pix.pixelformat); + } + handle->video = video; file->private_data = &handle->vfh;