From patchwork Fri May 16 13:33:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 4192381 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 63B899F1C0 for ; Fri, 16 May 2014 13:45:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A08A20251 for ; Fri, 16 May 2014 13:45:13 +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 32D8A20200 for ; Fri, 16 May 2014 13:45:12 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDiHKF023033; Fri, 16 May 2014 08:44:17 -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 s4GDiHlx015073; Fri, 16 May 2014 08:44:17 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 16 May 2014 08:44:17 -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 s4GDiHcj004773; Fri, 16 May 2014 08:44:17 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 270A080635; Fri, 16 May 2014 08:44:17 -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 8B2688062C for ; Fri, 16 May 2014 08:40:12 -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 s4GDeCuc010441 for ; Fri, 16 May 2014 08:40:12 -0500 Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDeBji001582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 May 2014 08:40:12 -0500 Received: from [216.82.242.147:35849] by server-12.bemta-8.messagelabs.com id DA/21-31743-B3516735; Fri, 16 May 2014 13:40:11 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-10.tower-95.messagelabs.com!1400247609!33009809!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 31256 invoked from network); 16 May 2014 13:40:10 -0000 Received: from mail-pb0-f45.google.com (HELO mail-pb0-f45.google.com) (209.85.160.45) by server-10.tower-95.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2014 13:40:10 -0000 Received: by mail-pb0-f45.google.com with SMTP id um1so2624855pbc.32 for ; Fri, 16 May 2014 06:40:09 -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=5i2N1zsyjd3/MEijy9MXZRlblRWAS9o3/bky4aCv4p0=; b=1AvxQ8/83sqOwowtTPAf0D4o3QupMwjvO8fpboQDsCZul9cFCXbVJywAxUojfEB40t z4SiEEdL0X2W4qPDVCl46yu5npw01Z1EtNgzZM5CamcDR77OsH6YAcMac0ZXin957ZAv EU1h/SaJRt3hZDSGoy9BZDb8QdOqk8t2fk4Ad6l5MDE0CYwTpUx8bGIf5sHFpigjBQDT 5FHG8AaMVqOkKe60O6LLwnSzMIFTB5q4RXfyxgKL8SHUhorYGL8bchjuyV9MNk1QmJiK 6Bls5l54pzKpvXYquWNPeJjQitQX4YHEMOo5RZwKxl0IqaFADD9wqY9oESaxVOriuM/1 ABvg== X-Received: by 10.68.201.97 with SMTP id jz1mr20982781pbc.26.1400247609645; Fri, 16 May 2014 06:40:09 -0700 (PDT) Received: from localhost.localdomain ([27.107.45.22]) by mx.google.com with ESMTPSA id cj1sm34699547pac.40.2014.05.16.06.39.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 06:40:07 -0700 (PDT) From: "Lad, Prabhakar" To: LMML , Hans Verkuil Subject: [PATCH v5 16/49] media: davinic: vpif_display: drop started member from struct common_obj Date: Fri, 16 May 2014 19:03:21 +0530 Message-ID: <1400247235-31434-18-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_display.c | 42 ++++++++++--------------- drivers/media/platform/davinci/vpif_display.h | 2 -- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 5ea2db8..aa487a6 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -62,6 +62,10 @@ static struct vpif_config_params config_params = { .channel_bufsize[1] = 720 * 576 * 2, }; + +/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */ +static int ycmux_mode; + static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} }; static struct vpif_device vpif_obj = { {NULL} }; @@ -185,9 +189,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; /* clock settings */ if (vpif_config_data->set_clock) { @@ -204,7 +207,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) if (ret < 0) goto err; - common->started = ret; + ycmux_mode = ret; vpif_config_addr(ch, ret); /* Get the next frame from the buffer queue */ common->next_frm = common->cur_frm = @@ -235,8 +238,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) channel2_clipping_enable(1); } - if (VPIF_CHANNEL3_VIDEO == ch->channel_id || - common->started == 2) { + if (VPIF_CHANNEL3_VIDEO == ch->channel_id || ycmux_mode == 2) { channel3_intr_assert(); channel3_intr_enable(1); enable_channel3(1); @@ -275,12 +277,10 @@ static void vpif_stop_streaming(struct vb2_queue *vq) enable_channel2(0); channel2_intr_enable(0); } - if (VPIF_CHANNEL3_VIDEO == ch->channel_id || - 2 == common->started) { + if (VPIF_CHANNEL3_VIDEO == ch->channel_id || ycmux_mode == 2) { enable_channel3(0); channel3_intr_enable(0); } - common->started = 0; /* release all active buffers */ spin_lock_irqsave(&common->irqlock, flags); @@ -392,8 +392,6 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id) for (i = 0; i < VPIF_NUMOBJECTS; i++) { common = &ch->common[i]; /* If streaming is started in this channel */ - if (0 == common->started) - continue; if (1 == ch->vpifparams.std_info.frm_fmt) { spin_lock(&common->irqlock); @@ -704,10 +702,8 @@ static int vpif_s_fmt_vid_out(struct file *file, void *priv, struct v4l2_pix_format *pixfmt; int ret = 0; - if (common->started) { - vpif_dbg(1, debug, "Streaming in progress\n"); + if (vb2_is_busy(&common->buffer_queue)) return -EBUSY; - } pixfmt = &fmt->fmt.pix; /* Check for valid field format */ @@ -747,13 +743,12 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id) struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; int ret = 0; + if (vb2_is_busy(&common->buffer_queue)) + return -EBUSY; + if (!(std_id & VPIF_V4L2_STD)) return -EINVAL; - if (common->started) { - vpif_err("streaming in progress\n"); - return -EBUSY; - } /* Call encoder subdevice function to set the standard */ ch->video.stdid = std_id; @@ -920,16 +915,14 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i) struct vpif_display_chan_config *chan_cfg; struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; + if (vb2_is_busy(&common->buffer_queue)) + return -EBUSY; + chan_cfg = &config->chan_config[ch->channel_id]; if (i >= chan_cfg->output_count) return -EINVAL; - if (common->started) { - vpif_err("Streaming in progress\n"); - return -EBUSY; - } - return vpif_set_output(config, ch, i); } @@ -1223,7 +1216,6 @@ static int vpif_probe_complete(void) for (k = 0; k < VPIF_NUMOBJECTS; k++) { common = &ch->common[k]; common->io_usrs = 0; - common->started = 0; spin_lock_init(&common->irqlock); mutex_init(&common->lock); common->set_addr = NULL; @@ -1488,7 +1480,7 @@ static int vpif_suspend(struct device *dev) channel2_intr_enable(0); } if (ch->channel_id == VPIF_CHANNEL3_VIDEO || - common->started == 2) { + ycmux_mode == 2) { enable_channel3(0); channel3_intr_enable(0); } @@ -1518,7 +1510,7 @@ static int vpif_resume(struct device *dev) channel2_intr_enable(1); } if (ch->channel_id == VPIF_CHANNEL3_VIDEO || - common->started == 2) { + ycmux_mode == 2) { enable_channel3(1); channel3_intr_enable(1); } diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h index e21a343..029e0c5 100644 --- a/drivers/media/platform/davinci/vpif_display.h +++ b/drivers/media/platform/davinci/vpif_display.h @@ -85,8 +85,6 @@ struct common_obj { * structure */ u32 io_usrs; /* number of users performing * IO */ - u8 started; /* Indicates whether streaming - * started */ u32 ytop_off; /* offset of Y top from the * starting of the buffer */ u32 ybtm_off; /* offset of Y bottom from the