From patchwork Fri May 16 13:33:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 4193491 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D9F7A9F1C0 for ; Fri, 16 May 2014 14:04:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C972720295 for ; Fri, 16 May 2014 14:04:12 +0000 (UTC) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC87E2026F for ; Fri, 16 May 2014 14:04:11 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GE4Bvp028466 for ; Fri, 16 May 2014 09:04:11 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GE4AMs008458 for ; Fri, 16 May 2014 09:04:11 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Fri, 16 May 2014 09:04:10 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GE4AaQ024465 for ; Fri, 16 May 2014 09:04:10 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 88AAA80627 for ; Fri, 16 May 2014 09:04:10 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlelxv84.itg.ti.com (dlelxv84.itg.ti.com [172.17.0.246]) by linux.omap.com (Postfix) with ESMTP id 5C9CC80627 for ; Fri, 16 May 2014 08:42:56 -0500 (CDT) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dlelxv84.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDgu7u012387 for ; Fri, 16 May 2014 08:42:56 -0500 Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDgtjF022455 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 May 2014 08:42:56 -0500 Received: from [216.82.242.147:44649] by server-8.bemta-8.messagelabs.com id C9/D8-01549-FD516735; Fri, 16 May 2014 13:42:55 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-11.tower-95.messagelabs.com!1400247774!23353348!1 X-Originating-IP: [209.85.160.45] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14758 invoked from network); 16 May 2014 13:42:54 -0000 Received: from mail-pb0-f45.google.com (HELO mail-pb0-f45.google.com) (209.85.160.45) by server-11.tower-95.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2014 13:42:54 -0000 Received: by mail-pb0-f45.google.com with SMTP id um1so2627702pbc.32 for ; Fri, 16 May 2014 06:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e9iyApGVEF/d6fnZZT4LaWITStrxQlyKMRZteh0CZ8Q=; b=Ltxk2qN47yzKC5ezLNL+kpZNPp+ZBm4pnY3bjk6UqTkhwsRy5nK0S/sfnlfBNL4Hw8 JBs982D8phMrejDSaVI66B2mDuXGmaDGrurxa8WHD7jjfbxVo9gZsjkwkycRZlZakeRY nlR7Q2ZbddM5YwN82qfiB5zwb0CXPj2nmfjzAYxoR1I3HGW3OPeLp2n9pgKRzFmYxNBy e+dd9j5Y2s4QJRl4B3COIc2rmSJfdZi/za7GQlvQwSwMQv9VDPWX8ybZOaAuh+kU3oR3 htr9cvYAe1WlCbUPnkmlWcysjhIHO7PUzgSl0504k3MZbrcd+HoBjv7NRmIIJiLkngHO suYQ== X-Received: by 10.68.191.138 with SMTP id gy10mr11831659pbc.169.1400247773809; Fri, 16 May 2014 06:42:53 -0700 (PDT) Received: from localhost.localdomain ([27.107.45.22]) by mx.google.com with ESMTPSA id cj1sm34699547pac.40.2014.05.16.06.42.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 06:42:52 -0700 (PDT) From: "Lad, Prabhakar" To: LMML , Hans Verkuil Subject: [PATCH v5 46/49] media: davinci: vpif_capture: return -ENODATA for *std calls Date: Fri, 16 May 2014 19:03:52 +0530 Message-ID: <1400247235-31434-49-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400247235-31434-1-git-send-email-prabhakar.csengg@gmail.com> References: <1400247235-31434-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , LKML X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Lad, Prabhakar" this patch adds supports to return -ENODATA to *std calls if the selected output does not support it. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpif_capture.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 0b97023..8d7ada2 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -862,11 +862,22 @@ static int vpif_querystd(struct file *file, void *priv, v4l2_std_id *std_id) */ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std) { + struct vpif_capture_config *config = vpif_dev->platform_data; struct video_device *vdev = video_devdata(file); struct channel_obj *ch = video_get_drvdata(vdev); + struct vpif_capture_chan_config *chan_cfg; + struct v4l2_input input; vpif_dbg(2, debug, "vpif_g_std\n"); + if (config->chan_config[ch->channel_id].inputs == NULL) + return -ENODATA; + + chan_cfg = &config->chan_config[ch->channel_id]; + input = chan_cfg->inputs[ch->input_idx].input; + if (input.capabilities != V4L2_IN_CAP_STD) + return -ENODATA; + *std = ch->video.stdid; return 0; } @@ -879,13 +890,24 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std) */ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id) { + struct vpif_capture_config *config = vpif_dev->platform_data; struct video_device *vdev = video_devdata(file); struct channel_obj *ch = video_get_drvdata(vdev); struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; - int ret = 0; + struct vpif_capture_chan_config *chan_cfg; + struct v4l2_input input; + int ret; vpif_dbg(2, debug, "vpif_s_std\n"); + if (config->chan_config[ch->channel_id].inputs == NULL) + return -ENODATA; + + chan_cfg = &config->chan_config[ch->channel_id]; + input = chan_cfg->inputs[ch->input_idx].input; + if (input.capabilities != V4L2_IN_CAP_STD) + return -ENODATA; + if (vb2_is_busy(&common->buffer_queue)) return -EBUSY;