Skip to content

Commit db8e94e

Browse files
Sakari Ailusmchehab
Sakari Ailus
authored andcommitted
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: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent f5c24ca commit db8e94e

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

drivers/media/v4l2-core/v4l2-subdev.c

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -792,21 +792,55 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
792792
struct v4l2_subdev_format *source_fmt,
793793
struct v4l2_subdev_format *sink_fmt)
794794
{
795+
bool pass = true;
796+
795797
/* The width, height and code must match. */
796-
if (source_fmt->format.width != sink_fmt->format.width
797-
|| source_fmt->format.height != sink_fmt->format.height
798-
|| source_fmt->format.code != sink_fmt->format.code)
799-
return -EPIPE;
798+
if (source_fmt->format.width != sink_fmt->format.width) {
799+
dev_dbg(sd->entity.graph_obj.mdev->dev,
800+
"%s: width does not match (source %u, sink %u)\n",
801+
__func__,
802+
source_fmt->format.width, sink_fmt->format.width);
803+
pass = false;
804+
}
805+
806+
if (source_fmt->format.height != sink_fmt->format.height) {
807+
dev_dbg(sd->entity.graph_obj.mdev->dev,
808+
"%s: height does not match (source %u, sink %u)\n",
809+
__func__,
810+
source_fmt->format.height, sink_fmt->format.height);
811+
pass = false;
812+
}
813+
814+
if (source_fmt->format.code != sink_fmt->format.code) {
815+
dev_dbg(sd->entity.graph_obj.mdev->dev,
816+
"%s: media bus code does not match (source 0x%8.8x, sink 0x%8.8x)\n",
817+
__func__,
818+
source_fmt->format.code, sink_fmt->format.code);
819+
pass = false;
820+
}
800821

801822
/* The field order must match, or the sink field order must be NONE
802823
* to support interlaced hardware connected to bridges that support
803824
* progressive formats only.
804825
*/
805826
if (source_fmt->format.field != sink_fmt->format.field &&
806-
sink_fmt->format.field != V4L2_FIELD_NONE)
807-
return -EPIPE;
827+
sink_fmt->format.field != V4L2_FIELD_NONE) {
828+
dev_dbg(sd->entity.graph_obj.mdev->dev,
829+
"%s: field does not match (source %u, sink %u)\n",
830+
__func__,
831+
source_fmt->format.field, sink_fmt->format.field);
832+
pass = false;
833+
}
808834

809-
return 0;
835+
if (pass)
836+
return 0;
837+
838+
dev_dbg(sd->entity.graph_obj.mdev->dev,
839+
"%s: link was \"%s\":%u -> \"%s\":%u\n", __func__,
840+
link->source->entity->name, link->source->index,
841+
link->sink->entity->name, link->sink->index);
842+
843+
return -EPIPE;
810844
}
811845
EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate_default);
812846

0 commit comments

Comments
 (0)