vc4_debugfs.c 1.3 KB

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