summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 212fc76a..d9c740d6 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -28,6 +28,7 @@
#include <libcamera/stream.h>
#include "libcamera/internal/camera.h"
+#include "libcamera/internal/camera_lens.h"
#include "libcamera/internal/camera_sensor.h"
#include "libcamera/internal/delayed_controls.h"
#include "libcamera/internal/device_enumerator.h"
@@ -107,6 +108,7 @@ private:
void paramFilled(unsigned int frame);
void setSensorControls(unsigned int frame,
const ControlList &sensorControls);
+ void setLensControls(const ControlList &lensControls);
void metadataReady(unsigned int frame, const ControlList &metadata);
};
@@ -374,6 +376,20 @@ void RkISP1CameraData::setSensorControls([[maybe_unused]] unsigned int frame,
delayedCtrls_->push(sensorControls);
}
+void RkISP1CameraData::setLensControls(const ControlList &lensControls)
+{
+ CameraLens *focusLens = sensor_->focusLens();
+ if (!focusLens)
+ return;
+
+ if (!lensControls.contains(V4L2_CID_FOCUS_ABSOLUTE))
+ return;
+
+ const ControlValue &focusValue = lensControls.get(V4L2_CID_FOCUS_ABSOLUTE);
+
+ focusLens->setFocusPosition(focusValue.get<int32_t>());
+}
+
void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)
{
RkISP1FrameInfo *info = frameInfo_.find(frame);
@@ -681,6 +697,10 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
std::map<uint32_t, ControlInfoMap> entityControls;
entityControls.emplace(0, data->sensor_->controls());
+ CameraLens *lens = data->sensor_->focusLens();
+ if (lens)
+ entityControls.emplace(1, lens->controls());
+
ret = data->ipa_->configure(sensorInfo, streamConfig, entityControls);
if (ret) {
LOG(RkISP1, Error) << "failed configuring IPA (" << ret << ")";