Skip to content

Commit 600a08c

Browse files
Sakari Ailuspelwell
Sakari Ailus
authored andcommitted
media: v4l: subdev: Improve link format validation debug messages
Commit db8e94e upstream 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 8ee1258 commit 600a08c

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
@@ -768,21 +768,55 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
768768
struct v4l2_subdev_format *source_fmt,
769769
struct v4l2_subdev_format *sink_fmt)
770770
{
771+
bool pass = true;
772+
771773
/* The width, height and code must match. */
772-
if (source_fmt->format.width != sink_fmt->format.width
773-
|| source_fmt->format.height != sink_fmt->format.height
774-
|| source_fmt->format.code != sink_fmt->format.code)
775-
return -EPIPE;
774+
if (source_fmt->format.width != sink_fmt->format.width) {
775+
dev_dbg(sd->entity.graph_obj.mdev->dev,
776+
"%s: width does not match (source %u, sink %u)\n",
777+
__func__,
778+
source_fmt->format.width, sink_fmt->format.width);
779+
pass = false;
780+
}
781+
782+
if (source_fmt->format.height != sink_fmt->format.height) {
783+
dev_dbg(sd->entity.graph_obj.mdev->dev,
784+
"%s: height does not match (source %u, sink %u)\n",
785+
__func__,
786+
source_fmt->format.height, sink_fmt->format.height);
787+
pass = false;
788+
}
789+
790+
if (source_fmt->format.code != sink_fmt->format.code) {
791+
dev_dbg(sd->entity.graph_obj.mdev->dev,
792+
"%s: media bus code does not match (source 0x%8.8x, sink 0x%8.8x)\n",
793+
__func__,
794+
source_fmt->format.code, sink_fmt->format.code);
795+
pass = false;
796+
}
776797

777798
/* The field order must match, or the sink field order must be NONE
778799
* to support interlaced hardware connected to bridges that support
779800
* progressive formats only.
780801
*/
781802
if (source_fmt->format.field != sink_fmt->format.field &&
782-
sink_fmt->format.field != V4L2_FIELD_NONE)
783-
return -EPIPE;
803+
sink_fmt->format.field != V4L2_FIELD_NONE) {
804+
dev_dbg(sd->entity.graph_obj.mdev->dev,
805+
"%s: field does not match (source %u, sink %u)\n",
806+
__func__,
807+
source_fmt->format.field, sink_fmt->format.field);
808+
pass = false;
809+
}
784810

785-
return 0;
811+
if (pass)
812+
return 0;
813+
814+
dev_dbg(sd->entity.graph_obj.mdev->dev,
815+
"%s: link was \"%s\":%u -> \"%s\":%u\n", __func__,
816+
link->source->entity->name, link->source->index,
817+
link->sink->entity->name, link->sink->index);
818+
819+
return -EPIPE;
786820
}
787821
EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate_default);
788822

0 commit comments

Comments
 (0)