]> asedeno.scripts.mit.edu Git - linux.git/blob - drivers/gpu/drm/pl111/pl111_debugfs.c
drm/pl111: drop use of drmP.h
[linux.git] / drivers / gpu / drm / pl111 / pl111_debugfs.c
1 /*
2  *  Copyright © 2017 Broadcom
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
8
9 #include <linux/amba/clcd-regs.h>
10 #include <linux/seq_file.h>
11
12 #include <drm/drm_debugfs.h>
13 #include <drm/drm_file.h>
14
15 #include "pl111_drm.h"
16
17 #define REGDEF(reg) { reg, #reg }
18 static const struct {
19         u32 reg;
20         const char *name;
21 } pl111_reg_defs[] = {
22         REGDEF(CLCD_TIM0),
23         REGDEF(CLCD_TIM1),
24         REGDEF(CLCD_TIM2),
25         REGDEF(CLCD_TIM3),
26         REGDEF(CLCD_UBAS),
27         REGDEF(CLCD_LBAS),
28         REGDEF(CLCD_PL111_CNTL),
29         REGDEF(CLCD_PL111_IENB),
30         REGDEF(CLCD_PL111_RIS),
31         REGDEF(CLCD_PL111_MIS),
32         REGDEF(CLCD_PL111_ICR),
33         REGDEF(CLCD_PL111_UCUR),
34         REGDEF(CLCD_PL111_LCUR),
35 };
36
37 int pl111_debugfs_regs(struct seq_file *m, void *unused)
38 {
39         struct drm_info_node *node = (struct drm_info_node *)m->private;
40         struct drm_device *dev = node->minor->dev;
41         struct pl111_drm_dev_private *priv = dev->dev_private;
42         int i;
43
44         for (i = 0; i < ARRAY_SIZE(pl111_reg_defs); i++) {
45                 seq_printf(m, "%s (0x%04x): 0x%08x\n",
46                            pl111_reg_defs[i].name, pl111_reg_defs[i].reg,
47                            readl(priv->regs + pl111_reg_defs[i].reg));
48         }
49
50         return 0;
51 }
52
53 static const struct drm_info_list pl111_debugfs_list[] = {
54         {"regs", pl111_debugfs_regs, 0},
55 };
56
57 int
58 pl111_debugfs_init(struct drm_minor *minor)
59 {
60         return drm_debugfs_create_files(pl111_debugfs_list,
61                                         ARRAY_SIZE(pl111_debugfs_list),
62                                         minor->debugfs_root, minor);
63 }