summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPratyush Yadav <p.yadav@ti.com>2022-04-13 00:59:19 +0530
committerVignesh Raghavendra <vigneshr@ti.com>2022-05-31 13:57:33 +0530
commit7d6c29ee9f2ff21927e430ffbe937ab96f5ed8e5 (patch)
tree8a89bf9728b357273c8d29f321dccc7da9b75724
parent2eb201f75885cf918de64c03a2d56a3f72f71f72 (diff)
media: ti: j721e-csi2rx: Drop pipeline validation
The pipeline validation being done here is completely broken. Firstly, it assumes that the media_graph_walk_* APIs perform a depth-first traversal on the media graph. They claim to do so, but that is not the case in reality. The order of traversal seems to not be guaranteed, just that all the entities in the graph will be traversed at some point. This means that the device that last touched for format can't be reliably found. Secondly, a driver is not supposed to validate format propagation through the entire pipeline anyway. It should just mind its own formats and its own links, and should not traverse the graph to validate the entire thing. Due to these two reasons, it is better to just drop the validation. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
-rw-r--r--drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
index f4b04602a6cd..3614a06f238d 100644
--- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
+++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
@@ -793,81 +793,6 @@ static int ti_csi2rx_get_vc(struct ti_csi2rx_ctx *ctx)
return -ENODEV;
}
-/*
- * Find the input format. This is done by finding the first device in the
- * pipeline which can tell us the current format. This could be the sensor, or
- * this could be another device in the middle which is capable of format
- * conversions.
- */
-static int ti_csi2rx_validate_pipeline(struct ti_csi2rx_ctx *ctx)
-{
- struct ti_csi2rx_dev *csi = ctx->csi;
- struct media_pipeline *pipe = &csi->pipe;
- struct media_pad *pad;
- struct v4l2_subdev *sd;
- struct v4l2_subdev_format fmt;
- struct v4l2_pix_format *pix = &ctx->v_fmt.fmt.pix;
- const struct ti_csi2rx_fmt *ti_fmt;
- int ret;
-
- media_graph_walk_start(&pipe->graph, ctx->vdev.entity.pads);
-
- while ((pad = media_graph_walk_next(&pipe->graph))) {
- if (!is_media_entity_v4l2_subdev(pad->entity))
- continue;
-
- sd = media_entity_to_v4l2_subdev(pad->entity);
-
- fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
- fmt.pad = pad->index;
- fmt.stream = ctx->stream;
-
- ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt);
- if (ret && ret != -ENOIOCTLCMD)
- return ret;
- if (!ret)
- break;
- }
-
- /* Could not find input format. */
- if (!pad)
- return -EPIPE;
-
- if (fmt.format.width != pix->width)
- return -EPIPE;
- if (fmt.format.height != pix->height)
- return -EPIPE;
-
- ti_fmt = find_format_by_pix(pix->pixelformat);
- if (WARN_ON(!ti_fmt))
- return -EINVAL;
-
- if (fmt.format.code == MEDIA_BUS_FMT_YUYV8_2X8 ||
- fmt.format.code == MEDIA_BUS_FMT_VYUY8_2X8 ||
- fmt.format.code == MEDIA_BUS_FMT_YVYU8_2X8) {
- dev_err(csi->dev,
- "Only UYVY input allowed for YUV422 8-bit. Output format can be configured.\n");
- return -EPIPE;
- }
-
- if (fmt.format.code == MEDIA_BUS_FMT_UYVY8_2X8) {
- /* Format conversion between YUV422 formats can be done. */
- if (ti_fmt->code != MEDIA_BUS_FMT_UYVY8_2X8 &&
- ti_fmt->code != MEDIA_BUS_FMT_YUYV8_2X8 &&
- ti_fmt->code != MEDIA_BUS_FMT_VYUY8_2X8 &&
- ti_fmt->code != MEDIA_BUS_FMT_YVYU8_2X8)
- return -EPIPE;
- } else if (fmt.format.code != ti_fmt->code) {
- return -EPIPE;
- }
-
- if (fmt.format.field != V4L2_FIELD_NONE &&
- fmt.format.field != V4L2_FIELD_ANY)
- return -EPIPE;
-
- return 0;
-}
-
static int ti_csi2rx_start_streaming(struct vb2_queue *vq, unsigned int count)
{
struct ti_csi2rx_ctx *ctx = vb2_get_drv_priv(vq);
@@ -934,13 +859,6 @@ static int ti_csi2rx_start_streaming(struct vb2_queue *vq, unsigned int count)
else
ctx->vc = ret;
- ret = ti_csi2rx_validate_pipeline(ctx);
- if (ret) {
- dev_err(csi->dev,
- "Format mismatch between source and video node\n");
- goto err_pipeline;
- }
-
ti_csi2rx_setup_shim(ctx);
ret = v4l2_subdev_call(&csi->subdev, video, s_stream, 1);