From b2ff4e194a3c3663942ca32850b6abc58fc45856 Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Thu, 13 Feb 2020 16:59:47 +0100 Subject: [PATCH 01/10] trace: host: fix inconsistent trace deps Depending on the header files include order some files may not compile. Note: trace header deps need a closer look and cleanup. Signed-off-by: Marcin Maka --- src/include/sof/trace/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/sof/trace/trace.h b/src/include/sof/trace/trace.h index 30745dc99496..eae01c8ba960 100644 --- a/src/include/sof/trace/trace.h +++ b/src/include/sof/trace/trace.h @@ -15,7 +15,7 @@ "Add it to CMake's target with sof_append_relative_path_definitions." #endif -#if CONFIG_TRACE +#if !CONFIG_LIBRARY && CONFIG_TRACE #include #endif #include From 2ff612ab848bb85e50f5eae5c334a4e4c37258f5 Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Tue, 11 Feb 2020 12:05:34 +0100 Subject: [PATCH 02/10] trace: add base macros for err,info,dbg levels New macros use well known (also by checkpatch) trace level names and map them to underlying trace_ implementation. They can be used to define comp_err(), pipe_err(), etc. derivatives with properly defined get_id_m(), get_subid_m(). Signed-off-by: Marcin Maka --- src/include/sof/trace/trace.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/include/sof/trace/trace.h b/src/include/sof/trace/trace.h index eae01c8ba960..62218eacd1f0 100644 --- a/src/include/sof/trace/trace.h +++ b/src/include/sof/trace/trace.h @@ -376,6 +376,31 @@ do { \ trace_unused(class, id_0, id_1, format, ##__VA_ARGS__) #endif +/* tracing from device (component, pipeline, dai, ...) */ + +/** \brief Trace from a device on err level. + * + * \param class Trace class, one of TRACE_CLASS_... + * \param get_id_m Macro that can retrieve device's id0 from the dev + * \param get_subid_m Macro that can retrieve device's id1 from the dev + * \param dev Device + * \param fmt Format followed by parameters + */ +#define trace_dev_err(class, get_id_m, get_subid_m, dev, fmt, ...) \ + trace_error_with_ids(class, get_id_m(dev), get_subid_m(dev), fmt, \ + ##__VA_ARGS__) + +/** \brief Trace from a device on info level. */ +#define trace_dev_info(class, get_id_m, get_subid_m, dev, fmt, ...) \ + trace_event_with_ids(class, get_id_m(dev), get_subid_m(dev), fmt, \ + ##__VA_ARGS__) + +/** \brief Trace from a device on dbg level. */ +#define trace_dev_dbg(class, get_id_m, get_subid_m, dev, fmt, ...) \ + tracev_event_with_ids(class, get_id_m(dev), get_subid_m(dev), fmt, \ + ##__VA_ARGS__) + +/* TODO: remove component specific macros from global header */ /* tracing from component */ #define _trace_comp_build(fun, class, comp_ptr, format, ...) \ fun(class, comp_ptr->comp.pipeline_id, \ @@ -387,5 +412,4 @@ do { \ ##__VA_ARGS__) #define trace_error_comp(...) _trace_comp_build(trace_error_with_ids, \ ##__VA_ARGS__) - #endif /* __SOF_TRACE_TRACE_H__ */ From cb1b9af59c73346090bde19600c5ec5b52a25455 Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Tue, 11 Feb 2020 12:49:04 +0100 Subject: [PATCH 03/10] trace: pipeline: use err,info,dbg macros Both class and instance macro set switched to err,info,dbg version. Signed-off-by: Marcin Maka --- src/audio/pipeline.c | 124 +++++++++++++------------------ src/audio/pipeline_static.c | 2 +- src/include/sof/audio/pipeline.h | 50 +++++++------ 3 files changed, 81 insertions(+), 95 deletions(-) diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 625c27a17a02..5ec151688cbc 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -44,12 +44,12 @@ struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc, struct pipeline *p; int ret; - trace_pipe("pipeline_new()"); + pipe_cl_info("pipeline_new()"); /* allocate new pipeline */ p = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, sizeof(*p)); if (!p) { - trace_pipe_error("pipeline_new() error: Out of Memory"); + pipe_cl_err("pipeline_new() error: Out of Memory"); return NULL; } @@ -71,8 +71,8 @@ int pipeline_connect(struct comp_dev *comp, struct comp_buffer *buffer, { uint32_t flags; - trace_pipe("pipeline: connect comp %d and buffer %d", - comp->comp.id, buffer->id); + pipe_cl_info("pipeline: connect comp %d and buffer %d", + comp->comp.id, buffer->id); irq_local_disable(flags); list_item_prepend(buffer_comp_list(buffer, dir), @@ -130,13 +130,11 @@ static int pipeline_comp_complete(struct comp_dev *current, void *data, { struct pipeline_data *ppl_data = data; - tracev_pipe_with_ids(ppl_data->p, "pipeline_comp_complete(), " - "current->comp.id = %u, dir = %u", - current->comp.id, dir); + pipe_dbg(ppl_data->p, "pipeline_comp_complete(), current->comp.id = %u, dir = %u", + current->comp.id, dir); if (!comp_is_single_pipeline(current, ppl_data->start)) { - tracev_pipe_with_ids(ppl_data->p, "pipeline_comp_complete(), " - "current is from another pipeline"); + pipe_dbg(ppl_data->p, "pipeline_comp_complete(), current is from another pipeline"); return 0; } @@ -154,12 +152,11 @@ int pipeline_complete(struct pipeline *p, struct comp_dev *source, { struct pipeline_data data; - trace_pipe_with_ids(p, "pipeline_complete()"); + pipe_info(p, "pipeline_complete()"); /* check whether pipeline is already completed */ if (p->status != COMP_STATE_INIT) { - trace_pipe_error_with_ids(p, "pipeline_complete() error: " - "Pipeline already completed"); + pipe_err(p, "pipeline_complete() error: Pipeline already completed"); return -EINVAL; } @@ -186,12 +183,11 @@ static int pipeline_comp_free(struct comp_dev *current, void *data, int dir) struct pipeline_data *ppl_data = data; uint32_t flags; - tracev_pipe("pipeline_comp_free(), current->comp.id = %u, dir = %u", + pipe_cl_dbg("pipeline_comp_free(), current->comp.id = %u, dir = %u", current->comp.id, dir); if (!comp_is_single_pipeline(current, ppl_data->start)) { - tracev_pipe("pipeline_comp_free(), " - "current is from another pipeline"); + pipe_cl_dbg("pipeline_comp_free(), current is from another pipeline"); return 0; } @@ -214,15 +210,14 @@ int pipeline_free(struct pipeline *p) { struct pipeline_data data; - trace_pipe_with_ids(p, "pipeline_free()"); + pipe_info(p, "pipeline_free()"); /* make sure we are not in use */ if (p->source_comp) { if (p->source_comp->state > COMP_STATE_READY) { - trace_pipe_error_with_ids(p, "pipeline_free() error: " - "Pipeline in use, %u, %u", - p->source_comp->comp.id, - p->source_comp->state); + pipe_err(p, "pipeline_free() error: Pipeline in use, %u, %u", + p->source_comp->comp.id, + p->source_comp->state); return -EBUSY; } @@ -318,7 +313,7 @@ static int pipeline_comp_params(struct comp_dev *current, void *data, int dir) int end_type; int err = 0; - tracev_pipe("pipeline_comp_params(), current->comp.id = %u, dir = %u", + pipe_cl_dbg("pipeline_comp_params(), current->comp.id = %u, dir = %u", current->comp.id, dir); if (!comp_is_single_pipeline(current, ppl_data->start)) { @@ -381,15 +376,15 @@ int pipeline_params(struct pipeline *p, struct comp_dev *host, struct pipeline_data data; int ret; - trace_pipe_with_ids(p, "pipeline_params()"); + pipe_info(p, "pipeline_params()"); data.params = params; data.start = host; ret = pipeline_comp_params(host, &data, params->params.direction); if (ret < 0) { - trace_pipe_error("pipeline_params() error: ret = %d, host->" - "comp.id = %u", ret, host->comp.id); + pipe_cl_err("pipeline_params() error: ret = %d, host->comp.id = %u", + ret, host->comp.id); } return ret; @@ -431,8 +426,7 @@ static int pipeline_comp_task_init(struct pipeline *p) p->pipe_task = pipeline_task_init(p, type, pipeline_task); if (!p->pipe_task) { - trace_pipe_error("pipeline_prepare() error: task init " - "failed"); + pipe_cl_err("pipeline_prepare() error: task init failed"); return -ENOMEM; } } @@ -447,7 +441,7 @@ static int pipeline_comp_prepare(struct comp_dev *current, void *data, int dir) int stream_direction = dir; int end_type; - tracev_pipe("pipeline_comp_prepare(), current->comp.id = %u, dir = %u", + pipe_cl_dbg("pipeline_comp_prepare(), current->comp.id = %u, dir = %u", current->comp.id, dir); if (!comp_is_single_pipeline(current, ppl_data->start)) { @@ -489,14 +483,14 @@ int pipeline_prepare(struct pipeline *p, struct comp_dev *dev) struct pipeline_data ppl_data; int ret = 0; - trace_pipe_with_ids(p, "pipeline_prepare()"); + pipe_info(p, "pipeline_prepare()"); ppl_data.start = dev; ret = pipeline_comp_prepare(dev, &ppl_data, dev->direction); if (ret < 0) { - trace_pipe_error("pipeline_prepare() error: ret = %d," - "dev->comp.id = %u", ret, dev->comp.id); + pipe_cl_err("pipeline_prepare() error: ret = %d, dev->comp.id = %u", + ret, dev->comp.id); return ret; } @@ -544,15 +538,14 @@ static int pipeline_comp_trigger(struct comp_dev *current, void *data, int dir) ppl_data->start->pipeline); int err; - tracev_pipe("pipeline_comp_trigger(), current->comp.id = %u, dir = %u", + pipe_cl_dbg("pipeline_comp_trigger(), current->comp.id = %u, dir = %u", current->comp.id, dir); /* trigger should propagate to the connected pipelines, * which need to be scheduled together */ if (!is_single_ppl && !is_same_sched) { - tracev_pipe_with_ids(current->pipeline, "pipeline_comp_trigger" - "(), current is from another pipeline"); + pipe_dbg(current->pipeline, "pipeline_comp_trigger(), current is from another pipeline"); return 0; } @@ -587,12 +580,11 @@ static int pipeline_xrun_handle_trigger(struct pipeline *p, int cmd) switch (cmd) { case COMP_TRIGGER_START: /* in xrun, prepare before trigger start needed */ - trace_pipe_with_ids(p, "in xrun, prepare it first"); + pipe_info(p, "in xrun, prepare it first"); /* prepare the pipeline */ ret = pipeline_prepare(p, p->source_comp); if (ret < 0) { - trace_pipe_error_with_ids(p, "prepare error: ret = %d", - ret); + pipe_err(p, "prepare error: ret = %d", ret); return ret; } /* now ready for start, clear xrun_bytes */ @@ -600,7 +592,7 @@ static int pipeline_xrun_handle_trigger(struct pipeline *p, int cmd) break; case COMP_TRIGGER_STOP: /* in xrun, suppose pipeline is already stopped, ignore it */ - trace_pipe_with_ids(p, "already stopped in xrun"); + pipe_info(p, "already stopped in xrun"); /* no more further trigger stop needed */ ret = PPL_STATUS_PATH_STOP; break; @@ -617,14 +609,13 @@ int pipeline_trigger(struct pipeline *p, struct comp_dev *host, int cmd) struct pipeline_data data; int ret; - trace_pipe_with_ids(p, "pipeline_trigger()"); + pipe_info(p, "pipeline_trigger()"); /* handle pipeline global checks before going into each components */ if (p->xrun_bytes) { ret = pipeline_xrun_handle_trigger(p, cmd); if (ret < 0) { - trace_pipe_error_with_ids(p, "xrun handle error: " - "ret = %d", ret); + pipe_err(p, "xrun handle error: ret = %d", ret); return ret; } else if (ret == PPL_STATUS_PATH_STOP) /* no further action needed*/ @@ -636,9 +627,8 @@ int pipeline_trigger(struct pipeline *p, struct comp_dev *host, int cmd) ret = pipeline_comp_trigger(host, &data, host->direction); if (ret < 0) { - trace_ipc_error("pipeline_trigger() error: ret = %d, host->" - "comp.id = %u, cmd = %d", ret, host->comp.id, - cmd); + pipe_cl_err("pipeline_trigger() error: ret = %d, host->comp.id = %u, cmd = %d", + ret, host->comp.id, cmd); } return ret; @@ -651,7 +641,7 @@ static int pipeline_comp_reset(struct comp_dev *current, void *data, int dir) int end_type; int err = 0; - tracev_pipe("pipeline_comp_reset(), current->comp.id = %u, dir = %u", + pipe_cl_dbg("pipeline_comp_reset(), current->comp.id = %u, dir = %u", current->comp.id, dir); if (!comp_is_single_pipeline(current, p->source_comp)) { @@ -688,12 +678,12 @@ int pipeline_reset(struct pipeline *p, struct comp_dev *host) { int ret = 0; - trace_pipe_with_ids(p, "pipeline_reset()"); + pipe_info(p, "pipeline_reset()"); ret = pipeline_comp_reset(host, p, host->direction); if (ret < 0) { - trace_pipe_error("pipeline_reset() error: ret = %d, host->comp." - "id = %u", ret, host->comp.id); + pipe_cl_err("pipeline_reset() error: ret = %d, host->comp.id = %u", + ret, host->comp.id); } return ret; @@ -705,17 +695,16 @@ static int pipeline_comp_copy(struct comp_dev *current, void *data, int dir) int is_single_ppl = comp_is_single_pipeline(current, ppl_data->start); int err; - tracev_pipe("pipeline_comp_copy(), current->comp.id = %u, dir = %u", + pipe_cl_dbg("pipeline_comp_copy(), current->comp.id = %u, dir = %u", current->comp.id, dir); if (!is_single_ppl) { - tracev_pipe("pipeline_comp_copy(), current is from another " - "pipeline and can't be scheduled together"); + pipe_cl_dbg("pipeline_comp_copy(), current is from another pipeline and can't be scheduled together"); return 0; } if (!comp_is_active(current)) { - tracev_pipe("pipeline_comp_copy(), current is not active"); + pipe_cl_dbg("pipeline_comp_copy(), current is not active"); return 0; } @@ -762,9 +751,8 @@ static int pipeline_copy(struct pipeline *p) ret = pipeline_comp_copy(start, &data, dir); if (ret < 0) - trace_pipe_error("pipeline_copy() error: ret = %d, start" - "->comp.id = %u, dir = %u", ret, - start->comp.id, dir); + pipe_cl_err("pipeline_copy() error: ret = %d, start->comp.id = %u, dir = %u", + ret, start->comp.id, dir); return ret; } @@ -778,8 +766,7 @@ static int pipeline_comp_timestamp(struct comp_dev *current, void *data, struct pipeline_data *ppl_data = data; if (!comp_is_active(current)) { - tracev_pipe("pipeline_comp_timestamp(), " - "current is not active"); + pipe_cl_dbg("pipeline_comp_timestamp(), current is not active"); return 0; } @@ -847,9 +834,8 @@ void pipeline_xrun(struct pipeline *p, struct comp_dev *dev, /* notify all pipeline comps we are in XRUN, and stop copying */ ret = pipeline_trigger(p, p->source_comp, COMP_TRIGGER_XRUN); if (ret < 0) - trace_pipe_error_with_ids(p, "pipeline_xrun() error: " - "Pipelines notification about XRUN " - "failed, ret = %d", ret); + pipe_err(p, "pipeline_xrun() error: Pipelines notification about XRUN failed, ret = %d", + ret); memset(&posn, 0, sizeof(posn)); p->xrun_bytes = bytes; @@ -873,14 +859,13 @@ static int pipeline_xrun_recover(struct pipeline *p) { int ret; - trace_pipe_error_with_ids(p, "pipeline_xrun_recover()"); + pipe_err(p, "pipeline_xrun_recover()"); /* prepare the pipeline */ ret = pipeline_prepare(p, p->source_comp); if (ret < 0) { - trace_pipe_error_with_ids(p, "pipeline_xrun_recover() error: " - "pipeline_prepare() failed, " - "ret = %d", ret); + pipe_err(p, "pipeline_xrun_recover() error: pipeline_prepare() failed, ret = %d", + ret); return ret; } @@ -890,9 +875,8 @@ static int pipeline_xrun_recover(struct pipeline *p) /* restart pipeline comps */ ret = pipeline_trigger(p, p->source_comp, COMP_TRIGGER_START); if (ret < 0) { - trace_pipe_error_with_ids(p, "pipeline_xrun_recover() error: " - "pipeline_trigger() failed, " - "ret = %d", ret); + pipe_err(p, "pipeline_xrun_recover() error: pipeline_trigger() failed, ret = %d", + ret); return ret; } @@ -916,7 +900,7 @@ static enum task_state pipeline_task(void *arg) struct pipeline *p = arg; int err; - tracev_pipe_with_ids(p, "pipeline_task()"); + pipe_dbg(p, "pipeline_task()"); /* are we in xrun ? */ if (p->xrun_bytes) { @@ -932,15 +916,13 @@ static enum task_state pipeline_task(void *arg) /* try to recover */ err = pipeline_xrun_recover(p); if (err < 0) { - trace_pipe_error_with_ids(p, "pipeline_task(): xrun " - "recover failed! pipeline " - "will be stopped!"); + pipe_err(p, "pipeline_task(): xrun recover failed! pipeline will be stopped!"); /* failed - host will stop this pipeline */ return SOF_TASK_STATE_COMPLETED; } } - tracev_pipe("pipeline_task() sched"); + pipe_cl_dbg("pipeline_task() sched"); return SOF_TASK_STATE_RESCHEDULE; } diff --git a/src/audio/pipeline_static.c b/src/audio/pipeline_static.c index 791025cf253f..a3e352be5195 100644 --- a/src/audio/pipeline_static.c +++ b/src/audio/pipeline_static.c @@ -415,7 +415,7 @@ int init_static_pipeline(struct ipc *ipc) return 0; error: - trace_pipe_error("init_static_pipeline() error"); + pipe_cl_err("init_static_pipeline() error"); 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 831dd2caa4e7..5960ef73bd3f 100644 --- a/src/include/sof/audio/pipeline.h +++ b/src/include/sof/audio/pipeline.h @@ -31,29 +31,33 @@ struct task; #define NO_XRUN_RECOVERY 1 /* pipeline tracing */ -#define trace_pipe(format, ...) \ - trace_event(TRACE_CLASS_PIPE, format, ##__VA_ARGS__) -#define trace_pipe_with_ids(pipe_ptr, format, ...) \ - trace_event_with_ids(TRACE_CLASS_PIPE, \ - pipe_ptr->ipc_pipe.pipeline_id, \ - pipe_ptr->ipc_pipe.comp_id, \ - format, ##__VA_ARGS__) - -#define trace_pipe_error(format, ...) \ - trace_error(TRACE_CLASS_PIPE, format, ##__VA_ARGS__) -#define trace_pipe_error_with_ids(pipe_ptr, format, ...) \ - trace_error_with_ids(TRACE_CLASS_PIPE, \ - pipe_ptr->ipc_pipe.pipeline_id, \ - pipe_ptr->ipc_pipe.comp_id, \ - format, ##__VA_ARGS__) - -#define tracev_pipe(format, ...) \ - tracev_event(TRACE_CLASS_PIPE, format, ##__VA_ARGS__) -#define tracev_pipe_with_ids(pipe_ptr, format, ...) \ - tracev_event_with_ids(TRACE_CLASS_PIPE, \ - pipe_ptr->ipc_pipe.pipeline_id, \ - pipe_ptr->ipc_pipe.comp_id, \ - format, ##__VA_ARGS__) +#define trace_pipe_get_id(pipe_p) ((pipe_p)->ipc_pipe.pipeline_id) +#define trace_pipe_get_subid(pipe_p) ((pipe_p)->ipc_pipe.comp_id) + +/* class (driver) level (no device object) tracing */ + +#define pipe_cl_err(__e, ...) \ + trace_error(TRACE_CLASS_PIPE, __e, ##__VA_ARGS__) + +#define pipe_cl_info(__e, ...) \ + trace_event(TRACE_CLASS_PIPE, __e, ##__VA_ARGS__) + +#define pipe_cl_dbg(__e, ...) \ + tracev_event(TRACE_CLASS_PIPE, __e, ##__VA_ARGS__) + +/* device tracing */ + +#define pipe_err(pipe_p, __e, ...) \ + trace_dev_err(TRACE_CLASS_PIPE, trace_pipe_get_id, \ + trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__) + +#define pipe_info(pipe_p, __e, ...) \ + trace_dev_info(TRACE_CLASS_PIPE, trace_pipe_get_id, \ + trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__) + +#define pipe_dbg(pipe_p, __e, ...) \ + trace_dev_dbg(TRACE_CLASS_PIPE, trace_pipe_get_id, \ + trace_pipe_get_subid, pipe_p, __e, ##__VA_ARGS__) /* Pipeline status to stop execution of current path */ #define PPL_STATUS_PATH_STOP 1 From 5814310195756ce8fab3352c9d6a53ae40b6fbf6 Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Tue, 11 Feb 2020 13:12:12 +0100 Subject: [PATCH 04/10] trace: component: use err,info,dbg macros Both class and instance macro set switched to err,info,dbg version. Signed-off-by: Marcin Maka --- src/audio/asrc/asrc.c | 138 +++++++--------- src/audio/asrc/asrc_farrow.c | 200 ++++++++++++----------- src/audio/component.c | 47 ++---- src/audio/dai.c | 137 +++++++--------- src/audio/detect_test.c | 156 ++++++------------ src/audio/eq_fir/eq_fir.c | 135 ++++++--------- src/audio/eq_iir/eq_iir.c | 113 ++++++------- src/audio/host.c | 119 +++++--------- src/audio/kpb.c | 185 +++++++++------------ src/audio/mixer.c | 47 ++---- src/audio/mux/mux.c | 76 ++++----- src/audio/selector/selector.c | 99 +++++------ src/audio/src/src.c | 125 ++++++-------- src/audio/switch.c | 21 +-- src/audio/tone.c | 112 +++++-------- src/audio/volume/volume.c | 143 +++++++--------- src/include/sof/audio/asrc/asrc_farrow.h | 34 ++-- src/include/sof/audio/component.h | 58 ++++--- src/include/sof/audio/kpb.h | 17 -- src/include/sof/audio/mux.h | 18 -- src/include/sof/audio/selector.h | 21 --- src/include/sof/audio/volume.h | 21 --- src/include/sof/trace/trace.h | 12 -- 23 files changed, 792 insertions(+), 1242 deletions(-) diff --git a/src/audio/asrc/asrc.c b/src/audio/asrc/asrc.c index 0fcb859ca7a6..ce9ac44fcb61 100644 --- a/src/audio/asrc/asrc.c +++ b/src/audio/asrc/asrc.c @@ -37,31 +37,14 @@ #define COEF_C1 Q_CONVERT_FLOAT(0.01, 30) #define COEF_C2 Q_CONVERT_FLOAT(0.99, 30) -/* Tracing */ -#define trace_asrc(__e, ...) \ - trace_event(TRACE_CLASS_SRC, __e, ##__VA_ARGS__) -#define trace_asrc_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_SRC, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_asrc(__e, ...) \ - tracev_event(TRACE_CLASS_SRC, __e, ##__VA_ARGS__) -#define tracev_asrc_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_SRC, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_asrc_error(__e, ...) \ - trace_error(TRACE_CLASS_SRC, __e, ##__VA_ARGS__) -#define trace_asrc_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_SRC, comp_ptr, \ - __e, ##__VA_ARGS__) - typedef void (*asrc_proc_func)(struct comp_dev *dev, const struct audio_stream *source, struct audio_stream *sink, int *consumed, int *produced); +static const struct comp_driver comp_asrc; + /* asrc component private data */ struct comp_data { struct asrc_farrow *asrc_obj; /* ASRC core data */ @@ -144,13 +127,15 @@ static void src_copy_s32(struct comp_dev *dev, /* Run ASRC */ if (cd->mode == ASRC_OM_PUSH) { - ret = asrc_process_push32(cd->asrc_obj, (int32_t **)cd->ibuf, + ret = asrc_process_push32(dev, + cd->asrc_obj, (int32_t **)cd->ibuf, cd->source_frames, (int32_t **)cd->obuf, &frames, &idx, 0); n = frames * sink->channels; } else { - ret = asrc_process_pull32(cd->asrc_obj, (int32_t **)cd->ibuf, + ret = asrc_process_pull32(dev, cd->asrc_obj, + (int32_t **)cd->ibuf, &frames, (int32_t **)cd->obuf, cd->sink_frames, cd->source_frames, &idx); @@ -158,7 +143,7 @@ static void src_copy_s32(struct comp_dev *dev, } if (ret) - trace_asrc_error_with_ids(dev, "src_copy_s32(), error %d", ret); + comp_err(dev, "src_copy_s32(), error %d", ret); buf = (int32_t *)cd->obuf[0]; while (n > 0) { @@ -220,13 +205,15 @@ static void src_copy_s16(struct comp_dev *dev, /* Run ASRC */ if (cd->mode == ASRC_OM_PUSH) { - ret = asrc_process_push16(cd->asrc_obj, (int16_t **)cd->ibuf, + ret = asrc_process_push16(dev, + cd->asrc_obj, (int16_t **)cd->ibuf, cd->source_frames, (int16_t **)cd->obuf, &frames, &idx, 0); n = frames * sink->channels; } else { - ret = asrc_process_pull16(cd->asrc_obj, (int16_t **)cd->ibuf, + ret = asrc_process_pull16(dev, + cd->asrc_obj, (int16_t **)cd->ibuf, &frames, (int16_t **)cd->obuf, cd->sink_frames, cd->source_frames, &idx); @@ -234,7 +221,7 @@ static void src_copy_s16(struct comp_dev *dev, } if (ret) - trace_asrc_error_with_ids(dev, "src_copy_s16(), error %d", ret); + comp_err(dev, "src_copy_s16(), error %d", ret); buf = (int16_t *)cd->obuf[0]; while (n > 0) { @@ -268,21 +255,20 @@ static struct comp_dev *asrc_new(struct sof_ipc_comp *comp) struct comp_data *cd; int err; - trace_asrc("asrc_new()"); + comp_cl_info(&comp_asrc, "asrc_new()"); if (IPC_IS_SIZE_INVALID(ipc_asrc->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_SRC, ipc_asrc->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_asrc->config); return NULL; } - trace_asrc("asrc_new(), source_rate=%d, sink_rate=%d" - ", asynchronous_mode=%d, operation_mode=%d", - ipc_asrc->source_rate, ipc_asrc->sink_rate, - ipc_asrc->asynchronous_mode, ipc_asrc->operation_mode); + comp_cl_info(&comp_asrc, "asrc_new(), source_rate=%d, sink_rate=%d, asynchronous_mode=%d, operation_mode=%d", + ipc_asrc->source_rate, ipc_asrc->sink_rate, + ipc_asrc->asynchronous_mode, ipc_asrc->operation_mode); /* validate init data - either SRC sink or source rate must be set */ if (ipc_asrc->source_rate == 0 && ipc_asrc->sink_rate == 0) { - trace_asrc_error("asrc_new(), sink and source rates are not set"); + comp_cl_err(&comp_asrc, "asrc_new(), sink and source rates are not set"); return NULL; } @@ -325,7 +311,7 @@ static void asrc_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_asrc_with_ids(dev, "asrc_free()"); + comp_info(dev, "asrc_free()"); rfree(cd->buf); rfree(cd->asrc_obj); @@ -335,7 +321,7 @@ static void asrc_free(struct comp_dev *dev) static int asrc_ctrl_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { - trace_asrc_error_with_ids(dev, "asrc_ctrl_cmd()"); + comp_err(dev, "asrc_ctrl_cmd()"); return -EINVAL; } @@ -346,7 +332,7 @@ static int asrc_cmd(struct comp_dev *dev, int cmd, void *data, struct sof_ipc_ctrl_data *cdata = data; int ret = 0; - trace_asrc_with_ids(dev, "asrc_cmd()"); + comp_info(dev, "asrc_cmd()"); if (cmd == COMP_CMD_SET_VALUE) ret = asrc_ctrl_cmd(dev, cdata); @@ -356,7 +342,7 @@ static int asrc_cmd(struct comp_dev *dev, int cmd, void *data, static int asrc_trigger(struct comp_dev *dev, int cmd) { - trace_asrc_with_ids(dev, "asrc_trigger()"); + comp_info(dev, "asrc_trigger()"); return comp_set_state(dev, cmd); } @@ -369,7 +355,7 @@ static int asrc_params(struct comp_dev *dev, struct sof_ipc_comp_asrc *asrc = COMP_GET_IPC(dev, sof_ipc_comp_asrc); struct comp_data *cd = comp_get_drvdata(dev); - trace_asrc_with_ids(dev, "asrc_params()"); + comp_info(dev, "asrc_params()"); /* Calculate source and sink rates, one rate will come from IPC new * and the other from params. @@ -404,10 +390,9 @@ static int asrc_params(struct comp_dev *dev, cd->sink_frames_max = cd->sink_frames + 10; cd->frames = MAX(cd->source_frames_max, cd->sink_frames_max); - trace_asrc_with_ids(dev, "asrc_params(), source_rate=%u, sink_rate=%u" - ", source_frames_max=%d, sink_frames_max=%d", - cd->source_rate, cd->sink_rate, - cd->source_frames_max, cd->sink_frames_max); + comp_info(dev, "asrc_params(), source_rate=%u, sink_rate=%u, source_frames_max=%d, sink_frames_max=%d", + cd->source_rate, cd->sink_rate, + cd->source_frames_max, cd->sink_frames_max); return 0; } @@ -432,12 +417,12 @@ static int asrc_dai_find(struct comp_dev *dev, source_list); next_dev = sinkb->sink; if (!next_dev) { - trace_asrc_error("At end, no DAI found."); + comp_cl_err(&comp_asrc, "At end, no DAI found."); return -EINVAL; } if (next_dev->comp.pipeline_id != pid) { - trace_asrc_error("No DAI sink in pipeline."); + comp_cl_err(&comp_asrc, "No DAI sink in pipeline."); return -EINVAL; } } @@ -450,12 +435,12 @@ static int asrc_dai_find(struct comp_dev *dev, sink_list); next_dev = sourceb->source; if (!next_dev) { - trace_asrc_error("At beginning, no DAI found."); + comp_cl_err(&comp_asrc, "At beginning, no DAI found."); return -EINVAL; } if (next_dev->comp.pipeline_id != pid) { - trace_asrc_error("No DAI source in pipeline."); + comp_cl_err(&comp_asrc, "No DAI source in pipeline."); return -EINVAL; } } @@ -527,7 +512,7 @@ static int asrc_prepare(struct comp_dev *dev) int ret; int i; - trace_asrc_with_ids(dev, "asrc_prepare()"); + comp_info(dev, "asrc_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -553,23 +538,21 @@ static int asrc_prepare(struct comp_dev *dev) cd->sink_frames); if (sinkb->stream.size < config->periods_sink * sink_period_bytes) { - trace_asrc_error_with_ids(dev, - "asrc_prepare(), sink size=%d is insufficient, when periods=%d, period_bytes=%d", - sinkb->stream.size, - config->periods_sink, - sink_period_bytes); + comp_err(dev, "asrc_prepare(), sink size=%d is insufficient, when periods=%d, period_bytes=%d", + sinkb->stream.size, config->periods_sink, + sink_period_bytes); ret = -ENOMEM; goto err; } /* validate */ if (!sink_period_bytes) { - trace_asrc_error_with_ids(dev, "asrc_prepare(), sink_period_bytes = 0"); + comp_err(dev, "asrc_prepare(), sink_period_bytes = 0"); ret = -EINVAL; goto err; } if (!source_period_bytes) { - trace_asrc_error_with_ids(dev, "asrc_prepare(), source_period_bytes = 0"); + comp_err(dev, "asrc_prepare(), source_period_bytes = 0"); ret = -EINVAL; goto err; } @@ -588,7 +571,7 @@ static int asrc_prepare(struct comp_dev *dev) cd->asrc_func = src_copy_s32; break; default: - trace_asrc_error_with_ids(dev, "asrc_prepare(), invalid frame format"); + comp_err(dev, "asrc_prepare(), invalid frame format"); return -EINVAL; } @@ -603,8 +586,8 @@ static int asrc_prepare(struct comp_dev *dev) cd->buf_size); if (!cd->buf) { cd->buf_size = 0; - trace_asrc_error_with_ids(dev, "asrc_prepare(), allocation fail for size %d", - cd->buf_size); + comp_err(dev, "asrc_prepare(), allocation fail for size %d", + cd->buf_size); ret = -ENOMEM; goto err_free_buf; } @@ -619,18 +602,19 @@ static int asrc_prepare(struct comp_dev *dev) * Get required size and allocate memory for ASRC */ sample_bits = sample_bytes * 8; - ret = asrc_get_required_size(&cd->asrc_size, sourceb->stream.channels, + ret = asrc_get_required_size(dev, &cd->asrc_size, + sourceb->stream.channels, sample_bits); if (ret) { - trace_asrc_error_with_ids(dev, "asrc_prepare(), get_required_size_bytes failed"); + comp_err(dev, "asrc_prepare(), get_required_size_bytes failed"); goto err_free_buf; } cd->asrc_obj = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, cd->asrc_size); if (!cd->asrc_obj) { - trace_asrc_error_with_ids(dev, "asrc_prepare(), allocation fail for size %d", - cd->asrc_size); + comp_err(dev, "asrc_prepare(), allocation fail for size %d", + cd->asrc_size); cd->asrc_size = 0; ret = -ENOMEM; goto err_free_buf; @@ -647,14 +631,13 @@ static int asrc_prepare(struct comp_dev *dev) fs_sec = cd->source_rate; } - ret = asrc_initialise(cd->asrc_obj, sourceb->stream.channels, + ret = asrc_initialise(dev, cd->asrc_obj, sourceb->stream.channels, fs_prim, fs_sec, ASRC_IOF_INTERLEAVED, ASRC_IOF_INTERLEAVED, ASRC_BM_LINEAR, cd->frames, sample_bits, ASRC_CM_FEEDBACK, cd->mode); if (ret) { - trace_asrc_error_with_ids(dev, "initialise_asrc(), error %d", - ret); + comp_err(dev, "initialise_asrc(), error %d", ret); goto err_free_asrc; } @@ -665,11 +648,10 @@ static int asrc_prepare(struct comp_dev *dev) if (!cd->skew) cd->skew = Q_CONVERT_FLOAT(1.0, 30); - trace_asrc_with_ids(dev, "asrc_prepare(), skew = %d", cd->skew); - ret = asrc_update_drift(cd->asrc_obj, cd->skew); + comp_info(dev, "asrc_prepare(), skew = %d", cd->skew); + ret = asrc_update_drift(dev, cd->asrc_obj, cd->skew); if (ret) { - trace_asrc_error_with_ids(dev, "asrc_update_drift(), error %d", - ret); + comp_err(dev, "asrc_update_drift(), error %d", ret); goto err_free_asrc; } @@ -677,7 +659,7 @@ static int asrc_prepare(struct comp_dev *dev) if (cd->track_drift) { ret = asrc_dai_find(dev, cd, sinkb, sourceb); if (ret) { - trace_asrc_error_with_ids(dev, "No DAI found to track"); + comp_err(dev, "No DAI found to track"); cd->track_drift = false; goto err_free_asrc; } @@ -685,7 +667,7 @@ static int asrc_prepare(struct comp_dev *dev) cd->ts_count = 0; ret = asrc_dai_configure_timestamp(cd); if (ret) { - trace_asrc_error_with_ids(dev, "No timestamp capability in DAI"); + comp_err(dev, "No timestamp capability in DAI"); cd->track_drift = false; goto err_free_asrc; } @@ -706,7 +688,7 @@ static int asrc_prepare(struct comp_dev *dev) return ret; } -static int asrc_control_loop(struct comp_data *cd) +static int asrc_control_loop(struct comp_dev *dev, struct comp_data *cd) { struct timestamp_data tsd; int64_t tmp; @@ -750,7 +732,7 @@ static int asrc_control_loop(struct comp_data *cd) /* Prevent divide by zero */ if (delta_sample == 0 || tsd.walclk_rate == 0) { - trace_asrc_error("asrc_control_loop(), DAI timestamp failed"); + comp_cl_err(&comp_asrc, "asrc_control_loop(), DAI timestamp failed"); return -EINVAL; } @@ -765,8 +747,8 @@ static int asrc_control_loop(struct comp_data *cd) /* tmp is Q4.60, shift and round to Q2.30 */ tmp = ((int64_t)COEF_C1) * skew + ((int64_t)COEF_C2) * cd->skew; cd->skew = sat_int32(Q_SHIFT_RND(tmp, 60, 30)); - asrc_update_drift(cd->asrc_obj, cd->skew); - tracev_asrc("skew %d %d %d %d", delta_sample, delta_ts, skew, cd->skew); + asrc_update_drift(dev, cd->asrc_obj, cd->skew); + comp_cl_dbg("skew %d %d %d %d", delta_sample, delta_ts, skew, cd->skew); return 0; } @@ -782,9 +764,9 @@ static int asrc_copy(struct comp_dev *dev) int frames_snk; int ret; - tracev_asrc_with_ids(dev, "asrc_copy()"); + comp_dbg(dev, "asrc_copy()"); - ret = asrc_control_loop(cd); + ret = asrc_control_loop(dev, cd); if (ret) return ret; @@ -819,8 +801,8 @@ static int asrc_copy(struct comp_dev *dev) cd->asrc_func(dev, &source->stream, &sink->stream, &consumed, &produced); - tracev_asrc_with_ids(dev, "asrc_copy(), consumed = %u, produced = %u", - consumed, produced); + comp_dbg(dev, "asrc_copy(), consumed = %u, produced = %u", + consumed, produced); /* Calc new free and available if data was processed. These * functions must not be called with 0 consumed/produced. @@ -840,7 +822,7 @@ static int asrc_reset(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_asrc_with_ids(dev, "asrc_reset()"); + comp_info(dev, "asrc_reset()"); /* If any resources feasible to stop */ if (cd->track_drift) diff --git a/src/audio/asrc/asrc_farrow.c b/src/audio/asrc/asrc_farrow.c index 892b9fa448b0..038186054102 100644 --- a/src/audio/asrc/asrc_farrow.c +++ b/src/audio/asrc/asrc_farrow.c @@ -31,13 +31,6 @@ /* Generic scale value for Q27 fractional arithmetic */ #define ONE_Q27 Q_CONVERT_FLOAT(1, 27) -#define trace_asrc(__e, ...) \ - trace_event(TRACE_CLASS_ASRC, __e, ##__VA_ARGS__) -#define tracev_asrc(__e, ...) \ - tracev_event(TRACE_CLASS_ASRC, __e, ##__VA_ARGS__) -#define trace_asrc_error(__e, ...) \ - trace_error(TRACE_CLASS_ASRC, __e, ##__VA_ARGS__) - /* * GLOBALS */ @@ -206,7 +199,8 @@ static enum asrc_error_code initialise_buffer(struct asrc_farrow *src_obj); * Initialise the pointers to the filters, set the number of filters * and their length */ -static enum asrc_error_code initialise_filter(struct asrc_farrow *src_obj); +static enum asrc_error_code initialise_filter(struct comp_dev *dev, + struct asrc_farrow *src_obj); /* * FUNCTION DEFINITIONS + GENERAL SETUP @@ -238,7 +232,8 @@ static enum asrc_error_code initialise_filter(struct asrc_farrow *src_obj); * This is where the actual input data is buffered. */ -enum asrc_error_code asrc_get_required_size(int *required_size, +enum asrc_error_code asrc_get_required_size(struct comp_dev *dev, + int *required_size, int num_channels, int bit_depth) { @@ -248,19 +243,19 @@ enum asrc_error_code asrc_get_required_size(int *required_size, /* check for parameter errors */ if (!required_size) { - trace_asrc_error("asrc_get_required_size(), invalid required_size"); + comp_err(dev, "asrc_get_required_size(), invalid required_size"); return ASRC_EC_INVALID_POINTER; } if (num_channels < 1) { - trace_asrc_error("asrc_get_required_size(), invalid num_channels = %d", - num_channels); + comp_err(dev, "asrc_get_required_size(), invalid num_channels = %d", + num_channels); return ASRC_EC_INVALID_NUM_CHANNELS; } if (bit_depth != 16 && bit_depth != 32) { - trace_asrc_error("asrc_get_required_size_bytes(), invalid bit_depth = %d", - bit_depth); + comp_err(dev, "asrc_get_required_size_bytes(), invalid bit_depth = %d", + bit_depth); return ASRC_EC_INVALID_BIT_DEPTH; } @@ -289,7 +284,8 @@ enum asrc_error_code asrc_get_required_size(int *required_size, return ASRC_EC_OK; } -enum asrc_error_code asrc_initialise(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_initialise(struct comp_dev *dev, + struct asrc_farrow *src_obj, int num_channels, int fs_prim, int fs_sec, @@ -305,35 +301,35 @@ enum asrc_error_code asrc_initialise(struct asrc_farrow *src_obj, /* check for parameter errors */ if (!src_obj) { - trace_asrc_error("asrc_initialise(), null src_obj"); + comp_err(dev, "asrc_initialise(), null src_obj"); return ASRC_EC_INVALID_POINTER; } if (num_channels < 1) { - trace_asrc_error("asrc_initialise(), num_channels = %d", - num_channels); + comp_err(dev, "asrc_initialise(), num_channels = %d", + num_channels); return ASRC_EC_INVALID_NUM_CHANNELS; } if (fs_prim < 8000 || fs_prim > 192000) { - trace_asrc_error("asrc_initialise(), fs_prim = %d", fs_prim); + comp_err(dev, "asrc_initialise(), fs_prim = %d", fs_prim); return ASRC_EC_INVALID_SAMPLE_RATE; } if (fs_sec < 8000 || fs_sec > 192000) { - trace_asrc_error("asrc_initialise(), fs_src = %d", fs_sec); + comp_err(dev, "asrc_initialise(), fs_src = %d", fs_sec); return ASRC_EC_INVALID_SAMPLE_RATE; } if (buffer_length < 2) { - trace_asrc_error("asrc_initialise(), buffer_length = %d", - buffer_length); + comp_err(dev, "asrc_initialise(), buffer_length = %d", + buffer_length); return ASRC_EC_INVALID_BUFFER_LENGTH; } if (bit_depth != 16 && bit_depth != 32) { - trace_asrc_error("asrc_initialise(), bit_depth = %d", - bit_depth); + comp_err(dev, "asrc_initialise(), bit_depth = %d", + bit_depth); return ASRC_EC_INVALID_BIT_DEPTH; } @@ -365,7 +361,7 @@ enum asrc_error_code asrc_initialise(struct asrc_farrow *src_obj, /* check conversion ratios */ if (src_obj->fs_ratio == 0 || src_obj->fs_ratio_inv == 0) { - trace_asrc_error("asrc_initialise(), fail to calculate ratios"); + comp_err(dev, "asrc_initialise(), fail to calculate ratios"); return ASRC_EC_INVALID_CONVERSION_RATIO; } @@ -388,11 +384,11 @@ enum asrc_error_code asrc_initialise(struct asrc_farrow *src_obj, * also sets the pointer to the corresponding * calc_impulse_response_nX function. */ - error_code = initialise_filter(src_obj); + error_code = initialise_filter(dev, src_obj); /* check for errors */ if (error_code != ASRC_EC_OK) { - trace_asrc_error("asrc_initialise(), failed filter initialise"); + comp_err(dev, "asrc_initialise(), failed filter initialise"); return error_code; } @@ -401,7 +397,7 @@ enum asrc_error_code asrc_initialise(struct asrc_farrow *src_obj, /* check for errors */ if (error_code != ASRC_EC_OK) { - trace_asrc_error("asrc_initialise(), failed buffer initialise"); + comp_err(dev, "asrc_initialise(), failed buffer initialise"); return error_code; } @@ -430,27 +426,28 @@ enum asrc_error_code asrc_initialise(struct asrc_farrow *src_obj, return ASRC_EC_OK; } -enum asrc_error_code asrc_set_fs_ratio(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_set_fs_ratio(struct comp_dev *dev, + struct asrc_farrow *src_obj, int32_t fs_prim, int32_t fs_sec) { /* Check for parameter errors */ if (!src_obj) { - trace_asrc_error("asrc_set_fs_ratio(), null src_obj"); + comp_err(dev, "asrc_set_fs_ratio(), null src_obj"); return ASRC_EC_INVALID_POINTER; } if (!src_obj->is_initialised) { - trace_asrc_error("asrc_set_fs_ratio(), not initialised"); + comp_err(dev, "asrc_set_fs_ratio(), not initialised"); return ASRC_EC_INIT_FAILED; } if (fs_prim < 8000 || fs_prim > 192000) { - trace_asrc_error("asrc_set_fs_ratio(), fs_prim = %d", fs_prim); + comp_err(dev, "asrc_set_fs_ratio(), fs_prim = %d", fs_prim); return ASRC_EC_INVALID_SAMPLE_RATE; } if (fs_sec < 8000 || fs_sec > 192000) { - trace_asrc_error("asrc_set_fs_ratio(), fs_sec = %d", fs_sec); + comp_err(dev, "asrc_set_fs_ratio(), fs_sec = %d", fs_sec); return ASRC_EC_INVALID_SAMPLE_RATE; } @@ -470,7 +467,7 @@ enum asrc_error_code asrc_set_fs_ratio(struct asrc_farrow *src_obj, /* check conversion ratios */ if (src_obj->fs_ratio == 0 || src_obj->fs_ratio_inv == 0) { - trace_asrc_error("asrc_set_fs_ratio(), failed to calculate ratios"); + comp_err(dev, "asrc_set_fs_ratio(), failed to calculate ratios"); return ASRC_EC_INVALID_CONVERSION_RATIO; } @@ -481,10 +478,10 @@ enum asrc_error_code asrc_set_fs_ratio(struct asrc_farrow *src_obj, /* See initialise_asrc(...) for further information * Update the filters accordingly */ - enum asrc_error_code error_code = initialise_filter(src_obj); + enum asrc_error_code error_code = initialise_filter(dev, src_obj); /* check for errors */ if (error_code != ASRC_EC_OK) { - trace_asrc_error("asrc_set_fs_ratio(), failed filter initialise"); + comp_err(dev, "asrc_set_fs_ratio(), failed filter initialise"); return error_code; } @@ -492,7 +489,7 @@ enum asrc_error_code asrc_set_fs_ratio(struct asrc_farrow *src_obj, error_code = initialise_buffer(src_obj); /* check for errors */ if (error_code != ASRC_EC_OK) { - trace_asrc_error("asrc_set_fs_ratio(), failed buffer initialise"); + comp_err(dev, "asrc_set_fs_ratio(), failed buffer initialise"); return error_code; } @@ -511,17 +508,18 @@ enum asrc_error_code asrc_set_fs_ratio(struct asrc_farrow *src_obj, return ASRC_EC_OK; } -enum asrc_error_code asrc_set_input_format(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_set_input_format(struct comp_dev *dev, + struct asrc_farrow *src_obj, enum asrc_io_format input_format) { /* check for parameter errors */ if (!src_obj) { - trace_asrc_error("asrc_set_input_format(), null src_obj"); + comp_err(dev, "asrc_set_input_format(), null src_obj"); return ASRC_EC_INVALID_POINTER; } if (!src_obj->is_initialised) { - trace_asrc_error("asrc_set_input_format(), not initialised"); + comp_err(dev, "asrc_set_input_format(), not initialised"); return ASRC_EC_INIT_FAILED; } @@ -530,17 +528,18 @@ enum asrc_error_code asrc_set_input_format(struct asrc_farrow *src_obj, return ASRC_EC_OK; } -enum asrc_error_code asrc_set_output_format(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_set_output_format(struct comp_dev *dev, + struct asrc_farrow *src_obj, enum asrc_io_format output_format) { /* check for parameter errors */ if (!src_obj) { - trace_asrc_error("asrc_set_output_format(), null src_obj"); + comp_err(dev, "asrc_set_output_format(), null src_obj"); return ASRC_EC_INVALID_POINTER; } if (!src_obj->is_initialised) { - trace_asrc_error("asrc_set_output_format(), not initialised"); + comp_err(dev, "asrc_set_output_format(), not initialised"); return ASRC_EC_INIT_FAILED; } @@ -606,7 +605,8 @@ static enum asrc_error_code initialise_buffer(struct asrc_farrow *src_obj) /* * FILTER FUNCTIONS */ -static enum asrc_error_code initialise_filter(struct asrc_farrow *src_obj) +static enum asrc_error_code initialise_filter(struct comp_dev *dev, + struct asrc_farrow *src_obj) { int fs_in; int fs_out; @@ -632,8 +632,8 @@ static enum asrc_error_code initialise_filter(struct asrc_farrow *src_obj) if (fs_in == 0 || fs_out == 0) { /* Avoid possible divisions by zero. */ - trace_asrc_error("initialise_filter(), fs_in = %d, fs_out = %d", - fs_in, fs_out); + comp_err(dev, "initialise_filter(), fs_in = %d, fs_out = %d", + fs_in, fs_out); return ASRC_EC_INVALID_SAMPLE_RATE; } else if (fs_in == 48000 && fs_out >= 48000) { /* For conversion from 48 kHz to 48 kHz (and above) we @@ -729,8 +729,8 @@ static enum asrc_error_code initialise_filter(struct asrc_farrow *src_obj) break; #endif default: - trace_asrc_error("initialise_filter(), fs_out = %d", - fs_out); + comp_err(dev, "initialise_filter(), fs_out = %d", + fs_out); return ASRC_EC_INVALID_SAMPLE_RATE; } } else if (fs_in == 24000) { @@ -754,13 +754,13 @@ static enum asrc_error_code initialise_filter(struct asrc_farrow *src_obj) break; #endif default: - trace_asrc_error("initialise_filter(), fs_out = %d", - fs_out); + comp_err(dev, "initialise_filter(), fs_out = %d", + fs_out); return ASRC_EC_INVALID_SAMPLE_RATE; } } else { /* Conversion ratio is not supported. */ - trace_asrc_error("initialise_filter(), fs_in = %d", fs_in); + comp_err(dev, "initialise_filter(), fs_in = %d", fs_in); return ASRC_EC_INVALID_SAMPLE_RATE; } @@ -781,15 +781,16 @@ static enum asrc_error_code initialise_filter(struct asrc_farrow *src_obj) src_obj->calc_ir = &asrc_calc_impulse_response_n7; break; default: - trace_asrc_error("initialise_filter(), num_filters = %d", - src_obj->num_filters); + comp_err(dev, "initialise_filter(), num_filters = %d", + src_obj->num_filters); return ASRC_EC_INVALID_CONVERSION_RATIO; } return ASRC_EC_OK; } -enum asrc_error_code asrc_update_drift(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_update_drift(struct comp_dev *dev, + struct asrc_farrow *src_obj, uint32_t clock_skew) { uint32_t fs_ratio; @@ -797,24 +798,24 @@ enum asrc_error_code asrc_update_drift(struct asrc_farrow *src_obj, /* check for parameter errors */ if (!src_obj) { - trace_asrc_error("asrc_update_drift(), null src_obj"); + comp_err(dev, "asrc_update_drift(), null src_obj"); return ASRC_EC_INVALID_POINTER; } if (!src_obj->is_initialised) { - trace_asrc_error("asrc_update_drift(), not initialised"); + comp_err(dev, "asrc_update_drift(), not initialised"); return ASRC_EC_INIT_FAILED; } if (src_obj->control_mode != ASRC_CM_FEEDBACK) { - trace_asrc_error("update_drift(), need to use feedback mode"); + comp_err(dev, "update_drift(), need to use feedback mode"); return ASRC_EC_INVALID_CONTROL_MODE; } /* Skew is Q2.30 */ if (clock_skew < SKEW_MIN || clock_skew > SKEW_MAX) { - trace_asrc_error("asrc_update_drift(), clock_skew = %d", - clock_skew); + comp_err(dev, "asrc_update_drift(), clock_skew = %d", + clock_skew); return ASRC_EC_INVALID_CLOCK_SKEW; } @@ -836,7 +837,8 @@ enum asrc_error_code asrc_update_drift(struct asrc_farrow *src_obj, return ASRC_EC_OK; } -enum asrc_error_code asrc_update_fs_ratio(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_update_fs_ratio(struct comp_dev *dev, + struct asrc_farrow *src_obj, int primary_num_frames, int secondary_num_frames) { @@ -844,24 +846,23 @@ enum asrc_error_code asrc_update_fs_ratio(struct asrc_farrow *src_obj, /* Check input for errors */ if (!src_obj) { - trace_asrc_error("asrc_update_fs_ratio(), null src_obj"); + comp_err(dev, "asrc_update_fs_ratio(), null src_obj"); return ASRC_EC_INVALID_POINTER; } if (!src_obj->is_initialised) { - trace_asrc_error("asrc_update_fs_ratio(), not initialized"); + comp_err(dev, "asrc_update_fs_ratio(), not initialized"); return ASRC_EC_INIT_FAILED; } if (src_obj->control_mode != ASRC_CM_FIXED) { - trace_asrc_error("update_fs_ratio(), need to use fixed mode"); + comp_err(dev, "update_fs_ratio(), need to use fixed mode"); return ASRC_EC_INVALID_CONTROL_MODE; } if (primary_num_frames < 1 || secondary_num_frames < 1) { - trace_asrc_error("update_fs_ratio(), primary_num_frames = %d" - ", secondary_num_frames = %d", - primary_num_frames, secondary_num_frames); + comp_err(dev, "update_fs_ratio(), primary_num_frames = %d, secondary_num_frames = %d", + primary_num_frames, secondary_num_frames); return ASRC_EC_INVALID_FRAME_SIZE; } @@ -971,7 +972,8 @@ void asrc_write_to_ring_buffer32(struct asrc_farrow *src_obj, } } -enum asrc_error_code asrc_process_push16(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_process_push16(struct comp_dev *dev, + struct asrc_farrow *src_obj, int16_t **__restrict input_buffers, int input_num_frames, int16_t **__restrict output_buffers, @@ -1034,9 +1036,9 @@ enum asrc_error_code asrc_process_push16(struct asrc_farrow *src_obj, (*output_num_frames)++; } else { - trace_asrc_error("error onf=%d, max=%d", - *output_num_frames, - max_num_free_frames); + comp_err(dev, "error onf=%d, max=%d", + *output_num_frames, + max_num_free_frames); break; } } else { @@ -1061,15 +1063,15 @@ enum asrc_error_code asrc_process_push16(struct asrc_farrow *src_obj, src_obj->sec_num_frames >= src_obj->sec_num_frames_targ) { if (src_obj->sec_num_frames != src_obj->sec_num_frames_targ) { - trace_asrc_error("process_push16(), Generated = %d, Target = %d", - src_obj->sec_num_frames, - src_obj->sec_num_frames_targ); + comp_err(dev, "process_push16(), Generated = %d, Target = %d", + src_obj->sec_num_frames, + src_obj->sec_num_frames_targ); return ASRC_EC_FAILED_PUSH_MODE; } if (src_obj->time_value > TIME_VALUE_LIMIT) { - trace_asrc_error("process_push16(), Time value = %d", - src_obj->time_value); + comp_err(dev, "process_push16(), Time value = %d", + src_obj->time_value); return ASRC_EC_FAILED_PUSH_MODE; } @@ -1083,7 +1085,8 @@ enum asrc_error_code asrc_process_push16(struct asrc_farrow *src_obj, return ASRC_EC_OK; } -enum asrc_error_code asrc_process_push32(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_process_push32(struct comp_dev *dev, + struct asrc_farrow *src_obj, int32_t **__restrict input_buffers, int input_num_frames, int32_t **__restrict output_buffers, @@ -1146,9 +1149,9 @@ enum asrc_error_code asrc_process_push32(struct asrc_farrow *src_obj, (*output_num_frames)++; } else { - trace_asrc_error("error onf=%d, max=%d", - *output_num_frames, - max_num_free_frames); + comp_err(dev, "error onf=%d, max=%d", + *output_num_frames, + max_num_free_frames); break; } } else { @@ -1174,16 +1177,15 @@ enum asrc_error_code asrc_process_push32(struct asrc_farrow *src_obj, src_obj->sec_num_frames >= src_obj->sec_num_frames_targ) { if (src_obj->sec_num_frames != src_obj->sec_num_frames_targ) { - trace_asrc_error("process_push32(), Generated = %d" - ", Target = %d", - src_obj->sec_num_frames, - src_obj->sec_num_frames_targ); + comp_err(dev, "process_push32(), Generated = %d, Target = %d", + src_obj->sec_num_frames, + src_obj->sec_num_frames_targ); return ASRC_EC_FAILED_PUSH_MODE; } if (src_obj->time_value > TIME_VALUE_LIMIT) { - trace_asrc_error("process_push32(), Time value = %d", - src_obj->time_value); + comp_err(dev, "process_push32(), Time value = %d", + src_obj->time_value); return ASRC_EC_FAILED_PUSH_MODE; } @@ -1197,7 +1199,8 @@ enum asrc_error_code asrc_process_push32(struct asrc_farrow *src_obj, return ASRC_EC_OK; } -enum asrc_error_code asrc_process_pull16(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_process_pull16(struct comp_dev *dev, + struct asrc_farrow *src_obj, int16_t **__restrict input_buffers, int *input_num_frames, int16_t **__restrict output_buffers, @@ -1276,16 +1279,15 @@ enum asrc_error_code asrc_process_pull16(struct asrc_farrow *src_obj, src_obj->sec_num_frames >= src_obj->sec_num_frames_targ) { if (src_obj->sec_num_frames != src_obj->sec_num_frames_targ) { - trace_asrc_error("process_pull16(), Consumed = %d" - ", Target = %d", - src_obj->sec_num_frames, - src_obj->sec_num_frames_targ); + comp_err(dev, "process_pull16(), Consumed = %d, Target = %d", + src_obj->sec_num_frames, + src_obj->sec_num_frames_targ); return ASRC_EC_FAILED_PULL_MODE; } if (src_obj->time_value_pull > TIME_VALUE_LIMIT) { - trace_asrc_error("process_pull16(), Time value = %d", - src_obj->time_value_pull); + comp_err(dev, "process_pull16(), Time value = %d", + src_obj->time_value_pull); return ASRC_EC_FAILED_PULL_MODE; } @@ -1299,7 +1301,8 @@ enum asrc_error_code asrc_process_pull16(struct asrc_farrow *src_obj, return ASRC_EC_OK; } -enum asrc_error_code asrc_process_pull32(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_process_pull32(struct comp_dev *dev, + struct asrc_farrow *src_obj, int32_t **__restrict input_buffers, int *input_num_frames, int32_t **__restrict output_buffers, @@ -1379,16 +1382,15 @@ enum asrc_error_code asrc_process_pull32(struct asrc_farrow *src_obj, src_obj->sec_num_frames >= src_obj->sec_num_frames_targ) { if (src_obj->sec_num_frames != src_obj->sec_num_frames_targ) { - trace_asrc_error("process_pull32(), Consumed = %d" - ", Target = %d.\n", - src_obj->sec_num_frames, - src_obj->sec_num_frames_targ); + comp_err(dev, "process_pull32(), Consumed = %d, Target = %d.\n", + src_obj->sec_num_frames, + src_obj->sec_num_frames_targ); return ASRC_EC_FAILED_PULL_MODE; } if (src_obj->time_value_pull > TIME_VALUE_LIMIT) { - trace_asrc_error("process_pull32(): Time value = %d", - src_obj->time_value_pull); + comp_err(dev, "process_pull32(): Time value = %d", + src_obj->time_value_pull); return ASRC_EC_FAILED_PULL_MODE; } diff --git a/src/audio/component.c b/src/audio/component.c index edc5f1d14699..b3480aaf15b3 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -57,16 +57,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) { - trace_comp_error("comp_new() error: driver not found, " - "comp->type = %u", comp->type); + trace_error(TRACE_CLASS_COMP, "comp_new() error: driver not found, comp->type = %u", + comp->type); return NULL; } /* create the new component */ cdev = drv->ops.new(comp); if (!cdev) { - trace_comp_error("comp_new() error: " - "unable to create the new component"); + comp_cl_err(drv, "comp_new() error: unable to create the new component"); return NULL; } @@ -112,8 +111,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) int ret = 0; if (dev->state == requested_state) { - trace_comp_with_ids(dev, "comp_set_state(), " - "state already set to %u", dev->state); + comp_info(dev, "comp_set_state(), state already set to %u", + dev->state); return COMP_STATUS_STATE_ALREADY_SET; } @@ -122,10 +121,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) if (dev->state == COMP_STATE_PREPARE) { dev->state = COMP_STATE_ACTIVE; } else { - trace_comp_error_with_ids(dev, "comp_set_state() error: " - "wrong state = %u, " - "COMP_TRIGGER_START", - dev->state); + comp_err(dev, "comp_set_state() error: wrong state = %u, COMP_TRIGGER_START", + dev->state); ret = -EINVAL; } break; @@ -133,10 +130,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_with_ids(dev, "comp_set_state() error: " - "wrong state = %u, " - "COMP_TRIGGER_RELEASE", - dev->state); + comp_err(dev, "comp_set_state() error: wrong state = %u, COMP_TRIGGER_RELEASE", + dev->state); ret = -EINVAL; } break; @@ -145,10 +140,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) dev->state == COMP_STATE_PAUSED) { dev->state = COMP_STATE_PREPARE; } else { - trace_comp_error_with_ids(dev, "comp_set_state() error: " - "wrong state = %u, " - "COMP_TRIGGER_STOP", - dev->state); + comp_err(dev, "comp_set_state() error: wrong state = %u, COMP_TRIGGER_STOP", + dev->state); ret = -EINVAL; } break; @@ -161,10 +154,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_with_ids(dev, "comp_set_state() error: " - "wrong state = %u, " - "COMP_TRIGGER_PAUSE", - dev->state); + comp_err(dev, "comp_set_state() error: wrong state = %u, COMP_TRIGGER_PAUSE", + dev->state); ret = -EINVAL; } break; @@ -172,10 +163,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) /* reset always succeeds */ if (dev->state == COMP_STATE_ACTIVE || dev->state == COMP_STATE_PAUSED) { - trace_comp_error_with_ids(dev, "comp_set_state() error: " - "wrong state = %u, " - "COMP_TRIGGER_RESET", - dev->state); + comp_err(dev, "comp_set_state() error: wrong state = %u, COMP_TRIGGER_RESET", + dev->state); ret = 0; } dev->state = COMP_STATE_READY; @@ -184,10 +173,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) if (dev->state == COMP_STATE_READY) { dev->state = COMP_STATE_PREPARE; } else { - trace_comp_error_with_ids(dev, "comp_set_state() error: " - "wrong state = %u, " - "COMP_TRIGGER_PREPARE", - dev->state); + comp_err(dev, "comp_set_state() error: wrong state = %u, COMP_TRIGGER_PREPARE", + dev->state); ret = -EINVAL; } break; diff --git a/src/audio/dai.c b/src/audio/dai.c index 35def51f7956..e360de22bf92 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -32,24 +32,7 @@ #include #include -/* tracing */ -#define trace_dai_comp(__e, ...) \ - trace_event(TRACE_CLASS_DAI, __e, ##__VA_ARGS__) -#define trace_dai_comp_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_DAI, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_dai_comp(__e, ...) \ - tracev_event(TRACE_CLASS_DAI, __e, ##__VA_ARGS__) -#define tracev_dai_comp_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_DAI, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_dai_comp_error(__e, ...) \ - trace_error(TRACE_CLASS_DAI, __e, ##__VA_ARGS__) -#define trace_dai_comp_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_DAI, comp_ptr, \ - __e, ##__VA_ARGS__) +static const struct comp_driver comp_dai; struct dai_data { /* local DMA config */ @@ -86,7 +69,7 @@ static void dai_dma_cb(void *arg, enum notify_id type, void *data) uint32_t samples = bytes / sample_bytes(dd->frame_fmt); void *buffer_ptr; - tracev_dai_comp_with_ids(dev, "dai_dma_cb()"); + comp_dbg(dev, "dai_dma_cb()"); next->status = DMA_CB_STATUS_RELOAD; @@ -144,7 +127,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp) uint32_t dir, caps, dma_dev; int ret; - trace_dai_comp("dai_new()"); + comp_cl_info(&comp_dai, "dai_new()"); if (IPC_IS_SIZE_INVALID(ipc_dai->config)) { IPC_SIZE_ERROR_TRACE(TRACE_CLASS_DAI, ipc_dai->config); @@ -171,7 +154,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp) dd->dai = dai_get(dai->type, dai->dai_index, DAI_CREAT); if (!dd->dai) { - trace_dai_comp_error("dai_new() error: dai_get() failed to create DAI."); + comp_cl_err(&comp_dai, "dai_new() error: dai_get() failed to create DAI."); goto error; } @@ -184,7 +167,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp) dd->dma = dma_get(dir, caps, dma_dev, DMA_ACCESS_SHARED); if (!dd->dma) { - trace_dai_comp_error("dai_new() error: dma_get() failed to get shared access to DMA."); + comp_cl_err(&comp_dai, "dai_new() error: dma_get() failed to get shared access to DMA."); goto error; } @@ -244,16 +227,15 @@ static int dai_playback_params(struct comp_dev *dev, uint32_t period_bytes, config->is_scheduling_source = comp_is_scheduling_source(dev); config->period = dev->pipeline->ipc_pipe.period; - trace_dai_comp_with_ids(dev, "dai_playback_params() dest_dev = %d stream_id = %d src_width = %d dest_width = %d", - config->dest_dev, dd->stream_id, - config->src_width, config->dest_width); + comp_info(dev, "dai_playback_params() dest_dev = %d stream_id = %d src_width = %d dest_width = %d", + config->dest_dev, dd->stream_id, + config->src_width, config->dest_width); if (!config->elem_array.elems) { fifo = dai_get_fifo(dd->dai, dev->direction, dd->stream_id); - trace_dai_comp_with_ids(dev, "dai_playback_params() fifo %X", - fifo); + comp_info(dev, "dai_playback_params() fifo %X", fifo); err = dma_sg_alloc(&config->elem_array, SOF_MEM_ZONE_RUNTIME, config->direction, @@ -262,8 +244,8 @@ static int dai_playback_params(struct comp_dev *dev, uint32_t period_bytes, (uintptr_t)(dd->dma_buffer->stream.addr), fifo); if (err < 0) { - trace_dai_comp_error_with_ids(dev, "dai_playback_params() error: dma_sg_alloc() failed with err = %d", - err); + comp_err(dev, "dai_playback_params() error: dma_sg_alloc() failed with err = %d", + err); return err; } } @@ -305,16 +287,15 @@ static int dai_capture_params(struct comp_dev *dev, uint32_t period_bytes, config->dest_width = sample_bytes(dd->frame_fmt); } - trace_dai_comp_with_ids(dev, "dai_capture_params() src_dev = %d stream_id = %d src_width = %d dest_width = %d", - config->src_dev, dd->stream_id, - config->src_width, config->dest_width); + comp_info(dev, "dai_capture_params() src_dev = %d stream_id = %d src_width = %d dest_width = %d", + config->src_dev, dd->stream_id, + config->src_width, config->dest_width); if (!config->elem_array.elems) { fifo = dai_get_fifo(dd->dai, dev->direction, dd->stream_id); - trace_dai_comp_with_ids(dev, "dai_capture_params() fifo %X", - fifo); + comp_info(dev, "dai_capture_params() fifo %X", fifo); err = dma_sg_alloc(&config->elem_array, SOF_MEM_ZONE_RUNTIME, config->direction, @@ -323,8 +304,8 @@ static int dai_capture_params(struct comp_dev *dev, uint32_t period_bytes, (uintptr_t)(dd->dma_buffer->stream.addr), fifo); if (err < 0) { - trace_dai_comp_error_with_ids(dev, "dai_capture_params() error: dma_sg_alloc() failed with err = %d", - err); + comp_err(dev, "dai_capture_params() error: dma_sg_alloc() failed with err = %d", + err); return err; } } @@ -345,7 +326,7 @@ static int dai_params(struct comp_dev *dev, uint32_t align; int err; - trace_dai_comp_with_ids(dev, "dai_params()"); + comp_info(dev, "dai_params()"); if (dev->direction == SOF_IPC_STREAM_PLAYBACK) dd->local_buffer = list_first_item(&dev->bsource_list, @@ -358,37 +339,36 @@ static int dai_params(struct comp_dev *dev, /* check if already configured */ if (dev->state == COMP_STATE_PREPARE) { - trace_dai_comp_with_ids(dev, "dai_params() component has been already configured."); + comp_info(dev, "dai_params() component has been already configured."); return 0; } /* can set params on only init state */ if (dev->state != COMP_STATE_READY) { - trace_dai_comp_error_with_ids(dev, "dai_params() error: Component is not in init state."); + comp_err(dev, "dai_params() error: Component is not in init state."); return -EINVAL; } err = dma_get_attribute(dd->dma, DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT, &addr_align); if (err < 0) { - trace_dai_comp_error_with_ids(dev, "dai_params() error: could not get dma buffer address alignment, err = %d", - err); + comp_err(dev, "dai_params() error: could not get dma buffer address alignment, err = %d", + err); return err; } err = dma_get_attribute(dd->dma, DMA_ATTR_BUFFER_ALIGNMENT, &align); if (err < 0 || !align) { - trace_dai_comp_error_with_ids(dev, "dai_params() error: could not get valid dma buffer alignment, err = %d, align = %u", - err, align); + comp_err(dev, "dai_params() error: could not get valid dma buffer alignment, err = %d, align = %u", + err, align); return -EINVAL; } err = dma_get_attribute(dd->dma, DMA_ATTR_BUFFER_PERIOD_COUNT, &period_count); if (err < 0 || !period_count) { - trace_dai_comp_error_with_ids(dev, "dai_params() error: could not get valid dma buffer period count, err = %d, period_count = %u", - err, - period_count); + comp_err(dev, "dai_params() error: could not get valid dma buffer period count, err = %d, period_count = %u", + err, period_count); return -EINVAL; } @@ -401,7 +381,7 @@ static int dai_params(struct comp_dev *dev, /* calculate period size */ period_bytes = dev->frames * frame_size; if (!period_bytes) { - trace_dai_comp_error_with_ids(dev, "dai_params() error: invalid period_bytes."); + comp_err(dev, "dai_params() error: invalid period_bytes."); return -EINVAL; } @@ -412,15 +392,15 @@ static int dai_params(struct comp_dev *dev, if (dd->dma_buffer) { err = buffer_set_size(dd->dma_buffer, buffer_size); if (err < 0) { - trace_dai_comp_error_with_ids(dev, "dai_params() error: buffer_set_size() failed, buffer_size = %u", - buffer_size); + comp_err(dev, "dai_params() error: buffer_set_size() failed, buffer_size = %u", + buffer_size); return err; } } else { dd->dma_buffer = buffer_alloc(buffer_size, SOF_MEM_CAPS_DMA, addr_align); if (!dd->dma_buffer) { - trace_dai_comp_error_with_ids(dev, "dai_params() error: failed to alloc dma buffer"); + comp_err(dev, "dai_params() error: failed to alloc dma buffer"); return -ENOMEM; } } @@ -435,7 +415,7 @@ static int dai_prepare(struct comp_dev *dev) struct dai_data *dd = comp_get_drvdata(dev); int ret = 0; - trace_dai_comp_with_ids(dev, "dai_prepare()"); + comp_info(dev, "dai_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -447,13 +427,13 @@ static int dai_prepare(struct comp_dev *dev) dev->position = 0; if (!dd->chan) { - trace_dai_comp_error_with_ids(dev, "dai_prepare() error: Missing dd->chan."); + comp_err(dev, "dai_prepare() error: Missing dd->chan."); comp_set_state(dev, COMP_TRIGGER_RESET); return -EINVAL; } if (!dd->config.elem_array.elems) { - trace_dai_comp_error_with_ids(dev, "dai_prepare() error: Missing dd->config.elem_array.elems."); + comp_err(dev, "dai_prepare() error: Missing dd->config.elem_array.elems."); comp_set_state(dev, COMP_TRIGGER_RESET); return -EINVAL; } @@ -482,7 +462,7 @@ static int dai_reset(struct comp_dev *dev) struct dai_data *dd = comp_get_drvdata(dev); struct dma_sg_config *config = &dd->config; - trace_dai_comp_with_ids(dev, "dai_reset()"); + comp_info(dev, "dai_reset()"); dma_sg_free(&config->elem_array); @@ -520,7 +500,7 @@ static int dai_comp_trigger(struct comp_dev *dev, int cmd) struct dai_data *dd = comp_get_drvdata(dev); int ret; - trace_dai_comp_with_ids(dev, "dai_comp_trigger(), command = %u", cmd); + comp_info(dev, "dai_comp_trigger(), command = %u", cmd); ret = comp_set_state(dev, cmd); if (ret < 0) @@ -531,7 +511,7 @@ static int dai_comp_trigger(struct comp_dev *dev, int cmd) switch (cmd) { case COMP_TRIGGER_START: - trace_dai_comp_with_ids(dev, "dai_comp_trigger(), START"); + comp_info(dev, "dai_comp_trigger(), START"); /* only start the DAI if we are not XRUN handling */ if (dd->xrun == 0) { @@ -573,13 +553,13 @@ static int dai_comp_trigger(struct comp_dev *dev, int cmd) dai_update_start_position(dev); break; case COMP_TRIGGER_XRUN: - trace_dai_comp_with_ids(dev, "dai_comp_trigger(), XRUN"); + comp_info(dev, "dai_comp_trigger(), XRUN"); dd->xrun = 1; /* fallthrough */ case COMP_TRIGGER_PAUSE: case COMP_TRIGGER_STOP: - trace_dai_comp_with_ids(dev, "dai_comp_trigger(), PAUSE/STOP"); + comp_info(dev, "dai_comp_trigger(), PAUSE/STOP"); ret = dma_stop(dd->chan); dai_trigger(dd->dai, COMP_TRIGGER_STOP, dev->direction); break; @@ -596,10 +576,10 @@ static void dai_report_xrun(struct comp_dev *dev, uint32_t bytes) struct dai_data *dd = comp_get_drvdata(dev); if (dev->direction == SOF_IPC_STREAM_PLAYBACK) { - trace_dai_comp_error_with_ids(dev, "dai_report_xrun() error: underrun due to no data available"); + comp_err(dev, "dai_report_xrun() error: underrun due to no data available"); comp_underrun(dev, dd->local_buffer, bytes); } else { - trace_dai_comp_error_with_ids(dev, "dai_report_xrun() error: overrun due to no data available"); + comp_err(dev, "dai_report_xrun() error: overrun due to no data available"); comp_overrun(dev, dd->local_buffer, bytes); } } @@ -615,7 +595,7 @@ static int dai_copy(struct comp_dev *dev) uint32_t sink_samples; int ret = 0; - tracev_dai_comp_with_ids(dev, "dai_copy()"); + comp_dbg(dev, "dai_copy()"); /* get data sizes from DMA */ ret = dma_get_data_size(dd->chan, &avail_bytes, &free_bytes); @@ -639,8 +619,7 @@ static int dai_copy(struct comp_dev *dev) sample_bytes(dd->frame_fmt); } - tracev_dai_comp_with_ids(dev, "dai_copy(), copy_bytes = 0x%x", - copy_bytes); + comp_dbg(dev, "dai_copy(), copy_bytes = 0x%x", copy_bytes); /* return if it's not stream start */ if (!copy_bytes && dd->start_position != dev->position) @@ -676,12 +655,12 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config) int channel = 0; int handshake; - trace_dai_comp_with_ids(dev, "dai_config() dai %d.%d", - config->type, config->dai_index); + comp_info(dev, "dai_config() dai %d.%d", + config->type, config->dai_index); /* cannot configure DAI while active */ if (dev->state == COMP_STATE_ACTIVE) { - trace_dai_comp_error_with_ids(dev, "dai_config() error: Component is in active state."); + comp_err(dev, "dai_config() error: Component is in active state."); return -EINVAL; } @@ -691,19 +670,18 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config) dd->config.burst_elems = config->ssp.tdm_slots; break; case SOF_DAI_INTEL_DMIC: - tracev_dai_comp_with_ids(dev, "dai_config(), config->type = SOF_DAI_INTEL_DMIC"); + comp_dbg(dev, "dai_config(), config->type = SOF_DAI_INTEL_DMIC"); /* We can use always the largest burst length. */ dd->config.burst_elems = 8; - trace_dai_comp_with_ids(dev, "dai_config(), config->dmic.fifo_bits = %u config->dmic.num_pdm_active = %u", - config->dmic.fifo_bits, - config->dmic.num_pdm_active); + comp_info(dev, "dai_config(), config->dmic.fifo_bits = %u config->dmic.num_pdm_active = %u", + config->dmic.fifo_bits, + config->dmic.num_pdm_active); break; case SOF_DAI_INTEL_HDA: channel = config->hda.link_dma_ch; - trace_dai_comp_with_ids(dev, "dai_config(), channel = %d", - channel); + comp_info(dev, "dai_config(), channel = %d", channel); /* * For HDA DAIs, the driver sends the DAI_CONFIG IPC @@ -731,8 +709,7 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config) */ channel = config->alh.stream_id; dd->stream_id = config->alh.stream_id; - trace_dai_comp_with_ids(dev, "dai_config(), channel = %d", - channel); + comp_info(dev, "dai_config(), channel = %d", channel); break; case SOF_DAI_IMX_SAI: handshake = dai_get_handshake(dd->dai, dai->direction, @@ -752,7 +729,7 @@ 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_comp_error_with_ids(dev, "dai_config() error: Unknown dai type"); + comp_err(dev, "dai_config() error: Unknown dai type"); break; } @@ -768,7 +745,7 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config) dd->chan = dma_channel_get(dd->dma, channel); if (!dd->chan) { - trace_dai_comp_error_with_ids(dev, "dai_config() error: dma_channel_get() failed"); + comp_err(dev, "dai_config() error: dma_channel_get() failed"); dd->chan = NULL; return -EIO; } @@ -787,7 +764,7 @@ static int dai_ts_config(struct comp_dev *dev) struct timestamp_cfg *cfg = &dd->ts_config; struct sof_ipc_comp_dai *dai = (struct sof_ipc_comp_dai *)&dev->comp; - tracev_dai_comp_with_ids(dev, "dai_ts_config()"); + comp_dbg(dev, "dai_ts_config()"); cfg->type = dd->dai->drv->type; cfg->direction = dai->direction; cfg->index = dd->dai->index; @@ -804,7 +781,7 @@ static int dai_ts_start(struct comp_dev *dev) { struct dai_data *dd = comp_get_drvdata(dev); - tracev_dai_comp_with_ids(dev, "dai_ts_start()"); + comp_dbg(dev, "dai_ts_start()"); if (!dd->dai->drv->ts_ops.ts_start) return -ENXIO; @@ -815,7 +792,7 @@ static int dai_ts_stop(struct comp_dev *dev) { struct dai_data *dd = comp_get_drvdata(dev); - tracev_dai_comp_with_ids(dev, "dai_ts_stop()"); + comp_dbg(dev, "dai_ts_stop()"); if (!dd->dai->drv->ts_ops.ts_stop) return -ENXIO; @@ -826,7 +803,7 @@ static int dai_ts_get(struct comp_dev *dev, struct timestamp_data *tsd) { struct dai_data *dd = comp_get_drvdata(dev); - tracev_dai_comp_with_ids(dev, "dai_ts_get()"); + comp_dbg(dev, "dai_ts_get()"); if (!dd->dai->drv->ts_ops.ts_get) return -ENXIO; diff --git a/src/audio/detect_test.c b/src/audio/detect_test.c index 0a06239a2b5d..c2a28a6a9def 100644 --- a/src/audio/detect_test.c +++ b/src/audio/detect_test.c @@ -31,25 +31,6 @@ #include #include -/* tracing */ -#define trace_keyword(__e, ...) \ - trace_event(TRACE_CLASS_KEYWORD, __e, ##__VA_ARGS__) -#define trace_keyword_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_KEYWORD, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_keyword(__e, ...) \ - tracev_event(TRACE_CLASS_KEYWORD, __e, ##__VA_ARGS__) -#define tracev_keyword_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_KEYWORD, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_keyword_error(__e, ...) \ - trace_error(TRACE_CLASS_KEYWORD, __e, ##__VA_ARGS__) -#define trace_keyword_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_KEYWORD, comp_ptr, \ - __e, ##__VA_ARGS__) - #define ACTIVATION_DEFAULT_SHIFT 3 #define ACTIVATION_DEFAULT_DIVIDER_S16 0.5 #define ACTIVATION_DEFAULT_DIVIDER_S24 0.05 @@ -66,6 +47,8 @@ /* default number of samples before detection is activated */ #define KEYPHRASE_DEFAULT_PREAMBLE_LENGTH 0 +static const struct comp_driver comp_keyword; + struct model_data { uint32_t data_size; void *data; @@ -121,7 +104,7 @@ static void notify_host(const struct comp_dev *dev) { struct sof_ipc_comp_event event; - trace_keyword_with_ids(dev, "notify_host()"); + comp_info(dev, "notify_host()"); event.event_type = SOF_CTRL_EVENT_KD; event.num_elems = 0; @@ -138,8 +121,7 @@ static void notify_kpb(const struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_keyword_with_ids(dev, "notify_kpb(), preamble: %u", - cd->detect_preamble); + comp_info(dev, "notify_kpb(), preamble: %u", cd->detect_preamble); cd->client_data.r_ptr = NULL; cd->client_data.sink = NULL; @@ -218,7 +200,7 @@ static void default_detect_test(struct comp_dev *dev, static void free_mem_load(struct comp_data *cd) { if (!cd) { - trace_keyword_error("free_mem_load() error: invalid cd"); + comp_cl_err(&comp_keyword, "free_mem_load() error: invalid cd"); return; } @@ -237,7 +219,7 @@ static int alloc_mem_load(struct comp_data *cd, uint32_t size) return 0; if (!cd) { - trace_keyword_error("alloc_mem_load() error: invalid cd"); + comp_cl_err(&comp_keyword, "alloc_mem_load() error: invalid cd"); return -EINVAL; } @@ -246,7 +228,7 @@ static int alloc_mem_load(struct comp_data *cd, uint32_t size) cd->model.data = rballoc(0, SOF_MEM_CAPS_RAM, size); if (!cd->model.data) { - trace_keyword_error("alloc_mem_load() alloc failed"); + comp_cl_err(&comp_keyword, "alloc_mem_load() alloc failed"); return -ENOMEM; } @@ -273,8 +255,8 @@ static int test_keyword_get_threshold(struct comp_dev *dev, int sample_width) return ACTIVATION_DEFAULT_THRESHOLD_S32; #endif /* CONFIG_FORMAT_S32LE */ default: - trace_keyword_error_with_ids(dev, "test_keyword_get_threshold(), unsupported sample width: %d", - sample_width); + comp_err(dev, "test_keyword_get_threshold(), unsupported sample width: %d", + sample_width); return -EINVAL; } } @@ -314,7 +296,7 @@ static struct comp_dev *test_keyword_new(struct sof_ipc_comp *comp) int ret = 0; size_t bs; - trace_keyword("test_keyword_new()"); + comp_cl_info(&comp_keyword, "test_keyword_new()"); if (IPC_IS_SIZE_INVALID(ipc_keyword->config)) { IPC_SIZE_ERROR_TRACE(TRACE_CLASS_KEYWORD, ipc_keyword->config); @@ -346,22 +328,19 @@ static struct comp_dev *test_keyword_new(struct sof_ipc_comp *comp) if (bs > 0) { if (bs < sizeof(struct sof_detect_test_config)) { - trace_keyword_error_with_ids(dev, "test_keyword_new() " - "error: invalid data size"); + comp_err(dev, "test_keyword_new() error: invalid data size"); goto fail; } if (test_keyword_apply_config(dev, cfg)) { - trace_keyword_error_with_ids(dev, "test_keyword_new() " - "error: failed to apply config"); + comp_err(dev, "test_keyword_new() error: failed to apply config"); goto fail; } } ret = alloc_mem_load(cd, INITIAL_MODEL_DATA_SIZE); if (ret < 0) { - trace_keyword_error_with_ids(dev, "test_keyword_new() " - "error: model data initial failed"); + comp_err(dev, "test_keyword_new() error: model data initial failed"); goto fail; } @@ -379,7 +358,7 @@ static void test_keyword_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_keyword_with_ids(dev, "test_keyword_free()"); + comp_info(dev, "test_keyword_free()"); free_mem_load(cd); rfree(cd); @@ -403,16 +382,12 @@ static int test_keyword_params(struct comp_dev *dev, sourceb->stream.channels = 1; if (sourceb->stream.channels != 1) { - trace_keyword_error_with_ids(dev, "test_keyword_params() " - "error: only single-channel " - "supported"); + comp_err(dev, "test_keyword_params() error: only single-channel supported"); return -EINVAL; } if (!detector_is_sample_width_supported(sourceb->stream.frame_fmt)) { - trace_keyword_error_with_ids(dev, "test_keyword_params() " - "error: only 16-bit format " - "supported"); + comp_err(dev, "test_keyword_params() error: only 16-bit format supported"); return -EINVAL; } @@ -437,12 +412,10 @@ static int test_keyword_set_config(struct comp_dev *dev, cfg = (struct sof_detect_test_config *)cdata->data->data; bs = cfg->size; - trace_keyword_with_ids(dev, "test_keyword_set_config(), blob size = %u", - bs); + comp_info(dev, "test_keyword_set_config(), blob size = %u", bs); if (bs != sizeof(struct sof_detect_test_config)) { - trace_keyword_error_with_ids(dev, "test_keyword_set_config() " - "error: invalid blob size"); + comp_err(dev, "test_keyword_set_config() error: invalid blob size"); return -EINVAL; } @@ -456,11 +429,9 @@ static int test_keyword_set_model(struct comp_dev *dev, int ret = 0; bool done = false; - tracev_keyword_with_ids(dev, "keyword_ctrl_set_model() " - "msg_index = %d, num_elems = %d, " - "remaining = %d ", - cdata->msg_index, cdata->num_elems, - cdata->elems_remaining); + comp_dbg(dev, "keyword_ctrl_set_model() msg_index = %d, num_elems = %d, remaining = %d ", + cdata->msg_index, cdata->num_elems, + cdata->elems_remaining); if (!cdata->msg_index) { ret = alloc_mem_load(cd, cdata->data->size); @@ -469,17 +440,14 @@ static int test_keyword_set_model(struct comp_dev *dev, } if (!cd->model.data) { - trace_keyword_error_with_ids(dev, "keyword_ctrl_set_model() " - "error: buffer not allocated"); + comp_err(dev, "keyword_ctrl_set_model() error: buffer not allocated"); return -EINVAL; } if (!cdata->elems_remaining) { if (cdata->num_elems + cd->model.data_pos < cd->model.data_size) { - trace_keyword_error_with_ids(dev, - "keyword_ctrl_set_model() error: " - "not enough data to fill the buffer"); + comp_err(dev, "keyword_ctrl_set_model() error: not enough data to fill the buffer"); /* TODO: anything to do in such a situation? */ @@ -487,14 +455,12 @@ static int test_keyword_set_model(struct comp_dev *dev, } done = true; - trace_keyword_with_ids(dev, "test_keyword_set_model() " - "final packet received"); + comp_info(dev, "test_keyword_set_model() final packet received"); } if (cdata->num_elems > cd->model.data_size - cd->model.data_pos) { - trace_keyword_error_with_ids(dev, "keyword_ctrl_set_model() " - "error: too much data"); + comp_err(dev, "keyword_ctrl_set_model() error: too much data"); return -EINVAL; } @@ -509,9 +475,8 @@ static int test_keyword_set_model(struct comp_dev *dev, /* Set model data done, update crc value */ cd->model.crc = crc32(0, cd->model.data, cd->model.data_size); - trace_keyword_with_ids(dev, "keyword_ctrl_set_model() " - "done, memory_size = 0x%x, crc = 0x%08x", - cd->model.data_size, cd->model.crc); + comp_info(dev, "keyword_ctrl_set_model() done, memory_size = 0x%x, crc = 0x%08x", + cd->model.data_size, cd->model.crc); } return 0; } @@ -528,8 +493,7 @@ static int test_keyword_ctrl_set_bin_data(struct comp_dev *dev, * configuration will be used when playback/capture * starts. */ - trace_keyword_error_with_ids(dev, "keyword_ctrl_set_bin_data() " - "error: driver is busy"); + comp_err(dev, "keyword_ctrl_set_bin_data() error: driver is busy"); return -EBUSY; } @@ -541,8 +505,7 @@ static int test_keyword_ctrl_set_bin_data(struct comp_dev *dev, ret = test_keyword_set_model(dev, cdata); break; default: - trace_keyword_error_with_ids(dev, "keyword_ctrl_set_bin_data() " - "error: unknown binary data type"); + comp_err(dev, "keyword_ctrl_set_bin_data() error: unknown binary data type"); break; } @@ -556,24 +519,20 @@ static int test_keyword_ctrl_set_data(struct comp_dev *dev, /* Check version from ABI header */ if (SOF_ABI_VERSION_INCOMPATIBLE(SOF_ABI_VERSION, cdata->data->abi)) { - trace_keyword_error_with_ids(dev, "test_keyword_cmd_set_data() " - "error: invalid version"); + comp_err(dev, "test_keyword_cmd_set_data() error: invalid version"); return -EINVAL; } switch (cdata->cmd) { case SOF_CTRL_CMD_ENUM: - trace_keyword_with_ids(dev, "test_keyword_cmd_set_data(), " - "SOF_CTRL_CMD_ENUM"); + comp_info(dev, "test_keyword_cmd_set_data(), SOF_CTRL_CMD_ENUM"); break; case SOF_CTRL_CMD_BINARY: - trace_keyword_with_ids(dev, "test_keyword_cmd_set_data(), " - "SOF_CTRL_CMD_BINARY"); + comp_info(dev, "test_keyword_cmd_set_data(), SOF_CTRL_CMD_BINARY"); ret = test_keyword_ctrl_set_bin_data(dev, cdata); break; default: - trace_keyword_error_with_ids(dev, "test_keyword_cmd_set_data() " - "error: invalid cdata->cmd"); + comp_err(dev, "test_keyword_cmd_set_data() error: invalid cdata->cmd"); ret = -EINVAL; break; } @@ -588,11 +547,11 @@ static int test_keyword_get_config(struct comp_dev *dev, size_t bs; int ret = 0; - trace_keyword_with_ids(dev, "test_keyword_get_config()"); + comp_info(dev, "test_keyword_get_config()"); /* Copy back to user space */ bs = cd->config.size; - trace_keyword_with_ids(dev, "value of block size: %u", bs); + comp_info(dev, "value of block size: %u", bs); if (bs == 0 || bs > size) return -EINVAL; @@ -613,30 +572,23 @@ static int test_keyword_get_model(struct comp_dev *dev, size_t bs; int ret = 0; - tracev_keyword_with_ids(dev, "test_keyword_get_model() " - "msg_index = %d, num_elems = %d, " - "remaining = %d ", - cdata->msg_index, cdata->num_elems, - cdata->elems_remaining); + comp_dbg(dev, "test_keyword_get_model() msg_index = %d, num_elems = %d, remaining = %d ", + cdata->msg_index, cdata->num_elems, + cdata->elems_remaining); /* Copy back to user space */ if (cd->model.data) { if (!cdata->msg_index) { /* reset copy offset */ cd->model.data_pos = 0; - trace_keyword_with_ids(dev, "test_keyword_get_model() " - "model data_size = 0x%x, " - "crc = 0x%08x", - cd->model.data_size, - cd->model.crc); + comp_info(dev, "test_keyword_get_model() model data_size = 0x%x, crc = 0x%08x", + cd->model.data_size, cd->model.crc); } bs = cdata->num_elems; if (bs > size) { - trace_keyword_error_with_ids(dev, - "test_keyword_get_model() " - "error: " - "invalid size %d", bs); + comp_err(dev, "test_keyword_get_model() error: invalid size %d", + bs); return -EINVAL; } @@ -650,8 +602,7 @@ static int test_keyword_get_model(struct comp_dev *dev, cd->model.data_pos += bs; } else { - trace_keyword_error_with_ids(dev, "test_keyword_get_model() " - "error: invalid cd->config"); + comp_err(dev, "test_keyword_get_model() error: invalid cd->config"); ret = -EINVAL; } @@ -672,10 +623,7 @@ static int test_keyword_ctrl_get_bin_data(struct comp_dev *dev, ret = test_keyword_get_model(dev, cdata, size); break; default: - trace_keyword_error_with_ids(dev, - "test_keyword_ctrl_get_bin_data() " - "error: " - "unknown binary data type"); + comp_err(dev, "test_keyword_ctrl_get_bin_data() error: unknown binary data type"); break; } @@ -687,16 +635,14 @@ static int test_keyword_ctrl_get_data(struct comp_dev *dev, { int ret = 0; - trace_keyword_with_ids(dev, "test_keyword_ctrl_get_data() size: %d", - size); + comp_info(dev, "test_keyword_ctrl_get_data() size: %d", size); switch (cdata->cmd) { case SOF_CTRL_CMD_BINARY: ret = test_keyword_ctrl_get_bin_data(dev, cdata, size); break; default: - trace_keyword_error_with_ids(dev, "test_keyword_ctrl_get_data() " - "error: invalid cdata->cmd"); + comp_err(dev, "test_keyword_ctrl_get_data() error: invalid cdata->cmd"); return -EINVAL; } @@ -709,7 +655,7 @@ static int test_keyword_cmd(struct comp_dev *dev, int cmd, void *data, { struct sof_ipc_ctrl_data *cdata = data; - trace_keyword_with_ids(dev, "test_keyword_cmd()"); + comp_info(dev, "test_keyword_cmd()"); switch (cmd) { case COMP_CMD_SET_DATA: @@ -726,7 +672,7 @@ static int test_keyword_trigger(struct comp_dev *dev, int cmd) int ret; struct comp_data *cd = comp_get_drvdata(dev); - trace_keyword_with_ids(dev, "test_keyword_trigger()"); + comp_info(dev, "test_keyword_trigger()"); ret = comp_set_state(dev, cmd); if (ret) @@ -748,7 +694,7 @@ static int test_keyword_copy(struct comp_dev *dev) struct comp_data *cd = comp_get_drvdata(dev); struct comp_buffer *source; - tracev_keyword_with_ids(dev, "test_keyword_copy()"); + comp_dbg(dev, "test_keyword_copy()"); /* keyword components will only ever have 1 source */ source = list_first_item(&dev->bsource_list, @@ -769,7 +715,7 @@ static int test_keyword_reset(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_keyword_with_ids(dev, "test_keyword_reset()"); + comp_info(dev, "test_keyword_reset()"); cd->activation = 0; cd->detect_preamble = 0; @@ -784,7 +730,7 @@ static int test_keyword_prepare(struct comp_dev *dev) uint16_t valid_bits = cd->sample_valid_bytes * 8; uint16_t sample_width = cd->config.sample_width; - trace_keyword_with_ids(dev, "test_keyword_prepare()"); + comp_info(dev, "test_keyword_prepare()"); if (valid_bits != sample_width) { /* Default threshold value has to be changed diff --git a/src/audio/eq_fir/eq_fir.c b/src/audio/eq_fir/eq_fir.c index 7d9371aebbc8..ac5764679bc4 100644 --- a/src/audio/eq_fir/eq_fir.c +++ b/src/audio/eq_fir/eq_fir.c @@ -41,22 +41,7 @@ #include #endif -/* tracing */ -#define trace_eq(__e, ...) trace_event(TRACE_CLASS_EQ_FIR, __e, ##__VA_ARGS__) -#define trace_eq_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_EQ_FIR, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_eq(__e, ...) tracev_event(TRACE_CLASS_EQ_FIR, __e, ##__VA_ARGS__) -#define tracev_eq_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_EQ_FIR, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_eq_error(__e, ...) \ - trace_error(TRACE_CLASS_EQ_FIR, __e, ##__VA_ARGS__) -#define trace_eq_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_EQ_FIR, comp_ptr, \ - __e, ##__VA_ARGS__) +static const struct comp_driver comp_eq_fir; /* src component private data */ struct comp_data { @@ -151,24 +136,24 @@ static inline int set_fir_func(struct comp_dev *dev) switch (sourceb->stream.frame_fmt) { #if CONFIG_FORMAT_S16LE case SOF_IPC_FRAME_S16_LE: - trace_eq_with_ids(dev, "set_fir_func(), SOF_IPC_FRAME_S16_LE"); + comp_info(dev, "set_fir_func(), SOF_IPC_FRAME_S16_LE"); set_s16_fir(cd); break; #endif /* CONFIG_FORMAT_S16LE */ #if CONFIG_FORMAT_S24LE case SOF_IPC_FRAME_S24_4LE: - trace_eq_with_ids(dev, "set_fir_func(), SOF_IPC_FRAME_S24_4LE"); + comp_info(dev, "set_fir_func(), SOF_IPC_FRAME_S24_4LE"); set_s24_fir(cd); break; #endif /* CONFIG_FORMAT_S24LE */ #if CONFIG_FORMAT_S32LE case SOF_IPC_FRAME_S32_LE: - trace_eq_with_ids(dev, "set_fir_func(), SOF_IPC_FRAME_S32_LE"); + comp_info(dev, "set_fir_func(), SOF_IPC_FRAME_S32_LE"); set_s32_fir(cd); break; #endif /* CONFIG_FORMAT_S32LE */ default: - trace_eq_error_with_ids(dev, "set_fir_func(), invalid frame_fmt"); + comp_err(dev, "set_fir_func(), invalid frame_fmt"); return -EINVAL; } return 0; @@ -211,20 +196,19 @@ static inline int set_pass_func(struct comp_dev *dev) switch (sourceb->stream.frame_fmt) { #if CONFIG_FORMAT_S16LE case SOF_IPC_FRAME_S16_LE: - trace_eq_with_ids(dev, "set_pass_func(), SOF_IPC_FRAME_S16_LE"); + comp_info(dev, "set_pass_func(), SOF_IPC_FRAME_S16_LE"); cd->eq_fir_func = eq_fir_s16_passthrough; break; #endif /* CONFIG_FORMAT_S32LE */ #if CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE case SOF_IPC_FRAME_S24_4LE: case SOF_IPC_FRAME_S32_LE: - trace_eq_with_ids(dev, "set_pass_func(), SOF_IPC_FRAME_S32_LE"); + comp_info(dev, "set_pass_func(), SOF_IPC_FRAME_S32_LE"); cd->eq_fir_func = eq_fir_s32_passthrough; break; #endif /* CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE */ default: - trace_eq_error_with_ids(dev, "set_pass_func() error: " - "invalid dev->params.frame_fmt"); + comp_err(dev, "set_pass_func() error: invalid dev->params.frame_fmt"); return -EINVAL; } return 0; @@ -268,19 +252,19 @@ static int eq_fir_init_coef(struct sof_eq_fir_config *config, int j; int s; - trace_eq("eq_fir_init_coef(), response assign for %u channels, %u" - " responses", config->channels_in_config, - config->number_of_responses); + comp_cl_info(&comp_eq_fir, "eq_fir_init_coef(), response assign for %u channels, %u responses", + config->channels_in_config, + config->number_of_responses); /* Sanity checks */ if (nch > PLATFORM_MAX_CHANNELS || config->channels_in_config > PLATFORM_MAX_CHANNELS || !config->channels_in_config) { - trace_eq_error("eq_fir_init_coef(), invalid channels count"); + comp_cl_err(&comp_eq_fir, "eq_fir_init_coef(), invalid channels count"); return -EINVAL; } if (config->number_of_responses > SOF_EQ_FIR_MAX_RESPONSES) { - trace_eq_error("eq_fir_init_coef(), # of resp exceeds max"); + comp_cl_err(&comp_eq_fir, "eq_fir_init_coef(), # of resp exceeds max"); return -EINVAL; } @@ -314,15 +298,15 @@ static int eq_fir_init_coef(struct sof_eq_fir_config *config, /* Initialize EQ channel to bypass and continue with * next channel response. */ - trace_eq("eq_fir_init_coef(), ch %d is set to bypass", - i); + comp_cl_info(&comp_eq_fir, "eq_fir_init_coef(), ch %d is set to bypass", + i); fir_reset(&fir[i]); continue; } if (resp >= config->number_of_responses) { - trace_eq_error("eq_fir_init_coef(), requested response %d" - " exceeds what has been defined", resp); + comp_cl_err(&comp_eq_fir, "eq_fir_init_coef(), requested response %d exceeds what has been defined", + resp); return -EINVAL; } @@ -332,23 +316,22 @@ static int eq_fir_init_coef(struct sof_eq_fir_config *config, if (s > 0) { size_sum += s; } else { - trace_eq("eq_fir_init_coef(), FIR length %d" - " is invalid", eq->length); + comp_cl_info(&comp_eq_fir, "eq_fir_init_coef(), FIR length %d is invalid", + eq->length); return -EINVAL; } #if defined FIR_MAX_LENGTH_BUILD_SPECIFIC if (fir[i].taps * nch > FIR_MAX_LENGTH_BUILD_SPECIFIC) { - trace_eq_error("Filter length %d" - " exceeds limitation for build.", - fir[i].length); + comp_cl_err(&comp_eq_fir, "Filter length %d exceeds limitation for build.", + fir[i].length); return -EINVAL; } #endif fir_init_coef(&fir[i], eq); - trace_eq("eq_fir_init_coef(), ch %d is set to response = %d", - i, resp); + comp_cl_info(&comp_eq_fir, "eq_fir_init_coef(), ch %d is set to response = %d", + i, resp); } return size_sum; @@ -388,8 +371,8 @@ static int eq_fir_setup(struct comp_data *cd, int nch) /* Allocate all FIR channels data in a big chunk and clear it */ cd->fir_delay = rballoc(0, SOF_MEM_CAPS_RAM, delay_size); if (!cd->fir_delay) { - trace_eq_error("eq_fir_setup(), delay allocation failed for size %d", - delay_size); + comp_cl_err(&comp_eq_fir, "eq_fir_setup(), delay allocation failed for size %d", + delay_size); return -ENOMEM; } @@ -416,10 +399,10 @@ static struct comp_dev *eq_fir_new(struct sof_ipc_comp *comp) int i; int ret; - trace_eq("eq_fir_new()"); + comp_cl_info(&comp_eq_fir, "eq_fir_new()"); if (IPC_IS_SIZE_INVALID(ipc_fir->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_EQ_FIR, ipc_fir->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_fir->config); return NULL; } @@ -427,8 +410,8 @@ static struct comp_dev *eq_fir_new(struct sof_ipc_comp *comp) * blob size is sane. */ if (bs > SOF_EQ_FIR_MAX_SIZE) { - trace_eq_error("eq_fir_new() error: coefficients blob size = " - "%u > SOF_EQ_FIR_MAX_SIZE", bs); + comp_cl_err(&comp_eq_fir, "eq_fir_new() error: coefficients blob size = %u > SOF_EQ_FIR_MAX_SIZE", + bs); return NULL; } @@ -484,7 +467,7 @@ static void eq_fir_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_eq_with_ids(dev, "eq_fir_free()"); + comp_info(dev, "eq_fir_free()"); eq_fir_free_delaylines(cd); eq_fir_free_parameters(&cd->config); @@ -498,7 +481,7 @@ static void eq_fir_free(struct comp_dev *dev) static int eq_fir_params(struct comp_dev *dev, struct sof_ipc_stream_params *params) { - trace_eq_with_ids(dev, "eq_fir_params()"); + comp_info(dev, "eq_fir_params()"); /* All configuration work is postponed to prepare(). */ return 0; @@ -515,7 +498,7 @@ static int fir_cmd_get_data(struct comp_dev *dev, switch (cdata->cmd) { case SOF_CTRL_CMD_BINARY: - trace_eq_with_ids(dev, "fir_cmd_get_data(), SOF_CTRL_CMD_BINARY"); + comp_info(dev, "fir_cmd_get_data(), SOF_CTRL_CMD_BINARY"); max_size -= sizeof(struct sof_ipc_ctrl_data) + sizeof(struct sof_abi_hdr); @@ -536,13 +519,8 @@ static int fir_cmd_get_data(struct comp_dev *dev, offset; } cdata->num_elems = bs; - trace_eq_with_ids(dev, "fir_cmd_get_data(), " - "blob size %zu " - "msg index %u " - "max size %u " - "offset %zu", - bs, cdata->msg_index, - max_size, offset); + comp_info(dev, "fir_cmd_get_data(), blob size %zu msg index %u max size %u offset %zu", + bs, cdata->msg_index, max_size, offset); ret = memcpy_s(dst, ((struct sof_abi_hdr *) (cdata->data))->size, src + offset, bs); @@ -551,14 +529,12 @@ static int fir_cmd_get_data(struct comp_dev *dev, cdata->data->abi = SOF_ABI_VERSION; cdata->data->size = bs; } else { - trace_eq_error_with_ids(dev, "fir_cmd_get_data() error:" - "invalid cd->config"); + comp_err(dev, "fir_cmd_get_data() error: invalid cd->config"); ret = -EINVAL; } break; default: - trace_eq_error_with_ids(dev, "fir_cmd_get_data() error: " - "invalid cdata->cmd"); + comp_err(dev, "fir_cmd_get_data() error: invalid cdata->cmd"); ret = -EINVAL; break; } @@ -575,19 +551,18 @@ static int fir_cmd_set_data(struct comp_dev *dev, switch (cdata->cmd) { case SOF_CTRL_CMD_BINARY: - trace_eq_with_ids(dev, "fir_cmd_set_data(), SOF_CTRL_CMD_BINARY"); + comp_info(dev, "fir_cmd_set_data(), SOF_CTRL_CMD_BINARY"); /* Check that there is no work-in-progress previous request */ if (cd->config_new && cdata->msg_index == 0) { - trace_eq_error_with_ids(dev, "fir_cmd_set_data(), busy with previous request"); + comp_err(dev, "fir_cmd_set_data(), busy with previous request"); return -EBUSY; } /* Copy new config, find size from header */ - trace_eq_with_ids(dev, "fir_cmd_set_data(): " - "blob size: %u msg_index %u", - cdata->num_elems + cdata->elems_remaining, - cdata->msg_index); + comp_info(dev, "fir_cmd_set_data(): blob size: %u msg_index %u", + cdata->num_elems + cdata->elems_remaining, + cdata->msg_index); if (cdata->num_elems + cdata->elems_remaining > SOF_EQ_FIR_MAX_SIZE) return -EINVAL; @@ -599,9 +574,7 @@ static int fir_cmd_set_data(struct comp_dev *dev, cdata->elems_remaining); if (!cd->config_new) { - trace_eq_error_with_ids(dev, "fir_cmd_set_data() " - "error: buffer " - "allocation failed"); + comp_err(dev, "fir_cmd_set_data() error: buffer allocation failed"); return -EINVAL; } @@ -647,8 +620,7 @@ static int fir_cmd_set_data(struct comp_dev *dev, } break; default: - trace_eq_error_with_ids(dev, "fir_cmd_set_data() " - "error: invalid cdata->cmd"); + comp_err(dev, "fir_cmd_set_data() error: invalid cdata->cmd"); ret = -EINVAL; break; } @@ -663,7 +635,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_with_ids(dev, "eq_fir_cmd()"); + comp_info(dev, "eq_fir_cmd()"); switch (cmd) { case COMP_CMD_SET_DATA: @@ -673,8 +645,7 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data, ret = fir_cmd_get_data(dev, cdata, max_data_size); break; default: - trace_eq_error_with_ids(dev, "eq_fir_cmd() error: " - "invalid command"); + comp_err(dev, "eq_fir_cmd() error: invalid command"); ret = -EINVAL; } @@ -684,7 +655,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) { struct comp_data *cd = comp_get_drvdata(dev); - trace_eq_with_ids(dev, "eq_fir_trigger()"); + comp_info(dev, "eq_fir_trigger()"); if (cmd == COMP_TRIGGER_START || cmd == COMP_TRIGGER_RELEASE) assert(cd->eq_fir_func); @@ -701,7 +672,7 @@ static int eq_fir_copy(struct comp_dev *dev) int ret; int n; - tracev_eq_with_ids(dev, "eq_fir_copy()"); + comp_dbg(dev, "eq_fir_copy()"); sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); @@ -713,7 +684,7 @@ static int eq_fir_copy(struct comp_dev *dev) cd->config_new = NULL; ret = eq_fir_setup(cd, sourceb->stream.channels); if (ret < 0) { - trace_eq_error_with_ids(dev, "eq_fir_copy(), failed FIR setup"); + comp_err(dev, "eq_fir_copy(), failed FIR setup"); return ret; } } @@ -754,7 +725,7 @@ static int eq_fir_prepare(struct comp_dev *dev) uint32_t sink_period_bytes; int ret; - trace_eq_with_ids(dev, "eq_fir_prepare()"); + comp_info(dev, "eq_fir_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -784,8 +755,7 @@ static int eq_fir_prepare(struct comp_dev *dev) sinkb->stream.frame_fmt = cd->sink_format; if (sinkb->stream.size < config->periods_sink * sink_period_bytes) { - trace_eq_error_with_ids(dev, "eq_fir_prepare() error: " - "sink buffer size is insufficient"); + comp_err(dev, "eq_fir_prepare() error: sink buffer size is insufficient"); ret = -ENOMEM; goto err; } @@ -794,8 +764,7 @@ static int eq_fir_prepare(struct comp_dev *dev) if (cd->config && cd->config_ready) { ret = eq_fir_setup(cd, sourceb->stream.channels); if (ret < 0) { - trace_eq_error_with_ids(dev, "eq_fir_prepare() error: " - "eq_fir_setup failed."); + comp_err(dev, "eq_fir_prepare() error: eq_fir_setup failed."); goto err; } @@ -816,7 +785,7 @@ static int eq_fir_reset(struct comp_dev *dev) int i; struct comp_data *cd = comp_get_drvdata(dev); - trace_eq_with_ids(dev, "eq_fir_reset()"); + comp_info(dev, "eq_fir_reset()"); eq_fir_free_delaylines(cd); diff --git a/src/audio/eq_iir/eq_iir.c b/src/audio/eq_iir/eq_iir.c index 3f0190fafa9d..5c58898329e9 100644 --- a/src/audio/eq_iir/eq_iir.c +++ b/src/audio/eq_iir/eq_iir.c @@ -30,22 +30,7 @@ #include #include -/* tracing */ -#define trace_eq(__e, ...) trace_event(TRACE_CLASS_EQ_IIR, __e, ##__VA_ARGS__) -#define trace_eq_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_EQ_IIR, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_eq(__e, ...) tracev_event(TRACE_CLASS_EQ_IIR, __e, ##__VA_ARGS__) -#define tracev_eq_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_EQ_IIR, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_eq_error(__e, ...) \ - trace_error(TRACE_CLASS_EQ_IIR, __e, ##__VA_ARGS__) -#define trace_eq_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_EQ_IIR, comp_ptr, \ - __e, ##__VA_ARGS__) +static const struct comp_driver comp_eq_iir; /* IIR component private data */ struct comp_data { @@ -377,19 +362,19 @@ static int eq_iir_init_coef(struct sof_eq_iir_config *config, int j; int s; - trace_eq("eq_iir_init_coef(), response assign for %u channels, " - "%u responses", config->channels_in_config, - config->number_of_responses); + comp_cl_info(&comp_eq_iir, "eq_iir_init_coef(), response assign for %u channels, %u responses", + config->channels_in_config, + config->number_of_responses); /* Sanity checks */ if (nch > PLATFORM_MAX_CHANNELS || config->channels_in_config > PLATFORM_MAX_CHANNELS || !config->channels_in_config) { - trace_eq_error("eq_iir_init_coef(), invalid channels count"); + comp_cl_err(&comp_eq_iir, "eq_iir_init_coef(), invalid channels count"); return -EINVAL; } if (config->number_of_responses > SOF_EQ_IIR_MAX_RESPONSES) { - trace_eq_error("eq_iir_init_coef(), # of resp exceeds max"); + comp_cl_err(&comp_eq_iir, "eq_iir_init_coef(), # of resp exceeds max"); return -EINVAL; } @@ -424,15 +409,15 @@ static int eq_iir_init_coef(struct sof_eq_iir_config *config, /* Initialize EQ channel to bypass and continue with * next channel response. */ - trace_eq("eq_iir_init_coef(), ch %d is set to bypass", - i); + comp_cl_err(&comp_eq_iir, "eq_iir_init_coef(), ch %d is set to bypass", + i); iir_reset_df2t(&iir[i]); continue; } if (resp >= config->number_of_responses) { - trace_eq("eq_iir_init_coef(), requested response %d" - " exceeds defined", resp); + comp_cl_info(&comp_eq_iir, "eq_iir_init_coef(), requested response %d exceeds defined", + resp); return -EINVAL; } @@ -442,14 +427,14 @@ static int eq_iir_init_coef(struct sof_eq_iir_config *config, if (s > 0) { size_sum += s; } else { - trace_eq("eq_iir_init_coef(), sections count %d" - " exceeds max", eq->num_sections); + comp_cl_info(&comp_eq_iir, "eq_iir_init_coef(), sections count %d exceeds max", + eq->num_sections); return -EINVAL; } iir_init_coef_df2t(&iir[i], eq); - trace_eq("eq_iir_init_coef(), ch %d is set to response %d", - i, resp); + comp_cl_info(&comp_eq_iir, "eq_iir_init_coef(), ch %d is set to response %d", + i, resp); } return size_sum; @@ -492,7 +477,7 @@ static int eq_iir_setup(struct comp_data *cd, int nch) cd->iir_delay = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, delay_size); if (!cd->iir_delay) { - trace_eq_error("eq_iir_setup(), delay allocation fail"); + comp_cl_err(&comp_eq_iir, "eq_iir_setup(), delay allocation fail"); return -ENOMEM; } @@ -519,10 +504,10 @@ static struct comp_dev *eq_iir_new(struct sof_ipc_comp *comp) int i; int ret; - trace_eq("eq_iir_new()"); + comp_cl_info(&comp_eq_iir, "eq_iir_new()"); if (IPC_IS_SIZE_INVALID(ipc_iir->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_EQ_IIR, ipc_iir->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_iir->config); return NULL; } @@ -530,8 +515,8 @@ static struct comp_dev *eq_iir_new(struct sof_ipc_comp *comp) * blob size is sane. */ if (bs > SOF_EQ_IIR_MAX_SIZE) { - trace_eq_error("eq_iir_new(), coefficients blob size %u " - "exceeds maximum", bs); + comp_cl_err(&comp_eq_iir, "eq_iir_new(), coefficients blob size %u exceeds maximum", + bs); return NULL; } @@ -586,7 +571,7 @@ static void eq_iir_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_eq_with_ids(dev, "eq_iir_free()"); + comp_info(dev, "eq_iir_free()"); eq_iir_free_delaylines(cd); eq_iir_free_parameters(&cd->config); @@ -600,7 +585,7 @@ static void eq_iir_free(struct comp_dev *dev) static int eq_iir_params(struct comp_dev *dev, struct sof_ipc_stream_params *params) { - trace_eq_with_ids(dev, "eq_iir_params()"); + comp_info(dev, "eq_iir_params()"); /* All configuration work is postponed to prepare(). */ return 0; @@ -616,13 +601,13 @@ static int iir_cmd_get_data(struct comp_dev *dev, switch (cdata->cmd) { case SOF_CTRL_CMD_BINARY: - trace_eq_with_ids(dev, "iir_cmd_get_data(), SOF_CTRL_CMD_BINARY"); + comp_info(dev, "iir_cmd_get_data(), SOF_CTRL_CMD_BINARY"); /* Copy back to user space */ if (cd->config) { bs = cd->config->size; - trace_eq_with_ids(dev, "iir_cmd_set_data(), size %u", - bs); + comp_info(dev, "iir_cmd_set_data(), size %u", + bs); if (bs > SOF_EQ_IIR_MAX_SIZE || bs == 0 || bs > max_size) return -EINVAL; @@ -634,12 +619,12 @@ static int iir_cmd_get_data(struct comp_dev *dev, cdata->data->abi = SOF_ABI_VERSION; cdata->data->size = bs; } else { - trace_eq_error_with_ids(dev, "iir_cmd_get_data(), no config"); + comp_err(dev, "iir_cmd_get_data(), no config"); ret = -EINVAL; } break; default: - trace_eq_error_with_ids(dev, "iir_cmd_get_data(), invalid command"); + comp_err(dev, "iir_cmd_get_data(), invalid command"); ret = -EINVAL; break; } @@ -656,20 +641,20 @@ static int iir_cmd_set_data(struct comp_dev *dev, switch (cdata->cmd) { case SOF_CTRL_CMD_BINARY: - trace_eq_with_ids(dev, "iir_cmd_set_data(), SOF_CTRL_CMD_BINARY"); + comp_info(dev, "iir_cmd_set_data(), SOF_CTRL_CMD_BINARY"); /* Find size from header */ request = (struct sof_eq_iir_config *)cdata->data->data; bs = request->size; if (bs > SOF_EQ_IIR_MAX_SIZE || bs == 0) { - trace_eq_error_with_ids(dev, "iir_cmd_set_data(), size %d" - " is invalid", bs); + comp_err(dev, "iir_cmd_set_data(), size %d is invalid", + bs); return -EINVAL; } /* Check that there is no work-in-progress previous request */ if (cd->config_new) { - trace_eq_error_with_ids(dev, "iir_cmd_set_data(), busy with previous"); + comp_err(dev, "iir_cmd_set_data(), busy with previous"); return -EBUSY; } @@ -677,7 +662,7 @@ static int iir_cmd_set_data(struct comp_dev *dev, cd->config_new = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, bs); if (!cd->config_new) { - trace_eq_error_with_ids(dev, "iir_cmd_set_data(), alloc fail"); + comp_err(dev, "iir_cmd_set_data(), alloc fail"); return -EINVAL; } @@ -705,7 +690,7 @@ static int iir_cmd_set_data(struct comp_dev *dev, break; default: - trace_eq_error_with_ids(dev, "iir_cmd_set_data(), invalid command"); + comp_err(dev, "iir_cmd_set_data(), invalid command"); ret = -EINVAL; break; } @@ -720,7 +705,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_with_ids(dev, "eq_iir_cmd()"); + comp_info(dev, "eq_iir_cmd()"); switch (cmd) { case COMP_CMD_SET_DATA: @@ -730,7 +715,7 @@ static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data, ret = iir_cmd_get_data(dev, cdata, max_data_size); break; default: - trace_eq_error_with_ids(dev, "eq_iir_cmd(), invalid command"); + comp_err(dev, "eq_iir_cmd(), invalid command"); ret = -EINVAL; } @@ -740,7 +725,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) { struct comp_data *cd = comp_get_drvdata(dev); - trace_eq_with_ids(dev, "eq_iir_trigger()"); + comp_info(dev, "eq_iir_trigger()"); if (cmd == COMP_TRIGGER_START || cmd == COMP_TRIGGER_RELEASE) assert(cd->eq_iir_func); @@ -756,7 +741,7 @@ static int eq_iir_copy(struct comp_dev *dev) struct comp_buffer *sourceb; int ret; - tracev_eq_with_ids(dev, "eq_iir_copy()"); + comp_dbg(dev, "eq_iir_copy()"); sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); @@ -768,7 +753,7 @@ static int eq_iir_copy(struct comp_dev *dev) cd->config_new = NULL; ret = eq_iir_setup(cd, sourceb->stream.channels); if (ret < 0) { - trace_eq_error_with_ids(dev, "eq_iir_copy(), failed IIR setup"); + comp_err(dev, "eq_iir_copy(), failed IIR setup"); return ret; } } @@ -776,7 +761,7 @@ static int eq_iir_copy(struct comp_dev *dev) /* Get source, sink, number of frames etc. to process. */ ret = comp_get_copy_limits(dev, &cl); if (ret < 0) { - trace_eq_error_with_ids(dev, "eq_iir_copy(), failed comp_get_copy_limits()"); + comp_err(dev, "eq_iir_copy(), failed comp_get_copy_limits()"); return ret; } @@ -799,7 +784,7 @@ static int eq_iir_prepare(struct comp_dev *dev) uint32_t sink_period_bytes; int ret; - trace_eq_with_ids(dev, "eq_iir_prepare()"); + comp_info(dev, "eq_iir_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -829,38 +814,38 @@ static int eq_iir_prepare(struct comp_dev *dev) sinkb->stream.frame_fmt = cd->sink_format; if (sinkb->stream.size < config->periods_sink * sink_period_bytes) { - trace_eq_error_with_ids(dev, "eq_iir_prepare(), sink buffer size %d is insufficient", - sinkb->stream.size); + comp_err(dev, "eq_iir_prepare(), sink buffer size %d is insufficient", + sinkb->stream.size); ret = -ENOMEM; goto err; } /* Initialize EQ */ - trace_eq_with_ids(dev, "eq_iir_prepare(), source_format=%d, sink_format=%d", - cd->source_format, cd->sink_format); + comp_info(dev, "eq_iir_prepare(), source_format=%d, sink_format=%d", + cd->source_format, cd->sink_format); if (cd->config) { ret = eq_iir_setup(cd, sourceb->stream.channels); if (ret < 0) { - trace_eq_error_with_ids(dev, "eq_iir_prepare(), setup failed."); + comp_err(dev, "eq_iir_prepare(), setup failed."); goto err; } cd->eq_iir_func = eq_iir_find_func(cd, fm_configured, ARRAY_SIZE(fm_configured)); if (!cd->eq_iir_func) { - trace_eq_error_with_ids(dev, "eq_iir_prepare(), No proc func"); + comp_err(dev, "eq_iir_prepare(), No proc func"); ret = -EINVAL; goto err; } - trace_eq_with_ids(dev, "eq_iir_prepare(), IIR is configured."); + comp_info(dev, "eq_iir_prepare(), IIR is configured."); } else { cd->eq_iir_func = eq_iir_find_func(cd, fm_passthrough, ARRAY_SIZE(fm_passthrough)); if (!cd->eq_iir_func) { - trace_eq_error_with_ids(dev, "eq_iir_prepare(), No pass func"); + comp_err(dev, "eq_iir_prepare(), No pass func"); ret = -EINVAL; goto err; } - trace_eq_with_ids(dev, "eq_iir_prepare(), pass-through mode."); + comp_info(dev, "eq_iir_prepare(), pass-through mode."); } return 0; @@ -874,7 +859,7 @@ static int eq_iir_reset(struct comp_dev *dev) int i; struct comp_data *cd = comp_get_drvdata(dev); - trace_eq_with_ids(dev, "eq_iir_reset()"); + comp_info(dev, "eq_iir_reset()"); eq_iir_free_delaylines(cd); diff --git a/src/audio/host.c b/src/audio/host.c index b9d4983cf444..3bb648eed874 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -28,32 +28,7 @@ #include #include -#define trace_host(__e, ...) \ - trace_event(TRACE_CLASS_HOST, __e, ##__VA_ARGS__) - -#define trace_host_with_ids(comp_ptr, format, ...) \ - trace_event_with_ids(TRACE_CLASS_HOST, \ - comp_ptr->comp.pipeline_id,\ - comp_ptr->comp.id, \ - format, ##__VA_ARGS__) - -#define tracev_host(__e, ...) \ - tracev_event(TRACE_CLASS_HOST, __e, ##__VA_ARGS__) - -#define tracev_host_with_ids(comp_ptr, format, ...) \ - tracev_event_with_ids(TRACE_CLASS_HOST, \ - comp_ptr->comp.pipeline_id,\ - comp_ptr->comp.id, \ - format, ##__VA_ARGS__) - -#define trace_host_error(__e, ...) \ - trace_error(TRACE_CLASS_HOST, __e, ##__VA_ARGS__) - -#define trace_host_error_with_ids(comp_ptr, format, ...) \ - trace_error_with_ids(TRACE_CLASS_HOST, \ - comp_ptr->comp.pipeline_id,\ - comp_ptr->comp.id, \ - format, ##__VA_ARGS__) +static const struct comp_driver comp_host; /** * \brief Host buffer info. @@ -232,7 +207,7 @@ static void host_dma_cb(void *arg, enum notify_id type, void *data) struct host_data *hd = comp_get_drvdata(dev); uint32_t bytes = next->elem.size; - tracev_host("host_dma_cb()"); + comp_cl_dbg(&comp_host, "host_dma_cb() %p", &comp_host); /* update position */ host_update_position(dev, bytes); @@ -261,9 +236,7 @@ static int create_local_elems(struct comp_dev *dev, uint32_t buffer_count, err = dma_sg_alloc(&hd->config.elem_array, SOF_MEM_ZONE_RUNTIME, dir, 1, 0, 0, 0); if (err < 0) { - trace_host_error_with_ids(dev, "create_local_elems() " - "error: dma_sg_alloc() " - "failed"); + comp_err(dev, "create_local_elems() error: dma_sg_alloc() failed"); return err; } } else { @@ -274,8 +247,7 @@ static int create_local_elems(struct comp_dev *dev, uint32_t buffer_count, buffer_bytes, (uintptr_t)(hd->dma_buffer->stream.addr), 0); if (err < 0) { - trace_host_error_with_ids(dev, "create_local_elems() error: " - "dma_sg_alloc() failed"); + comp_err(dev, "create_local_elems() error: dma_sg_alloc() failed"); return err; } @@ -297,7 +269,7 @@ static int host_trigger(struct comp_dev *dev, int cmd) struct host_data *hd = comp_get_drvdata(dev); int ret = 0; - trace_host_with_ids(dev, "host_trigger()"); + comp_info(dev, "host_trigger()"); ret = comp_set_state(dev, cmd); if (ret < 0) @@ -315,8 +287,7 @@ static int host_trigger(struct comp_dev *dev, int cmd) return ret; if (!hd->chan) { - trace_host_error_with_ids(dev, "host_trigger() error: no dma " - "channel configured"); + comp_err(dev, "host_trigger() error: no dma channel configured"); return -EINVAL; } @@ -324,16 +295,15 @@ static int host_trigger(struct comp_dev *dev, int cmd) case COMP_TRIGGER_START: ret = dma_start(hd->chan); if (ret < 0) - trace_host_error_with_ids(dev, "host_trigger() error: " - "dma_start() failed, " - "ret = %u", ret); + comp_err(dev, "host_trigger() error: dma_start() failed, ret = %u", + ret); break; case COMP_TRIGGER_STOP: case COMP_TRIGGER_XRUN: ret = dma_stop(hd->chan); if (ret < 0) - trace_host_error_with_ids(dev, "host_trigger(): dma " - "stop failed: %d", ret); + comp_err(dev, "host_trigger(): dma stop failed: %d", + ret); break; default: break; @@ -351,10 +321,10 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp) uint32_t dir; int ret; - trace_host("host_new()"); + comp_cl_info(&comp_host, "host_new()"); if (IPC_IS_SIZE_INVALID(ipc_host->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_HOST, ipc_host->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_host->config); return NULL; } @@ -382,7 +352,7 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp) hd->dma = dma_get(dir, 0, DMA_DEV_HOST, DMA_ACCESS_SHARED); if (!hd->dma) { - trace_host_error("host_new() error: dma_get() returned NULL"); + comp_cl_err(&comp_host, "host_new() error: dma_get() returned NULL"); rfree(hd); rfree(dev); return NULL; @@ -405,7 +375,7 @@ static void host_free(struct comp_dev *dev) { struct host_data *hd = comp_get_drvdata(dev); - trace_host_with_ids(dev, "host_free()"); + comp_info(dev, "host_free()"); dma_put(hd->dma); @@ -461,7 +431,7 @@ static int host_params(struct comp_dev *dev, uint32_t align; int err; - trace_host_with_ids(dev, "host_params()"); + comp_info(dev, "host_params()"); /* host params always installed by pipeline IPC */ hd->host_size = params->buffer.size; @@ -473,18 +443,16 @@ static int host_params(struct comp_dev *dev, err = dma_get_attribute(hd->dma, DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT, &addr_align); if (err < 0) { - trace_host_error_with_ids(dev, "host_params() error: could not " - "get dma buffer address alignment, " - "err = %d", err); + comp_err(dev, "host_params() error: could not get dma buffer address alignment, err = %d", + err); return err; } /* retrieve DMA buffer size alignment */ err = dma_get_attribute(hd->dma, DMA_ATTR_BUFFER_ALIGNMENT, &align); if (err < 0 || !align) { - trace_host_error_with_ids(dev, "host_params() error: could not " - "get valid dma buffer alignment, err " - "= %d, align = %u", err, align); + comp_err(dev, "host_params() error: could not get valid dma buffer alignment, err = %d, align = %u", + err, align); return -EINVAL; } @@ -492,10 +460,8 @@ static int host_params(struct comp_dev *dev, err = dma_get_attribute(hd->dma, DMA_ATTR_BUFFER_PERIOD_COUNT, &period_count); if (err < 0 || !period_count) { - trace_host_error_with_ids(dev, "host_params() error: could not " - "get valid dma buffer period count, " - "err = %d, period_count = %u", err, - period_count); + comp_err(dev, "host_params() error: could not get valid dma buffer period count, err = %d, period_count = %u", + err, period_count); return -EINVAL; } @@ -511,8 +477,7 @@ static int host_params(struct comp_dev *dev, period_bytes = dev->frames * audio_stream_frame_bytes(&hd->local_buffer->stream); if (!period_bytes) { - trace_host_error_with_ids(dev, "host_params() error: invalid " - "period_bytes"); + comp_err(dev, "host_params() error: invalid period_bytes"); return -EINVAL; } @@ -540,18 +505,15 @@ static int host_params(struct comp_dev *dev, if (hd->dma_buffer) { err = buffer_set_size(hd->dma_buffer, buffer_size); if (err < 0) { - trace_host_error_with_ids(dev, "host_params() error: " - "buffer_set_size() failed, " - "buffer_size = %u", - buffer_size); + comp_err(dev, "host_params() error: buffer_set_size() failed, buffer_size = %u", + buffer_size); return err; } } else { hd->dma_buffer = buffer_alloc(buffer_size, SOF_MEM_CAPS_DMA, addr_align); if (!hd->dma_buffer) { - trace_host_error_with_ids(dev, "host_params() error: " - "failed to alloc dma buffer"); + comp_err(dev, "host_params() error: failed to alloc dma buffer"); return -ENOMEM; } } @@ -579,15 +541,13 @@ static int host_params(struct comp_dev *dev, */ hd->chan = dma_channel_get(hd->dma, hd->stream_tag); if (!hd->chan) { - trace_host_error_with_ids(dev, "host_params() error: " - "hd->chan is NULL"); + comp_err(dev, "host_params() error: hd->chan is NULL"); return -ENODEV; } err = dma_set_config(hd->chan, &hd->config); if (err < 0) { - trace_host_error_with_ids(dev, "host_params() error: " - "dma_set_config() failed"); + comp_err(dev, "host_params() error: dma_set_config() failed"); dma_channel_put(hd->chan); hd->chan = NULL; return err; @@ -597,8 +557,7 @@ static int host_params(struct comp_dev *dev, &hd->dma_copy_align); if (err < 0) { - trace_host_error_with_ids(dev, "host_params() error: " - "dma_get_attribute()"); + comp_err(dev, "host_params() error: dma_get_attribute()"); return err; } @@ -619,7 +578,7 @@ static int host_prepare(struct comp_dev *dev) struct host_data *hd = comp_get_drvdata(dev); int ret; - trace_host_with_ids(dev, "host_prepare()"); + comp_info(dev, "host_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -662,7 +621,7 @@ static int host_reset(struct comp_dev *dev) { struct host_data *hd = comp_get_drvdata(dev); - trace_host_with_ids(dev, "host_reset()"); + comp_info(dev, "host_reset()"); if (hd->chan) { /* remove callback */ @@ -725,9 +684,8 @@ static uint32_t host_buffer_get_copy_bytes(struct comp_dev *dev) ret = dma_get_data_size(hd->chan, &avail_bytes, &free_bytes); if (ret < 0) { - trace_host_error("host_buffer_cb() error: " - "dma_get_data_size() failed, ret = %u", - ret); + comp_cl_err(&comp_host, "host_buffer_cb() error: dma_get_data_size() failed, ret = %u", + ret); return 0; } @@ -756,7 +714,7 @@ static int host_copy(struct comp_dev *dev) uint32_t flags = 0; int ret = 0; - tracev_host_with_ids(dev, "host_copy()"); + comp_dbg(dev, "host_copy()"); if (dev->state != COMP_STATE_ACTIVE) return 0; @@ -772,23 +730,22 @@ static int host_copy(struct comp_dev *dev) copy_bytes = host_buffer_get_copy_bytes(dev); if (!copy_bytes) { - trace_host_with_ids(dev, "host_copy(): no bytes to copy"); + comp_info(dev, "host_copy(): no bytes to copy"); return ret; } /* reconfigure transfer */ ret = dma_set_config(hd->chan, &hd->config); if (ret < 0) { - trace_host_error("host_copy() error: " - "dma_set_config() failed, ret = %u", - ret); + comp_cl_err(&comp_host, "host_copy() error: dma_set_config() failed, ret = %u", + ret); return ret; } ret = dma_copy(hd->chan, copy_bytes, flags); if (ret < 0) { - trace_host_error("host_copy() error: dma_copy() " - "failed, ret = %u", ret); + comp_cl_err(&comp_host, "host_copy() error: dma_copy() failed, ret = %u", + ret); return ret; } diff --git a/src/audio/kpb.c b/src/audio/kpb.c index 65f4608172f3..f44345fbd131 100644 --- a/src/audio/kpb.c +++ b/src/audio/kpb.c @@ -43,6 +43,8 @@ #include #include +static const struct comp_driver comp_kpb; + /* KPB private data, runtime data */ struct comp_data { uint64_t state_log; /**< keeps record of KPB recent states */ @@ -118,11 +120,11 @@ static struct comp_dev *kpb_new(struct sof_ipc_comp *comp) struct comp_data *kpb; int ret; - trace_kpb("kpb_new()"); + comp_cl_info(&comp_kpb, "kpb_new()"); /* Validate input parameters */ if (IPC_IS_SIZE_INVALID(ipc_process->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_KPB, ipc_process->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_process->config); return NULL; } @@ -148,20 +150,17 @@ static struct comp_dev *kpb_new(struct sof_ipc_comp *comp) assert(!ret); if (!kpb_is_sample_width_supported(kpb->config.sampling_width)) { - trace_kpb_error_with_ids(dev, "kpb_new() error: " - "requested sampling width not supported"); + comp_err(dev, "kpb_new() error: requested sampling width not supported"); return NULL; } if (kpb->config.channels > KPB_MAX_SUPPORTED_CHANNELS) { - trace_kpb_error_with_ids(dev, "kpb_new() error: " - "no of channels exceeded the limit"); + comp_err(dev, "kpb_new() error: no of channels exceeded the limit"); return NULL; } if (kpb->config.sampling_freq != KPB_SAMPLNG_FREQUENCY) { - trace_kpb_error_with_ids(dev, "kpb_new() error: " - "requested sampling frequency not supported"); + comp_err(dev, "kpb_new() error: requested sampling frequency not supported"); return NULL; } @@ -207,7 +206,7 @@ static size_t kpb_allocate_history_buffer(struct comp_data *kpb, int i = 0; size_t allocated_size = 0; - trace_kpb("kpb_allocate_history_buffer()"); + comp_cl_info(&comp_kpb, "kpb_allocate_history_buffer()"); /* Initialize history buffer */ kpb->history_buffer = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, @@ -233,7 +232,8 @@ static size_t kpb_allocate_history_buffer(struct comp_data *kpb, /* We managed to allocate a block of ca_size. * Now we initialize it. */ - trace_kpb("kpb new memory block: %d", ca_size); + comp_cl_info(&comp_kpb, "kpb new memory block: %d", + ca_size); allocated_size += ca_size; history_buffer->start_addr = new_mem_block; history_buffer->end_addr = (char *)new_mem_block + @@ -280,8 +280,8 @@ static size_t kpb_allocate_history_buffer(struct comp_data *kpb, } } - trace_kpb("kpb_allocate_history_buffer(): allocated %d bytes", - allocated_size); + comp_cl_info(&comp_kpb, "kpb_allocate_history_buffer(): allocated %d bytes", + allocated_size); return allocated_size; } @@ -297,7 +297,7 @@ static void kpb_free_history_buffer(struct hb *buff) struct hb *_buff; struct hb *first_buff = buff; - trace_kpb("kpb_free_history_buffer()"); + comp_cl_info(&comp_kpb, "kpb_free_history_buffer()"); if (!buff) return; @@ -324,7 +324,7 @@ static void kpb_free(struct comp_dev *dev) { struct comp_data *kpb = comp_get_drvdata(dev); - trace_kpb_with_ids(dev, "kpb_free()"); + comp_info(dev, "kpb_free()"); /* Unregister KPB from notifications */ notifier_unregister(dev, NULL, NOTIFIER_ID_KPB_CLIENT_EVT); @@ -350,7 +350,7 @@ static void kpb_free(struct comp_dev *dev) */ static int kpb_trigger(struct comp_dev *dev, int cmd) { - trace_kpb_with_ids(dev, "kpb_trigger()"); + comp_info(dev, "kpb_trigger()"); return comp_set_state(dev, cmd); } @@ -390,12 +390,12 @@ static int kpb_prepare(struct comp_dev *dev) struct comp_buffer *sink; size_t hb_size_req = KPB_MAX_BUFFER_SIZE(kpb->config.sampling_width); - trace_kpb_with_ids(dev, "kpb_prepare()"); + comp_info(dev, "kpb_prepare()"); if (kpb->state == KPB_STATE_RESETTING || kpb->state == KPB_STATE_RESET_FINISHING) { - trace_kpb_error("kpb_prepare() error: can not prepare KPB due to ongoing reset, state log %x", - kpb->state_log); + comp_cl_err(&comp_kpb, "kpb_prepare() error: can not prepare KPB due to ongoing reset, state log %x", + kpb->state_log); return -EBUSY; } @@ -408,7 +408,7 @@ static int kpb_prepare(struct comp_dev *dev) if (!validate_host_params(dev, kpb->host_period_size, kpb->host_buffer_size)) { - trace_kpb_error("kpb_prepare() error: wrong host params."); + comp_cl_err(&comp_kpb, "kpb_prepare() error: wrong host params."); return -EINVAL; } @@ -433,7 +433,7 @@ static int kpb_prepare(struct comp_dev *dev) /* Have we allocated what we requested? */ if (kpb->buffer_size < hb_size_req) { - trace_kpb_error("kpb_prepare() error: failed to allocate space for KPB buffer"); + comp_cl_err(&comp_kpb, "kpb_prepare() error: failed to allocate space for KPB buffer"); kpb_free_history_buffer(kpb->history_buffer); kpb->history_buffer = NULL; kpb->buffer_size = 0; @@ -479,10 +479,8 @@ static int kpb_prepare(struct comp_dev *dev) } if (!kpb->sel_sink || !kpb->host_sink) { - trace_kpb_with_ids(dev, "kpb_prepare() error: could not find " - "sinks: sel_sink %d host_sink %d", - (uint32_t)kpb->sel_sink, - (uint32_t)kpb->host_sink); + comp_info(dev, "kpb_prepare() error: could not find sinks: sel_sink %d host_sink %d", + (uint32_t)kpb->sel_sink, (uint32_t)kpb->host_sink); ret = -EIO; } @@ -519,8 +517,8 @@ static int kpb_reset(struct comp_dev *dev) struct comp_data *kpb = comp_get_drvdata(dev); int ret = 0; - trace_kpb("kpb_reset(): resetting from state %d, state log %x", - kpb->state, kpb->state_log); + comp_cl_info(&comp_kpb, "kpb_reset(): resetting from state %d, state log %x", + kpb->state, kpb->state_log); switch (kpb->state) { case KPB_STATE_BUFFERING: @@ -579,7 +577,7 @@ static int kpb_copy(struct comp_dev *dev) size_t sample_width = kpb->config.sampling_width; uint32_t hb_free_space; - tracev_kpb_with_ids(dev, "kpb_copy()"); + comp_dbg(dev, "kpb_copy()"); /* Get source and sink buffers */ source = list_first_item(&dev->bsource_list, struct comp_buffer, @@ -587,8 +585,7 @@ static int kpb_copy(struct comp_dev *dev) /* Validate source */ if (!source || !source->stream.r_ptr) { - trace_kpb_error_with_ids(dev, "kpb_copy(): " - "invalid source pointers."); + comp_err(dev, "kpb_copy(): invalid source pointers."); ret = -EINVAL; goto out; } @@ -600,17 +597,15 @@ static int kpb_copy(struct comp_dev *dev) /* Validate sink */ if (!sink || !sink->stream.w_ptr) { - trace_kpb_error_with_ids(dev, "kpb_copy(): invalid " - "selector sink pointers."); + comp_err(dev, "kpb_copy(): invalid selector sink pointers."); ret = -EINVAL; goto out; } copy_bytes = MIN(sink->stream.free, source->stream.avail); if (!copy_bytes) { - trace_kpb_error_with_ids(dev, "kpb_copy() error: nothing to copy sink->free %d source->avail %d", - sink->stream.free, - source->stream.avail); + comp_err(dev, "kpb_copy() error: nothing to copy sink->free %d source->avail %d", + sink->stream.free, source->stream.avail); ret = PPL_STATUS_PATH_STOP; goto out; } @@ -624,9 +619,7 @@ static int kpb_copy(struct comp_dev *dev) if (source->stream.avail <= kpb->buffer_size) { ret = kpb_buffer_data(dev, source, copy_bytes); if (ret) { - trace_kpb_error_with_ids(dev, "kpb_copy(): " - "internal buffering " - "failed."); + comp_err(dev, "kpb_copy(): internal buffering failed."); goto out; } if (kpb->buffered_data < kpb->buffer_size) { @@ -637,8 +630,7 @@ static int kpb_copy(struct comp_dev *dev) MIN(copy_bytes, hb_free_space); } } else { - trace_kpb_error_with_ids(dev, "kpb_copy(): " - "too much data to buffer."); + comp_err(dev, "kpb_copy(): too much data to buffer."); } comp_update_buffer_produce(sink, copy_bytes); @@ -652,17 +644,15 @@ static int kpb_copy(struct comp_dev *dev) /* Validate sink */ if (!sink || !sink->stream.w_ptr) { - trace_kpb_error_with_ids(dev, "kpb_copy(): " - "invalid host sink pointers."); + comp_err(dev, "kpb_copy(): invalid host sink pointers."); ret = -EINVAL; goto out; } copy_bytes = MIN(sink->stream.free, source->stream.avail); if (!copy_bytes) { - trace_kpb_error_with_ids(dev, "kpb_copy() error: nothing to copy sink->free %d source->avail %d", - sink->stream.free, - source->stream.avail); + comp_err(dev, "kpb_copy() error: nothing to copy sink->free %d source->avail %d", + sink->stream.free, source->stream.avail); ret = PPL_STATUS_PATH_STOP; goto out; } @@ -683,24 +673,21 @@ static int kpb_copy(struct comp_dev *dev) ret = kpb_buffer_data(dev, source, source->stream.avail); if (ret) { - trace_kpb_error_with_ids(dev, "kpb_copy(): " - "internal buffering " - "failed."); + comp_err(dev, "kpb_copy(): internal buffering failed."); goto out; } comp_update_buffer_consume(source, source->stream.avail); } else { - trace_kpb_error_with_ids(dev, "kpb_copy(): " - "too much data to buffer."); + comp_err(dev, "kpb_copy(): too much data to buffer."); } ret = PPL_STATUS_PATH_STOP; break; default: - trace_kpb_error("kpb_copy(): wrong state (state %d, state log %x)", - kpb->state, kpb->state_log); + comp_cl_err(&comp_kpb, "kpb_copy(): wrong state (state %d, state log %x)", + kpb->state, kpb->state_log); ret = -EIO; break; } @@ -733,7 +720,7 @@ static int kpb_buffer_data(struct comp_dev *dev, size_t sample_width = kpb->config.sampling_width; struct timer *timer = timer_get(); - tracev_kpb_with_ids(dev, "kpb_buffer_data()"); + comp_dbg(dev, "kpb_buffer_data()"); /* We are allowed to buffer data in internal history buffer * only in KPB_STATE_RUN, KPB_STATE_DRAINING or KPB_STATE_INIT_DRAINING @@ -742,8 +729,8 @@ static int kpb_buffer_data(struct comp_dev *dev, if (kpb->state != KPB_STATE_RUN && kpb->state != KPB_STATE_DRAINING && kpb->state != KPB_STATE_INIT_DRAINING) { - trace_kpb_error("kpb_buffer_data() error: wrong state! (current state %d, state log %x)", - kpb->state, kpb->state_log); + comp_err(dev, "kpb_buffer_data() error: wrong state! (current state %d, state log %x)", + kpb->state, kpb->state_log); return PPL_STATUS_PATH_STOP; } @@ -768,9 +755,9 @@ static int kpb_buffer_data(struct comp_dev *dev, /* Are we stuck in buffering? */ current_time = platform_timer_get(timer); if (timeout < current_time) { - trace_kpb_error("kpb_buffer_data(): timeout of %d [ms] (current state %d, state log %x)", - current_time - timeout, kpb->state, - kpb->state_log); + comp_err(dev, "kpb_buffer_data(): timeout of %d [ms] (current state %d, state log %x)", + current_time - timeout, kpb->state, + kpb->state_log); return -ETIME; } @@ -847,9 +834,8 @@ static void kpb_event_handler(void *arg, enum notify_id type, void *event_data) struct kpb_event_data *evd = event_data; struct kpb_client *cli = evd->client_data; - trace_kpb_with_ids(dev, "kpb_event_handler(): " - "received event with ID: %d ", - evd->event_id); + comp_info(dev, "kpb_event_handler(): received event with ID: %d ", + evd->event_id); switch (evd->event_id) { case KPB_EVENT_REGISTER_CLIENT: @@ -865,8 +851,7 @@ static void kpb_event_handler(void *arg, enum notify_id type, void *event_data) /*TODO*/ break; default: - trace_kpb_error_with_ids(dev, "kpb_cmd() error: " - "unsupported command"); + comp_err(dev, "kpb_cmd() error: unsupported command"); break; } } @@ -885,24 +870,21 @@ static int kpb_register_client(struct comp_data *kpb, struct kpb_client *cli) { int ret = 0; - trace_kpb("kpb_register_client()"); + comp_cl_info(&comp_kpb, "kpb_register_client()"); if (!cli) { - trace_kpb_error("kpb_register_client() error: " - "no client data"); + comp_cl_err(&comp_kpb, "kpb_register_client() error: no client data"); return -EINVAL; } /* Do we have a room for a new client? */ if (kpb->kpb_no_of_clients >= KPB_MAX_NO_OF_CLIENTS || cli->id >= KPB_MAX_NO_OF_CLIENTS) { - trace_kpb_error("kpb_register_client() error: " - "no free room for client = %u ", - cli->id); + comp_cl_err(&comp_kpb, "kpb_register_client() error: no free room for client = %u ", + cli->id); ret = -EINVAL; } else if (kpb->clients[cli->id].state != KPB_CLIENT_UNREGISTERED) { - trace_kpb_error("kpb_register_client() error: " - "client = %u already registered", - cli->id); + comp_cl_err(&comp_kpb, "kpb_register_client() error: client = %u already registered", + cli->id); ret = -EINVAL; } else { /* Client accepted, let's store his data */ @@ -947,23 +929,19 @@ static void kpb_init_draining(struct comp_dev *dev, struct kpb_client *cli) size_t period_bytes_limit = 0; uint32_t flags; - trace_kpb_with_ids(dev, "kpb_init_draining(): requested draining " - "of %d [ms] from history buffer", - cli->history_depth); + comp_info(dev, "kpb_init_draining(): requested draining of %d [ms] from history buffer", + cli->history_depth); if (kpb->state != KPB_STATE_RUN) { - trace_kpb_error_with_ids(dev, "kpb_init_draining() error: " - "wrong KPB state"); + comp_err(dev, "kpb_init_draining() error: wrong KPB state"); } else if (cli->id > KPB_MAX_NO_OF_CLIENTS) { - trace_kpb_error_with_ids(dev, "kpb_init_draining() error: " - "wrong client id"); + comp_err(dev, "kpb_init_draining() error: wrong client id"); /* TODO: check also if client is registered */ } else if (!is_sink_ready) { - trace_kpb_error_with_ids(dev, "kpb_init_draining() error: " - "sink not ready for draining"); + comp_err(dev, "kpb_init_draining() error: sink not ready for draining"); } else if (kpb->buffered_data < history_depth || kpb->buffer_size < history_depth) { - trace_kpb_error("kpb_init_draining() error: not enough data in history buffer"); + comp_cl_err(&comp_kpb, "kpb_init_draining() error: not enough data in history buffer"); } else { /* Draining accepted, find proper buffer to start reading * At this point we are guaranteed that there is enough data @@ -989,11 +967,7 @@ static void kpb_init_draining(struct comp_dev *dev, struct kpb_client *cli) (uint32_t)buff->start_addr; buffered += local_buffered; } else { - trace_kpb_error_with_ids(dev, - "kpb_init_draining() " - "error: " - "incorrect buffer " - "label"); + comp_err(dev, "kpb_init_draining() error: incorrect buffer label"); } /* Check if this is already sufficient to start draining * if not, go to previous buffer and continue @@ -1041,16 +1015,16 @@ static void kpb_init_draining(struct comp_dev *dev, struct kpb_client *cli) ticks_per_ms) / KPB_DRAIN_NUM_OF_PPL_PERIODS_AT_ONCE; period_bytes_limit = host_period_size; - trace_kpb_with_ids(dev, "kpb_init_draining(): sync_draining_mode selected with interval %d [uS].", drain_interval * 1000 / ticks_per_ms); + comp_info(dev, "kpb_init_draining(): sync_draining_mode selected with interval %d [uS].", + drain_interval * 1000 / ticks_per_ms); } else { /* Unlimited draining */ drain_interval = 0; period_bytes_limit = 0; - trace_kpb_with_ids(dev, "kpb_init_draining: unlimited draining speed selected."); + comp_info(dev, "kpb_init_draining: unlimited draining speed selected."); } - trace_kpb_with_ids(dev, "kpb_init_draining(), " - "schedule draining task"); + comp_info(dev, "kpb_init_draining(), schedule draining task"); /* Add one-time draining task into the scheduler. */ kpb->draining_task_data.sink = kpb->host_sink; @@ -1108,7 +1082,7 @@ static enum task_state kpb_draining_task(void *arg) struct comp_data *kpb = comp_get_drvdata(draining_data->dev); bool sync_mode_on = &draining_data->sync_mode_on; - trace_kpb("kpb_draining_task(), start."); + comp_cl_info(&comp_kpb, "kpb_draining_task(), start."); pm_runtime_disable(PM_RUNTIME_DSP, PLATFORM_MASTER_CORE_ID); @@ -1183,8 +1157,8 @@ static enum task_state kpb_draining_task(void *arg) * while we were draining real time stream could provided * new data which needs to be copy to host. */ - trace_kpb("kpb: update history_depth by %d", - *rt_stream_update); + comp_cl_info(&comp_kpb, "kpb: update history_depth by %d", + *rt_stream_update); history_depth += *rt_stream_update; *rt_stream_update = 0; } @@ -1203,10 +1177,10 @@ static enum task_state kpb_draining_task(void *arg) /* Reset host-sink copy mode back to unblocking */ comp_set_attribute(sink->sink, COMP_ATTR_COPY_TYPE, ©_type); - trace_kpb("KPB: kpb_draining_task(), done. %u drained in %d ms", - drained, - (draining_time_end - draining_time_start) - / clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1)); + comp_cl_info(&comp_kpb, "KPB: kpb_draining_task(), done. %u drained in %d ms", + drained, + (draining_time_end - draining_time_start) + / clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1)); /* If traces are disabled, prevent compile error from unused * variables. @@ -1257,8 +1231,7 @@ static void kpb_drain_samples(void *source, struct audio_stream *sink, break; #endif /* CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE */ default: - trace_kpb_error("KPB: An attempt to copy " - "not supported format!"); + comp_cl_err(&comp_kpb, "KPB: An attempt to copy not supported format!"); return; } j++; @@ -1303,8 +1276,7 @@ static void kpb_buffer_samples(const struct audio_stream *source, break; #endif /* CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE*/ default: - trace_kpb_error("KPB: An attempt to copy " - "not supported format!"); + comp_cl_err(&comp_kpb, "KPB: An attempt to copy not supported format!"); return; } j++; @@ -1324,7 +1296,7 @@ static void kpb_clear_history_buffer(struct hb *buff) void *start_addr; size_t size; - trace_kpb("kpb_clear_history_buffer()"); + comp_cl_info(&comp_kpb, "kpb_clear_history_buffer()"); do { start_addr = buff->start_addr; @@ -1403,8 +1375,7 @@ static void kpb_copy_samples(struct audio_stream *sink, break; #endif /* CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE*/ default: - trace_kpb_error("KPB: An attempt to copy " - "not supported format!"); + comp_cl_err(&comp_kpb, "KPB: An attempt to copy not supported format!"); return; } j++; @@ -1422,7 +1393,7 @@ static void kpb_reset_history_buffer(struct hb *buff) { struct hb *first_buff = buff; - trace_kpb("kpb_reset_history_buffer()"); + comp_cl_info(&comp_kpb, "kpb_reset_history_buffer()"); if (!buff) return; @@ -1497,8 +1468,8 @@ static inline bool validate_host_params(struct comp_dev *dev, static inline void kpb_change_state(struct comp_data *kpb, enum kpb_state state) { - tracev_kpb("kpb_change_state(): from %d to %d", - kpb->state, state); + comp_cl_dbg("kpb_change_state(): from %d to %d", + kpb->state, state); kpb->state = state; kpb->state_log = (kpb->state_log << 4) | state; } diff --git a/src/audio/mixer.c b/src/audio/mixer.c index 892bcdea7707..b5e1bad0b5b3 100644 --- a/src/audio/mixer.c +++ b/src/audio/mixer.c @@ -27,24 +27,7 @@ #include #include -/* mixer tracing */ -#define trace_mixer(__e, ...) \ - trace_event(TRACE_CLASS_MIXER, __e, ##__VA_ARGS__) -#define trace_mixer_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_MIXER, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_mixer(__e, ...) \ - tracev_event(TRACE_CLASS_MIXER, __e, ##__VA_ARGS__) -#define tracev_mixer_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_MIXER, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_mixer_error(__e, ...) \ - trace_error(TRACE_CLASS_MIXER, __e, ##__VA_ARGS__) -#define trace_mixer_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_MIXER, comp_ptr, \ - __e, ##__VA_ARGS__) +static const struct comp_driver comp_mixer; /* mixer component private data */ struct mixer_data { @@ -132,10 +115,10 @@ static struct comp_dev *mixer_new(struct sof_ipc_comp *comp) struct mixer_data *md; int ret; - trace_mixer("mixer_new()"); + comp_cl_info(&comp_mixer, "mixer_new()"); if (IPC_IS_SIZE_INVALID(ipc_mixer->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_MIXER, ipc_mixer->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_mixer->config); return NULL; } @@ -165,7 +148,7 @@ static void mixer_free(struct comp_dev *dev) { struct mixer_data *md = comp_get_drvdata(dev); - trace_mixer_with_ids(dev, "mixer_free()"); + comp_info(dev, "mixer_free()"); rfree(md); rfree(dev); @@ -179,7 +162,7 @@ static int mixer_params(struct comp_dev *dev, struct comp_buffer *sinkb; uint32_t period_bytes; - trace_mixer_with_ids(dev, "mixer_params()"); + comp_info(dev, "mixer_params()"); sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); @@ -187,14 +170,12 @@ static int mixer_params(struct comp_dev *dev, /* calculate period size based on config */ period_bytes = dev->frames * audio_stream_frame_bytes(&sinkb->stream); if (period_bytes == 0) { - trace_mixer_error_with_ids(dev, "mixer_params() error: " - "period_bytes = 0"); + comp_err(dev, "mixer_params() error: period_bytes = 0"); return -EINVAL; } if (sinkb->stream.size < config->periods_sink * period_bytes) { - trace_mixer_error_with_ids(dev, "mixer_params() error: " - "sink buffer size is insufficient"); + comp_err(dev, "mixer_params() error: sink buffer size is insufficient"); return -ENOMEM; } @@ -232,7 +213,7 @@ static int mixer_trigger(struct comp_dev *dev, int cmd) int dir = dev->pipeline->source_comp->direction; int ret; - trace_mixer_with_ids(dev, "mixer_trigger()"); + comp_info(dev, "mixer_trigger()"); ret = comp_set_state(dev, cmd); if (ret < 0) @@ -282,7 +263,7 @@ static int mixer_copy(struct comp_dev *dev) uint32_t source_bytes; uint32_t sink_bytes; - tracev_mixer_with_ids(dev, "mixer_copy()"); + comp_dbg(dev, "mixer_copy()"); sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); @@ -321,8 +302,8 @@ static int mixer_copy(struct comp_dev *dev) source_bytes = frames * audio_stream_frame_bytes(sources_stream[0]); sink_bytes = frames * audio_stream_frame_bytes(&sink->stream); - tracev_mixer_with_ids(dev, "mixer_copy(), source_bytes = 0x%x, " - "sink_bytes = 0x%x", source_bytes, sink_bytes); + comp_dbg(dev, "mixer_copy(), source_bytes = 0x%x, sink_bytes = 0x%x", + source_bytes, sink_bytes); /* mix streams */ md->mix_func(dev, &sink->stream, sources_stream, i, frames); @@ -342,7 +323,7 @@ static int mixer_reset(struct comp_dev *dev) struct list_item *blist; struct comp_buffer *source; - trace_mixer_with_ids(dev, "mixer_reset()"); + comp_info(dev, "mixer_reset()"); list_for_item(blist, &dev->bsource_list) { source = container_of(blist, struct comp_buffer, sink_list); @@ -373,7 +354,7 @@ static int mixer_prepare(struct comp_dev *dev) int downstream = 0; int ret; - trace_mixer_with_ids(dev, "mixer_prepare()"); + comp_info(dev, "mixer_prepare()"); sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); @@ -398,7 +379,7 @@ static int mixer_prepare(struct comp_dev *dev) break; #endif /* CONFIG_FORMAT_S32LE */ default: - trace_mixer_error_with_ids(dev, "unsupported data format"); + comp_err(dev, "unsupported data format"); return -EINVAL; } diff --git a/src/audio/mux/mux.c b/src/audio/mux/mux.c index 964dc826c0ff..89dc17fec537 100644 --- a/src/audio/mux/mux.c +++ b/src/audio/mux/mux.c @@ -29,6 +29,8 @@ #include #include +static const struct comp_driver comp_mux; + static int mux_set_values(struct comp_data *cd, struct sof_mux_config *cfg) { uint8_t i; @@ -36,10 +38,8 @@ static int mux_set_values(struct comp_data *cd, struct sof_mux_config *cfg) /* check if number of streams configured doesn't exceed maximum */ if (cfg->num_streams > MUX_MAX_STREAMS) { - trace_mux_error("mux_set_values() error: configured number of " - "streams (%u) exceeds maximum = " - META_QUOTE(MUX_MAX_STREAMS), - cfg->num_streams); + comp_cl_err(&comp_mux, "mux_set_values() error: configured number of streams (%u) exceeds maximum = " + META_QUOTE(MUX_MAX_STREAMS), cfg->num_streams); return -EINVAL; } @@ -48,10 +48,8 @@ static int mux_set_values(struct comp_data *cd, struct sof_mux_config *cfg) for (j = i + 1; j < cfg->num_streams; j++) { if (cfg->streams[i].pipeline_id == cfg->streams[j].pipeline_id) { - trace_mux_error("mux_set_values() error: " - "multiple configured streams " - "have same pipeline ID = %u", - cfg->streams[i].pipeline_id); + comp_cl_err(&comp_mux, "mux_set_values() error: multiple configured streams have same pipeline ID = %u", + cfg->streams[i].pipeline_id); return -EINVAL; } } @@ -60,11 +58,8 @@ static int mux_set_values(struct comp_data *cd, struct sof_mux_config *cfg) /* check if number of channels per stream doesn't exceed maximum */ for (i = 0; i < cfg->num_streams; i++) { if (cfg->streams[i].num_channels > PLATFORM_MAX_CHANNELS) { - trace_mux_error("mux_set_values() error: configured " - "number of channels for stream %u " - "exceeds platform maximum = " - META_QUOTE(PLATFORM_MAX_CHANNELS), - i); + comp_cl_err(&comp_mux, "mux_set_values() error: configured number of channels for stream %u exceeds platform maximum = " + META_QUOTE(PLATFORM_MAX_CHANNELS), i); return -EINVAL; } } @@ -91,10 +86,10 @@ static struct comp_dev *mux_new(struct sof_ipc_comp *comp) struct comp_data *cd; int ret; - trace_mux("mux_new()"); + comp_cl_info(&comp_mux, "mux_new()"); if (IPC_IS_SIZE_INVALID(ipc_process->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_MUX, ipc_process->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_process->config); return NULL; } @@ -135,7 +130,7 @@ static void mux_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_mux_with_ids(dev, "mux_free()"); + comp_info(dev, "mux_free()"); rfree(cd); rfree(dev); @@ -148,7 +143,7 @@ static int mux_params(struct comp_dev *dev, struct comp_data *cd = comp_get_drvdata(dev); struct comp_buffer *sinkb; - trace_mux_with_ids(dev, "mux_params()"); + comp_info(dev, "mux_params()"); sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); @@ -166,8 +161,8 @@ static int mux_ctrl_set_cmd(struct comp_dev *dev, struct sof_mux_config *cfg; int ret = 0; - trace_mux_with_ids(dev, "mux_ctrl_set_cmd(), cdata->cmd = 0x%08x", - cdata->cmd); + comp_info(dev, "mux_ctrl_set_cmd(), cdata->cmd = 0x%08x", + cdata->cmd); switch (cdata->cmd) { case SOF_CTRL_CMD_BINARY: @@ -177,8 +172,8 @@ static int mux_ctrl_set_cmd(struct comp_dev *dev, ret = mux_set_values(cd, cfg); break; default: - trace_mux_error_with_ids(dev, "mux_ctrl_set_cmd() error: " - "invalid cdata->cmd = 0x%08x", cdata->cmd); + comp_err(dev, "mux_ctrl_set_cmd() error: invalid cdata->cmd = 0x%08x", + cdata->cmd); ret = -EINVAL; break; } @@ -194,7 +189,8 @@ static int mux_ctrl_get_cmd(struct comp_dev *dev, uint32_t reply_size; int ret = 0; - trace_mux("mux_ctrl_get_cmd(), cdata->cmd = 0x%08x", cdata->cmd); + comp_cl_info(&comp_mux, "mux_ctrl_get_cmd(), cdata->cmd = 0x%08x", + cdata->cmd); switch (cdata->cmd) { case SOF_CTRL_CMD_BINARY: @@ -210,8 +206,8 @@ static int mux_ctrl_get_cmd(struct comp_dev *dev, cdata->data->size = reply_size; break; default: - trace_mux_error("mux_ctrl_set_cmd() error: invalid cdata->cmd =" - " 0x%08x", cdata->cmd); + comp_cl_err(&comp_mux, "mux_ctrl_set_cmd() error: invalid cdata->cmd = 0x%08x", + cdata->cmd); ret = -EINVAL; break; } @@ -225,7 +221,7 @@ static int mux_cmd(struct comp_dev *dev, int cmd, void *data, { struct sof_ipc_ctrl_data *cdata = data; - trace_mux_with_ids(dev, "mux_cmd() cmd = 0x%08x", cmd); + comp_info(dev, "mux_cmd() cmd = 0x%08x", cmd); switch (cmd) { case COMP_CMD_SET_DATA: @@ -245,8 +241,8 @@ static uint8_t get_stream_index(struct comp_data *cd, uint32_t pipe_id) if (cd->config.streams[i].pipeline_id == pipe_id) return i; } - trace_mux_error("get_stream_index() error: couldn't find configuration " - "for connected pipeline %u", pipe_id); + comp_cl_err(&comp_mux, "get_stream_index() error: couldn't find configuration for connected pipeline %u", + pipe_id); return 0; } @@ -265,7 +261,7 @@ static int demux_copy(struct comp_dev *dev) uint32_t avail; uint32_t sinks_bytes[MUX_MAX_STREAMS] = { 0 }; - tracev_mux_with_ids(dev, "demux_copy()"); + comp_dbg(dev, "demux_copy()"); // align sink streams with their respective configurations list_for_item(clist, &dev->bsink_list) { @@ -339,7 +335,7 @@ static int mux_copy(struct comp_dev *dev) uint32_t sources_bytes[MUX_MAX_STREAMS] = { 0 }; uint32_t sink_bytes; - tracev_mux_with_ids(dev, "mux_copy()"); + comp_dbg(dev, "mux_copy()"); /* align source streams with their respective configurations */ list_for_item(clist, &dev->bsource_list) { @@ -396,7 +392,7 @@ static int mux_copy(struct comp_dev *dev) static int mux_reset(struct comp_dev *dev) { - trace_mux_with_ids(dev, "mux_reset()"); + comp_info(dev, "mux_reset()"); return comp_set_state(dev, COMP_TRIGGER_RESET); } @@ -406,20 +402,17 @@ static int mux_prepare(struct comp_dev *dev) struct comp_data *cd = comp_get_drvdata(dev); int ret; - trace_mux_with_ids(dev, "mux_prepare()"); + comp_info(dev, "mux_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret) { - trace_mux_with_ids(dev, "mux_prepare() comp_set_state() " - "returned non-zero."); + comp_info(dev, "mux_prepare() comp_set_state() returned non-zero."); return ret; } cd->mux = mux_get_processing_function(dev); if (!cd->mux) { - trace_mux_error_with_ids(dev, "mux_prepare() error: couldn't " - "find appropriate mux processing function for " - "component."); + comp_err(dev, "mux_prepare() error: couldn't find appropriate mux processing function for component."); ret = -EINVAL; goto err; } @@ -436,20 +429,17 @@ static int demux_prepare(struct comp_dev *dev) struct comp_data *cd = comp_get_drvdata(dev); int ret; - trace_mux_with_ids(dev, "demux_prepare()"); + comp_info(dev, "demux_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret) { - trace_mux_with_ids(dev, "demux_prepare() comp_set_state() " - "returned non-zero"); + comp_info(dev, "demux_prepare() comp_set_state() returned non-zero"); return ret; } cd->demux = demux_get_processing_function(dev); if (!cd->demux) { - trace_mux_error_with_ids(dev, "demux_prepare() error: couldn't " - "find appropriate demux processing function " - "for component."); + comp_err(dev, "demux_prepare() error: couldn't find appropriate demux processing function for component."); ret = -EINVAL; goto err; } @@ -465,7 +455,7 @@ static int mux_trigger(struct comp_dev *dev, int cmd) { int ret = 0; - trace_mux_with_ids(dev, "mux_trigger(), command = %u", cmd); + comp_info(dev, "mux_trigger(), command = %u", cmd); ret = comp_set_state(dev, cmd); diff --git a/src/audio/selector/selector.c b/src/audio/selector/selector.c index 846542d96deb..e789eb8c959b 100644 --- a/src/audio/selector/selector.c +++ b/src/audio/selector/selector.c @@ -33,6 +33,8 @@ #include #include +static const struct comp_driver comp_selector; + /** * \brief Validates channel count and index and sets channel count. * \details If input data is not supported trace error is displayed and @@ -48,30 +50,29 @@ static int sel_set_channel_values(struct comp_data *cd, uint32_t in_channels, { /* verify input channels */ if (in_channels != SEL_SOURCE_2CH && in_channels != SEL_SOURCE_4CH) { - trace_selector_error("sel_set_channel_values() error: " - "in_channels = %u", in_channels); + comp_cl_err(&comp_selector, "sel_set_channel_values() error: in_channels = %u", + in_channels); return -EINVAL; } /* verify output channels */ if (out_channels != SEL_SINK_1CH && out_channels != SEL_SINK_2CH && out_channels != SEL_SINK_4CH) { - trace_selector_error("sel_set_channel_values() error: " - "out_channels = %u", out_channels); + comp_cl_err(&comp_selector, "sel_set_channel_values() error: out_channels = %u", + out_channels); return -EINVAL; } /* verify proper channels for passthrough mode */ if (out_channels != SEL_SINK_1CH && in_channels != out_channels) { - trace_selector_error("sel_set_channel_values() error: " - "in_channels = %u, out_channels = %u", - in_channels, out_channels); + comp_cl_err(&comp_selector, "sel_set_channel_values() error: in_channels = %u, out_channels = %u", + in_channels, out_channels); return -EINVAL; } if (ch_idx > (SEL_SOURCE_4CH - 1)) { - trace_selector_error("sel_set_channel_values() error: " - "ch_idx = %u", in_channels); + comp_cl_err(&comp_selector, "sel_set_channel_values() error: ch_idx = %u", + in_channels); return -EINVAL; } @@ -96,10 +97,10 @@ static struct comp_dev *selector_new(struct sof_ipc_comp *comp) struct comp_data *cd; int ret; - trace_selector("selector_new()"); + comp_cl_info(&comp_selector, "selector_new()"); if (IPC_IS_SIZE_INVALID(ipc_process->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_SELECTOR, ipc_process->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_process->config); return NULL; } @@ -145,7 +146,7 @@ static void selector_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_selector_with_ids(dev, "selector_free()"); + comp_info(dev, "selector_free()"); rfree(cd); rfree(dev); @@ -165,7 +166,7 @@ static int selector_params(struct comp_dev *dev, struct comp_buffer *sinkb; struct comp_buffer *sourceb; - trace_selector_with_ids(dev, "selector_params()"); + comp_info(dev, "selector_params()"); sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); @@ -196,8 +197,7 @@ static int selector_ctrl_set_data(struct comp_dev *dev, switch (cdata->cmd) { case SOF_CTRL_CMD_BINARY: - trace_selector_with_ids(dev, "selector_ctrl_set_data(), " - "SOF_CTRL_CMD_BINARY"); + comp_info(dev, "selector_ctrl_set_data(), SOF_CTRL_CMD_BINARY"); cfg = (struct sof_sel_config *) ASSUME_ALIGNED(cdata->data->data, 4); @@ -208,9 +208,8 @@ static int selector_ctrl_set_data(struct comp_dev *dev, cfg->sel_channel); break; default: - trace_selector_error_with_ids(dev, "selector_ctrl_set_cmd() " - "error: invalid cdata->cmd = %u", - cdata->cmd); + comp_err(dev, "selector_ctrl_set_cmd() error: invalid cdata->cmd = %u", + cdata->cmd); ret = -EINVAL; break; } @@ -234,8 +233,7 @@ static int selector_ctrl_get_data(struct comp_dev *dev, switch (cdata->cmd) { case SOF_CTRL_CMD_BINARY: - trace_selector_with_ids(dev, "selector_ctrl_get_data(), " - "SOF_CTRL_CMD_BINARY"); + comp_info(dev, "selector_ctrl_get_data(), SOF_CTRL_CMD_BINARY"); /* Copy back to user space */ ret = memcpy_s(cdata->data->data, ((struct sof_abi_hdr *) @@ -248,8 +246,7 @@ static int selector_ctrl_get_data(struct comp_dev *dev, break; default: - trace_selector_error_with_ids(dev, "selector_ctrl_get_data() " - "error: invalid cdata->cmd"); + comp_err(dev, "selector_ctrl_get_data() error: invalid cdata->cmd"); ret = -EINVAL; break; } @@ -271,7 +268,7 @@ static int selector_cmd(struct comp_dev *dev, int cmd, void *data, struct sof_ipc_ctrl_data *cdata = data; int ret = 0; - trace_selector_with_ids(dev, "selector_cmd()"); + comp_info(dev, "selector_cmd()"); switch (cmd) { case COMP_CMD_SET_DATA: @@ -281,16 +278,13 @@ static int selector_cmd(struct comp_dev *dev, int cmd, void *data, ret = selector_ctrl_get_data(dev, cdata, max_data_size); break; case COMP_CMD_SET_VALUE: - trace_selector_with_ids(dev, - "selector_cmd(), COMP_CMD_SET_VALUE"); + comp_info(dev, "selector_cmd(), COMP_CMD_SET_VALUE"); break; case COMP_CMD_GET_VALUE: - trace_selector_with_ids(dev, - "selector_cmd(), COMP_CMD_GET_VALUE"); + comp_info(dev, "selector_cmd(), COMP_CMD_GET_VALUE"); break; default: - trace_selector_error_with_ids(dev, "selector_cmd() error: " - "invalid command"); + comp_err(dev, "selector_cmd() error: invalid command"); ret = -EINVAL; } @@ -307,7 +301,7 @@ static int selector_trigger(struct comp_dev *dev, int cmd) { int ret; - trace_selector_with_ids(dev, "selector_trigger()"); + comp_info(dev, "selector_trigger()"); ret = comp_set_state(dev, cmd); return ret == 0 ? PPL_STATUS_PATH_STOP : ret; @@ -327,7 +321,7 @@ static int selector_copy(struct comp_dev *dev) uint32_t source_bytes; uint32_t sink_bytes; - tracev_selector_with_ids(dev, "selector_copy()"); + comp_dbg(dev, "selector_copy()"); /* selector component will have 1 source and 1 sink buffer */ source = list_first_item(&dev->bsource_list, struct comp_buffer, @@ -339,10 +333,8 @@ static int selector_copy(struct comp_dev *dev) source_bytes = frames * audio_stream_frame_bytes(&source->stream); sink_bytes = frames * audio_stream_frame_bytes(&sink->stream); - tracev_selector_with_ids(dev, "selector_copy(), " - "source_bytes = 0x%x, " - "sink_bytes = 0x%x", - source_bytes, sink_bytes); + comp_dbg(dev, "selector_copy(), source_bytes = 0x%x, sink_bytes = 0x%x", + source_bytes, sink_bytes); /* copy selected channels from in to out */ cd->sel_func(dev, &sink->stream, &source->stream, frames); @@ -367,7 +359,7 @@ static int selector_prepare(struct comp_dev *dev) struct sof_ipc_comp_config *config = COMP_GET_CONFIG(dev); int ret; - trace_selector_with_ids(dev, "selector_prepare()"); + comp_info(dev, "selector_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -396,46 +388,37 @@ static int selector_prepare(struct comp_dev *dev) * proper number of channels [1] for selector to actually * reduce channel count between source and sink */ - trace_selector_with_ids(dev, - "selector_prepare(): sourceb->schannels = %u", - sourceb->stream.channels); - trace_selector_with_ids(dev, - "selector_prepare(): sinkb->channels = %u", - sinkb->stream.channels); + comp_info(dev, "selector_prepare(): sourceb->schannels = %u", + sourceb->stream.channels); + comp_info(dev, "selector_prepare(): sinkb->channels = %u", + sinkb->stream.channels); if (sinkb->stream.size < config->periods_sink * cd->sink_period_bytes) { - trace_selector_error_with_ids(dev, "selector_prepare() error: " - "sink buffer size is insufficient"); + comp_err(dev, "selector_prepare() error: sink buffer size is insufficient"); ret = -ENOMEM; goto err; } /* validate */ if (cd->sink_period_bytes == 0) { - trace_selector_error_with_ids(dev, "selector_prepare() error: " - "cd->sink_period_bytes = 0, dev->frames =" - " %u", dev->frames); + comp_err(dev, "selector_prepare() error: cd->sink_period_bytes = 0, dev->frames = %u", + dev->frames); ret = -EINVAL; goto err; } if (cd->source_period_bytes == 0) { - trace_selector_error_with_ids(dev, "selector_prepare() error: " - "cd->source_period_bytes = 0, " - "dev->frames = %u", dev->frames); + comp_err(dev, "selector_prepare() error: cd->source_period_bytes = 0, dev->frames = %u", + dev->frames); ret = -EINVAL; goto err; } cd->sel_func = sel_get_processing_function(dev); if (!cd->sel_func) { - trace_selector_error_with_ids(dev, "selector_prepare() error: " - "invalid cd->sel_func, " - "cd->source_format = %u, " - "cd->sink_format = %u, " - "cd->out_channels_count = %u", - cd->source_format, cd->sink_format, - cd->config.out_channels_count); + comp_err(dev, "selector_prepare() error: invalid cd->sel_func, cd->source_format = %u, cd->sink_format = %u, cd->out_channels_count = %u", + cd->source_format, cd->sink_format, + cd->config.out_channels_count); ret = -EINVAL; goto err; } @@ -456,7 +439,7 @@ static int selector_reset(struct comp_dev *dev) { int ret; - trace_selector_with_ids(dev, "selector_reset()"); + comp_info(dev, "selector_reset()"); ret = comp_set_state(dev, COMP_TRIGGER_RESET); return ret == 0 ? PPL_STATUS_PATH_STOP : ret; diff --git a/src/audio/src/src.c b/src/audio/src/src.c index 540267840e60..ab8a4dcf2703 100644 --- a/src/audio/src/src.c +++ b/src/audio/src/src.c @@ -37,29 +37,12 @@ #include #endif -/* tracing */ -#define trace_src(__e, ...) \ - trace_event(TRACE_CLASS_SRC, __e, ##__VA_ARGS__) -#define trace_src_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_SRC, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_src(__e, ...) \ - tracev_event(TRACE_CLASS_SRC, __e, ##__VA_ARGS__) -#define tracev_src_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_SRC, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_src_error(__e, ...) \ - trace_error(TRACE_CLASS_SRC, __e, ##__VA_ARGS__) -#define trace_src_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_SRC, comp_ptr, \ - __e, ##__VA_ARGS__) - /* 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) #define MAX_OUT_DELAY_SIZE_XNCH (PLATFORM_MAX_CHANNELS * MAX_OUT_DELAY_SIZE) +static const struct comp_driver comp_src; + /* src component private data */ struct comp_data { struct polyphase_src src; @@ -118,8 +101,9 @@ int src_buffer_lengths(struct src_param *a, int fs_in, int fs_out, int nch, int r1; if (nch > PLATFORM_MAX_CHANNELS) { - trace_src_error("src_buffer_lengths() error: " - "nch = %u > PLATFORM_MAX_CHANNELS", nch); + /* TODO: should be device, not class */ + comp_cl_err(&comp_src, "src_buffer_lengths() error: nch = %u > PLATFORM_MAX_CHANNELS", + nch); return -EINVAL; } @@ -129,9 +113,8 @@ 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("src_buffer_lengths() error: " - "rates not supported, " - "fs_in: %u, fs_out: %u", fs_in, fs_out); + comp_cl_err(&comp_src, "src_buffer_lengths() error: rates not supported, fs_in: %u, fs_out: %u", + fs_in, fs_out); return -EINVAL; } @@ -140,9 +123,8 @@ 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("src_buffer_lengths() error: " - "Non-supported combination " - "fs_in = %d, fs_out = %d", fs_in, fs_out); + comp_cl_err(&comp_src, "src_buffer_lengths() error: Non-supported combination sfs_in = %d, fs_out = %d", + fs_in, fs_out); return -EINVAL; } @@ -374,7 +356,7 @@ static void src_2s(struct comp_dev *dev, const struct audio_stream *source, s1.times = sbuf_free / (cd->src.stage1->blk_out * nch); s1_blk_in = s1.times * cd->src.stage1->blk_in * nch; s1_blk_out = s1.times * cd->src.stage1->blk_out * nch; - tracev_src_with_ids(dev, "s1.times = %d", s1.times); + comp_dbg(dev, "s1.times = %d", s1.times); } if (avail_b >= s1_blk_in * sz && sbuf_free >= s1_blk_out) { @@ -394,7 +376,7 @@ static void src_2s(struct comp_dev *dev, const struct audio_stream *source, s2.times = cd->sbuf_avail / (cd->src.stage2->blk_in * nch); s2_blk_in = s2.times * cd->src.stage2->blk_in * nch; s2_blk_out = s2.times * cd->src.stage2->blk_out * nch; - tracev_src_with_ids(dev, "s2.times = %d", s2.times); + comp_dbg(dev, "s2.times = %d", s2.times); } /* Test if second stage can be run with default block length. */ @@ -472,17 +454,16 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp) struct comp_data *cd; int ret; - trace_src("src_new()"); + comp_cl_info(&comp_src, "src_new()"); if (IPC_IS_SIZE_INVALID(ipc_src->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_SRC, ipc_src->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_src->config); return NULL; } /* 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("src_new() error: " - "SRC sink and source rate are not set"); + comp_cl_err(&comp_src, "src_new() error: SRC sink and source rate are not set"); return NULL; } @@ -520,7 +501,7 @@ static void src_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_src_with_ids(dev, "src_free()"); + comp_info(dev, "src_free()"); /* Free dynamically reserved buffers for SRC algorithm */ if (cd->delay_lines) @@ -543,7 +524,7 @@ static int src_params(struct comp_dev *dev, int n = 0; int err; - trace_src_with_ids(dev, "src_params()"); + comp_info(dev, "src_params()"); cd->sample_container_bytes = params->sample_container_bytes; @@ -553,8 +534,8 @@ static int src_params(struct comp_dev *dev, sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); - trace_src("src_params(): src->source_rate: %d", src->source_rate); - trace_src("src_params(): src->sink_rate: %d", src->sink_rate); + comp_info(dev, "src_params(): src->source_rate: %d", src->source_rate); + comp_info(dev, "src_params(): src->sink_rate: %d", src->sink_rate); /* Calculate source and sink rates, one rate will come from IPC new * and the other from params. @@ -578,28 +559,25 @@ static int src_params(struct comp_dev *dev, cd->sink_frames = dev->frames; /* Allocate needed memory for delay lines */ - trace_src_with_ids(dev, - "src_params(), source_rate = %u, sink_rate = %u", - cd->source_rate, cd->sink_rate); - trace_src_with_ids(dev, - "src_params(), sourceb->channels = %u, sinkb->channels = %u, dev->frames = %u", - sourceb->stream.channels, - sinkb->stream.channels, dev->frames); - err = src_buffer_lengths(&cd->param, cd->source_rate, cd->sink_rate, + comp_info(dev, "src_params(), source_rate = %u, sink_rate = %u", + cd->source_rate, cd->sink_rate); + comp_info(dev, "src_params(), sourceb->channels = %u, sinkb->channels = %u, dev->frames = %u", + sourceb->stream.channels, + sinkb->stream.channels, dev->frames); + err = src_buffer_lengths(&cd->param, cd->source_rate, + cd->sink_rate, sourceb->stream.channels, cd->source_frames); if (err < 0) { - trace_src_error_with_ids(dev, "src_params() error: " - "src_buffer_lengths() failed"); + comp_err(dev, "src_params() error: src_buffer_lengths() failed"); return err; } - trace_src_with_ids(dev, "src_params(), blk_in = %u, blk_out = %u", - cd->param.blk_in, cd->param.blk_out); + comp_info(dev, "src_params(), blk_in = %u, blk_out = %u", + cd->param.blk_in, cd->param.blk_out); delay_lines_size = sizeof(int32_t) * cd->param.total; if (delay_lines_size == 0) { - trace_src_error_with_ids(dev, "src_params() error: " - "delay_lines_size = 0"); + comp_err(dev, "src_params() error: delay_lines_size = 0"); return -EINVAL; } @@ -609,10 +587,8 @@ static int src_params(struct comp_dev *dev, cd->delay_lines = rballoc(0, SOF_MEM_CAPS_RAM, delay_lines_size); if (!cd->delay_lines) { - trace_src_error_with_ids(dev, "src_params() error: " - "failed to alloc cd->delay_lines, " - "delay_lines_size = %u", - delay_lines_size); + comp_err(dev, "src_params() error: failed to alloc cd->delay_lines, delay_lines_size = %u", + delay_lines_size); return -EINVAL; } @@ -643,8 +619,7 @@ static int src_params(struct comp_dev *dev, /* This is possibly due to missing coefficients for * requested rates combination. */ - trace_src_with_ids(dev, "src_params(), missing coefficients " - "for requested rates combination"); + comp_info(dev, "src_params(), missing coefficients for requested rates combination"); cd->src_func = src_fallback; return -EINVAL; } @@ -654,7 +629,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_with_ids(dev, "src_ctrl_cmd()"); + comp_err(dev, "src_ctrl_cmd()"); return -EINVAL; } @@ -665,7 +640,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_with_ids(dev, "src_cmd()"); + comp_info(dev, "src_cmd()"); if (cmd == COMP_CMD_SET_VALUE) ret = src_ctrl_cmd(dev, cdata); @@ -677,7 +652,7 @@ static int src_trigger(struct comp_dev *dev, int cmd) { struct comp_data *cd = comp_get_drvdata(dev); - trace_src_with_ids(dev, "src_trigger()"); + comp_info(dev, "src_trigger()"); if (cmd == COMP_TRIGGER_START || cmd == COMP_TRIGGER_RELEASE) assert(cd->polyphase_func); @@ -746,7 +721,7 @@ static int src_copy(struct comp_dev *dev) int consumed = 0; int produced = 0; - tracev_src_with_ids(dev, "src_copy()"); + comp_dbg(dev, "src_copy()"); /* src component needs 1 source and 1 sink buffer */ source = list_first_item(&dev->bsource_list, struct comp_buffer, @@ -760,14 +735,14 @@ static int src_copy(struct comp_dev *dev) */ ret = src_get_copy_limits(cd, source, sink); if (ret) { - trace_src_with_ids(dev, "No data to process."); + comp_info(dev, "No data to process."); return PPL_STATUS_PATH_STOP; } cd->src_func(dev, &source->stream, &sink->stream, &consumed, &produced); - tracev_src_with_ids(dev, "src_copy(), consumed = %u, produced = %u", - consumed, produced); + comp_dbg(dev, "src_copy(), consumed = %u, produced = %u", + consumed, produced); /* Calc new free and available if data was processed. These * functions must not be called with 0 consumed/produced. @@ -794,7 +769,7 @@ static int src_prepare(struct comp_dev *dev) uint32_t sink_period_bytes; int ret; - trace_src_with_ids(dev, "src_prepare()"); + comp_info(dev, "src_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -820,31 +795,27 @@ static int src_prepare(struct comp_dev *dev) dev->frames); if (sinkb->stream.size < config->periods_sink * sink_period_bytes) { - trace_src_error_with_ids(dev, "src_prepare() error: " - "sink buffer size is insufficient"); + comp_err(dev, "src_prepare() error: sink buffer size is insufficient"); ret = -ENOMEM; goto err; } /* validate */ if (!sink_period_bytes) { - trace_src_error_with_ids(dev, "src_prepare() error: " - "sink_period_bytes = 0"); + comp_err(dev, "src_prepare() error: sink_period_bytes = 0"); ret = -EINVAL; goto err; } if (!source_period_bytes) { - trace_src_error_with_ids(dev, "src_prepare() error: " - "source_period_bytes = 0"); + comp_err(dev, "src_prepare() error: source_period_bytes = 0"); ret = -EINVAL; goto err; } /* SRC supports S16_LE, S24_4LE and S32_LE formats */ if (cd->source_format != cd->sink_format) { - trace_src_error("src_prepare() error: " - "Source fmt %d and sink fmt %d are different.", - cd->source_format, cd->sink_format); + comp_err(dev, "src_prepare() error: Source fmt %d and sink fmt %d are different.", + cd->source_format, cd->sink_format); ret = -EINVAL; goto err; } @@ -875,8 +846,8 @@ static int src_prepare(struct comp_dev *dev) break; #endif /* CONFIG_FORMAT_S32LE */ default: - trace_src_error("src_prepare() error: invalid format %d", - cd->source_format); + comp_err(dev, "src_prepare() error: invalid format %d", + cd->source_format); ret = -EINVAL; goto err; } @@ -892,7 +863,7 @@ static int src_reset(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_src_with_ids(dev, "src_reset()"); + comp_info(dev, "src_reset()"); cd->src_func = src_fallback; src_polyphase_reset(&cd->src); diff --git a/src/audio/switch.c b/src/audio/switch.c index 8270dbfb3fc0..507c042a7ade 100644 --- a/src/audio/switch.c +++ b/src/audio/switch.c @@ -12,28 +12,11 @@ #include #include -/* mixer tracing */ -#define trace_switch(__e, ...) \ - trace_event(TRACE_CLASS_SWITCH, __e, ##__VA_ARGS__) -#define trace_switch_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_SWITCH, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_switch(__e, ...) \ - tracev_event(TRACE_CLASS_SWITCH, __e, ##__VA_ARGS__) -#define tracev_switch_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_SWITCH, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_switch_error(__e, ...) \ - trace_error(TRACE_CLASS_SWITCH, __e, ##__VA_ARGS__) -#define trace_switch_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_SWITCH, comp_ptr, \ - __e, ##__VA_ARGS__) +static const struct comp_driver comp_switch; static struct comp_dev *switch_new(struct sof_ipc_comp *comp) { - trace_switch("switch_new()"); + comp_cl_info(&comp_switch, "switch_new()"); return NULL; } diff --git a/src/audio/tone.c b/src/audio/tone.c index af81048c56e2..7401c8203055 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -30,25 +30,6 @@ #include #include -/* mixer tracing */ -#define trace_tone(__e, ...) \ - trace_event(TRACE_CLASS_TONE, __e, ##__VA_ARGS__) -#define trace_tone_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_TONE, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_tone(__e, ...) \ - tracev_event(TRACE_CLASS_TONE, __e, ##__VA_ARGS__) -#define tracev_tone_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_TONE, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_tone_error(__e, ...) \ - trace_error(TRACE_CLASS_TONE, __e, ##__VA_ARGS__) -#define trace_tone_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_TONE, comp_ptr, \ - __e, ##__VA_ARGS__) - /* Convert float frequency in Hz to Q16.16 fractional format */ #define TONE_FREQ(f) Q_CONVERT_FLOAT(f, 16) @@ -60,6 +41,8 @@ #define TONE_FREQUENCY_DEFAULT TONE_FREQ(997.0) #define TONE_NUM_FS 13 /* Table size for 8-192 kHz range */ +static const struct comp_driver comp_tone; + /* 2*pi/Fs lookup tables in Q1.31 for each Fs */ static const int32_t tone_fs_list[TONE_NUM_FS] = { 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, @@ -392,10 +375,10 @@ static struct comp_dev *tone_new(struct sof_ipc_comp *comp) int i; int ret; - trace_tone("tone_new()"); + comp_cl_info(&comp_tone, "tone_new()"); if (IPC_IS_SIZE_INVALID(ipc_tone->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_TONE, ipc_tone->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_tone->config); return NULL; } @@ -432,7 +415,7 @@ static void tone_free(struct comp_dev *dev) { struct tone_data *td = comp_get_drvdata(dev); - trace_tone_with_ids(dev, "tone_free()"); + comp_info(dev, "tone_free()"); rfree(td); rfree(dev); @@ -453,8 +436,8 @@ static int tone_params(struct comp_dev *dev, sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); - trace_tone_with_ids(dev, "tone_params(), config->frame_fmt = %u", - config->frame_fmt); + comp_info(dev, "tone_params(), config->frame_fmt = %u", + config->frame_fmt); /* Tone supports only S32_LE PCM format atm */ if (config->frame_fmt != SOF_IPC_FRAME_S32_LE) @@ -476,15 +459,14 @@ static int tone_cmd_get_value(struct comp_dev *dev, struct comp_data *cd = comp_get_drvdata(dev); int j; - trace_tone_with_ids(dev, "tone_cmd_get_value()"); + comp_info(dev, "tone_cmd_get_value()"); if (cdata->cmd == SOF_CTRL_CMD_SWITCH) { for (j = 0; j < cdata->num_elems; j++) { cdata->chanv[j].channel = j; cdata->chanv[j].value = !cd->sg[j].mute; - trace_tone_with_ids(dev, "tone_cmd_get_value(), " - "j = %u, cd->sg[j].mute = %u", - j, cd->sg[j].mute); + comp_info(dev, "tone_cmd_get_value(), j = %u, cd->sg[j].mute = %u", + j, cd->sg[j].mute); } } return 0; @@ -499,18 +481,14 @@ static int tone_cmd_set_value(struct comp_dev *dev, bool val; if (cdata->cmd == SOF_CTRL_CMD_SWITCH) { - trace_tone_with_ids(dev, "tone_cmd_set_value(), " - "SOF_CTRL_CMD_SWITCH"); + comp_info(dev, "tone_cmd_set_value(), SOF_CTRL_CMD_SWITCH"); for (j = 0; j < cdata->num_elems; j++) { ch = cdata->chanv[j].channel; val = cdata->chanv[j].value; - trace_tone_with_ids(dev, "tone_cmd_set_value(), " - "SOF_CTRL_CMD_SWITCH," - " ch = %u, val = %u", ch, val); + comp_info(dev, "tone_cmd_set_value(), SOF_CTRL_CMD_SWITCH, ch = %u, val = %u", + ch, val); if (ch >= PLATFORM_MAX_CHANNELS) { - trace_tone_error_with_ids(dev, - "tone_cmd_set_value() error: " - "ch >= PLATFORM_MAX_CHANNELS"); + comp_err(dev, "tone_cmd_set_value() error: ch >= PLATFORM_MAX_CHANNELS"); return -EINVAL; } @@ -521,8 +499,7 @@ static int tone_cmd_set_value(struct comp_dev *dev, } } else { - trace_tone_error_with_ids(dev, "tone_cmd_set_value() error: " - "invalid cdata->cmd"); + comp_err(dev, "tone_cmd_set_value() error: invalid cdata->cmd"); return -EINVAL; } @@ -538,72 +515,59 @@ static int tone_cmd_set_data(struct comp_dev *dev, uint32_t ch; uint32_t val; - trace_tone_with_ids(dev, "tone_cmd_set_data()"); + comp_info(dev, "tone_cmd_set_data()"); switch (cdata->cmd) { case SOF_CTRL_CMD_ENUM: - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_CTRL_CMD_ENUM, cdata->index = %u", - cdata->index); + comp_info(dev, "tone_cmd_set_data(), SOF_CTRL_CMD_ENUM, cdata->index = %u", + 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; - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_CTRL_CMD_ENUM, " - "ch = %u, val = %u", ch, val); + comp_info(dev, "tone_cmd_set_data(), SOF_CTRL_CMD_ENUM, ch = %u, val = %u", + ch, val); switch (cdata->index) { case SOF_TONE_IDX_FREQUENCY: - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_TONE_IDX_FREQUENCY"); + comp_info(dev, "tone_cmd_set_data(), SOF_TONE_IDX_FREQUENCY"); tonegen_update_f(&cd->sg[ch], val); break; case SOF_TONE_IDX_AMPLITUDE: - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_TONE_IDX_AMPLITUDE"); + comp_info(dev, "tone_cmd_set_data(), SOF_TONE_IDX_AMPLITUDE"); tonegen_set_a(&cd->sg[ch], val); break; case SOF_TONE_IDX_FREQ_MULT: - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_TONE_IDX_FREQ_MULT"); + comp_info(dev, "tone_cmd_set_data(), SOF_TONE_IDX_FREQ_MULT"); tonegen_set_freq_mult(&cd->sg[ch], val); break; case SOF_TONE_IDX_AMPL_MULT: - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_TONE_IDX_AMPL_MULT"); + comp_info(dev, "tone_cmd_set_data(), SOF_TONE_IDX_AMPL_MULT"); tonegen_set_ampl_mult(&cd->sg[ch], val); break; case SOF_TONE_IDX_LENGTH: - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_TONE_IDX_LENGTH"); + comp_info(dev, "tone_cmd_set_data(), SOF_TONE_IDX_LENGTH"); tonegen_set_length(&cd->sg[ch], val); break; case SOF_TONE_IDX_PERIOD: - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_TONE_IDX_PERIOD"); + comp_info(dev, "tone_cmd_set_data(), SOF_TONE_IDX_PERIOD"); tonegen_set_period(&cd->sg[ch], val); break; case SOF_TONE_IDX_REPEATS: - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_TONE_IDX_REPEATS"); + comp_info(dev, "tone_cmd_set_data(), SOF_TONE_IDX_REPEATS"); tonegen_set_repeats(&cd->sg[ch], val); break; case SOF_TONE_IDX_LIN_RAMP_STEP: - trace_tone_with_ids(dev, "tone_cmd_set_data(), " - "SOF_TONE_IDX_LIN_RAMP_STEP"); + comp_info(dev, "tone_cmd_set_data(), SOF_TONE_IDX_LIN_RAMP_STEP"); tonegen_set_linramp(&cd->sg[ch], val); break; default: - trace_tone_error_with_ids(dev, - "tone_cmd_set_data() error: " - "invalid cdata->index"); + comp_err(dev, "tone_cmd_set_data() error: invalid cdata->index"); return -EINVAL; } } break; default: - trace_tone_error_with_ids(dev, "tone_cmd_set_data() error: " - "invalid cdata->cmd"); + comp_err(dev, "tone_cmd_set_data() error: invalid cdata->cmd"); return -EINVAL; } @@ -617,7 +581,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_with_ids(dev, "tone_cmd()"); + comp_info(dev, "tone_cmd()"); switch (cmd) { case COMP_CMD_SET_DATA: @@ -636,7 +600,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_with_ids(dev, "tone_trigger()"); + comp_info(dev, "tone_trigger()"); return comp_set_state(dev, cmd); } @@ -647,7 +611,7 @@ static int tone_copy(struct comp_dev *dev) struct comp_buffer *sink; struct comp_data *cd = comp_get_drvdata(dev); - tracev_comp_with_ids(dev, "tone_copy()"); + comp_dbg(dev, "tone_copy()"); /* tone component sink buffer */ sink = list_first_item(&dev->bsink_list, struct comp_buffer, @@ -678,7 +642,7 @@ static int tone_prepare(struct comp_dev *dev) int ret; int i; - trace_tone_with_ids(dev, "tone_prepare()"); + comp_info(dev, "tone_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -691,10 +655,8 @@ static int tone_prepare(struct comp_dev *dev) sink_list); cd->channels = sourceb->stream.channels; - trace_tone_with_ids(dev, "tone_prepare(), " - "cd->channels = %u, " - "cd->rate = %u", - cd->channels, cd->rate); + comp_info(dev, "tone_prepare(), cd->channels = %u, cd->rate = %u", + cd->channels, cd->rate); for (i = 0; i < cd->channels; i++) { f = tonegen_get_f(&cd->sg[i]); @@ -714,7 +676,7 @@ static int tone_reset(struct comp_dev *dev) struct comp_data *cd = comp_get_drvdata(dev); int i; - trace_tone_with_ids(dev, "tone_reset()"); + comp_info(dev, "tone_reset()"); /* Initialize with the defaults */ for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) diff --git a/src/audio/volume/volume.c b/src/audio/volume/volume.c index 64a92e1fd33c..24097dbf5de5 100644 --- a/src/audio/volume/volume.c +++ b/src/audio/volume/volume.c @@ -43,17 +43,20 @@ /* Shift to use in volume fractional multiplications */ #define Q_MUL_SHIFT Q_SHIFT_BITS_32(VOL_QXY_Y, VOL_QXY_Y, VOL_QXY_Y) +static const struct comp_driver comp_volume; + /** * \brief Synchronize host mmap() volume with real value. * \param[in,out] cd Volume component private data. * \param[in] num_channels Update channels 0 to num_channels -1. */ -static void vol_sync_host(struct comp_data *cd, unsigned int num_channels) +static void vol_sync_host(struct comp_dev *dev, unsigned int num_channels) { + struct comp_data *cd = comp_get_drvdata(dev); int n; if (!cd->hvol) { - tracev_volume("vol_sync_host() Warning: null hvol, no update"); + comp_dbg(dev, "vol_sync_host() Warning: null hvol, no update"); return; } @@ -61,9 +64,8 @@ static void vol_sync_host(struct comp_data *cd, unsigned int num_channels) for (n = 0; n < num_channels; n++) cd->hvol[n].value = cd->volume[n]; } else { - trace_volume_error("vol_sync_host() error: channels count %d" - " exceeds SOF_IPC_MAX_CHANNELS", - num_channels); + comp_err(dev, "vol_sync_host() error: channels count %d exceeds SOF_IPC_MAX_CHANNELS", + num_channels); } } @@ -86,7 +88,7 @@ static enum task_state vol_work(void *data) for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) cd->volume[i] = cd->tvolume[i]; - vol_sync_host(cd, PLATFORM_MAX_CHANNELS); + vol_sync_host(dev, PLATFORM_MAX_CHANNELS); return SOF_TASK_STATE_COMPLETED; } @@ -139,7 +141,7 @@ static enum task_state vol_work(void *data) } /* sync host with new value */ - vol_sync_host(cd, cd->channels); + vol_sync_host(dev, cd->channels); /* do we need to continue ramping */ if (again) @@ -195,10 +197,10 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp) int i; int ret; - trace_volume("volume_new()"); + comp_cl_info(&comp_volume, "volume_new()"); if (IPC_IS_SIZE_INVALID(ipc_vol->config)) { - IPC_SIZE_ERROR_TRACE(TRACE_CLASS_VOLUME, ipc_vol->config); + IPC_SIZE_ERROR_TRACE(TRACE_CLASS_COMP, ipc_vol->config); return NULL; } @@ -229,10 +231,7 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp) if (vol->min_value < VOL_MIN) { /* Use VOL_MIN instead, no need to stop new(). */ cd->vol_min = VOL_MIN; - trace_volume_error_with_ids(dev, - "volume_new(): " - "vol->min_value was " - "limited to VOL_MIN."); + comp_err(dev, "volume_new(): vol->min_value was limited to VOL_MIN."); } else { cd->vol_min = vol->min_value; } @@ -240,10 +239,7 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp) if (vol->max_value > VOL_MAX) { /* Use VOL_MAX instead, no need to stop new(). */ cd->vol_max = VOL_MAX; - trace_volume_error_with_ids(dev, - "volume_new(): " - "vol->max_value was " - "limited to VOL_MAX."); + comp_err(dev, "volume_new(): vol->max_value was limited to VOL_MAX."); } else { cd->vol_max = vol->max_value; } @@ -272,11 +268,9 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp) cd->vol_ramp_active = false; cd->channels = 0; /* To be set in prepare() */ - trace_volume_with_ids(dev, - "vol->initial_ramp = %d, vol->ramp = %d, " - "vol->min_value = %d, vol->max_value = %d", - vol->initial_ramp, vol->ramp, - vol->min_value, vol->max_value); + comp_info(dev, "vol->initial_ramp = %d, vol->ramp = %d, vol->min_value = %d, vol->max_value = %d", + vol->initial_ramp, vol->ramp, + vol->min_value, vol->max_value); dev->state = COMP_STATE_READY; return dev; @@ -290,7 +284,7 @@ static void volume_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - trace_volume_with_ids(dev, "volume_free()"); + comp_dbg(dev, "volume_free()"); /* remove scheduling */ if (cd->volwork) { @@ -313,7 +307,7 @@ static void volume_free(struct comp_dev *dev) static int volume_params(struct comp_dev *dev, struct sof_ipc_stream_params *params) { - trace_volume_with_ids(dev, "volume_params()"); + comp_dbg(dev, "volume_params()"); return 0; } @@ -345,15 +339,15 @@ static inline int volume_set_chan(struct comp_dev *dev, int chan, */ if (v < VOL_MIN) { /* No need to fail, just trace the event. */ - trace_volume_error_with_ids(dev, "volume_set_chan: Limited request %d" - " to min. %d", v, VOL_MIN); + comp_err(dev, "volume_set_chan: Limited request %d to min. %d", + v, VOL_MIN); v = VOL_MIN; } if (v > VOL_MAX) { /* No need to fail, just trace the event. */ - trace_volume_error_with_ids(dev, "volume_set_chan: Limited request %d" - " to max. %d", v, VOL_MAX); + comp_err(dev, "volume_set_chan: Limited request %d to max. %d", + v, VOL_MAX); v = VOL_MAX; } @@ -402,15 +396,15 @@ static inline int volume_set_chan(struct comp_dev *dev, int chan, inc = -inc; cd->ramp_increment[chan] = inc; - tracev_volume_with_ids(dev, "cd->ramp_increment[%d] = %d", chan, - cd->ramp_increment[chan]); + comp_dbg(dev, "cd->ramp_increment[%d] = %d", chan, + cd->ramp_increment[chan]); break; case SOF_VOLUME_LOG: case SOF_VOLUME_LINEAR_ZC: case SOF_VOLUME_LOG_ZC: default: - trace_volume_error_with_ids(dev, "volume_set_chan() error: " - "invalid ramp type %d", pga->ramp); + comp_err(dev, "volume_set_chan() error: invalid ramp type %d", + pga->ramp); return -EINVAL; } @@ -465,26 +459,22 @@ static int volume_ctrl_set_cmd(struct comp_dev *dev, /* validate */ if (cdata->num_elems == 0 || cdata->num_elems > SOF_IPC_MAX_CHANNELS) { - trace_volume_error_with_ids(dev, "volume_ctrl_set_cmd() error: " - "invalid cdata->num_elems"); + comp_err(dev, "volume_ctrl_set_cmd() error: invalid cdata->num_elems"); return -EINVAL; } switch (cdata->cmd) { case SOF_CTRL_CMD_VOLUME: - trace_volume_with_ids(dev, "volume_ctrl_set_cmd(), " - "SOF_CTRL_CMD_VOLUME, " - "cdata->comp_id = %u", - cdata->comp_id); + comp_info(dev, "volume_ctrl_set_cmd(), SOF_CTRL_CMD_VOLUME, cdata->comp_id = %u", + cdata->comp_id); for (j = 0; j < cdata->num_elems; j++) { ch = cdata->chanv[j].channel; val = cdata->chanv[j].value; - trace_volume_with_ids(dev, "volume_ctrl_set_cmd(), channel = %d" - ", value = %u", ch, val); + comp_info(dev, "volume_ctrl_set_cmd(), channel = %d, value = %u", + ch, val); if (ch < 0 || ch >= SOF_IPC_MAX_CHANNELS) { - trace_volume_error_with_ids(dev, - "volume_ctrl_set_cmd(), illegal channel = %d", - ch); + comp_err(dev, "volume_ctrl_set_cmd(), illegal channel = %d", + ch); return -EINVAL; } @@ -508,18 +498,16 @@ static int volume_ctrl_set_cmd(struct comp_dev *dev, break; case SOF_CTRL_CMD_SWITCH: - trace_volume_with_ids(dev, "volume_ctrl_set_cmd(), " - "SOF_CTRL_CMD_SWITCH, " - "cdata->comp_id = %u", cdata->comp_id); + comp_info(dev, "volume_ctrl_set_cmd(), SOF_CTRL_CMD_SWITCH, cdata->comp_id = %u", + cdata->comp_id); for (j = 0; j < cdata->num_elems; j++) { ch = cdata->chanv[j].channel; val = cdata->chanv[j].value; - trace_volume_with_ids(dev, "volume_ctrl_set_cmd(), channel = %d" - ", value = %u", ch, val); + comp_info(dev, "volume_ctrl_set_cmd(), channel = %d, value = %u", + ch, val); if (ch < 0 || ch >= SOF_IPC_MAX_CHANNELS) { - trace_volume_error_with_ids(dev, - "volume_ctrl_set_cmd(), illegal channel = %d", - ch); + comp_err(dev, "volume_ctrl_set_cmd(), illegal channel = %d", + ch); return -EINVAL; } @@ -540,8 +528,7 @@ static int volume_ctrl_set_cmd(struct comp_dev *dev, break; default: - trace_volume_error_with_ids(dev, "volume_ctrl_set_cmd() error: " - "invalid cdata->cmd"); + comp_err(dev, "volume_ctrl_set_cmd() error: invalid cdata->cmd"); return -EINVAL; } @@ -562,30 +549,24 @@ static int volume_ctrl_get_cmd(struct comp_dev *dev, /* validate */ if (cdata->num_elems == 0 || cdata->num_elems > SOF_IPC_MAX_CHANNELS) { - trace_volume_error_with_ids(dev, "volume_ctrl_get_cmd() error: " - "invalid cdata->num_elems %u", - cdata->num_elems); + comp_err(dev, "volume_ctrl_get_cmd() error: invalid cdata->num_elems %u", + cdata->num_elems); return -EINVAL; } if (cdata->cmd == SOF_CTRL_CMD_VOLUME || cdata->cmd == SOF_CTRL_CMD_SWITCH) { - trace_volume_with_ids(dev, "volume_ctrl_get_cmd(), " - "SOF_CTRL_CMD_VOLUME / " - "SOF_CTRL_CMD_SWITCH, " - "cdata->comp_id = %u", - cdata->comp_id); + comp_info(dev, "volume_ctrl_get_cmd(), SOF_CTRL_CMD_VOLUME / SOF_CTRL_CMD_SWITCH, cdata->comp_id = %u", + cdata->comp_id); for (j = 0; j < cdata->num_elems; j++) { cdata->chanv[j].channel = j; cdata->chanv[j].value = cd->tvolume[j]; - trace_volume_with_ids(dev, "volume_ctrl_get_cmd(), " - "channel = %u, value = %u", - cdata->chanv[j].channel, - cdata->chanv[j].value); + comp_info(dev, "volume_ctrl_get_cmd(), channel = %u, value = %u", + cdata->chanv[j].channel, + cdata->chanv[j].value); } } else { - trace_volume_error_with_ids(dev, "volume_ctrl_get_cmd() error: " - "invalid cdata->cmd"); + comp_err(dev, "volume_ctrl_get_cmd() error: invalid cdata->cmd"); return -EINVAL; } @@ -604,7 +585,7 @@ static int volume_cmd(struct comp_dev *dev, int cmd, void *data, { struct sof_ipc_ctrl_data *cdata = data; - trace_volume_with_ids(dev, "volume_cmd()"); + comp_info(dev, "volume_cmd()"); switch (cmd) { case COMP_CMD_SET_VALUE: @@ -624,7 +605,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_with_ids(dev, "volume_trigger()"); + comp_info(dev, "volume_trigger()"); return comp_set_state(dev, cmd); } @@ -640,7 +621,7 @@ static int volume_copy(struct comp_dev *dev) struct comp_data *cd = comp_get_drvdata(dev); int ret; - tracev_volume_with_ids(dev, "volume_copy()"); + comp_dbg(dev, "volume_copy()"); if (!cd->ramp_started) schedule_task(cd->volwork, VOL_RAMP_UPDATE_US, @@ -649,15 +630,12 @@ static int volume_copy(struct comp_dev *dev) /* Get source, sink, number of frames etc. to process. */ ret = comp_get_copy_limits(dev, &c); if (ret < 0) { - trace_volume_error_with_ids(dev, "volume_copy(): " - "Failed comp_get_copy_limits()"); + comp_err(dev, "volume_copy(): Failed comp_get_copy_limits()"); return ret; } - tracev_volume_with_ids(dev, "volume_copy(), " - "source_bytes = 0x%x, " - "sink_bytes = 0x%x", - c.source_bytes, c.sink_bytes); + comp_dbg(dev, "volume_copy(), source_bytes = 0x%x, sink_bytes = 0x%x", + c.source_bytes, c.sink_bytes); /* copy and scale volume */ cd->scale_vol(dev, &c.sink->stream, &c.source->stream, c.frames); @@ -686,7 +664,7 @@ static int volume_prepare(struct comp_dev *dev) int i; int ret; - trace_volume_with_ids(dev, "volume_prepare()"); + comp_info(dev, "volume_prepare()"); ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); if (ret < 0) @@ -704,23 +682,20 @@ static int volume_prepare(struct comp_dev *dev) dev->frames); if (sinkb->stream.size < config->periods_sink * sink_period_bytes) { - trace_volume_error_with_ids(dev, "volume_prepare() error: " - "sink buffer size is insufficient"); + comp_err(dev, "volume_prepare() error: sink buffer size is insufficient"); ret = -ENOMEM; goto err; } cd->scale_vol = vol_get_processing_function(dev); if (!cd->scale_vol) { - trace_volume_error_with_ids - (dev, - "volume_prepare() error: invalid cd->scale_vol"); + comp_err(dev, "volume_prepare() error: invalid cd->scale_vol"); ret = -EINVAL; goto err; } - vol_sync_host(cd, PLATFORM_MAX_CHANNELS); + vol_sync_host(dev, PLATFORM_MAX_CHANNELS); /* Set current volume to min to ensure ramp starts from minimum * to previous volume request. Copy() checks for ramp started @@ -753,7 +728,7 @@ static int volume_prepare(struct comp_dev *dev) */ static int volume_reset(struct comp_dev *dev) { - trace_volume_with_ids(dev, "volume_reset()"); + comp_info(dev, "volume_reset()"); comp_set_state(dev, COMP_TRIGGER_RESET); return 0; diff --git a/src/include/sof/audio/asrc/asrc_farrow.h b/src/include/sof/audio/asrc/asrc_farrow.h index 615a07af331b..c6a654e4bdbf 100644 --- a/src/include/sof/audio/asrc/asrc_farrow.h +++ b/src/include/sof/audio/asrc/asrc_farrow.h @@ -41,6 +41,7 @@ #ifndef IAS_SRC_FARROW_H #define IAS_SRC_FARROW_H +#include #include #include #include @@ -239,7 +240,8 @@ struct asrc_farrow { * @param[in] bit_depth The wordlength that will be used for representing * the PCM samples, must be 16 or 32. */ -enum asrc_error_code asrc_get_required_size(int *required_size, +enum asrc_error_code asrc_get_required_size(struct comp_dev *dev, + int *required_size, int num_channels, int bit_depth); @@ -275,7 +277,8 @@ enum asrc_error_code asrc_get_required_size(int *required_size, * @param[in] operation_mode Choose 'push' or 'pull', depending on the mode * you want your ASRC to operate in. */ -enum asrc_error_code asrc_initialise(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_initialise(struct comp_dev *dev, + struct asrc_farrow *src_obj, int num_channels, int32_t fs_prim, int32_t fs_sec, @@ -336,7 +339,8 @@ enum asrc_error_code asrc_initialise(struct asrc_farrow *src_obj, * avoid that unconsumed samples are * overwritten. */ -enum asrc_error_code asrc_process_push16(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_process_push16(struct comp_dev *dev, + struct asrc_farrow *src_obj, int16_t **__restrict input_buffers, int input_num_frames, int16_t **__restrict output_buffers, @@ -393,7 +397,8 @@ enum asrc_error_code asrc_process_push16(struct asrc_farrow *src_obj, * avoid that unconsumed samples are * overwritten. */ -enum asrc_error_code asrc_process_push32(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_process_push32(struct comp_dev *dev, + struct asrc_farrow *src_obj, int32_t **__restrict input_buffers, int input_num_frames, int32_t **__restrict output_buffers, @@ -457,7 +462,8 @@ enum asrc_error_code asrc_process_push32(struct asrc_farrow *src_obj, * parameter returns the number of frames * that have been read. */ -enum asrc_error_code asrc_process_pull16(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_process_pull16(struct comp_dev *dev, + struct asrc_farrow *src_obj, int16_t **__restrict input_buffers, int *input_num_frames, int16_t **__restrict output_buffers, @@ -520,7 +526,8 @@ enum asrc_error_code asrc_process_pull16(struct asrc_farrow *src_obj, * parameter returns the number of frames * that have been read. */ -enum asrc_error_code asrc_process_pull32(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_process_pull32(struct comp_dev *dev, + struct asrc_farrow *src_obj, int32_t **__restrict input_buffers, int *input_num_frames, int32_t **__restrict output_buffers, @@ -540,7 +547,8 @@ enum asrc_error_code asrc_process_pull32(struct asrc_farrow *src_obj, * Value should be passed as 2q30 fixed point value. * For synchrounous operation pass (1 << 30). */ -enum asrc_error_code asrc_update_drift(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_update_drift(struct comp_dev *dev, + struct asrc_farrow *src_obj, uint32_t clock_skew); /* @@ -562,7 +570,8 @@ enum asrc_error_code asrc_update_drift(struct asrc_farrow *src_obj, * in one controller loop on the * secondary (SSP) side */ -enum asrc_error_code asrc_update_fs_ratio(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_update_fs_ratio(struct comp_dev *dev, + struct asrc_farrow *src_obj, int primary_num_frames, int secondary_num_frames); @@ -579,7 +588,8 @@ enum asrc_error_code asrc_update_fs_ratio(struct asrc_farrow *src_obj, * @param[in] fs_prim Primary sampling rate. * @param[in] fs_sec Secondary sampling rate. */ -enum asrc_error_code asrc_set_fs_ratio(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_set_fs_ratio(struct comp_dev *dev, + struct asrc_farrow *src_obj, int32_t fs_prim, int32_t fs_sec); /* @@ -590,7 +600,8 @@ enum asrc_error_code asrc_set_fs_ratio(struct asrc_farrow *src_obj, * @param[in] src_obj Pointer to the ias_src_farrow instance. * @param[in] input_format Format parameter. */ -enum asrc_error_code asrc_set_input_format(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_set_input_format(struct comp_dev *dev, + struct asrc_farrow *src_obj, enum asrc_io_format input_format); /* @@ -601,7 +612,8 @@ enum asrc_error_code asrc_set_input_format(struct asrc_farrow *src_obj, * @param[in] src_obj Pointer to the ias_src_farrow instance. * @param[in] output_format Format parameter. */ -enum asrc_error_code asrc_set_output_format(struct asrc_farrow *src_obj, +enum asrc_error_code asrc_set_output_format(struct comp_dev *dev, + struct asrc_farrow *src_obj, enum asrc_io_format output_format); /* diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 7beeaa7d594a..9713afe6779a 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -145,23 +145,34 @@ struct dai_hw_params; /** \name Trace macros * @{ */ -#define trace_comp(__e, ...) \ +#define trace_comp_get_id(comp_p) ((comp_p)->comp.pipeline_id) +#define trace_comp_get_subid(comp_p) ((comp_p)->comp.id) + +/* class (driver) level (no device object) tracing */ + +#define comp_cl_err(drv_p, __e, ...) \ + trace_error(TRACE_CLASS_COMP, __e, ##__VA_ARGS__) + +#define comp_cl_info(drv_p, __e, ...) \ trace_event(TRACE_CLASS_COMP, __e, ##__VA_ARGS__) -#define trace_comp_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_COMP, comp_ptr, \ - __e, ##__VA_ARGS__) -#define tracev_comp(__e, ...) \ +#define comp_cl_dbg(drv_p, __e, ...) \ tracev_event(TRACE_CLASS_COMP, __e, ##__VA_ARGS__) -#define tracev_comp_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_COMP, comp_ptr, \ - __e, ##__VA_ARGS__) +/* device tracing */ + +#define comp_err(comp_p, __e, ...) \ + trace_dev_err(TRACE_CLASS_COMP, trace_comp_get_id, \ + trace_comp_get_subid, comp_p, __e, ##__VA_ARGS__) + +#define comp_info(comp_p, __e, ...) \ + trace_dev_info(TRACE_CLASS_COMP, trace_comp_get_id, \ + trace_comp_get_subid, comp_p, __e, ##__VA_ARGS__) + +#define comp_dbg(comp_p, __e, ...) \ + trace_dev_dbg(TRACE_CLASS_COMP, trace_comp_get_id, \ + trace_comp_get_subid, comp_p, __e, ##__VA_ARGS__) + -#define trace_comp_error(__e, ...) \ - trace_error(TRACE_CLASS_COMP, __e, ##__VA_ARGS__) -#define trace_comp_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_COMP, comp_ptr, \ - __e, ##__VA_ARGS__) /** @}*/ /* \brief Type of endpoint this component is connected to in a pipeline */ @@ -452,10 +463,8 @@ 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 || SOF_ABI_VERSION_INCOMPATIBLE(SOF_ABI_VERSION, cdata->data->abi))) { - trace_comp_error_with_ids(dev, "comp_cmd() error: " - "invalid version, " - "data->magic = %u, data->abi = %u", - cdata->data->magic, cdata->data->abi); + comp_err(dev, "comp_cmd() error: invalid version, data->magic = %u, data->abi = %u", + cdata->data->magic, cdata->data->abi); return -EINVAL; } @@ -659,13 +668,10 @@ static inline void comp_underrun(struct comp_dev *dev, { int32_t bytes = (int32_t)source->stream.avail - copy_bytes; - trace_comp_error_with_ids(dev, "comp_underrun() error: " - "dev->comp.id = %u, " - "source->avail = %u, " - "copy_bytes = %u", - dev->comp.id, - source->stream.avail, - copy_bytes); + comp_err(dev, "comp_underrun() error: dev->comp.id = %u, source->avail = %u, copy_bytes = %u", + dev->comp.id, + source->stream.avail, + copy_bytes); pipeline_xrun(dev->pipeline, dev, bytes); } @@ -681,8 +687,8 @@ static inline void comp_overrun(struct comp_dev *dev, struct comp_buffer *sink, { int32_t bytes = (int32_t)copy_bytes - sink->stream.free; - trace_comp_error("comp_overrun() error: dev->comp.id = %u, sink->free = %u, copy_bytes = %u", - dev->comp.id, sink->stream.free, copy_bytes); + comp_err(dev, "comp_overrun() error: sink->free = %u, copy_bytes = %u", + sink->stream.free, copy_bytes); pipeline_xrun(dev->pipeline, dev, bytes); } diff --git a/src/include/sof/audio/kpb.h b/src/include/sof/audio/kpb.h index 65ec4f4da074..8ee2f7fa52ca 100644 --- a/src/include/sof/audio/kpb.h +++ b/src/include/sof/audio/kpb.h @@ -14,23 +14,6 @@ struct comp_buffer; -/* KPB tracing */ -#define trace_kpb(__e, ...) trace_event(TRACE_CLASS_KPB, __e, ##__VA_ARGS__) -#define trace_kpb_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_KPB, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_kpb(__e, ...) tracev_event(TRACE_CLASS_KPB, __e, ##__VA_ARGS__) -#define tracev_kpb_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_KPB, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_kpb_error(__e, ...) trace_error(TRACE_CLASS_KPB, __e, \ - ##__VA_ARGS__) -#define trace_kpb_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_KPB, comp_ptr, \ - __e, ##__VA_ARGS__) - /* KPB internal defines */ #define KPB_MAX_BUFF_TIME 2100 /**< time of buffering in miliseconds */ #define KPB_MAX_SUPPORTED_CHANNELS 2 /**< number of supported channels */ diff --git a/src/include/sof/audio/mux.h b/src/include/sof/audio/mux.h index 0dd74fb76e43..7d00e125c0d0 100644 --- a/src/include/sof/audio/mux.h +++ b/src/include/sof/audio/mux.h @@ -28,24 +28,6 @@ struct comp_buffer; struct comp_dev; - /* tracing */ -#define trace_mux(__e, ...) trace_event(TRACE_CLASS_MUX, __e, ##__VA_ARGS__) -#define trace_mux_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_MUX, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define tracev_mux(__e, ...) \ - tracev_event(TRACE_CLASS_MUX, __e, ##__VA_ARGS__) -#define tracev_mux_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_MUX, comp_ptr, \ - __e, ##__VA_ARGS__) - -#define trace_mux_error(__e, ...) \ - trace_error(TRACE_CLASS_MUX, __e, ##__VA_ARGS__) -#define trace_mux_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_MUX, comp_ptr, \ - __e, ##__VA_ARGS__) - /** \brief Supported streams count. */ #define MUX_MAX_STREAMS 4 diff --git a/src/include/sof/audio/selector.h b/src/include/sof/audio/selector.h index a24717e6b54b..8aa56f256dfe 100644 --- a/src/include/sof/audio/selector.h +++ b/src/include/sof/audio/selector.h @@ -23,27 +23,6 @@ struct comp_buffer; struct comp_dev; -/** \brief Selector trace function. */ -#define trace_selector(__e, ...) \ - trace_event(TRACE_CLASS_SELECTOR, __e, ##__VA_ARGS__) -#define trace_selector_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_SELECTOR, comp_ptr, \ - __e, ##__VA_ARGS__) - -/** \brief Selector trace verbose function. */ -#define tracev_selector(__e, ...) \ - tracev_event(TRACE_CLASS_SELECTOR, __e, ##__VA_ARGS__) -#define tracev_selector_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_SELECTOR, comp_ptr, \ - __e, ##__VA_ARGS__) - -/** \brief Selector trace error function. */ -#define trace_selector_error(__e, ...) \ - trace_error(TRACE_CLASS_SELECTOR, __e, ##__VA_ARGS__) -#define trace_selector_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_SELECTOR, comp_ptr, \ - __e, ##__VA_ARGS__) - /** \brief Supported channel count on input. */ #define SEL_SOURCE_2CH 2 #define SEL_SOURCE_4CH 4 diff --git a/src/include/sof/audio/volume.h b/src/include/sof/audio/volume.h index d292be36dfa1..923ff8791004 100644 --- a/src/include/sof/audio/volume.h +++ b/src/include/sof/audio/volume.h @@ -39,27 +39,6 @@ struct sof_ipc_ctrl_value_chan; #endif -/** \brief Volume trace function. */ -#define trace_volume(__e, ...) \ - trace_event(TRACE_CLASS_VOLUME, __e, ##__VA_ARGS__) -#define trace_volume_with_ids(comp_ptr, __e, ...) \ - trace_event_comp(TRACE_CLASS_VOLUME, comp_ptr, \ - __e, ##__VA_ARGS__) - -/** \brief Volume trace value function. */ -#define tracev_volume(__e, ...) \ - tracev_event(TRACE_CLASS_VOLUME, __e, ##__VA_ARGS__) -#define tracev_volume_with_ids(comp_ptr, __e, ...) \ - tracev_event_comp(TRACE_CLASS_VOLUME, comp_ptr, \ - __e, ##__VA_ARGS__) - -/** \brief Volume trace error function. */ -#define trace_volume_error(__e, ...) \ - trace_error(TRACE_CLASS_VOLUME, __e, ##__VA_ARGS__) -#define trace_volume_error_with_ids(comp_ptr, __e, ...) \ - trace_error_comp(TRACE_CLASS_VOLUME, comp_ptr, \ - __e, ##__VA_ARGS__) - //** \brief Volume gain Qx.y integer x number of bits including sign bit. */ #define VOL_QXY_X 8 diff --git a/src/include/sof/trace/trace.h b/src/include/sof/trace/trace.h index 62218eacd1f0..a50fb111872c 100644 --- a/src/include/sof/trace/trace.h +++ b/src/include/sof/trace/trace.h @@ -400,16 +400,4 @@ do { \ tracev_event_with_ids(class, get_id_m(dev), get_subid_m(dev), fmt, \ ##__VA_ARGS__) -/* TODO: remove component specific macros from global header */ -/* tracing from component */ -#define _trace_comp_build(fun, class, comp_ptr, format, ...) \ - fun(class, comp_ptr->comp.pipeline_id, \ - comp_ptr->comp.id, format, ##__VA_ARGS__) - -#define trace_event_comp(...) _trace_comp_build(trace_event_with_ids, \ - ##__VA_ARGS__) -#define tracev_event_comp(...) _trace_comp_build(tracev_event_with_ids, \ - ##__VA_ARGS__) -#define trace_error_comp(...) _trace_comp_build(trace_error_with_ids, \ - ##__VA_ARGS__) #endif /* __SOF_TRACE_TRACE_H__ */ From 9e6ee386652439610a53a90c1e6de77da53a61ea Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Wed, 12 Feb 2020 14:36:16 +0100 Subject: [PATCH 05/10] trace: dai: add err,info,dbg macros New class and instance macro set for dai tracing defined. Uses compact and well known suffixes: err,info,dbg. Signed-off-by: Marcin Maka --- src/include/sof/lib/dai.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/include/sof/lib/dai.h b/src/include/sof/lib/dai.h index 1d554eb47167..7569f6f7bf57 100644 --- a/src/include/sof/lib/dai.h +++ b/src/include/sof/lib/dai.h @@ -148,6 +148,7 @@ struct dai_type_info { size_t num_dais; /**< Number of elements in dai_array */ }; +/* TODO: to be removed once dais using it are switched to the new one */ #define trace_dai_with_ids(klass, dai_ptr, format, ...) \ trace_event_with_ids(klass, \ dai_ptr->drv->type, \ @@ -166,6 +167,35 @@ struct dai_type_info { dai_ptr->index, \ format, ##__VA_ARGS__) +/* dai tracing */ +#define trace_dai_get_id(dai_p) ((dai_p)->drv->type) +#define trace_dai_get_subid(dai_p) ((dai_p)->index) + +/* class (driver) level (no device object) tracing */ + +#define dai_cl_err(drv_p, __e, ...) \ + trace_error(TRACE_CLASS_DAI, __e, ##__VA_ARGS__) + +#define dai_cl_info(drv_p, __e, ...) \ + trace_event(TRACE_CLASS_DAI, __e, ##__VA_ARGS__) + +#define dai_cl_dbg(drv_p, __e, ...) \ + tracev_event(TRACE_CLASS_DAI, __e, ##__VA_ARGS__) + +/* device tracing */ + +#define dai_err(dai_p, __e, ...) \ + trace_dev_err(TRACE_CLASS_DAI, trace_dai_get_id, \ + trace_dai_get_subid, dai_p, __e, ##__VA_ARGS__) + +#define dai_info(dai_p, __e, ...) \ + trace_dev_info(TRACE_CLASS_DAI, trace_dai_get_id, \ + trace_dai_get_subid, dai_p, __e, ##__VA_ARGS__) + +#define dai_dbg(dai_p, __e, ...) \ + trace_dev_dbg(TRACE_CLASS_DAI, trace_dai_get_id, \ + trace_dai_get_subid, dai_p, __e, ##__VA_ARGS__) + /** * \brief Holds information about array of DAIs grouped by type. */ From b1fd343a6e0500d5922d6c0983e08436d12c249b Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Wed, 12 Feb 2020 14:38:45 +0100 Subject: [PATCH 06/10] dmic: trace: switch to new trace macros Signed-off-by: Marcin Maka --- src/drivers/intel/cavs/dmic.c | 258 ++++++++++++++++------------------ 1 file changed, 121 insertions(+), 137 deletions(-) diff --git a/src/drivers/intel/cavs/dmic.c b/src/drivers/intel/cavs/dmic.c index a3a9c3557894..3c0f4989d4b1 100644 --- a/src/drivers/intel/cavs/dmic.c +++ b/src/drivers/intel/cavs/dmic.c @@ -134,25 +134,6 @@ struct pdm_controllers_configuration { #define Q_SHIFT_GAIN_X_GAIN_COEF \ (Q_SHIFT_BITS_32(30, DB2LIN_FIXED_OUTPUT_QY, 30)) -/* tracing */ -#define trace_dmic(__e, ...) \ - trace_event(TRACE_CLASS_DMIC, __e, ##__VA_ARGS__) - -#define trace_dmic_id(dmic_ptr, format, ...) \ - trace_dai_with_ids(TRACE_CLASS_DMIC, dmic_ptr, format, ##__VA_ARGS__) - -#define trace_error_dmic(__e, ...) \ - trace_error(TRACE_CLASS_DMIC, __e, ##__VA_ARGS__) - -#define trace_error_dmic_id(dmic_ptr, format, ...) \ - trace_dai_error_with_ids(TRACE_CLASS_DMIC, dmic_ptr, \ - format, ##__VA_ARGS__) -#define tracev_dmic(__e, ...) \ - tracev_event(TRACE_CLASS_DMIC, __e, ##__VA_ARGS__) - -#define tracev_dmic_id(dmic_ptr, format, ...) \ - tracev_dai_with_ids(TRACE_CLASS_DMIC, dmic_ptr, format, ##__VA_ARGS__) - /* Base addresses (in PDM scope) of 2ch PDM controllers and coefficient RAM. */ static const uint32_t base[4] = {PDM0, PDM1, PDM2, PDM3}; static const uint32_t coef_base_a[4] = {PDM0_COEFFICIENT_A, PDM1_COEFFICIENT_A, @@ -174,12 +155,12 @@ static enum task_state dmic_work(void *data) int i; int ret; - tracev_dmic_id(dai, "dmic_work()"); + dai_dbg(dai, "dmic_work()"); ret = spin_try_lock(&dai->lock); if (!ret) { platform_shared_commit(dai, sizeof(*dai)); - tracev_dmic_id(dai, "dmic_work(): spin_try_lock(dai->lock, ret) failed: RESCHEDULE"); + dai_dbg(dai, "dmic_work(): spin_try_lock(dai->lock, ret) failed: RESCHEDULE"); return SOF_TASK_STATE_RESCHEDULE; } @@ -250,7 +231,8 @@ static enum task_state dmic_work(void *data) * microphone clock min/max and duty cycle requirements need be checked from * used microphone component datasheet. */ -static void find_modes(struct decim_modes *modes, uint32_t fs, int di) +static void find_modes(struct dai *dai, + struct decim_modes *modes, uint32_t fs, int di) { int clkdiv_min; int clkdiv_max; @@ -285,28 +267,28 @@ static void find_modes(struct decim_modes *modes, uint32_t fs, int di) /* Check for sane pdm clock, min 100 kHz, max ioclk/2 */ if (dmic_prm[di]->pdmclk_max < DMIC_HW_PDM_CLK_MIN || dmic_prm[di]->pdmclk_max > DMIC_HW_IOCLK / 2) { - trace_error_dmic("find_modes() error: pdm clock max not in range"); + dai_err(dai, "find_modes() error: pdm clock max not in range"); return; } if (dmic_prm[di]->pdmclk_min < DMIC_HW_PDM_CLK_MIN || dmic_prm[di]->pdmclk_min > dmic_prm[di]->pdmclk_max) { - trace_error_dmic("find_modes() error: pdm clock min not in range"); + dai_err(dai, "find_modes() error: pdm clock min not in range"); return; } /* Check for sane duty cycle */ if (dmic_prm[di]->duty_min > dmic_prm[di]->duty_max) { - trace_error_dmic("find_modes() error: duty cycle min > max"); + dai_err(dai, "find_modes() error: duty cycle min > max"); return; } if (dmic_prm[di]->duty_min < DMIC_HW_DUTY_MIN || dmic_prm[di]->duty_min > DMIC_HW_DUTY_MAX) { - trace_error_dmic("find_modes() error: pdm clock min not in range"); + dai_err(dai, "find_modes() error: pdm clock min not in range"); return; } if (dmic_prm[di]->duty_max < DMIC_HW_DUTY_MIN || dmic_prm[di]->duty_max > DMIC_HW_DUTY_MAX) { - trace_error_dmic("find_modes() error: pdm clock max not in range"); + dai_err(dai, "find_modes() error: pdm clock max not in range"); return; } @@ -442,7 +424,8 @@ static void match_modes(struct matched_modes *c, struct decim_modes *a, } /* Finds a suitable FIR decimation filter from the included set */ -static struct pdm_decim *get_fir(struct dmic_configuration *cfg, int mfir) +static struct pdm_decim *get_fir(struct dai *dai, + struct dmic_configuration *cfg, int mfir) { int i; int fs; @@ -474,8 +457,8 @@ static struct pdm_decim *get_fir(struct dmic_configuration *cfg, int mfir) fir = fir_list[i]; break; } - trace_dmic("get_fir(), Note length=%d exceeds max=%d", - fir_list[i]->length, fir_max_length); + dai_info(dai, "get_fir(), Note length=%d exceeds max=%d", + fir_list[i]->length, fir_max_length); } i++; } @@ -546,7 +529,8 @@ static int fir_coef_scale(int32_t *fir_scale, int *fir_shift, int add_shift, * added into the included set. FIR decimation with a high factor usually * needs compromizes into specifications and is not desirable. */ -static int select_mode(struct dmic_configuration *cfg, +static int select_mode(struct dai *dai, + struct dmic_configuration *cfg, struct matched_modes *modes) { int32_t g_cic; @@ -570,7 +554,7 @@ static int select_mode(struct dmic_configuration *cfg, * the candidates should be sufficient. */ if (modes->num_of_modes == 0) { - trace_error_dmic("select_mode() error: no modes available"); + dai_err(dai, "select_mode() error: no modes available"); return -EINVAL; } @@ -601,19 +585,19 @@ static int select_mode(struct dmic_configuration *cfg, * A and B. */ if (cfg->mfir_a > 0) { - cfg->fir_a = get_fir(cfg, cfg->mfir_a); + cfg->fir_a = get_fir(dai, cfg, cfg->mfir_a); if (!cfg->fir_a) { - trace_error_dmic("select_mode() error: cannot find FIR coefficients, mfir_a = %u", - cfg->mfir_a); + dai_err(dai, "select_mode() error: cannot find FIR coefficients, mfir_a = %u", + cfg->mfir_a); return -EINVAL; } } if (cfg->mfir_b > 0) { - cfg->fir_b = get_fir(cfg, cfg->mfir_b); + cfg->fir_b = get_fir(dai, cfg, cfg->mfir_b); if (!cfg->fir_b) { - trace_error_dmic("select_mode() error: cannot find FIR coefficients, mfir_b = %u", - cfg->mfir_b); + dai_err(dai, "select_mode() error: cannot find FIR coefficients, mfir_b = %u", + cfg->mfir_b); return -EINVAL; } } @@ -625,7 +609,7 @@ static int select_mode(struct dmic_configuration *cfg, g_cic = mcic * mcic * mcic * mcic * mcic; if (g_cic < 0) { /* Erroneous decimation factor and CIC gain */ - trace_error_dmic("select_mode() error: erroneous decimation factor and CIC gain"); + dai_err(dai, "select_mode() error: erroneous decimation factor and CIC gain"); return -EINVAL; } @@ -652,7 +636,7 @@ static int select_mode(struct dmic_configuration *cfg, cfg->fir_a->length, gain_to_fir); if (ret < 0) { /* Invalid coefficient set found, should not happen. */ - trace_error_dmic("select_mode() error: invalid coefficient set found"); + dai_err(dai, "select_mode() error: invalid coefficient set found"); return -EINVAL; } } else { @@ -668,7 +652,7 @@ static int select_mode(struct dmic_configuration *cfg, cfg->fir_b->length, gain_to_fir); if (ret < 0) { /* Invalid coefficient set found, should not happen. */ - trace_error_dmic("select_mode() error: invalid coefficient set found"); + dai_err(dai, "select_mode() error: invalid coefficient set found"); return -EINVAL; } } else { @@ -833,11 +817,11 @@ static int configure_registers(struct dai *dai, /* pdata is set by dmic_probe(), error if it has not been set */ if (!pdata) { - trace_error_dmic_id(dai, "configure_registers() error: pdata not set"); + dai_err(dai, "configure_registers() error: pdata not set"); return -EINVAL; } - trace_dmic_id(dai, "configuring registers"); + dai_info(dai, "configuring registers"); /* OUTCONTROL0 and OUTCONTROL1 */ of0 = (dmic_prm[0]->fifo_bits == 32) ? 2 : 0; @@ -859,7 +843,7 @@ static int configure_registers(struct dai *dai, OUTCONTROL0_IPM(ipm) | OUTCONTROL0_TH(th); dai_write(dai, OUTCONTROL0, val); - tracev_dmic_id(dai, "configure_registers(), OUTCONTROL0 = %u", val); + dai_dbg(dai, "configure_registers(), OUTCONTROL0 = %u", val); ipm_helper1(&ipm, 1); val = OUTCONTROL1_TIE(0) | @@ -871,7 +855,7 @@ static int configure_registers(struct dai *dai, OUTCONTROL1_IPM(ipm) | OUTCONTROL1_TH(th); dai_write(dai, OUTCONTROL1, val); - tracev_dmic_id(dai, "configure_registers(), OUTCONTROL1 = %u", val); + dai_dbg(dai, "configure_registers(), OUTCONTROL1 = %u", val); #endif #if DMIC_HW_VERSION == 2 && DMIC_HW_CONTROLLERS > 2 @@ -889,7 +873,7 @@ static int configure_registers(struct dai *dai, OUTCONTROL0_IPM_SOURCE_4(source[3]) | OUTCONTROL0_TH(th); dai_write(dai, OUTCONTROL0, val); - tracev_dmic_id(dai, "configure_registers(), OUTCONTROL0 = %u", val); + dai_dbg(dai, "configure_registers(), OUTCONTROL0 = %u", val); ipm_helper2(source, &ipm, 1); val = OUTCONTROL1_TIE(0) | @@ -905,7 +889,7 @@ static int configure_registers(struct dai *dai, OUTCONTROL1_IPM_SOURCE_4(source[3]) | OUTCONTROL1_TH(th); dai_write(dai, OUTCONTROL1, val); - tracev_dmic_id(dai, "configure_registers(), OUTCONTROL1 = %u", val); + dai_dbg(dai, "configure_registers(), OUTCONTROL1 = %u", val); #endif /* Mark enabled microphones into private data to be later used @@ -918,7 +902,7 @@ static int configure_registers(struct dai *dai, ret = stereo_helper(stereo, swap); if (ret < 0) { - trace_error_dmic_id(dai, "configure_registers(): enable conflict"); + dai_err(dai, "configure_registers(): enable conflict"); return ret; } @@ -932,14 +916,14 @@ static int configure_registers(struct dai *dai, CIC_CONTROL_MIC_MUTE(cic_mute) | CIC_CONTROL_STEREO_MODE(stereo[i]); dai_write(dai, base[i] + CIC_CONTROL, val); - tracev_dmic_id(dai, "configure_registers(), CIC_CONTROL = %u", - val); + dai_dbg(dai, "configure_registers(), CIC_CONTROL = %u", + val); val = CIC_CONFIG_CIC_SHIFT(cfg->cic_shift + 8) | CIC_CONFIG_COMB_COUNT(cfg->mcic - 1); dai_write(dai, base[i] + CIC_CONFIG, val); - tracev_dmic_id(dai, "configure_registers(), CIC_CONFIG = %u", - val); + dai_dbg(dai, "configure_registers(), CIC_CONFIG = %u", + val); /* Mono right channel mic usage requires swap of PDM channels * since the mono decimation is done with only left channel @@ -955,8 +939,8 @@ static int configure_registers(struct dai *dai, MIC_CONTROL_PDM_EN_B(cic_start_b) | MIC_CONTROL_PDM_EN_A(cic_start_a); dai_write(dai, base[i] + MIC_CONTROL, val); - tracev_dmic_id(dai, "configure_registers(), MIC_CONTROL = %u", - val); + dai_dbg(dai, "configure_registers(), MIC_CONTROL = %u", + val); /* FIR A */ fir_decim = MAX(cfg->mfir_a - 1, 0); @@ -967,35 +951,35 @@ static int configure_registers(struct dai *dai, FIR_CONTROL_A_MUTE(fir_mute) | FIR_CONTROL_A_STEREO(stereo[i]); dai_write(dai, base[i] + FIR_CONTROL_A, val); - tracev_dmic_id(dai, "configure_registers(), FIR_CONTROL_A = %u", - val); + dai_dbg(dai, "configure_registers(), FIR_CONTROL_A = %u", + val); val = FIR_CONFIG_A_FIR_DECIMATION(fir_decim) | FIR_CONFIG_A_FIR_SHIFT(cfg->fir_a_shift) | FIR_CONFIG_A_FIR_LENGTH(fir_length); dai_write(dai, base[i] + FIR_CONFIG_A, val); - tracev_dmic_id(dai, "configure_registers(), FIR_CONFIG_A = %u", - val); + dai_dbg(dai, "configure_registers(), FIR_CONFIG_A = %u", + val); val = DC_OFFSET_LEFT_A_DC_OFFS(DCCOMP_TC0); dai_write(dai, base[i] + DC_OFFSET_LEFT_A, val); - tracev_dmic_id(dai, "configure_registers(), DC_OFFSET_LEFT_A = %u", - val); + dai_dbg(dai, "configure_registers(), DC_OFFSET_LEFT_A = %u", + val); val = DC_OFFSET_RIGHT_A_DC_OFFS(DCCOMP_TC0); dai_write(dai, base[i] + DC_OFFSET_RIGHT_A, val); - tracev_dmic_id(dai, "configure_registers(), DC_OFFSET_RIGHT_A = %u", - val); + dai_dbg(dai, "configure_registers(), DC_OFFSET_RIGHT_A = %u", + val); val = OUT_GAIN_LEFT_A_GAIN(0); dai_write(dai, base[i] + OUT_GAIN_LEFT_A, val); - tracev_dmic_id(dai, "configure_registers(), OUT_GAIN_LEFT_A = %u", - val); + dai_dbg(dai, "configure_registers(), OUT_GAIN_LEFT_A = %u", + val); val = OUT_GAIN_RIGHT_A_GAIN(0); dai_write(dai, base[i] + OUT_GAIN_RIGHT_A, val); - tracev_dmic_id(dai, "configure_registers(), OUT_GAIN_RIGHT_A = %u", - val); + dai_dbg(dai, "configure_registers(), OUT_GAIN_RIGHT_A = %u", + val); /* FIR B */ fir_decim = MAX(cfg->mfir_b - 1, 0); @@ -1006,35 +990,35 @@ static int configure_registers(struct dai *dai, FIR_CONTROL_B_MUTE(fir_mute) | FIR_CONTROL_B_STEREO(stereo[i]); dai_write(dai, base[i] + FIR_CONTROL_B, val); - tracev_dmic_id(dai, "configure_registers(), FIR_CONTROL_B = %u", - val); + dai_dbg(dai, "configure_registers(), FIR_CONTROL_B = %u", + val); val = FIR_CONFIG_B_FIR_DECIMATION(fir_decim) | FIR_CONFIG_B_FIR_SHIFT(cfg->fir_b_shift) | FIR_CONFIG_B_FIR_LENGTH(fir_length); dai_write(dai, base[i] + FIR_CONFIG_B, val); - tracev_dmic_id(dai, "configure_registers(), FIR_CONFIG_B = %u", - val); + dai_dbg(dai, "configure_registers(), FIR_CONFIG_B = %u", + val); val = DC_OFFSET_LEFT_B_DC_OFFS(DCCOMP_TC0); dai_write(dai, base[i] + DC_OFFSET_LEFT_B, val); - tracev_dmic_id(dai, "configure_registers(), DC_OFFSET_LEFT_B = %u", - val); + dai_dbg(dai, "configure_registers(), DC_OFFSET_LEFT_B = %u", + val); val = DC_OFFSET_RIGHT_B_DC_OFFS(DCCOMP_TC0); dai_write(dai, base[i] + DC_OFFSET_RIGHT_B, val); - tracev_dmic_id(dai, "configure_registers(), DC_OFFSET_RIGHT_B = %u", - val); + dai_dbg(dai, "configure_registers(), DC_OFFSET_RIGHT_B = %u", + val); val = OUT_GAIN_LEFT_B_GAIN(0); dai_write(dai, base[i] + OUT_GAIN_LEFT_B, val); - tracev_dmic_id(dai, "configure_registers(), OUT_GAIN_LEFT_B = %u", - val); + dai_dbg(dai, "configure_registers(), OUT_GAIN_LEFT_B = %u", + val); val = OUT_GAIN_RIGHT_B_GAIN(0); dai_write(dai, base[i] + OUT_GAIN_RIGHT_B, val); - tracev_dmic_id(dai, "configure_registers(), OUT_GAIN_RIGHT_B = %u", - val); + dai_dbg(dai, "configure_registers(), OUT_GAIN_RIGHT_B = %u", + val); /* Write coef RAM A with scaled coefficient in reverse order */ length = cfg->fir_a_length; @@ -1075,10 +1059,10 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config) int i, j, ret = 0; int di = dai->index; - trace_dmic_id(dai, "dmic_set_config()"); + dai_info(dai, "dmic_set_config()"); if (config->dmic.driver_ipc_version != DMIC_IPC_VERSION) { - trace_error_dmic_id(dai, "dmic_set_config() error: wrong ipc version"); + dai_err(dai, "dmic_set_config() error: wrong ipc version"); return -EINVAL; } @@ -1092,25 +1076,25 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config) if (unmute_ramp_time_ms < LOGRAMP_TIME_MIN_MS || unmute_ramp_time_ms > LOGRAMP_TIME_MAX_MS) { - trace_error_dmic_id(dai, "dmic_set_config(): Illegal ramp time = %d", - unmute_ramp_time_ms); + dai_err(dai, "dmic_set_config(): Illegal ramp time = %d", + unmute_ramp_time_ms); return -EINVAL; } if (di >= DMIC_HW_FIFOS) { - trace_error_dmic_id(dai, "dmic_set_config() error: dai->index exceeds number of FIFOs"); + dai_err(dai, "dmic_set_config() error: dai->index exceeds number of FIFOs"); return -EINVAL; } if (config->dmic.num_pdm_active > DMIC_HW_CONTROLLERS) { - trace_error_dmic_id(dai, "dmic_set_config() error: the requested PDM controllers count exceeds platform capability"); + dai_err(dai, "dmic_set_config() error: the requested PDM controllers count exceeds platform capability"); return -EINVAL; } step_db = LOGRAMP_CONST_TERM / unmute_ramp_time_ms; dmic->gain_coef = db2lin_fixed(step_db); - trace_dmic_id(dai, "dmic_set_config(): unmute_ramp_time_ms = %d", - unmute_ramp_time_ms); + dai_info(dai, "dmic_set_config(): unmute_ramp_time_ms = %d", + unmute_ramp_time_ms); /* * "config" might contain pdm controller params for only @@ -1125,7 +1109,7 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config) SOF_MEM_CAPS_RAM, DMIC_HW_FIFOS * size); if (!dmic_prm[0]) { - trace_error_dmic_id(dai, "dmic_set_config() error: prm not initialized"); + dai_err(dai, "dmic_set_config() error: prm not initialized"); return -ENOMEM; } for (i = 1; i < DMIC_HW_FIFOS; i++) @@ -1156,14 +1140,14 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config) } } - trace_dmic_id(dai, "dmic_set_config(), prm config->dmic.num_pdm_active = %u", - config->dmic.num_pdm_active); - trace_dmic_id(dai, "dmic_set_config(), prm pdmclk_min = %u, pdmclk_max = %u", - dmic_prm[di]->pdmclk_min, dmic_prm[di]->pdmclk_max); - trace_dmic_id(dai, "dmic_set_config(), prm duty_min = %u, duty_max = %u", - dmic_prm[di]->duty_min, dmic_prm[di]->duty_max); - trace_dmic_id(dai, "dmic_set_config(), prm fifo_fs = %u, fifo_bits = %u", - dmic_prm[di]->fifo_fs, dmic_prm[di]->fifo_bits); + dai_info(dai, "dmic_set_config(), prm config->dmic.num_pdm_active = %u", + config->dmic.num_pdm_active); + dai_info(dai, "dmic_set_config(), prm pdmclk_min = %u, pdmclk_max = %u", + dmic_prm[di]->pdmclk_min, dmic_prm[di]->pdmclk_max); + dai_info(dai, "dmic_set_config(), prm duty_min = %u, duty_max = %u", + dmic_prm[di]->duty_min, dmic_prm[di]->duty_max); + dai_info(dai, "dmic_set_config(), prm fifo_fs = %u, fifo_bits = %u", + dmic_prm[di]->fifo_fs, dmic_prm[di]->fifo_bits); switch (dmic_prm[di]->fifo_bits) { case 0: @@ -1171,7 +1155,7 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config) case 32: break; default: - trace_error_dmic_id(dai, "dmic_set_config() error: fifo_bits EINVAL"); + dai_err(dai, "dmic_set_config() error: fifo_bits EINVAL"); return -EINVAL; } @@ -1181,35 +1165,35 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config) * to use for FIR coefficient RAM write as well as the CIC and FIR * shift values. */ - find_modes(&modes_a, dmic_prm[0]->fifo_fs, di); + find_modes(dai, &modes_a, dmic_prm[0]->fifo_fs, di); if (modes_a.num_of_modes == 0 && dmic_prm[0]->fifo_fs > 0) { - trace_error_dmic_id(dai, "dmic_set_config() error: No modes found found for FIFO A"); + dai_err(dai, "dmic_set_config() error: No modes found found for FIFO A"); return -EINVAL; } - find_modes(&modes_b, dmic_prm[1]->fifo_fs, di); + find_modes(dai, &modes_b, dmic_prm[1]->fifo_fs, di); if (modes_b.num_of_modes == 0 && dmic_prm[1]->fifo_fs > 0) { - trace_error_dmic_id(dai, "dmic_set_config() error: No modes found for FIFO B"); + dai_err(dai, "dmic_set_config() error: No modes found for FIFO B"); return -EINVAL; } match_modes(&modes_ab, &modes_a, &modes_b); - ret = select_mode(&cfg, &modes_ab); + ret = select_mode(dai, &cfg, &modes_ab); if (ret < 0) { - trace_error_dmic_id(dai, "dmic_set_config() error: select_mode() failed"); + dai_err(dai, "dmic_set_config() error: select_mode() failed"); return -EINVAL; } - trace_dmic_id(dai, "dmic_set_config(), cfg clkdiv = %u, mcic = %u", - cfg.clkdiv, cfg.mcic); - trace_dmic_id(dai, "dmic_set_config(), cfg mfir_a = %u, mfir_b = %u", - cfg.mfir_a, cfg.mfir_b); - trace_dmic_id(dai, "dmic_set_config(), cfg cic_shift = %u", - cfg.cic_shift); - trace_dmic_id(dai, "dmic_set_config(), cfg fir_a_shift = %u, cfg.fir_b_shift = %u", - cfg.fir_a_shift, cfg.fir_b_shift); - trace_dmic_id(dai, "dmic_set_config(), cfg fir_a_length = %u, fir_b_length = %u", - cfg.fir_a_length, cfg.fir_b_length); + dai_info(dai, "dmic_set_config(), cfg clkdiv = %u, mcic = %u", + cfg.clkdiv, cfg.mcic); + dai_info(dai, "dmic_set_config(), cfg mfir_a = %u, mfir_b = %u", + cfg.mfir_a, cfg.mfir_b); + dai_info(dai, "dmic_set_config(), cfg cic_shift = %u", + cfg.cic_shift); + dai_info(dai, "dmic_set_config(), cfg fir_a_shift = %u, cfg.fir_b_shift = %u", + cfg.fir_a_shift, cfg.fir_b_shift); + dai_info(dai, "dmic_set_config(), cfg fir_a_length = %u, fir_b_length = %u", + cfg.fir_a_length, cfg.fir_b_length); /* Struct reg contains a mirror of actual HW registers. Determine * register bits configuration from decimator configuration and the @@ -1217,7 +1201,7 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config) */ ret = configure_registers(dai, &cfg); if (ret < 0) { - trace_error_dmic_id(dai, "dmic_set_config() error: cannot configure registers"); + dai_err(dai, "dmic_set_config() error: cannot configure registers"); return -EINVAL; } @@ -1238,7 +1222,7 @@ static void dmic_start(struct dai *dai) /* enable port */ spin_lock(&dai->lock); - tracev_dmic_id(dai, "dmic_start()"); + dai_dbg(dai, "dmic_start()"); dmic->state = COMP_STATE_ACTIVE; dmic->startcount = 0; @@ -1247,7 +1231,7 @@ static void dmic_start(struct dai *dai) switch (dai->index) { case 0: - trace_dmic_id(dai, "dmic_start(), dmic->fifo_a"); + dai_info(dai, "dmic_start(), dmic->fifo_a"); /* Clear FIFO A initialize, Enable interrupts to DSP, * Start FIFO A packer. */ @@ -1256,7 +1240,7 @@ static void dmic_start(struct dai *dai) OUTCONTROL0_SIP_BIT); break; case 1: - trace_dmic_id(dai, "dmic_start(), dmic->fifo_b"); + dai_info(dai, "dmic_start(), dmic->fifo_b"); /* Clear FIFO B initialize, Enable interrupts to DSP, * Start FIFO B packer. */ @@ -1281,8 +1265,8 @@ static void dmic_start(struct dai *dai) #else fir_b = 0; #endif - trace_dmic_id(dai, "dmic_start(), mic_a = %u, mic_b = %u, fir_a = %u, fir_b = %u", - mic_a, mic_b, fir_a, fir_b); + dai_info(dai, "dmic_start(), mic_a = %u, mic_b = %u, fir_a = %u, fir_b = %u", + mic_a, mic_b, fir_a, fir_b); /* If both microphones are needed start them simultaneously * to start them in sync. The reset may be cleared for another @@ -1351,8 +1335,8 @@ static void dmic_start(struct dai *dai) schedule_task(&dmic->dmicwork, DMIC_UNMUTE_RAMP_US, DMIC_UNMUTE_RAMP_US); - trace_dmic_id(dai, "dmic_start(), done active_fifos = %d", - dmic_active_fifos); + dai_info(dai, "dmic_start(), done active_fifos = %d", + dmic_active_fifos); } /* stop the DMIC for capture */ @@ -1361,11 +1345,11 @@ static void dmic_stop(struct dai *dai) struct dmic_pdata *dmic = dai_get_drvdata(dai); int i; - tracev_dmic_id(dai, "dmic_stop()"); + dai_dbg(dai, "dmic_stop()"); spin_lock(&dai->lock); if (dmic->state != COMP_STATE_ACTIVE) { - trace_dmic_id(dai, "dmic_stop(), already stopped"); + dai_info(dai, "dmic_stop(), already stopped"); goto out; } @@ -1387,8 +1371,8 @@ static void dmic_stop(struct dai *dai) /* Set soft reset and mute on for all PDM controllers. */ - trace_dmic_id(dai, "dmic_stop(), dmic_active_fifos = %d", - dmic_active_fifos); + dai_info(dai, "dmic_stop(), dmic_active_fifos = %d", + dmic_active_fifos); for (i = 0; i < DMIC_HW_CONTROLLERS; i++) { /* Don't stop CIC yet if both FIFOs were active */ @@ -1438,16 +1422,16 @@ static int dmic_trigger(struct dai *dai, int cmd, int direction) { struct dmic_pdata *dmic = dai_get_drvdata(dai); - tracev_dmic_id(dai, "dmic_trigger()"); + dai_dbg(dai, "dmic_trigger()"); /* dai private is set in dmic_probe(), error if not set */ if (!dmic) { - trace_error_dmic_id(dai, "dmic_trigger() error: dai not set"); + dai_err(dai, "dmic_trigger() error: dai not set"); return -EINVAL; } if (direction != DAI_DIR_CAPTURE) { - trace_error_dmic_id(dai, "dmic_trigger() error: direction != DAI_DIR_CAPTURE"); + dai_err(dai, "dmic_trigger() error: direction != DAI_DIR_CAPTURE"); return -EINVAL; } @@ -1458,8 +1442,8 @@ static int dmic_trigger(struct dai *dai, int cmd, int direction) dmic->state == COMP_STATE_PAUSED) { dmic_start(dai); } else { - trace_error_dmic_id(dai, "dmic_trigger() error: state is not prepare or paused, dmic->state = %u", - dmic->state); + dai_err(dai, "dmic_trigger() error: state is not prepare or paused, dmic->state = %u", + dmic->state); } break; case COMP_TRIGGER_STOP: @@ -1491,13 +1475,13 @@ static void dmic_irq_handler(void *data) /* Trace OUTSTAT0 register */ val0 = dai_read(dai, OUTSTAT0); val1 = dai_read(dai, OUTSTAT1); - trace_dmic_id(dai, "dmic_irq_handler(), OUTSTAT0 = %u", val0); - trace_dmic_id(dai, "dmic_irq_handler(), OUTSTAT1 = %u", val1); + dai_info(dai, "dmic_irq_handler(), OUTSTAT0 = %u", val0); + dai_info(dai, "dmic_irq_handler(), OUTSTAT1 = %u", val1); if (val0 & OUTSTAT0_ROR_BIT) - trace_error_dmic_id(dai, "dmic_irq_handler() error: full fifo A or PDM overrrun"); + dai_err(dai, "dmic_irq_handler() error: full fifo A or PDM overrrun"); if (val1 & OUTSTAT1_ROR_BIT) - trace_error_dmic_id(dai, "dmic_irq_handler() error: full fifo B or PDM overrrun"); + dai_err(dai, "dmic_irq_handler() error: full fifo B or PDM overrrun"); } static int dmic_probe(struct dai *dai) @@ -1506,7 +1490,7 @@ static int dmic_probe(struct dai *dai) struct dmic_pdata *dmic; int ret; - trace_dmic_id(dai, "dmic_probe()"); + dai_info(dai, "dmic_probe()"); if (dai_get_drvdata(dai)) return -EEXIST; /* already created */ @@ -1515,7 +1499,7 @@ static int dmic_probe(struct dai *dai) dmic = rzalloc(SOF_MEM_ZONE_SYS_RUNTIME, 0, SOF_MEM_CAPS_RAM, sizeof(*dmic)); if (!dmic) { - trace_error_dmic_id(dai, "dmic_probe() error: alloc failed"); + dai_err(dai, "dmic_probe() error: alloc failed"); return -ENOMEM; } dai_set_drvdata(dai, dmic); @@ -1533,7 +1517,7 @@ static int dmic_probe(struct dai *dai) ret = interrupt_register(dmic->irq, dmic_irq_handler, dai); if (ret < 0) { - trace_error_dmic_id(dai, "dmic failed to allocate IRQ"); + dai_err(dai, "dmic failed to allocate IRQ"); rfree(dmic); return ret; } @@ -1619,7 +1603,7 @@ static inline uint32_t dmic_ts_tscc_addr(void) static int dmic_ts_config(struct dai *dai, struct timestamp_cfg *cfg) { if (cfg->type != SOF_DAI_INTEL_DMIC) { - trace_error_dmic_id(dai, "dmic_ts_config(): Illegal DAI type"); + dai_err(dai, "dmic_ts_config(): Illegal DAI type"); return -EINVAL; } From 9b58e2980fada0512851ca075d58cb4187ab2138 Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Wed, 12 Feb 2020 14:39:31 +0100 Subject: [PATCH 07/10] trace: dai: remove old trace macros Signed-off-by: Marcin Maka --- src/include/sof/lib/dai.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/include/sof/lib/dai.h b/src/include/sof/lib/dai.h index 7569f6f7bf57..7d7ff7bef1db 100644 --- a/src/include/sof/lib/dai.h +++ b/src/include/sof/lib/dai.h @@ -148,25 +148,6 @@ struct dai_type_info { size_t num_dais; /**< Number of elements in dai_array */ }; -/* TODO: to be removed once dais using it are switched to the new one */ -#define trace_dai_with_ids(klass, dai_ptr, format, ...) \ - trace_event_with_ids(klass, \ - dai_ptr->drv->type, \ - dai_ptr->index, \ - format, ##__VA_ARGS__) - -#define trace_dai_error_with_ids(klass, dai_ptr, format, ...) \ - trace_error_with_ids(klass, \ - dai_ptr->drv->type, \ - dai_ptr->index, \ - format, ##__VA_ARGS__) - -#define tracev_dai_with_ids(klass, dai_ptr, format, ...) \ - tracev_event_with_ids(klass, \ - dai_ptr->drv->type, \ - dai_ptr->index, \ - format, ##__VA_ARGS__) - /* dai tracing */ #define trace_dai_get_id(dai_p) ((dai_p)->drv->type) #define trace_dai_get_subid(dai_p) ((dai_p)->index) From f25f051c971b171ab26eb3c8dedefce9e2f84075 Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Wed, 12 Feb 2020 15:26:22 +0100 Subject: [PATCH 08/10] ssp: trace: switch to new trace macros Signed-off-by: Marcin Maka --- src/drivers/intel/baytrail/ssp.c | 47 +++++------ src/drivers/intel/cavs/ssp.c | 138 ++++++++++++++----------------- src/drivers/intel/haswell/ssp.c | 53 +++++------- src/include/sof/drivers/ssp.h | 9 -- 4 files changed, 101 insertions(+), 146 deletions(-) diff --git a/src/drivers/intel/baytrail/ssp.c b/src/drivers/intel/baytrail/ssp.c index 72498e02c69f..7431ce4391cf 100644 --- a/src/drivers/intel/baytrail/ssp.c +++ b/src/drivers/intel/baytrail/ssp.c @@ -100,13 +100,12 @@ static int ssp_set_config(struct dai *dai, /* is playback/capture already running */ if (ssp->state[DAI_DIR_PLAYBACK] == COMP_STATE_ACTIVE || ssp->state[DAI_DIR_CAPTURE] == COMP_STATE_ACTIVE) { - trace_ssp_error("ssp_set_config(): " - "playback/capture already running"); + dai_err(dai, "ssp_set_config(): playback/capture already running"); ret = -EINVAL; goto out; } - trace_ssp("ssp_set_config(), config->format = %d", config->format); + dai_info(dai, "ssp_set_config(), config->format = %d", config->format); /* reset SSP settings */ /* sscr0 dynamic settings are DSS, EDSS, SCR, FRDC, ECS */ @@ -212,8 +211,7 @@ static int ssp_set_config(struct dai *dai, cbs = true; break; default: - trace_ssp_error("ssp_set_config() error: " - "format & MASTER_MASK EINVAL"); + dai_err(dai, "ssp_set_config() error: format & MASTER_MASK EINVAL"); ret = -EINVAL; goto out; } @@ -233,8 +231,7 @@ static int ssp_set_config(struct dai *dai, sspsp |= SSPSP_SCMODE(2); break; default: - trace_ssp_error("ssp_set_config() error: " - "format & INV_MASK EINVAL"); + dai_err(dai, "ssp_set_config() error: format & INV_MASK EINVAL"); ret = -EINVAL; goto out; } @@ -257,33 +254,32 @@ static int ssp_set_config(struct dai *dai, /* Checks for quirks that were requested but are not supported. */ if (ssp->params.quirks & SOF_DAI_INTEL_SSP_QUIRK_SMTATF) { - trace_ssp_error("SMTATF is not supported"); + dai_err(dai, "SMTATF is not supported"); ret = -EINVAL; goto out; } if (ssp->params.quirks & SOF_DAI_INTEL_SSP_QUIRK_MMRATF) { - trace_ssp_error("MMRATF is not supported"); + dai_err(dai, "MMRATF is not supported"); ret = -EINVAL; goto out; } if (ssp->params.quirks & SOF_DAI_INTEL_SSP_QUIRK_PSPSTWFDFD) { - trace_ssp_error("PSPSTWFDFD is not supported"); + dai_err(dai, "PSPSTWFDFD is not supported"); ret = -EINVAL; goto out; } if (ssp->params.quirks & SOF_DAI_INTEL_SSP_QUIRK_PSPSRWFDFD) { - trace_ssp_error("PSPSRWFDFD is not supported"); + dai_err(dai, "PSPSRWFDFD is not supported"); ret = -EINVAL; goto out; } /* BCLK is generated from MCLK - must be divisable */ if (config->ssp.mclk_rate % config->ssp.bclk_rate) { - trace_ssp_error("ssp_set_config() error: " - "MCLK is not divisable"); + dai_err(dai, "ssp_set_config() error: MCLK is not divisable"); ret = -EINVAL; goto out; } @@ -291,8 +287,7 @@ static int ssp_set_config(struct dai *dai, /* divisor must be within SCR range */ mdiv = (config->ssp.mclk_rate / config->ssp.bclk_rate) - 1; if (mdiv > (SSCR0_SCR_MASK >> 8)) { - trace_ssp_error("ssp_set_config() error: " - "divisor is not within SCR range"); + dai_err(dai, "ssp_set_config() error: divisor is not within SCR range"); ret = -EINVAL; goto out; } @@ -302,8 +297,7 @@ static int ssp_set_config(struct dai *dai, /* calc frame width based on BCLK and rate - must be divisable */ if (config->ssp.bclk_rate % config->ssp.fsync_rate) { - trace_ssp_error("ssp_set_config() error: " - "BLCK is not divisable"); + dai_err(dai, "ssp_set_config() error: BLCK is not divisable"); ret = -EINVAL; goto out; } @@ -312,14 +306,14 @@ static int ssp_set_config(struct dai *dai, bdiv = config->ssp.bclk_rate / config->ssp.fsync_rate; if (bdiv < config->ssp.tdm_slot_width * config->ssp.tdm_slots) { - trace_ssp_error("ssp_set_config() error: not enough BCLKs"); + dai_err(dai, "ssp_set_config() error: not enough BCLKs"); ret = -EINVAL; goto out; } /* tdm_slot_width must be <= 38 for SSP */ if (config->ssp.tdm_slot_width > 38) { - trace_ssp_error("ssp_set_config() error: tdm_slot_width > 38"); + dai_err(dai, "ssp_set_config() error: tdm_slot_width > 38"); ret = -EINVAL; goto out; } @@ -442,8 +436,7 @@ static int ssp_set_config(struct dai *dai, break; default: - trace_ssp_error("ssp_set_config() error: " - "format & FORMAT_MASK EINVAL"); + dai_err(dai, "ssp_set_config() error: format & FORMAT_MASK EINVAL"); ret = -EINVAL; goto out; } @@ -479,7 +472,7 @@ static int ssp_set_config(struct dai *dai, ssp->state[DAI_DIR_PLAYBACK] = COMP_STATE_PREPARE; ssp->state[DAI_DIR_CAPTURE] = COMP_STATE_PREPARE; - trace_ssp("ssp_set_config(), done"); + dai_info(dai, "ssp_set_config(), done"); out: spin_unlock(&dai->lock); @@ -498,7 +491,7 @@ static void ssp_start(struct dai *dai, int direction) ssp_update_bits(dai, SSCR0, SSCR0_SSE, SSCR0_SSE); ssp->state[direction] = COMP_STATE_ACTIVE; - trace_ssp("ssp_start()"); + dai_info(dai, "ssp_start()"); /* enable DMA */ if (direction == DAI_DIR_PLAYBACK) @@ -522,7 +515,7 @@ static void ssp_stop(struct dai *dai, int direction) ssp_update_bits(dai, SSCR1, SSCR1_RSRE, 0); ssp_empty_rx_fifo(dai); ssp->state[SOF_IPC_STREAM_CAPTURE] = COMP_STATE_PAUSED; - trace_ssp("ssp_stop(), RX stop"); + dai_info(dai, "ssp_stop(), RX stop"); } /* stop Tx if needed */ @@ -530,7 +523,7 @@ static void ssp_stop(struct dai *dai, int direction) ssp->state[SOF_IPC_STREAM_PLAYBACK] == COMP_STATE_ACTIVE) { ssp_update_bits(dai, SSCR1, SSCR1_TSRE, 0); ssp->state[SOF_IPC_STREAM_PLAYBACK] = COMP_STATE_PAUSED; - trace_ssp("ssp_stop(), TX stop"); + dai_info(dai, "ssp_stop(), TX stop"); } /* disable SSP port if no users */ @@ -539,7 +532,7 @@ static void ssp_stop(struct dai *dai, int direction) ssp_update_bits(dai, SSCR0, SSCR0_SSE, 0); ssp->state[SOF_IPC_STREAM_CAPTURE] = COMP_STATE_PREPARE; ssp->state[SOF_IPC_STREAM_PLAYBACK] = COMP_STATE_PREPARE; - trace_ssp("ssp_stop(), SSP port disabled"); + dai_info(dai, "ssp_stop(), SSP port disabled"); } spin_unlock(&dai->lock); @@ -549,7 +542,7 @@ static int ssp_trigger(struct dai *dai, int cmd, int direction) { struct ssp_pdata *ssp = dai_get_drvdata(dai); - trace_ssp("ssp_trigger()"); + dai_info(dai, "ssp_trigger()"); switch (cmd) { case COMP_TRIGGER_START: diff --git a/src/drivers/intel/cavs/ssp.c b/src/drivers/intel/cavs/ssp.c index 2995c1a42500..abaa4165c6a7 100644 --- a/src/drivers/intel/cavs/ssp.c +++ b/src/drivers/intel/cavs/ssp.c @@ -131,13 +131,13 @@ static int ssp_set_config(struct dai *dai, /* is playback/capture already running */ if (ssp->state[DAI_DIR_PLAYBACK] == COMP_STATE_ACTIVE || ssp->state[DAI_DIR_CAPTURE] == COMP_STATE_ACTIVE) { - trace_ssp_error("ssp_set_config() error: " - "playback/capture already running"); + dai_info(dai, "ssp_set_config() error: playback/capture already running"); ret = -EINVAL; goto out; } - trace_ssp("ssp_set_config(), config->format = 0x%4x", config->format); + dai_info(dai, "ssp_set_config(), config->format = 0x%4x", + config->format); /* reset SSP settings */ /* sscr0 dynamic settings are DSS, EDSS, SCR, FRDC, ECS */ @@ -196,8 +196,7 @@ static int ssp_set_config(struct dai *dai, /* FIXME: this mode has not been tested */ break; default: - trace_ssp_error("ssp_set_config() error: " - "format & MASTER_MASK EINVAL"); + dai_err(dai, "ssp_set_config() error: format & MASTER_MASK EINVAL"); ret = -EINVAL; goto out; } @@ -217,8 +216,7 @@ static int ssp_set_config(struct dai *dai, inverted_bclk = true; /* handled later with bclk idle */ break; default: - trace_ssp_error("ssp_set_config() error: " - "format & INV_MASK EINVAL"); + dai_err(dai, "ssp_set_config() error: format & INV_MASK EINVAL"); ret = -EINVAL; goto out; } @@ -277,19 +275,17 @@ static int ssp_set_config(struct dai *dai, if (!config->ssp.mclk_rate || config->ssp.mclk_rate > ssp_freq[MAX_SSP_FREQ_INDEX].freq) { - trace_ssp_error("ssp_set_config() error: " - "invalid MCLK = %d Hz (valid < %d)", - config->ssp.mclk_rate, - ssp_freq[MAX_SSP_FREQ_INDEX].freq); + dai_err(dai, "ssp_set_config() error: invalid MCLK = %d Hz (valid < %d)", + config->ssp.mclk_rate, + ssp_freq[MAX_SSP_FREQ_INDEX].freq); ret = -EINVAL; goto out; } if (!config->ssp.bclk_rate || config->ssp.bclk_rate > config->ssp.mclk_rate) { - trace_ssp_error("ssp_set_config() error: " - "BCLK %d Hz = 0 or > MCLK %d Hz", - config->ssp.bclk_rate, config->ssp.mclk_rate); + dai_err(dai, "ssp_set_config() error: BCLK %d Hz = 0 or > MCLK %d Hz", + config->ssp.bclk_rate, config->ssp.mclk_rate); ret = -EINVAL; goto out; } @@ -297,8 +293,8 @@ static int ssp_set_config(struct dai *dai, /* MCLK config */ ret = mn_set_mclk(config->ssp.mclk_id, config->ssp.mclk_rate); if (ret < 0) { - trace_ssp_error("error: invalid mclk_rate = %d for mclk_id = %d", - config->ssp.mclk_id, config->ssp.mclk_rate); + dai_err(dai, "error: invalid mclk_rate = %d for mclk_id = %d", + config->ssp.mclk_id, config->ssp.mclk_rate); goto out; } @@ -306,8 +302,8 @@ static int ssp_set_config(struct dai *dai, ret = mn_set_bclk(config->dai_index, config->ssp.bclk_rate, &mdiv, &need_ecs); if (ret < 0) { - trace_ssp_error("error: invalid bclk_rate = %d for dai_index = %d", - config->ssp.bclk_rate, config->dai_index); + dai_err(dai, "error: invalid bclk_rate = %d for dai_index = %d", + config->ssp.bclk_rate, config->dai_index); goto out; } @@ -319,8 +315,8 @@ static int ssp_set_config(struct dai *dai, /* divisor must be within SCR range */ if (mdiv > (SSCR0_SCR_MASK >> 8)) { - trace_ssp_error("ssp_set_config() error: " - "divisor %d is not within SCR range", mdiv); + dai_err(dai, "ssp_set_config() error: divisor %d is not within SCR range", + mdiv); ret = -EINVAL; goto out; } @@ -330,9 +326,8 @@ static int ssp_set_config(struct dai *dai, /* calc frame width based on BCLK and rate - must be divisable */ if (config->ssp.bclk_rate % config->ssp.fsync_rate) { - trace_ssp_error("ssp_set_config() error: " - "BCLK %d is not divisable by rate %d", - config->ssp.bclk_rate, config->ssp.fsync_rate); + dai_err(dai, "ssp_set_config() error: BCLK %d is not divisable by rate %d", + config->ssp.bclk_rate, config->ssp.fsync_rate); ret = -EINVAL; goto out; } @@ -340,17 +335,17 @@ static int ssp_set_config(struct dai *dai, /* must be enough BCLKs for data */ bdiv = config->ssp.bclk_rate / config->ssp.fsync_rate; if (bdiv < config->ssp.tdm_slot_width * config->ssp.tdm_slots) { - trace_ssp_error("ssp_set_config() error: not enough BCLKs " - "need %d", config->ssp.tdm_slot_width * - config->ssp.tdm_slots); + dai_err(dai, "ssp_set_config() error: not enough BCLKs need %d", + config->ssp.tdm_slot_width * + config->ssp.tdm_slots); ret = -EINVAL; goto out; } /* tdm_slot_width must be <= 38 for SSP */ if (config->ssp.tdm_slot_width > 38) { - trace_ssp_error("ssp_set_config() error: tdm_slot_width %d > " - "38", config->ssp.tdm_slot_width); + dai_err(dai, "ssp_set_config() error: tdm_slot_width %d > 38", + config->ssp.tdm_slot_width); ret = -EINVAL; goto out; } @@ -359,16 +354,16 @@ static int ssp_set_config(struct dai *dai, (config->ssp.tdm_per_slot_padding_flag ? config->ssp.tdm_slot_width : config->ssp.sample_valid_bits); if (bdiv < bdiv_min) { - trace_ssp_error("ssp_set_config() error: bdiv(%d) < " - "bdiv_min(%d)", bdiv, bdiv_min); + dai_err(dai, "ssp_set_config() error: bdiv(%d) < bdiv_min(%d)", + bdiv, bdiv_min); ret = -EINVAL; goto out; } frame_end_padding = bdiv - bdiv_min; if (frame_end_padding > SSPSP2_FEP_MASK) { - trace_ssp_error("ssp_set_config() error: frame_end_padding " - "too big: %u", frame_end_padding); + dai_err(dai, "ssp_set_config() error: frame_end_padding too big: %u", + frame_end_padding); ret = -EINVAL; goto out; } @@ -382,8 +377,8 @@ static int ssp_set_config(struct dai *dai, sscr0 |= SSCR0_FRDC(config->ssp.tdm_slots); if (bdiv % 2) { - trace_ssp_error("ssp_set_config() error: " - "bdiv %d is not divisible by 2", bdiv); + dai_err(dai, "ssp_set_config() error: bdiv %d is not divisible by 2", + bdiv); ret = -EINVAL; goto out; } @@ -404,10 +399,8 @@ static int ssp_set_config(struct dai *dai, * of each slot */ if (frame_end_padding % 2) { - trace_ssp_error("ssp_set_config() error: " - "frame_end_padding %d " - "is not divisible by 2", - frame_end_padding); + dai_err(dai, "ssp_set_config() error: frame_end_padding %d is not divisible by 2", + frame_end_padding); ret = -EINVAL; goto out; } @@ -416,9 +409,8 @@ static int ssp_set_config(struct dai *dai, if (slot_end_padding > SOF_DAI_INTEL_SSP_SLOT_PADDING_MAX) { /* too big padding */ - trace_ssp_error("ssp_set_config() error: " - "slot_end_padding > %d", - SOF_DAI_INTEL_SSP_SLOT_PADDING_MAX); + dai_err(dai, "ssp_set_config() error: slot_end_padding > %d", + SOF_DAI_INTEL_SSP_SLOT_PADDING_MAX); ret = -EINVAL; goto out; } @@ -439,8 +431,8 @@ static int ssp_set_config(struct dai *dai, sscr2 &= ~SSCR2_LJDFD; if (bdiv % 2) { - trace_ssp_error("ssp_set_config() error: " - "bdiv %d is not divisible by 2", bdiv); + dai_err(dai, "ssp_set_config() error: bdiv %d is not divisible by 2", + bdiv); ret = -EINVAL; goto out; } @@ -461,10 +453,8 @@ static int ssp_set_config(struct dai *dai, * of each slot */ if (frame_end_padding % 2) { - trace_ssp_error("ssp_set_config() error: " - "frame_end_padding %d " - "is not divisible by 2", - frame_end_padding); + dai_err(dai, "ssp_set_config() error: frame_end_padding %d is not divisible by 2", + frame_end_padding); ret = -EINVAL; goto out; } @@ -473,9 +463,8 @@ static int ssp_set_config(struct dai *dai, if (slot_end_padding > 15) { /* can't handle padding over 15 bits */ - trace_ssp_error("ssp_set_config() error: " - "slot_end_padding %d > 15 bits", - slot_end_padding); + dai_err(dai, "ssp_set_config() error: slot_end_padding %d > 15 bits", + slot_end_padding); ret = -EINVAL; goto out; } @@ -509,9 +498,7 @@ static int ssp_set_config(struct dai *dai, /* frame_pulse_width must less or equal 38 */ if (ssp->params.frame_pulse_width > SOF_DAI_INTEL_SSP_FRAME_PULSE_WIDTH_MAX) { - trace_ssp_error - ("ssp_set_config() error: " - "frame_pulse_width > %d", + dai_err(dai, "ssp_set_config() error: frame_pulse_width > %d", SOF_DAI_INTEL_SSP_FRAME_PULSE_WIDTH_MAX); ret = -EINVAL; goto out; @@ -541,9 +528,7 @@ static int ssp_set_config(struct dai *dai, if (slot_end_padding > SOF_DAI_INTEL_SSP_SLOT_PADDING_MAX) { - trace_ssp_error - ("ssp_set_config() error: " - "slot_end_padding > %d", + dai_err(dai, "ssp_set_config() error: slot_end_padding > %d", SOF_DAI_INTEL_SSP_SLOT_PADDING_MAX); ret = -EINVAL; goto out; @@ -560,8 +545,8 @@ static int ssp_set_config(struct dai *dai, break; default: - trace_ssp_error("ssp_set_config() error: " - "invalid format 0x%04x", config->format); + dai_err(dai, "ssp_set_config() error: invalid format 0x%04x", + config->format); ret = -EINVAL; goto out; } @@ -590,9 +575,8 @@ static int ssp_set_config(struct dai *dai, sample_width = 4; break; default: - trace_ssp_error("ssp_set_config() error: " - "sample_valid_bits %d", - config->ssp.sample_valid_bits); + dai_err(dai, "ssp_set_config() error: sample_valid_bits %d", + config->ssp.sample_valid_bits); ret = -EINVAL; goto out; } @@ -615,13 +599,12 @@ static int ssp_set_config(struct dai *dai, ssp_write(dai, SSTSA, sstsa); ssp_write(dai, SSRSA, ssrsa); - trace_ssp("ssp_set_config(), sscr0 = 0x%08x, sscr1 = 0x%08x, " - "ssto = 0x%08x, sspsp = 0x%0x", sscr0, sscr1, ssto, sspsp); - trace_ssp("ssp_set_config(), sscr2 = 0x%08x, sspsp2 = 0x%08x, " - "sscr3 = 0x%08x, ssioc = 0x%08x", sscr2, sspsp2, sscr3, - ssioc); - trace_ssp("ssp_set_config(), ssrsa = 0x%08x, sstsa = 0x%08x", ssrsa, - sstsa); + dai_info(dai, "ssp_set_config(), sscr0 = 0x%08x, sscr1 = 0x%08x, ssto = 0x%08x, sspsp = 0x%0x", + sscr0, sscr1, ssto, sspsp); + dai_info(dai, "ssp_set_config(), sscr2 = 0x%08x, sspsp2 = 0x%08x, sscr3 = 0x%08x, ssioc = 0x%08x", + sscr2, sspsp2, sscr3, ssioc); + dai_info(dai, "ssp_set_config(), ssrsa = 0x%08x, sstsa = 0x%08x", + ssrsa, sstsa); ssp->state[DAI_DIR_PLAYBACK] = COMP_STATE_PREPARE; ssp->state[DAI_DIR_CAPTURE] = COMP_STATE_PREPARE; @@ -645,7 +628,7 @@ static void ssp_start(struct dai *dai, int direction) ssp_update_bits(dai, SSCR0, SSCR0_SSE, SSCR0_SSE); ssp->state[direction] = COMP_STATE_ACTIVE; - trace_ssp("ssp_start()"); + dai_info(dai, "ssp_start()"); if (ssp->params.bclk_delay) { /* drive BCLK early for guaranteed time, @@ -687,7 +670,7 @@ static void ssp_stop(struct dai *dai, int direction) ssp_update_bits(dai, SSRSA, 0x1 << 8, 0x0 << 8); ssp_empty_rx_fifo(dai); ssp->state[SOF_IPC_STREAM_CAPTURE] = COMP_STATE_PAUSED; - trace_ssp("ssp_stop(), RX stop"); + dai_info(dai, "ssp_stop(), RX stop"); } /* stop Tx if needed */ @@ -697,7 +680,7 @@ static void ssp_stop(struct dai *dai, int direction) ssp_update_bits(dai, SSCR1, SSCR1_TSRE, 0); ssp_update_bits(dai, SSTSA, 0x1 << 8, 0x0 << 8); ssp->state[SOF_IPC_STREAM_PLAYBACK] = COMP_STATE_PAUSED; - trace_ssp("ssp_stop(), TX stop"); + dai_info(dai, "ssp_stop(), TX stop"); } /* disable SSP port if no users */ @@ -706,7 +689,7 @@ static void ssp_stop(struct dai *dai, int direction) ssp_update_bits(dai, SSCR0, SSCR0_SSE, 0); ssp->state[SOF_IPC_STREAM_CAPTURE] = COMP_STATE_PREPARE; ssp->state[SOF_IPC_STREAM_PLAYBACK] = COMP_STATE_PREPARE; - trace_ssp("ssp_stop(), SSP port disabled"); + dai_info(dai, "ssp_stop(), SSP port disabled"); } spin_unlock(&dai->lock); @@ -716,7 +699,7 @@ static int ssp_trigger(struct dai *dai, int cmd, int direction) { struct ssp_pdata *ssp = dai_get_drvdata(dai); - trace_ssp("ssp_trigger() cmd %d", cmd); + dai_info(dai, "ssp_trigger() cmd %d", cmd); switch (cmd) { case COMP_TRIGGER_START: @@ -759,8 +742,7 @@ static int ssp_probe(struct dai *dai) ssp = rzalloc(SOF_MEM_ZONE_SYS_RUNTIME, SOF_MEM_FLAG_SHARED, SOF_MEM_CAPS_RAM, sizeof(*ssp)); if (!ssp) { - trace_error(TRACE_CLASS_DAI, "ssp_probe() error: " - "alloc failed"); + dai_err(dai, "ssp_probe() error: alloc failed"); return -ENOMEM; } dai_set_drvdata(dai, ssp); @@ -883,12 +865,12 @@ static int ssp_ts_config(struct dai *dai, struct timestamp_cfg *cfg) int i; if (cfg->type != SOF_DAI_INTEL_SSP) { - trace_ssp_error("ssp_ts_config(): Illegal DAI type"); + dai_err(dai, "ssp_ts_config(): Illegal DAI type"); return -EINVAL; } if (cfg->index > DAI_NUM_SSP_BASE + DAI_NUM_SSP_EXT - 1) { - trace_ssp_error("ssp_ts_config(): Illegal DAI index"); + dai_err(dai, "ssp_ts_config(): Illegal DAI index"); return -EINVAL; } @@ -899,7 +881,7 @@ static int ssp_ts_config(struct dai *dai, struct timestamp_cfg *cfg) } if (!cfg->walclk_rate) { - trace_ssp_error("ssp_ts_config(): No XTAL frequency defined"); + dai_err(dai, "ssp_ts_config(): No XTAL frequency defined"); return -EINVAL; } diff --git a/src/drivers/intel/haswell/ssp.c b/src/drivers/intel/haswell/ssp.c index 98b64e9a7ab0..297b7155ed20 100644 --- a/src/drivers/intel/haswell/ssp.c +++ b/src/drivers/intel/haswell/ssp.c @@ -76,13 +76,12 @@ static int ssp_set_config(struct dai *dai, /* is playback/capture already running */ if (ssp->state[DAI_DIR_PLAYBACK] == COMP_STATE_ACTIVE || ssp->state[DAI_DIR_CAPTURE] == COMP_STATE_ACTIVE) { - trace_ssp_error("ssp_set_config() error: " - "playback/capture already running"); + dai_err(dai, "ssp_set_config() error: playback/capture already running"); ret = -EINVAL; goto out; } - trace_ssp("ssp_set_config()"); + dai_info(dai, "ssp_set_config()"); /* disable clock */ shim_update_bits(SHIM_CLKCTL, SHIM_CLKCTL_EN_SSP(dai->index), 0); @@ -129,8 +128,7 @@ static int ssp_set_config(struct dai *dai, sscr1 |= SSCR1_SFRMDIR; break; default: - trace_ssp_error("ssp_set_config() error: " - "format & MASTER_MASK EINVAL"); + dai_err(dai, "ssp_set_config() error: format & MASTER_MASK EINVAL"); ret = -EINVAL; goto out; } @@ -150,8 +148,7 @@ static int ssp_set_config(struct dai *dai, sspsp |= SSPSP_SCMODE(2); break; default: - trace_ssp_error("ssp_set_config() error: " - "format & INV_MASK EINVAL"); + dai_err(dai, "ssp_set_config() error: format & INV_MASK EINVAL"); ret = -EINVAL; goto out; } @@ -198,8 +195,7 @@ static int ssp_set_config(struct dai *dai, /* BCLK is generated from MCLK - must be divisable */ if (config->ssp.mclk_rate % config->ssp.bclk_rate) { - trace_ssp_error("ssp_set_config() error: " - "MCLK is not divisable"); + dai_err(dai, "ssp_set_config() error: MCLK is not divisable"); ret = -EINVAL; goto out; } @@ -207,8 +203,7 @@ static int ssp_set_config(struct dai *dai, /* divisor must be within SCR range */ mdiv = (config->ssp.mclk_rate / config->ssp.bclk_rate) - 1; if (mdiv > (SSCR0_SCR_MASK >> 8)) { - trace_ssp_error("ssp_set_config() error: " - "divisor is not within SCR range"); + dai_err(dai, "ssp_set_config() error: divisor is not within SCR range"); ret = -EINVAL; goto out; } @@ -218,8 +213,7 @@ static int ssp_set_config(struct dai *dai, /* calc frame width based on BCLK and rate - must be divisable */ if (config->ssp.bclk_rate % config->ssp.fsync_rate) { - trace_ssp_error("ssp_set_config() error: " - "BLCK is not divisable"); + dai_err(dai, "ssp_set_config() error: BLCK is not divisable"); ret = -EINVAL; goto out; } @@ -228,29 +222,28 @@ static int ssp_set_config(struct dai *dai, bdiv = config->ssp.bclk_rate / config->ssp.fsync_rate; if (bdiv < config->ssp.tdm_slot_width * config->ssp.tdm_slots) { - trace_ssp_error("ssp_set_config() error: not enough BCLKs"); + dai_err(dai, "ssp_set_config() error: not enough BCLKs"); ret = -EINVAL; goto out; } /* tdm_slot_width must be <= 38 for SSP */ if (config->ssp.tdm_slot_width > 38) { - trace_ssp_error("ssp_set_config() error: tdm_slot_width > 38"); + dai_err(dai, "ssp_set_config() error: tdm_slot_width > 38"); ret = -EINVAL; goto out; } bdiv_min = config->ssp.tdm_slots * config->ssp.sample_valid_bits; if (bdiv < bdiv_min) { - trace_ssp_error("ssp_set_config() error: bdiv < bdiv_min"); + dai_err(dai, "ssp_set_config() error: bdiv < bdiv_min"); ret = -EINVAL; goto out; } frame_end_padding = bdiv - bdiv_min; if (frame_end_padding > SSPSP2_FEP_MASK) { - trace_ssp_error("ssp_set_config() error: " - "frame_end_padding > SSPSP2_FEP_MASK"); + dai_err(dai, "ssp_set_config() error: frame_end_padding > SSPSP2_FEP_MASK"); ret = -EINVAL; goto out; } @@ -288,8 +281,7 @@ static int ssp_set_config(struct dai *dai, sscr0 |= SSCR0_FRDC(config->ssp.tdm_slots); if (bdiv % 2) { - trace_ssp_error("ssp_set_config() error: " - "bdiv is not divisible by 2"); + dai_err(dai, "ssp_set_config() error: bdiv is not divisible by 2"); ret = -EINVAL; goto out; } @@ -302,9 +294,7 @@ static int ssp_set_config(struct dai *dai, * of each slot */ if (frame_end_padding % 2) { - trace_ssp_error("ssp_set_config() error: " - "frame_end_padding " - "is not divisible by 2"); + dai_err(dai, "ssp_set_config() error: frame_end_padding is not divisible by 2"); ret = -EINVAL; goto out; } @@ -313,8 +303,7 @@ static int ssp_set_config(struct dai *dai, if (slot_end_padding > 15) { /* can't handle padding over 15 bits */ - trace_ssp_error("ssp_set_config() error: " - "slot_end_padding over 15 bits"); + dai_err(dai, "ssp_set_config() error: slot_end_padding over 15 bits"); ret = -EINVAL; goto out; } @@ -353,7 +342,7 @@ static int ssp_set_config(struct dai *dai, break; default: - trace_ssp_error("ssp_set_config() error: invalid format"); + dai_err(dai, "ssp_set_config() error: invalid format"); ret = -EINVAL; goto out; } @@ -391,7 +380,7 @@ static int ssp_set_config(struct dai *dai, ssp_update_bits(dai, SSCR0, SSCR0_SSE, SSCR0_SSE); ssp_update_bits(dai, SSCR0, SSCR0_SSE, 0); - trace_ssp("ssp_set_config(), done"); + dai_info(dai, "ssp_set_config(), done"); out: spin_unlock(&dai->lock); @@ -406,7 +395,7 @@ static void ssp_start(struct dai *dai, int direction) spin_lock(&dai->lock); - trace_ssp("ssp_start()"); + dai_info(dai, "ssp_start()"); /* enable DMA */ if (direction == DAI_DIR_PLAYBACK) { @@ -442,7 +431,7 @@ static void ssp_stop(struct dai *dai, int direction) ssp_update_bits(dai, SSCR1, SSCR1_RSRE, 0); ssp_update_bits(dai, SSCR0, SSCR0_RIM, SSCR0_RIM); ssp->state[SOF_IPC_STREAM_CAPTURE] = COMP_STATE_PAUSED; - trace_ssp("ssp_stop(), RX stop"); + dai_info(dai, "ssp_stop(), RX stop"); } /* stop Tx if needed */ @@ -451,7 +440,7 @@ static void ssp_stop(struct dai *dai, int direction) ssp_update_bits(dai, SSCR1, SSCR1_TSRE, 0); ssp_update_bits(dai, SSCR0, SSCR0_TIM, SSCR0_TIM); ssp->state[SOF_IPC_STREAM_PLAYBACK] = COMP_STATE_PAUSED; - trace_ssp("ssp_stop(), TX stop"); + dai_info(dai, "ssp_stop(), TX stop"); } /* disable SSP port if no users */ @@ -460,7 +449,7 @@ static void ssp_stop(struct dai *dai, int direction) ssp_update_bits(dai, SSCR0, SSCR0_SSE, 0); ssp->state[SOF_IPC_STREAM_CAPTURE] = COMP_STATE_PREPARE; ssp->state[SOF_IPC_STREAM_PLAYBACK] = COMP_STATE_PREPARE; - trace_ssp("ssp_stop(), SSP port disabled"); + dai_info(dai, "ssp_stop(), SSP port disabled"); } spin_unlock(&dai->lock); @@ -470,7 +459,7 @@ static int ssp_trigger(struct dai *dai, int cmd, int direction) { struct ssp_pdata *ssp = dai_get_drvdata(dai); - trace_ssp("ssp_trigger()"); + dai_info(dai, "ssp_trigger()"); switch (cmd) { case COMP_TRIGGER_START: diff --git a/src/include/sof/drivers/ssp.h b/src/include/sof/drivers/ssp.h index c2b90dadb472..fee409fc77fe 100644 --- a/src/include/sof/drivers/ssp.h +++ b/src/include/sof/drivers/ssp.h @@ -216,15 +216,6 @@ extern const struct dai_driver ssp_driver; #endif -/* tracing */ -#define trace_ssp(__e, ...) \ - trace_event(TRACE_CLASS_SSP, __e, ##__VA_ARGS__) -#define trace_ssp_error(__e, ...) \ - trace_error(TRACE_CLASS_SSP, __e, ##__VA_ARGS__) -#define tracev_ssp(__e, ...) \ - tracev_event(TRACE_CLASS_SSP, __e, ##__VA_ARGS__) - - #define ssp_irq(ssp) \ ssp->plat_data.irq From 8527249595e47164ead4ae45f3b178804b7dc8d0 Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Wed, 12 Feb 2020 18:08:29 +0100 Subject: [PATCH 09/10] alh: trace: switch to new trace macros Signed-off-by: Marcin Maka --- src/drivers/intel/cavs/alh.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/drivers/intel/cavs/alh.c b/src/drivers/intel/cavs/alh.c index ea127cccef47..24eb373ef42c 100644 --- a/src/drivers/intel/cavs/alh.c +++ b/src/drivers/intel/cavs/alh.c @@ -15,21 +15,16 @@ #include #include -#define trace_alh(__e, ...) trace_event(TRACE_CLASS_ALH, __e, ##__VA_ARGS__) -#define trace_alh_error(__e, ...) \ - trace_error(TRACE_CLASS_ALH, __e, ##__VA_ARGS__) -#define tracev_alh(__e, ...) tracev_event(TRACE_CLASS_ALH, __e, ##__VA_ARGS__) - static int alh_trigger(struct dai *dai, int cmd, int direction) { - trace_alh("alh_trigger() cmd %d", cmd); + dai_info(dai, "alh_trigger() cmd %d", cmd); return 0; } static int alh_set_config(struct dai *dai, struct sof_ipc_dai_config *config) { - trace_alh("alh_set_config() config->format = 0x%4x", + dai_info(dai, "alh_set_config() config->format = 0x%4x", config->format); return 0; @@ -37,28 +32,28 @@ static int alh_set_config(struct dai *dai, struct sof_ipc_dai_config *config) static int alh_context_store(struct dai *dai) { - trace_alh("alh_context_store()"); + dai_info(dai, "alh_context_store()"); return 0; } static int alh_context_restore(struct dai *dai) { - trace_alh("alh_context_restore()"); + dai_info(dai, "alh_context_restore()"); return 0; } static int alh_probe(struct dai *dai) { - trace_alh("alh_probe()"); + dai_info(dai, "alh_probe()"); return 0; } static int alh_remove(struct dai *dai) { - trace_alh("alh_remove()"); + dai_info(dai, "alh_remove()"); return 0; } @@ -66,7 +61,7 @@ static int alh_remove(struct dai *dai) static int alh_get_handshake(struct dai *dai, int direction, int stream_id) { if (stream_id >= ARRAY_SIZE(alh_handshake_map)) { - trace_alh_error("alh_get_handshake() error: " + dai_err(dai, "alh_get_handshake() error: " "stream_id %d out of range", stream_id); return -1; From a8e3d024d7a85e4ef74ca8df66c45fd02d7d66dd Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Wed, 12 Feb 2020 18:20:25 +0100 Subject: [PATCH 10/10] hda: trace: switch to new trace macros Signed-off-by: Marcin Maka --- src/drivers/intel/cavs/hda.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/drivers/intel/cavs/hda.c b/src/drivers/intel/cavs/hda.c index 201fba4c785c..918221ebca6f 100644 --- a/src/drivers/intel/cavs/hda.c +++ b/src/drivers/intel/cavs/hda.c @@ -11,12 +11,6 @@ #include #include -/* tracing */ -#define trace_hda(__e, ...) \ - trace_event(TRACE_CLASS_DAI, __e, ##__VA_ARGS__) -#define trace_hda_error(__e, ...) \ - trace_error(TRACE_CLASS_DAI, __e, ##__VA_ARGS__) - static int hda_trigger(struct dai *dai, int cmd, int direction) { return 0; @@ -75,7 +69,7 @@ static int hda_ts_config(struct dai *dai, struct timestamp_cfg *cfg) int i; if (cfg->type != SOF_DAI_INTEL_HDA) { - trace_hda_error("dmic_ts_config(): Illegal DAI type"); + dai_err(dai, "dmic_ts_config(): Illegal DAI type"); return -EINVAL; }