spi.h 3.3 KB

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