dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] drm: Add a helper function for printing a debugfs_regset32.
@ 2019-02-20 21:03 Eric Anholt
  2019-02-20 21:03 ` [PATCH 2/7] drm/vc4: Use drm_print_regset32() for our debug register dumping Eric Anholt
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Eric Anholt @ 2019-02-20 21:03 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-kernel, Paul Kocialkowski, Maxime Ripard, Eric Anholt

The debugfs_regset32 is nice to use for reducing boilerplate in
dumping a bunch of regs in debugfs, but we also want to be able to
print to dmesg them at runtime for driver debugging.  drm_printer lets
us format debugfs and the printk the same way.

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/drm_print.c | 16 ++++++++++++++++
 include/drm/drm_print.h     |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 0e7fc3e7dfb4..5ecc0f04cd0c 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -253,3 +253,19 @@ void drm_err(const char *format, ...)
 	va_end(args);
 }
 EXPORT_SYMBOL(drm_err);
+
+void drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset)
+{
+	int namelen = 0;
+	int i;
+
+	for (i = 0; i < regset->nregs; i++)
+		namelen = max(namelen, (int)strlen(regset->regs[i].name));
+
+	for (i = 0; i < regset->nregs; i++) {
+		drm_printf(p, "%*s = 0x%08x\n",
+			   namelen, regset->regs[i].name,
+			   readl(regset->base + regset->regs[i].offset));
+	}
+}
+EXPORT_SYMBOL(drm_print_regset32);
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index afbc3beef089..3a4247319e63 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -30,6 +30,7 @@
 #include <linux/printk.h>
 #include <linux/seq_file.h>
 #include <linux/device.h>
+#include <linux/debugfs.h>
 
 /**
  * DOC: print
@@ -84,6 +85,7 @@ void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf);
 __printf(2, 3)
 void drm_printf(struct drm_printer *p, const char *f, ...);
 void drm_puts(struct drm_printer *p, const char *str);
+void drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset);
 
 __printf(2, 0)
 /**
-- 
2.20.1

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

end of thread, other threads:[~2019-04-01 17:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-20 21:03 [PATCH 1/7] drm: Add a helper function for printing a debugfs_regset32 Eric Anholt
2019-02-20 21:03 ` [PATCH 2/7] drm/vc4: Use drm_print_regset32() for our debug register dumping Eric Anholt
2019-03-22 10:32   ` Paul Kocialkowski
2019-02-20 21:03 ` [PATCH 3/7] drm/vc4: Use common helpers for debugfs setup by the driver components Eric Anholt
2019-02-20 21:03 ` [PATCH 4/7] drm/vc4: Use drm_printer for the debugfs and runtime bo stats output Eric Anholt
2019-03-22 10:41   ` Paul Kocialkowski
2019-02-20 21:03 ` [PATCH 5/7] drm/vc4: Disable V3D interactions if the v3d component didn't probe Eric Anholt
2019-03-25 13:30   ` Paul Kocialkowski
2019-02-20 21:03 ` [PATCH 6/7] drm/vc4: Add helpers for pm get/put Eric Anholt
2019-03-22 10:48   ` Paul Kocialkowski
2019-02-20 21:03 ` [PATCH 7/7] drm/vc4: Make sure that the v3d ident debugfs has vc4's power on Eric Anholt
2019-03-22 10:43   ` Paul Kocialkowski
2019-02-21  9:37 ` [PATCH 1/7] drm: Add a helper function for printing a debugfs_regset32 Daniel Vetter
2019-03-25 16:43   ` Eric Anholt
2019-03-22 10:30 ` Paul Kocialkowski
2019-04-01 17:52   ` Eric Anholt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).