media: v4l: subdev: Print debug information on frame descriptor

Print debug level information on returned frame descriptors.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
Sakari Ailus 2023-09-12 14:55:24 +03:00 committed by Hans Verkuil
parent 76c0b99d61
commit 4c812e33b0

View File

@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/overflow.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/version.h>
#include <linux/videodev2.h>
@ -309,9 +310,37 @@ static int call_set_selection(struct v4l2_subdev *sd,
static int call_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
struct v4l2_mbus_frame_desc *fd)
{
unsigned int i;
int ret;
memset(fd, 0, sizeof(*fd));
return sd->ops->pad->get_frame_desc(sd, pad, fd);
ret = sd->ops->pad->get_frame_desc(sd, pad, fd);
if (ret)
return ret;
dev_dbg(sd->dev, "Frame descriptor on pad %u, type %s\n", pad,
fd->type == V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL ? "parallel" :
fd->type == V4L2_MBUS_FRAME_DESC_TYPE_CSI2 ? "CSI-2" :
"unknown");
for (i = 0; i < fd->num_entries; i++) {
struct v4l2_mbus_frame_desc_entry *entry = &fd->entry[i];
char buf[20] = "";
if (fd->type == V4L2_MBUS_FRAME_DESC_TYPE_CSI2)
WARN_ON(snprintf(buf, sizeof(buf),
", vc %u, dt 0x%02x",
entry->bus.csi2.vc,
entry->bus.csi2.dt) >= sizeof(buf));
dev_dbg(sd->dev,
"\tstream %u, code 0x%04x, length %u, flags 0x%04x%s\n",
entry->stream, entry->pixelcode, entry->length,
entry->flags, buf);
}
return 0;
}
static inline int check_edid(struct v4l2_subdev *sd,