aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorDharageswari R <dharageswari.r@intel.com>2016-09-22 04:30:39 -0400
committerMark Brown <broonie@kernel.org>2016-09-24 14:26:26 -0400
commit55a92ea9cf6d6cac2f1be1bf53f0a120656b2060 (patch)
tree28142526cdae6c138f14f8f45b41dc8b8bf183c6 /sound
parent5e8f0ee46de46e709e19675726a46cf5838b9bca (diff)
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. Signed-off-by: Dharageswari R <dharageswari.r@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/skylake/skl-sst-dsp.h2
-rw-r--r--sound/soc/intel/skylake/skl-sst-utils.c37
2 files changed, 37 insertions, 2 deletions
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index b61bd03ee4f0..b9e71d051fb1 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -219,6 +219,8 @@ int skl_get_pvt_id(struct skl_sst *ctx,
219 struct skl_module_cfg *mconfig); 219 struct skl_module_cfg *mconfig);
220int skl_put_pvt_id(struct skl_sst *ctx, 220int skl_put_pvt_id(struct skl_sst *ctx,
221 struct skl_module_cfg *mconfig); 221 struct skl_module_cfg *mconfig);
222int skl_get_pvt_instance_id_map(struct skl_sst *ctx,
223 int module_id, int instance_id);
222void skl_freeup_uuid_list(struct skl_sst *ctx); 224void skl_freeup_uuid_list(struct skl_sst *ctx);
223 225
224int skl_dsp_strip_extended_manifest(struct firmware *fw); 226int skl_dsp_strip_extended_manifest(struct firmware *fw);
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index 876b9e04e880..1aa0f371b381 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -102,6 +102,7 @@ struct uuid_module {
102 int is_loadable; 102 int is_loadable;
103 int max_instance; 103 int max_instance;
104 u64 pvt_id[MAX_INSTANCE_BUFF]; 104 u64 pvt_id[MAX_INSTANCE_BUFF];
105 int *instance_id;
105 106
106 struct list_head list; 107 struct list_head list;
107}; 108};
@@ -135,6 +136,31 @@ int snd_skl_get_module_info(struct skl_sst *ctx,
135} 136}
136EXPORT_SYMBOL_GPL(snd_skl_get_module_info); 137EXPORT_SYMBOL_GPL(snd_skl_get_module_info);
137 138
139static int skl_get_pvtid_map(struct uuid_module *module, int instance_id)
140{
141 int pvt_id;
142
143 for (pvt_id = 0; pvt_id < module->max_instance; pvt_id++) {
144 if (module->instance_id[pvt_id] == instance_id)
145 return pvt_id;
146 }
147 return -EINVAL;
148}
149
150int skl_get_pvt_instance_id_map(struct skl_sst *ctx,
151 int module_id, int instance_id)
152{
153 struct uuid_module *module;
154
155 list_for_each_entry(module, &ctx->uuid_list, list) {
156 if (module->id == module_id)
157 return skl_get_pvtid_map(module, instance_id);
158 }
159
160 return -EINVAL;
161}
162EXPORT_SYMBOL_GPL(skl_get_pvt_instance_id_map);
163
138static inline int skl_getid_32(struct uuid_module *module, u64 *val, 164static inline int skl_getid_32(struct uuid_module *module, u64 *val,
139 int word1_mask, int word2_mask) 165 int word1_mask, int word2_mask)
140{ 166{
@@ -203,8 +229,11 @@ int skl_get_pvt_id(struct skl_sst *ctx, struct skl_module_cfg *mconfig)
203 if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) { 229 if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) {
204 230
205 pvt_id = skl_pvtid_128(module); 231 pvt_id = skl_pvtid_128(module);
206 if (pvt_id >= 0) 232 if (pvt_id >= 0) {
233 module->instance_id[pvt_id] =
234 mconfig->id.instance_id;
207 return pvt_id; 235 return pvt_id;
236 }
208 } 237 }
209 } 238 }
210 239
@@ -254,7 +283,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
254{ 283{
255 struct adsp_fw_hdr *adsp_hdr; 284 struct adsp_fw_hdr *adsp_hdr;
256 struct adsp_module_entry *mod_entry; 285 struct adsp_module_entry *mod_entry;
257 int i, num_entry; 286 int i, num_entry, size;
258 uuid_le *uuid_bin; 287 uuid_le *uuid_bin;
259 const char *buf; 288 const char *buf;
260 struct skl_sst *skl = ctx->thread_context; 289 struct skl_sst *skl = ctx->thread_context;
@@ -318,6 +347,10 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
318 module->id = (i | (index << 12)); 347 module->id = (i | (index << 12));
319 module->is_loadable = mod_entry->type.load_type; 348 module->is_loadable = mod_entry->type.load_type;
320 module->max_instance = mod_entry->instance_max_count; 349 module->max_instance = mod_entry->instance_max_count;
350 size = sizeof(int) * mod_entry->instance_max_count;
351 module->instance_id = devm_kzalloc(ctx->dev, size, GFP_KERNEL);
352 if (!module->instance_id)
353 return -ENOMEM;
321 354
322 list_add_tail(&module->list, &skl->uuid_list); 355 list_add_tail(&module->list, &skl->uuid_list);
323 356