Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2002938rwb; Mon, 7 Nov 2022 08:06:18 -0800 (PST) X-Google-Smtp-Source: AMsMyM4nkiwpZODTTlnIMsPNwqogy3NTqFc4HBV5AT7MAmR9lQXOuFrnzGLwOwruVtslAld33G2e X-Received: by 2002:a17:90b:378f:b0:213:acf2:13ba with SMTP id mz15-20020a17090b378f00b00213acf213bamr51008159pjb.25.1667837178612; Mon, 07 Nov 2022 08:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667837178; cv=none; d=google.com; s=arc-20160816; b=K4G/Opy1eZvT1jV3djLlbtJQmI2uO57wkdJ/lcMIt8xBCCa9OzZTpHeHMjLb0Gs3yh 7YkSIBuDsHHjcVM+r7I2Ul7jMTVG8Nu6UkzQTaDg1Y/UWayDujasUSKxaxg5VZHrjzky 4tQTBoABLTASsLaGtC981axXhUq25Smn4qKOH8yKvtIc3TKwnkjURhwfJNoj3yXoHCQu Hu+Pr1J/OY9PbtnawGU8nGugOkYj8GCS2uJuoHPerL0EdBGh9bz0J8pDPQTJN0J2Zh8O jNUOwxbC3aybC4D1sw7nqrSY5gVQdKYff8E8h9fObeoVycIajDB48fsk+9eVmsvwktre 6ysA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cSn+m4dhkw/qQX6bln9eDcHBgT/dXJxFRWSJNnu7suk=; b=nfw2hys5cGnqV1p/MeoKiECd5u3OE5V6vcvK3tvgPiYJlgILESjWo1mRzeur/WVrYI rnNDz1enykz0M1vEPwjlzK+WD/V6keOD4WGZ/rYUAbGOxsqz4NN0M6iZCr6gnzyj4whZ AH3+l3lm0vOJwhzlSNS5ZUsIxmxQHHhqB84KgfxMFHFnc3ubd5KEQSREy9LTWgMp43lQ h5xgA2nItTuh7uOBvuRynAiaxpS8VZAkTBysF+9I1kwWQA9Nje0PSocZiKJr+EpuyjXS rnyWzJtWmtNEm3a7KowtRbvA3CrGX2GclOPQ7lnP/2HVgHCd6ejSonK1XycEDRo2rhp1 jHkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=mTZ9Wg1W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020a17090a940e00b002100c234c6dsi13088654pjo.35.2022.11.07.08.06.00; Mon, 07 Nov 2022 08:06:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=mTZ9Wg1W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232458AbiKGOYm (ORCPT + 93 others); Mon, 7 Nov 2022 09:24:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232361AbiKGOYP (ORCPT ); Mon, 7 Nov 2022 09:24:15 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13C5123E95; Mon, 7 Nov 2022 06:19:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667830763; x=1699366763; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/luAN7OA0doORJetnI5tF2uTnMhfUCA9gIxuQ14Fh70=; b=mTZ9Wg1W2OzIk9Zdip1gk4ATiIv2PytebL+mLrCAfZviaxVTRP9R28jA 7W9HuQQEQ/t/x1gTwteuYBSgFb3E3Z1e3xcILcw7DEcspwiu3cpUAGU7q mtbxacwjRIKGoVdtRD2199VkacXmqaleDfCRxzHKsAGNz9n+gG1fbRbF7 ZANbCy9BEUMCyRmjIWWovXrJYtCUhl0fPxc3XAEr3jduwviRW2vzhMq97 YDRV3kVK5D+5grqlgabQQcO6pa4ioDMogS1TZM0SEVA/rvkb2yAw8YVGy ouU3pnzMQI8Pvjxbz35CXWHep+45HyO9+SmnCpu9VmGTGYbfhKaaJrPR8 g==; 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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, -- 2.25.1