vc4_debugfs.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright © 2014 Broadcom
  4. */
  5. #include <drm/drm_drv.h>
  6. #include <linux/seq_file.h>
  7. #include <linux/circ_buf.h>
  8. #include <linux/ctype.h>
  9. #include <linux/debugfs.h>
  10. #include <linux/platform_device.h>
  11. #include "vc4_drv.h"
  12. #include "vc4_regs.h"
  13. /*
  14. * Called at drm_dev_register() time on each of the minors registered
  15. * by the DRM device, to attach the debugfs files.
  16. */
  17. void
  18. vc4_debugfs_init(struct drm_minor *minor)
  19. {
  20. struct vc4_dev *vc4 = to_vc4_dev(minor->dev);
  21. struct drm_device *drm = &vc4->base;
  22. drm_WARN_ON(drm, vc4_hvs_debugfs_init(minor));
  23. if (vc4->v3d) {
  24. drm_WARN_ON(drm, vc4_bo_debugfs_init(minor));
  25. drm_WARN_ON(drm, vc4_v3d_debugfs_init(minor));
  26. }
  27. }
  28. static int vc4_debugfs_regset32(struct seq_file *m, void *unused)
  29. {
  30. struct drm_debugfs_entry *entry = m->private;
  31. struct drm_device *drm = entry->dev;
  32. struct debugfs_regset32 *regset = entry->file.data;
  33. struct drm_printer p = drm_seq_file_printer(m);
  34. int idx;
  35. if (!drm_dev_enter(drm, &idx))
  36. return -ENODEV;
  37. drm_print_regset32(&p, regset);
  38. drm_dev_exit(idx);
  39. return 0;
  40. }
  41. void vc4_debugfs_add_regset32(struct drm_device *drm,
  42. const char *name,
  43. struct debugfs_regset32 *regset)
  44. {
  45. drm_debugfs_add_file(drm, name, vc4_debugfs_regset32, regset);
  46. }