[libcamera-devel] [PATCH 06/15] libcamera: ipu3: Initialize DelayedControls with camera properties

Jacopo Mondi jacopo at jmondi.org
Mon Jun 27 18:27:23 CEST 2022


Use the sensor control delays as reported by the camera sensor
properties map to intialize delayed controls for the IPU3 platform.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 30 ++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index b7dda282faab..19d022c584ed 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -1127,13 +1127,31 @@ int PipelineHandlerIPU3::registerCameras()
 			continue;
 
 		/*
-		 * \todo Read delay values from the sensor itself or from a
-		 * a sensor database. For now use generic values taken from
-		 * the Raspberry Pi and listed as 'generic values'.
+		 * Get the sensor delays and validate the required controls
+		 * are reported.
 		 */
-		std::unordered_map<uint32_t, DelayedControls::ControlParams> params = {
-			{ V4L2_CID_ANALOGUE_GAIN, { 1, false } },
-			{ V4L2_CID_EXPOSURE, { 2, false } },
+		const CameraSensor::SensorDelays &sensorDelays = cio2->sensor()->sensorDelays();
+		if (!sensorDelays.count(&controls::internal::ExposureTime) ||
+		    !sensorDelays.count(&controls::internal::draft::SensorAnalogueGain)) {
+			LOG(IPU3, Error) << "Missing sensor control delays";
+			return -ENODEV;
+		}
+
+		const std::unordered_map<uint32_t, DelayedControls::ControlParams> params{
+			{
+				V4L2_CID_ANALOGUE_GAIN,
+				{
+					sensorDelays.at(&controls::internal::draft::SensorAnalogueGain),
+					false,
+				},
+			},
+			{
+				V4L2_CID_EXPOSURE,
+				{
+					sensorDelays.at(&controls::internal::ExposureTime),
+					false,
+				},
+			},
 		};
 
 		data->delayedCtrls_ =
-- 
2.36.1



More information about the libcamera-devel mailing list