Re: [PATCH v7 03/15] media: i2c: imx219: Report internal routes to userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/03/2024 00:08, Laurent Pinchart wrote:
Usage of internal pads creates a route internal to the subdev, and the
V4L2 camera sensor API requires such routes to be reported to userspace.
Create the route in the .init_state() operation.

Internal routing support requires stream support, so set the
V4L2_SUBDEV_FL_HAS_STREAMS flag and switch formats and selection
rectangles access from pads to streams. As the route is immutable,

No "switch formats and selection rectangles access from pads to stream" in this patch.

 Tomi

there's no need to implement the .set_routing() operation, and we can
hardcode the sink and source stream IDs to 0.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
Reviewed-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
---
Changes since v6:

- Drop change to get format API in imx219_set_ctrl()
- Fix function name in commit message
- Set V4L2_SUBDEV_ROUTE_FL_IMMUTABLE flag on route
---
  drivers/media/i2c/imx219.c | 24 +++++++++++++++++++++++-
  1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index 817bf192e4d9..6602250834be 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -993,15 +993,36 @@ static int imx219_get_selection(struct v4l2_subdev *sd,
  static int imx219_init_state(struct v4l2_subdev *sd,
  			     struct v4l2_subdev_state *state)
  {
+	struct v4l2_subdev_route routes[1] = {
+		{
+			.sink_pad = IMX219_PAD_IMAGE,
+			.sink_stream = 0,
+			.source_pad = IMX219_PAD_SOURCE,
+			.source_stream = 0,
+			.flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE |
+				 V4L2_SUBDEV_ROUTE_FL_IMMUTABLE,
+		},
+	};
+	struct v4l2_subdev_krouting routing = {
+		.len_routes = ARRAY_SIZE(routes),
+		.num_routes = ARRAY_SIZE(routes),
+		.routes = routes,
+	};
  	struct v4l2_subdev_format fmt = {
  		.which = V4L2_SUBDEV_FORMAT_TRY,
  		.pad = IMX219_PAD_SOURCE,
+		.stream = 0,
  		.format = {
  			.code = MEDIA_BUS_FMT_SRGGB10_1X10,
  			.width = supported_modes[0].width,
  			.height = supported_modes[0].height,
  		},
  	};
+	int ret;
+
+	ret = v4l2_subdev_set_routing(sd, state, &routing);
+	if (ret)
+		return ret;
imx219_set_pad_format(sd, state, &fmt); @@ -1260,7 +1281,8 @@ static int imx219_probe(struct i2c_client *client) /* Initialize subdev */
  	imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
-			    V4L2_SUBDEV_FL_HAS_EVENTS;
+			    V4L2_SUBDEV_FL_HAS_EVENTS |
+			    V4L2_SUBDEV_FL_STREAMS;
  	imx219->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
/*





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux