From patchwork Wed Jan 25 09:05:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18194 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 8EA81BDB1D for ; Wed, 25 Jan 2023 09:06:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D2630625D8; Wed, 25 Jan 2023 10:06:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674637563; bh=mRDfxF0s+ZqJKV2Pxp1TteElBEVv8wN0y5rz/ueNEaM=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=outr8eUFGNDOoKwvM2rXPm5OvVNn3hOnDSbVpjt2eV3L7m2QU7N3aQOEIzbGgK6RK 9x/HpJEGoitsm6NjQbkhnlJ4HHHC04XiVeql1E43mv2JfVXzy0hC0TObbkbXBBHF8Q 6iKfioG/6xABg8Bk7NVHtUPMzHkOH7ayEG5TMhwssDD4oi9qWuLLY/tV4Dz3Pq8CIW nrHUjiOpUt3q9ByppvIxuGKWyAXOX9YhKpoLPkiZtebo61yqxpiQcSoeE1k6hTdi7H BsK3/c06/jD1JUOmLDPW3+48B9BR1NaVvPd7q/tEsQbVV3eq8VChe65XuWs140jO4Y Swquw49ZI4C2g== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A01461EFA for ; Wed, 25 Jan 2023 10:06:02 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="m8kGm3G9"; dkim-atps=neutral Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C0C616E0; Wed, 25 Jan 2023 10:06:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1674637562; bh=mRDfxF0s+ZqJKV2Pxp1TteElBEVv8wN0y5rz/ueNEaM=; h=From:To:Cc:Subject:Date:From; b=m8kGm3G9HxpFj9iBAfAKkA6KcSUCv1Xpewua5u6G/lHv/zVjAl7f3sC3zCf8tHlb6 qKtUaivzIe82N8g8auirD6eEme7/bJexdKTUj7dUERUQ6lNq/uQ3Ywiw0R0+bAKvyO EW1+GJ+l72qrLmmVR1lXZs8FEfxEZqi9uWK6vU4g= To: libcamera-devel@lists.libcamera.org Date: Wed, 25 Jan 2023 10:05:28 +0100 Message-Id: <20230125090528.46218-1-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] libcamera: Add support for OmniVision OV8858 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi , Nicholas Roth Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Nicholas Roth Support for the OmniVision OV8858 sensor is scheduled for inclusion in the Linux kernel in version v6.3. Add support for the sensor in libcamera by providing static properties and a camera sensor helper in libipa. The camera sensor helper expresses analogue gain increments in 1/128 step which differs from what is reported in the sensor documentation in section "5.8 manual exposure compensation/ manual gain compensation" [0] A more detailed analysis of the sensor gain model is reported at: https://patchwork.linuxtv.org/project/linux-media/patch/20221106171129.166892-2-nicholas@rothemail.net/#142267 Record with a \todo note a reference to discussion on the gain model implementation. Signed-off-by: Nicholas Roth Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- Compared to initial Nicholas' submission: - Change gain step to 128 (link to the driver discussion) - Add fadeToGray test patter and adjust comment --- src/ipa/libipa/camera_sensor_helper.cpp | 18 ++++++++++++++++++ src/libcamera/camera_sensor_properties.cpp | 13 +++++++++++++ 2 files changed, 31 insertions(+) -- 2.39.0 diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index 3d8a2835fa28..52e11dfb8ca2 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -505,6 +505,24 @@ public: }; REGISTER_CAMERA_SENSOR_HELPER("ov5693", CameraSensorHelperOv5693) +class CameraSensorHelperOv8858 : public CameraSensorHelper +{ +public: + CameraSensorHelperOv8858() + { + gainType_ = AnalogueGainLinear; + + /* + * \todo Use an increment step of 1/128 which differs from + * what the sensor manual describes. + * + * See: https://patchwork.linuxtv.org/project/linux-media/patch/20221106171129.166892-2-nicholas@rothemail.net/#142267 + */ + gainConstants_.linear = { 1, 0, 0, 128 }; + } +}; +REGISTER_CAMERA_SENSOR_HELPER("ov8858", CameraSensorHelperOv8858) + class CameraSensorHelperOv8865 : public CameraSensorHelper { public: diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp index c3c2caced906..7f6816e72773 100644 --- a/src/libcamera/camera_sensor_properties.cpp +++ b/src/libcamera/camera_sensor_properties.cpp @@ -167,6 +167,19 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen */ }, } }, + { "ov8858", { + .unitCellSize = { 1120, 1120 }, + .testPatternModes = { + { controls::draft::TestPatternModeOff, 0 }, + { controls::draft::TestPatternModeColorBars, 1 }, + { controls::draft::TestPatternModeColorBarsFadeToGray, 2 }, + /* + * No corresponding test patter mode + * 3: "Vertical Color Bar Type 3", + * 4: "Vertical Color Bar Type 4" + */ + }, + } }, { "ov8865", { .unitCellSize = { 1400, 1400 }, .testPatternModes = {