summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2017-05-17 17:56:40 -0700
committerEric Anholt <eric@anholt.net>2017-05-19 11:13:57 -0700
commit141518d23493d47bbc5acd1e2892a6ca3f638cf9 (patch)
treedb66ed60eff8756f986f676f7a61f88a59973651 /drivers/gpu
parent3719a5adbb620f09d386db49629f424be284af6a (diff)
downloadlinux-141518d23493d47bbc5acd1e2892a6ca3f638cf9.tar.bz2
drm/pl111: Add a debugfs node to dump our registers.
While debugging an X11 display failure, I wanted to see where we were actually scanning out from. This is probably generally useful to others that might be working on this device. v2: Fix uint32_t sparse warning. Signed-off-by: Eric Anholt <eric@anholt.net> Link: http://patchwork.freedesktop.org/patch/msgid/20170518005640.10310-1-eric@anholt.net Reviewed-by: Linus Walleij <linus.walleij@linaro.org> (v1)
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/pl111/Makefile2
-rw-r--r--drivers/gpu/drm/pl111/pl111_debugfs.c55
-rw-r--r--drivers/gpu/drm/pl111/pl111_drm.h3
-rw-r--r--drivers/gpu/drm/pl111/pl111_drv.c4
4 files changed, 64 insertions, 0 deletions
diff --git a/drivers/gpu/drm/pl111/Makefile b/drivers/gpu/drm/pl111/Makefile
index 01caee727c13..59483d610ef5 100644
--- a/drivers/gpu/drm/pl111/Makefile
+++ b/drivers/gpu/drm/pl111/Makefile
@@ -2,4 +2,6 @@ pl111_drm-y += pl111_connector.o \
pl111_display.o \
pl111_drv.o
+pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o
+
obj-$(CONFIG_DRM_PL111) += pl111_drm.o
diff --git a/drivers/gpu/drm/pl111/pl111_debugfs.c b/drivers/gpu/drm/pl111/pl111_debugfs.c
new file mode 100644
index 000000000000..0d9dee199b2c
--- /dev/null
+++ b/drivers/gpu/drm/pl111/pl111_debugfs.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2017 Broadcom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/amba/clcd-regs.h>
+#include <linux/seq_file.h>
+#include <drm/drm_debugfs.h>
+#include <drm/drmP.h>
+#include "pl111_drm.h"
+
+#define REGDEF(reg) { reg, #reg }
+static const struct {
+ u32 reg;
+ const char *name;
+} pl111_reg_defs[] = {
+ REGDEF(CLCD_TIM0),
+ REGDEF(CLCD_TIM1),
+ REGDEF(CLCD_TIM2),
+ REGDEF(CLCD_TIM3),
+ REGDEF(CLCD_UBAS),
+ REGDEF(CLCD_PL111_CNTL),
+ REGDEF(CLCD_PL111_IENB),
+};
+
+int pl111_debugfs_regs(struct seq_file *m, void *unused)
+{
+ struct drm_info_node *node = (struct drm_info_node *)m->private;
+ struct drm_device *dev = node->minor->dev;
+ struct pl111_drm_dev_private *priv = dev->dev_private;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(pl111_reg_defs); i++) {
+ seq_printf(m, "%s (0x%04x): 0x%08x\n",
+ pl111_reg_defs[i].name, pl111_reg_defs[i].reg,
+ readl(priv->regs + pl111_reg_defs[i].reg));
+ }
+
+ return 0;
+}
+
+static const struct drm_info_list pl111_debugfs_list[] = {
+ {"regs", pl111_debugfs_regs, 0},
+};
+
+int
+pl111_debugfs_init(struct drm_minor *minor)
+{
+ return drm_debugfs_create_files(pl111_debugfs_list,
+ ARRAY_SIZE(pl111_debugfs_list),
+ minor->debugfs_root, minor);
+}
diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h
index 4162c6aa5dbb..5c685bfc8fdc 100644
--- a/drivers/gpu/drm/pl111/pl111_drm.h
+++ b/drivers/gpu/drm/pl111/pl111_drm.h
@@ -25,6 +25,8 @@
#define CLCD_IRQ_NEXTBASE_UPDATE BIT(2)
+struct drm_minor;
+
struct pl111_drm_connector {
struct drm_connector connector;
struct drm_panel *panel;
@@ -60,5 +62,6 @@ int pl111_encoder_init(struct drm_device *dev);
int pl111_dumb_create(struct drm_file *file_priv,
struct drm_device *dev,
struct drm_mode_create_dumb *args);
+int pl111_debugfs_init(struct drm_minor *minor);
#endif /* _PL111_DRM_H_ */
diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
index 12d085b0aef8..97095b1aa961 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -173,6 +173,10 @@ static struct drm_driver pl111_drm_driver = {
.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
.gem_prime_export = drm_gem_prime_export,
.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
+
+#if defined(CONFIG_DEBUG_FS)
+ .debugfs_init = pl111_debugfs_init,
+#endif
};
#ifdef CONFIG_ARM_AMBA