[libcamera-devel,v2,01/14] pipeline: ipa: raspberrypi: Check if lens actuator is available
diff mbox series

Message ID 20230123154934.27803-2-naush@raspberrypi.com
State Accepted
Commit a0701930a8be9900d428a8cbae0414b455b56e97
Headers show
Series
  • Raspberry Pi: Camera Module 3 support
Related show

Commit Message

Naushir Patuck Jan. 23, 2023, 3:49 p.m. UTC
Check if a lens actuator is available by the presense of the lens driver entity
in the pipeline handler. Pass this result to the IPA on init.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
---
 include/libcamera/ipa/raspberrypi.mojom            | 2 +-
 src/ipa/raspberrypi/raspberrypi.cpp                | 7 +++++--
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom
index 189f978a5081..e7dabcbe5313 100644
--- a/include/libcamera/ipa/raspberrypi.mojom
+++ b/include/libcamera/ipa/raspberrypi.mojom
@@ -50,7 +50,7 @@  struct StartConfig {
 };
 
 interface IPARPiInterface {
-	init(libcamera.IPASettings settings)
+	init(libcamera.IPASettings settings, bool lensPresent)
 		=> (int32 ret, IPAInitResult result);
 	start(libcamera.ControlList controls) => (StartConfig startConfig);
 	stop();
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index bead436def3c..ec18497155ba 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -115,7 +115,7 @@  public:
 			munmap(lsTable_, MaxLsGridSize);
 	}
 
-	int init(const IPASettings &settings, IPAInitResult *result) override;
+	int init(const IPASettings &settings, bool lensPresent, IPAInitResult *result) override;
 	void start(const ControlList &controls, StartConfig *startConfig) override;
 	void stop() override {}
 
@@ -158,6 +158,7 @@  private:
 
 	ControlInfoMap sensorCtrls_;
 	ControlInfoMap ispCtrls_;
+	bool lensPresent_;
 	ControlList libcameraMetadata_;
 
 	/* Camera sensor params. */
@@ -204,7 +205,7 @@  private:
 	uint32_t maxSensorGainCode_;
 };
 
-int IPARPi::init(const IPASettings &settings, IPAInitResult *result)
+int IPARPi::init(const IPASettings &settings, bool lensPresent, IPAInitResult *result)
 {
 	/*
 	 * Load the "helper" for this sensor. This tells us all the device specific stuff
@@ -241,6 +242,8 @@  int IPARPi::init(const IPASettings &settings, IPAInitResult *result)
 		return ret;
 	}
 
+	lensPresent_ = lensPresent;
+
 	controller_.initialise();
 
 	/* Return the controls handled by the IPA */
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index f6303e60e1e6..62417669bdc5 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -32,6 +32,7 @@ 
 
 #include "libcamera/internal/bayer_format.h"
 #include "libcamera/internal/camera.h"
+#include "libcamera/internal/camera_lens.h"
 #include "libcamera/internal/camera_sensor.h"
 #include "libcamera/internal/device_enumerator.h"
 #include "libcamera/internal/framebuffer.h"
@@ -1606,7 +1607,7 @@  int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)
 
 	IPASettings settings(configurationFile, sensor_->model());
 
-	return ipa_->init(settings, result);
+	return ipa_->init(settings, !!sensor_->focusLens(), result);
 }
 
 int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPAConfigResult *result)