From patchwork Tue Sep 8 08:45:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel LEGROS X-Patchwork-Id: 28200 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5C924C3257 for ; Tue, 8 Sep 2026 08:53:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EC9C368622; Tue, 8 Sep 2026 10:53:38 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PRaEUjfw"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1F5D868613 for ; Tue, 8 Sep 2026 10:45:47 +0200 (CEST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4957eefd361so34294095e9.1 for ; Tue, 08 Sep 2026 01:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788857146; x=1789461946; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=7mJK1UpS8/Dk9vgvwasi/lG+XDhe7YU0GYjj4DhEybM=; b=PRaEUjfw8wMfynX7i9EHeGX1VAQvJ1bUGAkNaoqUwP+GC3IZropJKaqI27ssV3Db6o OUEUo8XP8GtHLHM2UksdsBGv3z2rlYwE+K2avEmnvUPu7010faBiu+3PMxl/LEWRqotx ld0+N/9R8qwYTgNZ8MBk9Sch8n4dtkX2UBN43EUUHVdkGfFa5A6AnsmbQ64EHGctJpI5 /KKYRN5AdbMpax3V3RUlPdWlmOg4nsaC4I1d1CtnjJ8yiZNdx/l3AzvYbp/YeOFCAHMM Lj2jPYy7AuKRPbQqRnM20mV2IJuvwMVC0S0RfiCneY6ffvLvJA6RXNZi3RUwvNsITacC WI3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788857146; x=1789461946; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7mJK1UpS8/Dk9vgvwasi/lG+XDhe7YU0GYjj4DhEybM=; b=smZ2FLBG4mIliE4zhK6A23gWC/Pzw/qdUHWf1RIqyhUdkklFt49VVnjik1WOexaUYn 7tpufFPoVMDqaufX4sKvIRULqLiUiVf9tAgFpuK7K0sW8anGdcioeSlo9qVPMYOX1VQV qvfATQjkvjLv/2rmwVbaxAZUfVO+iaCApC4aFEHbnli38egrdmoblRtPYOKpPfAXwPtH cHo2548MV3PQ9/LFw3GKyrAe4dmuqxl6HpoRauGwdsO+uIfTYBXhmo2gauMJ8zW6zmSP DjCqdNLi51nS0uYOCFWHqcg5PvW2VSSAoQPut+VaVB4LTkXAHZiBQGCFbc3irlGH2pc0 3pjg== X-Gm-Message-State: AFuF++mNZcDTbh67naBh/6EXgPp6Kap4CS0z9wFTbC+xcwEBPBAUCfLA dMAAyh9lw3Mv5CMwpNFfbg269tUpdMjPjoB5C5A7XxvZUJjNsWCiysZRTZIp+TObf2o= X-Gm-Gg: AYBFou3vgq6W/Ev2yyXvfhA4xALtQ6I5Ie23IPE4Z40kL1PltJ9e9Qd4vRX0aTeahCw QVxQeEJlePKm9dgcwOiD3IfbUZctWX/F25b9JUPqMEAsSpNLtgTEdkuAiwkApCYJcVt8rWPKLLY rOM0X6riIfspjHAzRoO53gkTwc2/pDf8BrtqBkd0G4sL/3DqHpW/XRsE2jtyUFd8u1GjO/PqaaT oBDt8h3ZYQ3uuSYUMhO5yMdB5PNPzWxGAXwiAwv5xSjoPRLwFTjcaLIOIM1SqQ5KO1SRznP03MQ hoTMgY+7vU7EdWNNJVpv59ehooKDjUX62VU/lEYTE9SS8o8syS29jDVlCmfv4vbFcv4beNnrMGX e+4bsgjgDmALI+P1pjCNuQsYurrVJ2a8YYb9HRnLj/HlIashh0GaycOphgKSHQ/tZ5igSdPD+zZ EJGpnfMkFefL6PcSfT3sa2PG/7hywqEIpYCGNvmQDKmsA3cRCqkpH08Eti0HF/Ne14+qLG+Kxeo GJXMlwH7uU6xup0J8kDiTa75MCiv7Nz0gNItfAJl3hdcThAoivio0buUdl8Nn9BrQ4y8ozj X-Received: by 2002:a05:600c:1991:b0:49b:2796:be30 with SMTP id 5b1f17b1804b1-49cf824f7damr252365015e9.11.1788857146282; Tue, 08 Sep 2026 01:45:46 -0700 (PDT) Received: from laptop-sam.ss2i-services.local (lneuilly-657-1-3-33.w81-250.abo.wanadoo.fr. [81.250.130.33]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cee7fec25sm538427965e9.13.2026.09.08.01.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 01:45:45 -0700 (PDT) From: Samuel LEGROS To: libcamera-devel@lists.libcamera.org Cc: naush@raspberrypi.com, robert.mader@collabora.com, Samuel LEGROS Subject: [PATCH 1/2] libcamera: camera_sensor: Fix IMX355 test pattern mode mapping Date: Tue, 8 Sep 2026 10:45:43 +0200 Message-ID: <20260908084544.274613-1-sam.legros@gmail.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 08 Sep 2026 10:53:38 +0200 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The IMX355 sensor properties map TestPatternModeColorBars to menu index 1 and TestPatternModeSolidColor to index 2. The kernel driver defines the opposite order: static const char * const imx355_test_pattern_menu[] = { "Disabled", "Solid Colour", "Eight Vertical Colour Bars", "Colour Bars With Fade to Grey", "Pseudorandom Sequence (PN9)", }; This matches drivers/media/i2c/imx355.c in mainline Linux and in the Raspberry Pi kernel tree, and was confirmed on a Google Pixel 3a (front camera, imx355 4-001a) running postmarketOS: $ v4l2-ctl -d /dev/v4l-subdev19 --list-ctrls-menus test_pattern 0x009f0903 (menu) : min=0 max=4 default=0 value=0 0: Disabled 1: Solid Colour 2: Eight Vertical Colour Bars 3: Colour Bars With Fade to Grey 4: Pseudorandom Sequence (PN9) Requesting a solid colour test pattern therefore produces colour bars, and vice versa. Swap the two entries, which makes IMX355 consistent with IMX258 and IMX471, whose drivers expose the same menu and which are already described correctly. IMX214 and IMX219 keep their current mapping, as their drivers do list "Color Bars" at index 1. Fixes: a1db25dabaee ("libcamera: camera_sensor: Add Sony IMX355 sensor properties and helper") Signed-off-by: Samuel LEGROS --- src/libcamera/sensor/camera_sensor_properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp index 819f07b..ecf523c 100644 --- a/src/libcamera/sensor/camera_sensor_properties.cpp +++ b/src/libcamera/sensor/camera_sensor_properties.cpp @@ -269,8 +269,8 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen .unitCellSize = { 1120, 1120 }, .testPatternModes = { { controls::draft::TestPatternModeOff, 0 }, - { controls::draft::TestPatternModeColorBars, 1 }, - { controls::draft::TestPatternModeSolidColor, 2 }, + { controls::draft::TestPatternModeSolidColor, 1 }, + { controls::draft::TestPatternModeColorBars, 2 }, { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, { controls::draft::TestPatternModePn9, 4 }, }, From patchwork Tue Sep 8 08:45:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel LEGROS X-Patchwork-Id: 28201 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 56EC9C3273 for ; Tue, 8 Sep 2026 08:53:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 90B006861D; Tue, 8 Sep 2026 10:53:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GpiK152x"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FE7568615 for ; Tue, 8 Sep 2026 10:45:48 +0200 (CEST) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-49cd77e0f95so35677405e9.3 for ; Tue, 08 Sep 2026 01:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788857148; x=1789461948; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=dJd+mKQzDXf2Ebkgg5dEz0cg7N2YIqqL08irlO+eYnY=; b=GpiK152x1gjcvodPCA8+XNAz4Sg98dOZ2ARgkh7we4Tkbq22DZpPfUjUrBRyaJVk1/ ZSokKYtvUz2HyIdO/RCUiA0bQTnFrvR90gi6TBGh6jyEH9MlvS8yT7P+jgWT4VdnNSsF C3znkbghLZaN24FJaw2kFt6hCNPUhEu720s/U5yuSwrsNydHuRR5snO4id8VMkV/ssks gTh1R5x3aOUAePIoyHrUkAurBnyYZuJyxVBak57ljNmvT0disbnfvBcFJzf5sK+AyFz7 8tWYxdL1KT9x3uZ7bCIKu+L0fl/I3k3hXe3xt62xgWOdbgT1jWFXEsI5MfhwvvKvvz02 hpcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788857148; x=1789461948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=dJd+mKQzDXf2Ebkgg5dEz0cg7N2YIqqL08irlO+eYnY=; b=P8a/YHmIkHCAFUG3Efisqgu1h5T5Scx9EKoKGtUZG22mGsMP+b8WLgoEcwDzaIUuda wjPmmkOOIXmvs6KdjC3VWrEu18s7xrsAdp5g/rQTMthwP8qoSVhiGktSpNWxPo5Qyxra SOK332hFKaWTiNX5douCpFNFKpu9YszbKOEF5fD8NJLPlRIqCEXqXz/THDKBwtB/fJNi CwgZVga7rxkMxvmB3uKZne0m0PbdROJKTmDTuMLECdsaOHzUqK4uhQNJWK9eaSMFDRe8 wRr8W4J9GXVRxlhCTYsq8Rg7WdKUoHFUCfjnQxSZwxARjK+iFeJvviyDdkXTqHntbtjl 3LhA== X-Gm-Message-State: AFuF++mLGiBs/WSMSW259IjrUDl81WpsrDOLOUHgB4Lr+heXiFUdf+2a yyY5bTuJTNnKSXsVDz3U+/BvJsX95z9imsQp3xihXLAG3t5j3qivP4FsdFhfwfIeL9E= X-Gm-Gg: AYBFou0maVd6I3Trtw4ig6b2LXImT2aa45cXYCwJwq7hfTgKeM98sMOXmh42aNqOkmN R1k3NsUQr0V8XyvLb6ggFCYp1PNMPTtzy0ZWzR1YLoD1jss7PPIt54d+D4+nEkKsuy4GnM2KcnC yKqkOtw/3mqroycd1PCWklpPBT1yxoZ3GE7sJ3Ygh7k9u6boVAqCXHrxoZ/Ht0+fj17A5QMXbtJ gJ/zFnqp1NWmHVYkP7c+CDXKxx5L/y2kSaNlA/dsjeHB3UP0yZnGJHUTKW+IG9krIdVbXpJBCOP /CN9/v0MRdgrxLvAHy0fhsbB3IbZ5ir+/GgKjo9ZFOb55bfbzxZX9tFHG4J6s8RZSTJyYm1cj5e oHfR1yQarmiVcfwCDdc1RnN9B7KCRGMx8FS35PbE72wDN0ci95tKIKI/xYBkUdwYwt0gdynmfQJ 2uMg/O8F+EJp4b1XdhF2uhO70J2F5rHNQQFNYz34l0fCa5IQYxr9O9OxZycV81gbmuOBHcjjU7I NKOrER4dERRWlcuubsX2BpGMJLbvmapVjRLFC+7YWq5HGiL3PZVkR7nHKaFdg== X-Received: by 2002:a05:600c:138e:b0:49d:daa:af6e with SMTP id 5b1f17b1804b1-49d1c7b732amr15307565e9.16.1788857147931; Tue, 08 Sep 2026 01:45:47 -0700 (PDT) Received: from laptop-sam.ss2i-services.local (lneuilly-657-1-3-33.w81-250.abo.wanadoo.fr. [81.250.130.33]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cee7fec25sm538427965e9.13.2026.09.08.01.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 01:45:46 -0700 (PDT) From: Samuel LEGROS To: libcamera-devel@lists.libcamera.org Cc: naush@raspberrypi.com, robert.mader@collabora.com, Samuel LEGROS Subject: [PATCH 2/2] libcamera: camera_sensor: Add Sony IMX363 sensor properties and helper Date: Tue, 8 Sep 2026 10:45:44 +0200 Message-ID: <20260908084544.274613-2-sam.legros@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260908084544.274613-1-sam.legros@gmail.com> References: <20260908084544.274613-1-sam.legros@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 08 Sep 2026 10:53:38 +0200 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add the camera sensor properties and camera sensor helper entries for the Sony IMX363, the rear sensor of the Google Pixel 3 and Pixel 3a. Values were taken from the driver and confirmed on a Pixel 3a running postmarketOS (imx363 3-001a): - The pixel array is 4032x3024 within a 4048x3168 native area, and the sensor is a 12.2 MP type 1/2.55" part, giving a 1.4 um pixel pitch (4032 * 1.4 um = 5.64 mm across). - The driver exposes the same test pattern menu as the IMX258 and the IMX355: static const char * const imx363_test_pattern_menu[] = { "Disabled", "Solid Colour", "Eight Vertical Colour Bars", "Colour Bars With Fade to Grey", "Pseudorandom Sequence (PN9)", }; - Analogue gain is written to ANALOG_GAIN_GLOBAL (0x0204) and ranges from 0 to 480, the same limit as the IMX258, which corresponds to the 512/(512 - x) gain model and a 16x maximum. The IMX355 uses the same formula scaled to 1024 with a limit of 960. - The black level follows the value documented for the sibling sensors, 0x40 at 10 bits. Signed-off-by: Samuel LEGROS --- src/ipa/libipa/camera_sensor_helper.cpp | 12 ++++++++++++ .../sensor/camera_sensor_properties.cpp | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index 82bf255..c3ae412 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -629,6 +629,18 @@ public: }; REGISTER_CAMERA_SENSOR_HELPER("imx355", CameraSensorHelperImx355) +class CameraSensorHelperImx363 : public CameraSensorHelper +{ +public: + CameraSensorHelperImx363() + { + /* From datasheet: 0x40 at 10bits. */ + blackLevel_ = 4096; + gain_ = AnalogueGainLinear{ 0, 512, -1, 512 }; + } +}; +REGISTER_CAMERA_SENSOR_HELPER("imx363", CameraSensorHelperImx363) + class CameraSensorHelperImx415 : public CameraSensorHelper { public: diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp index ecf523c..10095f2 100644 --- a/src/libcamera/sensor/camera_sensor_properties.cpp +++ b/src/libcamera/sensor/camera_sensor_properties.cpp @@ -281,6 +281,22 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen .hblankDelay = 2 }, } }, + { "imx363", { + .unitCellSize = { 1400, 1400 }, + .testPatternModes = { + { controls::draft::TestPatternModeOff, 0 }, + { controls::draft::TestPatternModeSolidColor, 1 }, + { controls::draft::TestPatternModeColorBars, 2 }, + { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, + { controls::draft::TestPatternModePn9, 4 }, + }, + .sensorDelays = { + .exposureDelay = 2, + .gainDelay = 2, + .vblankDelay = 2, + .hblankDelay = 2 + }, + } }, { "imx415", { .unitCellSize = { 1450, 1450 }, .testPatternModes = {},