Skip to contentSkip to conversation

ASoC: Intel: Skylake: Driver updates

PATCH In review Vinod Koul 2 participants 18 messages Aug 24, 2016 – Sep 25, 2016

Subsystems (3)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

cover ASoC: Intel: Skylake: Driver updates

So we had some driver updates collated, time to send them upstream :)

- manifest data size was not checked so that is fixed
- previous conversion to use core parsing for HDA capabilities was wrong at one place, that is fixed.
- DMA config size was wrong, that is also fixed
- Add 32bit format
- The module instance IDs are manged in driver now.

Dharageswari R (5):
ASoC: Intel: Skylake: Unload all the loadable modules
ASoC: Intel: Skylake: Create dynamic instance ids for DSP modules
ASoC: Intel: Skylake: Use private instance id of modules in IPC
ASoC: Intel: Skylake: Table for module instance id and private id
ASoC: Intel: Skylake: Override the actual instance id's to pvt_id's

Jeeja KP (1):
ASoC: Intel: Skylake: Fix DMA control config size

Samaga Krishna (1):
ASoC: Intel: Skylake: Add 32bit support

Vinod Koul (2):
ASoC: Intel: Skylake: check manifest size
ASoC: Intel: Skylake: Fix the inverted logic check

 sound/soc/intel/skylake/skl-messages.c       |  24 +++--
 sound/soc/intel/skylake/skl-pcm.c            |   5 +-
 sound/soc/intel/skylake/skl-sst-dsp.h        |   6 ++
 sound/soc/intel/skylake/skl-sst-utils.c      | 133 ++++++++++++++++++++++++++-
 sound/soc/intel/skylake/skl-topology.c       |  44 ++++++++-
 sound/soc/intel/skylake/skl-topology.h       |  13 ++-
 sound/soc/intel/skylake/skl-tplg-interface.h |   3 +-
 7 files changed, 208 insertions(+), 20 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/9 ASoC: Intel: Skylake: check manifest size

For some platforms manifest data may not be defined, thus the private data would not be defined as well.

So check the size of private data and proceed only if it is valid.

---
 sound/soc/intel/skylake/skl-topology.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/intel/skylake/skl-topology.c +4 -0
