Show a patch.

GET /api/1.1/patches/16212/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 16212,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16212/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16212/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20220613142853.98484-4-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2022-06-13T14:28:46",
    "name": "[libcamera-devel,03/10] ipa: raspberrypi: Control the lens position",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "620fbdab148906d0231d668dd6d303e7b7502dc0",
    "submitter": {
        "id": 75,
        "url": "https://patchwork.libcamera.org/api/1.1/people/75/?format=api",
        "name": "Jean-Michel Hautbois",
        "email": "jeanmichel.hautbois@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16212/mbox/",
    "series": [
        {
            "id": 3174,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3174/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3174",
            "date": "2022-06-13T14:28:43",
            "name": "ipa: raspberrypi: Introduce an autofocus algorithm",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3174/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16212/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16212/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 DC6FFC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Jun 2022 14:29:08 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2BD9565652;\n\tMon, 13 Jun 2022 16:29:06 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 93884600F1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jun 2022 16:29:00 +0200 (CEST)",
            "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:a1c7:c28c:7720:9b30])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 41ABD305;\n\tMon, 13 Jun 2022 16:29:00 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655130546;\n\tbh=rdz4OCdCQzkW6WAN4X6RgX/WInxGu7PZPMZvTejgqEo=;\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=l9EkuC31EkcGMw9VcL28eFznJBMgAwv0WzSqZtin8oK2Ls+zukQu/8naQznSEFl9a\n\tQJskUt/nAwpXXdc4RGan79i/3gOFEggqc458sqmS5EjrcUq+FArGnslvM9drZeddKW\n\t36DX2BBJfalLvk0jlUw6cv3tkAQlf1IKBX7B5bbJ/6BH5L1EeJmnOYxkmuMY1dqNry\n\tOqbOY7uyLmeElKg7dfH/hTIrQrBSiOannMSrcn30XwyFNaluwi2rPkahqxikrHo9lB\n\tIJTcKSrDv6rE308Tt/Af7wmcNe9bmnqi3M3e8lhToBq459TO89nVvxmM6dorOuNsgH\n\tiYzWCdLhJlQPA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655130540;\n\tbh=rdz4OCdCQzkW6WAN4X6RgX/WInxGu7PZPMZvTejgqEo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=rMv4jRdnc3hxEteD2SudNS6QnkKP2C370z9kFiZ2g8gyAJ+sn/c/7VKlU4vH3LTr1\n\tlMwo4tCwcc7gWVO4HxEzaIEEqyapuJpkRI/nK+IfoYtLXc+EIdnaGgPndW9Sn52hIi\n\tTQ7VgDdrH8Be10Mo2Tjn0hifXbwX+bxm0RMik+zU="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"rMv4jRdn\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 13 Jun 2022 16:28:46 +0200",
        "Message-Id": "<20220613142853.98484-4-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com>",
        "References": "<20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 03/10] ipa: raspberrypi: Control the lens\n\tposition",
        "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": "Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Now that the ancillary links are configured, we can use the CameraLens\nclass and control the VCM through the IPA.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 30 ++++++++++++++++++++++++++++-\n 1 file changed, 29 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 3b126bb5..1e9e2e61 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -30,6 +30,7 @@\n \n #include \"libcamera/internal/mapped_framebuffer.h\"\n \n+#include \"af_status.h\"\n #include \"agc_algorithm.hpp\"\n #include \"agc_status.h\"\n #include \"alsc_status.h\"\n@@ -110,6 +111,7 @@ private:\n \tvoid setMode(const IPACameraSensorInfo &sensorInfo);\n \tbool validateSensorControls();\n \tbool validateIspControls();\n+\tbool validateLensControls();\n \tvoid queueRequest(const ControlList &controls);\n \tvoid returnEmbeddedBuffer(unsigned int bufferId);\n \tvoid prepareISP(const ISPConfig &data);\n@@ -134,6 +136,7 @@ private:\n \n \tControlInfoMap sensorCtrls_;\n \tControlInfoMap ispCtrls_;\n+\tControlInfoMap lensCtrls_;\n \tControlList libcameraMetadata_;\n \n \t/* Camera sensor params. */\n@@ -346,7 +349,7 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n \t\t      const IPAConfig &ipaConfig,\n \t\t      ControlList *controls, IPAConfigResult *result)\n {\n-\tif (entityControls.size() != 2) {\n+\tif (entityControls.size() < 2) {\n \t\tLOG(IPARPI, Error) << \"No ISP or sensor controls found.\";\n \t\treturn -1;\n \t}\n@@ -354,6 +357,14 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n \tsensorCtrls_ = entityControls.at(0);\n \tispCtrls_ = entityControls.at(1);\n \n+\t/* Lens may not be present, don't make it an hard assumption. */\n+\tauto lensControl = entityControls.find(2);\n+\tif (lensControl != entityControls.end()) {\n+\t\tlensCtrls_ = lensControl->second;\n+\t\tif (!validateLensControls())\n+\t\t\tLOG(IPARPI, Error) << \"Lens control validation failed.\";\n+\t}\n+\n \tif (!validateSensorControls()) {\n \t\tLOG(IPARPI, Error) << \"Sensor control validation failed.\";\n \t\treturn -1;\n@@ -585,6 +596,23 @@ bool IPARPi::validateIspControls()\n \treturn true;\n }\n \n+bool IPARPi::validateLensControls()\n+{\n+\tstatic const uint32_t ctrls[] = {\n+\t\tV4L2_CID_FOCUS_ABSOLUTE,\n+\t};\n+\n+\tfor (auto c : ctrls) {\n+\t\tif (lensCtrls_.find(c) == lensCtrls_.end()) {\n+\t\t\tLOG(IPARPI, Error) << \"Unable to find lens control \"\n+\t\t\t\t\t   << utils::hex(c);\n+\t\t\treturn false;\n+\t\t}\n+\t}\n+\n+\treturn true;\n+}\n+\n /*\n  * Converting between enums (used in the libcamera API) and the names that\n  * we use to identify different modes. Unfortunately, the conversion tables\n",
    "prefixes": [
        "libcamera-devel",
        "03/10"
    ]
}