{"id":19290,"url":"https://patchwork.libcamera.org/api/patches/19290/?format=json","web_url":"https://patchwork.libcamera.org/patch/19290/","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":"<20231206114307.94241-2-jacopo.mondi@ideasonboard.com>","date":"2023-12-06T11:43:05","name":"[libcamera-devel,v3,2/4] ipa: rpi: Provide a Camera Helper for the OV64A40","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"0a89c64225c12790af2347e8bc701501db120355","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19290/mbox/","series":[{"id":4107,"url":"https://patchwork.libcamera.org/api/series/4107/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4107","date":"2023-12-06T11:40:44","name":"ipa: Add support for Arducam OV64A40","version":3,"mbox":"https://patchwork.libcamera.org/series/4107/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19290/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19290/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 E3317C32BC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Dec 2023 11:43:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 86BC6629DC;\n\tWed,  6 Dec 2023 12:43:24 +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 172CB629DC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Dec 2023 12:43:22 +0100 (CET)","from localhost.localdomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 49F7FE45;\n\tWed,  6 Dec 2023 12:42:41 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701863004;\n\tbh=wc0KAwvhiTNCw8hGq7rRLgZ71Qhfpucra5q8wIcnAPk=;\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:Cc:\n\tFrom;\n\tb=ppuOLPxAEFkAM7o1r0RHa/zeQ3tUAYbKR4B1pDfGEBgxFqA7LeEE2QWdg5QIGXsmh\n\tVAZFnNkq7w2KVF2KWFBVDO0aCghWFCURirwYcKMo9KT3kk7geKPsfHNGHa9JTflaDM\n\tSKkkZ0J8L/nkmGYLcgCD+wdUspQN2zraQ4jFN1xrLnSzgPBvAT70EDz79BqE+F0Ul2\n\tMnKybR7qV1SLrQABijH/wumJdNKUflvM7wbGroLc9bIiUnFMC4dWEqp5o8CzMGijRY\n\tMxt/co6iIerjjeRzgnFOhMZhzPm3RowiU0N0qnNoE3/4861uyoMvR5vIUk9ktmSdfV\n\ti8EhzRv5e3+rA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1701862961;\n\tbh=wc0KAwvhiTNCw8hGq7rRLgZ71Qhfpucra5q8wIcnAPk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=PA1AbDdB/8sqLgv1RtH3YjFhRdJbapHgDVeBa+FR19lRppb71L9CpnuWIgaD8IADJ\n\tMgLLrX0j/fUWdwU+5aVOKwNNqdhoLNGLGwEnyHreaxeQ8dH9VgvHYZ8sYW8hNsNKxJ\n\tFUJBUU19rxvCnC4vtQhzfPeVvhOuypYgclASaNEo="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"PA1AbDdB\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  6 Dec 2023 12:43:05 +0100","Message-ID":"<20231206114307.94241-2-jacopo.mondi@ideasonboard.com>","X-Mailer":"git-send-email 2.41.0","In-Reply-To":"<20231206114307.94241-1-jacopo.mondi@ideasonboard.com>","References":"<20231206114044.94068-1-jacopo.mondi@ideasonboard.com>\n\t<20231206114307.94241-1-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 2/4] ipa: rpi: Provide a Camera Helper\n\tfor the OV64A40","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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Support the OV64A40 sensor with a camera helper to manage the gain\nmodel, light sensitivity, and control delays.\n\nSigned-off-by: Lee Jackson <lee.jackson@arducam.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp | 73 +++++++++++++++++++\n src/ipa/rpi/cam_helper/meson.build            |  1 +\n 2 files changed, 74 insertions(+)\n create mode 100644 src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp","diff":"diff --git a/src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp b/src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp\nnew file mode 100644\nindex 000000000000..4575cc4e11d7\n--- /dev/null\n+++ b/src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp\n@@ -0,0 +1,73 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2021, Raspberry Pi Ltd\n+ *\n+ * cam_helper_ov64a40.cpp - camera information for ov64a40 sensor\n+ */\n+\n+#include <assert.h>\n+\n+#include \"cam_helper.h\"\n+\n+using namespace RPiController;\n+\n+class CamHelperOv64a40 : public CamHelper\n+{\n+public:\n+\tCamHelperOv64a40();\n+\tuint32_t gainCode(double gain) const override;\n+\tdouble gain(uint32_t gainCode) const override;\n+\tvoid getDelays(int &exposureDelay, int &gainDelay,\n+\t\t       int &vblankDelay, int &hblankDelay) const override;\n+\tdouble getModeSensitivity(const CameraMode &mode) const override;\n+\n+private:\n+\t/*\n+\t * Smallest difference between the frame length and integration time,\n+\t * in units of lines.\n+\t */\n+\tstatic constexpr int frameIntegrationDiff = 32;\n+};\n+\n+CamHelperOv64a40::CamHelperOv64a40()\n+\t: CamHelper({}, frameIntegrationDiff)\n+{\n+}\n+\n+uint32_t CamHelperOv64a40::gainCode(double gain) const\n+{\n+\treturn static_cast<uint32_t>(gain * 128.0);\n+}\n+\n+double CamHelperOv64a40::gain(uint32_t gainCode) const\n+{\n+\treturn static_cast<double>(gainCode) / 128.0;\n+}\n+\n+void CamHelperOv64a40::getDelays(int &exposureDelay, int &gainDelay,\n+\t\t\t\t int &vblankDelay, int &hblankDelay) const\n+{\n+\t/* The driver appears to behave as follows: */\n+\texposureDelay = 2;\n+\tgainDelay = 2;\n+\tvblankDelay = 2;\n+\thblankDelay = 2;\n+}\n+\n+double CamHelperOv64a40::getModeSensitivity(const CameraMode &mode) const\n+{\n+\tif (mode.binX >= 2 && mode.scaleX >= 4) {\n+\t\treturn 4.0;\n+\t} else if (mode.binX >= 2 && mode.scaleX >= 2) {\n+\t\treturn 2.0;\n+\t} else {\n+\t\treturn 1.0;\n+\t}\n+}\n+\n+static CamHelper *create()\n+{\n+\treturn new CamHelperOv64a40();\n+}\n+\n+static RegisterCamHelper reg(\"ov64a40\", &create);\ndiff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build\nindex bdf2db8eb742..7262505742f3 100644\n--- a/src/ipa/rpi/cam_helper/meson.build\n+++ b/src/ipa/rpi/cam_helper/meson.build\n@@ -9,6 +9,7 @@ rpi_ipa_cam_helper_sources = files([\n     'cam_helper_imx477.cpp',\n     'cam_helper_imx519.cpp',\n     'cam_helper_imx708.cpp',\n+    'cam_helper_ov64a40.cpp',\n     'cam_helper_ov9281.cpp',\n     'md_parser_smia.cpp',\n ])\n","prefixes":["libcamera-devel","v3","2/4"]}