clear-pkgs-linux-iot-lts2018/0238-ASoC-Intel-Skylake-Han...

91 lines
2.8 KiB
Diff

From cf70c42f593a84ea67a979c6a13178776565889c Mon Sep 17 00:00:00 2001
From: "Panwar, Ashish" <ashish.panwar@intel.com>
Date: Wed, 20 Jan 2016 19:19:21 +0530
Subject: [PATCH 238/743] ASoC: Intel: Skylake: Handler for firmware log buffer
status notification
We copy half of the firmware log buffer on this notification. We
figure which half of trace buffer to copy based on the write pointer.
Change-Id: I32d8f47b5eaed3d35b4d2a0761bf4878f0c14d97
Signed-off-by: Panwar, Ashish <ashish.panwar@intel.com>
Reviewed-on:
Reviewed-by: Babu, Ramesh <ramesh.babu@intel.com>
Tested-by: Babu, Ramesh <ramesh.babu@intel.com>
---
sound/soc/intel/skylake/skl-sst-ipc.c | 35 ++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 5234fafb758a..9864801e9ed1 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -19,9 +19,9 @@
#include "skl.h"
#include "skl-sst-dsp.h"
#include "skl-sst-ipc.h"
+#include "skl-fwlog.h"
#include "sound/hdaudio_ext.h"
-
#define IPC_IXC_STATUS_BITS 24
/* Global Message - Generic */
@@ -53,6 +53,10 @@
#define IPC_MSG_DIR(x) (((x) & IPC_MSG_DIR_MASK) \
<< IPC_MSG_DIR_SHIFT)
/* Global Notification Message */
+#define IPC_GLB_NOTIFY_CORE_SHIFT 15
+#define IPC_GLB_NOTIFY_CORE_MASK 0x1
+#define IPC_GLB_NOTIFY_CORE_ID(x) (((x) >> IPC_GLB_NOTIFY_CORE_SHIFT) \
+ & IPC_GLB_NOTIFY_CORE_MASK)
#define IPC_GLB_NOTIFY_TYPE_SHIFT 16
#define IPC_GLB_NOTIFY_TYPE_MASK 0xFF
#define IPC_GLB_NOTIFY_TYPE(x) (((x) >> IPC_GLB_NOTIFY_TYPE_SHIFT) \
@@ -347,6 +351,31 @@ static struct ipc_message *skl_ipc_reply_get_msg(struct sst_generic_ipc *ipc,
}
+static void
+skl_process_log_buffer(struct sst_dsp *sst, struct skl_ipc_header header)
+{
+ int core, size;
+ u32 *ptr, avail;
+ u8 *base;
+
+ core = IPC_GLB_NOTIFY_CORE_ID(header.primary);
+ if (!(BIT(core) & sst->trace_wind.flags)) {
+ dev_err(sst->dev, "Logging is disabled on dsp %d\n", core);
+ return;
+ }
+ skl_dsp_get_log_buff(sst, core);
+ size = sst->trace_wind.size/sst->trace_wind.nr_dsp;
+ base = (u8 *)sst->trace_wind.addr;
+ /* move to the source dsp tracing window */
+ base += (core * size);
+ ptr = (u32 *)sst->trace_wind.dsp_wps[core];
+ avail = *ptr;
+ if (avail < size/2)
+ base += size/2;
+ skl_dsp_write_log(sst, (void __iomem *)base, core, size/2);
+ skl_dsp_put_log_buff(sst, core);
+}
+
int skl_ipc_process_notification(struct sst_generic_ipc *ipc,
struct skl_ipc_header header)
{
@@ -369,6 +398,10 @@ int skl_ipc_process_notification(struct sst_generic_ipc *ipc,
wake_up(&skl->boot_wait);
break;
+ case IPC_GLB_NOTIFY_LOG_BUFFER_STATUS:
+ skl_process_log_buffer(skl->dsp, header);
+ break;
+
case IPC_GLB_NOTIFY_PHRASE_DETECTED:
dev_dbg(ipc->dev, "***** Phrase Detected **********\n");
--
2.19.2