From: Yan Wang yan.wang@linux.intel.com
SOF modules include comp_dev, comp_buffer and pipeline. For trace level control based on modules, need add one variable for every module type and set function.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/buffer.c | 1 + src/audio/component.c | 1 + src/audio/pipeline.c | 1 + src/include/sof/audio/buffer.h | 3 +++ src/include/sof/audio/component.h | 3 +++ src/include/sof/audio/pipeline.h | 3 +++ src/include/sof/ipc.h | 5 +++++ src/ipc/ipc.c | 34 ++++++++++++++++++++++++++++++++++ 8 files changed, 51 insertions(+)
diff --git a/src/audio/buffer.c b/src/audio/buffer.c index a4cb3dc..6aeb6a4 100644 --- a/src/audio/buffer.c +++ b/src/audio/buffer.c @@ -83,6 +83,7 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc) buffer->free = buffer->ipc_buffer.size; buffer->avail = 0; buffer->connected = 0; + buffer->trace_level = 1;
spinlock_init(&buffer->lock);
diff --git a/src/audio/component.c b/src/audio/component.c index 319b401..15760b2 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -93,6 +93,7 @@ struct comp_dev *comp_new(struct sof_ipc_comp *comp) /* init component */ memcpy(&cdev->comp, comp, sizeof(*comp)); cdev->drv = drv; + cdev->trace_level = 1; spinlock_init(&cdev->lock); list_init(&cdev->bsource_list); list_init(&cdev->bsink_list); diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 28243fc..0ed6b95 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -256,6 +256,7 @@ struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc, list_init(&p->buffer_list); spinlock_init(&p->lock); memcpy(&p->ipc_pipe, pipe_desc, sizeof(*pipe_desc)); + p->trace_level = 1;
return p; } diff --git a/src/include/sof/audio/buffer.h b/src/include/sof/audio/buffer.h index 9193a78..171f0a4 100644 --- a/src/include/sof/audio/buffer.h +++ b/src/include/sof/audio/buffer.h @@ -61,6 +61,9 @@ struct comp_buffer { void *addr; /* buffer base address */ void *end_addr; /* buffer end address */
+ /* trace level */ + uint32_t trace_level; + /* IPC configuration */ struct sof_ipc_buffer ipc_buffer;
diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 35ed618..80a72d9 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -181,6 +181,9 @@ struct comp_dev { uint32_t frame_bytes; /* frames size copied to sink in bytes */ struct pipeline *pipeline; /* pipeline we belong to */
+ /* trace level */ + uint32_t trace_level; + /* common runtime configuration for downstream/upstream */ struct sof_ipc_stream_params params;
diff --git a/src/include/sof/audio/pipeline.h b/src/include/sof/audio/pipeline.h index 57d2488..1ef53e5 100644 --- a/src/include/sof/audio/pipeline.h +++ b/src/include/sof/audio/pipeline.h @@ -57,6 +57,9 @@ struct pipeline { spinlock_t lock; struct sof_ipc_pipe_new ipc_pipe;
+ /* trace level */ + uint32_t trace_level; + /* runtime status */ int32_t xrun_bytes; /* last xrun length */ uint32_t status; /* pipeline status */ diff --git a/src/include/sof/ipc.h b/src/include/sof/ipc.h index 06425b3..67cf25f 100644 --- a/src/include/sof/ipc.h +++ b/src/include/sof/ipc.h @@ -172,6 +172,11 @@ int ipc_comp_connect(struct ipc *ipc, */ struct ipc_comp_dev *ipc_get_comp(struct ipc *ipc, uint32_t id);
+/* + * Set trace level for component. + */ +int ipc_set_comp_level(struct ipc *ipc, uint32_t id, uint32_t level); + /* * Configure all DAI components attached to DAI. */ diff --git a/src/ipc/ipc.c b/src/ipc/ipc.c index fbb1be6..d613d1f 100644 --- a/src/ipc/ipc.c +++ b/src/ipc/ipc.c @@ -78,6 +78,40 @@ struct ipc_comp_dev *ipc_get_comp(struct ipc *ipc, uint32_t id) return NULL; }
+int ipc_set_comp_level(struct ipc *ipc, uint32_t id, uint32_t level) +{ + struct ipc_comp_dev *icd; + struct list_item *clist; + + list_for_item(clist, &ipc->comp_list) { + icd = container_of(clist, struct ipc_comp_dev, list); + switch (icd->type) { + case COMP_TYPE_COMPONENT: + if (icd->cd->comp.id == id) { + icd->cd->trace_level = level; + return 0; + } + break; + case COMP_TYPE_BUFFER: + if (icd->cb->ipc_buffer.comp.id == id) { + icd->cb->trace_level = level; + return 0; + } + break; + case COMP_TYPE_PIPELINE: + if (icd->pipeline->ipc_pipe.comp_id == id) { + icd->pipeline->trace_level = level; + return 0; + } + break; + default: + break; + } + } + + return -EINVAL; +} + int ipc_get_posn_offset(struct ipc *ipc, struct pipeline *pipe) { int i;