From patchwork Fri May 16 13:33:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 4193271 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 ADCCCBFF02 for ; Fri, 16 May 2014 13:59:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B100620270 for ; Fri, 16 May 2014 13:59:40 +0000 (UTC) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 906FA2026F for ; Fri, 16 May 2014 13:59:39 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDwlAt002486; Fri, 16 May 2014 08:58:47 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDwj5G032329; Fri, 16 May 2014 08:58:47 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 16 May 2014 08:58:45 -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 s4GDwjQe015668; Fri, 16 May 2014 08:58:45 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 8B0C880631; Fri, 16 May 2014 08:58:45 -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 B93508062F for ; Fri, 16 May 2014 08:42:21 -0500 (CDT) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dlelxv84.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDgLQS012049 for ; Fri, 16 May 2014 08:42:21 -0500 Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDgLVq008141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 May 2014 08:42:21 -0500 Received: from [216.82.241.195:48817] by server-7.bemta-8.messagelabs.com id FC/30-31662-CB516735; Fri, 16 May 2014 13:42:20 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-13.tower-119.messagelabs.com!1400247739!20139181!1 X-Originating-IP: [209.85.220.49] 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 23144 invoked from network); 16 May 2014 13:42:20 -0000 Received: from mail-pa0-f49.google.com (HELO mail-pa0-f49.google.com) (209.85.220.49) by server-13.tower-119.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2014 13:42:20 -0000 Received: by mail-pa0-f49.google.com with SMTP id lj1so2567983pab.36 for ; Fri, 16 May 2014 06:42:18 -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=RLvtLTm0KKTrLLX2uT4njAXZr+xTnIH5lV4ljBYlK/k=; b=D2ruKwzBbVLQ+lIwR/dDUCeEIAsn479bTitbrDEs5f+H8zExeHt36ZWhsqrA2WwEfB bnwxGqLR+2vyFmIB8oo5WrkIzcQB1mF9e0K0Fb7VO/XrBEB6zAOAtlfeoq5q4jnGRn+l huXmyQJANy74BXrEO3nRslwVw3BpyKDFwz+If1fpKZVlzmRTD7JBUuOzGF4PBOJUJVto Q2Y+RtzE/9KOcDleJN+2dE9KS8JKo4aIAgsyf4iWGEXdKlPefyo+futJTh6hVQxrM0e6 B6nB1fUh9Yh8Mxrx3DFznPUvT/qVvdbwX5A3gmFKTOeCxUs34/4F1meKSTQ82ExZJiRD RN2g== X-Received: by 10.68.224.101 with SMTP id rb5mr20998136pbc.135.1400247738875; Fri, 16 May 2014 06:42:18 -0700 (PDT) Received: from localhost.localdomain ([27.107.45.22]) by mx.google.com with ESMTPSA id cj1sm34699547pac.40.2014.05.16.06.42.13 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 06:42:17 -0700 (PDT) From: "Lad, Prabhakar" To: LMML , Hans Verkuil Subject: [PATCH v5 39/49] media: davinic: vpif_capture: drop started member from struct common_obj Date: Fri, 16 May 2014 19:03:45 +0530 Message-ID: <1400247235-31434-42-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" the started member was indicating whether streaming was started or not, this can be determined by vb2 offering, this patch replaces the started member from struct common_obj with appropriate vb2 calls. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpif_capture.c | 36 ++++++++++--------------- drivers/media/platform/davinci/vpif_capture.h | 2 -- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 6b66f55..b898779 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -73,6 +73,9 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode); static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] = { {1, 1} }; +/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */ +static int ycmux_mode; + static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb) { return container_of(vb, struct vpif_cap_buffer, vb); @@ -194,9 +197,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) spin_lock_irqsave(&common->irqlock, flags); - /* Initialize field_id and started member */ + /* Initialize field_id */ ch->field_id = 0; - common->started = 1; /* configure 1 or 2 channel mode */ if (vpif_config_data->setup_input_channel_mode) { @@ -216,13 +218,12 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) /* Call vpif_set_params function to set the parameters and addresses */ ret = vpif_set_video_params(vpif, ch->channel_id); - if (ret < 0) { vpif_dbg(1, debug, "can't set video params\n"); goto err; } - common->started = ret; + ycmux_mode = ret; vpif_config_addr(ch, ret); /* Get the next frame from the buffer queue */ @@ -252,7 +253,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) enable_channel0(1); } if (VPIF_CHANNEL1_VIDEO == ch->channel_id || - common->started == 2) { + ycmux_mode == 2) { channel1_intr_assert(); channel1_intr_enable(1); enable_channel1(1); @@ -291,11 +292,12 @@ static void vpif_stop_streaming(struct vb2_queue *vq) channel0_intr_enable(0); } if (VPIF_CHANNEL1_VIDEO == ch->channel_id || - 2 == common->started) { + ycmux_mode == 2) { enable_channel1(0); channel1_intr_enable(0); } - common->started = 0; + + ycmux_mode = 0; ret = v4l2_subdev_call(ch->sd, video, s_stream, 0); if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) @@ -404,9 +406,6 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id) for (i = 0; i < VPIF_NUMBER_OF_OBJECTS; i++) { common = &ch->common[i]; /* skip If streaming is not started in this channel */ - if (0 == common->started) - continue; - /* Check the field format */ if (1 == ch->vpifparams.std_info.frm_fmt) { /* Progressive mode */ @@ -910,10 +909,8 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id) vpif_dbg(2, debug, "vpif_s_std\n"); - if (common->started) { - vpif_err("streaming in progress\n"); + if (vb2_is_busy(&common->buffer_queue)) return -EBUSY; - } /* Call encoder subdevice function to set the standard */ ch->video.stdid = std_id; @@ -998,10 +995,8 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index) if (index >= chan_cfg->input_count) return -EINVAL; - if (common->started) { - vpif_err("Streaming in progress\n"); + if (vb2_is_busy(&common->buffer_queue)) return -EBUSY; - } return vpif_set_input(config, ch, index); } @@ -1092,11 +1087,8 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv, vpif_dbg(2, debug, "%s\n", __func__); - /* If streaming is started, return error */ - if (common->started) { - vpif_dbg(1, debug, "Streaming is started\n"); + if (vb2_is_busy(&common->buffer_queue)) return -EBUSY; - } pixfmt = &fmt->fmt.pix; /* Check for valid field format */ @@ -1707,7 +1699,7 @@ static int vpif_suspend(struct device *dev) channel0_intr_enable(0); } if (ch->channel_id == VPIF_CHANNEL1_VIDEO || - common->started == 2) { + ycmux_mode == 2) { enable_channel1(0); channel1_intr_enable(0); } @@ -1739,7 +1731,7 @@ static int vpif_resume(struct device *dev) channel0_intr_enable(1); } if (ch->channel_id == VPIF_CHANNEL1_VIDEO || - common->started == 2) { + ycmux_mode == 2) { enable_channel1(1); channel1_intr_enable(1); } diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h index 9b7dd06..4960504 100644 --- a/drivers/media/platform/davinci/vpif_capture.h +++ b/drivers/media/platform/davinci/vpif_capture.h @@ -77,8 +77,6 @@ struct common_obj { struct mutex lock; /* number of users performing IO */ u32 io_usrs; - /* Indicates whether streaming started */ - u8 started; /* Function pointer to set the addresses */ void (*set_addr) (unsigned long, unsigned long, unsigned long, unsigned long);