Commit babca007 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Don't validate links when the userspace API is disabled

As the pipeline is configured internally by the driver when the
userspace API is disabled its configuration can be trusted and link
validation isn't needed.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 3dbb6100
...@@ -78,6 +78,8 @@ struct vsp1_device { ...@@ -78,6 +78,8 @@ struct vsp1_device {
struct v4l2_device v4l2_dev; struct v4l2_device v4l2_dev;
struct media_device media_dev; struct media_device media_dev;
struct media_entity_operations media_ops;
}; };
int vsp1_device_get(struct vsp1_device *vsp1); int vsp1_device_get(struct vsp1_device *vsp1);
......
...@@ -424,7 +424,7 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1) ...@@ -424,7 +424,7 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1)
subdev = &bru->entity.subdev; subdev = &bru->entity.subdev;
v4l2_subdev_init(subdev, &bru_ops); v4l2_subdev_init(subdev, &bru_ops);
subdev->entity.ops = &vsp1_media_ops; subdev->entity.ops = &vsp1->media_ops;
subdev->internal_ops = &vsp1_subdev_internal_ops; subdev->internal_ops = &vsp1_subdev_internal_ops;
snprintf(subdev->name, sizeof(subdev->name), "%s bru", snprintf(subdev->name, sizeof(subdev->name), "%s bru",
dev_name(vsp1->dev)); dev_name(vsp1->dev));
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <media/v4l2-subdev.h>
#include "vsp1.h" #include "vsp1.h"
#include "vsp1_bru.h" #include "vsp1_bru.h"
#include "vsp1_hsit.h" #include "vsp1_hsit.h"
...@@ -214,6 +216,14 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) ...@@ -214,6 +216,14 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
dev_name(mdev->dev)); dev_name(mdev->dev));
media_device_init(mdev); media_device_init(mdev);
vsp1->media_ops.link_setup = vsp1_entity_link_setup;
/* Don't perform link validation when the userspace API is disabled as
* the pipeline is configured internally by the driver in that case, and
* its configuration can thus be trusted.
*/
if (vsp1->pdata.uapi)
vsp1->media_ops.link_validate = v4l2_subdev_link_validate;
vdev->mdev = mdev; vdev->mdev = mdev;
ret = v4l2_device_register(vsp1->dev, vdev); ret = v4l2_device_register(vsp1->dev, vdev);
if (ret < 0) { if (ret < 0) {
......
...@@ -131,7 +131,7 @@ const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops = { ...@@ -131,7 +131,7 @@ const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops = {
* Media Operations * Media Operations
*/ */
static int vsp1_entity_link_setup(struct media_entity *entity, int vsp1_entity_link_setup(struct media_entity *entity,
const struct media_pad *local, const struct media_pad *local,
const struct media_pad *remote, u32 flags) const struct media_pad *remote, u32 flags)
{ {
...@@ -158,11 +158,6 @@ static int vsp1_entity_link_setup(struct media_entity *entity, ...@@ -158,11 +158,6 @@ static int vsp1_entity_link_setup(struct media_entity *entity,
return 0; return 0;
} }
const struct media_entity_operations vsp1_media_ops = {
.link_setup = vsp1_entity_link_setup,
.link_validate = v4l2_subdev_link_validate,
};
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Initialization * Initialization
*/ */
......
...@@ -86,7 +86,10 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, ...@@ -86,7 +86,10 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
void vsp1_entity_destroy(struct vsp1_entity *entity); void vsp1_entity_destroy(struct vsp1_entity *entity);
extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops; extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
extern const struct media_entity_operations vsp1_media_ops;
int vsp1_entity_link_setup(struct media_entity *entity,
const struct media_pad *local,
const struct media_pad *remote, u32 flags);
struct v4l2_mbus_framefmt * struct v4l2_mbus_framefmt *
vsp1_entity_get_pad_format(struct vsp1_entity *entity, vsp1_entity_get_pad_format(struct vsp1_entity *entity,
......
...@@ -203,7 +203,7 @@ struct vsp1_hsit *vsp1_hsit_create(struct vsp1_device *vsp1, bool inverse) ...@@ -203,7 +203,7 @@ struct vsp1_hsit *vsp1_hsit_create(struct vsp1_device *vsp1, bool inverse)
subdev = &hsit->entity.subdev; subdev = &hsit->entity.subdev;
v4l2_subdev_init(subdev, &hsit_ops); v4l2_subdev_init(subdev, &hsit_ops);
subdev->entity.ops = &vsp1_media_ops; subdev->entity.ops = &vsp1->media_ops;
subdev->internal_ops = &vsp1_subdev_internal_ops; subdev->internal_ops = &vsp1_subdev_internal_ops;
snprintf(subdev->name, sizeof(subdev->name), "%s %s", snprintf(subdev->name, sizeof(subdev->name), "%s %s",
dev_name(vsp1->dev), inverse ? "hsi" : "hst"); dev_name(vsp1->dev), inverse ? "hsi" : "hst");
......
...@@ -223,7 +223,7 @@ struct vsp1_lif *vsp1_lif_create(struct vsp1_device *vsp1) ...@@ -223,7 +223,7 @@ struct vsp1_lif *vsp1_lif_create(struct vsp1_device *vsp1)
subdev = &lif->entity.subdev; subdev = &lif->entity.subdev;
v4l2_subdev_init(subdev, &lif_ops); v4l2_subdev_init(subdev, &lif_ops);
subdev->entity.ops = &vsp1_media_ops; subdev->entity.ops = &vsp1->media_ops;
subdev->internal_ops = &vsp1_subdev_internal_ops; subdev->internal_ops = &vsp1_subdev_internal_ops;
snprintf(subdev->name, sizeof(subdev->name), "%s lif", snprintf(subdev->name, sizeof(subdev->name), "%s lif",
dev_name(vsp1->dev)); dev_name(vsp1->dev));
......
...@@ -237,7 +237,7 @@ struct vsp1_lut *vsp1_lut_create(struct vsp1_device *vsp1) ...@@ -237,7 +237,7 @@ struct vsp1_lut *vsp1_lut_create(struct vsp1_device *vsp1)
subdev = &lut->entity.subdev; subdev = &lut->entity.subdev;
v4l2_subdev_init(subdev, &lut_ops); v4l2_subdev_init(subdev, &lut_ops);
subdev->entity.ops = &vsp1_media_ops; subdev->entity.ops = &vsp1->media_ops;
subdev->internal_ops = &vsp1_subdev_internal_ops; subdev->internal_ops = &vsp1_subdev_internal_ops;
snprintf(subdev->name, sizeof(subdev->name), "%s lut", snprintf(subdev->name, sizeof(subdev->name), "%s lut",
dev_name(vsp1->dev)); dev_name(vsp1->dev));
......
...@@ -245,7 +245,7 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index) ...@@ -245,7 +245,7 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index)
subdev = &rpf->entity.subdev; subdev = &rpf->entity.subdev;
v4l2_subdev_init(subdev, &rpf_ops); v4l2_subdev_init(subdev, &rpf_ops);
subdev->entity.ops = &vsp1_media_ops; subdev->entity.ops = &vsp1->media_ops;
subdev->internal_ops = &vsp1_subdev_internal_ops; subdev->internal_ops = &vsp1_subdev_internal_ops;
snprintf(subdev->name, sizeof(subdev->name), "%s rpf.%u", snprintf(subdev->name, sizeof(subdev->name), "%s rpf.%u",
dev_name(vsp1->dev), index); dev_name(vsp1->dev), index);
......
...@@ -363,7 +363,7 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1) ...@@ -363,7 +363,7 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1)
subdev = &sru->entity.subdev; subdev = &sru->entity.subdev;
v4l2_subdev_init(subdev, &sru_ops); v4l2_subdev_init(subdev, &sru_ops);
subdev->entity.ops = &vsp1_media_ops; subdev->entity.ops = &vsp1->media_ops;
subdev->internal_ops = &vsp1_subdev_internal_ops; subdev->internal_ops = &vsp1_subdev_internal_ops;
snprintf(subdev->name, sizeof(subdev->name), "%s sru", snprintf(subdev->name, sizeof(subdev->name), "%s sru",
dev_name(vsp1->dev)); dev_name(vsp1->dev));
......
...@@ -338,7 +338,7 @@ struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index) ...@@ -338,7 +338,7 @@ struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index)
subdev = &uds->entity.subdev; subdev = &uds->entity.subdev;
v4l2_subdev_init(subdev, &uds_ops); v4l2_subdev_init(subdev, &uds_ops);
subdev->entity.ops = &vsp1_media_ops; subdev->entity.ops = &vsp1->media_ops;
subdev->internal_ops = &vsp1_subdev_internal_ops; subdev->internal_ops = &vsp1_subdev_internal_ops;
snprintf(subdev->name, sizeof(subdev->name), "%s uds.%u", snprintf(subdev->name, sizeof(subdev->name), "%s uds.%u",
dev_name(vsp1->dev), index); dev_name(vsp1->dev), index);
......
...@@ -243,7 +243,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index) ...@@ -243,7 +243,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
subdev = &wpf->entity.subdev; subdev = &wpf->entity.subdev;
v4l2_subdev_init(subdev, &wpf_ops); v4l2_subdev_init(subdev, &wpf_ops);
subdev->entity.ops = &vsp1_media_ops; subdev->entity.ops = &vsp1->media_ops;
subdev->internal_ops = &vsp1_subdev_internal_ops; subdev->internal_ops = &vsp1_subdev_internal_ops;
snprintf(subdev->name, sizeof(subdev->name), "%s wpf.%u", snprintf(subdev->name, sizeof(subdev->name), "%s wpf.%u",
dev_name(vsp1->dev), index); dev_name(vsp1->dev), index);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment