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

[media] v4l: subdev: Extend default link validation to cover field order

The field order must match between the source and sink pads, or the sink
pad field order must be NONE. This allows connecting an interlaced
source to a bridge that has no hardware support for interlaced formats.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: default avatarEnrico Butera <ebutera@users.sourceforge.net>
Acked-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 0e2a6b7f
...@@ -501,11 +501,20 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, ...@@ -501,11 +501,20 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
struct v4l2_subdev_format *source_fmt, struct v4l2_subdev_format *source_fmt,
struct v4l2_subdev_format *sink_fmt) struct v4l2_subdev_format *sink_fmt)
{ {
/* The width, height and code must match. */
if (source_fmt->format.width != sink_fmt->format.width if (source_fmt->format.width != sink_fmt->format.width
|| source_fmt->format.height != sink_fmt->format.height || source_fmt->format.height != sink_fmt->format.height
|| source_fmt->format.code != sink_fmt->format.code) || source_fmt->format.code != sink_fmt->format.code)
return -EINVAL; return -EINVAL;
/* The field order must match, or the sink field order must be NONE
* to support interlaced hardware connected to bridges that support
* progressive formats only.
*/
if (source_fmt->format.field != sink_fmt->format.field &&
sink_fmt->format.field != V4L2_FIELD_NONE)
return -EINVAL;
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate_default); EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate_default);
......
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