From patchwork Thu Jul 26 11:59:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jones X-Patchwork-Id: 1242121 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 372154025E for ; Thu, 26 Jul 2012 11:57:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752591Ab2GZL5O (ORCPT ); Thu, 26 Jul 2012 07:57:14 -0400 Received: from mail1.matrix-vision.com ([78.47.19.71]:39139 "EHLO mail1.matrix-vision.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343Ab2GZL5N (ORCPT ); Thu, 26 Jul 2012 07:57:13 -0400 Received: from mail1.matrix-vision.com (localhost [127.0.0.1]) by mail1.matrix-vision.com (Postfix) with ESMTP id AE04972356; Thu, 26 Jul 2012 13:57:11 +0200 (CEST) Received: from erinome (g2.matrix-vision.com [80.152.136.245]) by mail1.matrix-vision.com (Postfix) with ESMTPA id 837BC721CD; Thu, 26 Jul 2012 13:57:11 +0200 (CEST) Received: from erinome (localhost [127.0.0.1]) by erinome (Postfix) with ESMTP id EFBD26F8A; Thu, 26 Jul 2012 13:57:10 +0200 (CEST) Received: by erinome (Postfix, from userid 108) id E51016F9C; Thu, 26 Jul 2012 13:57:10 +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 D3E5C6F8A; Thu, 26 Jul 2012 13:57:10 +0200 (CEST) From: Michael Jones To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Sakari Ailus Subject: [PATCH 1/2] [media] omap3isp: implement ENUM_FMT Date: Thu, 26 Jul 2012 13:59:55 +0200 Message-Id: <1343303996-16025-2-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 ENUM_FMT will not enumerate all formats that the ISP is capable of, it will only return the format which has been previously configured using the media controller, because this is the only format available to a V4L2 application which is unaware of the media controller. Signed-off-by: Michael Jones --- drivers/media/video/omap3isp/ispvideo.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index b37379d..d1d2c14 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -678,6 +678,28 @@ isp_video_get_format(struct file *file, void *fh, struct v4l2_format *format) } static int +isp_video_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *fmtdesc) +{ + struct isp_video_fh *vfh = to_isp_video_fh(fh); + struct isp_video *video = video_drvdata(file); + + if (fmtdesc->index) + return -EINVAL; + + if (fmtdesc->type != video->type) + return -EINVAL; + + fmtdesc->flags = 0; + fmtdesc->description[0] = 0; + + mutex_lock(&video->mutex); + fmtdesc->pixelformat = vfh->format.fmt.pix.pixelformat; + mutex_unlock(&video->mutex); + + return 0; +} + +static int isp_video_set_format(struct file *file, void *fh, struct v4l2_format *format) { struct isp_video_fh *vfh = to_isp_video_fh(fh); @@ -1191,6 +1213,7 @@ isp_video_s_input(struct file *file, void *fh, unsigned int input) static const struct v4l2_ioctl_ops isp_video_ioctl_ops = { .vidioc_querycap = isp_video_querycap, + .vidioc_enum_fmt_vid_cap = isp_video_enum_format, .vidioc_g_fmt_vid_cap = isp_video_get_format, .vidioc_s_fmt_vid_cap = isp_video_set_format, .vidioc_try_fmt_vid_cap = isp_video_try_format,