From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0856269945 for ; Mon, 15 Apr 2024 12:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182573; cv=none; b=aLErWCas7LlUvu2Qi9s3U/OBzmV/cG1qe7aQTYN0p5cQpigK/2PUcMF4c25Wur5cQZ76GBfHs+nM3lDnzEgQ9bzUec3+hZLuehdgq+2o+bf0+rfryTgYVf6T7ybX5dGChP6vxFimaYuMnUCeLH1KqXPFIZdKb8k23zjzDUn8Mb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182573; c=relaxed/simple; bh=/2KJ/TsMOZJB6hH86nftC0fSo3cHqvgpF5KdM3jdmtc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GLVOPWwhT4O0/9GmisBX5YLsPKyhhW+S9vc9UEZa5JEZGbFK1HWdU0sjhRkBYIjziB4eQD+sOZa18svmg5Kuo62s0QMB8nSYLzqN4jyYYokFhLhOGUWFOGTcVnUpRnTx4xw3c7UkWwqCX288qFqt9OTjPrXf5Hthx5yu4SpUdeI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CEeHtmno; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CEeHtmno" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oHHrJR8HiRcRSBbFDuzyUMs/wZE2RbsTa3jSRIQeRbo=; b=CEeHtmnoeJS/ZfzR+V5FaspakyXtVfghmVCzd2VjqRBuxT8+CZK7LyJRzs6hNxdc5f1ZBc 8ZvJMUK3Yb146ZwtpxPVQsMKtBYDWh88MAXRgEX5y/YnOKEhxBLaC+nM+07GJHMLzFr2k6 bvSoe0lhWYVRM1oHsjOX+9ok6x+9GQk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-490-vTy0ymoRMKuhzaK2IVM07A-1; Mon, 15 Apr 2024 08:02:47 -0400 X-MC-Unique: vTy0ymoRMKuhzaK2IVM07A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B3D1780171E; Mon, 15 Apr 2024 12:02:45 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CE7BC13FA1; Mon, 15 Apr 2024 12:02:44 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 08/23] media: atomisp: Call media_pipeline_alloc_start() in stream start Date: Mon, 15 Apr 2024 14:02:05 +0200 Message-ID: <20240415120220.219480-9-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Call media_pipeline_alloc_start() from atomisp_start_streaming() to mark all involved subdevs as busy so that the links cannot be changed through the media-controller APIs while streaming. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 15 +++++++++++++++ .../staging/media/atomisp/pci/atomisp_subdev.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index c16942051cfb..8ef8cbc3b7a7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -902,6 +902,20 @@ int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count) if (ret) goto out_unlock; + /* + * When running a classic v4l2 app after a media-controller aware + * app, the CSI-receiver -> ISP link for the current sensor may be + * disabled. Fix this up before marking the pipeline as started. + */ + mutex_lock(&isp->media_dev.graph_mutex); + atomisp_setup_input_links(isp); + ret = __media_pipeline_start(&asd->video_out.vdev.entity.pads[0], &asd->video_out.pipe); + mutex_unlock(&isp->media_dev.graph_mutex); + if (ret) { + dev_err(isp->dev, "Error starting mc pipline: %d\n", ret); + goto out_unlock; + } + /* Input system HW workaround */ atomisp_dma_burst_len_cfg(asd); @@ -1054,6 +1068,7 @@ void atomisp_stop_streaming(struct vb2_queue *vq) if (ret) dev_warn(isp->dev, "Recreating streams failed: %d\n", ret); + media_pipeline_stop(&asd->video_out.vdev.entity.pads[0]); mutex_unlock(&isp->mutex); } diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp_subdev.h index 9c1703bf439c..bcfa829dbf61 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.h +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.h @@ -49,6 +49,7 @@ struct atomisp_video_pipe { struct video_device vdev; enum v4l2_buf_type type; struct media_pad pad; + struct media_pipeline pipe; struct vb2_queue vb_queue; /* Lock for vb_queue, when also taking isp->mutex this must be taken first! */ struct mutex vb_queue_mutex; -- 2.44.0