[Sound-open-firmware] [RFC PATCH v2 00/29] Trace level control based on modules.
From: Yan Wang yan.wang@linux.intel.com
This patch set is only for review. This patch set is tested on CNL no-codec only currently.
User could check current trace level status like the following: cat /sys/kernel/debug/sof/trace_level irq >> 1 ipc >> 1 dma >> 1 ssp >> 1 wait >> 1 lock >> 1 mem >> 1 value >> 1 PIPELINE.2.SSP2.IN >> 1 SSP2.IN >> 1 BUF2.0 >> 1 PCM0C >> 0 PIPELINE.1.SSP2.OUT >> 1 SSP2.OUT >> 1 BUF1.0 >> 1 PCM0P >> 1
It includes trace levels of global trace types and loaded widgets.
When level = 0, only error trace will be enabled. When level = 1, error and normal trace will be enabled. When level = 2, all trace including verbose trace will be enabled.
Set trace level like the following: echo PCM0C 0 > /sys/kernel/debug/sof/trace_level will disable the trace of capture host component of fw pipeline.
In the future, more module information will bind with trace.
Yan Wang (29): Define IPC message type and data structure for trace level. Add utility functions and variable for DMA trace level control. Add trace level variable and set function for SOF modules. Add trace level IPC message processing logic. Change trace macro definition and API for trace level checking. Change macro definition and trace calling for dma-trace.c Change macro definition and trace calling for dma-copy.c Change macro definition and trace calling for alloc.c Change macro definition and trace calling for agent.c Change macro definition and trace calling for schdule module. Change macro definition and trace calling for wait.h Change macro definition and trace calling for SSP. Change macro definition and trace calling for dw-dma.c Change macro definition and trace calling for hda-dma.c Change macro definition and trace calling for interrupt.h Change macro definition and trace calling for comp_dev. Change macro definition and trace calling for comp_buffer. Change macro definition and trace calling for pipeline. Change macro definition and trace calling for dai. Change macro definition and trace calling for volume. Change macro definition and trace calling for switch. Change macro definition and trace calling for tone. Change macro definition and trace calling for mixer. Change macro definition and trace calling for host. Change macro definition and trace calling for mux. Change macro definition and trace calling for eq_fir. Change macro definition and trace calling for eq_iir. Change macro definition and trace calling for src. Change macro definition and trace calling for IPC.
src/audio/buffer.c | 13 +-- src/audio/component.c | 31 +++--- src/audio/dai.c | 80 +++++++++------- src/audio/eq_fir.c | 63 ++++++------ src/audio/eq_iir.c | 63 ++++++------ src/audio/host.c | 71 ++++++++------ src/audio/mixer.c | 39 +++++--- src/audio/mux.c | 17 +++- src/audio/pipeline.c | 191 +++++++++++++++++++----------------- src/audio/pipeline_static.c | 2 +- src/audio/src.c | 97 ++++++++++--------- src/audio/src.h | 5 +- src/audio/switch.c | 17 +++- src/audio/tone.c | 79 ++++++++------- src/audio/volume.c | 121 ++++++++++++----------- src/drivers/apl-ssp.c | 29 +++--- src/drivers/byt-ssp.c | 7 +- src/drivers/dw-dma.c | 25 +++-- src/drivers/hda-dma.c | 44 +++++---- src/include/sof/audio/buffer.h | 41 +++++--- src/include/sof/audio/component.h | 34 ++++--- src/include/sof/audio/pipeline.h | 18 +++- src/include/sof/dma-trace.h | 7 ++ src/include/sof/interrupt.h | 12 ++- src/include/sof/ipc.h | 18 +++- src/include/sof/schedule.h | 10 ++ src/include/sof/ssp.h | 14 ++- src/include/sof/trace.h | 197 +++++++++++++++++++++++++++++--------- src/include/sof/wait.h | 21 +++- src/include/uapi/ipc.h | 25 +++++ src/ipc/dma-copy.c | 13 ++- src/ipc/handler.c | 54 ++++++++--- src/ipc/ipc.c | 50 ++++++++-- src/lib/agent.c | 12 ++- src/lib/alloc.c | 18 +++- src/lib/dma-trace.c | 83 +++++++++++++++- src/lib/schedule.c | 20 ++-- src/lib/trace.c | 101 +++++++++++++++++++ 38 files changed, 1173 insertions(+), 569 deletions(-)
From: Yan Wang yan.wang@linux.intel.com
For supporting trace level control based different modules, need define one new IPC message type and data structure to transfer trace levels of different global DMA trace type or component id from kernel driver to SOF side.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/include/uapi/ipc.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/src/include/uapi/ipc.h b/src/include/uapi/ipc.h index b32376d..8495f16 100644 --- a/src/include/uapi/ipc.h +++ b/src/include/uapi/ipc.h @@ -124,6 +124,7 @@ /* trace and debug */ #define SOF_IPC_TRACE_DMA_PARAMS SOF_CMD_TYPE(0x001) #define SOF_IPC_TRACE_DMA_POSITION SOF_CMD_TYPE(0x002) +#define SOF_IPC_TRACE_DMA_LEVELS SOF_CMD_TYPE(0x003)
/* Get message component id */ #define SOF_IPC_MESSAGE_ID(x) (x & 0xffff) @@ -917,6 +918,30 @@ struct sof_ipc_dma_trace_posn { uint32_t messages; /* total trace messages */ } __attribute__((packed));
+/* DMA trace level type */ +enum sof_dma_trace_level_type { + SOF_DMA_TRACE_LEVEL_IRQ = 0, + SOF_DMA_TRACE_LEVEL_IPC, + SOF_DMA_TRACE_LEVEL_DMA, + SOF_DMA_TRACE_LEVEL_SSP, + SOF_DMA_TRACE_LEVEL_WAIT, + SOF_DMA_TRACE_LEVEL_LOCK, + SOF_DMA_TRACE_LEVEL_MEM, + SOF_DMA_TRACE_LEVEL_SA, + SOF_DMA_TRACE_LEVEL_DMIC, + SOF_DMA_TRACE_LEVEL_SCH, + SOF_DMA_TRACE_LEVEL_VALUE, + SOF_DMA_TRACE_LEVEL_END, +}; + +/* DMA for Trace level info - SOF_IPC_DEBUG_DMA_LEVELS */ +struct sof_ipc_dma_trace_levels { + struct sof_ipc_hdr hdr; + uint32_t type; + int32_t comp_id; + uint32_t level; +} __attribute__((packed)); + /* * Architecture specific debug */
From: Yan Wang yan.wang@linux.intel.com
For global trace level type, need one level array to save current trace levels. And it also need set/get functions to operate these trace levels.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/include/sof/dma-trace.h | 7 ++++++ src/lib/dma-trace.c | 61 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+)
diff --git a/src/include/sof/dma-trace.h b/src/include/sof/dma-trace.h index 81ce0a2..42780ab 100644 --- a/src/include/sof/dma-trace.h +++ b/src/include/sof/dma-trace.h @@ -65,6 +65,7 @@ struct dma_trace_data { uint32_t enabled; uint32_t copy_in_progress; uint32_t stream_tag; + uint32_t global_trace_level[SOF_DMA_TRACE_LEVEL_END]; spinlock_t lock; };
@@ -73,9 +74,15 @@ int dma_trace_init_complete(struct dma_trace_data *d); int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem, uint32_t host_size); int dma_trace_enable(struct dma_trace_data *d); +int dma_trace_set_global_level(struct dma_trace_data *d, + enum sof_dma_trace_level_type type, + uint32_t level); void dma_trace_flush(void *t);
void dtrace_event(const char *e, uint32_t size); void dtrace_event_atomic(const char *e, uint32_t length);
+uint32_t get_global_class_trace_level(uint32_t event); +uint32_t get_global_value_trace_level(void); + #endif diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 01a9925..8295f3e 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -269,8 +269,17 @@ static int dma_trace_start(struct dma_trace_data *d)
#endif
+int dma_trace_set_global_level(struct dma_trace_data *d, + enum sof_dma_trace_level_type type, + uint32_t level) +{ + d->global_trace_level[type] = level; + return 0; +} + int dma_trace_enable(struct dma_trace_data *d) { + int i; #if defined CONFIG_DMA_GW int err;
@@ -290,6 +299,10 @@ int dma_trace_enable(struct dma_trace_data *d) }
d->enabled = 1; + + for (i = 0; i < SOF_DMA_TRACE_LEVEL_END; i++) + d->global_trace_level[i] = 1; + work_schedule_default(&d->dmat_work, DMA_TRACE_PERIOD); return 0; } @@ -354,6 +367,54 @@ static void dtrace_add_event(const char *e, uint32_t length) trace_data->messages++; }
+uint32_t get_global_class_trace_level(uint32_t e) +{ + struct dma_trace_data *d = trace_data; + uint32_t class, level = 1; + + /* check whether this event should be sent */ + class = e & 0xff000000; + + switch (class) { + case TRACE_CLASS_IRQ: + level = d->global_trace_level[SOF_DMA_TRACE_LEVEL_IRQ]; + break; + case TRACE_CLASS_IPC: + level = d->global_trace_level[SOF_DMA_TRACE_LEVEL_IPC]; + break; + case TRACE_CLASS_DMA: + level = d->global_trace_level[SOF_DMA_TRACE_LEVEL_DMA]; + break; + case TRACE_CLASS_SSP: + level = d->global_trace_level[SOF_DMA_TRACE_LEVEL_SSP]; + break; + case TRACE_CLASS_WAIT: + level = d->global_trace_level[SOF_DMA_TRACE_LEVEL_WAIT]; + break; + case TRACE_CLASS_LOCK: + level = d->global_trace_level[SOF_DMA_TRACE_LEVEL_LOCK]; + break; + case TRACE_CLASS_MEM: + level = d->global_trace_level[SOF_DMA_TRACE_LEVEL_MEM]; + break; + case TRACE_CLASS_SA: + level = d->global_trace_level[SOF_DMA_TRACE_LEVEL_SA]; + break; + case TRACE_CLASS_SCH: + level = d->global_trace_level[SOF_DMA_TRACE_LEVEL_SCH]; + break; + default: + break; + } + + return level; +} + +uint32_t get_global_value_trace_level(void) +{ + return trace_data->global_trace_level[SOF_DMA_TRACE_LEVEL_VALUE]; +} + void dtrace_event(const char *e, uint32_t length) { struct dma_trace_buf *buffer = NULL;
From: Yan Wang yan.wang@linux.intel.com
SOF modules include comp_dev, comp_buffer and pipeline. For trace level control based on modules, need add one variable for every module type and set function.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/buffer.c | 1 + src/audio/component.c | 1 + src/audio/pipeline.c | 1 + src/include/sof/audio/buffer.h | 3 +++ src/include/sof/audio/component.h | 3 +++ src/include/sof/audio/pipeline.h | 3 +++ src/include/sof/ipc.h | 5 +++++ src/ipc/ipc.c | 34 ++++++++++++++++++++++++++++++++++ 8 files changed, 51 insertions(+)
diff --git a/src/audio/buffer.c b/src/audio/buffer.c index a4cb3dc..6aeb6a4 100644 --- a/src/audio/buffer.c +++ b/src/audio/buffer.c @@ -83,6 +83,7 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc) buffer->free = buffer->ipc_buffer.size; buffer->avail = 0; buffer->connected = 0; + buffer->trace_level = 1;
spinlock_init(&buffer->lock);
diff --git a/src/audio/component.c b/src/audio/component.c index 319b401..15760b2 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -93,6 +93,7 @@ struct comp_dev *comp_new(struct sof_ipc_comp *comp) /* init component */ memcpy(&cdev->comp, comp, sizeof(*comp)); cdev->drv = drv; + cdev->trace_level = 1; spinlock_init(&cdev->lock); list_init(&cdev->bsource_list); list_init(&cdev->bsink_list); diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 28243fc..0ed6b95 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -256,6 +256,7 @@ struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc, list_init(&p->buffer_list); spinlock_init(&p->lock); memcpy(&p->ipc_pipe, pipe_desc, sizeof(*pipe_desc)); + p->trace_level = 1;
return p; } diff --git a/src/include/sof/audio/buffer.h b/src/include/sof/audio/buffer.h index 9193a78..171f0a4 100644 --- a/src/include/sof/audio/buffer.h +++ b/src/include/sof/audio/buffer.h @@ -61,6 +61,9 @@ struct comp_buffer { void *addr; /* buffer base address */ void *end_addr; /* buffer end address */
+ /* trace level */ + uint32_t trace_level; + /* IPC configuration */ struct sof_ipc_buffer ipc_buffer;
diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 35ed618..80a72d9 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -181,6 +181,9 @@ struct comp_dev { uint32_t frame_bytes; /* frames size copied to sink in bytes */ struct pipeline *pipeline; /* pipeline we belong to */
+ /* trace level */ + uint32_t trace_level; + /* common runtime configuration for downstream/upstream */ struct sof_ipc_stream_params params;
diff --git a/src/include/sof/audio/pipeline.h b/src/include/sof/audio/pipeline.h index 57d2488..1ef53e5 100644 --- a/src/include/sof/audio/pipeline.h +++ b/src/include/sof/audio/pipeline.h @@ -57,6 +57,9 @@ struct pipeline { spinlock_t lock; struct sof_ipc_pipe_new ipc_pipe;
+ /* trace level */ + uint32_t trace_level; + /* runtime status */ int32_t xrun_bytes; /* last xrun length */ uint32_t status; /* pipeline status */ diff --git a/src/include/sof/ipc.h b/src/include/sof/ipc.h index 06425b3..67cf25f 100644 --- a/src/include/sof/ipc.h +++ b/src/include/sof/ipc.h @@ -172,6 +172,11 @@ int ipc_comp_connect(struct ipc *ipc, */ struct ipc_comp_dev *ipc_get_comp(struct ipc *ipc, uint32_t id);
+/* + * Set trace level for component. + */ +int ipc_set_comp_level(struct ipc *ipc, uint32_t id, uint32_t level); + /* * Configure all DAI components attached to DAI. */ diff --git a/src/ipc/ipc.c b/src/ipc/ipc.c index fbb1be6..d613d1f 100644 --- a/src/ipc/ipc.c +++ b/src/ipc/ipc.c @@ -78,6 +78,40 @@ struct ipc_comp_dev *ipc_get_comp(struct ipc *ipc, uint32_t id) return NULL; }
+int ipc_set_comp_level(struct ipc *ipc, uint32_t id, uint32_t level) +{ + struct ipc_comp_dev *icd; + struct list_item *clist; + + list_for_item(clist, &ipc->comp_list) { + icd = container_of(clist, struct ipc_comp_dev, list); + switch (icd->type) { + case COMP_TYPE_COMPONENT: + if (icd->cd->comp.id == id) { + icd->cd->trace_level = level; + return 0; + } + break; + case COMP_TYPE_BUFFER: + if (icd->cb->ipc_buffer.comp.id == id) { + icd->cb->trace_level = level; + return 0; + } + break; + case COMP_TYPE_PIPELINE: + if (icd->pipeline->ipc_pipe.comp_id == id) { + icd->pipeline->trace_level = level; + return 0; + } + break; + default: + break; + } + } + + return -EINVAL; +} + int ipc_get_posn_offset(struct ipc *ipc, struct pipeline *pipe) { int i;
From: Yan Wang yan.wang@linux.intel.com
When SOF side receives trace level IPC message, set it to global trace level array or component structure for future usage.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/ipc/handler.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/src/ipc/handler.c b/src/ipc/handler.c index 581ce9e..41290ca 100644 --- a/src/ipc/handler.c +++ b/src/ipc/handler.c @@ -510,6 +510,34 @@ static int ipc_glb_pm_message(uint32_t header) * Debug IPC Operations. */
+static int ipc_dma_trace_levels(uint32_t header) +{ + struct sof_ipc_dma_trace_levels *levels = _ipc->comp_data; + struct sof_ipc_reply reply; + int err; + + if (levels->comp_id == -1) + err = dma_trace_set_global_level(_ipc->dmat, levels->type, + levels->level); + else + err = ipc_set_comp_level(_ipc, levels->comp_id, levels->level); + + if (err < 0) + goto error; + + /* write reply message to the outbox */ + reply.hdr.size = sizeof(reply); + reply.hdr.cmd = header; + reply.error = 0; + mailbox_hostbox_write(0, &reply, sizeof(reply)); + return 0; + +error: + if (err < 0) + trace_ipc_error("eA!"); + return -EINVAL; +} + static int ipc_dma_trace_config(uint32_t header) { #ifdef CONFIG_HOST_PTABLE @@ -619,6 +647,8 @@ static int ipc_glb_debug_message(uint32_t header) switch (cmd) { case iCS(SOF_IPC_TRACE_DMA_PARAMS): return ipc_dma_trace_config(header); + case iCS(SOF_IPC_TRACE_DMA_LEVELS): + return ipc_dma_trace_levels(header); default: trace_ipc_error("eDc"); trace_error_value(header);
From: Yan Wang yan.wang@linux.intel.com
TRACEV and TRACEE are unnecessary because new trace API could cover every level (ERROR is 0, NORMAL is 1 and VERBOSE is 2). And global, component, buffer and pipeline have different trace level checking.: For scheduler trace, it uses pipeline trace class previously but no pipeline structure as input parameter. So add a new global trace class for it.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/include/sof/trace.h | 197 +++++++++++++++++++++++++++++++++++++----------- src/lib/trace.c | 101 +++++++++++++++++++++++++ 2 files changed, 254 insertions(+), 44 deletions(-)
diff --git a/src/include/sof/trace.h b/src/include/sof/trace.h index 2fd77fe..c2d874c 100644 --- a/src/include/sof/trace.h +++ b/src/include/sof/trace.h @@ -96,13 +96,16 @@ #define TRACE_CLASS_EQ_IIR (20 << 24) #define TRACE_CLASS_SA (21 << 24) #define TRACE_CLASS_DMIC (22 << 24) +#define TRACE_CLASS_SCH (23 << 24)
/* move to config.h */ #define TRACE 1 -#define TRACEV 0 -#define TRACEE 1 #define TRACEM 0 /* send all trace messages to mbox and local trace buffer */
+#define ERROR_LEVEL 0 +#define NORMAL_LEVEL 1 +#define VERBOSE_LEVEL 2 + void _trace_event(uint32_t event); void _trace_event_mbox(uint32_t event); void _trace_event_atomic(uint32_t event); @@ -111,63 +114,169 @@ void trace_flush(void); void trace_off(void); void trace_init(struct sof *sof);
+#define DECLARE_MODULE_TRACE_FUNCTION(NAME, MODULE) \ + void _trace_##NAME##_event(struct MODULE *m, \ + uint32_t level, uint32_t event); \ + void _trace_##NAME##_event_mbox(struct MODULE *m, \ + uint32_t level, uint32_t event); \ + void _trace_##NAME##_event_atomic(struct MODULE *m, \ + uint32_t level, uint32_t event); \ + void _trace_##NAME##_event_mbox_atomic(struct MODULE *m, \ + uint32_t level, uint32_t event); + +struct comp_dev; +struct comp_buffer; +struct pipeline; + +DECLARE_MODULE_TRACE_FUNCTION(comp, comp_dev) +DECLARE_MODULE_TRACE_FUNCTION(buf, comp_buffer) +DECLARE_MODULE_TRACE_FUNCTION(pipe, pipeline) + +void _trace_global_event(uint32_t level, uint32_t event); +void _trace_global_event_mbox(uint32_t level, uint32_t event); +void _trace_global_event_atomic(uint32_t level, uint32_t event); +void _trace_global_event_mbox_atomic(uint32_t level, uint32_t event); + +void _trace_global_value(uint32_t level, uint32_t value); +void _trace_global_value_mbox(uint32_t level, uint32_t value); +void _trace_global_value_atomic(uint32_t level, uint32_t value); +void _trace_global_value_mbox_atomic(uint32_t level, uint32_t value); + #if TRACE
-/* send all trace to mbox and local trace buffer */ +#define trace_point(x) platform_trace_point(x) + +/* send component trace to mbox and local trace buffer */ #if TRACEM -#define trace_event(__c, __e) \ - _trace_event_mbox(__c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) -#define trace_event_atomic(__c, __e) \ - _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) -/* send trace events only to the local trace buffer */ +#define trace_comp_event(__cd, __l, __c, __e) \ + _trace_comp_event_mbox(__cd, __l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_comp_event_atomic(__cd, __l, __c, __e) \ + _trace_comp_event_mbox_atomic_(__cd, __l, \ + __c | (__e[0] << 16) | \ + (__e[1] << 8) | __e[2]) +#define trace_comp_value(cd, l, x) \ + _trace_comp_event_mbox(cd, l, x) +#define trace_comp_value_atomic(cd, l, x) \ + _trace_comp_event_mobox_atomic(cd, l, x) +/* send component trace only to the local trace buffer */ #else -#define trace_event(__c, __e) \ - _trace_event(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2]) -#define trace_event_atomic(__c, __e) \ - _trace_event_atomic(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2]) +#define trace_comp_event(__cd, __l, __c, __e) \ + _trace_comp_event(__cd, __l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_comp_event_atomic(__cd, __l, __c, __e) \ + _trace_comp_event_atomic(__cd, __l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_comp_value(cd, l, x) \ + _trace_comp_event(cd, l, x) +#define trace_comp_value_atomic(cd, l, x) \ + _trace_comp_event_atomic(cd, l, x) #endif -#define trace_value(x) _trace_event(x) -#define trace_value_atomic(x) _trace_event_atomic(x)
-#define trace_point(x) platform_trace_point(x) +/* send buffer trace to mbox and local trace buffer */ +#if TRACEM +#define trace_buf_event(__cb, __l, __c, __e) \ + _trace_buf_event_mbox(__cb, __l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_buf_event_atomic(__cb, __l, __c, __e) \ + _trace_buf_event_mbox_atomic_(__cb, __l, \ + __c | (__e[0] << 16) | \ + (__e[1] << 8) | __e[2]) +#define trace_buf_value(cb, l, x) \ + _trace_buf_event_mbox(cb, l, x) +#define trace_buf_value_atomic(cb, l, x) \ + _trace_buf_event_mbox_atomic(cb, l, x) +/* send buffer trace only to the local trace buffer */ +#else +#define trace_buf_event(__cb, __l, __c, __e) \ + _trace_buf_event(__cb, __l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_buf_event_atomic(__cb, __l, __c, __e) \ + _trace_buf_event_atomic(__cb, __l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_buf_value(cb, l, x) \ + _trace_buf_event(cb, l, x) +#define trace_buf_value_atomic(cb, l, x) \ + _trace_buf_event_atomic(cb, l, x) +#endif
-/* verbose tracing */ -#if TRACEV -#define tracev_event(__c, __e) trace_event(__c, __e) -#define tracev_value(x) _trace_event(x) -#define tracev_event_atomic(__c, __e) trace_event_atomic(__c, __e) -#define tracev_value_atomic(x) _trace_event_atomic(x) +/* send pipeline trace to mbox and local trace pipeline */ +#if TRACEM +#define trace_pipeline_event(__cp, __l, __c, __e) \ + _trace_pipe_event_mbox(__cp, __l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_pipeline_event_atomic(__cp, __l, __c, __e) \ + _trace_pipe_event_mbox_atomic_(__cp, __l, \ + __c | (__e[0] << 16) | \ + (__e[1] << 8) | __e[2]) +#define trace_pipeline_value(cb, l, x) \ + _trace_pipe_event_mbox(cb, l, x) +#define trace_pipeline_value_atomic(cb, l, x) \ + _trace_pipe_event_mbox_atomic(cb, l, x) +/* send pipeline trace only to the local trace pipeline */ #else -#define tracev_event(__c, __e) -#define tracev_value(x) -#define tracev_event_atomic(__c, __e) -#define tracev_value_atomic(x) +#define trace_pipeline_event(__cp, __l, __c, __e) \ + _trace_pipe_event(__cp, __l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_pipeline_event_atomic(__cp, __l, __c, __e) \ + _trace_pipe_event_atomic(__cp, __l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_pipeline_value(cb, l, x) \ + _trace_pipe_event(cb, l, x) +#define trace_pipeline_value_atomic(cb, l, x) \ + _trace_pipe_event_atomic(cb, l, x) #endif
-/* error tracing */ -#if TRACEE -#define trace_error(__c, __e) \ - _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) -#define trace_error_atomic(__c, __e) \ - _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) -/* write back error value to mbox */ -#define trace_error_value(x) _trace_event_mbox_atomic(x) -#define trace_error_value_atomic(x) _trace_event_mbox_atomic(x) +/* send global trace to mbox and local trace buffer */ +#if TRACEM +#define trace_global_event(__l, __c, __e) \ + _trace_global_event_mbox(__l, \ + __c | (__e[0] << 16) | (__e[1] << 8) | __e[2]) +#define trace_global_event_atomic(__l, __c, __e) \ + _trace_global_event_mbox_atomic_(__l, \ + __c | (__e[0] << 16) | \ + (__e[1] << 8) | __e[2]) +#define trace_global_value(l, x) \ + _trace_global_value_mbox(l, x) +#define trace_global_value_atomic(l, x) \ + _trace_global_value_mbox_atomic(l, x) +/* send global trace only to the local trace buffer */ #else -#define trace_error(__c, __e) -#define trace_error_atomic(__c, __e) -#define trace_error_value(x) -#define trace_error_value_atomic(x) +#define trace_global_event(__l, __c, __e) \ + _trace_global_event(__l, \ + __c | (__e[0] << 16) | \ + (__e[1] << 8) | __e[2]) +#define trace_global_event_atomic(__l, __c, __e) \ + _trace_global_event_atomic(__l, \ + __c | (__e[0] << 16) | \ + (__e[1] << 8) | __e[2]) +#define trace_global_value(l, x) \ + _trace_global_value(l, x) +#define trace_global_value_atomic(l, x) \ + _trace_global_value_atomic(l, x) #endif
#else
-#define trace_event(x, e) -#define trace_error(c, e) -#define trace_value(x) -#define trace_point(x) -#define tracev_event(__c, __e) -#define tracev_value(x) +#define trace_comp_event(cd, l, x, e) +#define trace_comp_event_atomic(cd, l, c, e) +#define trace_comp_value(cd, l, x) +#define trace_comp_value_atomic(cd, l, x) + +#define trace_buf_event(cd, l, x, e) +#define trace_buf_event_atomic(cd, l, c, e) +#define trace_buf_value(cd, l, x) +#define trace_buf_value_atomic(cd, l, x) + +#define trace_pipeline_event(cd, l, x, e) +#define trace_pipeline_event_atomic(cd, l, c, e) +#define trace_pipeline_value(cd, l, x) +#define trace_pipeline_value_atomic(cd, l, x) + +#define trace_global_event(l, x, e) +#define trace_global_event_atomic(l, c, e) +#define trace_global_value(l, x) +#define trace_global_value_atomic(l, x)
#endif
diff --git a/src/lib/trace.c b/src/lib/trace.c index 0c37858..c522330 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -35,6 +35,9 @@ #include <platform/timer.h> #include <sof/lock.h> #include <sof/dma-trace.h> +#include <sof/audio/component.h> +#include <sof/audio/buffer.h> +#include <sof/audio/pipeline.h> #include <stdint.h>
struct trace { @@ -136,6 +139,104 @@ void _trace_event_mbox_atomic(uint32_t event) dcache_writeback_region((void *)t, sizeof(uint64_t) * 2); }
+#define DEFINE_MODULE_TRACE_FUNCTION(NAME, MODULE) \ +inline void _trace_##NAME##_event(struct MODULE *m, \ + uint32_t level, uint32_t event) \ +{ \ + if (m && m->trace_level < level) \ + return; \ + _trace_event(event); \ +} \ +inline void _trace_##NAME##_event_atomic(struct MODULE *m, \ + uint32_t level, uint32_t event) \ +{ \ + if (m && m->trace_level < level) \ + return; \ + _trace_event_atomic(event); \ +} \ +inline void _trace_##NAME##_event_mbox(struct MODULE *m, \ + uint32_t level, uint32_t event) \ +{ \ + if (m && m->trace_level < level) \ + return; \ + _trace_event_mbox(event); \ +} \ +inline void _trace_##NAME##_event_mbox_atomic(struct MODULE *m, \ + uint32_t level, uint32_t event) \ +{ \ + if (m && m->trace_level < level) \ + return; \ + _trace_event_mbox_atomic(event); \ +} + +DEFINE_MODULE_TRACE_FUNCTION(comp, comp_dev) +DEFINE_MODULE_TRACE_FUNCTION(buf, comp_buffer) +DEFINE_MODULE_TRACE_FUNCTION(pipe, pipeline) + +inline void _trace_global_event(uint32_t level, uint32_t event) +{ + if (get_global_class_trace_level(event) < level) + return; + + _trace_event(event); +} + +inline void _trace_global_event_atomic(uint32_t level, uint32_t event) +{ + if (get_global_class_trace_level(event) < level) + return; + + _trace_event_atomic(event); +} + +inline void _trace_global_event_mbox(uint32_t level, uint32_t event) +{ + if (get_global_class_trace_level(event) < level) + return; + + _trace_event_mbox(event); +} + +inline void _trace_global_event_mbox_atomic(uint32_t level, uint32_t event) +{ + if (get_global_class_trace_level(event) < level) + return; + + _trace_event_mbox_atomic(event); +} + +inline void _trace_global_value(uint32_t level, uint32_t value) +{ + if (get_global_value_trace_level() < level) + return; + + _trace_event(value); +} + +inline void _trace_global_value_atomic(uint32_t level, uint32_t value) +{ + if (get_global_value_trace_level() < level) + return; + + _trace_event_atomic(value); +} + +inline void _trace_global_value_mbox(uint32_t level, uint32_t value) +{ + if (get_global_value_trace_level() < level) + return; + + _trace_event_mbox(value); +} + +inline void _trace_global_value_mbox_atomic(uint32_t level, uint32_t value) +{ + if (get_global_value_trace_level() < level) + return; + + _trace_event_mbox_atomic(value); +} + void trace_flush(void) { volatile uint64_t *t;
On Thu, 2018-05-10 at 19:31 +0800, sound-open-firmware-bounces@alsa- project.org wrote:
From: Yan Wang yan.wang@linux.intel.com
TRACEV and TRACEE are unnecessary because new trace API could cover every level (ERROR is 0, NORMAL is 1 and VERBOSE is 2). And global, component, buffer and pipeline have different trace level checking.: For scheduler trace, it uses pipeline trace class previously but no pipeline structure as input parameter. So add a new global trace class for it.
Signed-off-by: Yan Wang yan.wang@linux.intel.com
Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51
src/include/sof/trace.h | 197 +++++++++++++++++++++++++++++++++++++-
src/lib/trace.c | 101 +++++++++++++++++++++++++ 2 files changed, 254 insertions(+), 44 deletions(-)
diff --git a/src/include/sof/trace.h b/src/include/sof/trace.h index 2fd77fe..c2d874c 100644 --- a/src/include/sof/trace.h +++ b/src/include/sof/trace.h @@ -96,13 +96,16 @@ #define TRACE_CLASS_EQ_IIR (20 << 24) #define TRACE_CLASS_SA (21 << 24) #define TRACE_CLASS_DMIC (22 << 24) +#define TRACE_CLASS_SCH (23 << 24)
/* move to config.h */ #define TRACE 1 -#define TRACEV 0 -#define TRACEE 1 #define TRACEM 0 /* send all trace messages to mbox and local trace buffer */
+#define ERROR_LEVEL 0 +#define NORMAL_LEVEL 1 +#define VERBOSE_LEVEL 2
void _trace_event(uint32_t event); void _trace_event_mbox(uint32_t event); void _trace_event_atomic(uint32_t event); @@ -111,63 +114,169 @@ void trace_flush(void); void trace_off(void); void trace_init(struct sof *sof);
+#define DECLARE_MODULE_TRACE_FUNCTION(NAME, MODULE) \
- void _trace_##NAME##_event(struct MODULE *m, \
uint32_t level, uint32_t event);
\
- void _trace_##NAME##_event_mbox(struct MODULE *m, \
uint32_t level, uint32_t
event); \
- void _trace_##NAME##_event_atomic(struct MODULE *m, \
uint32_t level, uint32_t
event); \
- void _trace_##NAME##_event_mbox_atomic(struct MODULE *m, \
uint32_t level,
uint32_t event);
+struct comp_dev; +struct comp_buffer; +struct pipeline;
+DECLARE_MODULE_TRACE_FUNCTION(comp, comp_dev) +DECLARE_MODULE_TRACE_FUNCTION(buf, comp_buffer) +DECLARE_MODULE_TRACE_FUNCTION(pipe, pipeline)
Yan, just curious, why do we need to define these here in trace.h? Cant we define them in buffer.c, pipeline.c and component.c? And have them call a generic trace function in trace.h?
+void _trace_global_event(uint32_t level, uint32_t event); +void _trace_global_event_mbox(uint32_t level, uint32_t event); +void _trace_global_event_atomic(uint32_t level, uint32_t event); +void _trace_global_event_mbox_atomic(uint32_t level, uint32_t event);
+void _trace_global_value(uint32_t level, uint32_t value); +void _trace_global_value_mbox(uint32_t level, uint32_t value); +void _trace_global_value_atomic(uint32_t level, uint32_t value); +void _trace_global_value_mbox_atomic(uint32_t level, uint32_t value);
#if TRACE
-/* send all trace to mbox and local trace buffer */ +#define trace_point(x) platform_trace_point(x)
+/* send component trace to mbox and local trace buffer */ #if TRACEM -#define trace_event(__c, __e) \
- _trace_event_mbox(__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) -#define trace_event_atomic(__c, __e) \
- _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
-/* send trace events only to the local trace buffer */ +#define trace_comp_event(__cd, __l, __c, __e) \
- _trace_comp_event_mbox(__cd, __l, \
__c | (__e[0] << 16) | (__e[1] << 8)
| __e[2]) +#define trace_comp_event_atomic(__cd, __l, __c, __e) \
- _trace_comp_event_mbox_atomic_(__cd, __l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_comp_value(cd, l, x) \
- _trace_comp_event_mbox(cd, l, x)
+#define trace_comp_value_atomic(cd, l, x) \
- _trace_comp_event_mobox_atomic(cd, l, x)
+/* send component trace only to the local trace buffer */ #else -#define trace_event(__c, __e) \
- _trace_event(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2])
-#define trace_event_atomic(__c, __e) \
- _trace_event_atomic(__c | (__e[0] << 16) | (__e[1] <<8) |
__e[2]) +#define trace_comp_event(__cd, __l, __c, __e) \
- _trace_comp_event(__cd, __l, \
__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) +#define trace_comp_event_atomic(__cd, __l, __c, __e) \
- _trace_comp_event_atomic(__cd, __l, \
__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
+#define trace_comp_value(cd, l, x) \
- _trace_comp_event(cd, l, x)
+#define trace_comp_value_atomic(cd, l, x) \
- _trace_comp_event_atomic(cd, l, x)
#endif -#define trace_value(x) _trace_event(x) -#define trace_value_atomic(x) _trace_event_atomic(x)
-#define trace_point(x) platform_trace_point(x) +/* send buffer trace to mbox and local trace buffer */ +#if TRACEM +#define trace_buf_event(__cb, __l, __c, __e) \
- _trace_buf_event_mbox(__cb, __l, \
__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) +#define trace_buf_event_atomic(__cb, __l, __c, __e) \
- _trace_buf_event_mbox_atomic_(__cb, __l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_buf_value(cb, l, x) \
- _trace_buf_event_mbox(cb, l, x)
+#define trace_buf_value_atomic(cb, l, x) \
- _trace_buf_event_mbox_atomic(cb, l, x)
+/* send buffer trace only to the local trace buffer */ +#else +#define trace_buf_event(__cb, __l, __c, __e) \
- _trace_buf_event(__cb, __l, \
__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) +#define trace_buf_event_atomic(__cb, __l, __c, __e) \
- _trace_buf_event_atomic(__cb, __l, \
__c | (__e[0] << 16) | (__e[1] << 8)
| __e[2]) +#define trace_buf_value(cb, l, x) \
- _trace_buf_event(cb, l, x)
+#define trace_buf_value_atomic(cb, l, x) \
- _trace_buf_event_atomic(cb, l, x)
+#endif
-/* verbose tracing */ -#if TRACEV -#define tracev_event(__c, __e) trace_event(__c, __e) -#define tracev_value(x) _trace_event(x) -#define tracev_event_atomic(__c, __e) trace_event_atomic(__c, __e) -#define tracev_value_atomic(x) _trace_event_atomic(x) +/* send pipeline trace to mbox and local trace pipeline */ +#if TRACEM +#define trace_pipeline_event(__cp, __l, __c, __e) \
- _trace_pipe_event_mbox(__cp, __l, \
__c | (__e[0] << 16) | (__e[1] << 8)
| __e[2]) +#define trace_pipeline_event_atomic(__cp, __l, __c, __e) \
- _trace_pipe_event_mbox_atomic_(__cp, __l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_pipeline_value(cb, l, x) \
- _trace_pipe_event_mbox(cb, l, x)
+#define trace_pipeline_value_atomic(cb, l, x) \
- _trace_pipe_event_mbox_atomic(cb, l, x)
+/* send pipeline trace only to the local trace pipeline */ #else -#define tracev_event(__c, __e) -#define tracev_value(x) -#define tracev_event_atomic(__c, __e) -#define tracev_value_atomic(x) +#define trace_pipeline_event(__cp, __l, __c, __e) \
- _trace_pipe_event(__cp, __l, \
__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) +#define trace_pipeline_event_atomic(__cp, __l, __c, __e) \
- _trace_pipe_event_atomic(__cp, __l, \
__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
+#define trace_pipeline_value(cb, l, x) \
- _trace_pipe_event(cb, l, x)
+#define trace_pipeline_value_atomic(cb, l, x) \
- _trace_pipe_event_atomic(cb, l, x)
#endif
-/* error tracing */ -#if TRACEE -#define trace_error(__c, __e) \
- _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
-#define trace_error_atomic(__c, __e) \
- _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
-/* write back error value to mbox */ -#define trace_error_value(x) _trace_event_mbox_atomic(x) -#define trace_error_value_atomic(x) _trace_event_mbox_atomic(x) +/* send global trace to mbox and local trace buffer */ +#if TRACEM +#define trace_global_event(__l, __c, __e) \
- _trace_global_event_mbox(__l, \
__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
+#define trace_global_event_atomic(__l, __c, __e) \
- _trace_global_event_mbox_atomic_(__l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_global_value(l, x) \
- _trace_global_value_mbox(l, x)
+#define trace_global_value_atomic(l, x) \
- _trace_global_value_mbox_atomic(l, x)
+/* send global trace only to the local trace buffer */ #else -#define trace_error(__c, __e) -#define trace_error_atomic(__c, __e) -#define trace_error_value(x) -#define trace_error_value_atomic(x) +#define trace_global_event(__l, __c, __e) \
- _trace_global_event(__l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_global_event_atomic(__l, __c, __e) \
- _trace_global_event_atomic(__l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_global_value(l, x) \
- _trace_global_value(l, x)
+#define trace_global_value_atomic(l, x) \
- _trace_global_value_atomic(l, x)
#endif
#else
-#define trace_event(x, e) -#define trace_error(c, e) -#define trace_value(x) -#define trace_point(x) -#define tracev_event(__c, __e) -#define tracev_value(x) +#define trace_comp_event(cd, l, x, e) +#define trace_comp_event_atomic(cd, l, c, e) +#define trace_comp_value(cd, l, x) +#define trace_comp_value_atomic(cd, l, x)
+#define trace_buf_event(cd, l, x, e) +#define trace_buf_event_atomic(cd, l, c, e) +#define trace_buf_value(cd, l, x) +#define trace_buf_value_atomic(cd, l, x)
+#define trace_pipeline_event(cd, l, x, e) +#define trace_pipeline_event_atomic(cd, l, c, e) +#define trace_pipeline_value(cd, l, x) +#define trace_pipeline_value_atomic(cd, l, x)
+#define trace_global_event(l, x, e) +#define trace_global_event_atomic(l, c, e) +#define trace_global_value(l, x) +#define trace_global_value_atomic(l, x)
#endif
diff --git a/src/lib/trace.c b/src/lib/trace.c index 0c37858..c522330 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -35,6 +35,9 @@ #include <platform/timer.h> #include <sof/lock.h> #include <sof/dma-trace.h> +#include <sof/audio/component.h> +#include <sof/audio/buffer.h> +#include <sof/audio/pipeline.h> #include <stdint.h>
struct trace { @@ -136,6 +139,104 @@ void _trace_event_mbox_atomic(uint32_t event) dcache_writeback_region((void *)t, sizeof(uint64_t) * 2); }
+#define DEFINE_MODULE_TRACE_FUNCTION(NAME, MODULE) \ +inline void _trace_##NAME##_event(struct MODULE *m, \
uint32_t level, uint32_t event) \
+{ \
- if (m && m->trace_level < level) \
return; \
- _trace_event(event); \
+} \ +inline void _trace_##NAME##_event_atomic(struct MODULE *m, \
uint32_t level, uint32_t
event) \ +{ \
- if (m && m->trace_level < level) \
return; \
- _trace_event_atomic(event); \
+} \ +inline void _trace_##NAME##_event_mbox(struct MODULE *m, \
uint32_t level, uint32_t
event) \ +{ \
- if (m && m->trace_level < level) \
return; \
- _trace_event_mbox(event); \
+} \ +inline void _trace_##NAME##_event_mbox_atomic(struct MODULE *m, \
uint32_t level,
uint32_t event) \ +{ \
- if (m && m->trace_level < level) \
return; \
- _trace_event_mbox_atomic(event); \
+}
+DEFINE_MODULE_TRACE_FUNCTION(comp, comp_dev) +DEFINE_MODULE_TRACE_FUNCTION(buf, comp_buffer) +DEFINE_MODULE_TRACE_FUNCTION(pipe, pipeline)
+inline void _trace_global_event(uint32_t level, uint32_t event) +{
- if (get_global_class_trace_level(event) < level)
return;
- _trace_event(event);
+}
+inline void _trace_global_event_atomic(uint32_t level, uint32_t event) +{
- if (get_global_class_trace_level(event) < level)
return;
- _trace_event_atomic(event);
+}
+inline void _trace_global_event_mbox(uint32_t level, uint32_t event) +{
- if (get_global_class_trace_level(event) < level)
return;
- _trace_event_mbox(event);
+}
+inline void _trace_global_event_mbox_atomic(uint32_t level, uint32_t event) +{
- if (get_global_class_trace_level(event) < level)
return;
- _trace_event_mbox_atomic(event);
+}
+inline void _trace_global_value(uint32_t level, uint32_t value) +{
- if (get_global_value_trace_level() < level)
return;
- _trace_event(value);
+}
+inline void _trace_global_value_atomic(uint32_t level, uint32_t value) +{
- if (get_global_value_trace_level() < level)
return;
- _trace_event_atomic(value);
+}
+inline void _trace_global_value_mbox(uint32_t level, uint32_t value) +{
- if (get_global_value_trace_level() < level)
return;
- _trace_event_mbox(value);
+}
+inline void _trace_global_value_mbox_atomic(uint32_t level, uint32_t value) +{
- if (get_global_value_trace_level() < level)
return;
- _trace_event_mbox_atomic(value);
+}
void trace_flush(void) { volatile uint64_t *t;
On 5/11/2018 1:43 PM, Ranjani Sridharan wrote:
On Thu, 2018-05-10 at 19:31 +0800, sound-open-firmware-bounces@alsa- project.org wrote:
From: Yan Wang yan.wang@linux.intel.com
TRACEV and TRACEE are unnecessary because new trace API could cover every level (ERROR is 0, NORMAL is 1 and VERBOSE is 2). And global, component, buffer and pipeline have different trace level checking.: For scheduler trace, it uses pipeline trace class previously but no pipeline structure as input parameter. So add a new global trace class for it.
Signed-off-by: Yan Wang yan.wang@linux.intel.com
Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51
src/include/sof/trace.h | 197 +++++++++++++++++++++++++++++++++++++-
src/lib/trace.c | 101 +++++++++++++++++++++++++ 2 files changed, 254 insertions(+), 44 deletions(-)
diff --git a/src/include/sof/trace.h b/src/include/sof/trace.h index 2fd77fe..c2d874c 100644 --- a/src/include/sof/trace.h +++ b/src/include/sof/trace.h @@ -96,13 +96,16 @@ #define TRACE_CLASS_EQ_IIR (20 << 24) #define TRACE_CLASS_SA (21 << 24) #define TRACE_CLASS_DMIC (22 << 24) +#define TRACE_CLASS_SCH (23 << 24)
/* move to config.h */ #define TRACE 1 -#define TRACEV 0 -#define TRACEE 1 #define TRACEM 0 /* send all trace messages to mbox and local trace buffer */
+#define ERROR_LEVEL 0 +#define NORMAL_LEVEL 1 +#define VERBOSE_LEVEL 2
- void _trace_event(uint32_t event); void _trace_event_mbox(uint32_t event); void _trace_event_atomic(uint32_t event);
@@ -111,63 +114,169 @@ void trace_flush(void); void trace_off(void); void trace_init(struct sof *sof);
+#define DECLARE_MODULE_TRACE_FUNCTION(NAME, MODULE) \
- void _trace_##NAME##_event(struct MODULE *m, \
uint32_t level, uint32_t event);
\
- void _trace_##NAME##_event_mbox(struct MODULE *m, \
uint32_t level, uint32_t
event); \
- void _trace_##NAME##_event_atomic(struct MODULE *m, \
uint32_t level, uint32_t
event); \
- void _trace_##NAME##_event_mbox_atomic(struct MODULE *m, \
uint32_t level,
uint32_t event);
+struct comp_dev; +struct comp_buffer; +struct pipeline;
+DECLARE_MODULE_TRACE_FUNCTION(comp, comp_dev) +DECLARE_MODULE_TRACE_FUNCTION(buf, comp_buffer) +DECLARE_MODULE_TRACE_FUNCTION(pipe, pipeline)
Yan, just curious, why do we need to define these here in trace.h? Cant we define them in buffer.c, pipeline.c and component.c? And have them call a generic trace function in trace.h?
Yes. I can modify it. Thanks.
Yan Wang
+void _trace_global_event(uint32_t level, uint32_t event); +void _trace_global_event_mbox(uint32_t level, uint32_t event); +void _trace_global_event_atomic(uint32_t level, uint32_t event); +void _trace_global_event_mbox_atomic(uint32_t level, uint32_t event);
+void _trace_global_value(uint32_t level, uint32_t value); +void _trace_global_value_mbox(uint32_t level, uint32_t value); +void _trace_global_value_atomic(uint32_t level, uint32_t value); +void _trace_global_value_mbox_atomic(uint32_t level, uint32_t value);
- #if TRACE
-/* send all trace to mbox and local trace buffer */ +#define trace_point(x) platform_trace_point(x)
+/* send component trace to mbox and local trace buffer */ #if TRACEM -#define trace_event(__c, __e) \
- _trace_event_mbox(__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) -#define trace_event_atomic(__c, __e) \
- _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
-/* send trace events only to the local trace buffer */ +#define trace_comp_event(__cd, __l, __c, __e) \
- _trace_comp_event_mbox(__cd, __l, \
__c | (__e[0] << 16) | (__e[1] << 8)
| __e[2]) +#define trace_comp_event_atomic(__cd, __l, __c, __e) \
- _trace_comp_event_mbox_atomic_(__cd, __l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_comp_value(cd, l, x) \
- _trace_comp_event_mbox(cd, l, x)
+#define trace_comp_value_atomic(cd, l, x) \
- _trace_comp_event_mobox_atomic(cd, l, x)
+/* send component trace only to the local trace buffer */ #else -#define trace_event(__c, __e) \
- _trace_event(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2])
-#define trace_event_atomic(__c, __e) \
- _trace_event_atomic(__c | (__e[0] << 16) | (__e[1] <<8) |
__e[2]) +#define trace_comp_event(__cd, __l, __c, __e) \
- _trace_comp_event(__cd, __l, \
__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) +#define trace_comp_event_atomic(__cd, __l, __c, __e) \
- _trace_comp_event_atomic(__cd, __l, \
__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
+#define trace_comp_value(cd, l, x) \
- _trace_comp_event(cd, l, x)
+#define trace_comp_value_atomic(cd, l, x) \
- _trace_comp_event_atomic(cd, l, x) #endif
-#define trace_value(x) _trace_event(x) -#define trace_value_atomic(x) _trace_event_atomic(x)
-#define trace_point(x) platform_trace_point(x) +/* send buffer trace to mbox and local trace buffer */ +#if TRACEM +#define trace_buf_event(__cb, __l, __c, __e) \
- _trace_buf_event_mbox(__cb, __l, \
__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) +#define trace_buf_event_atomic(__cb, __l, __c, __e) \
- _trace_buf_event_mbox_atomic_(__cb, __l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_buf_value(cb, l, x) \
- _trace_buf_event_mbox(cb, l, x)
+#define trace_buf_value_atomic(cb, l, x) \
- _trace_buf_event_mbox_atomic(cb, l, x)
+/* send buffer trace only to the local trace buffer */ +#else +#define trace_buf_event(__cb, __l, __c, __e) \
- _trace_buf_event(__cb, __l, \
__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) +#define trace_buf_event_atomic(__cb, __l, __c, __e) \
- _trace_buf_event_atomic(__cb, __l, \
__c | (__e[0] << 16) | (__e[1] << 8)
| __e[2]) +#define trace_buf_value(cb, l, x) \
- _trace_buf_event(cb, l, x)
+#define trace_buf_value_atomic(cb, l, x) \
- _trace_buf_event_atomic(cb, l, x)
+#endif
-/* verbose tracing */ -#if TRACEV -#define tracev_event(__c, __e) trace_event(__c, __e) -#define tracev_value(x) _trace_event(x) -#define tracev_event_atomic(__c, __e) trace_event_atomic(__c, __e) -#define tracev_value_atomic(x) _trace_event_atomic(x) +/* send pipeline trace to mbox and local trace pipeline */ +#if TRACEM +#define trace_pipeline_event(__cp, __l, __c, __e) \
- _trace_pipe_event_mbox(__cp, __l, \
__c | (__e[0] << 16) | (__e[1] << 8)
| __e[2]) +#define trace_pipeline_event_atomic(__cp, __l, __c, __e) \
- _trace_pipe_event_mbox_atomic_(__cp, __l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_pipeline_value(cb, l, x) \
- _trace_pipe_event_mbox(cb, l, x)
+#define trace_pipeline_value_atomic(cb, l, x) \
- _trace_pipe_event_mbox_atomic(cb, l, x)
+/* send pipeline trace only to the local trace pipeline */ #else -#define tracev_event(__c, __e) -#define tracev_value(x) -#define tracev_event_atomic(__c, __e) -#define tracev_value_atomic(x) +#define trace_pipeline_event(__cp, __l, __c, __e) \
- _trace_pipe_event(__cp, __l, \
__c | (__e[0] << 16) | (__e[1] << 8) |
__e[2]) +#define trace_pipeline_event_atomic(__cp, __l, __c, __e) \
- _trace_pipe_event_atomic(__cp, __l, \
__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
+#define trace_pipeline_value(cb, l, x) \
- _trace_pipe_event(cb, l, x)
+#define trace_pipeline_value_atomic(cb, l, x) \
- _trace_pipe_event_atomic(cb, l, x) #endif
-/* error tracing */ -#if TRACEE -#define trace_error(__c, __e) \
- _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
-#define trace_error_atomic(__c, __e) \
- _trace_event_mbox_atomic(__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
-/* write back error value to mbox */ -#define trace_error_value(x) _trace_event_mbox_atomic(x) -#define trace_error_value_atomic(x) _trace_event_mbox_atomic(x) +/* send global trace to mbox and local trace buffer */ +#if TRACEM +#define trace_global_event(__l, __c, __e) \
- _trace_global_event_mbox(__l, \
__c | (__e[0] << 16) | (__e[1] <<
- | __e[2])
+#define trace_global_event_atomic(__l, __c, __e) \
- _trace_global_event_mbox_atomic_(__l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_global_value(l, x) \
- _trace_global_value_mbox(l, x)
+#define trace_global_value_atomic(l, x) \
- _trace_global_value_mbox_atomic(l, x)
+/* send global trace only to the local trace buffer */ #else -#define trace_error(__c, __e) -#define trace_error_atomic(__c, __e) -#define trace_error_value(x) -#define trace_error_value_atomic(x) +#define trace_global_event(__l, __c, __e) \
- _trace_global_event(__l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_global_event_atomic(__l, __c, __e) \
- _trace_global_event_atomic(__l, \
__c | (__e[0] << 16) | \
(__e[1] << 8) | __e[2])
+#define trace_global_value(l, x) \
- _trace_global_value(l, x)
+#define trace_global_value_atomic(l, x) \
_trace_global_value_atomic(l, x) #endif
#else
-#define trace_event(x, e) -#define trace_error(c, e) -#define trace_value(x) -#define trace_point(x) -#define tracev_event(__c, __e) -#define tracev_value(x) +#define trace_comp_event(cd, l, x, e) +#define trace_comp_event_atomic(cd, l, c, e) +#define trace_comp_value(cd, l, x) +#define trace_comp_value_atomic(cd, l, x)
+#define trace_buf_event(cd, l, x, e) +#define trace_buf_event_atomic(cd, l, c, e) +#define trace_buf_value(cd, l, x) +#define trace_buf_value_atomic(cd, l, x)
+#define trace_pipeline_event(cd, l, x, e) +#define trace_pipeline_event_atomic(cd, l, c, e) +#define trace_pipeline_value(cd, l, x) +#define trace_pipeline_value_atomic(cd, l, x)
+#define trace_global_event(l, x, e) +#define trace_global_event_atomic(l, c, e) +#define trace_global_value(l, x) +#define trace_global_value_atomic(l, x)
#endif
diff --git a/src/lib/trace.c b/src/lib/trace.c index 0c37858..c522330 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -35,6 +35,9 @@ #include <platform/timer.h> #include <sof/lock.h> #include <sof/dma-trace.h> +#include <sof/audio/component.h> +#include <sof/audio/buffer.h> +#include <sof/audio/pipeline.h> #include <stdint.h>
struct trace { @@ -136,6 +139,104 @@ void _trace_event_mbox_atomic(uint32_t event) dcache_writeback_region((void *)t, sizeof(uint64_t) * 2); }
+#define DEFINE_MODULE_TRACE_FUNCTION(NAME, MODULE) \ +inline void _trace_##NAME##_event(struct MODULE *m, \
uint32_t level, uint32_t event) \
+{ \
- if (m && m->trace_level < level) \
return; \
- _trace_event(event); \
+} \ +inline void _trace_##NAME##_event_atomic(struct MODULE *m, \
uint32_t level, uint32_t
event) \ +{ \
- if (m && m->trace_level < level) \
return; \
- _trace_event_atomic(event); \
+} \ +inline void _trace_##NAME##_event_mbox(struct MODULE *m, \
uint32_t level, uint32_t
event) \ +{ \
- if (m && m->trace_level < level) \
return; \
- _trace_event_mbox(event); \
+} \ +inline void _trace_##NAME##_event_mbox_atomic(struct MODULE *m, \
uint32_t level,
uint32_t event) \ +{ \
- if (m && m->trace_level < level) \
return; \
- _trace_event_mbox_atomic(event); \
+}
+DEFINE_MODULE_TRACE_FUNCTION(comp, comp_dev) +DEFINE_MODULE_TRACE_FUNCTION(buf, comp_buffer) +DEFINE_MODULE_TRACE_FUNCTION(pipe, pipeline)
+inline void _trace_global_event(uint32_t level, uint32_t event) +{
- if (get_global_class_trace_level(event) < level)
return;
- _trace_event(event);
+}
+inline void _trace_global_event_atomic(uint32_t level, uint32_t event) +{
- if (get_global_class_trace_level(event) < level)
return;
- _trace_event_atomic(event);
+}
+inline void _trace_global_event_mbox(uint32_t level, uint32_t event) +{
- if (get_global_class_trace_level(event) < level)
return;
- _trace_event_mbox(event);
+}
+inline void _trace_global_event_mbox_atomic(uint32_t level, uint32_t event) +{
- if (get_global_class_trace_level(event) < level)
return;
- _trace_event_mbox_atomic(event);
+}
+inline void _trace_global_value(uint32_t level, uint32_t value) +{
- if (get_global_value_trace_level() < level)
return;
- _trace_event(value);
+}
+inline void _trace_global_value_atomic(uint32_t level, uint32_t value) +{
- if (get_global_value_trace_level() < level)
return;
- _trace_event_atomic(value);
+}
+inline void _trace_global_value_mbox(uint32_t level, uint32_t value) +{
- if (get_global_value_trace_level() < level)
return;
- _trace_event_mbox(value);
+}
+inline void _trace_global_value_mbox_atomic(uint32_t level, uint32_t value) +{
- if (get_global_value_trace_level() < level)
return;
- _trace_event_mbox_atomic(value);
+}
- void trace_flush(void) { volatile uint64_t *t;
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
From: Yan Wang yan.wang@linux.intel.com
It will use DMA trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/lib/dma-trace.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 8295f3e..bcae857 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -40,6 +40,18 @@ #include <sof/lock.h> #include <stdint.h>
+/* tracing */ +#define trace_dma(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_DMA, __e) +#define tracev_dma(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_DMA, __e) +#define trace_dma_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_DMA, __e) +#define trace_dma_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_dma_error_value(x) \ + trace_global_value(ERROR_LEVEL, x) + static struct dma_trace_data *trace_data = NULL;
static uint64_t trace_work(void *data, uint64_t delay) @@ -109,7 +121,7 @@ static uint64_t trace_work(void *data, uint64_t delay) size = dma_copy_to_host_nowait(&d->dc, config, d->host_offset, buffer->r_ptr, size); if (size < 0) { - trace_buffer_error("ebb"); + trace_dma_error("ebb"); goto out; }
@@ -153,7 +165,7 @@ int dma_trace_init_early(struct sof *sof) SOF_MEM_CAPS_RAM | SOF_MEM_CAPS_DMA, DMA_TRACE_LOCAL_SIZE); if (buffer->addr == NULL) { - trace_buffer_error("ebm"); + trace_dma_error("ebm"); return -ENOMEM; }
@@ -177,12 +189,12 @@ int dma_trace_init_complete(struct dma_trace_data *d) struct dma_trace_buf *buffer = &d->dmatb; int ret;
- trace_buffer("dtn"); + trace_dma("dtn");
/* init DMA copy context */ ret = dma_copy_new(&d->dc, PLATFORM_TRACE_DMAC); if (ret < 0) { - trace_buffer_error("edm"); + trace_dma_error("edm"); rfree(buffer->addr); return ret; } @@ -294,7 +306,7 @@ int dma_trace_enable(struct dma_trace_data *d)
/* validate DMA context */ if (d->dc.dmac == NULL || d->dc.chan < 0) { - trace_error_atomic(TRACE_CLASS_BUFFER, "eem"); + trace_dma_error("eem"); return -ENODEV; }
From: Yan Wang yan.wang@linux.intel.com
It will use DMA trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/ipc/dma-copy.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/ipc/dma-copy.c b/src/ipc/dma-copy.c index be72eb8..2bdc218 100644 --- a/src/ipc/dma-copy.c +++ b/src/ipc/dma-copy.c @@ -40,9 +40,16 @@ #include <platform/dma.h>
/* tracing */ -#define trace_dma(__e) trace_event(TRACE_CLASS_DMA, __e) -#define trace_dma_error(__e) trace_error(TRACE_CLASS_DMA, __e) -#define tracev_dma(__e) tracev_event(TRACE_CLASS_DMA, __e) +#define trace_dma(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_DMA, __e) +#define tracev_dma(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_DMA, __e) +#define trace_dma_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_DMA, __e) +#define trace_dma_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_dma_error_value(x) \ + trace_global_value(ERROR_LEVEL, x)
static struct dma_sg_elem *sg_get_elem_at(struct dma_sg_config *host_sg, int32_t *offset)
From: Yan Wang yan.wang@linux.intel.com
It will use MEM trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/lib/alloc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/lib/alloc.c b/src/lib/alloc.c index 3ca14c3..a3ecc34 100644 --- a/src/lib/alloc.c +++ b/src/lib/alloc.c @@ -48,12 +48,22 @@
/* memory tracing support */ #if DEBUG_BLOCK_ALLOC || DEBUG_BLOCK_FREE -#define trace_mem(__e) trace_event(TRACE_CLASS_MEM, __e) +#define trace_mem(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_MEM, __e) +#define tracev_mem(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_MEM, __e) +#define trace_mem_value(x) \ + trace_global_value(NORMAL_LEVEL, x) #else #define trace_mem(__e) +#define tracev_mem(__e) +#define trace_mem_value(__e) #endif
-#define trace_mem_error(__e) trace_error(TRACE_CLASS_MEM, __e) +#define trace_mem_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_MEM, __e) +#define trace_mem_error_value(x) \ + trace_global_value(ERROR_LEVEL, x)
extern struct mm memmap;
@@ -378,8 +388,8 @@ find:
error: trace_mem_error("eMm"); - trace_error_value(bytes); - trace_error_value(caps); + trace_mem_error_value(bytes); + trace_mem_error_value(caps); return NULL; }
From: Yan Wang yan.wang@linux.intel.com
It will use SA trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/lib/agent.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/lib/agent.c b/src/lib/agent.c index b672f23..b1a4366 100644 --- a/src/lib/agent.c +++ b/src/lib/agent.c @@ -45,8 +45,16 @@ #include <platform/platform.h> #include <platform/clk.h>
-#define trace_sa(__e) trace_event_atomic(TRACE_CLASS_SA, __e) -#define trace_sa_value(__e) trace_value_atomic(__e) +#define trace_sa(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_SA, __e) +#define tracev_sa(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_SA, __e) +#define trace_sa_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_SA, __e) +#define trace_sa_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_sa_error_value(x) \ + trace_global_value(ERROR_LEVEL, x)
/* * Notify the SA that we are about to enter idle state (WFI).
From: Yan Wang yan.wang@linux.intel.com
It will use SCH trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/include/sof/schedule.h | 10 ++++++++++ src/lib/schedule.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/src/include/sof/schedule.h b/src/include/sof/schedule.h index 7e5b3b2..b4b4b31 100644 --- a/src/include/sof/schedule.h +++ b/src/include/sof/schedule.h @@ -55,6 +55,16 @@ struct sof; #define TASK_PRI_MED 0 #define TASK_PRI_HIGH -20
+#define trace_sch(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_SCH, __e) +#define tracev_sch(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_SCH, __e) +#define trace_sch_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_SCH, __e) +#define trace_sch_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_sch_error_value(x) \ + trace_global_value(ERROR_LEVEL, x)
/* task descriptor */ struct task { diff --git a/src/lib/schedule.c b/src/lib/schedule.c index b98934d..6ed7c32 100644 --- a/src/lib/schedule.c +++ b/src/lib/schedule.c @@ -138,7 +138,7 @@ static inline struct task *edf_get_next(uint64_t current,
} else { /* missed scheduling - will be rescheduled */ - trace_pipe("ed!"); + trace_sch("ed!");
/* have we already tried to rescheule ? */ if (reschedule++) @@ -158,7 +158,7 @@ static inline struct task *edf_get_next(uint64_t current, /* work set in the future when next task can be scheduled */ static uint64_t sch_work(void *data, uint64_t delay) { - tracev_pipe("wrk"); + tracev_sch("wrk"); schedule(); return 0; } @@ -175,7 +175,7 @@ static struct task *schedule_edf(void) struct task *future_task = NULL; uint64_t current;
- tracev_pipe("edf"); + tracev_sch("edf");
/* get the current time */ current = platform_timer_get(platform_timer); @@ -211,7 +211,7 @@ static int schedule_task_del(struct task *task) uint32_t flags; int ret = 0;
- tracev_pipe("del"); + tracev_sch("del");
/* add task to list */ spin_lock_irq(&sch->lock, flags); @@ -237,13 +237,13 @@ static int _schedule_task(struct task *task, uint64_t start, uint64_t deadline) uint32_t flags; uint64_t current;
- tracev_pipe("ad!"); + tracev_sch("ad!");
spin_lock_irq(&sch->lock, flags);
/* is task already running ? - not enough MIPS to complete ? */ if (task->state == TASK_STATE_RUNNING) { - trace_pipe("tsk"); + trace_sch("tsk"); spin_unlock_irq(&sch->lock, flags); return 0; } @@ -307,7 +307,7 @@ void schedule_task_complete(struct task *task) { uint32_t flags;
- tracev_pipe("com"); + tracev_sch("com");
spin_lock_irq(&sch->lock, flags); list_item_del(&task->list); @@ -319,7 +319,7 @@ static void scheduler_run(void *unused) { struct task *future_task;
- tracev_pipe("run"); + tracev_sch("run");
/* EDF is only scheduler supported atm */ future_task = schedule_edf(); @@ -334,7 +334,7 @@ void schedule(void) struct task *task; uint32_t flags;
- tracev_pipe("sch"); + tracev_sch("sch");
spin_lock_irq(&sch->lock, flags);
@@ -367,7 +367,7 @@ schedule: /* Initialise the scheduler */ int scheduler_init(struct sof *sof) { - trace_pipe("ScI"); + trace_sch("ScI");
sch = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*sch)); list_init(&sch->list);
From: Yan Wang yan.wang@linux.intel.com
It will use WAIT trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/include/sof/wait.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/include/sof/wait.h b/src/include/sof/wait.h index b7725b8..a9f75b5 100644 --- a/src/include/sof/wait.h +++ b/src/include/sof/wait.h @@ -44,10 +44,21 @@ #include <sof/lock.h> #include <platform/interrupt.h>
+#define trace_wait(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_WAIT, __e) +#define tracev_wait(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_WAIT, __e) +#define trace_wait_error(__e) \ + trace_global_event_atomic(ERROR_LEVEL, TRACE_CLASS_WAIT, __e) +#define trace_wait_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_wait_error_value(x) \ + trace_global_value_atomic(ERROR_LEVEL, x) + #if DEBUG_LOCKS #define wait_atomic_check \ if (lock_dbg_atomic) { \ - trace_error_atomic(TRACE_CLASS_WAIT, "atm"); \ + trace_wait_error("atm"); \ } #else #define wait_atomic_check @@ -63,10 +74,10 @@ void arch_wait_for_interrupt(int level);
static inline void wait_for_interrupt(int level) { - tracev_event(TRACE_CLASS_WAIT, "WFE"); + tracev_wait("WFE"); wait_atomic_check; arch_wait_for_interrupt(level); - tracev_event(TRACE_CLASS_WAIT, "WFX"); + tracev_wait("WFX"); }
static uint64_t _wait_cb(void *data, uint64_t delay) @@ -139,8 +150,8 @@ static inline int wait_for_completion_timeout(completion_t *comp) return 0; } else { /* timeout */ - trace_error_value(c->timeout); - trace_error_value(c->complete); + trace_wait_error_value(c->timeout); + trace_wait_error_value(c->complete); return -ETIME; } }
From: Yan Wang yan.wang@linux.intel.com
It will use SSP trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/drivers/apl-ssp.c | 29 ++++++++++++----------------- src/drivers/byt-ssp.c | 7 +------ src/include/sof/ssp.h | 14 ++++++++++---- 3 files changed, 23 insertions(+), 27 deletions(-)
diff --git a/src/drivers/apl-ssp.c b/src/drivers/apl-ssp.c index a51f91c..2736171 100644 --- a/src/drivers/apl-ssp.c +++ b/src/drivers/apl-ssp.c @@ -38,11 +38,6 @@ #include <sof/interrupt.h> #include <config.h>
-/* tracing */ -#define trace_ssp(__e) trace_event(TRACE_CLASS_SSP, __e) -#define trace_ssp_error(__e) trace_error(TRACE_CLASS_SSP, __e) -#define tracev_ssp(__e) tracev_event(TRACE_CLASS_SSP, __e) - /* FIXME: move this to a helper and optimize */ static int hweight_32(uint32_t mask) { @@ -177,7 +172,7 @@ static inline int ssp_set_config(struct dai *dai, /* clock masters */ sscr1 &= ~SSCR1_SFRMDIR;
- trace_value(config->format); + trace_ssp_value(config->format); switch (config->format & SOF_DAI_FMT_MASTER_MASK) { case SOF_DAI_FMT_CBM_CFM: sscr0 |= SSCR0_ECS; /* external clock used */ @@ -529,16 +524,16 @@ static inline int ssp_set_config(struct dai *dai, ssp_write(dai, SSTSA, sstsa); ssp_write(dai, SSRSA, ssrsa);
- trace_value(sscr0); - trace_value(sscr1); - trace_value(ssto); - trace_value(sspsp); - trace_value(sstsa); - trace_value(ssrsa); - trace_value(sscr2); - trace_value(sspsp2); - trace_value(sscr3); - trace_value(ssioc); + trace_ssp_value(sscr0); + trace_ssp_value(sscr1); + trace_ssp_value(ssto); + trace_ssp_value(sspsp); + trace_ssp_value(sstsa); + trace_ssp_value(ssrsa); + trace_ssp_value(sscr2); + trace_ssp_value(sspsp2); + trace_ssp_value(sscr3); + trace_ssp_value(ssioc);
/* TODO: move this into M/N driver */ mn_reg_write(0x0, mdivc); @@ -672,7 +667,7 @@ static void ssp_irq_handler(void *data) struct dai *dai = data;
trace_ssp("irq"); - trace_value(ssp_read(dai, SSSR)); + trace_ssp_value(ssp_read(dai, SSSR));
/* clear IRQ */ ssp_write(dai, SSSR, ssp_read(dai, SSSR)); diff --git a/src/drivers/byt-ssp.c b/src/drivers/byt-ssp.c index ca3385d..a3cce24 100644 --- a/src/drivers/byt-ssp.c +++ b/src/drivers/byt-ssp.c @@ -36,11 +36,6 @@ #include <sof/alloc.h> #include <sof/interrupt.h>
-/* tracing */ -#define trace_ssp(__e) trace_event(TRACE_CLASS_SSP, __e) -#define trace_ssp_error(__e) trace_error(TRACE_CLASS_SSP, __e) -#define tracev_ssp(__e) tracev_event(TRACE_CLASS_SSP, __e) - /* FIXME: move this to a helper and optimize */ static int hweight_32(uint32_t mask) { @@ -578,7 +573,7 @@ static void ssp_irq_handler(void *data) struct dai *dai = data;
trace_ssp("irq"); - trace_value(ssp_read(dai, SSSR)); + trace_ssp_value(ssp_read(dai, SSSR));
/* clear IRQ */ ssp_write(dai, SSSR, ssp_read(dai, SSSR)); diff --git a/src/include/sof/ssp.h b/src/include/sof/ssp.h index 5a57d58..6fdb95d 100644 --- a/src/include/sof/ssp.h +++ b/src/include/sof/ssp.h @@ -218,10 +218,16 @@ extern const struct dai_ops ssp_ops; #endif
/* tracing */ -#define trace_ssp(__e) trace_event(TRACE_CLASS_SSP, __e) -#define trace_ssp_error(__e) trace_error(TRACE_CLASS_SSP, __e) -#define tracev_ssp(__e) tracev_event(TRACE_CLASS_SSP, __e) - +#define trace_ssp(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_SSP, __e) +#define tracev_ssp(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_SSP, __e) +#define trace_ssp_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_SSP, __e) +#define trace_ssp_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_ssp_error_value(x) \ + trace_global_value(ERROR_LEVEL, x)
#define ssp_irq(ssp) \ ssp->plat_data.irq
From: Yan Wang yan.wang@linux.intel.com
It will use DMA trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/drivers/dw-dma.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c index e0fbc5f..e236463 100644 --- a/src/drivers/dw-dma.c +++ b/src/drivers/dw-dma.c @@ -232,9 +232,16 @@ #endif
/* tracing */ -#define trace_dma(__e) trace_event(TRACE_CLASS_DMA, __e) -#define trace_dma_error(__e) trace_error(TRACE_CLASS_DMA, __e) -#define tracev_dma(__e) tracev_event(TRACE_CLASS_DMA, __e) +#define trace_dma(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_DMA, __e) +#define tracev_dma(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_DMA, __e) +#define trace_dma_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_DMA, __e) +#define trace_dma_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_dma_error_value(x) \ + trace_global_value(ERROR_LEVEL, x)
/* HW Linked list support, only enabled for APL/CNL at the moment */ #if defined CONFIG_APOLLOLAKE || defined CONFIG_CANNONLAKE @@ -374,9 +381,9 @@ static int dw_dma_start(struct dma *dma, int channel) (dw_read(dma, DW_DMA_CHAN_EN) & (0x1 << channel))) { ret = -EBUSY; trace_dma_error("eS0"); - trace_error_value(dw_read(dma, DW_DMA_CHAN_EN)); - trace_error_value(dw_read(dma, DW_CFG_LOW(channel))); - trace_error_value(p->chan[channel].status); + trace_dma_error_value(dw_read(dma, DW_DMA_CHAN_EN)); + trace_dma_error_value(dw_read(dma, DW_CFG_LOW(channel))); + trace_dma_error_value(p->chan[channel].status); goto out; }
@@ -484,7 +491,7 @@ static int dw_dma_stop(struct dma *dma, int channel) /* is channel stii active ? */ if ((dw_read(dma, DW_DMA_CHAN_EN) & (0x1 << channel))) { trace_dma_error("ea0"); - trace_error_value(channel); + trace_dma_error_value(channel); }
p->chan[channel].status = COMP_STATE_PREPARE; @@ -916,7 +923,7 @@ static void dw_dma_irq_handler(void *data) status_intr = dw_read(dma, DW_INTR_STATUS); if (!status_intr) { trace_dma_error("eDI"); - trace_error_value(status_intr); + trace_dma_error_value(status_intr); }
tracev_dma("irq"); @@ -1082,7 +1089,7 @@ static void dw_dma_irq_handler(void *data) status_block_new = dw_read(dma, DW_STATUS_BLOCK); if (status_block_new) { trace_dma_error("eI2"); - trace_error_value(status_block_new); + trace_dma_error_value(status_block_new); }
for (i = 0; i < DW_MAX_CHAN; i++) {
From: Yan Wang yan.wang@linux.intel.com
It will use DMA trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/drivers/hda-dma.c | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/src/drivers/hda-dma.c b/src/drivers/hda-dma.c index 97ea0ef..f159758 100644 --- a/src/drivers/hda-dma.c +++ b/src/drivers/hda-dma.c @@ -46,10 +46,6 @@ #include <arch/cache.h> #include <uapi/ipc.h>
-#define trace_host(__e) trace_event(TRACE_CLASS_HOST, __e) -#define tracev_host(__e) tracev_event(TRACE_CLASS_HOST, __e) -#define trace_host_error(__e) trace_error(TRACE_CLASS_HOST, __e) - /* Gateway Stream Registers */ #define DGCS 0x00 #define DGBBA 0x04 @@ -79,6 +75,18 @@
#define HDA_DMA_MAX_CHANS 9
+/* tracing */ +#define trace_dma(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_DMA, __e) +#define tracev_dma(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_DMA, __e) +#define trace_dma_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_DMA, __e) +#define trace_dma_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_dma_error_value(x) \ + trace_global_value(ERROR_LEVEL, x) + struct hda_chan_data { uint32_t stream_id; uint32_t status; @@ -114,7 +122,7 @@ static inline void hda_update_bits(struct dma *dma, uint32_t chan, /* notify DMA to copy bytes */ static int hda_dma_copy(struct dma *dma, int channel, int bytes) { - tracev_host("GwU"); + tracev_dma("GwU");
/* reset BSC before start next copy */ hda_update_bits(dma, channel, DGCS, DGCS_BSC, DGCS_BSC); @@ -139,7 +147,7 @@ static int hda_dma_channel_get(struct dma *dma, int channel)
spin_lock_irq(&dma->lock, flags);
- trace_host("Dgt"); + trace_dma("Dgt");
/* use channel if it's free */ if (p->chan[channel].status == COMP_STATE_INIT) { @@ -152,7 +160,7 @@ static int hda_dma_channel_get(struct dma *dma, int channel)
/* DMAC has no free channels */ spin_unlock_irq(&dma->lock, flags); - trace_host_error("eG0"); + trace_dma_error("eG0"); return -ENODEV; }
@@ -184,16 +192,16 @@ static int hda_dma_start(struct dma *dma, int channel)
spin_lock_irq(&dma->lock, flags);
- trace_host("DEn"); + trace_dma("DEn");
/* is channel idle, disabled and ready ? */ dgcs = host_dma_reg_read(dma, channel, DGCS); if (p->chan[channel].status != COMP_STATE_PREPARE || (dgcs & DGCS_GEN)) { ret = -EBUSY; - trace_host_error("eS0"); - trace_error_value(dgcs); - trace_error_value(p->chan[channel].status); + trace_dma_error("eS0"); + trace_dma_error_value(dgcs); + trace_dma_error_value(p->chan[channel].status); goto out; }
@@ -215,7 +223,7 @@ static int hda_dma_release(struct dma *dma, int channel)
spin_lock_irq(&dma->lock, flags);
- trace_host("Dpr"); + trace_dma("Dpr");
/* resume and reload DMA */ p->chan[channel].status = COMP_STATE_ACTIVE; @@ -231,7 +239,7 @@ static int hda_dma_pause(struct dma *dma, int channel)
spin_lock_irq(&dma->lock, flags);
- trace_host("Dpa"); + trace_dma("Dpa");
if (p->chan[channel].status != COMP_STATE_ACTIVE) goto out; @@ -251,7 +259,7 @@ static int hda_dma_stop(struct dma *dma, int channel)
spin_lock_irq(&dma->lock, flags);
- trace_host("DDi"); + trace_dma("DDi");
/* disable the channel */ hda_update_bits(dma, channel, DGCS, DGCS_GEN | DGCS_FIFORDY, 0); @@ -293,14 +301,14 @@ static int hda_dma_set_config(struct dma *dma, int channel,
spin_lock_irq(&dma->lock, flags);
- trace_host("Dsc"); + trace_dma("Dsc");
/* get number of SG elems */ list_for_item(plist, &config->elem_list) desc_count++;
if (desc_count == 0) { - trace_host_error("eD1"); + trace_dma_error("eD1"); ret = -EINVAL; goto out; } @@ -320,14 +328,14 @@ static int hda_dma_set_config(struct dma *dma, int channel,
/* make sure elem is continuous */ if (buffer_addr && (buffer_addr + buffer_bytes) != addr) { - trace_host_error("eD2"); + trace_dma_error("eD2"); ret = -EINVAL; goto out; }
/* make sure period_bytes are constant */ if (period_bytes && period_bytes != sg_elem->size) { - trace_host_error("eD3"); + trace_dma_error("eD3"); ret = -EINVAL; goto out; }
From: Yan Wang yan.wang@linux.intel.com
It will use IRQ trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/include/sof/interrupt.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/include/sof/interrupt.h b/src/include/sof/interrupt.h index 2dc8954..a88ade3 100644 --- a/src/include/sof/interrupt.h +++ b/src/include/sof/interrupt.h @@ -38,8 +38,16 @@ #include <sof/debug.h> #include <sof/lock.h>
-#define trace_irq(__e) trace_event(TRACE_CLASS_IRQ, __e) -#define trace_irq_error(__e) trace_error(TRACE_CLASS_IRQ, __e) +#define trace_irq(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_IRQ, __e) +#define tracev_irq(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_IRQ, __e) +#define trace_irq_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_IRQ, __e) +#define trace_irq_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_irq_error_value(x) \ + trace_global_value(ERROR_LEVEL, x)
/* child interrupt source */ struct irq_child {
From: Yan Wang yan.wang@linux.intel.com
It will use COMP trace class and component DMA trace API. For trace calling of comp_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/component.c | 30 +++++++++++++++--------------- src/include/sof/audio/component.h | 31 +++++++++++++++++++------------ 2 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/src/audio/component.c b/src/audio/component.c index 15760b2..8684d87 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -78,15 +78,15 @@ struct comp_dev *comp_new(struct sof_ipc_comp *comp) /* find the driver for our new component */ drv = get_drv(comp->type); if (drv == NULL) { - trace_comp_error("eCD"); - trace_error_value(comp->type); + trace_comp_error(NULL, "eCD"); + trace_comp_val(NULL, comp->type); return NULL; }
/* create the new component */ cdev = drv->ops.new(comp); if (cdev == NULL) { - trace_comp_error("eCN"); + trace_comp_error(NULL, "eCN"); return NULL; }
@@ -127,8 +127,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) dev->state == COMP_STATE_PAUSED) { dev->state = COMP_STATE_ACTIVE; } else { - trace_comp_error("CES"); - trace_error_value(dev->state); + trace_comp_error(dev, "CES"); + trace_comp_val(dev, dev->state); ret = -EINVAL; } break; @@ -136,8 +136,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) if (dev->state == COMP_STATE_PAUSED) { dev->state = COMP_STATE_ACTIVE; } else { - trace_comp_error("CEr"); - trace_error_value(dev->state); + trace_comp_error(dev, "CEr"); + trace_comp_val(dev, dev->state); ret = -EINVAL; } break; @@ -146,8 +146,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) if (dev->state == COMP_STATE_ACTIVE) { dev->state = COMP_STATE_PREPARE; } else { - trace_comp_error("CEs"); - trace_error_value(dev->state); + trace_comp_error(dev, "CEs"); + trace_comp_val(dev, dev->state); ret = -EINVAL; } break; @@ -156,8 +156,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) if (dev->state == COMP_STATE_ACTIVE) dev->state = COMP_STATE_PAUSED; else { - trace_comp_error("CEp"); - trace_error_value(dev->state); + trace_comp_error(dev, "CEp"); + trace_comp_val(dev, dev->state); ret = -EINVAL; } break; @@ -166,8 +166,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) dev->state = COMP_STATE_READY; if (dev->state == COMP_STATE_ACTIVE || dev->state == COMP_STATE_PAUSED) { - trace_comp_error("CER"); - trace_error_value(dev->state); + trace_comp_error(dev, "CER"); + trace_comp_val(dev, dev->state); ret = 0; } break; @@ -176,8 +176,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) dev->state == COMP_STATE_READY) { dev->state = COMP_STATE_PREPARE; } else { - trace_comp_error("CEP"); - trace_error_value(dev->state); + trace_comp_error(dev, "CEP"); + trace_comp_val(dev, dev->state); ret = -EINVAL; } break; diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 80a72d9..daf0aa7 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -107,9 +107,16 @@ #define COMP_OPS_BUFFER 4 #define COMP_OPS_RESET 5
-#define trace_comp(__e) trace_event(TRACE_CLASS_COMP, __e) -#define trace_comp_error(__e) trace_error(TRACE_CLASS_COMP, __e) -#define tracev_comp(__e) tracev_event(TRACE_CLASS_COMP, __e) +#define trace_comp(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_COMP, __e) +#define tracev_comp(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_COMP, __e) +#define trace_comp_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_COMP, __e) +#define trace_comp_val(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define trace_comp_error_val(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
struct comp_dev; struct comp_buffer; @@ -256,9 +263,9 @@ static inline int comp_cmd(struct comp_dev *dev, int cmd, void *data) if ((cmd == COMP_CMD_SET_DATA) && ((cdata->data->magic != SOF_ABI_MAGIC) || (cdata->data->abi != SOF_ABI_VERSION))) { - trace_comp_error("abi"); - trace_error_value(cdata->data->magic); - trace_error_value(cdata->data->abi); + trace_comp_error(dev, "abi"); + trace_comp_error_val(dev, cdata->data->magic); + trace_comp_error_val(dev, cdata->data->abi); return -EINVAL; }
@@ -367,9 +374,9 @@ static inline uint32_t comp_sample_bytes(struct comp_dev *dev) static inline void comp_underrun(struct comp_dev *dev, struct comp_buffer *source, uint32_t copy_bytes, uint32_t min_bytes) { - trace_comp("Xun"); - trace_value((dev->comp.id << 16) | source->avail); - trace_value((min_bytes << 16) | copy_bytes); + trace_comp(dev, "Xun"); + trace_comp_val(dev, (dev->comp.id << 16) | source->avail); + trace_comp_val(dev, (min_bytes << 16) | copy_bytes);
pipeline_xrun(dev->pipeline, dev, (int32_t)source->avail - copy_bytes); } @@ -377,9 +384,9 @@ static inline void comp_underrun(struct comp_dev *dev, struct comp_buffer *sourc static inline void comp_overrun(struct comp_dev *dev, struct comp_buffer *sink, uint32_t copy_bytes, uint32_t min_bytes) { - trace_comp("Xov"); - trace_value((dev->comp.id << 16) | sink->free); - trace_value((min_bytes << 16) | copy_bytes); + trace_comp(dev, "Xov"); + trace_comp_val(dev, (dev->comp.id << 16) | sink->free); + trace_comp_val(dev, (min_bytes << 16) | copy_bytes);
pipeline_xrun(dev->pipeline, dev, (int32_t)copy_bytes - sink->free); }
From: Yan Wang yan.wang@linux.intel.com
It will use BUFFER trace class and component DMA trace API. For trace calling of buffer_new(), NULL will be passed into trace API because buffer_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/buffer.c | 12 ++++++------ src/include/sof/audio/buffer.h | 38 +++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/src/audio/buffer.c b/src/audio/buffer.c index 6aeb6a4..50e57dc 100644 --- a/src/audio/buffer.c +++ b/src/audio/buffer.c @@ -50,26 +50,26 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc) { struct comp_buffer *buffer;
- trace_buffer("new"); + trace_buffer(NULL, "new");
/* validate request */ if (desc->size == 0 || desc->size > HEAP_BUFFER_SIZE) { - trace_buffer_error("ebg"); - trace_error_value(desc->size); + trace_buffer_error(NULL, "ebg"); + trace_buffer_value(NULL, desc->size); return NULL; }
/* allocate new buffer */ buffer = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*buffer)); if (buffer == NULL) { - trace_buffer_error("ebN"); + trace_buffer_error(NULL, "ebN"); return NULL; }
buffer->addr = rballoc(RZONE_RUNTIME, desc->caps, desc->size); if (buffer->addr == NULL) { rfree(buffer); - trace_buffer_error("ebm"); + trace_buffer_error(NULL, "ebm"); return NULL; }
@@ -93,7 +93,7 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc) /* free component in the pipeline */ void buffer_free(struct comp_buffer *buffer) { - trace_buffer("BFr"); + trace_buffer(buffer, "BFr");
list_item_del(&buffer->source_list); list_item_del(&buffer->sink_list); diff --git a/src/include/sof/audio/buffer.h b/src/include/sof/audio/buffer.h index 171f0a4..6109e93 100644 --- a/src/include/sof/audio/buffer.h +++ b/src/include/sof/audio/buffer.h @@ -43,9 +43,18 @@ #include <uapi/ipc.h>
/* pipeline tracing */ -#define trace_buffer(__e) trace_event(TRACE_CLASS_BUFFER, __e) -#define trace_buffer_error(__e) trace_error(TRACE_CLASS_BUFFER, __e) -#define tracev_buffer(__e) tracev_event(TRACE_CLASS_BUFFER, __e) +#define trace_buffer(cb, __e) \ + trace_buf_event(cb, NORMAL_LEVEL, TRACE_CLASS_BUFFER, __e) +#define tracev_buffer(cb, __e) \ + trace_buf_event(cb, VERBOSE_LEVEL, TRACE_CLASS_BUFFER, __e) +#define trace_buffer_error(cb, __e) \ + trace_buf_event_atomic(cb, ERROR_LEVEL, TRACE_CLASS_BUFFER, __e) +#define trace_buffer_value(cb, x) \ + trace_buf_value(cb, NORMAL_LEVEL, x) +#define tracev_buffer_value(cb, x) \ + trace_buf_value(cb, VERBOSE_LEVEL, x) +#define trace_buffer_error_value(cb, x) \ + trace_buf_value_atomic(cb, ERROR_LEVEL, x)
/* audio component buffer - connects 2 audio components together in pipeline */ struct comp_buffer { @@ -109,10 +118,14 @@ static inline void comp_update_buffer_produce(struct comp_buffer *buffer,
spin_unlock_irq(&buffer->lock, flags);
- tracev_buffer("pro"); - tracev_value((buffer->avail << 16) | buffer->free); - tracev_value((buffer->ipc_buffer.comp.id << 16) | buffer->size); - tracev_value((buffer->r_ptr - buffer->addr) << 16 | (buffer->w_ptr - buffer->addr)); + tracev_buffer(buffer, "pro"); + tracev_buffer_value(buffer, + (buffer->avail << 16) | buffer->free); + tracev_buffer_value(buffer, + (buffer->ipc_buffer.comp.id << 16) | buffer->size); + tracev_buffer_value(buffer, + (buffer->r_ptr - buffer->addr) << 16 | + (buffer->w_ptr - buffer->addr)); }
/* called by a component after consuming data from this buffer */ @@ -142,10 +155,13 @@ static inline void comp_update_buffer_consume(struct comp_buffer *buffer,
spin_unlock_irq(&buffer->lock, flags);
- tracev_buffer("con"); - tracev_value((buffer->avail << 16) | buffer->free); - tracev_value((buffer->ipc_buffer.comp.id << 16) | buffer->size); - tracev_value((buffer->r_ptr - buffer->addr) << 16 | (buffer->w_ptr - buffer->addr)); + tracev_buffer(buffer, "con"); + tracev_buffer_value(buffer, (buffer->avail << 16) | buffer->free); + tracev_buffer_value(buffer, + (buffer->ipc_buffer.comp.id << 16) | buffer->size); + tracev_buffer_value(buffer, + (buffer->r_ptr - buffer->addr) << 16 | + (buffer->w_ptr - buffer->addr)); }
/* get the max number of bytes that can be copied between sink and source */
From: Yan Wang yan.wang@linux.intel.com
It will use PIPE trace class and component DMA trace API. NULL will be passed into trace API when pipeline hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/pipeline.c | 190 ++++++++++++++++++++------------------- src/audio/pipeline_static.c | 2 +- src/include/sof/audio/pipeline.h | 15 +++- 3 files changed, 113 insertions(+), 94 deletions(-)
diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 0ed6b95..805a686 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -67,7 +67,7 @@ static void connect_upstream(struct pipeline *p, struct comp_dev *start, { struct list_item *clist;
- tracev_value(current->comp.id); + tracev_pipe_value(p, current->comp.id);
/* complete component init */ current->pipeline = p; @@ -107,7 +107,7 @@ static void connect_downstream(struct pipeline *p, struct comp_dev *start, { struct list_item *clist;
- tracev_value(current->comp.id); + tracev_pipe_value(p, current->comp.id);
/* complete component init */ current->pipeline = p; @@ -139,7 +139,7 @@ static void disconnect_upstream(struct pipeline *p, struct comp_dev *start, { struct list_item *clist;
- tracev_value(current->comp.id); + tracev_pipe_value(p, current->comp.id);
/* complete component init */ current->pipeline = NULL; @@ -168,7 +168,7 @@ static void disconnect_downstream(struct pipeline *p, struct comp_dev *start, { struct list_item *clist;
- tracev_value(current->comp.id); + tracev_pipe_value(p, current->comp.id);
/* complete component init */ current->pipeline = NULL; @@ -237,12 +237,12 @@ struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc, { struct pipeline *p;
- trace_pipe("new"); + trace_pipe(NULL, "new");
/* allocate new pipeline */ p = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*p)); if (p == NULL) { - trace_pipe_error("ePN"); + trace_pipe_error(NULL, "ePN"); return NULL; }
@@ -264,11 +264,11 @@ struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc, /* pipelines must be inactive */ int pipeline_free(struct pipeline *p) { - trace_pipe("fre"); + trace_pipe(p, "fre");
/* make sure we are not in use */ if (p->sched_comp->state > COMP_STATE_READY) { - trace_pipe_error("epb"); + trace_pipe_error(p, "epb"); return -EBUSY; }
@@ -290,12 +290,12 @@ int pipeline_complete(struct pipeline *p) /* now walk downstream and upstream form "start" component and complete component task and pipeline init */
- trace_pipe("com"); - trace_value(p->ipc_pipe.pipeline_id); + trace_pipe(p, "com"); + trace_pipe_value(p, p->ipc_pipe.pipeline_id);
/* check whether pipeline is already complete */ if (p->status != COMP_STATE_INIT) { - trace_pipe_error("epc"); + trace_pipe_error(p, "epc"); return -EINVAL; }
@@ -309,7 +309,7 @@ int pipeline_complete(struct pipeline *p) int pipeline_comp_connect(struct pipeline *p, struct comp_dev *source_comp, struct comp_buffer *sink_buffer) { - trace_pipe("cnc"); + trace_pipe(p, "cnc");
/* connect source to buffer */ spin_lock(&source_comp->lock); @@ -321,7 +321,7 @@ int pipeline_comp_connect(struct pipeline *p, struct comp_dev *source_comp, if (sink_buffer->source && sink_buffer->sink) sink_buffer->connected = 1;
- tracev_value((source_comp->comp.id << 16) | + tracev_pipe_value(p, (source_comp->comp.id << 16) | sink_buffer->ipc_buffer.comp.id); return 0; } @@ -330,7 +330,7 @@ int pipeline_comp_connect(struct pipeline *p, struct comp_dev *source_comp, int pipeline_buffer_connect(struct pipeline *p, struct comp_buffer *source_buffer, struct comp_dev *sink_comp) { - trace_pipe("cbc"); + trace_pipe(p, "cbc");
/* connect sink to buffer */ spin_lock(&sink_comp->lock); @@ -342,7 +342,7 @@ int pipeline_buffer_connect(struct pipeline *p, if (source_buffer->source && source_buffer->sink) source_buffer->connected = 1;
- tracev_value((source_buffer->ipc_buffer.comp.id << 16) | + tracev_pipe_value(p, (source_buffer->ipc_buffer.comp.id << 16) | sink_comp->comp.id); return 0; } @@ -352,15 +352,16 @@ int pipeline_buffer_connect(struct pipeline *p, * returning an error ( < 0) and returns immediately. Components returning a * positive error code also stop the graph walk on that branch causing the * walk to return to a shallower level in the graph. */ -static int component_op_downstream(struct op_data *op_data, - struct comp_dev *start, struct comp_dev *current, - struct comp_dev *previous) +static int component_op_downstream(struct pipeline *p, struct op_data *op_data, + struct comp_dev *start, + struct comp_dev *current, + struct comp_dev *previous) { struct list_item *clist; int err = 0;
- tracev_pipe("CO-"); - tracev_value(current->comp.id); + tracev_pipe(p, "CO-"); + tracev_pipe_value(p, current->comp.id);
/* do operation on this component */ switch (op_data->op) { @@ -392,20 +393,20 @@ static int component_op_downstream(struct op_data *op_data, break; case COMP_OPS_BUFFER: /* handled by other API call */ default: - trace_pipe_error("eOi"); - trace_error_value(op_data->op); + trace_pipe_error(p, "eOi"); + trace_pipe_error_value(p, op_data->op); return -EINVAL; }
/* don't walk the graph any further if this component fails */ if (err < 0) { - trace_pipe_error("eOp"); + trace_pipe_error(p, "eOp"); return err; } else if (err > 0 || (current != start && current->is_endpoint)) { /* we finish walking the graph if we reach the DAI or component is * currently active and configured already (err > 0). */ - tracev_pipe("C-D"); + tracev_pipe(p, "C-D"); return err; }
@@ -419,8 +420,8 @@ static int component_op_downstream(struct op_data *op_data, if (!buffer->connected) continue;
- err = component_op_downstream(op_data, start, buffer->sink, - current); + err = component_op_downstream(p, op_data, start, buffer->sink, + current); if (err < 0) break; } @@ -433,15 +434,16 @@ static int component_op_downstream(struct op_data *op_data, * returning an error ( < 0) and returns immediately. Components returning a * positive error code also stop the graph walk on that branch causing the * walk to return to a shallower level in the graph. */ -static int component_op_upstream(struct op_data *op_data, - struct comp_dev *start, struct comp_dev *current, - struct comp_dev *previous) +static int component_op_upstream(struct pipeline *p, struct op_data *op_data, + struct comp_dev *start, + struct comp_dev *current, + struct comp_dev *previous) { struct list_item *clist; int err = 0;
- tracev_pipe("CO+"); - tracev_value(current->comp.id); + tracev_pipe(p, "CO+"); + tracev_pipe_value(p, current->comp.id);
/* do operation on this component */ switch (op_data->op) { @@ -473,17 +475,17 @@ static int component_op_upstream(struct op_data *op_data, break; case COMP_OPS_BUFFER: /* handled by other API call */ default: - trace_pipe_error("eOi"); - trace_error_value(op_data->op); + trace_pipe_error(p, "eOi"); + trace_pipe_error_value(p, op_data->op); return -EINVAL; }
/* don't walk the graph any further if this component fails */ if (err < 0) { - trace_pipe_error("eOp"); + trace_pipe_error(p, "eOp"); return err; } else if (err > 0 || (current != start && current->is_endpoint)) { - tracev_pipe("C+D"); + tracev_pipe(p, "C+D"); return 0; }
@@ -497,8 +499,8 @@ static int component_op_upstream(struct op_data *op_data, if (!buffer->connected) continue;
- err = component_op_upstream(op_data, start, buffer->source, - current); + err = component_op_upstream(p, op_data, start, buffer->source, + current); if (err < 0) break; } @@ -508,8 +510,10 @@ static int component_op_upstream(struct op_data *op_data,
/* walk the graph upstream from start component in any pipeline and prepare * the buffer context for each inactive component */ -static int component_prepare_buffers_upstream(struct comp_dev *start, - struct comp_dev *current, struct comp_buffer *buffer) +static int component_prepare_buffers_upstream(struct pipeline *p, + struct comp_dev *start, + struct comp_dev *current, + struct comp_buffer *buffer) { struct list_item *clist; int err = 0; @@ -534,10 +538,11 @@ static int component_prepare_buffers_upstream(struct comp_dev *start, continue;
/* continue downstream */ - err = component_prepare_buffers_upstream(start, buffer->source, - buffer); + err = component_prepare_buffers_upstream(p, start, + buffer->source, + buffer); if (err < 0) { - trace_pipe_error("eBD"); + trace_pipe_error(p, "eBD"); break; } } @@ -548,8 +553,10 @@ static int component_prepare_buffers_upstream(struct comp_dev *start,
/* walk the graph downstream from start component in any pipeline and prepare * the buffer context for each inactive component */ -static int component_prepare_buffers_downstream(struct comp_dev *start, - struct comp_dev *current, struct comp_buffer *buffer) +static int component_prepare_buffers_downstream(struct pipeline *p, + struct comp_dev *start, + struct comp_dev *current, + struct comp_buffer *buffer) { struct list_item *clist; int err = 0; @@ -574,10 +581,11 @@ static int component_prepare_buffers_downstream(struct comp_dev *start, continue;
/* continue downstream */ - err = component_prepare_buffers_downstream(start, buffer->sink, - buffer); + err = component_prepare_buffers_downstream(p, start, + buffer->sink, + buffer); if (err < 0) { - trace_pipe_error("eBD"); + trace_pipe_error(p, "eBD"); break; } } @@ -592,7 +600,7 @@ int pipeline_prepare(struct pipeline *p, struct comp_dev *dev) struct op_data op_data; int ret = -1;
- trace_pipe("pre"); + trace_pipe(p, "pre");
op_data.p = p; op_data.op = COMP_OPS_PREPARE; @@ -602,19 +610,19 @@ int pipeline_prepare(struct pipeline *p, struct comp_dev *dev) /* playback pipelines can be preloaded from host before trigger */ if (dev->params.direction == SOF_IPC_STREAM_PLAYBACK) {
- ret = component_op_downstream(&op_data, dev, dev, NULL); + ret = component_op_downstream(p, &op_data, dev, dev, NULL); if (ret < 0) goto out;
/* set up reader and writer positions */ - component_prepare_buffers_downstream(dev, dev, NULL); + component_prepare_buffers_downstream(p, dev, dev, NULL); } else { - ret = component_op_upstream(&op_data, dev, dev, NULL); + ret = component_op_upstream(p, &op_data, dev, dev, NULL); if (ret < 0) goto out;
/* set up reader and writer positions */ - component_prepare_buffers_upstream(dev, dev, NULL); + component_prepare_buffers_upstream(p, dev, dev, NULL); }
out: @@ -629,7 +637,7 @@ int pipeline_trigger(struct pipeline *p, struct comp_dev *host, int cmd) int ret; uint32_t flags;
- trace_pipe("cmd"); + trace_pipe(p, "cmd");
op_data.p = p; op_data.op = COMP_OPS_TRIGGER; @@ -639,16 +647,16 @@ int pipeline_trigger(struct pipeline *p, struct comp_dev *host, int cmd)
if (host->params.direction == SOF_IPC_STREAM_PLAYBACK) { /* send cmd downstream from host to DAI */ - ret = component_op_downstream(&op_data, host, host, NULL); + ret = component_op_downstream(p, &op_data, host, host, NULL); } else { /* send cmd upstream from host to DAI */ - ret = component_op_upstream(&op_data, host, host, NULL); + ret = component_op_upstream(p, &op_data, host, host, NULL); }
if (ret < 0) { trace_ipc_error("pc0"); - trace_error_value(host->comp.id); - trace_error_value(cmd); + trace_pipe_error_value(p, host->comp.id); + trace_pipe_error_value(p, cmd); }
spin_unlock_irq(&p->lock, flags); @@ -674,7 +682,7 @@ int pipeline_params(struct pipeline *p, struct comp_dev *host, struct op_data op_data; int ret;
- trace_pipe("Par"); + trace_pipe(p, "Par");
op_data.p = p; op_data.op = COMP_OPS_PARAMS; @@ -685,15 +693,15 @@ int pipeline_params(struct pipeline *p, struct comp_dev *host,
if (host->params.direction == SOF_IPC_STREAM_PLAYBACK) { /* send params downstream from host to DAI */ - ret = component_op_downstream(&op_data, host, host, NULL); + ret = component_op_downstream(p, &op_data, host, host, NULL); } else { /* send params upstream from host to DAI */ - ret = component_op_upstream(&op_data, host, host, NULL); + ret = component_op_upstream(p, &op_data, host, host, NULL); }
if (ret < 0) { trace_ipc_error("pp0"); - trace_error_value(host->comp.id); + trace_pipe_error_value(p, host->comp.id); }
spin_unlock(&p->lock); @@ -706,7 +714,7 @@ int pipeline_reset(struct pipeline *p, struct comp_dev *host) struct op_data op_data; int ret;
- trace_pipe("PRe"); + trace_pipe(p, "PRe");
op_data.p = p; op_data.op = COMP_OPS_RESET; @@ -715,15 +723,15 @@ int pipeline_reset(struct pipeline *p, struct comp_dev *host)
if (host->params.direction == SOF_IPC_STREAM_PLAYBACK) { /* send reset downstream from host to DAI */ - ret = component_op_downstream(&op_data, host, host, NULL); + ret = component_op_downstream(p, &op_data, host, host, NULL); } else { /* send reset upstream from host to DAI */ - ret = component_op_upstream(&op_data, host, host, NULL); + ret = component_op_upstream(p, &op_data, host, host, NULL); }
if (ret < 0) { trace_ipc_error("pr0"); - trace_error_value(host->comp.id); + trace_pipe_error_value(p, host->comp.id); }
spin_unlock(&p->lock); @@ -743,14 +751,15 @@ int pipeline_reset(struct pipeline *p, struct comp_dev *host) * individually) and it stops at pipeline endpoints (where a component has no * source or sink components) or where this pipeline joins another pipeline. */ -static int pipeline_copy_from_upstream(struct comp_dev *start, - struct comp_dev *current) +static int pipeline_copy_from_upstream(struct pipeline *p, + struct comp_dev *start, + struct comp_dev *current) { struct list_item *clist; int err = 0;
- tracev_pipe("CP+"); - tracev_value(current->comp.id); + tracev_pipe(p, "CP+"); + tracev_pipe_value(p, current->comp.id);
/* stop going upstream if we reach an end point in this pipeline */ if (current->is_endpoint && current != start) @@ -771,10 +780,10 @@ static int pipeline_copy_from_upstream(struct comp_dev *start, continue;
/* continue upstream */ - err = pipeline_copy_from_upstream(start, buffer->source); + err = pipeline_copy_from_upstream(p, start, buffer->source); if (err < 0) { - trace_pipe_error("ePU"); - trace_error_value(current->comp.id); + trace_pipe_error(p, "ePU"); + trace_pipe_error_value(p, current->comp.id); return err; } } @@ -784,7 +793,7 @@ copy: err = comp_copy(current);
/* return back downstream */ - tracev_pipe("CD+"); + tracev_pipe(p, "CD+"); return err; }
@@ -801,14 +810,15 @@ copy: * individually) and it stops at pipeline endpoints (where a component has no * source or sink components) or where this pipeline joins another pipeline. */ -static int pipeline_copy_to_downstream(struct comp_dev *start, - struct comp_dev *current) +static int pipeline_copy_to_downstream(struct pipeline *p, + struct comp_dev *start, + struct comp_dev *current) { struct list_item *clist; int err = 0;
- tracev_pipe("CP-"); - tracev_value(current->comp.id); + tracev_pipe(p, "CP-"); + tracev_pipe_value(p, current->comp.id);
/* component copy/process to downstream */ if (current != start) { @@ -834,17 +844,17 @@ static int pipeline_copy_to_downstream(struct comp_dev *start, continue;
/* continue downstream */ - err = pipeline_copy_to_downstream(start, buffer->sink); + err = pipeline_copy_to_downstream(p, start, buffer->sink); if (err < 0) { - trace_pipe_error("ePD"); - trace_error_value(current->comp.id); + trace_pipe_error(p, "ePD"); + trace_pipe_error_value(p, current->comp.id); return err; } }
out: /* return back upstream */ - tracev_pipe("CD-"); + tracev_pipe(p, "CD-"); return err; }
@@ -1052,12 +1062,12 @@ static int pipeline_xrun_recover(struct pipeline *p) { int ret;
- trace_pipe_error("pxr"); + trace_pipe_error(p, "pxr");
/* notify all pipeline comps we are in XRUN */ ret = pipeline_trigger(p, p->source_comp, COMP_TRIGGER_XRUN); if (ret < 0) { - trace_pipe_error("px0"); + trace_pipe_error(p, "px0"); return ret; } p->xrun_bytes = 0; @@ -1065,14 +1075,14 @@ static int pipeline_xrun_recover(struct pipeline *p) /* prepare the pipeline */ ret = pipeline_prepare(p, p->source_comp); if (ret < 0) { - trace_pipe_error("px1"); + trace_pipe_error(p, "px1"); return ret; }
/* restart pipeline comps */ ret = pipeline_trigger(p, p->source_comp, COMP_TRIGGER_START); if (ret < 0) { - trace_pipe_error("px2"); + trace_pipe_error(p, "px2"); return ret; }
@@ -1105,7 +1115,7 @@ static void pipeline_task(void *arg) struct comp_dev *dev = p->sched_comp; int err;
- tracev_pipe("PWs"); + tracev_pipe(p, "PWs");
/* are we in xrun ? */ if (p->xrun_bytes) { @@ -1116,7 +1126,7 @@ static void pipeline_task(void *arg) }
/* copy data from upstream source endpoints to downstream endpoints */ - err = pipeline_copy_from_upstream(dev, dev); + err = pipeline_copy_from_upstream(p, dev, dev); if (err < 0) { err = pipeline_xrun_recover(p); if (err < 0) @@ -1124,7 +1134,7 @@ static void pipeline_task(void *arg) goto sched; }
- err = pipeline_copy_to_downstream(dev, dev); + err = pipeline_copy_to_downstream(p, dev, dev); if (err < 0) { err = pipeline_xrun_recover(p); if (err < 0) @@ -1133,7 +1143,7 @@ static void pipeline_task(void *arg) }
sched: - tracev_pipe("PWe"); + tracev_pipe(p, "PWe");
/* now reschedule the task */ /* TODO: add in scheduling cost and any timer drift */ @@ -1144,7 +1154,7 @@ sched: /* init pipeline */ int pipeline_init(void) { - trace_pipe("PIn"); + trace_pipe(NULL, "PIn");
pipe_data = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*pipe_data)); diff --git a/src/audio/pipeline_static.c b/src/audio/pipeline_static.c index cf71a36..3de0025 100644 --- a/src/audio/pipeline_static.c +++ b/src/audio/pipeline_static.c @@ -423,7 +423,7 @@ int init_static_pipeline(struct ipc *ipc) return 0;
error: - trace_pipe_error("ePS"); + trace_pipe_error(NULL, "ePS"); for (i = 0; i < ARRAY_SIZE(pipeline); i++) {
diff --git a/src/include/sof/audio/pipeline.h b/src/include/sof/audio/pipeline.h index 1ef53e5..b83c320 100644 --- a/src/include/sof/audio/pipeline.h +++ b/src/include/sof/audio/pipeline.h @@ -43,9 +43,18 @@ #include <uapi/ipc.h>
/* pipeline tracing */ -#define trace_pipe(__e) trace_event(TRACE_CLASS_PIPE, __e) -#define trace_pipe_error(__e) trace_error(TRACE_CLASS_PIPE, __e) -#define tracev_pipe(__e) tracev_event(TRACE_CLASS_PIPE, __e) +#define trace_pipe(cp, __e) \ + trace_pipeline_event(cp, NORMAL_LEVEL, TRACE_CLASS_PIPE, __e) +#define tracev_pipe(cp, __e) \ + trace_pipeline_event(cp, VERBOSE_LEVEL, TRACE_CLASS_PIPE, __e) +#define trace_pipe_error(cp, __e) \ + trace_pipeline_event_atomic(cp, ERROR_LEVEL, TRACE_CLASS_PIPE, __e) +#define trace_pipe_value(cp, x) \ + trace_pipeline_value(cp, NORMAL_LEVEL, x) +#define tracev_pipe_value(cp, x) \ + trace_pipeline_value(cp, VERBOSE_LEVEL, x) +#define trace_pipe_error_value(cp, x) \ + trace_pipeline_value_atomic(cp, ERROR_LEVEL, x)
struct ipc_pipeline_dev; struct ipc;
From: Yan Wang yan.wang@linux.intel.com
It will use DAI trace class and component DMA trace API. For trace calling of dai_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/dai.c | 80 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 36 deletions(-)
diff --git a/src/audio/dai.c b/src/audio/dai.c index 1eeecd2..2ebff6a 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -49,10 +49,18 @@ #define DAI_CAPTURE_STREAM 1
/* tracing */ -#define trace_dai(__e) trace_event(TRACE_CLASS_DAI, __e) -#define trace_dai_error(__e) trace_error(TRACE_CLASS_DAI, __e) -#define tracev_dai(__e) tracev_event(TRACE_CLASS_DAI, __e) - +#define trace_dai(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_DAI, __e) +#define tracev_dai(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_DAI, __e) +#define trace_dai_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_DAI, __e) +#define trace_dai_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_dai_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_dai_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
struct dai_data { /* local DMA config */ @@ -80,7 +88,7 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next) struct comp_buffer *dma_buffer; uint32_t copied_size;
- tracev_dai("irq"); + tracev_dai(dev, "irq");
/* stop dma copy for pause/stop/xrun */ if (dev->state != COMP_STATE_ACTIVE || dd->xrun) { @@ -136,7 +144,7 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next)
/* make sure there is availble bytes for next period */ if (dma_buffer->avail < dd->period_bytes) { - trace_dai_error("xru"); + trace_dai_error(dev, "xru"); comp_underrun(dev, dma_buffer, copied_size, 0); }
@@ -160,7 +168,7 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next)
/* make sure there is free bytes for next period */ if (dma_buffer->free < dd->period_bytes) { - trace_dai_error("xro"); + trace_dai_error(dev, "xro"); comp_overrun(dev, dma_buffer, dd->period_bytes, 0); } } @@ -177,7 +185,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp) struct sof_ipc_comp_dai *ipc_dai = (struct sof_ipc_comp_dai *)comp; struct dai_data *dd;
- trace_dai("new"); + trace_dai(NULL, "new");
dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, COMP_SIZE(struct sof_ipc_comp_dai)); @@ -197,13 +205,13 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
dd->dai = dai_get(dai->type, dai->index); if (dd->dai == NULL) { - trace_dai_error("eDg"); + trace_dai_error(NULL, "eDg"); goto error; }
dd->dma = dma_get(ipc_dai->dmac_id); if (dd->dma == NULL) { - trace_dai_error("eDd"); + trace_dai_error(NULL, "eDd"); goto error; }
@@ -216,7 +224,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp) /* get DMA channel from DMAC1 */ dd->chan = dma_channel_get(dd->dma, 0); if (dd->chan < 0){ - trace_dai_error("eDc"); + trace_dai_error(dev, "eDc"); goto error; }
@@ -272,11 +280,11 @@ static int dai_playback_params(struct comp_dev *dev) /* resize the buffer if space is available to align with period size */ err = buffer_set_size(dma_buffer, buffer_size); if (err < 0) { - trace_dai_error("ep1"); - trace_error_value(source_config->periods_sink); - trace_error_value(dd->period_bytes); - trace_error_value(buffer_size); - trace_error_value(dma_buffer->alloc_size); + trace_dai_error(dev, "ep1"); + trace_dai_error_value(dev, source_config->periods_sink); + trace_dai_error_value(dev, dd->period_bytes); + trace_dai_error_value(dev, buffer_size); + trace_dai_error_value(dev, dma_buffer->alloc_size); return err; }
@@ -302,7 +310,7 @@ static int dai_playback_params(struct comp_dev *dev) return 0;
err_unwind: - trace_dai_error("ep3"); + trace_dai_error(dev, "ep3"); list_for_item_safe(elist, tlist, &config->elem_list) { elem = container_of(elist, struct dma_sg_elem, list); list_item_del(&elem->list); @@ -340,11 +348,11 @@ static int dai_capture_params(struct comp_dev *dev) /* resize the buffer if space is available to align with period size */ err = buffer_set_size(dma_buffer, buffer_size); if (err < 0) { - trace_dai_error("ec1"); - trace_error_value(sink_config->periods_sink); - trace_error_value(dd->period_bytes); - trace_error_value(buffer_size); - trace_error_value(dma_buffer->alloc_size); + trace_dai_error(dev, "ec1"); + trace_dai_error_value(dev, sink_config->periods_sink); + trace_dai_error_value(dev, dd->period_bytes); + trace_dai_error_value(dev, buffer_size); + trace_dai_error_value(dev, dma_buffer->alloc_size); return err; }
@@ -368,7 +376,7 @@ static int dai_capture_params(struct comp_dev *dev) return 0;
err_unwind: - trace_dai_error("ec3"); + trace_dai_error(dev, "ec3"); list_for_item_safe(elist, tlist, &config->elem_list) { elem = container_of(elist, struct dma_sg_elem, list); list_item_del(&elem->list); @@ -383,11 +391,11 @@ static int dai_params(struct comp_dev *dev) struct comp_buffer *dma_buffer; struct sof_ipc_comp_config *dconfig = COMP_GET_CONFIG(dev);
- trace_dai("par"); + trace_dai(dev, "par");
/* can set params on only init state */ if (dev->state != COMP_STATE_READY) { - trace_dai_error("wdp"); + trace_dai_error(dev, "wdp"); return -EINVAL; }
@@ -397,13 +405,13 @@ static int dai_params(struct comp_dev *dev) /* calculate period size based on config */ dev->frame_bytes = comp_frame_bytes(dev); if (dev->frame_bytes == 0) { - trace_dai_error("ed1"); + trace_dai_error(dev, "ed1"); return -EINVAL; }
dd->period_bytes = dev->frames * dev->frame_bytes; if (dd->period_bytes == 0) { - trace_dai_error("ed2"); + trace_dai_error(dev, "ed2"); return -EINVAL; }
@@ -428,7 +436,7 @@ static int dai_prepare(struct comp_dev *dev) struct comp_buffer *dma_buffer; int ret = 0;
- trace_dai("pre"); + trace_dai(dev, "pre");
ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -437,7 +445,7 @@ static int dai_prepare(struct comp_dev *dev) dev->position = 0;
if (list_is_empty(&dd->config.elem_list)) { - trace_dai_error("wdm"); + trace_dai_error(dev, "wdm"); comp_set_state(dev, COMP_TRIGGER_RESET); return -EINVAL; } @@ -474,7 +482,7 @@ static int dai_reset(struct comp_dev *dev) struct list_item *tlist; struct dma_sg_elem *elem;
- trace_dai("res"); + trace_dai(dev, "res");
list_for_item_safe(elist, tlist, &config->elem_list) { elem = container_of(elist, struct dma_sg_elem, list); @@ -532,8 +540,8 @@ static int dai_comp_trigger(struct comp_dev *dev, int cmd) struct dai_data *dd = comp_get_drvdata(dev); int ret;
- trace_dai("trg"); - tracev_value(cmd); + trace_dai(dev, "trg"); + tracev_dai_value(dev, cmd);
wait_init(&dd->complete);
@@ -588,8 +596,8 @@ static int dai_comp_trigger(struct comp_dev *dev, int cmd) dd->complete.timeout = dev->pipeline->ipc_pipe.deadline; ret = wait_for_completion_timeout(&dd->complete); if (ret < 0) { - trace_dai_error("ed0"); - trace_error_value(cmd); + trace_dai_error(dev, "ed0"); + trace_dai_error_value(dev, cmd); } break; default: @@ -646,12 +654,12 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config) break; default: /* other types of DAIs not handled for now */ - trace_dai_error("de2"); + trace_dai_error(dev, "de2"); break; }
if (dev->frame_bytes == 0) { - trace_dai_error("de1"); + trace_dai_error(dev, "de1"); return -EINVAL; }
From: Yan Wang yan.wang@linux.intel.com
It will use VOLUME trace class and component DMA trace API. For trace calling of volume_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/volume.c | 121 +++++++++++++++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 55 deletions(-)
diff --git a/src/audio/volume.c b/src/audio/volume.c index d0b690b..8d8eb70 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -43,9 +43,18 @@ #include <sof/audio/pipeline.h> #include <sof/audio/format.h>
-#define trace_volume(__e) trace_event(TRACE_CLASS_VOLUME, __e) -#define tracev_volume(__e) tracev_event(TRACE_CLASS_VOLUME, __e) -#define trace_volume_error(__e) trace_error(TRACE_CLASS_VOLUME, __e) +#define trace_volume(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_VOLUME, __e) +#define tracev_volume(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_VOLUME, __e) +#define trace_volume_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_VOLUME, __e) +#define trace_volume_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_volume_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_volume_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
/* this should ramp from 0dB to mute in 64ms. * i.e 2^16 -> 0 in 32 * 2048 steps each lasting 2ms @@ -538,7 +547,8 @@ static const struct comp_func_map func_map[] = { };
/* synchronise host mmap() volume with real value */ -static void vol_sync_host(struct comp_data *cd, uint32_t chan) +static void vol_sync_host(struct comp_dev *dev, struct comp_data *cd, + uint32_t chan) { if (cd->hvol == NULL) return; @@ -546,15 +556,16 @@ static void vol_sync_host(struct comp_data *cd, uint32_t chan) if (chan < SOF_IPC_MAX_CHANNELS) cd->hvol[chan].value = cd->volume[chan]; else { - trace_volume_error("veh"); - tracev_value(chan); + trace_volume_error(dev, "veh"); + tracev_volume_value(dev, chan); } }
-static void vol_update(struct comp_data *cd, uint32_t chan) +static void vol_update(struct comp_dev *dev, struct comp_data *cd, + uint32_t chan) { cd->volume[chan] = cd->tvolume[chan]; - vol_sync_host(cd, chan); + vol_sync_host(dev, cd, chan); }
/* this ramps volume changes over time */ @@ -582,7 +593,7 @@ static uint64_t vol_work(void *data, uint64_t delay)
/* ramp completed ? */ if (vol >= cd->tvolume[i] || vol >= VOL_MAX) - vol_update(cd, i); + vol_update(dev, cd, i); else { cd->volume[i] = vol; again = 1; @@ -592,12 +603,12 @@ static uint64_t vol_work(void *data, uint64_t delay) new_vol = vol - VOL_RAMP_STEP; if (new_vol <= 0) { /* cannot ramp down below 0 */ - vol_update(cd, i); + vol_update(dev, cd, i); } else { /* ramp completed ? */ if (new_vol <= cd->tvolume[i] || new_vol <= VOL_MIN) { - vol_update(cd, i); + vol_update(dev, cd, i); } else { cd->volume[i] = new_vol; again = 1; @@ -606,7 +617,7 @@ static uint64_t vol_work(void *data, uint64_t delay) }
/* sync host with new value */ - vol_sync_host(cd, i); + vol_sync_host(dev, cd, i); }
/* do we need to continue ramping */ @@ -624,7 +635,7 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp) struct comp_data *cd; int i;
- trace_volume("new"); + trace_volume(NULL, "new");
dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, COMP_SIZE(struct sof_ipc_comp_volume)); @@ -657,7 +668,7 @@ static void volume_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev);
- trace_volume("fre"); + trace_volume(dev, "fre");
rfree(cd); rfree(dev); @@ -671,7 +682,7 @@ static int volume_params(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev);
- trace_volume("par"); + trace_volume(dev, "par");
/* rewrite params format for all downstream */ dev->params.frame_fmt = cd->sink_format; @@ -725,34 +736,34 @@ static int volume_ctrl_set_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *c
/* validate */ if (cdata->num_elems == 0 || cdata->num_elems >= SOF_IPC_MAX_CHANNELS) { - trace_volume_error("gs0"); + trace_volume_error(dev, "gs0"); return -EINVAL; }
switch (cdata->cmd) { case SOF_CTRL_CMD_VOLUME: - trace_volume("vst"); - trace_value(cdata->comp_id); + trace_volume(dev, "vst"); + trace_volume_value(dev, cdata->comp_id); for (j = 0; j < cdata->num_elems; j++) { - trace_value(cdata->chanv[j].channel); - trace_value(cdata->chanv[j].value); + trace_volume_value(dev, cdata->chanv[j].channel); + trace_volume_value(dev, cdata->chanv[j].value); i = cdata->chanv[j].channel; if ((i >= 0) && (i < SOF_IPC_MAX_CHANNELS)) volume_set_chan(dev, i, cdata->chanv[j].value); else { - trace_volume_error("gs2"); - tracev_value(i); + trace_volume_error(dev, "gs2"); + tracev_volume_value(dev, i); } } work_schedule_default(&cd->volwork, VOL_RAMP_US); break;
case SOF_CTRL_CMD_SWITCH: - trace_volume("mst"); - trace_value(cdata->comp_id); + trace_volume(dev, "mst"); + trace_volume_value(dev, cdata->comp_id); for (j = 0; j < cdata->num_elems; j++) { - trace_value(cdata->chanv[j].channel); - trace_value(cdata->chanv[j].value); + trace_volume_value(dev, cdata->chanv[j].channel); + trace_volume_value(dev, cdata->chanv[j].value); i = cdata->chanv[j].channel; if ((i >= 0) && (i < SOF_IPC_MAX_CHANNELS)) { if (cdata->chanv[j].value) @@ -760,15 +771,15 @@ static int volume_ctrl_set_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *c else volume_set_chan_mute(dev, i); } else { - trace_volume_error("gs3"); - tracev_value(i); + trace_volume_error(dev, "gs3"); + tracev_volume_value(dev, i); } } work_schedule_default(&cd->volwork, VOL_RAMP_US); break;
default: - trace_volume_error("gs1"); + trace_volume_error(dev, "gs1"); return -EINVAL; }
@@ -782,23 +793,23 @@ static int volume_ctrl_get_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *c
/* validate */ if (cdata->num_elems == 0 || cdata->num_elems >= SOF_IPC_MAX_CHANNELS) { - trace_volume_error("gc0"); - tracev_value(cdata->num_elems); + trace_volume_error(dev, "gc0"); + tracev_volume_value(dev, cdata->num_elems); return -EINVAL; }
if (cdata->cmd == SOF_CTRL_CMD_VOLUME || cdata->cmd == SOF_CTRL_CMD_SWITCH) { - trace_volume("vgt"); - trace_value(cdata->comp_id); + trace_volume(dev, "vgt"); + trace_volume_value(dev, cdata->comp_id); for (j = 0; j < cdata->num_elems; j++) { cdata->chanv[j].channel = j; cdata->chanv[j].value = cd->tvolume[j]; - trace_value(cdata->chanv[j].channel); - trace_value(cdata->chanv[j].value); + trace_volume_value(dev, cdata->chanv[j].channel); + trace_volume_value(dev, cdata->chanv[j].value); } } else { - trace_volume_error("ec2"); + trace_volume_error(dev, "ec2"); return -EINVAL; }
@@ -810,7 +821,7 @@ static int volume_cmd(struct comp_dev *dev, int cmd, void *data) { struct sof_ipc_ctrl_data *cdata = data;
- trace_volume("cmd"); + trace_volume(dev, "cmd");
switch (cmd) { case COMP_CMD_SET_VALUE: @@ -824,7 +835,7 @@ static int volume_cmd(struct comp_dev *dev, int cmd, void *data)
static int volume_trigger(struct comp_dev *dev, int cmd) { - trace_volume("trg"); + trace_volume(dev, "trg");
return comp_set_state(dev, cmd); } @@ -836,7 +847,7 @@ static int volume_copy(struct comp_dev *dev) struct comp_buffer *sink; struct comp_buffer *source;
- tracev_volume("cpy"); + tracev_volume(dev, "cpy");
/* volume components will only ever have 1 source and 1 sink buffer */ source = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); @@ -846,12 +857,12 @@ static int volume_copy(struct comp_dev *dev) * the sink component buffer has enough free bytes for copy. Also * check for XRUNs */ if (source->avail < cd->source_period_bytes) { - trace_volume_error("xru"); + trace_volume_error(dev, "xru"); comp_underrun(dev, source, cd->source_period_bytes, 0); return -EIO; /* xrun */ } if (sink->free < cd->sink_period_bytes) { - trace_volume_error("xro"); + trace_volume_error(dev, "xro"); comp_overrun(dev, sink, cd->sink_period_bytes, 0); return -EIO; /* xrun */ } @@ -880,7 +891,7 @@ static int volume_prepare(struct comp_dev *dev) int i; int ret;
- trace_volume("pre"); + trace_volume(dev, "pre");
ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -938,22 +949,22 @@ static int volume_prepare(struct comp_dev *dev) ret = buffer_set_size(sinkb, cd->sink_period_bytes * config->periods_sink); if (ret < 0) { - trace_volume_error("vp0"); + trace_volume_error(dev, "vp0"); goto err; }
/* validate */ if (cd->sink_period_bytes == 0) { - trace_volume_error("vp1"); - trace_error_value(dev->frames); - trace_error_value(sinkb->sink->frame_bytes); + trace_volume_error(dev, "vp1"); + trace_volume_error_value(dev, dev->frames); + trace_volume_error_value(dev, sinkb->sink->frame_bytes); ret = -EINVAL; goto err; } if (cd->source_period_bytes == 0) { - trace_volume_error("vp2"); - trace_error_value(dev->frames); - trace_error_value(sourceb->source->frame_bytes); + trace_volume_error(dev, "vp2"); + trace_volume_error_value(dev, dev->frames); + trace_volume_error_value(dev, sourceb->source->frame_bytes); ret = -EINVAL; goto err; } @@ -971,10 +982,10 @@ static int volume_prepare(struct comp_dev *dev) cd->scale_vol = func_map[i].func; goto found; } - trace_volume_error("vp3"); - trace_error_value(cd->source_format); - trace_error_value(cd->sink_format); - trace_error_value(dev->params.channels); + trace_volume_error(dev, "vp3"); + trace_volume_error_value(dev, cd->source_format); + trace_volume_error_value(dev, cd->sink_format); + trace_volume_error_value(dev, dev->params.channels);
err: comp_set_state(dev, COMP_TRIGGER_RESET); @@ -982,14 +993,14 @@ err:
found: for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) - vol_sync_host(cd, i); + vol_sync_host(dev, cd, i);
return 0; }
static int volume_reset(struct comp_dev *dev) { - trace_volume("res"); + trace_volume(dev, "res");
comp_set_state(dev, COMP_TRIGGER_RESET); return 0;
From: Yan Wang yan.wang@linux.intel.com
It will use SWITCH trace class and component DMA trace API. For trace calling of switch_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/switch.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/audio/switch.c b/src/audio/switch.c index cde300b..50764d7 100644 --- a/src/audio/switch.c +++ b/src/audio/switch.c @@ -36,13 +36,22 @@ #include <sof/audio/component.h>
/* tracing */ -#define trace_switch(__e) trace_event(TRACE_CLASS_SWITCH, __e) -#define trace_switch_error(__e) trace_error(TRACE_CLASS_SWITCH, __e) -#define tracev_switch(__e) tracev_event(TRACE_CLASS_SWITCH, __e) +#define trace_switch(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_SWITCH, __e) +#define tracev_switch(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_SWITCH, __e) +#define trace_switch_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_SWITCH, __e) +#define trace_switch_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_switch_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_switch_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
static struct comp_dev *switch_new(struct sof_ipc_comp *comp) { - trace_switch("new"); + trace_switch(NULL, "new");
return NULL; }
From: Yan Wang yan.wang@linux.intel.com
It will use TONE trace class and component DMA trace API. For trace calling of tone_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/tone.c | 79 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 35 deletions(-)
diff --git a/src/audio/tone.c b/src/audio/tone.c index eee6091..33c827e 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -52,9 +52,18 @@ #include <stdio.h> #endif
-#define trace_tone(__e) trace_event(TRACE_CLASS_TONE, __e) -#define tracev_tone(__e) tracev_event(TRACE_CLASS_TONE, __e) -#define trace_tone_error(__e) trace_error(TRACE_CLASS_TONE, __e) +#define trace_tone(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_TONE, __e) +#define tracev_tone(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_TONE, __e) +#define trace_tone_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_TONE, __e) +#define trace_tone_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_tone_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_tone_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
/* Convert float frequency in Hz to Q16.16 fractional format */ #define TONE_FREQ(f) Q_CONVERT_FLOAT(f, 16) @@ -403,7 +412,7 @@ static struct comp_dev *tone_new(struct sof_ipc_comp *comp) struct comp_data *cd; int i;
- trace_tone("new"); + trace_tone(NULL, "new");
dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, COMP_SIZE(struct sof_ipc_comp_tone)); @@ -434,7 +443,7 @@ static void tone_free(struct comp_dev *dev) { struct tone_data *td = comp_get_drvdata(dev);
- trace_tone("fre"); + trace_tone(dev, "fre");
rfree(td); rfree(dev); @@ -446,7 +455,7 @@ static int tone_params(struct comp_dev *dev) struct comp_data *cd = comp_get_drvdata(dev); struct sof_ipc_comp_config *config = COMP_GET_CONFIG(dev);
- trace_tone("par"); + trace_tone(dev, "par");
/* Need to compute this in non-host endpoint */ dev->frame_bytes = @@ -470,14 +479,14 @@ static int tone_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cd bool val;
if (cdata->cmd == SOF_CTRL_CMD_SWITCH) { - trace_tone("mst"); + trace_tone(dev, "mst"); for (j = 0; j < cdata->num_elems; j++) { ch = cdata->chanv[j].channel; val = cdata->chanv[j].value; - tracev_value(ch); - tracev_value(val); + tracev_tone_value(dev, ch); + tracev_tone_value(dev, val); if (ch >= PLATFORM_MAX_CHANNELS) { - trace_tone_error("che"); + trace_tone_error(dev, "che"); return -EINVAL; } if (val) @@ -487,7 +496,7 @@ static int tone_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cd
} } else { - trace_tone_error("ste"); + trace_tone_error(dev, "ste"); return -EINVAL; }
@@ -503,65 +512,65 @@ static int tone_cmd_set_data(struct comp_dev *dev, uint32_t ch; uint32_t val;
- trace_tone("tri"); + trace_tone(dev, "tri");
/* Check version from ABI header */ if (cdata->data->comp_abi != SOF_TONE_ABI_VERSION) { - trace_tone_error("abi"); + trace_tone_error(dev, "abi"); return -EINVAL; }
switch (cdata->cmd) { case SOF_CTRL_CMD_ENUM: - trace_tone("ten"); - trace_value(cdata->index); + trace_tone(dev, "ten"); + trace_tone_value(dev, cdata->index); compv = (struct sof_ipc_ctrl_value_comp *) cdata->data->data; for (i = 0; i < (int) cdata->num_elems; i++) { ch = compv[i].index; val = compv[i].svalue; - tracev_value(ch); - tracev_value(val); + tracev_tone_value(dev, ch); + tracev_tone_value(dev, val); switch (cdata->index) { case SOF_TONE_IDX_FREQUENCY: - trace_tone("tfr"); + trace_tone(dev, "tfr"); tonegen_update_f(&cd->sg[ch], val); break; case SOF_TONE_IDX_AMPLITUDE: - trace_tone("tam"); + trace_tone(dev, "tam"); tonegen_set_a(&cd->sg[ch], val); break; case SOF_TONE_IDX_FREQ_MULT: - trace_tone("tfx"); + trace_tone(dev, "tfx"); tonegen_set_freq_mult(&cd->sg[ch], val); break; case SOF_TONE_IDX_AMPL_MULT: - trace_tone("tax"); + trace_tone(dev, "tax"); tonegen_set_ampl_mult(&cd->sg[ch], val); break; case SOF_TONE_IDX_LENGTH: - trace_tone("tle"); + trace_tone(dev, "tle"); tonegen_set_length(&cd->sg[ch], val); break; case SOF_TONE_IDX_PERIOD: - trace_tone("tpe"); + trace_tone(dev, "tpe"); tonegen_set_period(&cd->sg[ch], val); break; case SOF_TONE_IDX_REPEATS: - trace_tone("trp"); + trace_tone(dev, "trp"); tonegen_set_repeats(&cd->sg[ch], val); break; case SOF_TONE_IDX_LIN_RAMP_STEP: - trace_tone("trs"); + trace_tone(dev, "trs"); tonegen_set_linramp(&cd->sg[ch], val); break; default: - trace_tone_error("ier"); + trace_tone_error(dev, "ier"); return -EINVAL; } } break; default: - trace_tone_error("ec1"); + trace_tone_error(dev, "ec1"); return -EINVAL; }
@@ -574,7 +583,7 @@ static int tone_cmd(struct comp_dev *dev, int cmd, void *data) struct sof_ipc_ctrl_data *cdata = data; int ret = 0;
- trace_tone("cmd"); + trace_tone(dev, "cmd");
switch (cmd) { case COMP_CMD_SET_DATA: @@ -590,7 +599,7 @@ static int tone_cmd(struct comp_dev *dev, int cmd, void *data)
static int tone_trigger(struct comp_dev *dev, int cmd) { - trace_tone("trg"); + trace_tone(dev, "trg");
return comp_set_state(dev, cmd); } @@ -601,7 +610,7 @@ static int tone_copy(struct comp_dev * dev) struct comp_buffer *sink; struct comp_data *cd = comp_get_drvdata(dev);
- tracev_comp("cpy"); + tracev_tone(dev, "cpy");
/* tone component sink buffer */ sink = list_first_item(&dev->bsink_list, struct comp_buffer, @@ -620,7 +629,7 @@ static int tone_copy(struct comp_dev * dev) return dev->frames; } else { /* XRUN */ - trace_tone_error("xrn"); + trace_tone_error(dev, "xrn"); comp_overrun(dev, sink, cd->period_bytes, sink->free); return -EIO; } @@ -634,7 +643,7 @@ static int tone_prepare(struct comp_dev * dev) int ret; int i;
- trace_tone("TPp"); + trace_tone(dev, "TPp");
ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -642,8 +651,8 @@ static int tone_prepare(struct comp_dev * dev)
cd->channels = dev->params.channels; cd->rate = dev->params.rate; - tracev_value(cd->channels); - tracev_value(cd->rate); + tracev_tone_value(dev, cd->channels); + tracev_tone_value(dev, cd->rate);
for (i = 0; i < cd->channels; i++) { f = tonegen_get_f(&cd->sg[i]); @@ -663,7 +672,7 @@ static int tone_reset(struct comp_dev * dev) struct comp_data *cd = comp_get_drvdata(dev); int i;
- trace_tone("TRe"); + trace_tone(dev, "TRe");
/* Initialize with the defaults */ for (i = 0; i < PLATFORM_MAX_CHANNELS; i++)
From: Yan Wang yan.wang@linux.intel.com
It will use MIXER trace class and component DMA trace API. For trace calling of mixer_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/mixer.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/src/audio/mixer.c b/src/audio/mixer.c index ac6b7f9..ee2996e 100644 --- a/src/audio/mixer.c +++ b/src/audio/mixer.c @@ -37,9 +37,18 @@ #include <sof/alloc.h> #include <sof/audio/component.h>
-#define trace_mixer(__e) trace_event(TRACE_CLASS_MIXER, __e) -#define tracev_mixer(__e) tracev_event(TRACE_CLASS_MIXER, __e) -#define trace_mixer_error(__e) trace_error(TRACE_CLASS_MIXER, __e) +#define trace_mixer(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_MIXER, __e) +#define tracev_mixer(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_MIXER, __e) +#define trace_mixer_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_MIXER, __e) +#define trace_mixer_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_mixer_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_mixer_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
/* mixer component private data */ struct mixer_data { @@ -86,7 +95,7 @@ static struct comp_dev *mixer_new(struct sof_ipc_comp *comp) (struct sof_ipc_comp_mixer *)comp; struct mixer_data *md;
- trace_mixer("new"); + trace_mixer(NULL, "new"); dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, COMP_SIZE(struct sof_ipc_comp_mixer)); if (dev == NULL) @@ -110,7 +119,7 @@ static void mixer_free(struct comp_dev *dev) { struct mixer_data *md = comp_get_drvdata(dev);
- trace_mixer("fre"); + trace_mixer(dev, "fre");
rfree(md); rfree(dev); @@ -124,19 +133,19 @@ static int mixer_params(struct comp_dev *dev) struct comp_buffer *sink; int ret;
- trace_mixer("par"); + trace_mixer(dev, "par");
/* calculate frame size based on config */ dev->frame_bytes = comp_frame_bytes(dev); if (dev->frame_bytes == 0) { - trace_mixer_error("mx1"); + trace_mixer_error(dev, "mx1"); return -EINVAL; }
/* calculate period size based on config */ md->period_bytes = dev->frames * dev->frame_bytes; if (md->period_bytes == 0) { - trace_mixer_error("mx2"); + trace_mixer_error(dev, "mx2"); return -EINVAL; }
@@ -145,7 +154,7 @@ static int mixer_params(struct comp_dev *dev) /* set downstream buffer size */ ret = buffer_set_size(sink, md->period_bytes * config->periods_sink); if (ret < 0) { - trace_mixer_error("mx3"); + trace_mixer_error(dev, "mx3"); return ret; }
@@ -182,7 +191,7 @@ static int mixer_trigger(struct comp_dev *dev, int cmd) { int ret;
- trace_mixer("trg"); + trace_mixer(dev, "trg");
ret = comp_set_state(dev, cmd); if (ret < 0) @@ -222,7 +231,7 @@ static int mixer_copy(struct comp_dev *dev) int32_t num_mix_sources = 0; int res;
- tracev_mixer("cpy"); + tracev_mixer(dev, "cpy");
sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
@@ -251,11 +260,11 @@ static int mixer_copy(struct comp_dev *dev) * for copy. Also check for XRUNs */ res = comp_buffer_can_copy_bytes(sources[i], sink, md->period_bytes); if (res < 0) { - trace_mixer_error("xru"); + trace_mixer_error(dev, "xru"); comp_underrun(dev, sources[i], sources[i]->avail, md->period_bytes); } else if (res > 0) { - trace_mixer_error("xru"); + trace_mixer_error(dev, "xru"); comp_overrun(dev, sources[i], sink->free, md->period_bytes); } @@ -280,7 +289,7 @@ static int mixer_reset(struct comp_dev *dev) struct list_item * blist; struct comp_buffer *source;
- trace_mixer("res"); + trace_mixer(dev, "res");
list_for_item(blist, &dev->bsource_list) { source = container_of(blist, struct comp_buffer, sink_list); @@ -309,7 +318,7 @@ static int mixer_prepare(struct comp_dev *dev) int downstream = 0; int ret;
- trace_mixer("pre"); + trace_mixer(dev, "pre");
/* does mixer already have active source streams ? */ if (dev->state != COMP_STATE_ACTIVE) {
From: Yan Wang yan.wang@linux.intel.com
It will use HOST trace class and component DMA trace API. For trace calling of host_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/host.c | 71 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 31 deletions(-)
diff --git a/src/audio/host.c b/src/audio/host.c index 998c5ca..b23da69 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -47,9 +47,18 @@ #include <arch/cache.h> #include <uapi/ipc.h>
-#define trace_host(__e) trace_event(TRACE_CLASS_HOST, __e) -#define tracev_host(__e) tracev_event(TRACE_CLASS_HOST, __e) -#define trace_host_error(__e) trace_error(TRACE_CLASS_HOST, __e) +#define trace_host(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_HOST, __e) +#define tracev_host(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_HOST, __e) +#define trace_host_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_HOST, __e) +#define trace_host_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_host_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_host_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
static int host_copy(struct comp_dev *dev);
@@ -269,7 +278,7 @@ unwind: rfree(e); }
- trace_host_error("el0"); + trace_host_error(dev, "el0"); return -ENOMEM; }
@@ -278,7 +287,7 @@ static int host_trigger(struct comp_dev *dev, int cmd) { int ret = 0;
- trace_host("cmd"); + trace_host(dev, "cmd");
ret = comp_set_state(dev, cmd); if (ret < 0) @@ -317,7 +326,7 @@ static void host_gw_dma_update(struct comp_dev *dev) local_elem = list_first_item(&hd->config.elem_list, struct dma_sg_elem, list);
- tracev_host("upd"); + tracev_host(dev, "upd");
/* update buffer positions */ dma_buffer = hd->dma_buffer; @@ -448,7 +457,7 @@ unwind: rfree(ec); }
- trace_host_error("el0"); + trace_host_error(dev, "el0"); return -ENOMEM; }
@@ -458,7 +467,7 @@ static int host_trigger(struct comp_dev *dev, int cmd) struct host_data *hd = comp_get_drvdata(dev); int ret = 0;
- trace_host("trg"); + trace_host(dev, "trg");
ret = comp_set_state(dev, cmd); if (ret < 0) @@ -472,8 +481,8 @@ static int host_trigger(struct comp_dev *dev, int cmd) case COMP_TRIGGER_START: ret = dma_start(hd->dma, hd->chan); if (ret < 0) { - trace_host_error("TsF"); - trace_error_value(ret); + trace_host_error(dev, "TsF"); + trace_host_error_value(dev, ret); goto out; }
@@ -505,7 +514,7 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp) struct sof_ipc_comp_host *ipc_host = (struct sof_ipc_comp_host *)comp; struct dma_sg_elem *elem;
- trace_host("new"); + trace_host(NULL, "new");
dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, COMP_SIZE(struct sof_ipc_comp_host)); @@ -539,7 +548,7 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp) hd->dma = dma_get(DMA_HOST_IN_DMAC); #endif if (hd->dma == NULL) { - trace_host_error("eDM"); + trace_host_error(NULL, "eDM"); goto error; }
@@ -553,7 +562,7 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp) /* get DMA channel from DMAC */ hd->chan = dma_channel_get(hd->dma, 0); if (hd->chan < 0) { - trace_host_error("eDC"); + trace_host_error(NULL, "eDC"); goto error; }
@@ -578,7 +587,7 @@ static void host_free(struct comp_dev *dev) struct host_data *hd = comp_get_drvdata(dev); struct dma_sg_elem *elem;
- trace_host("fre"); + trace_host(dev, "fre");
elem = list_first_item(&hd->config.elem_list, struct dma_sg_elem, list); @@ -631,7 +640,7 @@ static int host_params(struct comp_dev *dev) uint32_t buffer_size; int err;
- trace_host("par"); + trace_host(dev, "par");
/* host params always installed by pipeline IPC */ hd->host_size = dev->params.buffer.size; @@ -659,14 +668,14 @@ static int host_params(struct comp_dev *dev)
/* validate period count */ if (hd->period_count == 0) { - trace_host_error("eS0"); + trace_host_error(dev, "eS0"); return -EINVAL; }
/* calculate period size based on config */ hd->period_bytes = dev->frames * comp_frame_bytes(dev); if (hd->period_bytes == 0) { - trace_host_error("eS1"); + trace_host_error(dev, "eS1"); return -EINVAL; }
@@ -674,16 +683,16 @@ static int host_params(struct comp_dev *dev) buffer_size = hd->period_count * hd->period_bytes; err = buffer_set_size(hd->dma_buffer, buffer_size); if (err < 0) { - trace_host_error("eSz"); - trace_error_value(buffer_size); + trace_host_error(dev, "eSz"); + trace_host_error_value(dev, buffer_size); return err; }
/* component buffer size must be divisor of host buffer size */ if (hd->host_size % hd->period_bytes) { - trace_comp_error("eHB"); - trace_error_value(hd->host_size); - trace_error_value(hd->period_bytes); + trace_host_error(dev, "eHB"); + trace_host_error_value(dev, hd->host_size); + trace_host_error_value(dev, hd->period_bytes); return -EINVAL; }
@@ -704,12 +713,12 @@ static int host_params(struct comp_dev *dev) /* get DMA channel from DMAC */ hd->chan = dma_channel_get(hd->dma, dev->params.stream_tag); if (hd->chan < 0) { - trace_host_error("eDC"); + trace_host_error(dev, "eDC"); return -ENODEV; } err = dma_set_config(hd->dma, hd->chan, &hd->config); if (err < 0) { - trace_host_error("eDc"); + trace_host_error(dev, "eDc"); dma_channel_put(hd->dma, hd->chan); return err; } @@ -723,7 +732,7 @@ static int host_prepare(struct comp_dev *dev) struct host_data *hd = comp_get_drvdata(dev); int ret;
- trace_host("pre"); + trace_host(dev, "pre");
ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -805,7 +814,7 @@ static int host_reset(struct comp_dev *dev) struct list_item *elist; struct list_item *tlist;
- trace_host("res"); + trace_host(dev, "res");
/* free all host DMA elements */ list_for_item_safe(elist, tlist, &hd->host.elem_list) { @@ -858,7 +867,7 @@ static int host_copy(struct comp_dev *dev) struct dma_sg_elem *local_elem; int ret;
- tracev_host("cpy"); + tracev_host(dev, "cpy");
if (dev->state != COMP_STATE_ACTIVE) return 0; @@ -883,14 +892,14 @@ static int host_copy(struct comp_dev *dev) if (dev->params.direction == SOF_IPC_STREAM_PLAYBACK) { if (hd->dma_buffer->free < local_elem->size) { /* buffer is enough avail, just return. */ - trace_host("Bea"); + trace_host(dev, "Bea"); return 0; } } else {
if (hd->dma_buffer->avail < local_elem->size) { /* buffer is enough empty, just return. */ - trace_host("Bee"); + trace_host(dev, "Bee"); return 0; } } @@ -915,8 +924,8 @@ static int host_copy(struct comp_dev *dev) #endif return dev->frames; out: - trace_host_error("CpF"); - trace_error_value(ret); + trace_host_error(dev, "CpF"); + trace_host_error_value(dev, ret); return ret; }
From: Yan Wang yan.wang@linux.intel.com
It will use MUX trace class and component DMA trace API. For trace calling of mux_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/mux.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/audio/mux.c b/src/audio/mux.c index e96c467..c85fb2e 100644 --- a/src/audio/mux.c +++ b/src/audio/mux.c @@ -36,13 +36,22 @@ #include <sof/audio/component.h>
/* tracing */ -#define trace_mux(__e) trace_event(TRACE_CLASS_MUX, __e) -#define trace_mux_error(__e) trace_error(TRACE_CLASS_MUX, __e) -#define tracev_mux(__e) tracev_event(TRACE_CLASS_MUX, __e) +#define trace_mux(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_MUX, __e) +#define tracev_mux(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_MUX, __e) +#define trace_mux_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_MUX, __e) +#define trace_mux_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_mux_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_mux_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
static struct comp_dev *mux_new(struct sof_ipc_comp *comp) { - trace_mux("new"); + trace_mux(NULL, "new");
return NULL; }
From: Yan Wang yan.wang@linux.intel.com
It will use EQ_FIR trace class and component DMA trace API. For trace calling of eq_fir_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/eq_fir.c | 63 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 27 deletions(-)
diff --git a/src/audio/eq_fir.c b/src/audio/eq_fir.c index 8566818..8718ecd 100644 --- a/src/audio/eq_fir.c +++ b/src/audio/eq_fir.c @@ -53,9 +53,18 @@ #include <stdio.h> #endif
-#define trace_eq(__e) trace_event(TRACE_CLASS_EQ_FIR, __e) -#define tracev_eq(__e) tracev_event(TRACE_CLASS_EQ_FIR, __e) -#define trace_eq_error(__e) trace_error(TRACE_CLASS_EQ_FIR, __e) +#define trace_eq_fir(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_EQ_FIR, __e) +#define tracev_eq_fir(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_EQ_FIR, __e) +#define trace_eq_fir_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_EQ_FIR, __e) +#define trace_eq_fir_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_eq_fir_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_eq_fir_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
/* src component private data */ struct comp_data { @@ -251,7 +260,7 @@ static struct comp_dev *eq_fir_new(struct sof_ipc_comp *comp) struct comp_data *cd; int i;
- trace_eq("new"); + trace_eq_fir(NULL, "new");
dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, COMP_SIZE(struct sof_ipc_comp_eq_fir)); @@ -282,7 +291,7 @@ static void eq_fir_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev);
- trace_eq("fre"); + trace_eq_fir(dev, "fre");
eq_fir_free_delaylines(cd->fir); eq_fir_free_parameters(&cd->config); @@ -299,7 +308,7 @@ static int eq_fir_params(struct comp_dev *dev) struct comp_buffer *sink; int err;
- trace_eq("par"); + trace_eq_fir(dev, "par");
/* Calculate period size based on config. First make sure that * frame_bytes is set. @@ -312,7 +321,7 @@ static int eq_fir_params(struct comp_dev *dev) sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); err = buffer_set_size(sink, cd->period_bytes * config->periods_sink); if (err < 0) { - trace_eq_error("eSz"); + trace_eq_fir_error(dev, "eSz"); return err; }
@@ -331,14 +340,14 @@ static int fir_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cda bool val;
if (cdata->cmd == SOF_CTRL_CMD_SWITCH) { - trace_eq("mst"); + trace_eq_fir(dev, "mst"); for (j = 0; j < cdata->num_elems; j++) { ch = cdata->chanv[j].channel; val = cdata->chanv[j].value; - tracev_value(ch); - tracev_value(val); + tracev_eq_fir_value(dev, ch); + tracev_eq_fir_value(dev, val); if (ch >= PLATFORM_MAX_CHANNELS) { - trace_eq_error("che"); + trace_eq_fir_error(dev, "che"); return -EINVAL; } if (val) @@ -347,7 +356,7 @@ static int fir_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cda fir_mute(&cd->fir[ch]); } } else { - trace_eq_error("ste"); + trace_eq_fir_error(dev, "ste"); return -EINVAL; }
@@ -370,28 +379,28 @@ static int fir_cmd_set_data(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdat
switch (cdata->cmd) { case SOF_CTRL_CMD_ENUM: - trace_eq("EFe"); + trace_eq_fir(dev, "EFe"); if (cdata->index == SOF_EQ_FIR_IDX_SWITCH) { - trace_eq("EFs"); + trace_eq_fir(dev, "EFs"); compv = (struct sof_ipc_ctrl_value_comp *) cdata->data->data; for (i = 0; i < (int) cdata->num_elems; i++) { - tracev_value(compv[i].index); - tracev_value(compv[i].svalue); + tracev_eq_fir_value(dev, compv[i].index); + tracev_eq_fir_value(dev, compv[i].svalue); ret = eq_fir_switch_response(cd->fir, cd->config, compv[i].index, compv[i].svalue); if (ret < 0) { - trace_eq_error("swe"); + trace_eq_fir_error(dev, "swe"); return -EINVAL; } } } else { - trace_eq_error("une"); - trace_error_value(cdata->index); + trace_eq_fir_error(dev, "une"); + trace_eq_fir_error_value(dev, cdata->index); return -EINVAL; } break; case SOF_CTRL_CMD_BINARY: - trace_eq("EFc"); + trace_eq_fir(dev, "EFc");
/* Check and free old config */ eq_fir_free_parameters(&cd->config); @@ -409,7 +418,7 @@ static int fir_cmd_set_data(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdat ret = eq_fir_setup(cd->fir, cd->config, PLATFORM_MAX_CHANNELS); break; default: - trace_eq_error("ec1"); + trace_eq_fir_error(dev, "ec1"); ret = -EINVAL; break; } @@ -423,7 +432,7 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) struct sof_ipc_ctrl_data *cdata = data; int ret = 0;
- trace_eq("cmd"); + trace_eq_fir(dev, "cmd");
switch (cmd) { case COMP_CMD_SET_VALUE: @@ -439,7 +448,7 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data)
static int eq_fir_trigger(struct comp_dev *dev, int cmd) { - trace_eq("trg"); + trace_eq_fir(dev, "trg");
return comp_set_state(dev, cmd); } @@ -452,7 +461,7 @@ static int eq_fir_copy(struct comp_dev *dev) struct comp_buffer *sink; int res;
- trace_comp("EqF"); + trace_eq_fir(dev, "EqF");
/* get source and sink buffers */ source = list_first_item(&dev->bsource_list, struct comp_buffer, @@ -465,7 +474,7 @@ static int eq_fir_copy(struct comp_dev *dev) * check for XRUNs */ res = comp_buffer_can_copy_bytes(source, sink, sd->period_bytes); if (res) { - trace_eq_error("xrn"); + trace_eq_fir_error(dev, "xrn"); return -EIO; /* xrun */ }
@@ -483,7 +492,7 @@ static int eq_fir_prepare(struct comp_dev *dev) struct comp_data *cd = comp_get_drvdata(dev); int ret;
- trace_eq("EPp"); + trace_eq_fir(dev, "EPp");
ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -511,7 +520,7 @@ static int eq_fir_reset(struct comp_dev *dev) int i; struct comp_data *cd = comp_get_drvdata(dev);
- trace_eq("ERe"); + trace_eq_fir(dev, "ERe");
eq_fir_free_delaylines(cd->fir); eq_fir_free_parameters(&cd->config);
From: Yan Wang yan.wang@linux.intel.com
It will use EQ_IIR trace class and component DMA trace API. For trace calling of eq_iir_new(), NULL will be passed into trace API because comp_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/eq_iir.c | 63 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 27 deletions(-)
diff --git a/src/audio/eq_iir.c b/src/audio/eq_iir.c index b874518..2e1b971 100644 --- a/src/audio/eq_iir.c +++ b/src/audio/eq_iir.c @@ -53,9 +53,18 @@ #include <stdio.h> #endif
-#define trace_eq_iir(__e) trace_event(TRACE_CLASS_EQ_IIR, __e) -#define tracev_eq_iir(__e) tracev_event(TRACE_CLASS_EQ_IIR, __e) -#define trace_eq_iir_error(__e) trace_error(TRACE_CLASS_EQ_IIR, __e) +#define trace_eq_iir(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_EQ_IIR, __e) +#define tracev_eq_iir(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_EQ_IIR, __e) +#define trace_eq_iir_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_EQ_IIR, __e) +#define trace_eq_iir_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_eq_iir_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_eq_iir_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
/* src component private data */ struct comp_data { @@ -254,7 +263,7 @@ static struct comp_dev *eq_iir_new(struct sof_ipc_comp *comp) struct comp_data *cd; int i;
- trace_eq_iir("new"); + trace_eq_iir(NULL, "new");
dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, COMP_SIZE(struct sof_ipc_comp_eq_iir)); @@ -284,7 +293,7 @@ static void eq_iir_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev);
- trace_eq_iir("fre"); + trace_eq_iir(dev, "fre");
eq_iir_free_delaylines(cd->iir); eq_iir_free_parameters(&cd->config); @@ -301,7 +310,7 @@ static int eq_iir_params(struct comp_dev *dev) struct comp_buffer *sink; int err;
- trace_eq_iir("par"); + trace_eq_iir(dev, "par");
/* Calculate period size based on config. First make sure that * frame_bytes is set. @@ -314,7 +323,7 @@ static int eq_iir_params(struct comp_dev *dev) sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); err = buffer_set_size(sink, cd->period_bytes * config->periods_sink); if (err < 0) { - trace_eq_iir_error("eSz"); + trace_eq_iir_error(dev, "eSz"); return err; }
@@ -333,14 +342,14 @@ static int iir_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cda bool val;
if (cdata->cmd == SOF_CTRL_CMD_SWITCH) { - trace_eq_iir("mst"); + trace_eq_iir(dev, "mst"); for (j = 0; j < cdata->num_elems; j++) { ch = cdata->chanv[j].channel; val = cdata->chanv[j].value; - tracev_value(ch); - tracev_value(val); + tracev_eq_iir_value(dev, ch); + tracev_eq_iir_value(dev, val); if (ch >= PLATFORM_MAX_CHANNELS) { - trace_eq_iir_error("che"); + trace_eq_iir_error(dev, "che"); return -EINVAL; } if (val) @@ -349,7 +358,7 @@ static int iir_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cda iir_mute_df2t(&cd->iir[ch]); } } else { - trace_eq_iir_error("ste"); + trace_eq_iir_error(dev, "ste"); return -EINVAL; }
@@ -366,28 +375,28 @@ static int iir_cmd_set_data(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdat
switch (cdata->cmd) { case SOF_CTRL_CMD_ENUM: - trace_eq_iir("EIe"); + trace_eq_iir(dev, "EIe"); if (cdata->index == SOF_EQ_IIR_IDX_SWITCH) { - trace_eq_iir("EIs"); + trace_eq_iir(dev, "EIs"); compv = (struct sof_ipc_ctrl_value_comp *) cdata->data->data; for (i = 0; i < (int) cdata->num_elems; i++) { - tracev_value(compv[i].index); - tracev_value(compv[i].svalue); + tracev_eq_iir_value(dev, compv[i].index); + tracev_eq_iir_value(dev, compv[i].svalue); ret = eq_iir_switch_response(cd->iir, cd->config, compv[i].index, compv[i].svalue); if (ret < 0) { - trace_eq_iir_error("swe"); + trace_eq_iir_error(dev, "swe"); return -EINVAL; } } } else { - trace_eq_iir_error("une"); - trace_error_value(cdata->index); + trace_eq_iir_error(dev, "une"); + trace_eq_iir_error_value(dev, cdata->index); return -EINVAL; } break; case SOF_CTRL_CMD_BINARY: - trace_eq_iir("EIb"); + trace_eq_iir(dev, "EIb"); /* Check and free old config */ eq_iir_free_parameters(&cd->config);
@@ -408,7 +417,7 @@ static int iir_cmd_set_data(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdat ret = eq_iir_setup(cd->iir, cd->config, PLATFORM_MAX_CHANNELS); break; default: - trace_eq_iir_error("ec1"); + trace_eq_iir_error(dev, "ec1"); ret = -EINVAL; break; } @@ -422,7 +431,7 @@ static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data) struct sof_ipc_ctrl_data *cdata = data; int ret = 0;
- trace_eq_iir("cmd"); + trace_eq_iir(dev, "cmd");
switch (cmd) { case COMP_CMD_SET_VALUE: @@ -438,7 +447,7 @@ static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data)
static int eq_iir_trigger(struct comp_dev *dev, int cmd) { - trace_eq_iir("trg"); + trace_eq_iir(dev, "trg");
return comp_set_state(dev, cmd); } @@ -451,7 +460,7 @@ static int eq_iir_copy(struct comp_dev *dev) struct comp_buffer *sink; int res;
- trace_comp("EqI"); + trace_eq_iir(dev, "EqI");
/* get source and sink buffers */ source = list_first_item(&dev->bsource_list, struct comp_buffer, @@ -464,7 +473,7 @@ static int eq_iir_copy(struct comp_dev *dev) * check for XRUNs */ res = comp_buffer_can_copy_bytes(source, sink, cd->period_bytes); if (res) { - trace_eq_iir_error("xrn"); + trace_eq_iir_error(dev, "xrn"); return -EIO; /* xrun */ }
@@ -482,7 +491,7 @@ static int eq_iir_prepare(struct comp_dev *dev) struct comp_data *cd = comp_get_drvdata(dev); int ret;
- trace_eq_iir("EPp"); + trace_eq_iir(dev, "EPp");
ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -513,7 +522,7 @@ static int eq_iir_reset(struct comp_dev *dev) int i; struct comp_data *cd = comp_get_drvdata(dev);
- trace_eq_iir("ERe"); + trace_eq_iir(dev, "ERe");
eq_iir_free_delaylines(cd->iir); eq_iir_free_parameters(&cd->config);
From: Yan Wang yan.wang@linux.intel.com
It will use SRC trace class and component DMA trace API. For trace calling of src_new(), NULL will be passed into trace API because comp_dev hasn't been initialized. Some sub-functions must be added comp_dev input parameter for trace.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/src.c | 97 ++++++++++++++++++++++++++++++++------------------------- src/audio/src.h | 5 +-- 2 files changed, 57 insertions(+), 45 deletions(-)
diff --git a/src/audio/src.c b/src/audio/src.c index c19828a..2fc01d6 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -60,9 +60,18 @@ #include <stdio.h> #endif
-#define trace_src(__e) trace_event(TRACE_CLASS_SRC, __e) -#define tracev_src(__e) tracev_event(TRACE_CLASS_SRC, __e) -#define trace_src_error(__e) trace_error(TRACE_CLASS_SRC, __e) +#define trace_src(cd, __e) \ + trace_comp_event(cd, NORMAL_LEVEL, TRACE_CLASS_SRC, __e) +#define tracev_src(cd, __e) \ + trace_comp_event(cd, VERBOSE_LEVEL, TRACE_CLASS_SRC, __e) +#define trace_src_error(cd, __e) \ + trace_comp_event_atomic(cd, ERROR_LEVEL, TRACE_CLASS_SRC, __e) +#define trace_src_value(cd, x) \ + trace_comp_value(cd, NORMAL_LEVEL, x) +#define tracev_src_value(cd, x) \ + trace_comp_value(cd, VERBOSE_LEVEL, x) +#define trace_src_error_value(cd, x) \ + trace_comp_value_atomic(cd, ERROR_LEVEL, x)
/* The FIR maximum lengths are per channel so need to multiply them */ #define MAX_FIR_DELAY_SIZE_XNCH (PLATFORM_MAX_CHANNELS * MAX_FIR_DELAY_SIZE) @@ -124,8 +133,9 @@ static int src_find_fs(int fs_list[], int list_length, int fs) }
/* Calculates buffers to allocate for a SRC mode */ -int src_buffer_lengths(struct src_param *a, int fs_in, int fs_out, int nch, - int frames, int frames_is_for_source) +int src_buffer_lengths(struct comp_dev *dev, struct src_param *a, int fs_in, + int fs_out, int nch, int frames, + int frames_is_for_source) { struct src_stage *stage1; struct src_stage *stage2; @@ -135,8 +145,8 @@ int src_buffer_lengths(struct src_param *a, int fs_in, int fs_out, int nch, int frames2;
if (nch > PLATFORM_MAX_CHANNELS) { - trace_src_error("che"); - tracev_value(nch); + trace_src_error(dev, "che"); + tracev_src_value(dev, nch); return -EINVAL; }
@@ -146,9 +156,9 @@ int src_buffer_lengths(struct src_param *a, int fs_in, int fs_out, int nch,
/* Check that both in and out rates are supported */ if (a->idx_in < 0 || a->idx_out < 0) { - trace_src_error("us1"); - tracev_value(fs_in); - tracev_value(fs_out); + trace_src_error(dev, "us1"); + tracev_src_value(dev, fs_in); + tracev_src_value(dev, fs_out); return -EINVAL; }
@@ -157,9 +167,9 @@ int src_buffer_lengths(struct src_param *a, int fs_in, int fs_out, int nch,
/* Check from stage1 parameter for a deleted in/out rate combination.*/ if (stage1->filter_length < 1) { - trace_src_error("us2"); - tracev_value(fs_in); - tracev_value(fs_out); + trace_src_error(dev, "us2"); + tracev_src_value(dev, fs_in); + tracev_src_value(dev, fs_out); return -EINVAL; }
@@ -542,11 +552,11 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp) struct sof_ipc_comp_src *ipc_src = (struct sof_ipc_comp_src *)comp; struct comp_data *cd;
- trace_src("new"); + trace_src(NULL, "new");
/* validate init data - either SRC sink or source rate must be set */ if (ipc_src->source_rate == 0 && ipc_src->sink_rate == 0) { - trace_src_error("sn1"); + trace_src_error(NULL, "sn1"); return NULL; }
@@ -579,7 +589,7 @@ static void src_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev);
- trace_src("fre"); + trace_src(dev, "fre");
/* Free dynamically reserved buffers for SRC algorithm */ if (!cd->delay_lines) @@ -607,7 +617,7 @@ static int src_params(struct comp_dev *dev) int frames_is_for_source; int q;
- trace_src("par"); + trace_src(dev, "par");
/* SRC supports S24_4LE and S32_LE formats */ switch (config->frame_fmt) { @@ -618,7 +628,7 @@ static int src_params(struct comp_dev *dev) cd->polyphase_func = src_polyphase_stage_cir; break; default: - trace_src_error("sr0"); + trace_src_error(dev, "sr0"); return -EINVAL; }
@@ -642,20 +652,21 @@ static int src_params(struct comp_dev *dev) }
/* Allocate needed memory for delay lines */ - err = src_buffer_lengths(&cd->param, source_rate, sink_rate, - params->channels, dev->frames, frames_is_for_source); + err = src_buffer_lengths(dev, &cd->param, source_rate, sink_rate, + params->channels, dev->frames, + frames_is_for_source); if (err < 0) { - trace_src_error("sr1"); - trace_error_value(source_rate); - trace_error_value(sink_rate); - trace_error_value(params->channels); - trace_error_value(dev->frames); + trace_src_error(dev, "sr1"); + trace_src_error_value(dev, source_rate); + trace_src_error_value(dev, sink_rate); + trace_src_error_value(dev, params->channels); + trace_src_error_value(dev, dev->frames); return err; }
delay_lines_size = sizeof(int32_t) * cd->param.total; if (delay_lines_size == 0) { - trace_src_error("sr2"); + trace_src_error(dev, "sr2"); return -EINVAL; }
@@ -666,8 +677,8 @@ static int src_params(struct comp_dev *dev) cd->delay_lines = rballoc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, delay_lines_size); if (!cd->delay_lines) { - trace_src_error("sr3"); - trace_error_value(delay_lines_size); + trace_src_error(dev, "sr3"); + trace_src_error_value(dev, delay_lines_size); return -EINVAL; }
@@ -698,7 +709,7 @@ static int src_params(struct comp_dev *dev) * requested rates combination. Sink audio will be * muted if copy() is run. */ - trace_src("SFa"); + trace_src(dev, "SFa"); cd->src_func = src_fallback; return -EINVAL; } @@ -721,9 +732,9 @@ static int src_params(struct comp_dev *dev) source_list); err = buffer_set_size(sink, q * dev->frames * dev->frame_bytes); if (err < 0) { - trace_src_error("eSz"); - trace_error_value(sink->alloc_size); - trace_error_value(q * dev->frames * dev->frame_bytes); + trace_src_error(dev, "eSz"); + trace_src_error_value(dev, sink->alloc_size); + trace_src_error_value(dev, q * dev->frames * dev->frame_bytes); return err; }
@@ -731,7 +742,7 @@ static int src_params(struct comp_dev *dev) source = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); if (source->size < cd->param.blk_in * dev->frame_bytes) { - trace_src_error("eSy"); + trace_src_error(dev, "eSy"); return -EINVAL; }
@@ -740,7 +751,7 @@ static int src_params(struct comp_dev *dev)
static int src_ctrl_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { - trace_src_error("ec1"); + trace_src_error(dev, "ec1"); return -EINVAL; }
@@ -750,7 +761,7 @@ static int src_cmd(struct comp_dev *dev, int cmd, void *data) struct sof_ipc_ctrl_data *cdata = data; int ret = 0;
- trace_src("cmd"); + trace_src(dev, "cmd");
if (cmd == COMP_CMD_SET_VALUE) ret = src_ctrl_cmd(dev, cdata); @@ -760,7 +771,7 @@ static int src_cmd(struct comp_dev *dev, int cmd, void *data)
static int src_trigger(struct comp_dev *dev, int cmd) { - trace_src("trg"); + trace_src(dev, "trg");
return comp_set_state(dev, cmd); } @@ -776,7 +787,7 @@ static int src_copy(struct comp_dev *dev) size_t consumed = 0; size_t produced = 0;
- trace_src("SRC"); + trace_src(dev, "SRC");
/* src component needs 1 source and 1 sink buffer */ source = list_first_item(&dev->bsource_list, struct comp_buffer, @@ -799,18 +810,18 @@ static int src_copy(struct comp_dev *dev) * check for XRUNs. */ if (source->avail < need_source) { - trace_src_error("xru"); + trace_src_error(dev, "xru"); return -EIO; /* xrun */ } if (sink->free < need_sink) { - trace_src_error("xro"); + trace_src_error(dev, "xro"); return -EIO; /* xrun */ }
cd->src_func(dev, source, sink, &consumed, &produced);
- tracev_value(consumed >> 3); - tracev_value(produced >> 3); + tracev_src_value(dev, consumed >> 3); + tracev_src_value(dev, produced >> 3);
/* Calc new free and available if data was processed. These * functions must not be called with 0 consumed/produced. @@ -829,7 +840,7 @@ static int src_copy(struct comp_dev *dev)
static int src_prepare(struct comp_dev *dev) { - trace_src("pre"); + trace_src(dev, "pre");
return comp_set_state(dev, COMP_TRIGGER_PREPARE); } @@ -838,7 +849,7 @@ static int src_reset(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev);
- trace_src("SRe"); + trace_src(dev, "SRe");
cd->src_func = src_2s_s32_default; src_polyphase_reset(&cd->src); diff --git a/src/audio/src.h b/src/audio/src.h index 5268a66..a78bcc5 100644 --- a/src/audio/src.h +++ b/src/audio/src.h @@ -119,8 +119,9 @@ void src_polyphase_stage_cir(struct src_stage_prm *s);
void src_polyphase_stage_cir_s24(struct src_stage_prm *s);
-int src_buffer_lengths(struct src_param *p, int fs_in, int fs_out, int nch, - int frames, int frames_is_for_source); +int src_buffer_lengths(struct comp_dev *dev, struct src_param *p, int fs_in, + int fs_out, int nch, int frames, + int frames_is_for_source);
int32_t src_input_rates(void);
From: Yan Wang yan.wang@linux.intel.com
It will use IPC trace class and global DMA trace API.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/include/sof/ipc.h | 13 ++++++++++--- src/ipc/handler.c | 24 ++++++++++++------------ src/ipc/ipc.c | 16 ++++++++-------- 3 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/src/include/sof/ipc.h b/src/include/sof/ipc.h index 67cf25f..d8ac1bb 100644 --- a/src/include/sof/ipc.h +++ b/src/include/sof/ipc.h @@ -45,9 +45,16 @@ struct sof; struct dai_config;
-#define trace_ipc(__e) trace_event(TRACE_CLASS_IPC, __e) -#define tracev_ipc(__e) tracev_event(TRACE_CLASS_IPC, __e) -#define trace_ipc_error(__e) trace_error(TRACE_CLASS_IPC, __e) +#define trace_ipc(__e) \ + trace_global_event(NORMAL_LEVEL, TRACE_CLASS_IPC, __e) +#define tracev_ipc(__e) \ + trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_IPC, __e) +#define trace_ipc_error(__e) \ + trace_global_event(ERROR_LEVEL, TRACE_CLASS_IPC, __e) +#define trace_ipc_value(x) \ + trace_global_value(NORMAL_LEVEL, x) +#define trace_ipc_error_value(x) \ + trace_global_value(ERROR_LEVEL, x)
#define MSG_QUEUE_SIZE 12
diff --git a/src/ipc/handler.c b/src/ipc/handler.c index 41290ca..4dc0ffe 100644 --- a/src/ipc/handler.c +++ b/src/ipc/handler.c @@ -110,14 +110,14 @@ static int ipc_stream_pcm_params(uint32_t stream) pcm_dev = ipc_get_comp(_ipc, pcm_params->comp_id); if (pcm_dev == NULL) { trace_ipc_error("eAC"); - trace_error_value(pcm_params->comp_id); + trace_ipc_error_value(pcm_params->comp_id); return -EINVAL; }
/* sanity check comp */ if (pcm_dev->cd->pipeline == NULL) { trace_ipc_error("eA1"); - trace_error_value(pcm_params->comp_id); + trace_ipc_error_value(pcm_params->comp_id); return -EINVAL; }
@@ -224,7 +224,7 @@ static int ipc_stream_pcm_free(uint32_t header) /* sanity check comp */ if (pcm_dev->cd->pipeline == NULL) { trace_ipc_error("eF1"); - trace_error_value(free_req->comp_id); + trace_ipc_error_value(free_req->comp_id); return -EINVAL; }
@@ -343,7 +343,7 @@ static int ipc_stream_trigger(uint32_t header) ret = pipeline_trigger(pcm_dev->cd->pipeline, pcm_dev->cd, cmd); if (ret < 0) { trace_ipc_error("eRc"); - trace_error_value(ipc_cmd); + trace_ipc_error_value(ipc_cmd); }
return ret; @@ -389,8 +389,8 @@ static int ipc_dai_config(uint32_t header) dai = dai_get(config->type, config->id); if (dai == NULL) { trace_ipc_error("eDi"); - trace_error_value(config->type); - trace_error_value(config->id); + trace_ipc_error_value(config->type); + trace_ipc_error_value(config->id); return -ENODEV; }
@@ -416,7 +416,7 @@ static int ipc_glb_dai_message(uint32_t header) //return ipc_comp_set_value(header, COMP_CMD_LOOPBACK); default: trace_ipc_error("eDc"); - trace_error_value(header); + trace_ipc_error_value(header); return -EINVAL; } } @@ -651,7 +651,7 @@ static int ipc_glb_debug_message(uint32_t header) return ipc_dma_trace_levels(header); default: trace_ipc_error("eDc"); - trace_error_value(header); + trace_ipc_error_value(header); return -EINVAL; } } @@ -673,7 +673,7 @@ static int ipc_comp_value(uint32_t header, uint32_t cmd) comp_dev = ipc_get_comp(_ipc, data->comp_id); if (comp_dev == NULL){ trace_ipc_error("eVg"); - trace_error_value(data->comp_id); + trace_ipc_error_value(data->comp_id); return -ENODEV; } @@ -704,7 +704,7 @@ static int ipc_glb_comp_message(uint32_t header) return ipc_comp_value(header, COMP_CMD_GET_DATA); default: trace_ipc_error("eCc"); - trace_error_value(header); + trace_ipc_error_value(header); return -EINVAL; } } @@ -833,7 +833,7 @@ static int ipc_glb_tplg_message(uint32_t header) return ipc_glb_tplg_free(header, ipc_buffer_free); default: trace_ipc_error("eTc"); - trace_error_value(header); + trace_ipc_error_value(header); return -EINVAL; } } @@ -874,7 +874,7 @@ int ipc_cmd(void) return ipc_glb_debug_message(hdr->cmd); default: trace_ipc_error("eGc"); - trace_error_value(type); + trace_ipc_error_value(type); return -EINVAL; } } diff --git a/src/ipc/ipc.c b/src/ipc/ipc.c index d613d1f..026501f 100644 --- a/src/ipc/ipc.c +++ b/src/ipc/ipc.c @@ -143,7 +143,7 @@ int ipc_comp_new(struct ipc *ipc, struct sof_ipc_comp *comp) icd = ipc_get_comp(ipc, comp->id); if (icd != NULL) { trace_ipc_error("eCe"); - trace_error_value(comp->id); + trace_ipc_error_value(comp->id); return -EINVAL; }
@@ -197,7 +197,7 @@ int ipc_buffer_new(struct ipc *ipc, struct sof_ipc_buffer *desc) ibd = ipc_get_comp(ipc, desc->comp.id); if (ibd != NULL) { trace_ipc_error("eBe"); - trace_error_value(desc->comp.id); + trace_ipc_error_value(desc->comp.id); return -EINVAL; }
@@ -250,14 +250,14 @@ int ipc_comp_connect(struct ipc *ipc, icd_source = ipc_get_comp(ipc, connect->source_id); if (icd_source == NULL) { trace_ipc_error("eCr"); - trace_error_value(connect->source_id); + trace_ipc_error_value(connect->source_id); return -EINVAL; }
icd_sink = ipc_get_comp(ipc, connect->sink_id); if (icd_sink == NULL) { trace_ipc_error("eCn"); - trace_error_value(connect->sink_id); + trace_ipc_error_value(connect->sink_id); return -EINVAL; }
@@ -272,8 +272,8 @@ int ipc_comp_connect(struct ipc *ipc, icd_source->cd, icd_sink->cb); else { trace_ipc_error("eCt"); - trace_error_value(connect->source_id); - trace_error_value(connect->sink_id); + trace_ipc_error_value(connect->source_id); + trace_ipc_error_value(connect->sink_id); return -EINVAL; } } @@ -290,7 +290,7 @@ int ipc_pipeline_new(struct ipc *ipc, ipc_pipe = ipc_get_comp(ipc, pipe_desc->comp_id); if (ipc_pipe != NULL) { trace_ipc_error("ePi"); - trace_error_value(pipe_desc->comp_id); + trace_ipc_error_value(pipe_desc->comp_id); return -EINVAL; }
@@ -298,7 +298,7 @@ int ipc_pipeline_new(struct ipc *ipc, icd = ipc_get_comp(ipc, pipe_desc->sched_id); if (icd == NULL) { trace_ipc_error("ePs"); - trace_error_value(pipe_desc->sched_id); + trace_ipc_error_value(pipe_desc->sched_id); return -EINVAL; } if (icd->type != COMP_TYPE_COMPONENT) {
On Thu, 2018-05-10 at 19:31 +0800, sound-open-firmware-bounces@alsa-project.org wrote:
From: Yan Wang yan.wang@linux.intel.com
Yan, mailing list has screwed up the sender on this series. Can you resend after addressing comments.
This patch set is only for review. This patch set is tested on CNL no-codec only currently.
User could check current trace level status like the following: cat /sys/kernel/debug/sof/trace_level irq >> 1 ipc >> 1 dma >> 1 ssp >> 1 wait >> 1 lock >> 1 mem >> 1 value >> 1 PIPELINE.2.SSP2.IN >> 1 SSP2.IN >> 1 BUF2.0 >> 1 PCM0C >> 0 PIPELINE.1.SSP2.OUT >> 1 SSP2.OUT >> 1 BUF1.0 >> 1 PCM0P >> 1
Ok, so I'd expect NOT to see any ">>" in the output here.
It includes trace levels of global trace types and loaded widgets.
When level = 0, only error trace will be enabled. When level = 1, error and normal trace will be enabled. When level = 2, all trace including verbose trace will be enabled.
In general the higher the number, the more trace.
Set trace level like the following: echo PCM0C 0 > /sys/kernel/debug/sof/trace_level
we need to do
echo PCM0C trace=0 > /sys/kernel/debug/sof/trace_level
as we will want to add more trace flags i.e.
echo PCM0C rpos=1,wpos=1 > /sys/kernel/debug/sof/trace_level
will trace the reader and writer position (not implemented)
Liam
will disable the trace of capture host component of fw pipeline.
In the future, more module information will bind with trace.
Yan Wang (29): Define IPC message type and data structure for trace level. Add utility functions and variable for DMA trace level control. Add trace level variable and set function for SOF modules. Add trace level IPC message processing logic. Change trace macro definition and API for trace level checking. Change macro definition and trace calling for dma-trace.c Change macro definition and trace calling for dma-copy.c Change macro definition and trace calling for alloc.c Change macro definition and trace calling for agent.c Change macro definition and trace calling for schdule module. Change macro definition and trace calling for wait.h Change macro definition and trace calling for SSP. Change macro definition and trace calling for dw-dma.c Change macro definition and trace calling for hda-dma.c Change macro definition and trace calling for interrupt.h Change macro definition and trace calling for comp_dev. Change macro definition and trace calling for comp_buffer. Change macro definition and trace calling for pipeline. Change macro definition and trace calling for dai. Change macro definition and trace calling for volume. Change macro definition and trace calling for switch. Change macro definition and trace calling for tone. Change macro definition and trace calling for mixer. Change macro definition and trace calling for host. Change macro definition and trace calling for mux. Change macro definition and trace calling for eq_fir. Change macro definition and trace calling for eq_iir. Change macro definition and trace calling for src. Change macro definition and trace calling for IPC.
src/audio/buffer.c | 13 +-- src/audio/component.c | 31 +++--- src/audio/dai.c | 80 +++++++++------- src/audio/eq_fir.c | 63 ++++++------ src/audio/eq_iir.c | 63 ++++++------ src/audio/host.c | 71 ++++++++------ src/audio/mixer.c | 39 +++++--- src/audio/mux.c | 17 +++- src/audio/pipeline.c | 191 +++++++++++++++++++----------------- src/audio/pipeline_static.c | 2 +- src/audio/src.c | 97 ++++++++++--------- src/audio/src.h | 5 +- src/audio/switch.c | 17 +++- src/audio/tone.c | 79 ++++++++------- src/audio/volume.c | 121 ++++++++++++----------- src/drivers/apl-ssp.c | 29 +++--- src/drivers/byt-ssp.c | 7 +- src/drivers/dw-dma.c | 25 +++-- src/drivers/hda-dma.c | 44 +++++---- src/include/sof/audio/buffer.h | 41 +++++--- src/include/sof/audio/component.h | 34 ++++--- src/include/sof/audio/pipeline.h | 18 +++- src/include/sof/dma-trace.h | 7 ++ src/include/sof/interrupt.h | 12 ++- src/include/sof/ipc.h | 18 +++- src/include/sof/schedule.h | 10 ++ src/include/sof/ssp.h | 14 ++- src/include/sof/trace.h | 197 +++++++++++++++++++++++++++++------
src/include/sof/wait.h | 21 +++- src/include/uapi/ipc.h | 25 +++++ src/ipc/dma-copy.c | 13 ++- src/ipc/handler.c | 54 ++++++++--- src/ipc/ipc.c | 50 ++++++++-- src/lib/agent.c | 12 ++- src/lib/alloc.c | 18 +++- src/lib/dma-trace.c | 83 +++++++++++++++- src/lib/schedule.c | 20 ++-- src/lib/trace.c | 101 +++++++++++++++++++ 38 files changed, 1173 insertions(+), 569 deletions(-)
--------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
On Thu, 2018-05-10 at 20:49 +0100, Liam Girdwood wrote:
On Thu, 2018-05-10 at 19:31 +0800, sound-open-firmware-bounces@alsa-p roject.org wrote:
From: Yan Wang yan.wang@linux.intel.com
Yan, mailing list has screwed up the sender on this series. Can you resend after addressing comments.
I can resend it.
This patch set is only for review. This patch set is tested on CNL no-codec only currently.
User could check current trace level status like the following: cat /sys/kernel/debug/sof/trace_level irq >> 1 ipc >> 1 dma >> 1 ssp >> 1 wait >> 1 lock >> 1 mem >> 1 value >> 1 PIPELINE.2.SSP2.IN >> 1 SSP2.IN >> 1 BUF2.0 >> 1 PCM0C >> 0 PIPELINE.1.SSP2.OUT >> 1 SSP2.OUT >> 1 BUF1.0 >> 1 PCM0P >> 1
Ok, so I'd expect NOT to see any ">>" in the output here.
Sorry for this. I can remove it in kernel driver code.
It includes trace levels of global trace types and loaded widgets.
When level = 0, only error trace will be enabled. When level = 1, error and normal trace will be enabled. When level = 2, all trace including verbose trace will be enabled.
In general the higher the number, the more trace.
Yes. Now it is.
Set trace level like the following: echo PCM0C 0 > /sys/kernel/debug/sof/trace_level
we need to do
echo PCM0C trace=0 > /sys/kernel/debug/sof/trace_level
I can change it in kernel driver code.
as we will want to add more trace flags i.e.
echo PCM0C rpos=1,wpos=1 > /sys/kernel/debug/sof/trace_level
will trace the reader and writer position (not implemented)
Could you clarify more detail for rpos and wpos? I can add it in the next version patch set. Thanks.
Yan Wang
Liam
will disable the trace of capture host component of fw pipeline.
In the future, more module information will bind with trace.
Yan Wang (29): Define IPC message type and data structure for trace level. Add utility functions and variable for DMA trace level control. Add trace level variable and set function for SOF modules. Add trace level IPC message processing logic. Change trace macro definition and API for trace level checking. Change macro definition and trace calling for dma-trace.c Change macro definition and trace calling for dma-copy.c Change macro definition and trace calling for alloc.c Change macro definition and trace calling for agent.c Change macro definition and trace calling for schdule module. Change macro definition and trace calling for wait.h Change macro definition and trace calling for SSP. Change macro definition and trace calling for dw-dma.c Change macro definition and trace calling for hda-dma.c Change macro definition and trace calling for interrupt.h Change macro definition and trace calling for comp_dev. Change macro definition and trace calling for comp_buffer. Change macro definition and trace calling for pipeline. Change macro definition and trace calling for dai. Change macro definition and trace calling for volume. Change macro definition and trace calling for switch. Change macro definition and trace calling for tone. Change macro definition and trace calling for mixer. Change macro definition and trace calling for host. Change macro definition and trace calling for mux. Change macro definition and trace calling for eq_fir. Change macro definition and trace calling for eq_iir. Change macro definition and trace calling for src. Change macro definition and trace calling for IPC.
src/audio/buffer.c | 13 +-- src/audio/component.c | 31 +++--- src/audio/dai.c | 80 +++++++++------- src/audio/eq_fir.c | 63 ++++++------ src/audio/eq_iir.c | 63 ++++++------ src/audio/host.c | 71 ++++++++------ src/audio/mixer.c | 39 +++++--- src/audio/mux.c | 17 +++- src/audio/pipeline.c | 191 +++++++++++++++++++-------
src/audio/pipeline_static.c | 2 +- src/audio/src.c | 97 ++++++++++--------- src/audio/src.h | 5 +- src/audio/switch.c | 17 +++- src/audio/tone.c | 79 ++++++++------- src/audio/volume.c | 121 ++++++++++++----------- src/drivers/apl-ssp.c | 29 +++--- src/drivers/byt-ssp.c | 7 +- src/drivers/dw-dma.c | 25 +++-- src/drivers/hda-dma.c | 44 +++++---- src/include/sof/audio/buffer.h | 41 +++++--- src/include/sof/audio/component.h | 34 ++++--- src/include/sof/audio/pipeline.h | 18 +++- src/include/sof/dma-trace.h | 7 ++ src/include/sof/interrupt.h | 12 ++- src/include/sof/ipc.h | 18 +++- src/include/sof/schedule.h | 10 ++ src/include/sof/ssp.h | 14 ++- src/include/sof/trace.h | 197
+++++++++++++++++++++++++++++------
src/include/sof/wait.h | 21 +++- src/include/uapi/ipc.h | 25 +++++ src/ipc/dma-copy.c | 13 ++- src/ipc/handler.c | 54 ++++++++--- src/ipc/ipc.c | 50 ++++++++-- src/lib/agent.c | 12 ++- src/lib/alloc.c | 18 +++- src/lib/dma-trace.c | 83 +++++++++++++++- src/lib/schedule.c | 20 ++-- src/lib/trace.c | 101 +++++++++++++++++++ 38 files changed, 1173 insertions(+), 569 deletions(-)
Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. _______________________________________________ Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
On Fri, 2018-05-11 at 11:42 +0800, yanwang wrote:
as we will want to add more trace flags i.e. echo PCM0C rpos=1,wpos=1 > /sys/kernel/debug/sof/trace_level will trace the reader and writer position (not implemented)
Could you clarify more detail for rpos and wpos? I can add it in the next version patch set. Thanks.
Hi, Liam, Could you clarify it? Thanks.
Yan Wang
Yan Wang
On Mon, 2018-05-14 at 15:02 +0800, yanwang wrote:
On Fri, 2018-05-11 at 11:42 +0800, yanwang wrote:
as we will want to add more trace flags i.e.
echo PCM0C rpos=1,wpos=1 > /sys/kernel/debug/sof/trace_level
will trace the reader and writer position (not implemented)
Could you clarify more detail for rpos and wpos? I can add it in the next version patch set.
The point here is that we should allow for more than one type of trace data type and class in our debugFS API and IPC ABI. We ned to be flexable with types and class of data from kernel and IPC.
Liam
Thanks.
Hi, Liam, Could you clarify it? Thanks.
Yan Wang
Yan Wang
On 5/17/2018 9:57 PM, Liam Girdwood wrote:
On Mon, 2018-05-14 at 15:02 +0800, yanwang wrote:
On Fri, 2018-05-11 at 11:42 +0800, yanwang wrote:
as we will want to add more trace flags i.e.
echo PCM0C rpos=1,wpos=1 > /sys/kernel/debug/sof/trace_level
will trace the reader and writer position (not implemented)
Could you clarify more detail for rpos and wpos? I can add it in the next version patch set.
The point here is that we should allow for more than one type of trace data type and class in our debugFS API and IPC ABI. We ned to be flexable with types and class of data from kernel and IPC.
Sure. I will add it. I think I also need add rpos and wpos previously. Thanks.
Yan Wang
Liam
Thanks.
Hi, Liam, Could you clarify it? Thanks.
Yan Wang
Yan Wang
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
participants (6)
-
Liam Girdwood
-
Liam Girdwood
-
Ranjani Sridharan
-
Yan Wang
-
yan.wang@linux.intel.com
-
yanwang