Show a patch.

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

{
    "id": 15458,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15458/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15458/",
    "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": "<20220316093951.33779-2-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2022-03-16T09:39:51",
    "name": "[libcamera-devel,2/2] ipa: raspberrypi: Control the lens position",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ceb62ac1bc1ccdc427a954822f9743be5c2a170b",
    "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/15458/mbox/",
    "series": [
        {
            "id": 2966,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2966/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2966",
            "date": "2022-03-16T09:39:50",
            "name": "[libcamera-devel,1/2] libcamera: raspberrypi: Control the lens from pipeline",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2966/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15458/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15458/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\r\n\t[92.243.16.209])\r\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4324CC3262\r\n\tfor <parsemail@patchwork.libcamera.org>;\r\n\tWed, 16 Mar 2022 09:39:59 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DD9B8632E2;\r\n\tWed, 16 Mar 2022 10:39:57 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\r\n\t[213.167.242.64])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D33F5604E7\r\n\tfor <libcamera-devel@lists.libcamera.org>;\r\n\tWed, 16 Mar 2022 10:39:55 +0100 (CET)",
            "from tatooine.ideasonboard.com (unknown\r\n\t[IPv6:2a01:e0a:169:7140:3036:4976:879c:5c94])\r\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 765BEA67;\r\n\tWed, 16 Mar 2022 10:39:55 +0100 (CET)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\r\n\ts=mail; t=1647423597;\r\n\tbh=39nx0jN/BSL7NAeiCDh5ROPoY0goom8ufH1EyAcYehc=;\r\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\r\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\r\n\tFrom;\r\n\tb=zzhQSASIi6J031zRZjd5uwcNfUa/0DBexHQVlvCiwWplqOQ6z2PbF+Nb7N24LU8iy\r\n\tiKZ+p3BJ9Z8LgFZslncJgyV4DL9QY7Vv7r2Whp2JcgxnRlhFXgoTpEaT7qPuE+vRT7\r\n\tmgMbxjI55vdR6JUpAW0kpi6XPMrZwzs7GE3wvY5YaVI65v5QqAZlX1O+cNLIuG//E1\r\n\tuKbn1hJ/I8hnE2CbT8PIcLDLbrvefSyn46tQ4FgkbONbfdr/3vqnYr5pMEy2rJEjK7\r\n\td3FBqmmDUNIlO+ZJhjSQmyifEktClWVMrAZMk88mCTTpxOwwGeUWsOQ6iRJOoK2kRS\r\n\tc5+ZCJCH6He9Q==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\r\n\ts=mail; t=1647423595;\r\n\tbh=39nx0jN/BSL7NAeiCDh5ROPoY0goom8ufH1EyAcYehc=;\r\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\r\n\tb=vQgYOi1Q5xP7KwL50i4O5pB2KJNaIcfOY84seeRzlCz0UZMUtk9bSZu1VKg8wKFMy\r\n\tPeRzGiMB83GOG6f8z/rQfGs+CDRwq6WT5asEiXa6JunrMGiYs3q3rFCUBHuCJPRKum\r\n\tscatF/6Zeo1vrMYebTjsFwjcUT/AfKr3yKu29KgU="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \r\n\tunprotected) header.d=ideasonboard.com\r\n\theader.i=@ideasonboard.com\r\n\theader.b=\"vQgYOi1Q\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 16 Mar 2022 10:39:51 +0100",
        "Message-Id": "<20220316093951.33779-2-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20220316093951.33779-1-jeanmichel.hautbois@ideasonboard.com>",
        "References": "<20220316093951.33779-1-jeanmichel.hautbois@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/2] ipa: raspberrypi: Control the lens\r\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>,\r\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>,\r\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "From": "Jean-Michel Hautbois via libcamera-devel\r\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.\nFor now, force a default value for the lens position, until the AF\nalgorithm is introduced.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 38 +++++++++++++++++++++++++++--\n 1 file changed, 36 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\r\nindex fd8fecb0..0a0b5a3a 100644\r\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\r\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\r\n@@ -108,6 +108,7 @@ private:\r\n \tvoid setMode(const IPACameraSensorInfo &sensorInfo);\r\n \tbool validateSensorControls();\r\n \tbool validateIspControls();\r\n+\tbool validateLensControls();\r\n \tvoid queueRequest(const ControlList &controls);\r\n \tvoid returnEmbeddedBuffer(unsigned int bufferId);\r\n \tvoid prepareISP(const ipa::RPi::ISPConfig &data);\r\n@@ -132,6 +133,7 @@ private:\r\n \r\n \tControlInfoMap sensorCtrls_;\r\n \tControlInfoMap ispCtrls_;\r\n+\tControlInfoMap lensCtrls_;\r\n \tControlList libcameraMetadata_;\r\n \r\n \t/* Camera sensor params. */\r\n@@ -342,13 +344,14 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\r\n \t\t      const ipa::RPi::IPAConfig &ipaConfig,\r\n \t\t      ControlList *controls)\r\n {\r\n-\tif (entityControls.size() != 2) {\r\n-\t\tLOG(IPARPI, Error) << \"No ISP or sensor controls found.\";\r\n+\tif (entityControls.size() != 3) {\r\n+\t\tLOG(IPARPI, Error) << \"No ISP, lens or sensor controls found.\";\r\n \t\treturn -1;\r\n \t}\r\n \r\n \tsensorCtrls_ = entityControls.at(0);\r\n \tispCtrls_ = entityControls.at(1);\r\n+\tlensCtrls_ = entityControls.at(2);\r\n \r\n \tif (!validateSensorControls()) {\r\n \t\tLOG(IPARPI, Error) << \"Sensor control validation failed.\";\r\n@@ -360,6 +363,11 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\r\n \t\treturn -1;\r\n \t}\r\n \r\n+\tif (!validateLensControls()) {\r\n+\t\tLOG(IPARPI, Error) << \"Lens control validation failed.\";\r\n+\t\treturn -1;\r\n+\t}\r\n+\r\n \tmaxSensorGainCode_ = sensorCtrls_.at(V4L2_CID_ANALOGUE_GAIN).max().get<int32_t>();\r\n \r\n \t/* Setup a metadata ControlList to output metadata. */\r\n@@ -578,6 +586,23 @@ bool IPARPi::validateIspControls()\r\n \treturn true;\r\n }\r\n \r\n+bool IPARPi::validateLensControls()\r\n+{\r\n+\tstatic const uint32_t ctrls[] = {\r\n+\t\tV4L2_CID_FOCUS_ABSOLUTE,\r\n+\t};\r\n+\r\n+\tfor (auto c : ctrls) {\r\n+\t\tif (lensCtrls_.find(c) == lensCtrls_.end()) {\r\n+\t\t\tLOG(IPARPI, Error) << \"Unable to find lens control \"\r\n+\t\t\t\t\t   << utils::hex(c);\r\n+\t\t\treturn false;\r\n+\t\t}\r\n+\t}\r\n+\r\n+\treturn true;\r\n+}\r\n+\r\n /*\r\n  * Converting between enums (used in the libcamera API) and the names that\r\n  * we use to identify different modes. Unfortunately, the conversion tables\r\n@@ -1066,6 +1091,15 @@ void IPARPi::processStats(unsigned int bufferId)\r\n \r\n \t\tsetDelayedControls.emit(ctrls);\r\n \t}\r\n+\r\n+\t/*\r\n+\t * Set the focus position\r\n+\t * \\todo Use an AF algorithm and replace the arbitrary value\r\n+\t */\r\n+\tControlList lensCtrls(lensCtrls_);\r\n+\tlensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast<int32_t>(123));\r\n+\tsetLensControls.emit(lensCtrls);\r\n+\r\n }\r\n \r\n void IPARPi::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls)",
    "prefixes": [
        "libcamera-devel",
        "2/2"
    ]
}