Skip to contentSkip to conversation

ASoC: Intel: Skylake: Driver updates

PATCH In review [email protected] 4 participants 21 messages Mar 7, 2017 – Mar 15, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: Intel: Skylake: Driver updates

From: Jeeja KP <[email protected]>

This patch series provides updates and fixes on the following:
Fix parameter overwrite for KPB DSP Module.
To handle module download with size > dma buffer size. Fix to handle dsp pipes correctly.
Disable notification after dsp boot.
Remove get dsp_ops in cleanup routine.
Disable interrupt when DSP is in D3.
Update DSP core state in D0.
Reload the firmware in case of D3 failure.

Dharageswari R (1):
ASoC: Intel: Skylake: Fix parameter overwrite for KPB Module

G Kranthi (2):
ASoC: Intel: Skylake: Disable notifications at boot after DSP FW init
ASoC: Intel: Skylake: Remove get dsp_ops in cleanup routine

Guneshwor Singh (1):
ASoC: Intel: Skylake: Fix not to stop src pipe in pre pmd event
handler

Jeeja KP (6):
ASoC: Intel: Skylake: Fix to delete DSP pipe after stopping pipe
ASoC: Intel: bxtn: Disable interrupt when DSP is in D3
ASoC: Intel: bxtn: Update DSP core state in D0
ASoC: Intel: bxtn: Reload the firmware in case of D3 failure
ASoC: Intel: Skylake: Remove BE prepare ops
ASoC: Intel: Skylake: Fix module load when module size > DMA buffer
size

 sound/soc/intel/skylake/bxt-sst.c       | 14 ++++++-
 sound/soc/intel/skylake/skl-messages.c  | 12 ++----
 sound/soc/intel/skylake/skl-pcm.c       | 19 +---------
 sound/soc/intel/skylake/skl-sst-cldma.c | 26 ++++++++-----
 sound/soc/intel/skylake/skl-sst-cldma.h |  2 +-
 sound/soc/intel/skylake/skl-sst-dsp.c   |  6 ++-
 sound/soc/intel/skylake/skl-sst-dsp.h   |  3 ++
 sound/soc/intel/skylake/skl-sst-ipc.c   | 67 ++++++++++++++++++++++-----------
 sound/soc/intel/skylake/skl-sst-ipc.h   |  7 ++++
 sound/soc/intel/skylake/skl-sst.c       | 49 ++++++++++++++++++------
 sound/soc/intel/skylake/skl-topology.c  | 56 ++++++++++++++-------------
 11 files changed, 162 insertions(+), 99 deletions(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/10 ASoC: Intel: Skylake: Fix to delete DSP pipe after stopping pipe

From: Jeeja KP <[email protected]>

DSP pipe needs to stopped before deleting the pipe. Currently check is is for pipe state > STARTED, which is incorrect. So changed to include pipe state STARTED to stop the pipe if it started.

---
 sound/soc/intel/skylake/skl-messages.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/skl-messages.c +1 -1
index e668704..ed57696 100644
@@ -1098,7 +1098,7 @@ int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
 	dev_dbg(ctx->dev, "%s: pipe = %d\n", __func__, pipe->ppl_id);
 
 	/* If pipe is started, do stop the pipe in FW. */
-	if (pipe->state > SKL_PIPE_STARTED) {
+	if (pipe->state >= SKL_PIPE_STARTED) {
 		ret = skl_set_pipe_state(ctx, pipe, PPL_PAUSED);
 		if (ret < 0) {
 			dev_err(ctx->dev, "Failed to stop pipeline\n");
Signature · 1 line
2.5.0
#3 lore raw

PATCH 2/10 ASoC: Intel: Skylake: Fix not to stop src pipe in pre pmd event handler

In reply to [email protected]

From: Guneshwor Singh <[email protected]>

If the widget is a mixin module, just unbind between source and sink and don't stop the source pipe as there can be multiple sinks connected.

---
 sound/soc/intel/skylake/skl-topology.c | 9 ---------
 1 file changed, 9 deletions(-)
sound/soc/intel/skylake/skl-topology.c +0 -9
index 2dbfb1b..d46b6c3 100644
@@ -985,15 +985,6 @@ static int skl_tplg_mixer_dapm_pre_pmd_event(struct snd_soc_dapm_widget *w,
 			src_mconfig = sink_mconfig->m_in_pin[i].tgt_mcfg;
 			if (!src_mconfig)
 				continue;
-			/*
-			 * If path_found == 1, that means pmd for source
-			 * pipe has not occurred, source is connected to
-			 * some other sink. so its responsibility of sink
-			 * to unbind itself from source.
-			 */
-			ret = skl_stop_pipe(ctx, src_mconfig->pipe);
-			if (ret < 0)
-				return ret;
 
 			ret = skl_unbind_modules(ctx,
 						src_mconfig, sink_mconfig);
Signature · 1 line
2.5.0
#5 lore raw

PATCH 3/10 ASoC: Intel: bxtn: Disable interrupt when DSP is in D3

In reply to [email protected]

From: Jeeja KP <[email protected]>

When DSP is in D3, no interrupts are expected, so disable interrupt while entering D3.

---
 sound/soc/intel/skylake/bxt-sst.c | 5 +++++
 1 file changed, 5 insertions(+)
sound/soc/intel/skylake/bxt-sst.c +5 -0
index 15a063a..d9cd67d 100644
@@ -519,6 +519,11 @@ static int bxt_set_dsp_D3(struct sst_dsp *ctx, unsigned int core_id)
 		"Failed to set DSP to D3:core id = %d;Continue reset\n",
 		core_id);
 
+	if (core_id == SKL_DSP_CORE0_ID) {
+		/* disable Interrupt */
+		skl_ipc_op_int_disable(ctx);
+		skl_ipc_int_disable(ctx);
+	}
 	ret = skl_dsp_disable_core(ctx, core_mask);
 	if (ret < 0) {
 		dev_err(ctx->dev, "Failed to disable core %d\n", ret);
Signature · 1 line
2.5.0
#7 lore raw

PATCH 4/10 ASoC: Intel: bxtn: Update DSP core state in D0

In reply to [email protected]

From: Jeeja KP <[email protected]>

In system suspend, firmware needs to be re-downloaded as IMR is cleared. When firmware is downloaded in D0, core state is not set to running state causing instability with subsequent D0-D3 cycles.

So set the core state correctly during D0 and check the DSP core state if not in reset to set the DSP to D3.

---
 sound/soc/intel/skylake/bxt-sst.c     | 1 +
 sound/soc/intel/skylake/skl-sst-dsp.c | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +1 -0
index d9cd67d..c6f18b5 100644
@@ -428,6 +428,7 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id)
 				return ret;
 			}
 		}
+		skl->cores.state[core_id] = SKL_DSP_RUNNING;
 		return ret;
 	}
 
sound/soc/intel/skylake/skl-sst-dsp.c +4 -2
index c3deefa..0833272 100644
@@ -355,12 +355,13 @@ int skl_dsp_get_core(struct sst_dsp *ctx, unsigned int core_id)
 		ret = ctx->fw_ops.set_state_D0(ctx, core_id);
 		if (ret < 0) {
 			dev_err(ctx->dev, "unable to get core%d\n", core_id);
-			return ret;
+			goto out;
 		}
 	}
 
 	skl->cores.usage_count[core_id]++;
 
+out:
 	dev_dbg(ctx->dev, "core id %d state %d usage_count %d\n",
 			core_id, skl->cores.state[core_id],
 			skl->cores.usage_count[core_id]);
@@ -379,7 +380,8 @@ int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id)
 		return -EINVAL;
 	}
 
-	if (--skl->cores.usage_count[core_id] == 0) {
+	if ((--skl->cores.usage_count[core_id] == 0) &&
+		(skl->cores.state[core_id] != SKL_DSP_RESET)) {
 		ret = ctx->fw_ops.set_state_D3(ctx, core_id);
 		if (ret < 0) {
 			dev_err(ctx->dev, "unable to put core %d: %d\n",
Signature · 1 line
2.5.0
#9 lore raw

PATCH 5/10 ASoC: Intel: bxtn: Reload the firmware in case of D3 failure

In reply to [email protected]

From: Jeeja KP <[email protected]>

If D3 IPC fails or times out, firmware needs to be reloaded as driver continues the reset.
So set the fw_load flag to false to reload the firmware in D0.

---
 sound/soc/intel/skylake/bxt-sst.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/bxt-sst.c +7 -1
index c6f18b5..b30f887 100644
@@ -515,10 +515,16 @@ static int bxt_set_dsp_D3(struct sst_dsp *ctx, unsigned int core_id)
 
 	ret = skl_ipc_set_dx(&skl->ipc, BXT_INSTANCE_ID,
 				BXT_BASE_FW_MODULE_ID, &dx);
-	if (ret < 0)
+	if (ret < 0) {
 		dev_err(ctx->dev,
 		"Failed to set DSP to D3:core id = %d;Continue reset\n",
 		core_id);
+		/*
+		 * In case of D3 failure, re-download the firmware, so set
+		 * fw_loaded to false.
+		 */
+		skl->fw_loaded = false;
+	}
 
 	if (core_id == SKL_DSP_CORE0_ID) {
 		/* disable Interrupt */
Signature · 1 line
2.5.0
#11 lore raw

PATCH 6/10 ASoC: Intel: Skylake: Remove BE prepare ops

In reply to [email protected]

From: Jeeja KP <[email protected]>

Remove BE prepare ops which enables MCLK by default. If MCLK is required to be enabled for any specific platform, it needs to be enabled in the corresponding machine driver.

---
 sound/soc/intel/skylake/skl-pcm.c | 18 ------------------
 1 file changed, 18 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +0 -18
index e12520e..a5d46f7 100644
@@ -262,23 +262,6 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int skl_be_prepare(struct snd_pcm_substream *substream,
-		struct snd_soc_dai *dai)
-{
-	struct skl *skl = get_skl_ctx(dai->dev);
-	struct skl_sst *ctx = skl->skl_sst;
-	struct skl_module_cfg *mconfig;
-
-	if (dai->playback_widget->power || dai->capture_widget->power)
-		return 0;
-
-	mconfig = skl_tplg_be_get_cpr_module(dai, substream->stream);
-	if (mconfig == NULL)
-		return -EINVAL;
-
-	return skl_dsp_set_dma_control(ctx, mconfig);
-}
-
 static int skl_pcm_prepare(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
@@ -649,7 +632,6 @@ static struct snd_soc_dai_ops skl_dmic_dai_ops = {
 
 static struct snd_soc_dai_ops skl_be_ssp_dai_ops = {
 	.hw_params = skl_be_hw_params,
-	.prepare = skl_be_prepare,
 };
 
 static struct snd_soc_dai_ops skl_link_dai_ops = {
Signature · 1 line
2.5.0
#13 lore raw

PATCH 7/10 ASoC: Intel: Skylake: Disable notifications at boot after DSP FW init

In reply to [email protected]

From: G Kranthi <[email protected]>

DSP firmware sends notification every 1m, which is disabled in runtime suspend. But if a system has no runtime pm, we keep getting notification, so disable after FW init as well.

---
 sound/soc/intel/skylake/skl-messages.c | 2 +-
 sound/soc/intel/skylake/skl-pcm.c      | 1 +
 sound/soc/intel/skylake/skl-sst-dsp.h  | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl-messages.c +1 -1
index ed57696..29523dd 100644
@@ -58,7 +58,7 @@ static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab)
 #define NOTIFICATION_MASK 0xf
 
 /* disable notfication for underruns/overruns from firmware module */
-static void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable)
+void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable)
 {
 	struct notification_mask mask;
 	struct skl_ipc_large_config_msg	msg = {0};
sound/soc/intel/skylake/skl-pcm.c +1 -0
index a5d46f7..270fec7 100644
@@ -1214,6 +1214,7 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform)
 		}
 		skl_populate_modules(skl);
 		skl->skl_sst->update_d0i3c = skl_update_d0i3c;
+		skl_dsp_enable_notification(skl->skl_sst, false);
 	}
 	pm_runtime_mark_last_busy(platform->dev);
 	pm_runtime_put_autosuspend(platform->dev);
sound/soc/intel/skylake/skl-sst-dsp.h +2 -0
index 849410d..e8d1e14 100644
@@ -235,4 +235,6 @@ int skl_get_pvt_instance_id_map(struct skl_sst *ctx,
 void skl_freeup_uuid_list(struct skl_sst *ctx);
 
 int skl_dsp_strip_extended_manifest(struct firmware *fw);
+void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable);
+
 #endif /*__SKL_SST_DSP_H__*/
Signature · 1 line
2.5.0
#16 lore raw

PATCH 8/10 ASoC: Intel: Skylake: Remove get dsp_ops in cleanup routine

In reply to [email protected]

From: G Kranthi <[email protected]>

dsp ops is already set in init, so use the this in cleanup routine instead of again retrieving it.

---
 sound/soc/intel/skylake/skl-messages.c | 8 ++------
 sound/soc/intel/skylake/skl-sst-ipc.h  | 2 ++
 2 files changed, 4 insertions(+), 6 deletions(-)
sound/soc/intel/skylake/skl-messages.c +2 -6
index 29523dd..ba1ec97 100644
@@ -274,6 +274,7 @@ int skl_init_dsp(struct skl *skl)
 	if (ret < 0)
 		return ret;
 
+	skl->skl_sst->dsp_ops = ops;
 	dev_dbg(bus->dev, "dsp registration status=%d\n", ret);
 
 	return ret;
@@ -284,16 +285,11 @@ int skl_free_dsp(struct skl *skl)
 	struct hdac_ext_bus *ebus = &skl->ebus;
 	struct hdac_bus *bus = ebus_to_hbus(ebus);
 	struct skl_sst *ctx = skl->skl_sst;
-	const struct skl_dsp_ops *ops;
 
 	/* disable  ppcap interrupt */
 	snd_hdac_ext_bus_ppcap_int_enable(&skl->ebus, false);
 
-	ops = skl_get_dsp_ops(skl->pci->device);
-	if (!ops)
-		return -EIO;
-
-	ops->cleanup(bus->dev, ctx);
+	ctx->dsp_ops->cleanup(bus->dev, ctx);
 
 	if (ctx->dsp->addr.lpe)
 		iounmap(ctx->dsp->addr.lpe);
sound/soc/intel/skylake/skl-sst-ipc.h +2 -0
index 9660ace..87ae03e 100644
@@ -105,6 +105,8 @@ struct skl_sst {
 	void (*update_d0i3c)(struct device *dev, bool enable);
 
 	struct skl_d0i3_data d0i3;
+
+	struct skl_dsp_ops *dsp_ops;
 };
 
 struct skl_ipc_init_instance_msg {
Signature · 1 line
2.5.0
#18 lore raw

PATCH 9/10 ASoC: Intel: Skylake: Fix module load when module size > DMA buffer size

In reply to [email protected]

From: Jeeja KP <[email protected]>

When module size > DMA buffer size, driver copies first chunk and waits for the BDL complete interrupt. BDL complete interrupt never occurs and wait time expires as module load IPC is not send to start the DMA from DSP.

To fix the above issue need to follow the below steps:
After copying the first chunk, send the module load IPC to start the DMA and once the BDL interrupt is received, copy the next chunk till all bytes are copied. After all the bytes are copied, wait for module load IPC response to complete the module load. Also handled module load IPC reply messages.

---
 sound/soc/intel/skylake/skl-sst-cldma.c | 26 ++++++++-----
 sound/soc/intel/skylake/skl-sst-cldma.h |  2 +-
 sound/soc/intel/skylake/skl-sst-dsp.h   |  1 +
 sound/soc/intel/skylake/skl-sst-ipc.c   | 67 ++++++++++++++++++++++-----------
 sound/soc/intel/skylake/skl-sst-ipc.h   |  5 +++
 sound/soc/intel/skylake/skl-sst.c       | 49 ++++++++++++++++++------
 6 files changed, 107 insertions(+), 43 deletions(-)
sound/soc/intel/skylake/skl-sst-cldma.c +17 -9
index c9f6d87..d2b1d60 100644
@@ -164,7 +164,7 @@ static void skl_cldma_cleanup(struct sst_dsp  *ctx)
 	ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_bdl);
 }
 
-static int skl_cldma_wait_interruptible(struct sst_dsp *ctx)
+int skl_cldma_wait_interruptible(struct sst_dsp *ctx)
 {
 	int ret = 0;
 
@@ -243,9 +243,14 @@ static void skl_cldma_fill_buffer(struct sst_dsp *ctx, unsigned int size,
  * 2. Polling on fw register to identify if data left to transferred doesn't
  *    fill the ring buffer. Caller takes care of polling the required status
  *    register to identify the transfer status.
+ * 3. if wait flag is set, waits for DBL interrupt to copy the next chunk till
+ *    bytes_left is 0.
+ *    if wait flag is not set, doesn't wait for BDL interrupt. after ccopying
+ *    the first chunk return the no of bytes_left to be copied.
  */
 static int
-skl_cldma_copy_to_buf(struct sst_dsp *ctx, const void *bin, u32 total_size)
+skl_cldma_copy_to_buf(struct sst_dsp *ctx, const void *bin,
+			u32 total_size, bool wait)
 {
 	int ret = 0;
 	bool start = true;
@@ -272,13 +277,14 @@ skl_cldma_copy_to_buf(struct sst_dsp *ctx, const void *bin, u32 total_size)
 			size = ctx->cl_dev.bufsize;
 			skl_cldma_fill_buffer(ctx, size, curr_pos, true, start);
 
-			start = false;
-			ret = skl_cldma_wait_interruptible(ctx);
-			if (ret < 0) {
-				skl_cldma_stop(ctx);
-				return ret;
+			if (wait) {
+				start = false;
+				ret = skl_cldma_wait_interruptible(ctx);
+				if (ret < 0) {
+					skl_cldma_stop(ctx);
+					return ret;
+				}
 			}
-
 		} else {
 			skl_cldma_int_disable(ctx);
 
@@ -298,9 +304,11 @@ skl_cldma_copy_to_buf(struct sst_dsp *ctx, const void *bin, u32 total_size)
 		}
 		bytes_left -= size;
 		curr_pos = curr_pos + size;
+		if (!wait)
+			return bytes_left;
 	}
 
-	return ret;
+	return bytes_left;
 }
 
 void skl_cldma_process_intr(struct sst_dsp *ctx)
sound/soc/intel/skylake/skl-sst-cldma.h +1 -1
index 99e4c86..5b730a1 100644
@@ -213,7 +213,7 @@ struct skl_cl_dev_ops {
 	void (*cl_trigger)(struct sst_dsp  *ctx, bool enable);
 	void (*cl_cleanup_controller)(struct sst_dsp  *ctx);
 	int (*cl_copy_to_dmabuf)(struct sst_dsp *ctx,
-			const void *bin, u32 size);
+			const void *bin, u32 size, bool wait);
 	void (*cl_stop_dma)(struct sst_dsp *ctx);
 };
 
sound/soc/intel/skylake/skl-sst-dsp.h +1 -0
index e8d1e14..5d7a93a 100644
@@ -186,6 +186,7 @@ struct skl_module_table {
 void skl_cldma_process_intr(struct sst_dsp *ctx);
 void skl_cldma_int_disable(struct sst_dsp *ctx);
 int skl_cldma_prepare(struct sst_dsp *ctx);
+int skl_cldma_wait_interruptible(struct sst_dsp *ctx);
 
 void skl_dsp_set_state_locked(struct sst_dsp *ctx, int state);
 struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
sound/soc/intel/skylake/skl-sst-ipc.c +45 -22

111 lines not on this page · raw message

sound/soc/intel/skylake/skl-sst-ipc.h +5 -0
index 87ae03e..a43313c 100644
@@ -77,6 +77,11 @@ struct skl_sst {
 	wait_queue_head_t boot_wait;
 	bool boot_complete;
 
+	/* module load */
+	wait_queue_head_t mod_load_wait;
+	bool mod_load_complete;
+	bool mod_load_status;
+
 	/* IPC messaging */
 	struct sst_generic_ipc ipc;
 
sound/soc/intel/skylake/skl-sst.c +38 -11

74 lines not on this page · raw message

Signature · 1 line
2.5.0
#19 lore raw

PATCH 10/10 ASoC: Intel: Skylake: Fix parameter overwrite for KPB Module

In reply to [email protected]

From: Dharageswari R <[email protected]>

KPB module default parameter were overwritten by the dynamic instance id once use case is executed. This will cause module crash from subsequent execution of use case as the updated parameters are used.

So instead of over writing the default parameter, make a copy and update the module parameter and use this in IPC message.

---
 sound/soc/intel/skylake/skl-topology.c | 47 +++++++++++++++++++++-------------
 1 file changed, 29 insertions(+), 18 deletions(-)
sound/soc/intel/skylake/skl-topology.c +29 -18
index d46b6c3..53c9d63 100644
@@ -690,26 +690,29 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
 	return 0;
 }
 
-static int skl_fill_sink_instance_id(struct skl_sst *ctx,
-				struct skl_algo_data *alg_data)
+static int skl_fill_sink_instance_id(struct skl_sst *ctx, u32 *params,
+				int size, struct skl_module_cfg *mcfg)
 {
-	struct skl_kpb_params *params = (struct skl_kpb_params *)alg_data->params;
-	struct skl_mod_inst_map *inst;
 	int i, pvt_id;
 
-	inst = params->map;
+	if (mcfg->m_type == SKL_MODULE_TYPE_KPB) {
+		struct skl_kpb_params *kpb_params =
+				(struct skl_kpb_params *)params;
+		struct skl_mod_inst_map *inst = kpb_params->map;
 
-	for (i = 0; i < params->num_modules; i++) {
-		pvt_id = skl_get_pvt_instance_id_map(ctx,
-					inst->mod_id, inst->inst_id);
-		if (pvt_id < 0)
-			return -EINVAL;
-		inst->inst_id = pvt_id;
-		inst++;
+		for (i = 0; i < kpb_params->num_modules; i++) {
+			pvt_id = skl_get_pvt_instance_id_map(ctx, inst->mod_id,
+								inst->inst_id);
+			if (pvt_id < 0)
+				return -EINVAL;
+
+			inst->inst_id = pvt_id;
+			inst++;
+		}
 	}
+
 	return 0;
 }
-
 /*
  * Some modules require params to be set after the module is bound to
  * all pins connected.
@@ -726,6 +729,7 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
 	struct soc_bytes_ext *sb;
 	struct skl_algo_data *bc;
 	struct skl_specific_cfg *sp_cfg;
+	u32 *params;
 
 	/*
 	 * check all out/in pins are in bind state.
@@ -758,11 +762,18 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
 			bc = (struct skl_algo_data *)sb->dobj.private;
 
 			if (bc->set_params == SKL_PARAM_BIND) {
-				if (mconfig->m_type == SKL_MODULE_TYPE_KPB)
-					skl_fill_sink_instance_id(ctx, bc);
-				ret = skl_set_module_params(ctx,
-						(u32 *)bc->params, bc->max,
-						bc->param_id, mconfig);
+				params = kzalloc(bc->max, GFP_KERNEL);
+				if (!params)
+					return -ENOMEM;
+
+				memcpy(params, bc->params, bc->max);
+				skl_fill_sink_instance_id(ctx, params, bc->max,
+								mconfig);
+
+				ret = skl_set_module_params(ctx, params,
+						bc->max, bc->param_id, mconfig);
+				kfree(params);
+
 				if (ret < 0)
 					return ret;
 			}
Signature · 1 line
2.5.0
#2 lore raw

Re: [PATCH 01/10] ASoC: Intel: Skylake: Fix to delete DSP pipe after stopping pipe

In reply to [email protected]
Quoted 3 lines · On Tue, Mar 07, 2017 at 11:43:57PM +0530, [email protected] wrote:

From: Jeeja KP <[email protected]>

DSP pipe needs to stopped before deleting the pipe. Currently check is

needs to be ...

Quoted 1 line

is for pipe state > STARTED, which is incorrect. So changed to include

double is, please fix. Otherwise looks good to me.

Signature · 1 line
~Vinod
#17 lore raw

Re: [PATCH 08/10] ASoC: Intel: Skylake: Remove get dsp_ops in cleanup routine

In reply to [email protected]
reproduce:

Hi Kranthi,

[auto build test WARNING on asoc/for-next]
[also build test WARNING on v4.11-rc1 next-20170309]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/jeeja-kp-intel-com/ASoC-Intel-Skylake-Driver-updates/20170310-104533
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: i386-randconfig-s1-201710 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

sound/soc/intel/skylake/skl-messages.c: In function 'skl_init_dsp':

>> sound/soc/intel/skylake/skl-messages.c:277:24: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     skl->skl_sst->dsp_ops = ops;
                           ^

vim +/const +277 sound/soc/intel/skylake/skl-messages.c

261 dev_err(bus->dev, "ioremap error\n");
262 return -ENXIO;
263 }
264
265 ops = skl_get_dsp_ops(skl->pci->device);
266 if (!ops)
267 return -EIO;
268
269 loader_ops = ops->loader_ops();
270 ret = ops->init(bus->dev, mmio_base, irq,
271 skl->fw_name, loader_ops,
272 &skl->skl_sst);
273
274 if (ret < 0)
275 return ret;
276

 > 277		skl->skl_sst->dsp_ops = ops;

278 dev_dbg(bus->dev, "dsp registration status=%d\n", ret);
279
280 return ret;
281 }
282
283 int skl_free_dsp(struct skl *skl)
284 {
285 struct hdac_ext_bus *ebus = &skl->ebus;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

maintainer
#20 lore raw

Applied "ASoC: Intel: Skylake: Fix parameter overwrite for KPB Module" to the asoc tree

In reply to [email protected]

The patch

ASoC: Intel: Skylake: Fix parameter overwrite for KPB Module

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From bf3e5ef5d549f650c13bef2b2192057cfef33d38 Mon Sep 17 00:00:00 2001

From: Dharageswari R <[email protected]>
Date: Mon, 13 Mar 2017 22:11:32 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Fix parameter overwrite for KPB Module

KPB module default parameter were overwritten by the dynamic instance id once use case is executed. This will cause module crash from subsequent execution of use case as the updated parameters are used.

So instead of over writing the default parameter, make a copy and update the module parameter and use this in IPC message.

---
 sound/soc/intel/skylake/skl-topology.c | 47 +++++++++++++++++++++-------------
 1 file changed, 29 insertions(+), 18 deletions(-)
sound/soc/intel/skylake/skl-topology.c +29 -18
index d4058d2a8023..c6bd4bb49ec0 100644
@@ -678,26 +678,29 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
 	return 0;
 }
 
-static int skl_fill_sink_instance_id(struct skl_sst *ctx,
-				struct skl_algo_data *alg_data)
+static int skl_fill_sink_instance_id(struct skl_sst *ctx, u32 *params,
+				int size, struct skl_module_cfg *mcfg)
 {
-	struct skl_kpb_params *params = (struct skl_kpb_params *)alg_data->params;
-	struct skl_mod_inst_map *inst;
 	int i, pvt_id;
 
-	inst = params->map;
+	if (mcfg->m_type == SKL_MODULE_TYPE_KPB) {
+		struct skl_kpb_params *kpb_params =
+				(struct skl_kpb_params *)params;
+		struct skl_mod_inst_map *inst = kpb_params->map;
 
-	for (i = 0; i < params->num_modules; i++) {
-		pvt_id = skl_get_pvt_instance_id_map(ctx,
-					inst->mod_id, inst->inst_id);
-		if (pvt_id < 0)
-			return -EINVAL;
-		inst->inst_id = pvt_id;
-		inst++;
+		for (i = 0; i < kpb_params->num_modules; i++) {
+			pvt_id = skl_get_pvt_instance_id_map(ctx, inst->mod_id,
+								inst->inst_id);
+			if (pvt_id < 0)
+				return -EINVAL;
+
+			inst->inst_id = pvt_id;
+			inst++;
+		}
 	}
+
 	return 0;
 }
-
 /*
  * Some modules require params to be set after the module is bound to
  * all pins connected.
@@ -714,6 +717,7 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
 	struct soc_bytes_ext *sb;
 	struct skl_algo_data *bc;
 	struct skl_specific_cfg *sp_cfg;
+	u32 *params;
 
 	/*
 	 * check all out/in pins are in bind state.
@@ -746,11 +750,18 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
 			bc = (struct skl_algo_data *)sb->dobj.private;
 
 			if (bc->set_params == SKL_PARAM_BIND) {
-				if (mconfig->m_type == SKL_MODULE_TYPE_KPB)
-					skl_fill_sink_instance_id(ctx, bc);
-				ret = skl_set_module_params(ctx,
-						(u32 *)bc->params, bc->max,
-						bc->param_id, mconfig);
+				params = kzalloc(bc->max, GFP_KERNEL);
+				if (!params)
+					return -ENOMEM;
+
+				memcpy(params, bc->params, bc->max);
+				skl_fill_sink_instance_id(ctx, params, bc->max,
+								mconfig);
+
+				ret = skl_set_module_params(ctx, params,
+						bc->max, bc->param_id, mconfig);
+				kfree(params);
+
 				if (ret < 0)
 					return ret;
 			}
Signature · 1 line
2.11.0
maintainer
#15 lore raw

Applied "ASoC: Intel: Skylake: Disable notifications at boot after DSP FW init" to the asoc tree

In reply to [email protected]

The patch

ASoC: Intel: Skylake: Disable notifications at boot after DSP FW init

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From cb729d80b5c556acf38f1f04a1f0550472a75987 Mon Sep 17 00:00:00 2001

From: G Kranthi <[email protected]>
Date: Mon, 13 Mar 2017 22:11:29 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Disable notifications at boot after DSP
FW init

DSP firmware sends notification every 1ms, which is disabled in runtime suspend. But if a system has no runtime pm, we keep getting notification, so disable after FW init as well.

---
 sound/soc/intel/skylake/skl-messages.c | 2 +-
 sound/soc/intel/skylake/skl-pcm.c      | 1 +
 sound/soc/intel/skylake/skl-sst-dsp.h  | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl-messages.c +1 -1
index ed576965cacc..29523ddcfab0 100644
@@ -58,7 +58,7 @@ static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab)
 #define NOTIFICATION_MASK 0xf
 
 /* disable notfication for underruns/overruns from firmware module */
-static void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable)
+void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable)
 {
 	struct notification_mask mask;
 	struct skl_ipc_large_config_msg	msg = {0};
sound/soc/intel/skylake/skl-pcm.c +1 -0
index e3d206d50f3e..2f90bc40be77 100644
@@ -1214,6 +1214,7 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform)
 		}
 		skl_populate_modules(skl);
 		skl->skl_sst->update_d0i3c = skl_update_d0i3c;
+		skl_dsp_enable_notification(skl->skl_sst, false);
 	}
 	pm_runtime_mark_last_busy(platform->dev);
 	pm_runtime_put_autosuspend(platform->dev);
sound/soc/intel/skylake/skl-sst-dsp.h +2 -0
index 849410d0823e..e8d1e149e0cd 100644
@@ -235,4 +235,6 @@ int skl_get_pvt_instance_id_map(struct skl_sst *ctx,
 void skl_freeup_uuid_list(struct skl_sst *ctx);
 
 int skl_dsp_strip_extended_manifest(struct firmware *fw);
+void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable);
+
 #endif /*__SKL_SST_DSP_H__*/
Signature · 1 line
2.11.0
maintainer
#12 lore raw

Applied "ASoC: Intel: Skylake: Remove BE prepare ops" to the asoc tree

In reply to [email protected]

The patch

ASoC: Intel: Skylake: Remove BE prepare ops

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 3643ff10d48140a283d2e50c0e0a47f290cc3e4d Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Mon, 13 Mar 2017 22:11:28 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Remove BE prepare ops

Remove BE prepare ops which enables MCLK by default. If MCLK is required to be enabled for any specific platform, it needs to be enabled in the corresponding machine driver.

---
 sound/soc/intel/skylake/skl-pcm.c | 18 ------------------
 1 file changed, 18 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +0 -18
index 635cbb1e7d91..e3d206d50f3e 100644
@@ -262,23 +262,6 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int skl_be_prepare(struct snd_pcm_substream *substream,
-		struct snd_soc_dai *dai)
-{
-	struct skl *skl = get_skl_ctx(dai->dev);
-	struct skl_sst *ctx = skl->skl_sst;
-	struct skl_module_cfg *mconfig;
-
-	if (dai->playback_widget->power || dai->capture_widget->power)
-		return 0;
-
-	mconfig = skl_tplg_be_get_cpr_module(dai, substream->stream);
-	if (mconfig == NULL)
-		return -EINVAL;
-
-	return skl_dsp_set_dma_control(ctx, mconfig);
-}
-
 static int skl_pcm_prepare(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
@@ -649,7 +632,6 @@ static struct snd_soc_dai_ops skl_dmic_dai_ops = {
 
 static struct snd_soc_dai_ops skl_be_ssp_dai_ops = {
 	.hw_params = skl_be_hw_params,
-	.prepare = skl_be_prepare,
 };
 
 static struct snd_soc_dai_ops skl_link_dai_ops = {
Signature · 1 line
2.11.0
maintainer
#10 lore raw

Applied "ASoC: Intel: bxtn: Reload the firmware in case of D3 failure" to the asoc tree

In reply to [email protected]

The patch

ASoC: Intel: bxtn: Reload the firmware in case of D3 failure

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 03de8c2ef82fae29d53de7eb86b0ca10501499fc Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Mon, 13 Mar 2017 22:11:27 +0530
Subject: [PATCH] ASoC: Intel: bxtn: Reload the firmware in case of D3 failure

If D3 IPC fails or times out, firmware needs to be reloaded as driver continues the reset.
So set the fw_load flag to false to reload the firmware in D0.

---
 sound/soc/intel/skylake/bxt-sst.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/bxt-sst.c +7 -1
index 2a2bb944cd40..600d95891996 100644
@@ -533,10 +533,16 @@ static int bxt_set_dsp_D3(struct sst_dsp *ctx, unsigned int core_id)
 
 	ret = skl_ipc_set_dx(&skl->ipc, BXT_INSTANCE_ID,
 				BXT_BASE_FW_MODULE_ID, &dx);
-	if (ret < 0)
+	if (ret < 0) {
 		dev_err(ctx->dev,
 		"Failed to set DSP to D3:core id = %d;Continue reset\n",
 		core_id);
+		/*
+		 * In case of D3 failure, re-download the firmware, so set
+		 * fw_loaded to false.
+		 */
+		skl->fw_loaded = false;
+	}
 
 	if (core_id == SKL_DSP_CORE0_ID) {
 		/* disable Interrupt */
Signature · 1 line
2.11.0
maintainer
#8 lore raw

Applied "ASoC: Intel: bxtn: Update DSP core state in D0" to the asoc tree

In reply to [email protected]

The patch

ASoC: Intel: bxtn: Update DSP core state in D0

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 1fb344a33a2f99378128281df97770e2c5182c2d Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Mon, 13 Mar 2017 22:11:26 +0530
Subject: [PATCH] ASoC: Intel: bxtn: Update DSP core state in D0

In system suspend, firmware needs to be re-downloaded as IMR is cleared. When firmware is downloaded in D0, core state is not set to running state causing instability with subsequent D0-D3 cycles.

So set the core state correctly during D0 and check the DSP core state if not in reset to set the DSP to D3.

---
 sound/soc/intel/skylake/bxt-sst.c     | 1 +
 sound/soc/intel/skylake/skl-sst-dsp.c | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +1 -0
index b34c96508605..2a2bb944cd40 100644
@@ -446,6 +446,7 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id)
 				return ret;
 			}
 		}
+		skl->cores.state[core_id] = SKL_DSP_RUNNING;
 		return ret;
 	}
 
sound/soc/intel/skylake/skl-sst-dsp.c +4 -2
index c3deefab65d6..08332723c700 100644
@@ -355,12 +355,13 @@ int skl_dsp_get_core(struct sst_dsp *ctx, unsigned int core_id)
 		ret = ctx->fw_ops.set_state_D0(ctx, core_id);
 		if (ret < 0) {
 			dev_err(ctx->dev, "unable to get core%d\n", core_id);
-			return ret;
+			goto out;
 		}
 	}
 
 	skl->cores.usage_count[core_id]++;
 
+out:
 	dev_dbg(ctx->dev, "core id %d state %d usage_count %d\n",
 			core_id, skl->cores.state[core_id],
 			skl->cores.usage_count[core_id]);
@@ -379,7 +380,8 @@ int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id)
 		return -EINVAL;
 	}
 
-	if (--skl->cores.usage_count[core_id] == 0) {
+	if ((--skl->cores.usage_count[core_id] == 0) &&
+		(skl->cores.state[core_id] != SKL_DSP_RESET)) {
 		ret = ctx->fw_ops.set_state_D3(ctx, core_id);
 		if (ret < 0) {
 			dev_err(ctx->dev, "unable to put core %d: %d\n",
Signature · 1 line
2.11.0
maintainer
#6 lore raw

Applied "ASoC: Intel: bxtn: Disable interrupt when DSP is in D3" to the asoc tree

In reply to [email protected]

The patch

ASoC: Intel: bxtn: Disable interrupt when DSP is in D3

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 5518af9f97940e84de6a4bf6fed212a95278f818 Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Mon, 13 Mar 2017 22:11:25 +0530
Subject: [PATCH] ASoC: Intel: bxtn: Disable interrupt when DSP is in D3

When DSP is in D3, no interrupts are expected, so disable interrupt while entering D3.

---
 sound/soc/intel/skylake/bxt-sst.c | 5 +++++
 1 file changed, 5 insertions(+)
sound/soc/intel/skylake/bxt-sst.c +5 -0
index d3be1be5a372..b34c96508605 100644
@@ -537,6 +537,11 @@ static int bxt_set_dsp_D3(struct sst_dsp *ctx, unsigned int core_id)
 		"Failed to set DSP to D3:core id = %d;Continue reset\n",
 		core_id);
 
+	if (core_id == SKL_DSP_CORE0_ID) {
+		/* disable Interrupt */
+		skl_ipc_op_int_disable(ctx);
+		skl_ipc_int_disable(ctx);
+	}
 	ret = skl_dsp_disable_core(ctx, core_mask);
 	if (ret < 0) {
 		dev_err(ctx->dev, "Failed to disable core %d\n", ret);
Signature · 1 line
2.11.0
maintainer
#4 lore raw

Applied "ASoC: Intel: Skylake: Fix not to stop src pipe in pre pmd event handler" to the asoc tree

In reply to [email protected]

The patch

ASoC: Intel: Skylake: Fix not to stop src pipe in pre pmd event handler

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 3b563e0a8406bf47cd39ca59f8453b3d968d996a Mon Sep 17 00:00:00 2001

From: Guneshwor Singh <[email protected]>
Date: Mon, 13 Mar 2017 22:11:24 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Fix not to stop src pipe in pre pmd
event handler

If the widget is a mixin module, just unbind between source and sink and don't stop the source pipe as there can be multiple sinks connected.

---
 sound/soc/intel/skylake/skl-topology.c | 9 ---------
 1 file changed, 9 deletions(-)
sound/soc/intel/skylake/skl-topology.c +0 -9
index e7836a2e18f0..d4058d2a8023 100644
@@ -973,15 +973,6 @@ static int skl_tplg_mixer_dapm_pre_pmd_event(struct snd_soc_dapm_widget *w,
 			src_mconfig = sink_mconfig->m_in_pin[i].tgt_mcfg;
 			if (!src_mconfig)
 				continue;
-			/*
-			 * If path_found == 1, that means pmd for source
-			 * pipe has not occurred, source is connected to
-			 * some other sink. so its responsibility of sink
-			 * to unbind itself from source.
-			 */
-			ret = skl_stop_pipe(ctx, src_mconfig->pipe);
-			if (ret < 0)
-				return ret;
 
 			ret = skl_unbind_modules(ctx,
 						src_mconfig, sink_mconfig);
Signature · 1 line
2.11.0