[Sound-open-firmware] [PATCH 2/2] Update trace level status based on received IPC message.

yan.wang at linux.intel.com yan.wang at linux.intel.com
Thu Apr 12 09:46:30 CEST 2018


From: Yan Wang <yan.wang at linux.intel.com>

Need update trace level bit field collection based on IPC messaged
from driver side.

Signed-off-by: Yan Wang <yan.wang at linux.intel.com>
---
Test with:
Mininow max rt5651 and APL UP^2 nocodec and CNL nocodec
SOF master: 949c4339ab8cb10f2edd497a671af989d7ea80f3
SOF-Tool master: 8e8cd884c36e297f5996a7bb4f1e830a0f1ee84c
https://github.com/plbossart/sound/tree/topic/sof-v4.14:
2cd03d26b66f8fee25b8b21ea3f60db11def5b13
---
 src/include/uapi/ipc.h |  8 ++++++++
 src/ipc/handler.c      | 25 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/src/include/uapi/ipc.h b/src/include/uapi/ipc.h
index fbf1c07..a562bf7 100644
--- a/src/include/uapi/ipc.h
+++ b/src/include/uapi/ipc.h
@@ -117,6 +117,7 @@
 /* trace and debug */
 #define SOF_IPC_TRACE_DMA_PARAMS		SOF_CMD_TYPE(0x001)
 #define SOF_IPC_TRACE_DMA_POSITION		SOF_CMD_TYPE(0x002)
+#define SOF_IPC_TRACE_DMA_LEVELS		SOF_CMD_TYPE(0x003)
 
 /* Get message component id */
 #define SOF_IPC_MESSAGE_ID(x)			(x & 0xffff)
@@ -850,6 +851,13 @@ struct sof_ipc_dma_trace_posn {
 	uint32_t messages;	/* total trace messages */
 }  __attribute__((packed));
 
+/* DMA for Trace level info - SOF_IPC_DEBUG_DMA_LEVELS */
+struct sof_ipc_dma_trace_levels {
+	struct sof_ipc_hdr hdr;
+	uint32_t type;
+	uint32_t level;
+}  __attribute__((packed));
+
 /*
  * Architecture specific debug
  */
diff --git a/src/ipc/handler.c b/src/ipc/handler.c
index 6a51765..daab3a9 100644
--- a/src/ipc/handler.c
+++ b/src/ipc/handler.c
@@ -636,6 +636,29 @@ static int ipc_glb_pm_message(uint32_t header)
  * Debug IPC Operations.
  */
 
+static int ipc_dma_trace_levels(uint32_t header)
+{
+	struct sof_ipc_dma_trace_levels *levels = _ipc->comp_data;
+	struct sof_ipc_reply reply;
+	int err;
+
+	err = dma_trace_set_level(_ipc->dmat, levels->type, levels->level);
+	if (err < 0)
+		goto error;
+
+	/* write component values to the outbox */
+	reply.hdr.size = sizeof(reply);
+	reply.hdr.cmd = header;
+	reply.error = 0;
+	mailbox_hostbox_write(0, &reply, sizeof(reply));
+	return 0;
+
+error:
+	if (err < 0)
+		trace_ipc_error("eA!");
+	return -EINVAL;
+}
+
 static int ipc_dma_trace_config(uint32_t header)
 {
 #ifdef CONFIG_HOST_PTABLE
@@ -744,6 +767,8 @@ static int ipc_glb_debug_message(uint32_t header)
 	switch (cmd) {
 	case iCS(SOF_IPC_TRACE_DMA_PARAMS):
 		return ipc_dma_trace_config(header);
+	case iCS(SOF_IPC_TRACE_DMA_LEVELS):
+		return ipc_dma_trace_levels(header);
 	default:
 		trace_ipc_error("eDc");
 		trace_error_value(header);
-- 
2.14.3



More information about the Sound-open-firmware mailing list