WIP FPC-III support
[linux/fpc-iii.git] / drivers / gpu / drm / pl111 / pl111_debugfs.c
blob6744fa16f4644affe7b962c9812bd0a2757d578f
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright © 2017 Broadcom
4 */
6 #include <linux/seq_file.h>
8 #include <drm/drm_debugfs.h>
9 #include <drm/drm_file.h>
11 #include "pl111_drm.h"
13 #define REGDEF(reg) { reg, #reg }
14 static const struct {
15 u32 reg;
16 const char *name;
17 } pl111_reg_defs[] = {
18 REGDEF(CLCD_TIM0),
19 REGDEF(CLCD_TIM1),
20 REGDEF(CLCD_TIM2),
21 REGDEF(CLCD_TIM3),
22 REGDEF(CLCD_UBAS),
23 REGDEF(CLCD_LBAS),
24 REGDEF(CLCD_PL111_CNTL),
25 REGDEF(CLCD_PL111_IENB),
26 REGDEF(CLCD_PL111_RIS),
27 REGDEF(CLCD_PL111_MIS),
28 REGDEF(CLCD_PL111_ICR),
29 REGDEF(CLCD_PL111_UCUR),
30 REGDEF(CLCD_PL111_LCUR),
33 static int pl111_debugfs_regs(struct seq_file *m, void *unused)
35 struct drm_info_node *node = (struct drm_info_node *)m->private;
36 struct drm_device *dev = node->minor->dev;
37 struct pl111_drm_dev_private *priv = dev->dev_private;
38 int i;
40 for (i = 0; i < ARRAY_SIZE(pl111_reg_defs); i++) {
41 seq_printf(m, "%s (0x%04x): 0x%08x\n",
42 pl111_reg_defs[i].name, pl111_reg_defs[i].reg,
43 readl(priv->regs + pl111_reg_defs[i].reg));
46 return 0;
49 static const struct drm_info_list pl111_debugfs_list[] = {
50 {"regs", pl111_debugfs_regs, 0},
53 void
54 pl111_debugfs_init(struct drm_minor *minor)
56 drm_debugfs_create_files(pl111_debugfs_list,
57 ARRAY_SIZE(pl111_debugfs_list),
58 minor->debugfs_root, minor);