Skip to contentSkip to conversation

ASoC: Intel: Skylake: Driver updates

PATCH In review [email protected] 3 participants 14 messages Mar 13, 2017 – Mar 15, 2017

Subsystems (3)

v2 of 5 In review Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 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.

Changes in v2:
- fixed the typo's in commit message.
- handle error in case when ipc fails in case of load module.

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   | 66 ++++++++++++++++++++++-----------
 sound/soc/intel/skylake/skl-sst-ipc.h   |  7 ++++
 sound/soc/intel/skylake/skl-sst.c       | 53 ++++++++++++++++++++------
 sound/soc/intel/skylake/skl-topology.c  | 56 ++++++++++++++--------------
 11 files changed, 165 insertions(+), 99 deletions(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH v2 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 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
#2 lore raw

PATCH v2 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 f38f8e6..f04a251 100644
@@ -975,15 +975,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
#3 lore raw

PATCH v2 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 d3be1be..b34c965 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.5.0
#4 lore raw

PATCH v2 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 b34c965..2a2bb94 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 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
#5 lore raw

PATCH v2 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 2a2bb94..600d958 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.5.0
#6 lore raw

PATCH v2 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 635cbb1..e3d206d 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
#7 lore raw

PATCH v2 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 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 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 e3d206d..2f90bc4 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
#8 lore raw

PATCH v2 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 this in cleanup routine instead of again retrieving it. Also constify struct skl_dsp_ops.

---
 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..7d21f05 100644
@@ -105,6 +105,8 @@ struct skl_sst {
 	void (*update_d0i3c)(struct device *dev, bool enable);
 
 	struct skl_d0i3_data d0i3;
+
+	const struct skl_dsp_ops *dsp_ops;
 };
 
 struct skl_ipc_init_instance_msg {
Signature · 1 line
2.5.0
maintainer
#9 lore raw

Applied "ASoC: Intel: Skylake: Remove get dsp_ops in cleanup routine" to the asoc tree

The patch

ASoC: Intel: Skylake: Remove get dsp_ops in cleanup routine

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 7bd86a30599de479bd863e18472207337485d339 Mon Sep 17 00:00:00 2001

From: G Kranthi <[email protected]>
Date: Mon, 13 Mar 2017 22:11:30 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Remove get dsp_ops in cleanup routine

dsp ops is already set in init, so use this in cleanup routine instead of again retrieving it. Also constify struct skl_dsp_ops.

---
 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 29523ddcfab0..ba1ec973ded7 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 9660ace379ab..7d21f055328d 100644
@@ -105,6 +105,8 @@ struct skl_sst {
 	void (*update_d0i3c)(struct device *dev, bool enable);
 
 	struct skl_d0i3_data d0i3;
+
+	const struct skl_dsp_ops *dsp_ops;
 };
 
 struct skl_ipc_init_instance_msg {
Signature · 1 line
2.11.0
#10 lore raw

PATCH v2 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:
1. After copying the first chunk, send the module load IPC to start the DMA.
2. Wait for the BDL interrupt. Once interrupt is received, copy the next chunk.
3. Continue step 2 till all bytes are copied.
4. When all the bytes are copied (bytes_left = 0), wait for module load IPC response
5. Handled module load IPC response messages, check the load module IPC response and wake up the thread to complete module load.

---
 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   | 66 ++++++++++++++++++++++-----------
 sound/soc/intel/skylake/skl-sst-ipc.h   |  5 +++
 sound/soc/intel/skylake/skl-sst.c       | 53 ++++++++++++++++++++------
 6 files changed, 110 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 -21

104 lines not on this page · raw message

sound/soc/intel/skylake/skl-sst-ipc.h +5 -0
index 7d21f05..fc07c39 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 +41 -12

77 lines not on this page · raw message

Signature · 1 line
2.5.0
maintainer
#11 lore raw

Applied "ASoC: Intel: Skylake: Fix module load when module size > DMA buffer size" to the asoc tree

The patch

ASoC: Intel: Skylake: Fix module load when module size > DMA buffer size

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 b7d0254c51f3ce79a8931690e8a2f035208f6b55 Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Mon, 13 Mar 2017 22:11:31 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Fix module load when module size > DMA
buffer size

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:
1. After copying the first chunk, send the module load IPC to start the DMA.
2. Wait for the BDL interrupt. Once interrupt is received, copy the next chunk.
3. Continue step 2 till all bytes are copied.
4. When all the bytes are copied (bytes_left = 0), wait for module load IPC response
5. Handled module load IPC response messages, check the load module IPC response and wake up the thread to complete module load.

---
 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   | 66 ++++++++++++++++++++++-----------
 sound/soc/intel/skylake/skl-sst-ipc.h   |  5 +++
 sound/soc/intel/skylake/skl-sst.c       | 53 ++++++++++++++++++++------
 6 files changed, 110 insertions(+), 43 deletions(-)
sound/soc/intel/skylake/skl-sst-cldma.c +17 -9
index c9f6d87381db..d2b1d60fec02 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 99e4c86b6358..5b730a1a0ae4 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 e8d1e149e0cd..5d7a93aa5bed 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 -21

104 lines not on this page · raw message

sound/soc/intel/skylake/skl-sst-ipc.h +5 -0
index 7d21f055328d..fc07c397b060 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 +41 -12

77 lines not on this page · raw message

Signature · 1 line
2.11.0
#12 lore raw

PATCH v2 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 f04a251..33a4e0d 100644
@@ -680,26 +680,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.
@@ -716,6 +719,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.
@@ -748,11 +752,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
Acked-by on the v2 series
#13 lore raw
In reply to [email protected]
Quoted 12 lines · On Mon, Mar 13, 2017 at 10:11:22PM +0530, [email protected] wrote:

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.

Quoted 3 lines

Changes in v2:
- fixed the typo's in commit message.
- handle error in case when ipc fails in case of load module.

Thanks for updating these

Signature · 1 line
~Vinod