trace.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM hda
  4. #if !defined(__HDAC_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define __HDAC_TRACE_H
  6. #include <linux/tracepoint.h>
  7. #include <linux/device.h>
  8. #include <sound/hdaudio.h>
  9. #ifndef HDAC_MSG_MAX
  10. #define HDAC_MSG_MAX 500
  11. #endif
  12. struct hdac_bus;
  13. struct hdac_codec;
  14. TRACE_EVENT(hda_send_cmd,
  15. TP_PROTO(struct hdac_bus *bus, unsigned int cmd),
  16. TP_ARGS(bus, cmd),
  17. TP_STRUCT__entry(__dynamic_array(char, msg, HDAC_MSG_MAX)),
  18. TP_fast_assign(
  19. snprintf(__get_str(msg), HDAC_MSG_MAX,
  20. "[%s:%d] val=0x%08x",
  21. dev_name((bus)->dev), (cmd) >> 28, cmd);
  22. ),
  23. TP_printk("%s", __get_str(msg))
  24. );
  25. TRACE_EVENT(hda_get_response,
  26. TP_PROTO(struct hdac_bus *bus, unsigned int addr, unsigned int res),
  27. TP_ARGS(bus, addr, res),
  28. TP_STRUCT__entry(__dynamic_array(char, msg, HDAC_MSG_MAX)),
  29. TP_fast_assign(
  30. snprintf(__get_str(msg), HDAC_MSG_MAX,
  31. "[%s:%d] val=0x%08x",
  32. dev_name((bus)->dev), addr, res);
  33. ),
  34. TP_printk("%s", __get_str(msg))
  35. );
  36. TRACE_EVENT(hda_unsol_event,
  37. TP_PROTO(struct hdac_bus *bus, u32 res, u32 res_ex),
  38. TP_ARGS(bus, res, res_ex),
  39. TP_STRUCT__entry(__dynamic_array(char, msg, HDAC_MSG_MAX)),
  40. TP_fast_assign(
  41. snprintf(__get_str(msg), HDAC_MSG_MAX,
  42. "[%s:%d] res=0x%08x, res_ex=0x%08x",
  43. dev_name((bus)->dev), res_ex & 0x0f, res, res_ex);
  44. ),
  45. TP_printk("%s", __get_str(msg))
  46. );
  47. DECLARE_EVENT_CLASS(hdac_stream,
  48. TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
  49. TP_ARGS(bus, azx_dev),
  50. TP_STRUCT__entry(
  51. __field(unsigned char, stream_tag)
  52. ),
  53. TP_fast_assign(
  54. __entry->stream_tag = (azx_dev)->stream_tag;
  55. ),
  56. TP_printk("stream_tag: %d", __entry->stream_tag)
  57. );
  58. DEFINE_EVENT(hdac_stream, snd_hdac_stream_start,
  59. TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
  60. TP_ARGS(bus, azx_dev)
  61. );
  62. DEFINE_EVENT(hdac_stream, snd_hdac_stream_stop,
  63. TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
  64. TP_ARGS(bus, azx_dev)
  65. );
  66. #endif /* __HDAC_TRACE_H */
  67. /* This part must be outside protection */
  68. #undef TRACE_INCLUDE_PATH
  69. #define TRACE_INCLUDE_PATH .
  70. #undef TRACE_INCLUDE_FILE
  71. #define TRACE_INCLUDE_FILE trace
  72. #include <trace/define_trace.h>