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) {