[libcamera-devel] [PATCH v2 05/14] ipa: mojom: raspberrypi: Add setLensControls() function
Naushir Patuck
naush at raspberrypi.com
Mon Jan 23 16:49:25 CET 2023
From: Nick Hollinghurst <nick.hollinghurst at raspberrypi.com>
Add a setLensControls() function to the IPA/pipeline handler interface. This
will be used in a future commit to control the lens actuator position from an
autofocus algorithm.
Signed-off-by: Nick Hollinghurst <nick.hollinghurst at raspberrypi.com>
Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
Reviewed-by: Naushir Patuck <naush at raspberrypi.com>
Reviewed-by: David Plowman <david.plowman at raspberrypi.com>
---
include/libcamera/ipa/raspberrypi.mojom | 1 +
src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom
index bfacd1275bfb..8e78f167f179 100644
--- a/include/libcamera/ipa/raspberrypi.mojom
+++ b/include/libcamera/ipa/raspberrypi.mojom
@@ -131,4 +131,5 @@ interface IPARPiEventInterface {
embeddedComplete(uint32 bufferId);
setIspControls(libcamera.ControlList controls);
setDelayedControls(libcamera.ControlList controls, uint32 delayContext);
+ setLensControls(libcamera.ControlList controls);
};
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index b0f4930c6f1b..d1fd93292652 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -208,6 +208,7 @@ public:
void embeddedComplete(uint32_t bufferId);
void setIspControls(const ControlList &controls);
void setDelayedControls(const ControlList &controls, uint32_t delayContext);
+ void setLensControls(const ControlList &controls);
void setSensorControls(ControlList &controls);
void unicamTimeout();
@@ -1589,6 +1590,7 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)
ipa_->embeddedComplete.connect(this, &RPiCameraData::embeddedComplete);
ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls);
ipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls);
+ ipa_->setLensControls.connect(this, &RPiCameraData::setLensControls);
/*
* The configuration (tuning file) is made from the sensor name unless
@@ -1836,6 +1838,16 @@ void RPiCameraData::setDelayedControls(const ControlList &controls, uint32_t del
handleState();
}
+void RPiCameraData::setLensControls(const ControlList &controls)
+{
+ CameraLens *lens = sensor_->focusLens();
+
+ if (lens && controls.contains(V4L2_CID_FOCUS_ABSOLUTE)) {
+ ControlValue const &focusValue = controls.get(V4L2_CID_FOCUS_ABSOLUTE);
+ lens->setFocusPosition(focusValue.get<int32_t>());
+ }
+}
+
void RPiCameraData::setSensorControls(ControlList &controls)
{
/*
--
2.25.1
More information about the libcamera-devel
mailing list