[WIP,RFC,10/26] libcamera: camera_sensor_raw: Check for CONFIG_MODEL
diff mbox series

Message ID 20261023-b4-raw-model-v1-10-eadb9948901b@ideasonboard.com
State New
Headers show
Series
  • Support the new common raw sensor model
Related show

Commit Message

Jai Luthra Oct. 23, 2026, 10:58 a.m. UTC
Query the V4L2_CID_CONFIG_MODEL control on the sensor sub-device, and
only match it with the CameraRawSensor class if the COMMON_RAW_SENSOR
bit is set.

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
---
 src/libcamera/sensor/camera_sensor_raw.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp
index 29ea9406ad0d..d8874a7c5e1a 100644
--- a/src/libcamera/sensor/camera_sensor_raw.cpp
+++ b/src/libcamera/sensor/camera_sensor_raw.cpp
@@ -241,6 +241,23 @@  std::optional<int> CameraSensorRaw::init()
 	if (ret)
 		return { ret };
 
+	/* Ensure CONFIG_MODEL is set to COMMON_RAW_SENSOR */
+	ControlList configModel = subdev_->getControls({ { V4L2_CID_CONFIG_MODEL } });
+	if (configModel.empty()) {
+		LOG(CameraSensor, Debug)
+			<< entity_->name() << ": control "
+			<< "V4L2_CID_CONFIG_MODEL not available";
+		return { 0 };
+	}
+
+	int32_t model = configModel.get(V4L2_CID_CONFIG_MODEL).get<int32_t>();
+	if (!(model & V4L2_CONFIG_MODEL_COMMON_RAW_SENSOR)) {
+		LOG(CameraSensor, Debug)
+			<< entity_->name()
+			<< ": Common raw sensor model not supported";
+		return { 0 };
+	}
+
 	/*
 	 * 1. Identify the pads.
 	 */