[libcamera-devel,1/3] ipu3: Registering AF controls
diff mbox series

Message ID 20220916103713.21132-2-hpa@redhat.com
State New
Headers show
Series
  • Basic AF control for IPU3
Related show

Commit Message

Kate Hsuan Sept. 16, 2022, 10:37 a.m. UTC
Regitering AF controls, including AF_MODE and LENS_POSITION.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
---
 src/ipa/ipu3/ipu3.cpp                | 4 ++++
 src/libcamera/pipeline/ipu3/ipu3.cpp | 2 ++
 2 files changed, 6 insertions(+)

Comments

Jacopo Mondi Sept. 28, 2022, 6:52 a.m. UTC | #1
Hi Kate

On Fri, Sep 16, 2022 at 06:37:11PM +0800, Kate Hsuan via libcamera-devel wrote:
> Regitering AF controls, including AF_MODE and LENS_POSITION.

Registering

>
> Signed-off-by: Kate Hsuan <hpa@redhat.com>
> ---
>  src/ipa/ipu3/ipu3.cpp                | 4 ++++
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 2 ++
>  2 files changed, 6 insertions(+)
>
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index e37b2fa0..ac0c42a7 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -277,6 +277,10 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,
>  							       frameDurations[1],
>  							       frameDurations[2]);
>
> +	/* Af controls */
> +	controls[&controls::AfMode] = ControlInfo(controls::AfModeValues);
> +	controls[&controls::LensPosition] = ControlInfo(0.0f, 1.0f, 0.5f);
> +
>  	*ipaControls = ControlInfoMap(std::move(controls), controls::controls);
>  }
>
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 93219a6c..2e35b9bc 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -43,6 +43,8 @@ LOG_DEFINE_CATEGORY(IPU3)
>
>  static const ControlInfoMap::Map IPU3Controls = {
>  	{ &controls::draft::PipelineDepth, ControlInfo(2, 3) },
> +	{ &controls::AfMode, ControlInfo(controls::AfModeValues) },
> +	{ &controls::LensPosition, ControlInfo(0.0f, 1.0f, 0.5f) }

Isn't this a duplicate ?

The pipeline handler takes the ipa registered controls and adds them
to the camera's controls

int PipelineHandlerIPU3::updateControls(IPU3CameraData *data)
{
        ..


	/* Add the IPA registered controls to list of camera controls. */
	for (const auto &ipaControl : data->ipaControls_)
		controls[ipaControl.first] = ipaControl.second;
}

I think it's enough to register the controls on the IPA side maybe ?

Thanks
  j


>  };
>
>  class IPU3CameraData : public Camera::Private
> --
> 2.37.3
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index e37b2fa0..ac0c42a7 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -277,6 +277,10 @@  void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,
 							       frameDurations[1],
 							       frameDurations[2]);
 
+	/* Af controls */
+	controls[&controls::AfMode] = ControlInfo(controls::AfModeValues);
+	controls[&controls::LensPosition] = ControlInfo(0.0f, 1.0f, 0.5f);
+
 	*ipaControls = ControlInfoMap(std::move(controls), controls::controls);
 }
 
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 93219a6c..2e35b9bc 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -43,6 +43,8 @@  LOG_DEFINE_CATEGORY(IPU3)
 
 static const ControlInfoMap::Map IPU3Controls = {
 	{ &controls::draft::PipelineDepth, ControlInfo(2, 3) },
+	{ &controls::AfMode, ControlInfo(controls::AfModeValues) },
+	{ &controls::LensPosition, ControlInfo(0.0f, 1.0f, 0.5f) }
 };
 
 class IPU3CameraData : public Camera::Private