[libcamera-devel,v5,5/9] libcamera: camera_lens: Add function to fetch subdev controls
diff mbox series

Message ID 20220303234956.1463551-6-djrscally@gmail.com
State Accepted
Headers show
Series
  • Enumerate CameraLens by following sensor's ancillary links
Related show

Commit Message

Daniel Scally March 3, 2022, 11:49 p.m. UTC
Add a function to the CameraLens class to fetch the V4L2 controls
for its V4L2 subdev

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
---
Changes in v5:

	- None

Changes since v4:

	- None

Changes in v3:

	- s/sensor/lens


 include/libcamera/internal/camera_lens.h |  4 ++++
 src/libcamera/camera_lens.cpp            | 11 +++++++++++
 2 files changed, 15 insertions(+)

Comments

Nicolas Dufresne via libcamera-devel March 9, 2022, 3:13 p.m. UTC | #1
Hi !

Thanks for the patch !

On 04/03/2022 00:49, Daniel Scally wrote:
> Add a function to the CameraLens class to fetch the V4L2 controls
> for its V4L2 subdev
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Daniel Scally <djrscally@gmail.com>

Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>

> ---
> Changes in v5:
> 
> 	- None
> 
> Changes since v4:
> 
> 	- None
> 
> Changes in v3:
> 
> 	- s/sensor/lens
> 
> 
>   include/libcamera/internal/camera_lens.h |  4 ++++
>   src/libcamera/camera_lens.cpp            | 11 +++++++++++
>   2 files changed, 15 insertions(+)
> 
> diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h
> index 6f2ea1bc..64794294 100644
> --- a/include/libcamera/internal/camera_lens.h
> +++ b/include/libcamera/internal/camera_lens.h
> @@ -12,6 +12,8 @@
>   #include <libcamera/base/class.h>
>   #include <libcamera/base/log.h>
>   
> +#include <libcamera/controls.h>
> +
>   namespace libcamera {
>   
>   class MediaEntity;
> @@ -28,6 +30,8 @@ public:
>   
>   	const std::string &model() const { return model_; }
>   
> +	const ControlInfoMap &controls() const;
> +
>   protected:
>   	std::string logPrefix() const override;
>   
> diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp
> index 189cb025..142390ed 100644
> --- a/src/libcamera/camera_lens.cpp
> +++ b/src/libcamera/camera_lens.cpp
> @@ -139,4 +139,15 @@ std::string CameraLens::logPrefix() const
>   	return "'" + entity_->name() + "'";
>   }
>   
> +/**
> + * \fn CameraLens::controls()
> + * \brief Retrieve the V4L2 controls of the lens' subdev
> + *
> + * \return A map of the V4L2 controls supported by the lens' driver
> + */
> +const ControlInfoMap &CameraLens::controls() const
> +{
> +	return subdev_->controls();
> +}
> +
>   } /* namespace libcamera */

Patch
diff mbox series

diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h
index 6f2ea1bc..64794294 100644
--- a/include/libcamera/internal/camera_lens.h
+++ b/include/libcamera/internal/camera_lens.h
@@ -12,6 +12,8 @@ 
 #include <libcamera/base/class.h>
 #include <libcamera/base/log.h>
 
+#include <libcamera/controls.h>
+
 namespace libcamera {
 
 class MediaEntity;
@@ -28,6 +30,8 @@  public:
 
 	const std::string &model() const { return model_; }
 
+	const ControlInfoMap &controls() const;
+
 protected:
 	std::string logPrefix() const override;
 
diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp
index 189cb025..142390ed 100644
--- a/src/libcamera/camera_lens.cpp
+++ b/src/libcamera/camera_lens.cpp
@@ -139,4 +139,15 @@  std::string CameraLens::logPrefix() const
 	return "'" + entity_->name() + "'";
 }
 
+/**
+ * \fn CameraLens::controls()
+ * \brief Retrieve the V4L2 controls of the lens' subdev
+ *
+ * \return A map of the V4L2 controls supported by the lens' driver
+ */
+const ControlInfoMap &CameraLens::controls() const
+{
+	return subdev_->controls();
+}
+
 } /* namespace libcamera */