Loading...
1/*
2 * Copyright © 2014 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/seq_file.h>
10#include <linux/circ_buf.h>
11#include <linux/ctype.h>
12#include <linux/debugfs.h>
13#include <drm/drmP.h>
14
15#include "vc4_drv.h"
16#include "vc4_regs.h"
17
18static const struct drm_info_list vc4_debugfs_list[] = {
19 {"bo_stats", vc4_bo_stats_debugfs, 0},
20 {"hdmi_regs", vc4_hdmi_debugfs_regs, 0},
21 {"hvs_regs", vc4_hvs_debugfs_regs, 0},
22 {"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0},
23 {"crtc1_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)1},
24 {"crtc2_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)2},
25 {"v3d_ident", vc4_v3d_debugfs_ident, 0},
26 {"v3d_regs", vc4_v3d_debugfs_regs, 0},
27};
28
29#define VC4_DEBUGFS_ENTRIES ARRAY_SIZE(vc4_debugfs_list)
30
31int
32vc4_debugfs_init(struct drm_minor *minor)
33{
34 return drm_debugfs_create_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES,
35 minor->debugfs_root, minor);
36}
37
38void
39vc4_debugfs_cleanup(struct drm_minor *minor)
40{
41 drm_debugfs_remove_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES, minor);
42}
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright © 2014 Broadcom
4 */
5
6#include <drm/drm_drv.h>
7
8#include <linux/seq_file.h>
9#include <linux/circ_buf.h>
10#include <linux/ctype.h>
11#include <linux/debugfs.h>
12#include <linux/platform_device.h>
13
14#include "vc4_drv.h"
15#include "vc4_regs.h"
16
17/*
18 * Called at drm_dev_register() time on each of the minors registered
19 * by the DRM device, to attach the debugfs files.
20 */
21void
22vc4_debugfs_init(struct drm_minor *minor)
23{
24 struct vc4_dev *vc4 = to_vc4_dev(minor->dev);
25 struct drm_device *drm = &vc4->base;
26
27 drm_WARN_ON(drm, vc4_hvs_debugfs_init(minor));
28
29 if (vc4->v3d) {
30 drm_WARN_ON(drm, vc4_bo_debugfs_init(minor));
31 drm_WARN_ON(drm, vc4_v3d_debugfs_init(minor));
32 }
33}
34
35static int vc4_debugfs_regset32(struct seq_file *m, void *unused)
36{
37 struct drm_debugfs_entry *entry = m->private;
38 struct drm_device *drm = entry->dev;
39 struct debugfs_regset32 *regset = entry->file.data;
40 struct drm_printer p = drm_seq_file_printer(m);
41 int idx;
42
43 if (!drm_dev_enter(drm, &idx))
44 return -ENODEV;
45
46 drm_print_regset32(&p, regset);
47
48 drm_dev_exit(idx);
49
50 return 0;
51}
52
53void vc4_debugfs_add_regset32(struct drm_device *drm,
54 const char *name,
55 struct debugfs_regset32 *regset)
56{
57 drm_debugfs_add_file(drm, name, vc4_debugfs_regset32, regset);
58}