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