index 108ebb9ab329..6bceab8f0bac 100644
@@ -2401,6 +2401,10 @@ static int skl_manifest_load(struct snd_soc_component *cmpnt,
 	struct skl *skl = ebus_to_skl(ebus);
 	int ret = 0;
 
+	/* proceed only if we have private data defined */
+	if (manifest->priv.size == 0)
+		return 0;
+
 	minfo = &skl->skl_sst->manifest;
 
 	skl_tplg_get_manifest_data(manifest, bus->dev, minfo);
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/9 ASoC: Intel: Skylake: Fix the inverted logic check

In reply to Vinod Koul

While converting to new core hda capability parsing, one instance of check had inverted logic which was converted wrongly.

Fixes ec8ae5703da1 (ALSA: convert users to core bus_parse_capabilities)
---
 sound/soc/intel/skylake/skl-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/skl-pcm.c +1 -1
index eb1f00b28df1..77bfd407f2a1 100644
@@ -1020,7 +1020,7 @@ static int skl_platform_pcm_trigger(struct snd_pcm_substream *substream,
 {
 	struct hdac_ext_bus *ebus = get_bus_ctx(substream);
 
-	if ((ebus_to_hbus(ebus))->ppcap)
+	if (!(ebus_to_hbus(ebus))->ppcap)
 		return skl_coupled_trigger(substream, cmd);
 
 	return 0;
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH 3/9 ASoC: Intel: Skylake: Fix DMA control config size

In reply to Vinod Koul

From: Jeeja KP <[email protected]>

DMA control IPC structure wrong config array length, So corrected the size

---
 sound/soc/intel/skylake/skl-topology.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/skl-topology.h +1 -1
index 96fa86d0f93a..37f45cc32a44 100644
@@ -133,7 +133,7 @@ struct skl_i2s_config_blob {
 struct skl_dma_control {
 	u32 node_id;
 	u32 config_length;
-	u32 config_data[1];
+	u32 config_data[0];
 } __packed;
 
 struct skl_cpr_cfg {
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 4/9 ASoC: Intel: Skylake: Unload all the loadable modules

In reply to Vinod Koul

From: Dharageswari R <[email protected]>

There could be more than one loadable module in a pipeline. So unload all modules whilst parsing the list.

---
 sound/soc/intel/skylake/skl-topology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-topology.c +6 -2
index 6bceab8f0bac..2d475b720963 100644
@@ -523,6 +523,7 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
 static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx,
 	 struct skl_pipe *pipe)
 {
+	int ret;
 	struct skl_pipe_module *w_module = NULL;
 	struct skl_module_cfg *mconfig = NULL;
 
@@ -530,9 +531,12 @@ static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx,
 		mconfig  = w_module->w->priv;
 
 		if (mconfig->is_loadable && ctx->dsp->fw_ops.unload_mod &&
-			mconfig->m_state > SKL_MODULE_UNINIT)
-			return ctx->dsp->fw_ops.unload_mod(ctx->dsp,
+			mconfig->m_state > SKL_MODULE_UNINIT) {
+			ret = ctx->dsp->fw_ops.unload_mod(ctx->dsp,
 						mconfig->id.module_id);
+			if (ret < 0)
+				return -EIO;
+		}
 	}
 
 	/* no modules to unload in this path, so return */
Signature · 1 line
1.9.1
author
#5 lore raw

PATCH 5/9 ASoC: Intel: Skylake: Create dynamic instance ids for DSP modules

In reply to Vinod Koul

From: Dharageswari R <[email protected]>

Module instance id's are unique id's used to communicate with DSP. Earlier they were defined in topology. But that approach runs issue with assigning unique id to each module and range is limited by firmware

The solution is to allocate and manage the id's in driver. Any unused id can be allocated and used in communication with firmware untill the module is destroyed and id freed.

The implementation uses ffz to find free id. Also it add a macro on top of ffz to create a 128 bit id as ffz works on long.

---
 sound/soc/intel/skylake/skl-sst-dsp.h   |  4 ++
 sound/soc/intel/skylake/skl-sst-utils.c | 98 +++++++++++++++++++++++++++++++++
 sound/soc/intel/skylake/skl-topology.h  |  1 +
 3 files changed, 103 insertions(+)
sound/soc/intel/skylake/skl-sst-dsp.h +4 -0
index 6ad5cab4b0d5..b61bd03ee4f0 100644
@@ -215,6 +215,10 @@ int snd_skl_get_module_info(struct skl_sst *ctx,
 				struct skl_module_cfg *mconfig);
 int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
 				unsigned int offset, int index);
+int skl_get_pvt_id(struct skl_sst *ctx,
+				struct skl_module_cfg *mconfig);
+int skl_put_pvt_id(struct skl_sst *ctx,
+				struct skl_module_cfg *mconfig);
 void skl_freeup_uuid_list(struct skl_sst *ctx);
 
 int skl_dsp_strip_extended_manifest(struct firmware *fw);
sound/soc/intel/skylake/skl-sst-utils.c +98 -0

120 lines not on this page · raw message

sound/soc/intel/skylake/skl-topology.h +1 -0
index 37f45cc32a44..def03912b1bd 100644
@@ -218,6 +218,7 @@ struct skl_module_cfg;
 struct skl_module_inst_id {
 	int module_id;
 	u32 instance_id;
+	int pvt_id;
 };
 
 enum skl_module_pin_state {
Signature · 1 line
1.9.1
maintainer
#6 lore raw

Re: [PATCH 5/9] ASoC: Intel: Skylake: Create dynamic instance ids for DSP modules

sound/soc/intel/skylake/skl-sst-utils.c int snd_skl_get_module_info(struct skl_sst *ctx, · line 152

Quoted 1 line · Vinod Koul
sound/soc/intel/skylake/skl-sst-utils.c +1 -0
+	if (!(mask_val == 0xffffffff)) {

Why is this not a != comparison?

author
#7 lore raw

Re: [PATCH 5/9] ASoC: Intel: Skylake: Create dynamic instance ids for DSP modules

Quoted 5 lines · Mark Brown

sound/soc/intel/skylake/skl-sst-utils.c int snd_skl_get_module_info(struct skl_sst *ctx, · line 152

Quoted 1 line · Vinod Koul
sound/soc/intel/skylake/skl-sst-utils.c +1 -0
+	if (!(mask_val == 0xffffffff)) {

Why is this not a != comparison?

Yeah that's right and simpler, will update

Signature · 1 line
~Vinod
author
#8 lore raw

PATCH 6/9 ASoC: Intel: Skylake: Use private instance id of modules in IPC

In reply to Vinod Koul

From: Dharageswari R <[email protected]>

Use private id's of module instances that are generated during init_module for the IPC messages to DSP. These id's are freed up during delete pipeline.

---
 sound/soc/intel/skylake/skl-messages.c  | 22 ++++++++++++----------
 sound/soc/intel/skylake/skl-sst-utils.c |  2 +-
 sound/soc/intel/skylake/skl-topology.c  | 10 +++++++---
 3 files changed, 20 insertions(+), 14 deletions(-)
sound/soc/intel/skylake/skl-messages.c +12 -10
index 8eb5ba2dae3a..ac0c58e170c3 100644
@@ -787,6 +787,7 @@ static int skl_alloc_queue(struct skl_module_pin *mpin,
 				mpin[i].in_use = true;
 				mpin[i].id.module_id = id.module_id;
 				mpin[i].id.instance_id = id.instance_id;
+				mpin[i].id.pvt_id = id.pvt_id;
 				mpin[i].tgt_mcfg = tgt_cfg;
 				return i;
 			}
@@ -810,6 +811,7 @@ static void skl_free_queue(struct skl_module_pin *mpin, int q_index)
 		mpin[q_index].in_use = false;
 		mpin[q_index].id.module_id = 0;
 		mpin[q_index].id.instance_id = 0;
+		mpin[q_index].id.pvt_id = 0;
 	}
 	mpin[q_index].pin_state = SKL_PIN_UNBIND;
 	mpin[q_index].tgt_mcfg = NULL;
@@ -850,7 +852,7 @@ int skl_init_module(struct skl_sst *ctx,
 	struct skl_ipc_init_instance_msg msg;
 
 	dev_dbg(ctx->dev, "%s: module_id = %d instance=%d\n", __func__,
-		 mconfig->id.module_id, mconfig->id.instance_id);
+		 mconfig->id.module_id, mconfig->id.pvt_id);
 
 	if (mconfig->pipe->state != SKL_PIPE_CREATED) {
 		dev_err(ctx->dev, "Pipe not created state= %d pipe_id= %d\n",
@@ -866,7 +868,7 @@ int skl_init_module(struct skl_sst *ctx,
 	}
 
 	msg.module_id = mconfig->id.module_id;
-	msg.instance_id = mconfig->id.instance_id;
+	msg.instance_id = mconfig->id.pvt_id;
 	msg.ppl_instance_id = mconfig->pipe->ppl_id;
 	msg.param_data_size = module_config_size;
 	msg.core_id = mconfig->core_id;
@@ -887,9 +889,9 @@ static void skl_dump_bind_info(struct skl_sst *ctx, struct skl_module_cfg
 	*src_module, struct skl_module_cfg *dst_module)
 {
 	dev_dbg(ctx->dev, "%s: src module_id = %d  src_instance=%d\n",
-		__func__, src_module->id.module_id, src_module->id.instance_id);
+		__func__, src_module->id.module_id, src_module->id.pvt_id);
 	dev_dbg(ctx->dev, "%s: dst_module=%d dst_instacne=%d\n", __func__,
-		 dst_module->id.module_id, dst_module->id.instance_id);
+		 dst_module->id.module_id, dst_module->id.pvt_id);
 
 	dev_dbg(ctx->dev, "src_module state = %d dst module state = %d\n",
 		src_module->m_state, dst_module->m_state);
@@ -936,9 +938,9 @@ int skl_unbind_modules(struct skl_sst *ctx,
 		return 0;
 
 	msg.module_id = src_mcfg->id.module_id;
-	msg.instance_id = src_mcfg->id.instance_id;
+	msg.instance_id = src_mcfg->id.pvt_id;
 	msg.dst_module_id = dst_mcfg->id.module_id;
-	msg.dst_instance_id = dst_mcfg->id.instance_id;
+	msg.dst_instance_id = dst_mcfg->id.pvt_id;
 	msg.bind = false;
 
 	ret = skl_ipc_bind_unbind(&ctx->ipc, &msg);
@@ -997,9 +999,9 @@ int skl_bind_modules(struct skl_sst *ctx,
 			 msg.src_queue, msg.dst_queue);
 
 	msg.module_id = src_mcfg->id.module_id;
-	msg.instance_id = src_mcfg->id.instance_id;
+	msg.instance_id = src_mcfg->id.pvt_id;
 	msg.dst_module_id = dst_mcfg->id.module_id;
-	msg.dst_instance_id = dst_mcfg->id.instance_id;
+	msg.dst_instance_id = dst_mcfg->id.pvt_id;
 	msg.bind = true;
 
 	ret = skl_ipc_bind_unbind(&ctx->ipc, &msg);
@@ -1177,7 +1179,7 @@ int skl_set_module_params(struct skl_sst *ctx, u32 *params, int size,
 	struct skl_ipc_large_config_msg msg;
 
 	msg.module_id = mcfg->id.module_id;
-	msg.instance_id = mcfg->id.instance_id;
+	msg.instance_id = mcfg->id.pvt_id;
 	msg.param_data_size = size;
 	msg.large_param_id = param_id;
 
@@ -1190,7 +1192,7 @@ int skl_get_module_params(struct skl_sst *ctx, u32 *params, int size,
 	struct skl_ipc_large_config_msg msg;
 
 	msg.module_id = mcfg->id.module_id;
-	msg.instance_id = mcfg->id.instance_id;
+	msg.instance_id = mcfg->id.pvt_id;
 	msg.param_data_size = size;
 	msg.large_param_id = param_id;
 
sound/soc/intel/skylake/skl-sst-utils.c +1 -1
index fe77d185b857..64873bc341dd 100644
@@ -141,7 +141,7 @@ int snd_skl_get_module_info(struct skl_sst *ctx,
 EXPORT_SYMBOL_GPL(snd_skl_get_module_info);
 
 static inline int skl_getid_32(struct uuid_module *module, u64 *val,
-					int word1_mask, int word2_mask)
+				int word1_mask, int word2_mask)
 {
 	int index, max_inst, pvt_id;
 	u32 mask_val;
sound/soc/intel/skylake/skl-topology.c +7 -3
index 2d475b720963..b6fc374f38b5 100644
@@ -505,12 +505,15 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
 		 * FE/BE params
 		 */
 		skl_tplg_update_module_params(w, ctx);
-
+		mconfig->id.pvt_id = skl_get_pvt_id(ctx, mconfig);
+		if (mconfig->id.pvt_id < 0)
+			return ret;
 		skl_tplg_set_module_init_data(w);
 		ret = skl_init_module(ctx, mconfig);
-		if (ret < 0)
+		if (ret < 0) {
+			skl_put_pvt_id(ctx, mconfig);
 			return ret;
-
+		}
 		skl_tplg_alloc_pipe_mcps(skl, mconfig);
 		ret = skl_tplg_set_module_params(w, ctx);
 		if (ret < 0)
@@ -537,6 +540,7 @@ static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx,
 			if (ret < 0)
 				return -EIO;
 		}
+		skl_put_pvt_id(ctx, mconfig);
 	}
 
 	/* no modules to unload in this path, so return */
Signature · 1 line
1.9.1
maintainer
#9 lore raw

Applied "ASoC: Intel: Skylake: Use private instance id of modules in IPC" to the asoc tree

The patch

ASoC: Intel: Skylake: Use private instance id of modules in IPC

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

From: Dharageswari R <[email protected]>
Date: Thu, 22 Sep 2016 14:00:38 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Use private instance id of modules in
IPC

Use private id's of module instances that are generated during init_module for the IPC messages to DSP. These id's are freed up during delete pipeline.

---
 sound/soc/intel/skylake/skl-messages.c  | 22 ++++++++++++----------
 sound/soc/intel/skylake/skl-sst-utils.c |  2 +-
 sound/soc/intel/skylake/skl-topology.c  | 10 +++++++---
 3 files changed, 20 insertions(+), 14 deletions(-)
sound/soc/intel/skylake/skl-messages.c +12 -10
index 8eb5ba2dae3a..ac0c58e170c3 100644
@@ -787,6 +787,7 @@ static int skl_alloc_queue(struct skl_module_pin *mpin,
 				mpin[i].in_use = true;
 				mpin[i].id.module_id = id.module_id;
 				mpin[i].id.instance_id = id.instance_id;
+				mpin[i].id.pvt_id = id.pvt_id;
 				mpin[i].tgt_mcfg = tgt_cfg;
 				return i;
 			}
@@ -810,6 +811,7 @@ static void skl_free_queue(struct skl_module_pin *mpin, int q_index)
 		mpin[q_index].in_use = false;
 		mpin[q_index].id.module_id = 0;
 		mpin[q_index].id.instance_id = 0;
+		mpin[q_index].id.pvt_id = 0;
 	}
 	mpin[q_index].pin_state = SKL_PIN_UNBIND;
 	mpin[q_index].tgt_mcfg = NULL;
@@ -850,7 +852,7 @@ int skl_init_module(struct skl_sst *ctx,
 	struct skl_ipc_init_instance_msg msg;
 
 	dev_dbg(ctx->dev, "%s: module_id = %d instance=%d\n", __func__,
-		 mconfig->id.module_id, mconfig->id.instance_id);
+		 mconfig->id.module_id, mconfig->id.pvt_id);
 
 	if (mconfig->pipe->state != SKL_PIPE_CREATED) {
 		dev_err(ctx->dev, "Pipe not created state= %d pipe_id= %d\n",
@@ -866,7 +868,7 @@ int skl_init_module(struct skl_sst *ctx,
 	}
 
 	msg.module_id = mconfig->id.module_id;
-	msg.instance_id = mconfig->id.instance_id;
+	msg.instance_id = mconfig->id.pvt_id;
 	msg.ppl_instance_id = mconfig->pipe->ppl_id;
 	msg.param_data_size = module_config_size;
 	msg.core_id = mconfig->core_id;
@@ -887,9 +889,9 @@ static void skl_dump_bind_info(struct skl_sst *ctx, struct skl_module_cfg
 	*src_module, struct skl_module_cfg *dst_module)
 {
 	dev_dbg(ctx->dev, "%s: src module_id = %d  src_instance=%d\n",
-		__func__, src_module->id.module_id, src_module->id.instance_id);
+		__func__, src_module->id.module_id, src_module->id.pvt_id);
 	dev_dbg(ctx->dev, "%s: dst_module=%d dst_instacne=%d\n", __func__,
-		 dst_module->id.module_id, dst_module->id.instance_id);
+		 dst_module->id.module_id, dst_module->id.pvt_id);
 
 	dev_dbg(ctx->dev, "src_module state = %d dst module state = %d\n",
 		src_module->m_state, dst_module->m_state);
@@ -936,9 +938,9 @@ int skl_unbind_modules(struct skl_sst *ctx,
 		return 0;
 
 	msg.module_id = src_mcfg->id.module_id;
-	msg.instance_id = src_mcfg->id.instance_id;
+	msg.instance_id = src_mcfg->id.pvt_id;
 	msg.dst_module_id = dst_mcfg->id.module_id;
-	msg.dst_instance_id = dst_mcfg->id.instance_id;
+	msg.dst_instance_id = dst_mcfg->id.pvt_id;
 	msg.bind = false;
 
 	ret = skl_ipc_bind_unbind(&ctx->ipc, &msg);
@@ -997,9 +999,9 @@ int skl_bind_modules(struct skl_sst *ctx,
 			 msg.src_queue, msg.dst_queue);
 
 	msg.module_id = src_mcfg->id.module_id;
-	msg.instance_id = src_mcfg->id.instance_id;
+	msg.instance_id = src_mcfg->id.pvt_id;
 	msg.dst_module_id = dst_mcfg->id.module_id;
-	msg.dst_instance_id = dst_mcfg->id.instance_id;
+	msg.dst_instance_id = dst_mcfg->id.pvt_id;
 	msg.bind = true;
 
 	ret = skl_ipc_bind_unbind(&ctx->ipc, &msg);
@@ -1177,7 +1179,7 @@ int skl_set_module_params(struct skl_sst *ctx, u32 *params, int size,
 	struct skl_ipc_large_config_msg msg;
 
 	msg.module_id = mcfg->id.module_id;
-	msg.instance_id = mcfg->id.instance_id;
+	msg.instance_id = mcfg->id.pvt_id;
 	msg.param_data_size = size;
 	msg.large_param_id = param_id;
 
@@ -1190,7 +1192,7 @@ int skl_get_module_params(struct skl_sst *ctx, u32 *params, int size,
 	struct skl_ipc_large_config_msg msg;
 
 	msg.module_id = mcfg->id.module_id;
-	msg.instance_id = mcfg->id.instance_id;
+	msg.instance_id = mcfg->id.pvt_id;
 	msg.param_data_size = size;
 	msg.large_param_id = param_id;
 
sound/soc/intel/skylake/skl-sst-utils.c +1 -1
index 5f1c203a448e..876b9e04e880 100644
@@ -136,7 +136,7 @@ int snd_skl_get_module_info(struct skl_sst *ctx,
 EXPORT_SYMBOL_GPL(snd_skl_get_module_info);
 
 static inline int skl_getid_32(struct uuid_module *module, u64 *val,
-					int word1_mask, int word2_mask)
+				int word1_mask, int word2_mask)
 {
 	int index, max_inst, pvt_id;
 	u32 mask_val;
sound/soc/intel/skylake/skl-topology.c +7 -3
index 2d475b720963..b6fc374f38b5 100644
@@ -505,12 +505,15 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
 		 * FE/BE params
 		 */
 		skl_tplg_update_module_params(w, ctx);
-
+		mconfig->id.pvt_id = skl_get_pvt_id(ctx, mconfig);
+		if (mconfig->id.pvt_id < 0)
+			return ret;
 		skl_tplg_set_module_init_data(w);
 		ret = skl_init_module(ctx, mconfig);
-		if (ret < 0)
+		if (ret < 0) {
+			skl_put_pvt_id(ctx, mconfig);
 			return ret;
-
+		}
 		skl_tplg_alloc_pipe_mcps(skl, mconfig);
 		ret = skl_tplg_set_module_params(w, ctx);
 		if (ret < 0)
@@ -537,6 +540,7 @@ static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx,
 			if (ret < 0)
 				return -EIO;
 		}
+		skl_put_pvt_id(ctx, mconfig);
 	}
 
 	/* no modules to unload in this path, so return */
Signature · 1 line
2.9.3
author
#10 lore raw

PATCH 7/9 ASoC: Intel: Skylake: Table for module instance id and private id

In reply to Vinod Koul

From: Dharageswari R <[email protected]>

Now that modules ids are generated dynamically, it helps to keep track of generated ids while referring modules, so add a map for each module.

---
 sound/soc/intel/skylake/skl-sst-dsp.h   |  2 ++
 sound/soc/intel/skylake/skl-sst-utils.c | 37 +++++++++++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-sst-dsp.h +2 -0
index b61bd03ee4f0..b9e71d051fb1 100644
@@ -219,6 +219,8 @@ int skl_get_pvt_id(struct skl_sst *ctx,
 				struct skl_module_cfg *mconfig);
 int skl_put_pvt_id(struct skl_sst *ctx,
 				struct skl_module_cfg *mconfig);
+int skl_get_pvt_instance_id_map(struct skl_sst *ctx,
+				int module_id, int instance_id);
 void skl_freeup_uuid_list(struct skl_sst *ctx);
 
 int skl_dsp_strip_extended_manifest(struct firmware *fw);
sound/soc/intel/skylake/skl-sst-utils.c +35 -2
index 64873bc341dd..8b955f93f405 100644
@@ -102,6 +102,7 @@ struct uuid_module {
 	int is_loadable;
 	int max_instance;
 	u64 pvt_id[MAX_INSTANCE_BUFF];
+	int *instance_id;
 
 	struct list_head list;
 };
@@ -140,6 +141,31 @@ int snd_skl_get_module_info(struct skl_sst *ctx,
 }
 EXPORT_SYMBOL_GPL(snd_skl_get_module_info);
 
+static int skl_get_pvtid_map(struct uuid_module *module, int instance_id)
+{
+	int pvt_id;
+
+	for (pvt_id = 0; pvt_id < module->max_instance; pvt_id++) {
+		if (module->instance_id[pvt_id] == instance_id)
+			return pvt_id;
+	}
+	return -EINVAL;
+}
+
+int skl_get_pvt_instance_id_map(struct skl_sst *ctx,
+				int module_id, int instance_id)
+{
+	struct uuid_module *module;
+
+	list_for_each_entry(module, &ctx->uuid_list, list) {
+		if (module->id == module_id)
+			return skl_get_pvtid_map(module, instance_id);
+	}
+
+	return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(skl_get_pvt_instance_id_map);
+
 static inline int skl_getid_32(struct uuid_module *module, u64 *val,
 				int word1_mask, int word2_mask)
 {
@@ -199,8 +225,11 @@ int skl_get_pvt_id(struct skl_sst *ctx, struct skl_module_cfg *mconfig)
 		if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) {
 
 			pvt_id = skl_pvtid_128(module);
-			if (pvt_id >= 0)
+			if (pvt_id >= 0) {
+				module->instance_id[pvt_id] =
+						mconfig->id.instance_id;
 				return pvt_id;
+			}
 		}
 	}
 
@@ -242,7 +271,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
 {
 	struct adsp_fw_hdr *adsp_hdr;
 	struct adsp_module_entry *mod_entry;
-	int i, num_entry;
+	int i, num_entry, size;
 	uuid_le *uuid_bin;
 	const char *buf;
 	struct skl_sst *skl = ctx->thread_context;
@@ -306,6 +335,10 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
 		module->id = (i | (index << 12));
 		module->is_loadable = mod_entry->type.load_type;
 		module->max_instance = mod_entry->instance_max_count;
+		size = sizeof(int) * mod_entry->instance_max_count;
+		module->instance_id = devm_kzalloc(ctx->dev, size, GFP_KERNEL);
+		if (!module->instance_id)
+			return -ENOMEM;
 
 		list_add_tail(&module->list, &skl->uuid_list);
 
Signature · 1 line
1.9.1
maintainer
#11 lore raw

Applied "ASoC: Intel: Skylake: Add table for module id for quick ref" to the asoc tree

The patch

ASoC: Intel: Skylake: Add table for module id for quick ref

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

From: Dharageswari R <[email protected]>
Date: Thu, 22 Sep 2016 14:00:39 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Add table for module id for quick ref

Since modules ids are generated dynamically, we do not know the id associate with modules in another pipelines. This limits our ability to tell DSP about neighbouring modules.

So add a table for quick referencing of allocated module ids.

---
 sound/soc/intel/skylake/skl-sst-dsp.h   |  2 ++
 sound/soc/intel/skylake/skl-sst-utils.c | 37 +++++++++++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-sst-dsp.h +2 -0
index b61bd03ee4f0..b9e71d051fb1 100644
@@ -219,6 +219,8 @@ int skl_get_pvt_id(struct skl_sst *ctx,
 				struct skl_module_cfg *mconfig);
 int skl_put_pvt_id(struct skl_sst *ctx,
 				struct skl_module_cfg *mconfig);
+int skl_get_pvt_instance_id_map(struct skl_sst *ctx,
+				int module_id, int instance_id);
 void skl_freeup_uuid_list(struct skl_sst *ctx);
 
 int skl_dsp_strip_extended_manifest(struct firmware *fw);
sound/soc/intel/skylake/skl-sst-utils.c +35 -2
index 876b9e04e880..1aa0f371b381 100644
@@ -102,6 +102,7 @@ struct uuid_module {
 	int is_loadable;
 	int max_instance;
 	u64 pvt_id[MAX_INSTANCE_BUFF];
+	int *instance_id;
 
 	struct list_head list;
 };
@@ -135,6 +136,31 @@ int snd_skl_get_module_info(struct skl_sst *ctx,
 }
 EXPORT_SYMBOL_GPL(snd_skl_get_module_info);
 
+static int skl_get_pvtid_map(struct uuid_module *module, int instance_id)
+{
+	int pvt_id;
+
+	for (pvt_id = 0; pvt_id < module->max_instance; pvt_id++) {
+		if (module->instance_id[pvt_id] == instance_id)
+			return pvt_id;
+	}
+	return -EINVAL;
+}
+
+int skl_get_pvt_instance_id_map(struct skl_sst *ctx,
+				int module_id, int instance_id)
+{
+	struct uuid_module *module;
+
+	list_for_each_entry(module, &ctx->uuid_list, list) {
+		if (module->id == module_id)
+			return skl_get_pvtid_map(module, instance_id);
+	}
+
+	return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(skl_get_pvt_instance_id_map);
+
 static inline int skl_getid_32(struct uuid_module *module, u64 *val,
 				int word1_mask, int word2_mask)
 {
@@ -203,8 +229,11 @@ int skl_get_pvt_id(struct skl_sst *ctx, struct skl_module_cfg *mconfig)
 		if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) {
 
 			pvt_id = skl_pvtid_128(module);
-			if (pvt_id >= 0)
+			if (pvt_id >= 0) {
+				module->instance_id[pvt_id] =
+						mconfig->id.instance_id;
 				return pvt_id;
+			}
 		}
 	}
 
@@ -254,7 +283,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
 {
 	struct adsp_fw_hdr *adsp_hdr;
 	struct adsp_module_entry *mod_entry;
-	int i, num_entry;
+	int i, num_entry, size;
 	uuid_le *uuid_bin;
 	const char *buf;
 	struct skl_sst *skl = ctx->thread_context;
@@ -318,6 +347,10 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
 		module->id = (i | (index << 12));
 		module->is_loadable = mod_entry->type.load_type;
 		module->max_instance = mod_entry->instance_max_count;
+		size = sizeof(int) * mod_entry->instance_max_count;
+		module->instance_id = devm_kzalloc(ctx->dev, size, GFP_KERNEL);
+		if (!module->instance_id)
+			return -ENOMEM;
 
 		list_add_tail(&module->list, &skl->uuid_list);
 
Signature · 1 line
2.9.3
author
#12 lore raw

PATCH 8/9 ASoC: Intel: Skylake: Override the actual instance id's to pvt_id's

In reply to Vinod Koul

From: Dharageswari R <[email protected]>

Post bind parameters of KPB contains the actual instance id's of modules in the sink path. Override these instance id's with the pvt_id's generated by driver.

---
 sound/soc/intel/skylake/skl-messages.c       |  2 ++
 sound/soc/intel/skylake/skl-topology.c       | 22 ++++++++++++++++++++++
 sound/soc/intel/skylake/skl-topology.h       | 10 ++++++++++
 sound/soc/intel/skylake/skl-tplg-interface.h |  3 ++-
 4 files changed, 36 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl-messages.c +2 -0
index ac0c58e170c3..805b7f2173f3 100644
@@ -680,6 +680,7 @@ static u16 skl_get_module_param_size(struct skl_sst *ctx,
 		return param_size;
 
 	case SKL_MODULE_TYPE_BASE_OUTFMT:
+	case SKL_MODULE_TYPE_KPB:
 		return sizeof(struct skl_base_outfmt_cfg);
 
 	default:
@@ -733,6 +734,7 @@ static int skl_set_module_format(struct skl_sst *ctx,
 		break;
 
 	case SKL_MODULE_TYPE_BASE_OUTFMT:
+	case SKL_MODULE_TYPE_KPB:
 		skl_set_base_outfmt_format(ctx, module_config, *param_data);
 		break;
 
sound/soc/intel/skylake/skl-topology.c +22 -0
index b6fc374f38b5..e48f872505b1 100644
@@ -607,6 +607,26 @@ 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)
+{
+	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;
+
+	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++;
+	}
+	return 0;
+}
+
 /*
  * Some modules require params to be set after the module is bound to
  * all pins connected.
@@ -655,6 +675,8 @@ 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);
sound/soc/intel/skylake/skl-topology.h +10 -0
index def03912b1bd..a519360f42a6 100644
@@ -215,6 +215,16 @@ struct skl_module_fmt {
 
 struct skl_module_cfg;
 
+struct skl_mod_inst_map {
+	u16 mod_id;
+	u16 inst_id;
+};
+
+struct skl_kpb_params {
+	u32 num_modules;
+	struct skl_mod_inst_map map[0];
+};
+
 struct skl_module_inst_id {
 	int module_id;
 	u32 instance_id;
sound/soc/intel/skylake/skl-tplg-interface.h +2 -1
index e208724f9db3..2f6281e056d6 100644
@@ -80,7 +80,8 @@ enum skl_module_type {
 	SKL_MODULE_TYPE_UPDWMIX,
 	SKL_MODULE_TYPE_SRCINT,
 	SKL_MODULE_TYPE_ALGO,
-	SKL_MODULE_TYPE_BASE_OUTFMT
+	SKL_MODULE_TYPE_BASE_OUTFMT,
+	SKL_MODULE_TYPE_KPB,
 };
 
 enum skl_core_affinity {
Signature · 1 line
1.9.1
maintainer
#13 lore raw

Applied "ASoC: Intel: Skylake: Update to use instance ids generated" to the asoc tree

The patch

ASoC: Intel: Skylake: Update to use instance ids generated

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

From: Dharageswari R <[email protected]>
Date: Thu, 22 Sep 2016 14:00:40 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Update to use instance ids generated

Post bind parameters of KPB module contains the instance id's of neighbouring modules in the sink path

Now that module instance ids are generated dynamically we need to update these parameters as well, so use the table created and update the ids

---
 sound/soc/intel/skylake/skl-messages.c       |  2 ++
 sound/soc/intel/skylake/skl-topology.c       | 22 ++++++++++++++++++++++
 sound/soc/intel/skylake/skl-topology.h       | 10 ++++++++++
 sound/soc/intel/skylake/skl-tplg-interface.h |  3 ++-
 4 files changed, 36 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl-messages.c +2 -0
index ac0c58e170c3..805b7f2173f3 100644
@@ -680,6 +680,7 @@ static u16 skl_get_module_param_size(struct skl_sst *ctx,
 		return param_size;
 
 	case SKL_MODULE_TYPE_BASE_OUTFMT:
+	case SKL_MODULE_TYPE_KPB:
 		return sizeof(struct skl_base_outfmt_cfg);
 
 	default:
@@ -733,6 +734,7 @@ static int skl_set_module_format(struct skl_sst *ctx,
 		break;
 
 	case SKL_MODULE_TYPE_BASE_OUTFMT:
+	case SKL_MODULE_TYPE_KPB:
 		skl_set_base_outfmt_format(ctx, module_config, *param_data);
 		break;
 
sound/soc/intel/skylake/skl-topology.c +22 -0
index b6fc374f38b5..e48f872505b1 100644
@@ -607,6 +607,26 @@ 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)
+{
+	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;
+
+	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++;
+	}
+	return 0;
+}
+
 /*
  * Some modules require params to be set after the module is bound to
  * all pins connected.
@@ -655,6 +675,8 @@ 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);
sound/soc/intel/skylake/skl-topology.h +10 -0
index def03912b1bd..a519360f42a6 100644
@@ -215,6 +215,16 @@ struct skl_module_fmt {
 
 struct skl_module_cfg;
 
+struct skl_mod_inst_map {
+	u16 mod_id;
+	u16 inst_id;
+};
+
+struct skl_kpb_params {
+	u32 num_modules;
+	struct skl_mod_inst_map map[0];
+};
+
 struct skl_module_inst_id {
 	int module_id;
 	u32 instance_id;
sound/soc/intel/skylake/skl-tplg-interface.h +2 -1
index e208724f9db3..2f6281e056d6 100644
@@ -80,7 +80,8 @@ enum skl_module_type {
 	SKL_MODULE_TYPE_UPDWMIX,
 	SKL_MODULE_TYPE_SRCINT,
 	SKL_MODULE_TYPE_ALGO,
-	SKL_MODULE_TYPE_BASE_OUTFMT
+	SKL_MODULE_TYPE_BASE_OUTFMT,
+	SKL_MODULE_TYPE_KPB,
 };
 
 enum skl_core_affinity {
Signature · 1 line
2.9.3
author
#14 lore raw

PATCH 9/9 ASoC: Intel: Skylake: Add 32bit support

In reply to Vinod Koul

From: Samaga Krishna <[email protected]>

We also support 32bit playback, so add that in DAI capabilities.

---
 sound/soc/intel/skylake/skl-pcm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl-pcm.c +2 -1
index 77bfd407f2a1..c7cdcba04c5d 100644
@@ -648,7 +648,8 @@ static struct snd_soc_dai_driver skl_platform_dai[] = {
 		.channels_min = HDA_MONO,
 		.channels_max = HDA_STEREO,
 		.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_8000,
-		.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE |
+			SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE,
 	},
 	.capture = {
 		.stream_name = "System Capture",
Signature · 1 line
1.9.1
maintainer
#15 lore raw

Applied "ASoC: Intel: Skylake: Add 32bit support" to the asoc tree

The patch

ASoC: Intel: Skylake: Add 32bit support

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

From: Samaga Krishna <[email protected]>
Date: Wed, 24 Aug 2016 18:03:21 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Add 32bit support

We also support 32bit playback, so add that in DAI capabilities.

---
 sound/soc/intel/skylake/skl-pcm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl-pcm.c +2 -1
index 77bfd407f2a1..c7cdcba04c5d 100644
@@ -648,7 +648,8 @@ static struct snd_soc_dai_driver skl_platform_dai[] = {
 		.channels_min = HDA_MONO,
 		.channels_max = HDA_STEREO,
 		.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_8000,
-		.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE |
+			SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE,
 	},
 	.capture = {
 		.stream_name = "System Capture",
Signature · 1 line
2.8.1
maintainer
#16 lore raw
In reply to Vinod Koul
Quoted 8 lines · Vinod Koul

- The module instance IDs are manged in driver now.

Dharageswari R (5):
ASoC: Intel: Skylake: Unload all the loadable modules
ASoC: Intel: Skylake: Create dynamic instance ids for DSP modules
ASoC: Intel: Skylake: Use private instance id of modules in IPC
ASoC: Intel: Skylake: Table for module instance id and private id
ASoC: Intel: Skylake: Override the actual instance id's to pvt_id's

I really don't understand what the point of these changes is at all, sorry. This makes it really hard to tell if they're doing what they're supposed to.

author
#17 lore raw
Quoted 11 lines · Mark Brown
Quoted 8 lines · Vinod Koul

- The module instance IDs are manged in driver now.

Dharageswari R (5):
ASoC: Intel: Skylake: Unload all the loadable modules
ASoC: Intel: Skylake: Create dynamic instance ids for DSP modules
ASoC: Intel: Skylake: Use private instance id of modules in IPC
ASoC: Intel: Skylake: Table for module instance id and private id
ASoC: Intel: Skylake: Override the actual instance id's to pvt_id's

Quoted 3 lines

I really don't understand what the point of these changes is at all, sorry. This makes it really hard to tell if they're doing what they're supposed to.

No issues, I will try to add more details on these bits.

The point of these changes is to allocate and manage an 'instance id' in kernel.

Topology gives its own ID but thats just a free running values and we may have more instance in complete graph than max allowed instance for that module as not all parts of graph will be operation simultaneously.

So the way is to allocate and manage them in driver. We have used ffz to maintain the ids, but ffz works on 32 bits, the max instance of some modules is more than that so we added implementation on top of ffz for 128bits.

Later the patches use this and add a table for quick ref of used ids for sending to DSPs.

Please do let me know if it helps, will add more details in patch changelogs...

Thanks

Signature · 1 line
~Vinod