Patch Detail
Show a patch.
GET /api/patches/15411/?format=api
{ "id": 15411, "url": "https://patchwork.libcamera.org/api/patches/15411/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15411/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220303234956.1463551-5-djrscally@gmail.com>", "date": "2022-03-03T23:49:51", "name": "[libcamera-devel,v5,4/9] libcamera: camera_sensor: Discover VCMs through ancillary links", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "4275b9048c32a28dd949243e021b4c38b1f6a7c9", "submitter": { "id": 90, "url": "https://patchwork.libcamera.org/api/people/90/?format=api", "name": "Daniel Scally", "email": "djrscally@gmail.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15411/mbox/", "series": [ { "id": 2950, "url": "https://patchwork.libcamera.org/api/series/2950/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2950", "date": "2022-03-03T23:49:47", "name": "Enumerate CameraLens by following sensor's ancillary links", "version": 5, "mbox": "https://patchwork.libcamera.org/series/2950/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15411/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15411/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 8211CC3261\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 3 Mar 2022 23:50:19 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5639B61182;\n\tFri, 4 Mar 2022 00:50:18 +0100 (CET)", "from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1FB0E61176\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 4 Mar 2022 00:50:15 +0100 (CET)", "by mail-wr1-x433.google.com with SMTP id bk29so10163872wrb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 03 Mar 2022 15:50:15 -0800 (PST)", "from localhost.localdomain\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161])\n\tby smtp.gmail.com with ESMTPSA id\n\ty4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.14\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 03 Mar 2022 15:50:14 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Rm9zDpkt\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=128dFyAg2PNBEd0fhzKmD9q8NNW0ZCeVDo9P+9Rq/4c=;\n\tb=Rm9zDpktK7Ias0l7VjZ7Bdz1EtYai+HxVR3h7S4v1daWHz3pJ2e7rdB6Z9fpyVeo5N\n\t7CPU6oQYNpSBkRVHZY5kEKu1mmQQIypmQbBN+fzbLUKoNDks7oWB5Qw3gAOs29pzMACt\n\tBLvBl7AS6vAm1n/vcEMFAdfFqojriQXYFYnIzLkFCyRsf6WYvtIS6+Ckj1rLIZYAZvO7\n\tIREdVkItqFB+P/e9Yw69gaJwoz106A9VCIu5/rXR5HQePHScmfELvS1KYUWdsfFHsUaD\n\tsmNM0tRCSGcqjkHTpLXnSwESJi/35keqEstohSPJeEMygJtfno/BjDQmVjS0k93Jtzpm\n\tuqgg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=128dFyAg2PNBEd0fhzKmD9q8NNW0ZCeVDo9P+9Rq/4c=;\n\tb=Ar0Z8y8lm5pdT52fxUaJqRSq9VEZx31o+tvIsHdZcAGOjIFBNXRcEcuiXwaERs7nQz\n\tqBiNBwxGyTgSx78jZp0xOh+0tHw7qtVFWK14ITMDUzMlCBiknsf1L8o/Zr11FUBFUGmV\n\tqXq1ExXDbKCpRNfQ5BkeO4JijWHVBSgXOsL5O4PDUcM625vwVLHKSipvDwefzaHpJS+Q\n\t0mFIIh109jp/HVlOaG+S68Hf9NzxAowAicDYVZjjBiWG4eJGmRYb3Wlnv0EHpsUzImOR\n\tmvGFNC9y7++C1EIIOzgxqXZ/WtmK8DyedsN9OaA+qkaxzx5zaRS/Kh1hD5AoT0BMKgRK\n\t8APw==", "X-Gm-Message-State": "AOAM531fT3LSGlIuUjSnhIaLgMfNPWFdJUKXkHkfZhdokCn3jd01RIql\n\ta3tcO3nYG4PpPnOO9ArBX311SIEHXjPAgg==", "X-Google-Smtp-Source": "ABdhPJwjffwdFySYzQElizKhQ2O5qmZhT79Kklg2SZ+wB09F4tvok3AOFQfVEb2A65av+t1pCAfXKA==", "X-Received": "by 2002:a5d:584d:0:b0:1f0:48d9:692f with SMTP id\n\ti13-20020a5d584d000000b001f048d9692fmr5555003wrf.566.1646351414835; \n\tThu, 03 Mar 2022 15:50:14 -0800 (PST)", "From": "Daniel Scally <djrscally@gmail.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 3 Mar 2022 23:49:51 +0000", "Message-Id": "<20220303234956.1463551-5-djrscally@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220303234956.1463551-1-djrscally@gmail.com>", "References": "<20220303234956.1463551-1-djrscally@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 4/9] libcamera: camera_sensor: Discover\n\tVCMs through ancillary links", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a function to check for and initialise any VCMs linked to the\nCameraSensor's entity by ancillary links. This should initialise\nthe lens_ member with the linked entity. Call the new function\nduring CameraSensor::init().\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Daniel Scally <djrscally@gmail.com>\n---\nChanges in v5:\n\n\t- Add a break to the default case\n\nChanges in v4:\n\n\t- Fixed typo (Laurent)\n\nChanges in v3:\n\n\t- Fixed some style errors\n\t- Replaced the flash case by printing the entity function in the \n\tdefault case.\n\n include/libcamera/internal/camera_sensor.h | 1 +\n src/libcamera/camera_sensor.cpp | 40 ++++++++++++++++++++++\n 2 files changed, 41 insertions(+)", "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 2fa11567..7fb4eded 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -81,6 +81,7 @@ private:\n \tvoid initTestPatternModes();\n \tint initProperties();\n \tint applyTestPatternMode(controls::draft::TestPatternModeEnum mode);\n+\tint discoverAncillaryDevices();\n \n \tconst MediaEntity *entity_;\n \tstd::unique_ptr<V4L2Subdevice> subdev_;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 64f7f12c..8b4406fe 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -172,6 +172,10 @@ int CameraSensor::init()\n \tif (ret)\n \t\treturn ret;\n \n+\tret = discoverAncillaryDevices();\n+\tif (ret)\n+\t\treturn ret;\n+\n \treturn applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff);\n }\n \n@@ -443,6 +447,42 @@ int CameraSensor::initProperties()\n \treturn 0;\n }\n \n+/**\n+ * \\brief Check for and initialise any ancillary devices\n+ *\n+ * Sensors sometimes have ancillary devices such as a Lens or Flash that could\n+ * be linked to their MediaEntity by the kernel. Search for and handle any\n+ * such device.\n+ *\n+ * \\todo Handle MEDIA_ENT_F_FLASH too.\n+ */\n+int CameraSensor::discoverAncillaryDevices()\n+{\n+\tint ret;\n+\n+\tfor (MediaEntity *ancillary : entity_->ancillaryEntities()) {\n+\t\tswitch (ancillary->function()) {\n+\t\tcase MEDIA_ENT_F_LENS:\n+\t\t\tfocusLens_ = std::make_unique<CameraLens>(ancillary);\n+\t\t\tret = focusLens_->init();\n+\t\t\tif (ret) {\n+\t\t\t\tLOG(CameraSensor, Error)\n+\t\t\t\t\t<< \"CameraLens initialisation failed\";\n+\t\t\t\treturn ret;\n+\t\t\t}\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\tLOG(CameraSensor, Warning)\n+\t\t\t\t<< \"Unsupported ancillary entity function \"\n+\t\t\t\t<< ancillary->function();\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n /**\n * \\fn CameraSensor::model()\n * \\brief Retrieve the sensor model name\n", "prefixes": [ "libcamera-devel", "v5", "4/9" ] }