1fa6e73d6SBard Liao /* SPDX-License-Identifier: GPL-2.0-only */ 2fa6e73d6SBard Liao /* 3fa6e73d6SBard Liao * Copyright(c) 2022 Intel Corporation. All rights reserved. 4fa6e73d6SBard Liao * 5fa6e73d6SBard Liao * Author: Noah Klayman <noah.klayman@intel.com> 6fa6e73d6SBard Liao */ 7fa6e73d6SBard Liao 8fa6e73d6SBard Liao #undef TRACE_SYSTEM 9fa6e73d6SBard Liao #define TRACE_SYSTEM sof 10fa6e73d6SBard Liao 11fa6e73d6SBard Liao #if !defined(_TRACE_SOF_H) || defined(TRACE_HEADER_MULTI_READ) 12fa6e73d6SBard Liao #define _TRACE_SOF_H 13fa6e73d6SBard Liao #include <linux/tracepoint.h> 14bcd2cc35SNoah Klayman #include <linux/types.h> 15fa6e73d6SBard Liao #include <sound/sof/stream.h> 16fa6e73d6SBard Liao #include "../../../sound/soc/sof/sof-audio.h" 17fa6e73d6SBard Liao 18fa6e73d6SBard Liao DECLARE_EVENT_CLASS(sof_widget_template, 19fa6e73d6SBard Liao TP_PROTO(struct snd_sof_widget *swidget), 20fa6e73d6SBard Liao TP_ARGS(swidget), 21fa6e73d6SBard Liao TP_STRUCT__entry( 22fa6e73d6SBard Liao __string(name, swidget->widget->name) 23fa6e73d6SBard Liao __field(int, use_count) 24fa6e73d6SBard Liao ), 25fa6e73d6SBard Liao TP_fast_assign( 26fa6e73d6SBard Liao __assign_str(name, swidget->widget->name); 27fa6e73d6SBard Liao __entry->use_count = swidget->use_count; 28fa6e73d6SBard Liao ), 29fa6e73d6SBard Liao TP_printk("name=%s use_count=%d", __get_str(name), __entry->use_count) 30fa6e73d6SBard Liao ); 31fa6e73d6SBard Liao 32fa6e73d6SBard Liao DEFINE_EVENT(sof_widget_template, sof_widget_setup, 33fa6e73d6SBard Liao TP_PROTO(struct snd_sof_widget *swidget), 34fa6e73d6SBard Liao TP_ARGS(swidget) 35fa6e73d6SBard Liao ); 36fa6e73d6SBard Liao 37fa6e73d6SBard Liao DEFINE_EVENT(sof_widget_template, sof_widget_free, 38fa6e73d6SBard Liao TP_PROTO(struct snd_sof_widget *swidget), 39fa6e73d6SBard Liao TP_ARGS(swidget) 40fa6e73d6SBard Liao ); 41fa6e73d6SBard Liao 42bcd2cc35SNoah Klayman TRACE_EVENT(sof_ipc3_period_elapsed_position, 43bcd2cc35SNoah Klayman TP_PROTO(struct snd_sof_dev *sdev, struct sof_ipc_stream_posn *posn), 44bcd2cc35SNoah Klayman TP_ARGS(sdev, posn), 45bcd2cc35SNoah Klayman TP_STRUCT__entry( 46bcd2cc35SNoah Klayman __string(device_name, dev_name(sdev->dev)) 47bcd2cc35SNoah Klayman __field(u64, host_posn) 48bcd2cc35SNoah Klayman __field(u64, dai_posn) 49bcd2cc35SNoah Klayman __field(u64, wallclock) 50bcd2cc35SNoah Klayman ), 51bcd2cc35SNoah Klayman TP_fast_assign( 52bcd2cc35SNoah Klayman __assign_str(device_name, dev_name(sdev->dev)); 53bcd2cc35SNoah Klayman __entry->host_posn = posn->host_posn; 54bcd2cc35SNoah Klayman __entry->dai_posn = posn->dai_posn; 55bcd2cc35SNoah Klayman __entry->wallclock = posn->wallclock; 56bcd2cc35SNoah Klayman ), 57bcd2cc35SNoah Klayman TP_printk("device_name=%s host_posn=%#llx dai_posn=%#llx wallclock=%#llx", 58bcd2cc35SNoah Klayman __get_str(device_name), __entry->host_posn, __entry->dai_posn, 59bcd2cc35SNoah Klayman __entry->wallclock) 60bcd2cc35SNoah Klayman ); 61bcd2cc35SNoah Klayman 62bcd2cc35SNoah Klayman TRACE_EVENT(sof_pcm_pointer_position, 63bcd2cc35SNoah Klayman TP_PROTO(struct snd_sof_dev *sdev, 64bcd2cc35SNoah Klayman struct snd_sof_pcm *spcm, 65bcd2cc35SNoah Klayman struct snd_pcm_substream *substream, 66bcd2cc35SNoah Klayman snd_pcm_uframes_t dma_posn, 67bcd2cc35SNoah Klayman snd_pcm_uframes_t dai_posn 68bcd2cc35SNoah Klayman ), 69bcd2cc35SNoah Klayman TP_ARGS(sdev, spcm, substream, dma_posn, dai_posn), 70bcd2cc35SNoah Klayman TP_STRUCT__entry( 71bcd2cc35SNoah Klayman __string(device_name, dev_name(sdev->dev)) 72bcd2cc35SNoah Klayman __field(u32, pcm_id) 73bcd2cc35SNoah Klayman __field(int, stream) 74bcd2cc35SNoah Klayman __field(unsigned long, dma_posn) 75bcd2cc35SNoah Klayman __field(unsigned long, dai_posn) 76bcd2cc35SNoah Klayman ), 77bcd2cc35SNoah Klayman TP_fast_assign( 78bcd2cc35SNoah Klayman __assign_str(device_name, dev_name(sdev->dev)); 79bcd2cc35SNoah Klayman __entry->pcm_id = le32_to_cpu(spcm->pcm.pcm_id); 80bcd2cc35SNoah Klayman __entry->stream = substream->stream; 81bcd2cc35SNoah Klayman __entry->dma_posn = dma_posn; 82bcd2cc35SNoah Klayman __entry->dai_posn = dai_posn; 83bcd2cc35SNoah Klayman ), 84bcd2cc35SNoah Klayman TP_printk("device_name=%s pcm_id=%d stream=%d dma_posn=%lu dai_posn=%lu", 85bcd2cc35SNoah Klayman __get_str(device_name), __entry->pcm_id, __entry->stream, 86bcd2cc35SNoah Klayman __entry->dma_posn, __entry->dai_posn) 87bcd2cc35SNoah Klayman ); 88bcd2cc35SNoah Klayman 89bcd2cc35SNoah Klayman TRACE_EVENT(sof_stream_position_ipc_rx, 90bcd2cc35SNoah Klayman TP_PROTO(struct device *dev), 91bcd2cc35SNoah Klayman TP_ARGS(dev), 92bcd2cc35SNoah Klayman TP_STRUCT__entry( 93bcd2cc35SNoah Klayman __string(device_name, dev_name(dev)) 94bcd2cc35SNoah Klayman ), 95bcd2cc35SNoah Klayman TP_fast_assign( 96bcd2cc35SNoah Klayman __assign_str(device_name, dev_name(dev)); 97bcd2cc35SNoah Klayman ), 98bcd2cc35SNoah Klayman TP_printk("device_name=%s", __get_str(device_name)) 99bcd2cc35SNoah Klayman ); 100bcd2cc35SNoah Klayman 101*794cd3bdSNoah Klayman TRACE_EVENT(sof_ipc4_fw_config, 102*794cd3bdSNoah Klayman TP_PROTO(struct snd_sof_dev *sdev, char *key, u32 value), 103*794cd3bdSNoah Klayman TP_ARGS(sdev, key, value), 104*794cd3bdSNoah Klayman TP_STRUCT__entry( 105*794cd3bdSNoah Klayman __string(device_name, dev_name(sdev->dev)) 106*794cd3bdSNoah Klayman __string(key, key) 107*794cd3bdSNoah Klayman __field(u32, value) 108*794cd3bdSNoah Klayman ), 109*794cd3bdSNoah Klayman TP_fast_assign( 110*794cd3bdSNoah Klayman __assign_str(device_name, dev_name(sdev->dev)); 111*794cd3bdSNoah Klayman __assign_str(key, key); 112*794cd3bdSNoah Klayman __entry->value = value; 113*794cd3bdSNoah Klayman ), 114*794cd3bdSNoah Klayman TP_printk("device_name=%s key=%s value=%d", 115*794cd3bdSNoah Klayman __get_str(device_name), __get_str(key), __entry->value) 116*794cd3bdSNoah Klayman ); 117*794cd3bdSNoah Klayman 118fa6e73d6SBard Liao #endif /* _TRACE_SOF_H */ 119fa6e73d6SBard Liao 120fa6e73d6SBard Liao /* This part must be outside protection */ 121fa6e73d6SBard Liao #include <trace/define_trace.h> 122