[libcamera-devel,RFC,2/7] libcamera: camera_lens: add method to set controls on subdev
diff mbox series

Message ID 20230202111252.3366729-3-matthias.fend@emfend.at
State New
Headers show
Series
  • add support for more complex optics
Related show

Commit Message

Matthias Fend Feb. 2, 2023, 11:12 a.m. UTC
This method allows v4l2 controls to be set directly on the underlying
v4l2 subdevice.

Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
---
 include/libcamera/internal/camera_lens.h |  1 +
 src/libcamera/camera_lens.cpp            | 10 ++++++++++
 2 files changed, 11 insertions(+)

Patch
diff mbox series

diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h
index 277417da..66c32a46 100644
--- a/include/libcamera/internal/camera_lens.h
+++ b/include/libcamera/internal/camera_lens.h
@@ -27,6 +27,7 @@  public:
 
 	int init();
 	int setFocusPosition(int32_t position);
+	int setSubdevControls(const ControlList &controls);
 
 	const std::string &model() const { return model_; }
 
diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp
index b3d48199..c8fadda5 100644
--- a/src/libcamera/camera_lens.cpp
+++ b/src/libcamera/camera_lens.cpp
@@ -95,6 +95,16 @@  int CameraLens::setFocusPosition(int32_t position)
 	return 0;
 }
 
+int CameraLens::setSubdevControls(const ControlList &controls)
+{
+	ControlList lensCtrls(controls);
+
+	if (subdev_->setControls(&lensCtrls))
+		return -EINVAL;
+
+	return 0;
+}
+
 int CameraLens::validateLensDriver()
 {
 	int ret = 0;