From patchwork Thu Aug 28 13:09:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fend X-Patchwork-Id: 24253 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 5075FBD87C for ; Thu, 28 Aug 2025 13:09:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D818169300; Thu, 28 Aug 2025 15:09:45 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=emfend.at header.i=@emfend.at header.b="BR6+WkpH"; dkim-atps=neutral Received: from lx20.hoststar.hosting (lx20.hoststar.hosting [168.119.41.54]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 20DD1692E1 for ; Thu, 28 Aug 2025 15:09:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=emfend.at; s=mail; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=H97QC7t5K+/IG6ZeI3tIjt8VWvL8BCztQQL5WRs7ahY=; b=BR6+WkpHe0CTHWZkxGadS6O4DP obFTHKYrq8sB1upqBYpaMZ1hR+kqBGLQlaY8iskpzQsurQSdIpSvNJURhoPEe1od8k+xbMRt1Wbpa mjewzL6FevFzKp1Tx0bNmpU/lvTgdTMkt35aMKCZRmlmxXWT4Q5qerMhPQxVPIIBWTls=; Received: from 194-208-208-245.tele.net ([194.208.208.245]:56023 helo=[127.0.1.1]) by lx20.hoststar.hosting with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1urcNq-00BORr-7n; Thu, 28 Aug 2025 15:09:42 +0200 From: Matthias Fend Date: Thu, 28 Aug 2025 15:09:38 +0200 Subject: [PATCH 1/5] libcamera: control_ids_draft: Add flash controls MIME-Version: 1.0 Message-Id: <20250828-flash-support-v1-1-4c5dc674a05b@emfend.at> References: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> In-Reply-To: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> To: libcamera-devel@lists.libcamera.org Cc: Matthias Fend X-Mailer: b4 0.14.2 X-Spam-Score: -1.0 X-Spam-Bar: - X-Spam-Report: Spam detection software, running on the system "lx20.hoststar.hosting", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This series brings initial support for v4l2 flash devices. With these patches, v4l2 flash devices can be controlled by applications via libcamera controls. Applications therefore only require one API and do not have to worry about details such as finding the [...] Content analysis details: (-1.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: meson.build] 0.0 URIBL_DBL_BLOCKED_OPENDNS ADMINISTRATOR NOTICE: The query to dbl.spamhaus.org was blocked due to usage of an open resolver. See https://www.spamhaus.org/returnc/pub/ [URIs: meson.build] 0.0 URIBL_ZEN_BLOCKED_OPENDNS ADMINISTRATOR NOTICE: The query to zen.spamhaus.org was blocked due to usage of an open resolver. See https://www.spamhaus.org/returnc/pub/ [URIs: meson.build] -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address 0.0 Local_hs1_NotHoststar Sender is not from hoststar.ch|de|com 0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict Alignment 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" Define a set of controls to control camera flash devices. Signed-off-by: Matthias Fend --- src/libcamera/control_ids_draft.yaml | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/src/libcamera/control_ids_draft.yaml b/src/libcamera/control_ids_draft.yaml index 03309eeac34fa76eee4bb5d1c87d6467b890c9a7..c10b774bfd59b26980475bb9706fffa6961b3b1b 100644 --- a/src/libcamera/control_ids_draft.yaml +++ b/src/libcamera/control_ids_draft.yaml @@ -294,4 +294,73 @@ controls: Currently identical to ANDROID_STATISTICS_FACE_IDS. size: [n] + - FlashMode: + type: int32_t + direction: inout + description: | + Flash mode. + enum: + - name: FlashModeNone + value: 0 + description: | + None. + - name: FlashModeFlash + value: 1 + description: | + Flash. + - name: FlashModeTorch + value: 2 + description: | + Torch. + + - FlashIntensity: + type: int32_t + direction: inout + description: | + Flash intensity in mA. + + - FlashTimeout: + type: int32_t + direction: inout + description: | + Flash timeout in us. + + - FlashStrobeSource: + type: int32_t + direction: inout + description: | + Flash mode. + enum: + - name: FlashStrobeSourceSoftware + value: 0 + description: | + Software. + - name: FlashStrobeSourceExternal + value: 1 + description: | + External. + + - FlashStrobe: + type: int32_t + direction: in + description: | + Start/stop flash strobe. + + enum: + - name: FlashStrobeStart + value: 0 + description: | + Start flash strobe. + + - name: FlashStrobeStop + value: 1 + description: | + Stop flash strobe. + + - FlashTorchIntensity: + type: int32_t + direction: inout + description: | + Torch intensity in mA. + ... From patchwork Thu Aug 28 13:09:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fend X-Patchwork-Id: 24254 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 31689BD87C for ; Thu, 28 Aug 2025 13:09:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DC597692F8; Thu, 28 Aug 2025 15:09:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=emfend.at header.i=@emfend.at header.b="A64Ktvs2"; dkim-atps=neutral Received: from lx20.hoststar.hosting (lx20.hoststar.hosting [168.119.41.54]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 23A9F692E1 for ; Thu, 28 Aug 2025 15:09:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=emfend.at; s=mail; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=AAuuYJIjlyUZSTXRpT052wDEQAn2HGC4nOuFufwxx08=; b=A64Ktvs2acqXZJbF950OGr6nOj n1pzHRZ5ouKgHl1qpQ9WlxVntomtMy860TSIs4xBOikaYLYpfW9nmaS7j5NcyOk5SLsUX1VyHk8ks qrzNXkP1Vhxm51JDBH4t9w8NA4TZJ86lk3T2ja5RU+4rnc7A5C97W/LNs34sF/Fs7R+E=; Received: from 194-208-208-245.tele.net ([194.208.208.245]:56023 helo=[127.0.1.1]) by lx20.hoststar.hosting with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1urcNq-00BORr-Lt; Thu, 28 Aug 2025 15:09:43 +0200 From: Matthias Fend Date: Thu, 28 Aug 2025 15:09:39 +0200 Subject: [PATCH 2/5] libcamera: Add support for camera flash devices MIME-Version: 1.0 Message-Id: <20250828-flash-support-v1-2-4c5dc674a05b@emfend.at> References: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> In-Reply-To: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> To: libcamera-devel@lists.libcamera.org Cc: Matthias Fend X-Mailer: b4 0.14.2 X-Spam-Score: -1.0 X-Spam-Bar: - X-Spam-Report: Spam detection software, running on the system "lx20.hoststar.hosting", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Define a set of controls to control camera flash devices. Signed-off-by: Matthias Fend --- src/libcamera/control_ids_draft.yaml | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) Content analysis details: (-1.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address 0.0 Local_hs1_NotHoststar Sender is not from hoststar.ch|de|com 0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict Alignment 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 a class to model camera flash devices. Currently, only v4l2 flash devices are supported. The v4l2 flash devices are implemented similar to the camera lenses. Signed-off-by: Matthias Fend --- include/libcamera/internal/camera_flash.h | 75 ++++++++ include/libcamera/internal/camera_sensor.h | 2 + src/libcamera/camera_flash.cpp | 248 ++++++++++++++++++++++++++ src/libcamera/meson.build | 1 + src/libcamera/sensor/camera_sensor_legacy.cpp | 13 ++ src/libcamera/sensor/camera_sensor_raw.cpp | 13 ++ 6 files changed, 352 insertions(+) diff --git a/include/libcamera/internal/camera_flash.h b/include/libcamera/internal/camera_flash.h new file mode 100644 index 0000000000000000000000000000000000000000..e41afef2ab84852a340a12a012e3994f00cac27a --- /dev/null +++ b/include/libcamera/internal/camera_flash.h @@ -0,0 +1,75 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2025, matthias.fend@emfend.at + * + * Camera flash support + */ +#pragma once + +#include +#include +#include + +#include +#include + +#include + +namespace libcamera { + +class MediaEntity; +class V4L2Subdevice; + +class CameraFlash : protected Loggable +{ +public: + enum Mode { + None, + Flash, + Torch, + }; + + enum StrobeSource { + Software, + External, + }; + + explicit CameraFlash(const MediaEntity *entity); + ~CameraFlash(); + int init(); + Mode getMode() const; + int setMode(Mode mode); + const ControlInfo &getFlashIntensityInfo() const; + int32_t getFlashIntensity() const; + int setFlashIntensity(int32_t intensity); + const ControlInfo &getFlashTimeoutInfo() const; + int32_t getFlashTimeout() const; + int setFlashTimeout(int32_t timeout_us); + StrobeSource getStrobeSource() const; + int setStrobeSource(StrobeSource source); + int startStrobe(); + int stopStrobe(); + const ControlInfo &getTorchIntensityInfo() const; + int32_t getTorchIntensity() const; + int setTorchIntensity(int32_t intensity); + + const std::string &model() const; + const ControlInfoMap &controls() const; + +protected: + std::string logPrefix() const override; + +private: + LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraFlash) + + int32_t getSubdevControl(uint32_t id) const; + int setSubdevControl(uint32_t id, int32_t value); + int validateDriver(); + + const MediaEntity *entity_; + std::unique_ptr subdev_; + std::string model_; + const ControlInfoMap *controlInfoMap_ = nullptr; +}; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index f6ef4df170d43500bc652762e9a575010a6c1cbd..faeecf244c8d42a43eca52ae04813e0c2f80e516 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -28,6 +28,7 @@ namespace libcamera { +class CameraFlash; class CameraLens; class MediaEntity; class SensorConfiguration; @@ -48,6 +49,7 @@ public: virtual V4L2Subdevice *device() = 0; virtual CameraLens *focusLens() = 0; + virtual CameraFlash *flash() = 0; virtual const std::vector &mbusCodes() const = 0; virtual std::vector sizes(unsigned int mbusCode) const = 0; diff --git a/src/libcamera/camera_flash.cpp b/src/libcamera/camera_flash.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4702c590c91e0bcb20d173e7ce03608e1ae6ecfd --- /dev/null +++ b/src/libcamera/camera_flash.cpp @@ -0,0 +1,248 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2025, matthias.fend@emfend.at + * + * Camera flash support + */ + +#include "libcamera/internal/camera_flash.h" + +#include + +#include "libcamera/internal/v4l2_subdevice.h" + +namespace libcamera { + +LOG_DEFINE_CATEGORY(CameraFlash) + +CameraFlash::CameraFlash(const MediaEntity *entity) + : entity_(entity) +{ +} + +CameraFlash::~CameraFlash() = default; + +int CameraFlash::init() +{ + if (entity_->function() != MEDIA_ENT_F_FLASH) { + LOG(CameraFlash, Error) + << "Invalid flash function " + << utils::hex(entity_->function()); + return -EINVAL; + } + + subdev_ = std::make_unique(entity_); + int ret = subdev_->open(); + if (ret < 0) + return ret; + + controlInfoMap_ = &subdev_->controls(); + + ret = validateDriver(); + if (ret) + return ret; + + model_ = subdev_->model(); + + return 0; +} + +CameraFlash::Mode CameraFlash::getMode() const +{ + Mode m; + + switch (getSubdevControl(V4L2_CID_FLASH_LED_MODE)) { + case V4L2_FLASH_LED_MODE_FLASH: + m = Flash; + break; + case V4L2_FLASH_LED_MODE_TORCH: + m = Torch; + break; + case V4L2_FLASH_LED_MODE_NONE: + default: + m = None; + break; + } + + return m; +} + +int CameraFlash::setMode(Mode mode) +{ + int32_t m; + + switch (mode) { + case Flash: + m = V4L2_FLASH_LED_MODE_FLASH; + break; + case Torch: + m = V4L2_FLASH_LED_MODE_TORCH; + break; + case None: + m = V4L2_FLASH_LED_MODE_NONE; + break; + default: + return -EINVAL; + } + + return setSubdevControl(V4L2_CID_FLASH_LED_MODE, m); +} + +const ControlInfo &CameraFlash::getFlashIntensityInfo() const +{ + return controlInfoMap_->find(V4L2_CID_FLASH_INTENSITY)->second; +} + +int32_t CameraFlash::getFlashIntensity() const +{ + return getSubdevControl(V4L2_CID_FLASH_INTENSITY); +} + +int CameraFlash::setFlashIntensity(int32_t intensity) +{ + return setSubdevControl(V4L2_CID_FLASH_INTENSITY, intensity); +} + +const ControlInfo &CameraFlash::getFlashTimeoutInfo() const +{ + return controlInfoMap_->find(V4L2_CID_FLASH_TIMEOUT)->second; +} + +int32_t CameraFlash::getFlashTimeout() const +{ + return getSubdevControl(V4L2_CID_FLASH_TIMEOUT); +} + +int CameraFlash::setFlashTimeout(int32_t timeout) +{ + return setSubdevControl(V4L2_CID_FLASH_TIMEOUT, timeout); +} + +CameraFlash::StrobeSource CameraFlash::getStrobeSource() const +{ + StrobeSource s; + + switch (getSubdevControl(V4L2_CID_FLASH_STROBE_SOURCE)) { + case V4L2_FLASH_STROBE_SOURCE_EXTERNAL: + s = External; + break; + case V4L2_FLASH_STROBE_SOURCE_SOFTWARE: + default: + s = Software; + break; + } + + return s; +} + +int CameraFlash::setStrobeSource(StrobeSource source) +{ + int32_t s; + + switch (source) { + case External: + s = V4L2_FLASH_STROBE_SOURCE_EXTERNAL; + break; + case Software: + s = V4L2_FLASH_STROBE_SOURCE_SOFTWARE; + break; + default: + return -EINVAL; + } + + return setSubdevControl(V4L2_CID_FLASH_STROBE_SOURCE, s); +} + +int CameraFlash::startStrobe() +{ + return setSubdevControl(V4L2_CID_FLASH_STROBE, 1); +} + +int CameraFlash::stopStrobe() +{ + return setSubdevControl(V4L2_CID_FLASH_STROBE_STOP, 1); +} + +const ControlInfo &CameraFlash::getTorchIntensityInfo() const +{ + return controlInfoMap_->find(V4L2_CID_FLASH_TORCH_INTENSITY)->second; +} + +int32_t CameraFlash::getTorchIntensity() const +{ + return getSubdevControl(V4L2_CID_FLASH_TORCH_INTENSITY); +} + +int CameraFlash::setTorchIntensity(int32_t intensity) +{ + return setSubdevControl(V4L2_CID_FLASH_TORCH_INTENSITY, intensity); +} + +const std::string &CameraFlash::model() const +{ + return model_; +} + +const ControlInfoMap &CameraFlash::controls() const +{ + return subdev_->controls(); +} + +std::string CameraFlash::logPrefix() const +{ + return "'" + entity_->name() + "'"; +} + +int32_t CameraFlash::getSubdevControl(uint32_t id) const +{ + ControlList controlList = subdev_->getControls(std::vector{ id }); + + return controlList.get(id).get(); +} + +int CameraFlash::setSubdevControl(uint32_t id, int32_t value) +{ + ControlList flashCtrls(subdev_->controls()); + + flashCtrls.set(id, value); + + if (subdev_->setControls(&flashCtrls)) + return -EINVAL; + + return 0; +} + +int CameraFlash::validateDriver() +{ + int ret = 0; + static constexpr uint32_t mandatoryControls[] = { + V4L2_CID_FLASH_LED_MODE, + V4L2_CID_FLASH_STROBE_SOURCE, + V4L2_CID_FLASH_STROBE, + V4L2_CID_FLASH_TIMEOUT, + V4L2_CID_FLASH_INTENSITY, + V4L2_CID_FLASH_TORCH_INTENSITY, + }; + + for (uint32_t ctrl : mandatoryControls) { + if (!controlInfoMap_->count(ctrl)) { + LOG(CameraFlash, Error) + << "Mandatory V4L2 control " << utils::hex(ctrl) + << " not available"; + ret = -EINVAL; + } + } + + if (ret) { + LOG(CameraFlash, Error) + << "The flash kernel driver needs to be fixed"; + LOG(CameraFlash, Error) + << "See Documentation/flash_driver_requirements.rst in" + << " the libcamera sources for more information"; + return ret; + } + + return ret; +} + +} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index b3ca27f217da4ba3a896ef7cbfb5502fa82a4907..0f125661a51e2431c1febc353cef30a1219f9ce7 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -20,6 +20,7 @@ libcamera_internal_sources = files([ 'bayer_format.cpp', 'byte_stream_buffer.cpp', 'camera_controls.cpp', + 'camera_flash.cpp', 'camera_lens.cpp', 'clock_recovery.cpp', 'control_serializer.cpp', diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp index f9e685a9acc499fc91d51ed1d66780a0ad2d2a8f..632b66ea0aa15fcd654e7f0efb50c24cb9b973bf 100644 --- a/src/libcamera/sensor/camera_sensor_legacy.cpp +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp @@ -31,6 +31,7 @@ #include #include "libcamera/internal/bayer_format.h" +#include "libcamera/internal/camera_flash.h" #include "libcamera/internal/camera_lens.h" #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/camera_sensor_properties.h" @@ -68,6 +69,7 @@ public: V4L2Subdevice *device() override { return subdev_.get(); } CameraLens *focusLens() override { return focusLens_.get(); } + CameraFlash *flash() override { return flash_.get(); } const std::vector &mbusCodes() const override { return mbusCodes_; } std::vector sizes(unsigned int mbusCode) const override; @@ -139,6 +141,7 @@ private: ControlList properties_; std::unique_ptr focusLens_; + std::unique_ptr flash_; }; /** @@ -665,6 +668,16 @@ int CameraSensorLegacy::discoverAncillaryDevices() } break; + case MEDIA_ENT_F_FLASH: + flash_ = std::make_unique(ancillary); + ret = flash_->init(); + if (ret) { + LOG(CameraSensor, Error) + << "Flash initialisation failed, flash disabled"; + flash_.reset(); + } + break; + default: LOG(CameraSensor, Warning) << "Unsupported ancillary entity function " diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp index 8ea4423698cd8c1eaae43eb5ba8b5d524b94d515..9d533d814b9df453aa4009a87818c1558bcbd665 100644 --- a/src/libcamera/sensor/camera_sensor_raw.cpp +++ b/src/libcamera/sensor/camera_sensor_raw.cpp @@ -32,6 +32,7 @@ #include #include "libcamera/internal/bayer_format.h" +#include "libcamera/internal/camera_flash.h" #include "libcamera/internal/camera_lens.h" #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/camera_sensor_properties.h" @@ -69,6 +70,7 @@ public: V4L2Subdevice *device() override { return subdev_.get(); } CameraLens *focusLens() override { return focusLens_.get(); } + CameraFlash *flash() override { return flash_.get(); } const std::vector &mbusCodes() const override { return mbusCodes_; } std::vector sizes(unsigned int mbusCode) const override; @@ -150,6 +152,7 @@ private: ControlList properties_; std::unique_ptr focusLens_; + std::unique_ptr flash_; }; /** @@ -513,6 +516,16 @@ std::optional CameraSensorRaw::init() } break; + case MEDIA_ENT_F_FLASH: + flash_ = std::make_unique(ancillary); + ret = flash_->init(); + if (ret) { + LOG(CameraSensor, Error) + << "Flash initialisation failed, flash disabled"; + flash_.reset(); + } + break; + default: LOG(CameraSensor, Warning) << "Unsupported ancillary entity function " From patchwork Thu Aug 28 13:09:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fend X-Patchwork-Id: 24255 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 9EDEAC32BB for ; Thu, 28 Aug 2025 13:09:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 13CDE692FC; Thu, 28 Aug 2025 15:09:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=emfend.at header.i=@emfend.at header.b="aXfU5vzH"; dkim-atps=neutral Received: from lx20.hoststar.hosting (lx20.hoststar.hosting [168.119.41.54]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B6C94692E9 for ; Thu, 28 Aug 2025 15:09:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=emfend.at; s=mail; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=hrmycKM5vz19EHoPbU8uUhqnMarL+q4v19l4pkGwgEs=; b=aXfU5vzH7Chc8P0H1bZmiZ3KW3 f7ovKNFy9eVtHvirVS/W9p6tZ1TCWrQ2N5xiyyUOECSojzVz86eu9pTGFiLzuF0kJeKBB+C0BGCfY Jehfw+KzrKi+BzJ7j3iaHcv1YH1YZdu4JtMYva1db+pRBnDtYGZktI1nKkPsVEcoK1HM=; Received: from 194-208-208-245.tele.net ([194.208.208.245]:56023 helo=[127.0.1.1]) by lx20.hoststar.hosting with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1urcNr-00BORr-NJ; Thu, 28 Aug 2025 15:09:44 +0200 From: Matthias Fend Date: Thu, 28 Aug 2025 15:09:40 +0200 Subject: [PATCH 3/5] Documentation: Add flash driver requirements MIME-Version: 1.0 Message-Id: <20250828-flash-support-v1-3-4c5dc674a05b@emfend.at> References: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> In-Reply-To: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> To: libcamera-devel@lists.libcamera.org Cc: Matthias Fend X-Mailer: b4 0.14.2 X-Spam-Score: -0.7 X-Spam-Bar: / X-Spam-Report: Spam detection software, running on the system "lx20.hoststar.hosting", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add a class to model camera flash devices. Currently, only v4l2 flash devices are supported. The v4l2 flash devices are implemented similar to the camera lenses. Signed-off-by: Matthias Fend --- include/libcamera/internal/camera_flash.h | 75 ++++++++ include/libcamera/internal/camera_sensor.h | 2 + src/libcamera/camera_flash.cpp | 248 [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: meson.build] 0.0 URIBL_DBL_BLOCKED_OPENDNS ADMINISTRATOR NOTICE: The query to dbl.spamhaus.org was blocked due to usage of an open resolver. See https://www.spamhaus.org/returnc/pub/ [URIs: meson.build] 0.0 URIBL_ZEN_BLOCKED_OPENDNS ADMINISTRATOR NOTICE: The query to zen.spamhaus.org was blocked due to usage of an open resolver. See https://www.spamhaus.org/returnc/pub/ [URIs: meson.build] -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address 0.0 Local_hs1_NotHoststar Sender is not from hoststar.ch|de|com 0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict Alignment 0.2 KAM_LOTSOFHASH Emails with lots of hash-like gibberish 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" Document the requirements for the v4l2 flash device drivers required by libcamera. Signed-off-by: Matthias Fend --- Documentation/documentation-contents.rst | 1 + Documentation/flash_driver_requirements.rst | 40 +++++++++++++++++++++++++++++ Documentation/index.rst | 1 + Documentation/meson.build | 1 + 4 files changed, 43 insertions(+) diff --git a/Documentation/documentation-contents.rst b/Documentation/documentation-contents.rst index 5c1118493745692f2521bced9dab48098585c39e..be7415cde42f55ae5f9da20bc9211227b8f8658c 100644 --- a/Documentation/documentation-contents.rst +++ b/Documentation/documentation-contents.rst @@ -22,6 +22,7 @@ * :doc:`/internal-api-html/index` * | * **Documentation for System Integrators** + * :doc:`/flash_driver_requirements` * :doc:`/lens_driver_requirements` * :doc:`/sensor_driver_requirements` diff --git a/Documentation/flash_driver_requirements.rst b/Documentation/flash_driver_requirements.rst new file mode 100644 index 0000000000000000000000000000000000000000..b4a1b4866e651c506203af7089b5634808de5ab7 --- /dev/null +++ b/Documentation/flash_driver_requirements.rst @@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: CC-BY-SA-4.0 + +.. include:: documentation-contents.rst + +.. _flash-driver-requirements: + +Flash Driver Requirements +========================= + +libcamera handles V4L2 flash devices in the CameraFlash class and defines +a consistent interface through its API towards other library components. + +The CameraFlash class uses the V4L2 subdev kernel API to interface with the +camera flash through a sub-device exposed to userspace by the V4L2 flash driver. + +In order for libcamera to be fully operational and provide all the required +information to interface with the camera flash to applications and pipeline +handlers, the driver must support a set of mandatory features. + +Mandatory Requirements +---------------------- + +The flash driver is assumed to be fully compliant with the V4L2 specification. + +The flash driver shall support the following V4L2 controls: + +* `V4L2_CID_FLASH_LED_MODE`_ +* `V4L2_CID_FLASH_STROBE_SOURCE`_ +* `V4L2_CID_FLASH_STROBE`_ +* `V4L2_CID_FLASH_TIMEOUT`_ +* `V4L2_CID_FLASH_INTENSITY`_ +* `V4L2_CID_FLASH_TORCH_INTENSITY`_ + +.. _V4L2_CID_FLASH_LED_MODE: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-flash.html +.. _V4L2_CID_FLASH_STROBE_SOURCE: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-flash.html +.. _V4L2_CID_FLASH_STROBE: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-flash.html +.. _V4L2_CID_FLASH_TIMEOUT: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-flash.html +.. _V4L2_CID_FLASH_INTENSITY: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-flash.html +.. _V4L2_CID_FLASH_TORCH_INTENSITY: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-flash.html + diff --git a/Documentation/index.rst b/Documentation/index.rst index 251112fbdf5f075b3e5c064d7230b9ad2c23b587..7ed56c17787fc643ef74cc35ef5b5db7d29eb18d 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -14,6 +14,7 @@ Camera Sensor Model Environment variables Feature Requirements + Flash driver requirements IPA Writer's guide Lens driver requirements libcamera Architecture diff --git a/Documentation/meson.build b/Documentation/meson.build index a8d4afc01dd154546d107b49bc322a993e4d78bd..965b33c60b031610251efbe59abb1682cb714d4a 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -159,6 +159,7 @@ if sphinx.found() 'documentation-contents.rst', 'environment_variables.rst', 'feature_requirements.rst', + 'flash_driver_requirements.rst', 'guides/application-developer.rst', 'guides/ipa.rst', 'guides/pipeline-handler.rst', From patchwork Thu Aug 28 13:09:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fend X-Patchwork-Id: 24256 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 C8D31BD87C for ; Thu, 28 Aug 2025 13:09:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3CEDB692FF; Thu, 28 Aug 2025 15:09:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=emfend.at header.i=@emfend.at header.b="EUMU6q6I"; dkim-atps=neutral Received: from lx20.hoststar.hosting (lx20.hoststar.hosting [168.119.41.54]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7EE61692FF for ; Thu, 28 Aug 2025 15:09:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=emfend.at; s=mail; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=sdkycQQGxXilrDAODlo8QVoy3nUofpFkOR1OAY89pFo=; b=EUMU6q6IIpavCWgdCv3WR7uirN IYWuMW3VbZe8mSK90bEd1urfkA4E/KqwvATrpMHQlTRLl/BL+X7XdFTwS9S+SBJjto3cUzTWqPPF5 HK50Q9gISd97RQcyRFkZRAV1WLQ9d0QhODP6i0hu2xKbl8+m0WEIAYarlGEggtQTHefQ=; Received: from 194-208-208-245.tele.net ([194.208.208.245]:56023 helo=[127.0.1.1]) by lx20.hoststar.hosting with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1urcNs-00BORr-A3; Thu, 28 Aug 2025 15:09:44 +0200 From: Matthias Fend Date: Thu, 28 Aug 2025 15:09:41 +0200 Subject: [PATCH 4/5] libcamera: Add flash helpers for pipeline handlers MIME-Version: 1.0 Message-Id: <20250828-flash-support-v1-4-4c5dc674a05b@emfend.at> References: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> In-Reply-To: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> To: libcamera-devel@lists.libcamera.org Cc: Matthias Fend X-Mailer: b4 0.14.2 X-Spam-Score: -0.7 X-Spam-Bar: / X-Spam-Report: Spam detection software, running on the system "lx20.hoststar.hosting", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Document the requirements for the v4l2 flash device drivers required by libcamera. Signed-off-by: Matthias Fend --- Documentation/documentation-contents.rst | 1 + Documentation/flash_driver_requirements.rst | 40 +++++++++++++++++++++++++++++ Documentation/i [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: meson.build] 0.0 URIBL_DBL_BLOCKED_OPENDNS ADMINISTRATOR NOTICE: The query to dbl.spamhaus.org was blocked due to usage of an open resolver. See https://www.spamhaus.org/returnc/pub/ [URIs: meson.build] 0.0 URIBL_ZEN_BLOCKED_OPENDNS ADMINISTRATOR NOTICE: The query to zen.spamhaus.org was blocked due to usage of an open resolver. See https://www.spamhaus.org/returnc/pub/ [URIs: meson.build] -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address 0.0 Local_hs1_NotHoststar Sender is not from hoststar.ch|de|com 0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict Alignment 0.2 KAM_LOTSOFHASH Emails with lots of hash-like gibberish 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 a set of helpers that pipeline handlers can use to deal with camera flash devices. This mainly involves mapping controls to the flash device and vice versa. Signed-off-by: Matthias Fend --- include/libcamera/internal/flash_control.h | 23 +++++++ src/libcamera/flash_control.cpp | 103 +++++++++++++++++++++++++++++ src/libcamera/meson.build | 1 + 3 files changed, 127 insertions(+) diff --git a/include/libcamera/internal/flash_control.h b/include/libcamera/internal/flash_control.h new file mode 100644 index 0000000000000000000000000000000000000000..d530dc24fd8ea2d5676d95ab5943a7dacee07617 --- /dev/null +++ b/include/libcamera/internal/flash_control.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2025, matthias.fend@emfend.at + * + * Flash controls helpers for pipeline handlers + */ + +#pragma once + +#include + +#include "libcamera/internal/camera_flash.h" + +namespace libcamera { + +class FlashControl +{ +public: + static void updateFlashControls(CameraFlash *flash, ControlInfoMap::Map &controls); + static void handleFlashControls(CameraFlash *flash, ControlList &controls, ControlList &metadata); +}; + +} /* namespace libcamera */ diff --git a/src/libcamera/flash_control.cpp b/src/libcamera/flash_control.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0350bfb7c6600d0cba767726be17678ce792e5e5 --- /dev/null +++ b/src/libcamera/flash_control.cpp @@ -0,0 +1,103 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2025, matthias.fend@emfend.at + * + * Flash controls helpers for pipeline handlers + */ + +#include "libcamera/internal/flash_control.h" + +#include +#include + +namespace libcamera { + +void FlashControl::updateFlashControls(CameraFlash *flash, ControlInfoMap::Map &controls) +{ + if (!flash) + return; + + controls[&controls::draft::FlashMode] = ControlInfo(controls::draft::FlashModeValues, controls::draft::FlashModeNone); + controls[&controls::draft::FlashIntensity] = flash->getFlashIntensityInfo(); + controls[&controls::draft::FlashTimeout] = flash->getFlashTimeoutInfo(); + controls[&controls::draft::FlashStrobeSource] = ControlInfo(controls::draft::FlashStrobeSourceValues, controls::draft::FlashStrobeSourceSoftware); + controls[&controls::draft::FlashStrobe] = ControlInfo(controls::draft::FlashStrobeValues); + controls[&controls::draft::FlashTorchIntensity] = flash->getTorchIntensityInfo(); +} + +void FlashControl::handleFlashControls(CameraFlash *flash, ControlList &controls, ControlList &metadata) +{ + if (!flash) + return; + + const auto &flashMode = controls.get(controls::draft::FlashMode); + if (flashMode) { + CameraFlash::Mode mode; + + switch (*flashMode) { + case controls::draft::FlashModeFlash: + mode = CameraFlash::Mode::Flash; + break; + case controls::draft::FlashModeTorch: + mode = CameraFlash::Mode::Torch; + break; + case controls::draft::FlashModeNone: + default: + mode = CameraFlash::Mode::None; + break; + } + + flash->setMode(mode); + } + + const auto &flashIntensity = controls.get(controls::draft::FlashIntensity); + if (flashIntensity) + flash->setFlashIntensity(*flashIntensity); + + const auto &flashTimeout = controls.get(controls::draft::FlashTimeout); + if (flashTimeout) + flash->setFlashTimeout(*flashTimeout); + + const auto &flashStrobeSource = controls.get(controls::draft::FlashStrobeSource); + if (flashStrobeSource) { + CameraFlash::StrobeSource source; + + switch (*flashStrobeSource) { + case controls::draft::FlashStrobeSourceExternal: + source = CameraFlash::StrobeSource::External; + break; + case controls::draft::FlashStrobeSourceSoftware: + default: + source = CameraFlash::StrobeSource::Software; + break; + } + + flash->setStrobeSource(source); + } + + const auto &flashStrobe = controls.get(controls::draft::FlashStrobe); + if (flashStrobe) { + switch (*flashStrobe) { + case controls::draft::FlashStrobeEnum::FlashStrobeStart: + flash->startStrobe(); + break; + case controls::draft::FlashStrobeEnum::FlashStrobeStop: + flash->stopStrobe(); + break; + default: + break; + } + } + + const auto &flashTorchIntensity = controls.get(controls::draft::FlashTorchIntensity); + if (flashTorchIntensity) + flash->setTorchIntensity(*flashTorchIntensity); + + metadata.set(controls::draft::FlashMode, flash->getMode()); + metadata.set(controls::draft::FlashIntensity, flash->getFlashIntensity()); + metadata.set(controls::draft::FlashTimeout, flash->getFlashTimeout()); + metadata.set(controls::draft::FlashStrobeSource, flash->getStrobeSource()); + metadata.set(controls::draft::FlashTorchIntensity, flash->getTorchIntensity()); +} + +} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 0f125661a51e2431c1febc353cef30a1219f9ce7..a68a49637db12f9e66b5bb38ee859aaac8c2fd1a 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -31,6 +31,7 @@ libcamera_internal_sources = files([ 'device_enumerator.cpp', 'device_enumerator_sysfs.cpp', 'dma_buf_allocator.cpp', + 'flash_control.cpp', 'formats.cpp', 'ipa_controls.cpp', 'ipa_data_serializer.cpp', From patchwork Thu Aug 28 13:09:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fend X-Patchwork-Id: 24257 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 A08ACC332A for ; Thu, 28 Aug 2025 13:09:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 125EC69305; Thu, 28 Aug 2025 15:09:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=emfend.at header.i=@emfend.at header.b="FcR4zIai"; dkim-atps=neutral Received: from lx20.hoststar.hosting (lx20.hoststar.hosting [168.119.41.54]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 105C869301 for ; Thu, 28 Aug 2025 15:09:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=emfend.at; s=mail; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=d9LOX1DvwYOxhjRSOQ0loAX/jgTazITi85JZDtouFbY=; b=FcR4zIainyGO6qQKvC8IvlKVEX KqOZtNdn6j5pwdLcm/CE1e1h1e5IyPPyIANgLlwzEdsqq1o4RdLQirth5NzB3sDI+sgJRNCYhjNDB IDzU1KOmygv6IB2HGV98QqK//RCUVF9VIFCsgG/M2/4Ynt/Xx/S7Pxw+Hpan2gs6Ub6w=; Received: from 194-208-208-245.tele.net ([194.208.208.245]:56023 helo=[127.0.1.1]) by lx20.hoststar.hosting with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1urcNt-00BORr-04; Thu, 28 Aug 2025 15:09:45 +0200 From: Matthias Fend Date: Thu, 28 Aug 2025 15:09:42 +0200 Subject: [PATCH 5/5] rkisp1: Add support for camera flash devices MIME-Version: 1.0 Message-Id: <20250828-flash-support-v1-5-4c5dc674a05b@emfend.at> References: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> In-Reply-To: <20250828-flash-support-v1-0-4c5dc674a05b@emfend.at> To: libcamera-devel@lists.libcamera.org Cc: Matthias Fend X-Mailer: b4 0.14.2 X-Spam-Score: -0.7 X-Spam-Bar: / X-Spam-Report: Spam detection software, running on the system "lx20.hoststar.hosting", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add a set of helpers that pipeline handlers can use to deal with camera flash devices. This mainly involves mapping controls to the flash device and vice versa. Signed-off-by: Matthias Fend --- include/libcamera/internal/flash_control.h | 23 +++++++ src/libcamera/flash_control.cpp | 103 +++++++++++++++++++++++++++++ src/libcamera/mes [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: meson.build] 0.0 URIBL_DBL_BLOCKED_OPENDNS ADMINISTRATOR NOTICE: The query to dbl.spamhaus.org was blocked due to usage of an open resolver. See https://www.spamhaus.org/returnc/pub/ [URIs: meson.build] 0.0 URIBL_ZEN_BLOCKED_OPENDNS ADMINISTRATOR NOTICE: The query to zen.spamhaus.org was blocked due to usage of an open resolver. See https://www.spamhaus.org/returnc/pub/ [URIs: meson.build] -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address 0.0 Local_hs1_NotHoststar Sender is not from hoststar.ch|de|com 0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict Alignment 0.2 KAM_LOTSOFHASH Emails with lots of hash-like gibberish 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" Use the flash device pipeline helpers to bring flash support to the RKISP1 pipeline. Signed-off-by: Matthias Fend --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 55d7d4442caf25c3e56880136986f48c1447c433..585bb2f0b51a2fe76cc84fa1a62cf66ef43c5723 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -39,6 +39,7 @@ #include "libcamera/internal/converter/converter_v4l2_m2m.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" +#include "libcamera/internal/flash_control.h" #include "libcamera/internal/framebuffer.h" #include "libcamera/internal/ipa_manager.h" #include "libcamera/internal/media_device.h" @@ -1294,6 +1295,8 @@ int PipelineHandlerRkISP1::updateControls(RkISP1CameraData *data) activeCrop_ = scalerMaxCrop_; } + FlashControl::updateFlashControls(data->sensor_->flash(), controls); + /* Add the IPA registered controls to list of camera controls. */ for (const auto &ipaControl : data->ipaControls_) controls[ipaControl.first] = ipaControl.second; @@ -1501,6 +1504,8 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer) info->metadataProcessed = true; } + FlashControl::handleFlashControls(data->sensor_->flash(), request->controls(), request->metadata()); + if (!useDewarper_) { completeBuffer(request, buffer); tryCompleteRequest(info);