spi.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM spi
  3. #if !defined(_TRACE_SPI_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_SPI_H
  5. #include <linux/ktime.h>
  6. #include <linux/tracepoint.h>
  7. DECLARE_EVENT_CLASS(spi_master,
  8. TP_PROTO(struct spi_master *master),
  9. TP_ARGS(master),
  10. TP_STRUCT__entry(
  11. __field( int, bus_num )
  12. ),
  13. TP_fast_assign(
  14. __entry->bus_num = master->bus_num;
  15. ),
  16. TP_printk("spi%d", (int)__entry->bus_num)
  17. );
  18. DEFINE_EVENT(spi_master, spi_master_idle,
  19. TP_PROTO(struct spi_master *master),
  20. TP_ARGS(master)
  21. );
  22. DEFINE_EVENT(spi_master, spi_master_busy,
  23. TP_PROTO(struct spi_master *master),
  24. TP_ARGS(master)
  25. );
  26. DECLARE_EVENT_CLASS(spi_message,
  27. TP_PROTO(struct spi_message *msg),
  28. TP_ARGS(msg),
  29. TP_STRUCT__entry(
  30. __field( int, bus_num )
  31. __field( int, chip_select )
  32. __field( struct spi_message *, msg )
  33. ),
  34. TP_fast_assign(
  35. __entry->bus_num = msg->spi->master->bus_num;
  36. __entry->chip_select = msg->spi->chip_select;
  37. __entry->msg = msg;
  38. ),
  39. TP_printk("spi%d.%d %p", (int)__entry->bus_num,
  40. (int)__entry->chip_select,
  41. (struct spi_message *)__entry->msg)
  42. );
  43. DEFINE_EVENT(spi_message, spi_message_submit,
  44. TP_PROTO(struct spi_message *msg),
  45. TP_ARGS(msg)
  46. );
  47. DEFINE_EVENT(spi_message, spi_message_start,
  48. TP_PROTO(struct spi_message *msg),
  49. TP_ARGS(msg)
  50. );
  51. TRACE_EVENT(spi_message_done,
  52. TP_PROTO(struct spi_message *msg),
  53. TP_ARGS(msg),
  54. TP_STRUCT__entry(
  55. __field( int, bus_num )
  56. __field( int, chip_select )
  57. __field( struct spi_message *, msg )
  58. __field( unsigned, frame )
  59. __field( unsigned, actual )
  60. ),
  61. TP_fast_assign(
  62. __entry->bus_num = msg->spi->master->bus_num;
  63. __entry->chip_select = msg->spi->chip_select;
  64. __entry->msg = msg;
  65. __entry->frame = msg->frame_length;
  66. __entry->actual = msg->actual_length;
  67. ),
  68. TP_printk("spi%d.%d %p len=%u/%u", (int)__entry->bus_num,
  69. (int)__entry->chip_select,
  70. (struct spi_message *)__entry->msg,
  71. (unsigned)__entry->actual, (unsigned)__entry->frame)
  72. );
  73. DECLARE_EVENT_CLASS(spi_transfer,
  74. TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
  75. TP_ARGS(msg, xfer),
  76. TP_STRUCT__entry(
  77. __field( int, bus_num )
  78. __field( int, chip_select )
  79. __field( struct spi_transfer *, xfer )
  80. __field( int, len )
  81. ),
  82. TP_fast_assign(
  83. __entry->bus_num = msg->spi->master->bus_num;
  84. __entry->chip_select = msg->spi->chip_select;
  85. __entry->xfer = xfer;
  86. __entry->len = xfer->len;
  87. ),
  88. TP_printk("spi%d.%d %p len=%d", (int)__entry->bus_num,
  89. (int)__entry->chip_select,
  90. (struct spi_message *)__entry->xfer,
  91. (int)__entry->len)
  92. );
  93. DEFINE_EVENT(spi_transfer, spi_transfer_start,
  94. TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
  95. TP_ARGS(msg, xfer)
  96. );
  97. DEFINE_EVENT(spi_transfer, spi_transfer_stop,
  98. TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
  99. TP_ARGS(msg, xfer)
  100. );
  101. #endif /* _TRACE_POWER_H */
  102. /* This part must be outside protection */
  103. #include <trace/define_trace.h>