[libcamera-devel] [PATCH/RFC] libcamera: camera_sensor: Accept entities exposing the ISP function

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Feb 8 02:39:03 CET 2021


Camera sensors can include an ISP, which may be reported as a separate
entity from the pixel array in the media graph.

Support such sensors by accepting MEDIA_ENT_F_PROC_VIDEO_ISP as a valid
entity type. This allows using sensors that can be fully (or at least
meaningfully) configured through the ISP's source pad only. Sensors that
require further configuration, on the ISP sink pad and/or on the pixel
array's source pad, will require further extension to the CameraSensor
class.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/libcamera/camera_sensor.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

This patch depends on the new MEDIA_ENT_F_PROC_VIDEO_ISP entity
function, which will be available in v5.12-rc1. I'll update the kernel
headers when that kernel will be released, in a few weeks from now.

diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 59834ffcdd94..8158a84b63db 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -198,7 +198,12 @@ int CameraSensor::init()
 		return -EINVAL;
 	}
 
-	if (entity_->function() != MEDIA_ENT_F_CAM_SENSOR) {
+	switch (entity_->function()) {
+	case MEDIA_ENT_F_CAM_SENSOR:
+	case MEDIA_ENT_F_PROC_VIDEO_ISP:
+		break;
+
+	default:
 		LOG(CameraSensor, Error)
 			<< "Invalid sensor function "
 			<< utils::hex(entity_->function());
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list