{"id":16297,"url":"https://patchwork.libcamera.org/api/patches/16297/?format=json","web_url":"https://patchwork.libcamera.org/patch/16297/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20220620210658.20288-5-laurent.pinchart@ideasonboard.com>","date":"2022-06-20T21:06:58","name":"[libcamera-devel,4/4] utils: rkisp1: Support optional CSI-2 receiver subdev","commit_ref":"a5877e03072c9578cd97a84f4db1106f24a588a9","pull_url":null,"state":"accepted","archived":false,"hash":"061b05e9450493aa673540ba5cc9268c10c32777","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16297/mbox/","series":[{"id":3197,"url":"https://patchwork.libcamera.org/api/series/3197/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3197","date":"2022-06-20T21:06:54","name":"utils: rkisp1: Miscellaneous capture script updates","version":1,"mbox":"https://patchwork.libcamera.org/series/3197/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16297/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16297/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 A36E3BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jun 2022 21:07:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 44AD165641;\n\tMon, 20 Jun 2022 23:07:25 +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 58D076563B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jun 2022 23:07:19 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8721BE5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jun 2022 23:07:18 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655759245;\n\tbh=0fhs8ySHonSCSmy5HzMPEw4hKvUUaLrUIVBKAopcUnw=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=H9QkfXWaH6YfHx6+SMiF66Ntan1oN7IGDG2rpS90scUeyIUMaIRxazGQ347PoMmVk\n\tNJGSnPwf69nrGW4rRGLyKhmZ7HPe9lCsyEoRZL8n7IEFAOkke7Mcuv16stW+ynh4OY\n\tu+LNxvq3wTyQ08Y6K1kjgFEgZVdqxlPcGSJEG2A1tLHTn9GK9XBN56JWVG0yw4y8/j\n\t/j/LRVBkEPsLcvEsnewlS/ROFe2D5g2JcqaaTIN3edqoeD4SVj52v55sVnIgdjg2p3\n\tbBvUXPy297USozp5uZ+6C+utCb49zOea1WTi4NsililOsDotTO4VAjF2/u2II3K5Fm\n\tdd8IH7CCVFIXA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655759238;\n\tbh=0fhs8ySHonSCSmy5HzMPEw4hKvUUaLrUIVBKAopcUnw=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=p/6JClEh94tFA4ezDEvHVBuaQSxsQ5l8amMiuvKmNpG9zK0F+OVl5arWcHcB3WQox\n\tatzSB+0ZU0Tl8wYjQ4iwX5txH+SSmqzHWouyakzdjbvpRAzlkCp0W1iCrZU0ujejiF\n\t4VE0YhxQ/FrppiQXEgyoiMxm/qrtiV4e4iTpxgdk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"p/6JClEh\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 21 Jun 2022 00:06:58 +0300","Message-Id":"<20220620210658.20288-5-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220620210658.20288-1-laurent.pinchart@ideasonboard.com>","References":"<20220620210658.20288-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 4/4] utils: rkisp1: Support optional CSI-2\n\treceiver subdev","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The media graph may include a CSI-2 receiver entity between the sensor\nand the ISP for platforms that have a CSI-2 receiver external to the\nISP. Support this by configuring the pipeline accordingly.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/rkisp1/rkisp1-capture.sh | 56 +++++++++++++++++++++++++++++++++-\n 1 file changed, 55 insertions(+), 1 deletion(-)","diff":"diff --git a/utils/rkisp1/rkisp1-capture.sh b/utils/rkisp1/rkisp1-capture.sh\nindex 2549779d0f78..c5f859f21001 100755\n--- a/utils/rkisp1/rkisp1-capture.sh\n+++ b/utils/rkisp1/rkisp1-capture.sh\n@@ -14,6 +14,37 @@\n # - raw2rgbpnm (from git://git.retiisi.org.uk/~sailus/raw2rgbpnm.git)\n # - yavta (from git://git.ideasonboard.org/yavta.git)\n \n+# Return the entity connected to a given pad\n+# $1: The pad, expressed as \"entity\":index\n+mc_remote_entity() {\n+\tlocal entity=\"${1%:*}\"\n+\tlocal pad=\"${1#*:}\"\n+\n+\t${mediactl} -p | awk '\n+/^- entity / {\n+\tin_entity=0\n+}\n+\n+/^- entity [0-9]+: '\"${entity}\"' / {\n+\tin_entity=1\n+}\n+\n+/^[ \\t]+pad/ {\n+\tin_pad=0\n+}\n+\n+/^[ \\t]+pad'\"${pad}\"': / {\n+\tin_pad=1\n+}\n+\n+/^[ \\t]+(<-|->) \"[^\"]+\"/ {\n+\tif (in_entity && in_pad) {\n+\t\tprint gensub(/^[^\"]+\"([^\"]+)\":([0-9]+).*$/, \"\\\\1\", \"g\")\n+\t\texit\n+\t}\n+}'\n+}\n+\n # Locate the sensor entity\n find_sensor() {\n \tlocal bus\n@@ -28,6 +59,17 @@ find_sensor() {\n \techo \"$sensor_name $bus\"\n }\n \n+# Locate the CSI-2 receiver\n+find_csi2_rx() {\n+\tlocal sensor_name=$1\n+\tlocal csi2_rx\n+\n+\tcsi2_rx=$(mc_remote_entity \"$sensor_name:0\")\n+\tif [ \"$csi2_rx\" != rkisp1_isp ] ; then\n+\t\techo \"$csi2_rx\"\n+\tfi\n+}\n+\n # Locate the media device\n find_media_device() {\n \tlocal mdev\n@@ -63,15 +105,27 @@ configure_pipeline() {\n \tlocal format=\"fmt:$sensor_mbus_code/$sensor_size\"\n \tlocal capture_mbus_code=$1\n \tlocal capture_size=$2\n+\tlocal csi2_rx\n \n \techo \"Configuring pipeline for $sensor in $format\"\n \n+\tcsi2_rx=$(find_csi2_rx \"$sensor\")\n+\n \t$mediactl -r\n \n-\t$mediactl -l \"'$sensor':0 -> 'rkisp1_isp':0 [1]\"\n+\tif [ -n \"$csi2_rx\" ] ; then\n+\t\t$mediactl -l \"'$sensor':0 -> '$csi2_rx':0 [1]\"\n+\t\t$mediactl -l \"'$csi2_rx':1 -> 'rkisp1_isp':0 [1]\"\n+\telse\n+\t\t$mediactl -l \"'$sensor':0 -> 'rkisp1_isp':0 [1]\"\n+\tfi\n \t$mediactl -l \"'rkisp1_isp':2 -> 'rkisp1_resizer_mainpath':0 [1]\"\n \n \t$mediactl -V \"\\\"$sensor\\\":0 [$format]\"\n+\tif [ -n \"$csi2_rx\" ] ; then\n+\t\t$mediactl -V \"'$csi2_rx':0 [$format]\"\n+\t\t$mediactl -V \"'$csi2_rx':1 [$format]\"\n+\tfi\n \t$mediactl -V \"'rkisp1_isp':0 [$format crop:(0,0)/$sensor_size]\"\n \t$mediactl -V \"'rkisp1_isp':2 [fmt:$capture_mbus_code/$sensor_size crop:(0,0)/$sensor_size]\"\n \t$mediactl -V \"'rkisp1_resizer_mainpath':0 [fmt:$capture_mbus_code/$sensor_size crop:(0,0)/$sensor_size]\"\n","prefixes":["libcamera-devel","4/4"]}