From patchwork Mon Nov 7 14:18:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 13034504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D8AAC433FE for ; Mon, 7 Nov 2022 14:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YkLUPwuGifX6K7UhVzYNGZlZYAXMHAbKfA5NeX+Uv04=; b=ZcY4FUI4M7Kczj jdcMICygwq3AJ2ONPK6Jtw0aLUaNp+liccbBVtaOWHT8XAoAl5CTvY2sP+LTyjPMVF9SgIQVXMhbO 9Bdw1K5hPVeQQT7ucjtuHicsZA9c+CFWDndSwndw7Xi9A5p5u5mGEHLjjl1HxO0/hctyq7egFyCXZ 6xwKFP9W/acUlj0PH8mmLJEmQSyL4xG6L+HqHcsNK4FB1CoZIZlKK1wgNS7WDuQJBthNNqm+kenZf 0GEFfrYNA6gJ26owVQBbfxHjDl+YzmWYc2i54uZ1rvEAJuMDP6fnVZQpORlE12VbUTNmqZyLQySeC DuTOlFU2ISRpVheflkSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1os3HU-00FICT-L7; Mon, 07 Nov 2022 14:39:20 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1os2xU-00FAix-CX for linux-arm-kernel@lists.infradead.org; Mon, 07 Nov 2022 14:18:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667830719; x=1699366719; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/luAN7OA0doORJetnI5tF2uTnMhfUCA9gIxuQ14Fh70=; b=WNVau5lZgBcIi17u/mbTVuoL+QsDTCkHKH4DcYvgjfMmLkE9/HW2fuxq JH4hINjp2t2kdCsA2znMTFwJwyIMtkM9ZLSNT0Y96wFztNb4JJ/leFOPR 4LiTwfQwOeJhzVlGIQMsxl5VCgDr+mpfPl8TWsxTM/5LKhpbS2HPNMgIV uCQ5r4mPfFQt97eMAil1OZ3q2E/DKlHmRKhj7UzZf61K5WbF3DCwldRaH toJFMP1LPrPEEfov3qQBrxSi/pQFvnc/3cdpsFf1BckGcWNFRDlspRm/Q 0Oc5K2H2SrzoWohRLgHsfMA7/miI+pAC9Cpm3yNiCJ0JaUR3haujLutk/ A==; X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="198727476" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Nov 2022 07:18:39 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Mon, 7 Nov 2022 07:18:39 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Mon, 7 Nov 2022 07:18:37 -0700 From: Eugen Hristev To: , , , CC: , , Eugen Hristev Subject: [PATCH v12 5/6] media: microchip: microchip-isc: move media_pipeline_* to (un)prepare cb Date: Mon, 7 Nov 2022 16:18:17 +0200 Message-ID: <20221107141818.104937-6-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107141818.104937-1-eugen.hristev@microchip.com> References: <20221107141818.104937-1-eugen.hristev@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221107_061840_471486_5869730A X-CRM114-Status: GOOD ( 11.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move the media_pipeline_start/stop calls from start/stop streaming to the new prepare_streaming and unprepare_streaming callbacks. Signed-off-by: Eugen Hristev --- .../platform/microchip/microchip-isc-base.c | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c index 28749a09b0c3..e2994d48f10c 100644 --- a/drivers/media/platform/microchip/microchip-isc-base.c +++ b/drivers/media/platform/microchip/microchip-isc-base.c @@ -328,6 +328,13 @@ static int isc_configure(struct isc_device *isc) return isc_update_profile(isc); } +static int isc_prepare_streaming(struct vb2_queue *vq) +{ + struct isc_device *isc = vb2_get_drv_priv(vq); + + return media_pipeline_start(isc->video_dev.entity.pads, &isc->mpipe); +} + static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) { struct isc_device *isc = vb2_get_drv_priv(vq); @@ -336,10 +343,6 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) unsigned long flags; int ret; - ret = media_pipeline_start(isc->video_dev.entity.pads, &isc->mpipe); - if (ret) - goto err_pipeline_start; - /* Enable stream on the sub device */ ret = v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 1); if (ret && ret != -ENOIOCTLCMD) { @@ -389,9 +392,6 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 0); err_start_stream: - media_pipeline_stop(isc->video_dev.entity.pads); - -err_pipeline_start: spin_lock_irqsave(&isc->dma_queue_lock, flags); list_for_each_entry(buf, &isc->dma_queue, list) vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED); @@ -401,6 +401,14 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) return ret; } +static void isc_unprepare_streaming(struct vb2_queue *vq) +{ + struct isc_device *isc = vb2_get_drv_priv(vq); + + /* Stop media pipeline */ + media_pipeline_stop(isc->video_dev.entity.pads); +} + static void isc_stop_streaming(struct vb2_queue *vq) { struct isc_device *isc = vb2_get_drv_priv(vq); @@ -430,9 +438,6 @@ static void isc_stop_streaming(struct vb2_queue *vq) if (ret && ret != -ENOIOCTLCMD) v4l2_err(&isc->v4l2_dev, "stream off failed in subdev\n"); - /* Stop media pipeline */ - media_pipeline_stop(isc->video_dev.entity.pads); - /* Release all active buffers */ spin_lock_irqsave(&isc->dma_queue_lock, flags); if (unlikely(isc->cur_frm)) { @@ -472,6 +477,8 @@ static const struct vb2_ops isc_vb2_ops = { .start_streaming = isc_start_streaming, .stop_streaming = isc_stop_streaming, .buf_queue = isc_buffer_queue, + .prepare_streaming = isc_prepare_streaming, + .unprepare_streaming = isc_unprepare_streaming, }; static int isc_querycap(struct file *file, void *priv,