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