From patchwork Fri May 16 13:33:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 4192561 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DE1D5BFF02 for ; Fri, 16 May 2014 13:47:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4CF520295 for ; Fri, 16 May 2014 13:47:42 +0000 (UTC) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2B08201FE for ; Fri, 16 May 2014 13:47:41 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDlf3H025883 for ; Fri, 16 May 2014 08:47:41 -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 s4GDlfNo015818 for ; Fri, 16 May 2014 08:47:41 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Fri, 16 May 2014 08:47:40 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDlekb008687 for ; Fri, 16 May 2014 08:47:40 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 561AD80633 for ; Fri, 16 May 2014 08:47:40 -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 B33F880631 for ; Fri, 16 May 2014 08:40:44 -0500 (CDT) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dlelxv84.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDeie3010854 for ; Fri, 16 May 2014 08:40:44 -0500 Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDeig6008890 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 May 2014 08:40:44 -0500 Received: from [216.82.253.147:48407] by server-1.bemta-7.messagelabs.com id 93/B5-29805-C5516735; Fri, 16 May 2014 13:40:44 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-11.tower-165.messagelabs.com!1400247643!13007871!1 X-Originating-IP: [209.85.220.42] 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 16295 invoked from network); 16 May 2014 13:40:43 -0000 Received: from mail-pa0-f42.google.com (HELO mail-pa0-f42.google.com) (209.85.220.42) by server-11.tower-165.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2014 13:40:43 -0000 Received: by mail-pa0-f42.google.com with SMTP id rd3so2584887pab.15 for ; Fri, 16 May 2014 06:40:43 -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=D1nkMLnaBOac9D1jsOA070BH712fMky5x3ivI7yshT4=; b=Ocuz6jHW10yXtmNfK8T2OdaxERX9H/qZ+a6gofla+TzsjrguVXHa7gujt/743d/gJC FXzBFZ9mNQdMJlrHaGzZYTEWS97P8beHGqqSupaoarCa65BdmC8WJcWIrZbTlWwSWUZS LGN7ChKsHzdB/2uHhg/wR/oLHJNDznvUlz9uQOi3WKmYBrtl9Ghjyiu/gs0n1mkNALYG HCQEpM9vTxv4CZEo+ZCITxQ7VY8+zGuwitKyJL7/PTlgFTlXKsRQArd9y2GTYhI3lG8T 6PxcD4NuRLcKa7mvClc7EEnQp5V8WdKCeNnhpSAGXTPK4CBVTF9J/CjApjheNRc6aEMN /YEA== X-Received: by 10.66.236.163 with SMTP id uv3mr21154738pac.18.1400247642930; Fri, 16 May 2014 06:40:42 -0700 (PDT) Received: from localhost.localdomain ([27.107.45.22]) by mx.google.com with ESMTPSA id cj1sm34699547pac.40.2014.05.16.06.40.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 06:40:41 -0700 (PDT) From: "Lad, Prabhakar" To: LMML , Hans Verkuil Subject: [PATCH v5 22/49] media: davinci: vpif_display: return -ENODATA for *dv_timings calls Date: Fri, 16 May 2014 19:03:27 +0530 Message-ID: <1400247235-31434-24-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 suppport to return -ENODATA for *dv_timings calls if the current output does not support it. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpif_display.c | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 81d955a..f51b5be 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -898,10 +898,21 @@ static int vpif_enum_dv_timings(struct file *file, void *priv, struct v4l2_enum_dv_timings *timings) { + struct vpif_display_config *config = vpif_dev->platform_data; struct video_device *vdev = video_devdata(file); struct channel_obj *ch = video_get_drvdata(vdev); + struct vpif_display_chan_config *chan_cfg; + struct v4l2_output output; int ret; + if (config->chan_config[ch->channel_id].outputs == NULL) + return -ENODATA; + + chan_cfg = &config->chan_config[ch->channel_id]; + output = chan_cfg->outputs[ch->output_idx].output; + if (output.capabilities != V4L2_OUT_CAP_DV_TIMINGS) + return -ENODATA; + ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings); if (ret == -ENOIOCTLCMD || ret == -ENODEV) return -EINVAL; @@ -917,14 +928,29 @@ vpif_enum_dv_timings(struct file *file, void *priv, static int vpif_s_dv_timings(struct file *file, void *priv, struct v4l2_dv_timings *timings) { + struct vpif_display_config *config = vpif_dev->platform_data; struct video_device *vdev = video_devdata(file); struct channel_obj *ch = video_get_drvdata(vdev); struct vpif_params *vpifparams = &ch->vpifparams; + struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; struct vpif_channel_config_params *std_info = &vpifparams->std_info; struct video_obj *vid_ch = &ch->video; struct v4l2_bt_timings *bt = &vid_ch->dv_timings.bt; + struct vpif_display_chan_config *chan_cfg; + struct v4l2_output output; int ret; + if (config->chan_config[ch->channel_id].outputs == NULL) + return -ENODATA; + + chan_cfg = &config->chan_config[ch->channel_id]; + output = chan_cfg->outputs[ch->output_idx].output; + if (output.capabilities != V4L2_OUT_CAP_DV_TIMINGS) + return -ENODATA; + + if (vb2_is_busy(&common->buffer_queue)) + return -EBUSY; + if (timings->type != V4L2_DV_BT_656_1120) { vpif_dbg(2, debug, "Timing type not defined\n"); return -EINVAL; @@ -1006,13 +1032,27 @@ static int vpif_s_dv_timings(struct file *file, void *priv, static int vpif_g_dv_timings(struct file *file, void *priv, struct v4l2_dv_timings *timings) { + struct vpif_display_config *config = vpif_dev->platform_data; struct video_device *vdev = video_devdata(file); struct channel_obj *ch = video_get_drvdata(vdev); + struct vpif_display_chan_config *chan_cfg; struct video_obj *vid_ch = &ch->video; + struct v4l2_output output; + + if (config->chan_config[ch->channel_id].outputs == NULL) + goto error; + + chan_cfg = &config->chan_config[ch->channel_id]; + output = chan_cfg->outputs[ch->output_idx].output; + + if (output.capabilities != V4L2_OUT_CAP_DV_TIMINGS) + goto error; *timings = vid_ch->dv_timings; return 0; +error: + return -ENODATA; } /*