{"id":16305,"url":"https://patchwork.libcamera.org/api/1.1/patches/16305/?format=json","web_url":"https://patchwork.libcamera.org/patch/16305/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220622074638.144636-1-paul.elder@ideasonboard.com>","date":"2022-06-22T07:46:38","name":"[libcamera-devel] pipeline: rkisp1: Support media graph with separate CSI RX","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"affd267ce48459fcf88ebe70dbbbfd3cce66263e","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16305/mbox/","series":[{"id":3201,"url":"https://patchwork.libcamera.org/api/1.1/series/3201/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3201","date":"2022-06-22T07:46:38","name":"[libcamera-devel] pipeline: rkisp1: Support media graph with separate CSI RX","version":1,"mbox":"https://patchwork.libcamera.org/series/3201/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16305/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16305/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 012A9BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jun 2022 07:46:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B81F865638;\n\tWed, 22 Jun 2022 09:46:51 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A64096559A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jun 2022 09:46:49 +0200 (CEST)","from pyrite.rasen.tech (softbank036240125119.bbtec.net\n\t[36.240.125.119])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 58A51DD;\n\tWed, 22 Jun 2022 09:46:48 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655884011;\n\tbh=fV1AJwjhaFKE7IKzeFvb+D25cB5RN/IqeKd0PVMJ5So=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=S8j/KpMRNBm85YtagFCZJSiGy4THVc7SPYbTFUg1Q3e1V+g49VLtOQ0QgHlhaIPeS\n\t7XrNLkSu1cZRNCIl9m1Bohj6Y1sXDV2vsYG8Kk4BpdR+GXaKfyrKjXT32OdASQEigf\n\tEFJcDj7D0MplMbWqr3LSJ3E6o81tR4KGO19FXU1szq5Fbl7UlOsINmIW8azQYOpMVI\n\tf4p1Xi8+qkCXSWDKx8VsvGguR9TeMTPoZ2PU5ZwKAoEbJRrx7f9qkMgrd7TjFGu/5F\n\t09CXYxa7BUGwnpjVBW+HhAoEiHN208s2RJxtJXsPY1JsNZVPgyRa0TuV8A0xlLye+Y\n\tQel+YNPbLxzQw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655884009;\n\tbh=fV1AJwjhaFKE7IKzeFvb+D25cB5RN/IqeKd0PVMJ5So=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=qhTEP8+c9ynzNru47Y2ZmqSmHVVQmiZYQ7PC1dpWSePdZy8sRSi12A5DOoqL+wVps\n\t6HzLlpTzUrtqkGY8v2KTsCRqEKlwZ5Gzi+6B+4CtNryvKdyz/UXoqzxsCTsAtW8W6k\n\tAEp0MTRjRpLUGGiQH6B/z1/EDKm5VB5xG5Kev5uI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"qhTEP8+c\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 22 Jun 2022 16:46:38 +0900","Message-Id":"<20220622074638.144636-1-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] pipeline: rkisp1: Support media graph\n\twith separate CSI RX","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The rkisp1 hardware supports a parallel interface, where the sensor\nwould be connected directly, as well as a CSI receiver. Although at the\nmoment the rkisp1 driver doesn't expose the CSI receiver as a separate\nsubdev, this patch allows the rkisp1 pipeline handler to continue\nworking even in the event that it eventually does.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 35 ++++++++++++++++++++++--\n 1 file changed, 33 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 43b76e14..a233c961 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -178,6 +178,7 @@ private:\n \tstd::unique_ptr<V4L2Subdevice> isp_;\n \tstd::unique_ptr<V4L2VideoDevice> param_;\n \tstd::unique_ptr<V4L2VideoDevice> stat_;\n+\tstd::unique_ptr<V4L2Subdevice> csi_;\n \n \tRkISP1MainPath mainPath_;\n \tRkISP1SelfPath selfPath_;\n@@ -591,6 +592,12 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \n \tLOG(RkISP1, Debug) << \"Sensor configured with \" << format;\n \n+\tif (csi_) {\n+\t\tret = csi_->setFormat(0, &format);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t}\n+\n \tret = isp_->setFormat(0, &format);\n \tif (ret < 0)\n \t\treturn ret;\n@@ -892,7 +899,7 @@ int PipelineHandlerRkISP1::initLinks(Camera *camera,\n \t * Configure the sensor links: enable the link corresponding to this\n \t * camera.\n \t */\n-\tconst MediaPad *pad = isp_->entity()->getPadByIndex(0);\n+\tconst MediaPad *pad = (csi_ ? csi_ : isp_)->entity()->getPadByIndex(0);\n \tfor (MediaLink *link : pad->links()) {\n \t\tif (link->source()->entity() != sensor->entity())\n \t\t\tcontinue;\n@@ -907,6 +914,18 @@ int PipelineHandlerRkISP1::initLinks(Camera *camera,\n \t\t\treturn ret;\n \t}\n \n+\tif (csi_) {\n+\t\tconst MediaPad *ispPad = isp_->entity()->getPadByIndex(0);\n+\t\tfor (MediaLink *link : ispPad->links()) {\n+\t\t\tif (link->source()->entity() != csi_->entity())\n+\t\t\t\tcontinue;\n+\n+\t\t\tret = link->setEnabled(true);\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n \tfor (const StreamConfiguration &cfg : config) {\n \t\tif (cfg.stream() == &data->mainPathStream_)\n \t\t\tret = data->mainPath_->setEnabled(true);\n@@ -1005,6 +1024,18 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n \tif (isp_->open() < 0)\n \t\treturn false;\n \n+\tpad = isp_->entity()->getPadByIndex(0);\n+\tif (!pad || pad->links().size() != 1)\n+\t\treturn false;\n+\n+\tcsi_ = std::make_unique<V4L2Subdevice>(pad->links().at(0)->source()->entity());\n+\tif (!csi_ || csi_->open() < 0)\n+\t\treturn false;\n+\n+\t/* If the media device has no 1th pad, it's the sensor */\n+\tif (!csi_->entity()->getPadByIndex(1))\n+\t\tcsi_ = nullptr;\n+\n \t/* Locate and open the stats and params video nodes. */\n \tstat_ = V4L2VideoDevice::fromEntityName(media_, \"rkisp1_stats\");\n \tif (stat_->open() < 0)\n@@ -1030,7 +1061,7 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n \t * Enumerate all sensors connected to the ISP and create one\n \t * camera instance for each of them.\n \t */\n-\tpad = isp_->entity()->getPadByIndex(0);\n+\tpad = (csi_ ? csi_ : isp_)->entity()->getPadByIndex(0);\n \tif (!pad)\n \t\treturn false;\n \n","prefixes":["libcamera-devel"]}