dpu_dbg.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef DPU_DBG_H_
  13. #define DPU_DBG_H_
  14. #include <stdarg.h>
  15. #include <linux/debugfs.h>
  16. #include <linux/list.h>
  17. enum dpu_dbg_dump_flag {
  18. DPU_DBG_DUMP_IN_LOG = BIT(0),
  19. DPU_DBG_DUMP_IN_MEM = BIT(1),
  20. };
  21. #if defined(CONFIG_DEBUG_FS)
  22. /**
  23. * dpu_dbg_init_dbg_buses - initialize debug bus dumping support for the chipset
  24. * @hwversion: Chipset revision
  25. */
  26. void dpu_dbg_init_dbg_buses(u32 hwversion);
  27. /**
  28. * dpu_dbg_init - initialize global dpu debug facilities: regdump
  29. * @dev: device handle
  30. * Returns: 0 or -ERROR
  31. */
  32. int dpu_dbg_init(struct device *dev);
  33. /**
  34. * dpu_dbg_debugfs_register - register entries at the given debugfs dir
  35. * @debugfs_root: debugfs root in which to create dpu debug entries
  36. * Returns: 0 or -ERROR
  37. */
  38. int dpu_dbg_debugfs_register(struct dentry *debugfs_root);
  39. /**
  40. * dpu_dbg_destroy - destroy the global dpu debug facilities
  41. * Returns: none
  42. */
  43. void dpu_dbg_destroy(void);
  44. /**
  45. * dpu_dbg_dump - trigger dumping of all dpu_dbg facilities
  46. * @queue_work: whether to queue the dumping work to the work_struct
  47. * @name: string indicating origin of dump
  48. * @dump_dbgbus: dump the dpu debug bus
  49. * @dump_vbif_rt: dump the vbif rt bus
  50. * Returns: none
  51. */
  52. void dpu_dbg_dump(bool queue_work, const char *name, bool dump_dbgbus_dpu,
  53. bool dump_dbgbus_vbif_rt);
  54. /**
  55. * dpu_dbg_set_dpu_top_offset - set the target specific offset from mdss base
  56. * address of the top registers. Used for accessing debug bus controls.
  57. * @blk_off: offset from mdss base of the top block
  58. */
  59. void dpu_dbg_set_dpu_top_offset(u32 blk_off);
  60. #else
  61. static inline void dpu_dbg_init_dbg_buses(u32 hwversion)
  62. {
  63. }
  64. static inline int dpu_dbg_init(struct device *dev)
  65. {
  66. return 0;
  67. }
  68. static inline int dpu_dbg_debugfs_register(struct dentry *debugfs_root)
  69. {
  70. return 0;
  71. }
  72. static inline void dpu_dbg_destroy(void)
  73. {
  74. }
  75. static inline void dpu_dbg_dump(bool queue_work, const char *name,
  76. bool dump_dbgbus_dpu, bool dump_dbgbus_vbif_rt)
  77. {
  78. }
  79. static inline void dpu_dbg_set_dpu_top_offset(u32 blk_off)
  80. {
  81. }
  82. #endif /* defined(CONFIG_DEBUG_FS) */
  83. #endif /* DPU_DBG_H_ */