synx_debugfs.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2019, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __SYNX_DEBUGFS_H__
  7. #define __SYNX_DEBUGFS_H__
  8. #include <linux/debugfs.h>
  9. #include <linux/delay.h>
  10. #include "synx_private.h"
  11. enum synx_debug_level {
  12. SYNX_ERR = 0x0001,
  13. SYNX_WARN = 0x0002,
  14. SYNX_INFO = 0x0004,
  15. SYNX_DBG = 0x0008,
  16. SYNX_VERB = 0x0010,
  17. SYNX_IPCL = 0x0020,
  18. SYNX_GSM = 0x0040,
  19. SYNX_MEM = 0x0080,
  20. SYNX_ALL = SYNX_ERR | SYNX_WARN | SYNX_INFO |
  21. SYNX_DBG | SYNX_IPCL | SYNX_GSM | SYNX_MEM,
  22. };
  23. enum synx_columns_level {
  24. NAME_COLUMN = 0x0001,
  25. ID_COLUMN = 0x0002,
  26. BOUND_COLUMN = 0x0004,
  27. STATE_COLUMN = 0x0008,
  28. FENCE_COLUMN = 0x0010,
  29. COREDATA_COLUMN = 0x0020,
  30. GLOBAL_COLUMN = 0x0040,
  31. ERROR_CODES = 0x8000,
  32. };
  33. #ifndef SYNX_DBG_LABEL
  34. #define SYNX_DBG_LABEL "synx"
  35. #endif
  36. #define SYNX_DBG_TAG SYNX_DBG_LABEL ": %4s: "
  37. extern int synx_debug;
  38. static inline char *synx_debug_str(int level)
  39. {
  40. switch (level) {
  41. case SYNX_ERR:
  42. return "err";
  43. case SYNX_WARN:
  44. return "warn";
  45. case SYNX_INFO:
  46. return "info";
  47. case SYNX_DBG:
  48. return "dbg";
  49. case SYNX_VERB:
  50. return "verb";
  51. case SYNX_IPCL:
  52. return "ipcl";
  53. case SYNX_GSM:
  54. return "gmem";
  55. case SYNX_MEM:
  56. return "mem";
  57. default:
  58. return "???";
  59. }
  60. }
  61. #define dprintk(__level, __fmt, arg...) \
  62. do { \
  63. if (synx_debug & __level) { \
  64. pr_info(SYNX_DBG_TAG "%s: %d: " __fmt, \
  65. synx_debug_str(__level), __func__, \
  66. __LINE__, ## arg); \
  67. } \
  68. } while (0)
  69. /**
  70. * synx_init_debugfs_dir - Initializes debugfs
  71. *
  72. * @param dev : Pointer to synx device structure
  73. */
  74. struct dentry *synx_init_debugfs_dir(struct synx_device *dev);
  75. /**
  76. * synx_remove_debugfs_dir - Removes debugfs
  77. *
  78. * @param dev : Pointer to synx device structure
  79. */
  80. void synx_remove_debugfs_dir(struct synx_device *dev);
  81. #endif /* __SYNX_DEBUGFS_H__ */