{"id":26994,"url":"https://patchwork.libcamera.org/api/1.1/patches/26994/?format=json","web_url":"https://patchwork.libcamera.org/patch/26994/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20260618-imx678-v2-2-a288102744c3@ideasonboard.com>","date":"2026-06-18T14:56:42","name":"[v2,2/2] ipa: rpi: Add cam_helper for Sony IMX678","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"b6cf0a9f4cf424d82c6749fa58faca2bf70bc655","submitter":{"id":223,"url":"https://patchwork.libcamera.org/api/1.1/people/223/?format=json","name":"Jai Luthra","email":"jai.luthra@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26994/mbox/","series":[{"id":6007,"url":"https://patchwork.libcamera.org/api/1.1/series/6007/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6007","date":"2026-06-18T14:56:40","name":"libcamera: sensor: Add support for Sony IMX678","version":2,"mbox":"https://patchwork.libcamera.org/series/6007/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26994/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26994/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 B9C66BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Jun 2026 14:57:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6CAD362C75;\n\tThu, 18 Jun 2026 16:57:03 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8A53C6298D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 16:57:02 +0200 (CEST)","from mail.ideasonboard.com (unknown\n\t[IPv6:2401:4900:1c68:bcf2:9325:a9bd:32b:e71])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 28A2F227;\n\tThu, 18 Jun 2026 16:56:26 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"u12XxJP+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1781794587;\n\tbh=JsfOTL+qasRiJK4+dljFvLPGJ7p09j/bY124CnG8Qak=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=u12XxJP+4MYjjrmnFGpWu3DyT95qvghfrHvM8eeFwh5RR0nJemg4V7/0SLG25HdtZ\n\tqOey7yuZuQTrGSvn3tu8VbM5O2wQGOTYgmsgDITKJ+CVkUEIba3JkQMb2eVcVpMzZO\n\t0Gp1VMxyX+4VCMKnvA/n3O5mWqi06twA75lMlS8w=","From":"Jai Luthra <jai.luthra@ideasonboard.com>","Date":"Thu, 18 Jun 2026 20:26:42 +0530","Subject":"[PATCH v2 2/2] ipa: rpi: Add cam_helper for Sony IMX678","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260618-imx678-v2-2-a288102744c3@ideasonboard.com>","References":"<20260618-imx678-v2-0-a288102744c3@ideasonboard.com>","In-Reply-To":"<20260618-imx678-v2-0-a288102744c3@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>, \n\tJai Luthra <jai.luthra@ideasonboard.com>, will whang <will@willwhang.com>","X-Mailer":"b4 0.14.3","X-Developer-Signature":"v=1; a=openpgp-sha256; l=2991;\n\ti=jai.luthra@ideasonboard.com; h=from:subject:message-id;\n\tbh=CdH63icFtGaqAETY5q9PMVVZ6spYsQD6tH1ENx12DDs=;\n\tb=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBqNAcuBmKgk5+zLdWQR0cNo1eGIIQOvbwso8snO\n\tOkPpzHOb3qJAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCajQHLgAKCRBD3pH5JJpx\n\tRcCjEACMJ2xN8WdgtwGXu0OZm189q+RhjlVOVk2hbxchXW9nyL4McvSpubcJ7MgHqhlgQUXsNXN\n\tNFw7XNbLYINZsHh1gQvixFdSpkmjP3OILL9d4FkZS/sa6Uo2JJX1gmJLOx5+Wg3FeW95TuS97Ry\n\tGHZuEc1hcscxN2TiEs89anQpJ/gDitd8vD3GK5rqrDYcnEgYs+VkqNT5eu0NcFK8mcIIBT8awXF\n\tAw3OPOMmOpSQJ/mBTfcYaf4+SMySfMTspCSowwp3/ltsPPATiQ0B3gLhRyOIxybYoLmsxRMCV3S\n\tqB2DGrq/we76Qq3+5ZJ7ygYMg8ZxQjsfUbWmLFl+r8cYIF5k0HW4rGEahe1n4EsiWHzo8L89EOK\n\t0uy4cKzuvw6hHiLxmQAcKyjA9VtaC06qHMbPGETcI3s/5/kl9kPGz9vSsp8GpQPjIzLyLniwuly\n\tzCHiKvlP8goAkuEkHT3pFG4MESBwYvuM2fE9P7EaD8kvAXMu1Nmk3oeloqv41raYRNp8nqiI59q\n\tu8cRNiEsBImoYKgRwR/6TX3wYz1YfZIji4OIqwfwgETX1a/K/XdNQooRcCJKmZ+RaR4NMZ/3S/H\n\tidRgPs14jeW4Ji6MxW1W3Bsvgsj3fx9/yIXkB7tkcNrF0i0SHCJslGIz6zImbTmMo5dZbMeSYi3\n\tLQTbnTXEcQx/Tcg==","X-Developer-Key":"i=jai.luthra@ideasonboard.com; a=openpgp;\n\tfpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145","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":"From: will whang <will@willwhang.com>\n\nThis adds a basic cam helper for Sony IMX678, modelling the gain curve\nand the sensor limits for the maximum exposure time.\n\nLink: https://github.com/will127534/libcamera/commit/619459e7c70306ba18476\nSigned-off-by: will whang <will@willwhang.com>\nCo-developed-by: Jai Luthra <jai.luthra@ideasonboard.com>\nSigned-off-by: Jai Luthra <jai.luthra@ideasonboard.com>\n---\nChanges in v2:\n- Drop hideFramesStartup() and hideFramesModeSwitch()\n- Use std::pow() instead of pow()\n- Drop unnecessary includes, and include <algorithm> and <cmath> for\n  std::pow and std::min/max\n- Reword comment for embedded data, as the sensor supports it but the\n  driver currently does not\n- Cleanup more issues with whitespace\n- Add a Co-developed-by tag now that it's not a complete copy-paste\n- Update commit message\n---\n src/ipa/rpi/cam_helper/cam_helper_imx678.cpp | 56 ++++++++++++++++++++++++++++\n src/ipa/rpi/cam_helper/meson.build           |  1 +\n 2 files changed, 57 insertions(+)","diff":"diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx678.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx678.cpp\nnew file mode 100644\nindex 000000000..916433bf6\n--- /dev/null\n+++ b/src/ipa/rpi/cam_helper/cam_helper_imx678.cpp\n@@ -0,0 +1,56 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2026, Will Whang\n+ *\n+ * cam_helper_imx678.cpp - camera information for Sony IMX678 sensor\n+ */\n+\n+#include <algorithm>\n+#include <cmath>\n+\n+#include \"cam_helper.h\"\n+\n+using namespace RPiController;\n+\n+class CamHelperImx678 : public CamHelper\n+{\n+public:\n+\tCamHelperImx678();\n+\tuint32_t gainCode(double gain) const override;\n+\tdouble gain(uint32_t gainCode) 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 = 4;\n+};\n+\n+/*\n+ * IMX678 driver currently doesn't expose a metadata stream, so we have to use\n+ * the \"unicam parser\" which works by counting frames.\n+ */\n+\n+CamHelperImx678::CamHelperImx678()\n+\t: CamHelper({}, frameIntegrationDiff)\n+{\n+}\n+\n+uint32_t CamHelperImx678::gainCode(double gain) const\n+{\n+\tint code = 66.6667 * log10(gain);\n+\treturn std::max(0, std::min(code, 0xf0));\n+}\n+\n+double CamHelperImx678::gain(uint32_t gainCode) const\n+{\n+\treturn std::pow(10, 0.015 * gainCode);\n+}\n+\n+static CamHelper *create()\n+{\n+\treturn new CamHelperImx678();\n+}\n+\n+static RegisterCamHelper reg(\"imx678\", &create);\ndiff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build\nindex 87b6a3600..eabd55dce 100644\n--- a/src/ipa/rpi/cam_helper/meson.build\n+++ b/src/ipa/rpi/cam_helper/meson.build\n@@ -10,6 +10,7 @@ rpi_ipa_cam_helper_sources = files([\n     'cam_helper_imx415.cpp',\n     'cam_helper_imx477.cpp',\n     'cam_helper_imx519.cpp',\n+    'cam_helper_imx678.cpp',\n     'cam_helper_imx708.cpp',\n     'cam_helper_ov64a40.cpp',\n     'cam_helper_ov7251.cpp',\n","prefixes":["v2","2/2"]}