spmi.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM spmi
  4. #if !defined(_TRACE_SPMI_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_SPMI_H
  6. #include <linux/spmi.h>
  7. #include <linux/tracepoint.h>
  8. /*
  9. * drivers/spmi/spmi.c
  10. */
  11. TRACE_EVENT(spmi_write_begin,
  12. TP_PROTO(u8 opcode, u8 sid, u16 addr, u8 len, const u8 *buf),
  13. TP_ARGS(opcode, sid, addr, len, buf),
  14. TP_STRUCT__entry(
  15. __field ( u8, opcode )
  16. __field ( u8, sid )
  17. __field ( u16, addr )
  18. __field ( u8, len )
  19. __dynamic_array ( u8, buf, len + 1 )
  20. ),
  21. TP_fast_assign(
  22. __entry->opcode = opcode;
  23. __entry->sid = sid;
  24. __entry->addr = addr;
  25. __entry->len = len + 1;
  26. memcpy(__get_dynamic_array(buf), buf, len + 1);
  27. ),
  28. TP_printk("opc=%d sid=%02d addr=0x%04x len=%d buf=0x[%*phD]",
  29. (int)__entry->opcode, (int)__entry->sid,
  30. (int)__entry->addr, (int)__entry->len,
  31. (int)__entry->len, __get_dynamic_array(buf))
  32. );
  33. TRACE_EVENT(spmi_write_end,
  34. TP_PROTO(u8 opcode, u8 sid, u16 addr, int ret),
  35. TP_ARGS(opcode, sid, addr, ret),
  36. TP_STRUCT__entry(
  37. __field ( u8, opcode )
  38. __field ( u8, sid )
  39. __field ( u16, addr )
  40. __field ( int, ret )
  41. ),
  42. TP_fast_assign(
  43. __entry->opcode = opcode;
  44. __entry->sid = sid;
  45. __entry->addr = addr;
  46. __entry->ret = ret;
  47. ),
  48. TP_printk("opc=%d sid=%02d addr=0x%04x ret=%d",
  49. (int)__entry->opcode, (int)__entry->sid,
  50. (int)__entry->addr, __entry->ret)
  51. );
  52. TRACE_EVENT(spmi_read_begin,
  53. TP_PROTO(u8 opcode, u8 sid, u16 addr),
  54. TP_ARGS(opcode, sid, addr),
  55. TP_STRUCT__entry(
  56. __field ( u8, opcode )
  57. __field ( u8, sid )
  58. __field ( u16, addr )
  59. ),
  60. TP_fast_assign(
  61. __entry->opcode = opcode;
  62. __entry->sid = sid;
  63. __entry->addr = addr;
  64. ),
  65. TP_printk("opc=%d sid=%02d addr=0x%04x",
  66. (int)__entry->opcode, (int)__entry->sid,
  67. (int)__entry->addr)
  68. );
  69. TRACE_EVENT(spmi_read_end,
  70. TP_PROTO(u8 opcode, u8 sid, u16 addr, int ret, u8 len, const u8 *buf),
  71. TP_ARGS(opcode, sid, addr, ret, len, buf),
  72. TP_STRUCT__entry(
  73. __field ( u8, opcode )
  74. __field ( u8, sid )
  75. __field ( u16, addr )
  76. __field ( int, ret )
  77. __field ( u8, len )
  78. __dynamic_array ( u8, buf, len + 1 )
  79. ),
  80. TP_fast_assign(
  81. __entry->opcode = opcode;
  82. __entry->sid = sid;
  83. __entry->addr = addr;
  84. __entry->ret = ret;
  85. __entry->len = len + 1;
  86. memcpy(__get_dynamic_array(buf), buf, len + 1);
  87. ),
  88. TP_printk("opc=%d sid=%02d addr=0x%04x ret=%d len=%02d buf=0x[%*phD]",
  89. (int)__entry->opcode, (int)__entry->sid,
  90. (int)__entry->addr, __entry->ret, (int)__entry->len,
  91. (int)__entry->len, __get_dynamic_array(buf))
  92. );
  93. TRACE_EVENT(spmi_cmd,
  94. TP_PROTO(u8 opcode, u8 sid, int ret),
  95. TP_ARGS(opcode, sid, ret),
  96. TP_STRUCT__entry(
  97. __field ( u8, opcode )
  98. __field ( u8, sid )
  99. __field ( int, ret )
  100. ),
  101. TP_fast_assign(
  102. __entry->opcode = opcode;
  103. __entry->sid = sid;
  104. __entry->ret = ret;
  105. ),
  106. TP_printk("opc=%d sid=%02d ret=%d", (int)__entry->opcode,
  107. (int)__entry->sid, ret)
  108. );
  109. #endif /* _TRACE_SPMI_H */
  110. /* This part must be outside protection */
  111. #include <trace/define_trace.h>