Skip to content

Commit

Permalink
media: renesas: vsp1: Implement .link_validate() for video devices
Browse files Browse the repository at this point in the history
The v4l2_subdev_link_validate() helper prints a warning if the
.link_validate() operation is not implemented for video devices
connected to the subdevs. Implement the operation to silence the
warning.

Ideally validation of the link between the video device and the subdev
should be implemented in that operation. That would however break
userspace that does not configure formats on all video devices before
starting streaming. While this mode of operation may not be considered
valid by the V4L2 API specification (interpretation differ), it is
nonetheless supported by the vsp1 driver at the moment and used by at
least the vsp1 unit test suite, and possibly other userspace
applications. Removing it would be a regression.

Signed-off-by: Laurent Pinchart <[email protected]>
Reviewed-by: Tomi Valkeinen <[email protected]>
Acked-by: Sakari Ailus <[email protected]>
  • Loading branch information
Laurent Pinchart committed Aug 26, 2024
1 parent 5fd3e24 commit a3d44f0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions drivers/media/platform/renesas/vsp1/vsp1_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,27 @@ static const struct v4l2_file_operations vsp1_video_fops = {
.mmap = vb2_fop_mmap,
};

/* -----------------------------------------------------------------------------
* Media entity operations
*/

static int vsp1_video_link_validate(struct media_link *link)
{
/*
* Ideally, link validation should be implemented here instead of
* calling vsp1_video_verify_format() in vsp1_video_streamon()
* manually. That would however break userspace that start one video
* device before configures formats on other video devices in the
* pipeline. This operation is just a no-op to silence the warnings
* from v4l2_subdev_link_validate().
*/
return 0;
}

static const struct media_entity_operations vsp1_video_media_ops = {
.link_validate = vsp1_video_link_validate,
};

/* -----------------------------------------------------------------------------
* Suspend and Resume
*/
Expand Down Expand Up @@ -1215,6 +1236,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device *vsp1,

/* ... and the video node... */
video->video.v4l2_dev = &video->vsp1->v4l2_dev;
video->video.entity.ops = &vsp1_video_media_ops;
video->video.fops = &vsp1_video_fops;
snprintf(video->video.name, sizeof(video->video.name), "%s %s",
rwpf->entity.subdev.name, direction);
Expand Down

0 comments on commit a3d44f0

Please sign in to comment.