Commit db8e94e7 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: v4l: subdev: Improve link format validation debug messages

The existing link format validation failure debug message in media-entity.c
helped to pinpoint the point of failure but provided no additional
information what's wrong. Tell the user exactly why the validation failed.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent f5c24ca7
...@@ -792,21 +792,55 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, ...@@ -792,21 +792,55 @@ 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)
{ {
bool pass = true;
/* The width, height and code must match. */ /* 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 dev_dbg(sd->entity.graph_obj.mdev->dev,
|| source_fmt->format.code != sink_fmt->format.code) "%s: width does not match (source %u, sink %u)\n",
return -EPIPE; __func__,
source_fmt->format.width, sink_fmt->format.width);
pass = false;
}
if (source_fmt->format.height != sink_fmt->format.height) {
dev_dbg(sd->entity.graph_obj.mdev->dev,
"%s: height does not match (source %u, sink %u)\n",
__func__,
source_fmt->format.height, sink_fmt->format.height);
pass = false;
}
if (source_fmt->format.code != sink_fmt->format.code) {
dev_dbg(sd->entity.graph_obj.mdev->dev,
"%s: media bus code does not match (source 0x%8.8x, sink 0x%8.8x)\n",
__func__,
source_fmt->format.code, sink_fmt->format.code);
pass = false;
}
/* The field order must match, or the sink field order must be NONE /* The field order must match, or the sink field order must be NONE
* to support interlaced hardware connected to bridges that support * to support interlaced hardware connected to bridges that support
* progressive formats only. * progressive formats only.
*/ */
if (source_fmt->format.field != sink_fmt->format.field && if (source_fmt->format.field != sink_fmt->format.field &&
sink_fmt->format.field != V4L2_FIELD_NONE) sink_fmt->format.field != V4L2_FIELD_NONE) {
return -EPIPE; dev_dbg(sd->entity.graph_obj.mdev->dev,
"%s: field does not match (source %u, sink %u)\n",
__func__,
source_fmt->format.field, sink_fmt->format.field);
pass = false;
}
if (pass)
return 0; return 0;
dev_dbg(sd->entity.graph_obj.mdev->dev,
"%s: link was \"%s\":%u -> \"%s\":%u\n", __func__,
link->source->entity->name, link->source->index,
link->sink->entity->name, link->sink->index);
return -EPIPE;
} }
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