mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] video: vpl: add debug output when calling ioctl
@ 2025-10-27  6:42 Ahmad Fatoum
  2025-10-28  7:28 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-10-27  6:42 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

To simplify pipeline debugging, add some human-readable output when
an ioctl is propagating along the pipeline.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 drivers/video/vpl.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/video/vpl.c b/drivers/video/vpl.c
index 0235c1e790bd..c4a41648bf04 100644
--- a/drivers/video/vpl.c
+++ b/drivers/video/vpl.c
@@ -116,6 +116,46 @@ static int vpl_foreach_endpoint(struct vpl *vpl, unsigned int port, int endpoint
 	return 0;
 }
 
+static const char *ioctl_cmd_str(unsigned cmd)
+{
+	switch (cmd) {
+	case VPL_PREPARE:
+		return "PREPARE";
+	case VPL_UNPREPARE:
+		return "UNPREPARE";
+	case VPL_ENABLE:
+		return "ENABLE";
+	case VPL_DISABLE:
+		return "DISABLE";
+	case VPL_GET_VIDEOMODES:
+		return "GET_VIDEOMODES";
+	case VPL_GET_BUS_FORMAT:
+		return "GET_BUS_FORMAT";
+	case VPL_GET_DISPLAY_INFO:
+		return "GET_DISPLAY_INFO";
+	default:
+		return NULL;
+	}
+}
+
+static int vpl_do_ioctl(struct vpl *vpl, unsigned port, unsigned cmd,
+			 void *data)
+{
+	char buf[sizeof("0x12345678")];
+	const char *cmdstr;
+
+	cmdstr = ioctl_cmd_str(cmd);
+	if (!cmdstr) {
+		snprintf(buf, sizeof(buf), "0x%08x", cmd);
+		cmdstr = buf;
+	}
+
+	pr_debug("%s: calling %ps(\"%pOF\", %d, %s, %p)\n", __func__,
+		 vpl->ioctl, vpl->node, port, cmdstr, data);
+
+	return vpl->ioctl(vpl, port, cmd, data);
+}
+
 struct vpl_ioctl {
 	int err;
 	unsigned cmd;
@@ -131,7 +171,7 @@ static int vpl_remote_ioctl(struct vpl *vpl, unsigned port, void *_data)
 		return 0;
 	}
 
-	return vpl->ioctl(vpl, port, data->cmd, data->ptr);
+	return vpl_do_ioctl(vpl, port, data->cmd, data->ptr);
 }
 
 int vpl_ioctl(struct vpl *vpl, unsigned int port,
@@ -182,5 +222,5 @@ int vpl_bridge_ioctl(struct vpl_bridge *bridge, unsigned int cmd, void *ptr)
 	if (!vpl->ioctl)
 		return -EOPNOTSUPP;
 
-	return vpl->ioctl(vpl, bridge->port, cmd, ptr);
+	return vpl_do_ioctl(vpl, bridge->port, cmd, ptr);
 }
-- 
2.47.3




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] video: vpl: add debug output when calling ioctl
  2025-10-27  6:42 [PATCH] video: vpl: add debug output when calling ioctl Ahmad Fatoum
@ 2025-10-28  7:28 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-10-28  7:28 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 27 Oct 2025 07:42:11 +0100, Ahmad Fatoum wrote:
> To simplify pipeline debugging, add some human-readable output when
> an ioctl is propagating along the pipeline.
> 
> 

Applied, thanks!

[1/1] video: vpl: add debug output when calling ioctl
      https://git.pengutronix.de/cgit/barebox/commit/?id=9003a08d0a29 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-28  7:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-27  6:42 [PATCH] video: vpl: add debug output when calling ioctl Ahmad Fatoum
2025-10-28  7:28 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox