185 lines
5.5 KiB
Diff
185 lines
5.5 KiB
Diff
From 37ef5116432a415c2d7cda3b474923bc2e75b1aa Mon Sep 17 00:00:00 2001
|
|
From: "Paul, Subhankar" <subhankar.paul@intel.com>
|
|
Date: Wed, 31 Aug 2016 03:24:12 +0530
|
|
Subject: [PATCH 347/743] ASoC: Intel: Skylake: Adding support for set system
|
|
time to aDSP
|
|
|
|
In order to calculate the logging timestamps, firmware need the IA
|
|
timestamps reference. A new IPC "SYSTEM TIME" has been added to pass
|
|
UTC time to firmware. Also enable log skl_log_state_msg structure
|
|
for enable log IPC has been modified according to latest firmware
|
|
interface specification document.
|
|
|
|
Change-Id: Ibcfb185c01c70b9b8e5a716849b9c935327594d3
|
|
Signed-off-by: Paul, Subhankar <subhankar.paul@intel.com>
|
|
Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com>
|
|
Reviewed-on:
|
|
Reviewed-by: Jayanti, Satya Charitardha <satya.charitardha.jayanti@intel.com>
|
|
Tested-by: Jayanti, Satya Charitardha <satya.charitardha.jayanti@intel.com>
|
|
Reviewed-on:
|
|
Reviewed-by: audio_build
|
|
Reviewed-by: R, Dharageswari <dharageswari.r@intel.com>
|
|
Reviewed-by: Diwakar, Praveen <praveen.diwakar@intel.com>
|
|
Tested-by: Sm, Bhadur A <bhadur.a.sm@intel.com>
|
|
---
|
|
sound/soc/intel/skylake/skl-messages.c | 32 +++++++++++++++++
|
|
sound/soc/intel/skylake/skl-pcm.c | 6 ++++
|
|
sound/soc/intel/skylake/skl-sst-ipc.h | 49 +++++++++++++++++++++++++-
|
|
3 files changed, 86 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
|
|
index 31384afe42b3..dc648b7db934 100644
|
|
--- a/sound/soc/intel/skylake/skl-messages.c
|
|
+++ b/sound/soc/intel/skylake/skl-messages.c
|
|
@@ -71,6 +71,8 @@ void skl_dsp_set_astate_cfg(struct skl_sst *ctx, u32 cnt, void *data)
|
|
}
|
|
|
|
#define ENABLE_LOGS 6
|
|
+#define FW_LOGGING_AGING_TIMER_PERIOD 100
|
|
+#define FW_LOG_FIFO_FULL_TIMER_PERIOD 100
|
|
|
|
/* set firmware logging state via IPC */
|
|
int skl_dsp_enable_logging(struct sst_generic_ipc *ipc, int core, int enable)
|
|
@@ -79,6 +81,9 @@ int skl_dsp_enable_logging(struct sst_generic_ipc *ipc, int core, int enable)
|
|
struct skl_ipc_large_config_msg msg = {0};
|
|
int ret = 0;
|
|
|
|
+ log_msg.aging_timer_period = FW_LOGGING_AGING_TIMER_PERIOD;
|
|
+ log_msg.fifo_full_timer_period = FW_LOG_FIFO_FULL_TIMER_PERIOD;
|
|
+
|
|
log_msg.core_mask = (1 << core);
|
|
log_msg.logs_core[core].enable = enable;
|
|
log_msg.logs_core[core].priority = ipc->dsp->trace_wind.log_priority;
|
|
@@ -91,6 +96,33 @@ int skl_dsp_enable_logging(struct sst_generic_ipc *ipc, int core, int enable)
|
|
return ret;
|
|
}
|
|
|
|
+#define SYSTEM_TIME 20
|
|
+
|
|
+/* set system time to DSP via IPC */
|
|
+int skl_dsp_set_system_time(struct skl_sst *skl_sst)
|
|
+{
|
|
+ struct sst_generic_ipc *ipc = &skl_sst->ipc;
|
|
+ struct SystemTime sys_time_msg;
|
|
+ struct skl_ipc_large_config_msg msg = {0};
|
|
+ struct timeval tv;
|
|
+ u64 sys_time;
|
|
+ u64 mask = 0x00000000FFFFFFFF;
|
|
+ int ret;
|
|
+
|
|
+ do_gettimeofday(&tv);
|
|
+
|
|
+ /* DSP firmware expects UTC time in micro seconds */
|
|
+ sys_time = tv.tv_sec*1000*1000 + tv.tv_usec;
|
|
+ sys_time_msg.val_l = sys_time & mask;
|
|
+ sys_time_msg.val_u = (sys_time & (~mask)) >> 32;
|
|
+
|
|
+ msg.large_param_id = SYSTEM_TIME;
|
|
+ msg.param_data_size = sizeof(sys_time_msg);
|
|
+
|
|
+ ret = skl_ipc_set_large_config(ipc, &msg, (u32 *)&sys_time_msg);
|
|
+ return ret;
|
|
+}
|
|
+
|
|
#define NOTIFICATION_PARAM_ID 3
|
|
#define NOTIFICATION_MASK 0xf
|
|
|
|
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
|
|
index 96c912bafc87..ac9f67c8b7e4 100644
|
|
--- a/sound/soc/intel/skylake/skl-pcm.c
|
|
+++ b/sound/soc/intel/skylake/skl-pcm.c
|
|
@@ -847,6 +847,12 @@ static int skl_trace_compr_set_params(struct snd_compr_stream *stream,
|
|
return ret;
|
|
}
|
|
|
|
+ ret = skl_dsp_set_system_time(skl_sst);
|
|
+ if (ret < 0) {
|
|
+ dev_err(sst->dev, "Set system time to dsp firmware failed: %d\n", ret);
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
skl_dsp_get_log_buff(sst, core);
|
|
sst->trace_wind.flags |= BIT(core);
|
|
ret = skl_dsp_enable_logging(ipc, core, 1);
|
|
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.h b/sound/soc/intel/skylake/skl-sst-ipc.h
|
|
index 43d3eedad780..bc9b27884120 100644
|
|
--- a/sound/soc/intel/skylake/skl-sst-ipc.h
|
|
+++ b/sound/soc/intel/skylake/skl-sst-ipc.h
|
|
@@ -27,6 +27,7 @@ struct sst_generic_ipc;
|
|
|
|
#define NO_OF_INJECTOR 6
|
|
#define NO_OF_EXTRACTOR 8
|
|
+#define FW_REG_SZ 1024
|
|
|
|
enum skl_ipc_pipeline_state {
|
|
PPL_INVALID_STATE = 0,
|
|
@@ -332,11 +333,56 @@ struct skl_log_state {
|
|
};
|
|
|
|
struct skl_log_state_msg {
|
|
+ uint32_t aging_timer_period;
|
|
+ uint32_t fifo_full_timer_period;
|
|
+
|
|
u32 core_mask;
|
|
struct skl_log_state logs_core[2];
|
|
};
|
|
|
|
-#define SKL_IPC_BOOT_MSECS 3000
|
|
+struct SystemTime {
|
|
+ uint32_t val_l;
|
|
+ uint32_t val_u;
|
|
+};
|
|
+
|
|
+struct fw_version {
|
|
+ u16 major;
|
|
+ u16 minor;
|
|
+ u16 hotfix;
|
|
+ u16 build;
|
|
+} __packed;
|
|
+
|
|
+struct sw_version {
|
|
+ u16 major;
|
|
+ u16 minor;
|
|
+ u16 hotfix;
|
|
+ u16 build;
|
|
+} __packed;
|
|
+
|
|
+struct skl_dsp_core_dump {
|
|
+ u16 type0;
|
|
+ u16 length0;
|
|
+ u32 crash_dump_ver;
|
|
+ u16 bus_dev_id;
|
|
+ u16 cavs_hw_version;
|
|
+ struct fw_version fw_ver;
|
|
+ struct sw_version sw_ver;
|
|
+ u16 type2;
|
|
+ u16 length2;
|
|
+ u32 fwreg[FW_REG_SZ];
|
|
+} __packed;
|
|
+
|
|
+struct skl_module_notify {
|
|
+ u32 unique_id;
|
|
+ u32 event_id;
|
|
+ u32 event_data_size;
|
|
+ u32 event_data[0];
|
|
+} __packed;
|
|
+
|
|
+/* Timeout values in milliseconds for response from FW */
|
|
+#define SKL_IPC_BOOT_MSECS 3000
|
|
+#define SKL_IPC_LOAD_LIB_TIMEOUT 3000
|
|
+#define SKL_IPC_DEFAULT_TIMEOUT 300
|
|
|
|
#define SKL_IPC_D3_MASK 0
|
|
#define SKL_IPC_D0_MASK 3
|
|
@@ -390,6 +436,7 @@ int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc,
|
|
int skl_ipc_check_D0i0(struct sst_dsp *dsp, bool state);
|
|
|
|
int skl_dsp_enable_logging(struct sst_generic_ipc *ipc, int core, int enable);
|
|
+int skl_dsp_set_system_time(struct skl_sst *skl_sst);
|
|
|
|
void skl_ipc_int_enable(struct sst_dsp *dsp);
|
|
void skl_ipc_op_int_enable(struct sst_dsp *ctx);
|
|
--
|
|
2.19.2
|
|
|