From patchwork Mon Jun 11 09:52:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugues FRUCHET X-Patchwork-Id: 10457559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 80D6C602C8 for ; Mon, 11 Jun 2018 11:05:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72DBB28329 for ; Mon, 11 Jun 2018 11:05:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6725E28414; Mon, 11 Jun 2018 11:05:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 006A128329 for ; Mon, 11 Jun 2018 11:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=pOJDJkpel2TlfOg2xZrm/7PZ7L5Fr4VHq0AdEy3oLPA=; b=cA7GNtrIxwsbtN lYm6f+D25FF0ieW3ijy1Qldq/UbIrTbUZuENSNyjLTYu28HVhULRPkZzHO9ZcUt6/oOpOVQTzyMKm O68NSEHLxmJctS5SDzAuktktIvwDOs9ttHQdZfOErY+ATJBoUfd28qG8gDUUUCo8qXN6W+Yk2SkLU hT8B11ZwmAmpdXfj81VuFM6JhzOmYyAFQot28ExO1R/VNEsHg4NnxT3OMsb6EvDxXA/cngFVIFTEp LzzZu9tleAkxIDwsnnV0Xt22D9b88I+6fu2cVgc2uS5JVy23yREfDd3pTEjxx+ubFj6X3Y1FWtbj+ G2TcJTaVUOVOFneTvXXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSKdb-0005LJ-Jr; Mon, 11 Jun 2018 11:05:27 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSKdY-0005AC-Hn for linux-arm-kernel@bombadil.infradead.org; Mon, 11 Jun 2018 11:05:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:Message-ID: Date:Subject:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=yCiXx9j8kaZSRbgsR28qiHVrXKqhpxaVu0kLqDsqZxk=; b=Wd5xLX/F4B1i56Y2n4hZdFfyty pO2x5Cw4Io6upUfaCJhsC63daUvNTOpcMc18pACH6pcZKhuXkpPQqNTMVzcmWjyjO36r4tlQPPvYE QsX5anHeKgMVbkuNGiCyHGi9/4U2Dkd2LKoD0iKtReu6vsWDtcWousBjSu4FtdycveRTho8NxdQZK UXBXKKeRBezmp/xYIY86GXiXETJmGEOycuISQRN1zUTNCvmITyq58csiKM0fMon19qLLXc/ztHzz1 9n1aPsuDTn8+6jfxH69VuOnn9FMyuQ8N5uFMAXLjb93UKKQImR8lbyEGO7CPnWRXZEdR7aqAz89dY apWCxEDg==; Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSJVE-0005sF-0d for linux-arm-kernel@lists.infradead.org; Mon, 11 Jun 2018 09:52:44 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w5B9ikQB013583; Mon, 11 Jun 2018 11:52:25 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2jg415reqj-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 11 Jun 2018 11:52:25 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id CAB244A; Mon, 11 Jun 2018 09:52:23 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas24.st.com [10.75.90.94]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9662C241E; Mon, 11 Jun 2018 09:52:23 +0000 (GMT) Received: from SAFEX1HUBCAS23.st.com (10.75.90.47) by Safex1hubcas24.st.com (10.75.90.94) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 11 Jun 2018 11:52:22 +0200 Received: from localhost (10.201.23.73) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 11 Jun 2018 11:52:22 +0200 From: Hugues Fruchet To: Maxime Coquelin , Alexandre Torgue , Mauro Carvalho Chehab , "Hans Verkuil" Subject: [PATCH] media: stm32-dcmi: revisit stop streaming ops Date: Mon, 11 Jun 2018 11:52:17 +0200 Message-ID: <1528710737-8946-1-git-send-email-hugues.fruchet@st.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.201.23.73] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-11_03:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180611_055244_243510_F3AAE03F X-CRM114-Status: GOOD ( 13.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Yannick Fertre , Benjamin Gaignard , Hugues Fruchet , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Do not wait for interrupt completion when stopping streaming, stopping sensor and disabling interruptions are enough. Signed-off-by: Hugues Fruchet --- drivers/media/platform/stm32/stm32-dcmi.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index 581ded0..f0134a6 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -87,7 +87,6 @@ enum state { STOPPED = 0, WAIT_FOR_BUFFER, RUNNING, - STOPPING, }; #define MIN_WIDTH 16U @@ -432,18 +431,6 @@ static irqreturn_t dcmi_irq_thread(int irq, void *arg) spin_lock_irq(&dcmi->irqlock); - /* Stop capture is required */ - if (dcmi->state == STOPPING) { - reg_clear(dcmi->regs, DCMI_IER, IT_FRAME | IT_OVR | IT_ERR); - - dcmi->state = STOPPED; - - complete(&dcmi->complete); - - spin_unlock_irq(&dcmi->irqlock); - return IRQ_HANDLED; - } - if ((dcmi->misr & IT_OVR) || (dcmi->misr & IT_ERR)) { dcmi->errors_count++; if (dcmi->misr & IT_OVR) @@ -701,8 +688,6 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) { struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq); struct dcmi_buf *buf, *node; - unsigned long time_ms = msecs_to_jiffies(TIMEOUT_MS); - long timeout; int ret; /* Disable stream on the sub device */ @@ -712,13 +697,6 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) __func__, ret); spin_lock_irq(&dcmi->irqlock); - dcmi->state = STOPPING; - spin_unlock_irq(&dcmi->irqlock); - - timeout = wait_for_completion_interruptible_timeout(&dcmi->complete, - time_ms); - - spin_lock_irq(&dcmi->irqlock); /* Disable interruptions */ reg_clear(dcmi->regs, DCMI_IER, IT_FRAME | IT_OVR | IT_ERR); @@ -726,12 +704,6 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) /* Disable DCMI */ reg_clear(dcmi->regs, DCMI_CR, CR_ENABLE); - if (!timeout) { - dev_err(dcmi->dev, "%s: Timeout during stop streaming\n", - __func__); - dcmi->state = STOPPED; - } - /* Return all queued buffers to vb2 in ERROR state */ list_for_each_entry_safe(buf, node, &dcmi->buffers, list) { list_del_init(&buf->list); @@ -739,6 +711,7 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) } dcmi->active = NULL; + dcmi->state = STOPPED; spin_unlock_irq(&dcmi->irqlock);