diff options
Diffstat (limited to 'drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c')
-rw-r--r-- | drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c index 6c0a33a83dcb..e5bcd8423dc5 100644 --- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c @@ -1330,80 +1330,6 @@ static int ti_csi2rx_init_vb2q(struct ti_csi2rx_ctx *ctx) return 0; } -static int ti_csi2rx_link_validate_get_fmt(struct media_pad *pad, - struct v4l2_subdev_format *fmt) -{ - if (is_media_entity_v4l2_subdev(pad->entity)) { - struct v4l2_subdev *sd = - media_entity_to_v4l2_subdev(pad->entity); - - fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE; - fmt->pad = pad->index; - return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); - } - - WARN(pad->entity->function != MEDIA_ENT_F_IO_V4L, - "Driver bug! Wrong media entity type 0x%08x, entity %s\n", - pad->entity->function, pad->entity->name); - - return -EINVAL; -} - -static int ti_csi2rx_link_validate(struct media_link *link) -{ - struct media_entity *entity = link->sink->entity; - struct video_device *vdev = media_entity_to_video_device(entity); - struct ti_csi2rx_ctx *ctx = container_of(vdev, struct ti_csi2rx_ctx, vdev); - struct ti_csi2rx_dev *csi = ctx->csi; - struct v4l2_pix_format *csi_fmt = &ctx->v_fmt.fmt.pix; - struct v4l2_subdev_format source_fmt; - const struct ti_csi2rx_fmt *ti_fmt; - int ret; - - ret = ti_csi2rx_link_validate_get_fmt(link->source, &source_fmt); - if (ret) - return ret; - - if (source_fmt.format.width != csi_fmt->width) { - dev_dbg(csi->dev, "Width does not match (source %u, sink %u)\n", - source_fmt.format.width, csi_fmt->width); - return -EPIPE; - } - - if (source_fmt.format.height != csi_fmt->height) { - dev_dbg(csi->dev, "Height does not match (source %u, sink %u)\n", - source_fmt.format.height, csi_fmt->height); - return -EPIPE; - } - - if (source_fmt.format.field != csi_fmt->field && - csi_fmt->field != V4L2_FIELD_NONE) { - dev_dbg(csi->dev, "Field does not match (source %u, sink %u)\n", - source_fmt.format.field, csi_fmt->field); - return -EPIPE; - } - - ti_fmt = find_format_by_code(source_fmt.format.code); - if (!ti_fmt) { - dev_dbg(csi->dev, "Media bus format 0x%x not supported\n", - source_fmt.format.code); - return -EPIPE; - } - - if (ctx->v_fmt.fmt.pix.pixelformat != ti_fmt->fourcc) { - dev_dbg(csi->dev, - "Cannot transform source fmt 0x%x to sink fmt 0x%x\n", - ctx->v_fmt.fmt.pix.pixelformat, ti_fmt->fourcc); - return -EPIPE; - } - - return 0; -} - -static const struct media_entity_operations ti_csi2rx_video_entity_ops = { - .link_validate = ti_csi2rx_link_validate, -}; - static int ti_csi2rx_init_dma(struct ti_csi2rx_ctx *ctx) { struct dma_slave_config cfg = { |