[WIP,RFC,11/26] libcamera: Support raw sensor model
diff mbox series

Message ID 20261023-b4-raw-model-v1-11-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
Now that the raw sensor model is fully supported, set the client
capability bit V4L2_SUBDEV_CLIENT_CAP_COMMON_RAW_SENSOR when interacting
with V4L2 subdevices.

Also bump the priority back up for the CameraRawSensor class, so it is
matched first for sensors that support the new model.

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
---
This commit needs to be at the very end of the series before merging.
I've kept it in the middle to ease review for now, as it is a WIP
series.
---
 src/libcamera/sensor/camera_sensor_raw.cpp |  2 +-
 src/libcamera/v4l2_subdevice.cpp           | 22 ++++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp
index d8874a7c5e1a..5301bc6d9f8c 100644
--- a/src/libcamera/sensor/camera_sensor_raw.cpp
+++ b/src/libcamera/sensor/camera_sensor_raw.cpp
@@ -1187,6 +1187,6 @@  std::string CameraSensorRaw::logPrefix() const
 	return "'" + entity_->name() + "'";
 }
 
-REGISTER_CAMERA_SENSOR(CameraSensorRaw, -200)
+REGISTER_CAMERA_SENSOR(CameraSensorRaw, 0)
 
 } /* namespace libcamera */
diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index 36f17e23da8e..28f962bbdd10 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -1281,19 +1281,21 @@  int V4L2Subdevice::open()
 		return ret;
 	}
 
+	struct v4l2_subdev_client_capability clientCaps{};
+	clientCaps.capabilities = V4L2_SUBDEV_CLIENT_CAP_COMMON_RAW_SENSOR;
+
 	/* If the subdev supports streams, enable the streams API. */
 	if (caps_.hasStreams()) {
-		struct v4l2_subdev_client_capability clientCaps{};
-		clientCaps.capabilities = V4L2_SUBDEV_CLIENT_CAP_STREAMS;
+		clientCaps.capabilities |= V4L2_SUBDEV_CLIENT_CAP_STREAMS;
+	}
 
-		ret = ioctl(VIDIOC_SUBDEV_S_CLIENT_CAP, &clientCaps);
-		if (ret < 0) {
-			ret = -errno;
-			LOG(V4L2, Error)
-				<< "Unable to set client capabilities: "
-				<< strerror(-ret);
-			return ret;
-		}
+	ret = ioctl(VIDIOC_SUBDEV_S_CLIENT_CAP, &clientCaps);
+	if (ret < 0 && errno != ENOTTY) {
+		ret = -errno;
+		LOG(V4L2, Error)
+			<< "Unable to set client capabilities: "
+			<< strerror(-ret);
+		return ret;
 	}
 
 	return 0;