Show a patch.

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

{
    "id": 17932,
    "url": "https://patchwork.libcamera.org/api/patches/17932/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17932/",
    "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": "<20221201145133.479794-4-umang.jain@ideasonboard.com>",
    "date": "2022-12-01T14:51:31",
    "name": "[libcamera-devel,3/5] ipa: raspberrypi: Control the lens position",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "ca9dbd5cd61604471b70b9c28c907862cf8640e1",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17932/mbox/",
    "series": [
        {
            "id": 3653,
            "url": "https://patchwork.libcamera.org/api/series/3653/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3653",
            "date": "2022-12-01T14:51:28",
            "name": "ipa: rapsberrypi: Introduce auto-focus (auto-mode)",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3653/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17932/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17932/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 2E549BE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  1 Dec 2022 14:52:48 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 001366333F;\n\tThu,  1 Dec 2022 15:52:47 +0100 (CET)",
            "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 BB0A663345\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  1 Dec 2022 15:52:45 +0100 (CET)",
            "from umang.jainideasonboard.com (unknown [210.186.188.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B09FC6D0;\n\tThu,  1 Dec 2022 15:52:44 +0100 (CET)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669906368;\n\tbh=/fb3lBrt+3qWxFcKDt5/FgOcDcBWLu/Xq10njz/52Bw=;\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=jFzlvI/6Ln8/yufVYuG7v1qRT9bwngJwcUAT+XCcOzUx9lAWbSjgzEAESpY0nP1F8\n\tB4k009BDPG72mNSS78ozuVfy/+aLKRsPhrtEY3/7/lHMkFPVqCLtUoba9IlyfqMZgA\n\tCPUY6b9e3UETEu7bdyeHS7xz3WenXUUdbnT1EUPPrqrBEGKpoFPOLpMLKE3Gnzuyow\n\t+/XOmLa/i0KuhyTqxa0CToYRPhBw7ZMwq15W07LH2jc6LyGKzd7TC7puCKHnSfUs9z\n\txz4WZAfuifTsQyxmZsMc5sU4YXfwxp/+hByxw3SnFAANhfSREzeCr3aQ4/Sxnmgz2i\n\t+5RF4d+S1f+kA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1669906365;\n\tbh=/fb3lBrt+3qWxFcKDt5/FgOcDcBWLu/Xq10njz/52Bw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=sBHAgOHALLz4XhNo/aHX/dWbhswV9AyuSYKPkZBs2IfX/FmpUYVHcovzYNK1yhHmY\n\tFFQm/LZTVrw+hbfIZqhzn0qFq11sRVJRNX4Q4jqDQ7XnPfCRcsRiw2Ja7lCw0XkfNe\n\tMq+YV1JosMsB+/HrbUQiYCX9ZofepO8bYys9PJiY="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"sBHAgOHA\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  1 Dec 2022 22:51:31 +0800",
        "Message-Id": "<20221201145133.479794-4-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.38.1",
        "In-Reply-To": "<20221201145133.479794-1-umang.jain@ideasonboard.com>",
        "References": "<20221201145133.479794-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 3/5] 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": "Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Umang Jain <umang.jain@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n\nNow 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 4e10c57d..3d1ac8fc 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.h\"\n #include \"agc_status.h\"\n #include \"alsc_status.h\"\n@@ -131,6 +132,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@@ -155,6 +157,7 @@ private:\n \n \tControlInfoMap sensorCtrls_;\n \tControlInfoMap ispCtrls_;\n+\tControlInfoMap lensCtrls_;\n \tControlList libcameraMetadata_;\n \n \t/* Camera sensor params. */\n@@ -381,7 +384,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@@ -389,6 +392,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@@ -650,6 +661,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",
        "3/5"
    ]
}