Skip to contentSkip to conversation

media: intel/ipu6: Set V4L2_CAP_IO_MC flag for isys /dev/video# nodes

PATCH Applied Hans de Goede 3 participants 3 messages Oct 2, 2023 – Oct 10, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: intel/ipu6: Set V4L2_CAP_IO_MC flag for isys /dev/video# nodes

The IPU6 isys is a media-controller centric device which needs the pipeline to be configured using the media controller API before use.

Set the V4L2_CAP_IO_MC flag to reflect this.

This also allows dropping of the enum_input() g_input() and s_input() implementations, with V4L2_CAP_IO_MC set the v4l2-core will take care of those.

---
 .../media/pci/intel/ipu6/ipu6-isys-video.c    | 29 ++-----------------
 1 file changed, 2 insertions(+), 27 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +2 -27
index ad74a19527b7..e6fc32603c3f 100644
@@ -262,29 +262,6 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *fh,
 	return 0;
 }
 
-static int vidioc_enum_input(struct file *file, void *fh,
-			     struct v4l2_input *input)
-{
-	if (input->index > 0)
-		return -EINVAL;
-	strscpy(input->name, "camera", sizeof(input->name));
-	input->type = V4L2_INPUT_TYPE_CAMERA;
-
-	return 0;
-}
-
-static int vidioc_g_input(struct file *file, void *fh, unsigned int *input)
-{
-	*input = 0;
-
-	return 0;
-}
-
-static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
-{
-	return input == 0 ? 0 : -EINVAL;
-}
-
 static int link_validate(struct media_link *link)
 {
 	struct ipu6_isys_video *av =
@@ -1017,9 +994,6 @@ static const struct v4l2_ioctl_ops ioctl_ops_mplane = {
 	.vidioc_streamon = vb2_ioctl_streamon,
 	.vidioc_streamoff = vb2_ioctl_streamoff,
 	.vidioc_expbuf = vb2_ioctl_expbuf,
-	.vidioc_enum_input = vidioc_enum_input,
-	.vidioc_g_input = vidioc_g_input,
-	.vidioc_s_input = vidioc_s_input,
 };
 
 static const struct media_entity_operations entity_ops = {
@@ -1217,7 +1191,8 @@ int ipu6_isys_video_init(struct ipu6_isys_video *av)
 
 	mutex_init(&av->mutex);
 	av->vdev.device_caps = V4L2_CAP_STREAMING |
-			       V4L2_CAP_VIDEO_CAPTURE_MPLANE;
+			       V4L2_CAP_VIDEO_CAPTURE_MPLANE |
+			       V4L2_CAP_IO_MC;
 	av->vdev.vfl_dir = VFL_DIR_RX;
 
 	ret = ipu6_isys_queue_init(&av->aq);
Signature · 1 line
2.41.0
maintainer
#1 lore raw

Hi Hans,

Quoted 10 lines · Hans de Goede

The IPU6 isys is a media-controller centric device which needs the pipeline to be configured using the media controller API before use.

Set the V4L2_CAP_IO_MC flag to reflect this.

This also allows dropping of the enum_input() g_input() and s_input() implementations, with V4L2_CAP_IO_MC set the v4l2-core will take care of those.

Thanks.

Cc'd Bingbu. (Also bounced the patch to him.)

Quoted 61 lines
---
 .../media/pci/intel/ipu6/ipu6-isys-video.c    | 29 ++-----------------
 1 file changed, 2 insertions(+), 27 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +2 -27
index ad74a19527b7..e6fc32603c3f 100644
@@ -262,29 +262,6 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *fh,
 	return 0;
 }
 
-static int vidioc_enum_input(struct file *file, void *fh,
-			     struct v4l2_input *input)
-{
-	if (input->index > 0)
-		return -EINVAL;
-	strscpy(input->name, "camera", sizeof(input->name));
-	input->type = V4L2_INPUT_TYPE_CAMERA;
-
-	return 0;
-}
-
-static int vidioc_g_input(struct file *file, void *fh, unsigned int *input)
-{
-	*input = 0;
-
-	return 0;
-}
-
-static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
-{
-	return input == 0 ? 0 : -EINVAL;
-}
-
 static int link_validate(struct media_link *link)
 {
 	struct ipu6_isys_video *av =
@@ -1017,9 +994,6 @@ static const struct v4l2_ioctl_ops ioctl_ops_mplane = {
 	.vidioc_streamon = vb2_ioctl_streamon,
 	.vidioc_streamoff = vb2_ioctl_streamoff,
 	.vidioc_expbuf = vb2_ioctl_expbuf,
-	.vidioc_enum_input = vidioc_enum_input,
-	.vidioc_g_input = vidioc_g_input,
-	.vidioc_s_input = vidioc_s_input,
 };
 
 static const struct media_entity_operations entity_ops = {
@@ -1217,7 +1191,8 @@ int ipu6_isys_video_init(struct ipu6_isys_video *av)
 
 	mutex_init(&av->mutex);
 	av->vdev.device_caps = V4L2_CAP_STREAMING |
-			       V4L2_CAP_VIDEO_CAPTURE_MPLANE;
+			       V4L2_CAP_VIDEO_CAPTURE_MPLANE |
+			       V4L2_CAP_IO_MC;
 	av->vdev.vfl_dir = VFL_DIR_RX;
 
 	ret = ipu6_isys_queue_init(&av->aq);
Signature · 1 line
2.41.0
Signature · 1 line
Sakari Ailus
Applied
#2 lore raw
Quoted 12 lines · Sakari Ailus

Hi Hans,

Quoted 9 lines · Hans de Goede

The IPU6 isys is a media-controller centric device which needs the pipeline to be configured using the media controller API before use.

Set the V4L2_CAP_IO_MC flag to reflect this.

This also allows dropping of the enum_input() g_input() and s_input() implementations, with V4L2_CAP_IO_MC set the v4l2-core will take care of those.

Quoted 5 lines
Quoted 1 line

Thanks.

Cc'd Bingbu. (Also bounced the patch to him.)

Applied, thanks. :)

Quoted 63 lines
Quoted 62 lines
---
 .../media/pci/intel/ipu6/ipu6-isys-video.c    | 29 ++-----------------
 1 file changed, 2 insertions(+), 27 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +2 -27
index ad74a19527b7..e6fc32603c3f 100644
@@ -262,29 +262,6 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *fh,
 	return 0;
 }
 
-static int vidioc_enum_input(struct file *file, void *fh,
-			     struct v4l2_input *input)
-{
-	if (input->index > 0)
-		return -EINVAL;
-	strscpy(input->name, "camera", sizeof(input->name));
-	input->type = V4L2_INPUT_TYPE_CAMERA;
-
-	return 0;
-}
-
-static int vidioc_g_input(struct file *file, void *fh, unsigned int *input)
-{
-	*input = 0;
-
-	return 0;
-}
-
-static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
-{
-	return input == 0 ? 0 : -EINVAL;
-}
-
 static int link_validate(struct media_link *link)
 {
 	struct ipu6_isys_video *av =
@@ -1017,9 +994,6 @@ static const struct v4l2_ioctl_ops ioctl_ops_mplane = {
 	.vidioc_streamon = vb2_ioctl_streamon,
 	.vidioc_streamoff = vb2_ioctl_streamoff,
 	.vidioc_expbuf = vb2_ioctl_expbuf,
-	.vidioc_enum_input = vidioc_enum_input,
-	.vidioc_g_input = vidioc_g_input,
-	.vidioc_s_input = vidioc_s_input,
 };
 
 static const struct media_entity_operations entity_ops = {
@@ -1217,7 +1191,8 @@ int ipu6_isys_video_init(struct ipu6_isys_video *av)
 
 	mutex_init(&av->mutex);
 	av->vdev.device_caps = V4L2_CAP_STREAMING |
-			       V4L2_CAP_VIDEO_CAPTURE_MPLANE;
+			       V4L2_CAP_VIDEO_CAPTURE_MPLANE |
+			       V4L2_CAP_IO_MC;
 	av->vdev.vfl_dir = VFL_DIR_RX;
 
 	ret = ipu6_isys_queue_init(&av->aq);
Signature · 1 line
2.41.0
Signature · 2 lines
Best regards,
Bingbu Cao