From patchwork Fri May 16 13:33:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 4193041 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 7E0F7BFF02 for ; Fri, 16 May 2014 13:55:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9920D202E9 for ; Fri, 16 May 2014 13:55:45 +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 A760C20270 for ; Fri, 16 May 2014 13:55:44 +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 s4GDsmJW019726; Fri, 16 May 2014 08:54:48 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDsmuc025269; Fri, 16 May 2014 08:54:48 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 16 May 2014 08:54:47 -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 s4GDsmgD011823; Fri, 16 May 2014 08:54:48 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 087BC8062D; Fri, 16 May 2014 08:54:48 -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 08A8A8064B for ; Fri, 16 May 2014 08:41:51 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dlelxv84.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDfoaC011704 for ; Fri, 16 May 2014 08:41:51 -0500 Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDfoqw002126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 May 2014 08:41:50 -0500 Received: from [216.82.253.67:12443] by server-10.bemta-7.messagelabs.com id BE/5C-15082-E9516735; Fri, 16 May 2014 13:41:50 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-12.tower-158.messagelabs.com!1400247709!3020969!1 X-Originating-IP: [209.85.160.54] 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 26027 invoked from network); 16 May 2014 13:41:49 -0000 Received: from mail-pb0-f54.google.com (HELO mail-pb0-f54.google.com) (209.85.160.54) by server-12.tower-158.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2014 13:41:49 -0000 Received: by mail-pb0-f54.google.com with SMTP id jt11so2612274pbb.41 for ; Fri, 16 May 2014 06:41:49 -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=Gz2vdgH60I/465eU1lErqoSYdrBXBiLyygoecCjaJ1I=; b=p64JScwHjuUzoiOQInO7uere63rVLhz7FiY9JiHs04hNnWlxRh3Jvi+q9QolX+kt8V PTkFRMadleFckBgYrC4BOIaJC/B4u1+/vIb7CQVeKkOc9DKDNfL4DRadlPb05zYGTCWC z/3erZrSvEZF0F/Jy9QJSSHfqjPPv18Rji193HQRxlCGPNXoO1c/ixcwLcQ+gA234C1v KaJg0TbflOLK8eohNrXxXjJeeIMJ7pww0rm6VaikTuo8S0gK3ppxNfwoPz37lGGDnxmE pI3cNrppGmR6vac/2aJHa/ks+1nSvrPFWbHBAsRyRoxXmDRhqXc2jcwvRnUJfrggLRF+ D78w== X-Received: by 10.68.240.68 with SMTP id vy4mr20838244pbc.127.1400247709188; Fri, 16 May 2014 06:41:49 -0700 (PDT) Received: from localhost.localdomain ([27.107.45.22]) by mx.google.com with ESMTPSA id cj1sm34699547pac.40.2014.05.16.06.41.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 06:41:48 -0700 (PDT) From: "Lad, Prabhakar" To: LMML , Hans Verkuil Subject: [PATCH v5 33/49] media: davinci: vpif_capture: improve start/stop_streaming callbacks Date: Fri, 16 May 2014 19:03:39 +0530 Message-ID: <1400247235-31434-36-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@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 drops unnecessary check from start_streaming() callback as this is already done in try/s_fmt and some minor code cleanups, drops check for vb2_is_streaming() as this check is done by vb2 itself before calling this callback. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpif_capture.c | 36 ++++++++++++------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index c77c176..58dddf6 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -176,6 +176,11 @@ static void vpif_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&common->irqlock, flags); } +/** + * vpif_start_streaming : Starts the DMA engine for streaming + * @vb: ptr to vb2_buffer + * @count: number of buffers + */ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) { struct vpif_capture_config *vpif_config_data = @@ -193,16 +198,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) ch->field_id = 0; common->started = 1; - if ((vpif->std_info.frm_fmt && - ((common->fmt.fmt.pix.field != V4L2_FIELD_NONE) && - (common->fmt.fmt.pix.field != V4L2_FIELD_ANY))) || - (!vpif->std_info.frm_fmt && - (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) { - vpif_dbg(1, debug, "conflict in field format and std format\n"); - ret = -EINVAL; - goto err; - } - /* configure 1 or 2 channel mode */ if (vpif_config_data->setup_input_channel_mode) { ret = vpif_config_data-> @@ -245,13 +240,13 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) * VPIF register */ channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; - if ((VPIF_CHANNEL0_VIDEO == ch->channel_id)) { + if (VPIF_CHANNEL0_VIDEO == ch->channel_id) { channel0_intr_assert(); channel0_intr_enable(1); enable_channel0(1); } - if ((VPIF_CHANNEL1_VIDEO == ch->channel_id) || - (common->started == 2)) { + if (VPIF_CHANNEL1_VIDEO == ch->channel_id || + common->started == 2) { channel1_intr_assert(); channel1_intr_enable(1); enable_channel1(1); @@ -268,16 +263,19 @@ err: return ret; } -/* abort streaming and wait for last buffer */ +/** + * vpif_stop_streaming : Stop the DMA engine + * @vq: ptr to vb2_queue + * + * This callback stops the DMA engine and any remaining buffers + * in the DMA queue are released. + */ static void vpif_stop_streaming(struct vb2_queue *vq) { struct channel_obj *ch = vb2_get_drv_priv(vq); struct common_obj *common; unsigned long flags; - if (!vb2_is_streaming(vq)) - return; - common = &ch->common[VPIF_VIDEO_INDEX]; /* Disable channel as per its device type and channel id */ @@ -285,8 +283,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq) enable_channel0(0); channel0_intr_enable(0); } - if ((VPIF_CHANNEL1_VIDEO == ch->channel_id) || - (2 == common->started)) { + if (VPIF_CHANNEL1_VIDEO == ch->channel_id || + 2 == common->started) { enable_channel1(0); channel1_intr_enable(0); }