diff options
Diffstat (limited to 'sound/soc/intel/skylake/skl-messages.c')
-rw-r--r-- | sound/soc/intel/skylake/skl-messages.c | 280 |
1 files changed, 153 insertions, 127 deletions
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c index 50a109503a3f..de6dac496a0d 100644 --- a/sound/soc/intel/skylake/skl-messages.c +++ b/sound/soc/intel/skylake/skl-messages.c | |||
@@ -96,7 +96,7 @@ int skl_init_dsp(struct skl *skl) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | ret = skl_sst_dsp_init(bus->dev, mmio_base, irq, | 98 | ret = skl_sst_dsp_init(bus->dev, mmio_base, irq, |
99 | loader_ops, &skl->skl_sst); | 99 | skl->fw_name, loader_ops, &skl->skl_sst); |
100 | if (ret < 0) | 100 | if (ret < 0) |
101 | return ret; | 101 | return ret; |
102 | 102 | ||
@@ -182,94 +182,6 @@ enum skl_bitdepth skl_get_bit_depth(int params) | |||
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | static u32 skl_create_channel_map(enum skl_ch_cfg ch_cfg) | ||
186 | { | ||
187 | u32 config; | ||
188 | |||
189 | switch (ch_cfg) { | ||
190 | case SKL_CH_CFG_MONO: | ||
191 | config = (0xFFFFFFF0 | SKL_CHANNEL_LEFT); | ||
192 | break; | ||
193 | |||
194 | case SKL_CH_CFG_STEREO: | ||
195 | config = (0xFFFFFF00 | SKL_CHANNEL_LEFT | ||
196 | | (SKL_CHANNEL_RIGHT << 4)); | ||
197 | break; | ||
198 | |||
199 | case SKL_CH_CFG_2_1: | ||
200 | config = (0xFFFFF000 | SKL_CHANNEL_LEFT | ||
201 | | (SKL_CHANNEL_RIGHT << 4) | ||
202 | | (SKL_CHANNEL_LFE << 8)); | ||
203 | break; | ||
204 | |||
205 | case SKL_CH_CFG_3_0: | ||
206 | config = (0xFFFFF000 | SKL_CHANNEL_LEFT | ||
207 | | (SKL_CHANNEL_CENTER << 4) | ||
208 | | (SKL_CHANNEL_RIGHT << 8)); | ||
209 | break; | ||
210 | |||
211 | case SKL_CH_CFG_3_1: | ||
212 | config = (0xFFFF0000 | SKL_CHANNEL_LEFT | ||
213 | | (SKL_CHANNEL_CENTER << 4) | ||
214 | | (SKL_CHANNEL_RIGHT << 8) | ||
215 | | (SKL_CHANNEL_LFE << 12)); | ||
216 | break; | ||
217 | |||
218 | case SKL_CH_CFG_QUATRO: | ||
219 | config = (0xFFFF0000 | SKL_CHANNEL_LEFT | ||
220 | | (SKL_CHANNEL_RIGHT << 4) | ||
221 | | (SKL_CHANNEL_LEFT_SURROUND << 8) | ||
222 | | (SKL_CHANNEL_RIGHT_SURROUND << 12)); | ||
223 | break; | ||
224 | |||
225 | case SKL_CH_CFG_4_0: | ||
226 | config = (0xFFFF0000 | SKL_CHANNEL_LEFT | ||
227 | | (SKL_CHANNEL_CENTER << 4) | ||
228 | | (SKL_CHANNEL_RIGHT << 8) | ||
229 | | (SKL_CHANNEL_CENTER_SURROUND << 12)); | ||
230 | break; | ||
231 | |||
232 | case SKL_CH_CFG_5_0: | ||
233 | config = (0xFFF00000 | SKL_CHANNEL_LEFT | ||
234 | | (SKL_CHANNEL_CENTER << 4) | ||
235 | | (SKL_CHANNEL_RIGHT << 8) | ||
236 | | (SKL_CHANNEL_LEFT_SURROUND << 12) | ||
237 | | (SKL_CHANNEL_RIGHT_SURROUND << 16)); | ||
238 | break; | ||
239 | |||
240 | case SKL_CH_CFG_5_1: | ||
241 | config = (0xFF000000 | SKL_CHANNEL_CENTER | ||
242 | | (SKL_CHANNEL_LEFT << 4) | ||
243 | | (SKL_CHANNEL_RIGHT << 8) | ||
244 | | (SKL_CHANNEL_LEFT_SURROUND << 12) | ||
245 | | (SKL_CHANNEL_RIGHT_SURROUND << 16) | ||
246 | | (SKL_CHANNEL_LFE << 20)); | ||
247 | break; | ||
248 | |||
249 | case SKL_CH_CFG_DUAL_MONO: | ||
250 | config = (0xFFFFFF00 | SKL_CHANNEL_LEFT | ||
251 | | (SKL_CHANNEL_LEFT << 4)); | ||
252 | break; | ||
253 | |||
254 | case SKL_CH_CFG_I2S_DUAL_STEREO_0: | ||
255 | config = (0xFFFFFF00 | SKL_CHANNEL_LEFT | ||
256 | | (SKL_CHANNEL_RIGHT << 4)); | ||
257 | break; | ||
258 | |||
259 | case SKL_CH_CFG_I2S_DUAL_STEREO_1: | ||
260 | config = (0xFFFF00FF | (SKL_CHANNEL_LEFT << 8) | ||
261 | | (SKL_CHANNEL_RIGHT << 12)); | ||
262 | break; | ||
263 | |||
264 | default: | ||
265 | config = 0xFFFFFFFF; | ||
266 | break; | ||
267 | |||
268 | } | ||
269 | |||
270 | return config; | ||
271 | } | ||
272 | |||
273 | /* | 185 | /* |
274 | * Each module in DSP expects a base module configuration, which consists of | 186 | * Each module in DSP expects a base module configuration, which consists of |
275 | * PCM format information, which we calculate in driver and resource values | 187 | * PCM format information, which we calculate in driver and resource values |
@@ -280,7 +192,7 @@ static void skl_set_base_module_format(struct skl_sst *ctx, | |||
280 | struct skl_module_cfg *mconfig, | 192 | struct skl_module_cfg *mconfig, |
281 | struct skl_base_cfg *base_cfg) | 193 | struct skl_base_cfg *base_cfg) |
282 | { | 194 | { |
283 | struct skl_module_fmt *format = &mconfig->in_fmt; | 195 | struct skl_module_fmt *format = &mconfig->in_fmt[0]; |
284 | 196 | ||
285 | base_cfg->audio_fmt.number_of_channels = (u8)format->channels; | 197 | base_cfg->audio_fmt.number_of_channels = (u8)format->channels; |
286 | 198 | ||
@@ -293,14 +205,14 @@ static void skl_set_base_module_format(struct skl_sst *ctx, | |||
293 | format->bit_depth, format->valid_bit_depth, | 205 | format->bit_depth, format->valid_bit_depth, |
294 | format->ch_cfg); | 206 | format->ch_cfg); |
295 | 207 | ||
296 | base_cfg->audio_fmt.channel_map = skl_create_channel_map( | 208 | base_cfg->audio_fmt.channel_map = format->ch_map; |
297 | base_cfg->audio_fmt.ch_cfg); | ||
298 | 209 | ||
299 | base_cfg->audio_fmt.interleaving = SKL_INTERLEAVING_PER_CHANNEL; | 210 | base_cfg->audio_fmt.interleaving = format->interleaving_style; |
300 | 211 | ||
301 | base_cfg->cps = mconfig->mcps; | 212 | base_cfg->cps = mconfig->mcps; |
302 | base_cfg->ibs = mconfig->ibs; | 213 | base_cfg->ibs = mconfig->ibs; |
303 | base_cfg->obs = mconfig->obs; | 214 | base_cfg->obs = mconfig->obs; |
215 | base_cfg->is_pages = mconfig->mem_pages; | ||
304 | } | 216 | } |
305 | 217 | ||
306 | /* | 218 | /* |
@@ -399,7 +311,7 @@ static void skl_setup_out_format(struct skl_sst *ctx, | |||
399 | struct skl_module_cfg *mconfig, | 311 | struct skl_module_cfg *mconfig, |
400 | struct skl_audio_data_format *out_fmt) | 312 | struct skl_audio_data_format *out_fmt) |
401 | { | 313 | { |
402 | struct skl_module_fmt *format = &mconfig->out_fmt; | 314 | struct skl_module_fmt *format = &mconfig->out_fmt[0]; |
403 | 315 | ||
404 | out_fmt->number_of_channels = (u8)format->channels; | 316 | out_fmt->number_of_channels = (u8)format->channels; |
405 | out_fmt->s_freq = format->s_freq; | 317 | out_fmt->s_freq = format->s_freq; |
@@ -407,8 +319,9 @@ static void skl_setup_out_format(struct skl_sst *ctx, | |||
407 | out_fmt->valid_bit_depth = format->valid_bit_depth; | 319 | out_fmt->valid_bit_depth = format->valid_bit_depth; |
408 | out_fmt->ch_cfg = format->ch_cfg; | 320 | out_fmt->ch_cfg = format->ch_cfg; |
409 | 321 | ||
410 | out_fmt->channel_map = skl_create_channel_map(out_fmt->ch_cfg); | 322 | out_fmt->channel_map = format->ch_map; |
411 | out_fmt->interleaving = SKL_INTERLEAVING_PER_CHANNEL; | 323 | out_fmt->interleaving = format->interleaving_style; |
324 | out_fmt->sample_type = format->sample_type; | ||
412 | 325 | ||
413 | dev_dbg(ctx->dev, "copier out format chan=%d fre=%d bitdepth=%d\n", | 326 | dev_dbg(ctx->dev, "copier out format chan=%d fre=%d bitdepth=%d\n", |
414 | out_fmt->number_of_channels, format->s_freq, format->bit_depth); | 327 | out_fmt->number_of_channels, format->s_freq, format->bit_depth); |
@@ -423,7 +336,7 @@ static void skl_set_src_format(struct skl_sst *ctx, | |||
423 | struct skl_module_cfg *mconfig, | 336 | struct skl_module_cfg *mconfig, |
424 | struct skl_src_module_cfg *src_mconfig) | 337 | struct skl_src_module_cfg *src_mconfig) |
425 | { | 338 | { |
426 | struct skl_module_fmt *fmt = &mconfig->out_fmt; | 339 | struct skl_module_fmt *fmt = &mconfig->out_fmt[0]; |
427 | 340 | ||
428 | skl_set_base_module_format(ctx, mconfig, | 341 | skl_set_base_module_format(ctx, mconfig, |
429 | (struct skl_base_cfg *)src_mconfig); | 342 | (struct skl_base_cfg *)src_mconfig); |
@@ -440,7 +353,7 @@ static void skl_set_updown_mixer_format(struct skl_sst *ctx, | |||
440 | struct skl_module_cfg *mconfig, | 353 | struct skl_module_cfg *mconfig, |
441 | struct skl_up_down_mixer_cfg *mixer_mconfig) | 354 | struct skl_up_down_mixer_cfg *mixer_mconfig) |
442 | { | 355 | { |
443 | struct skl_module_fmt *fmt = &mconfig->out_fmt; | 356 | struct skl_module_fmt *fmt = &mconfig->out_fmt[0]; |
444 | int i = 0; | 357 | int i = 0; |
445 | 358 | ||
446 | skl_set_base_module_format(ctx, mconfig, | 359 | skl_set_base_module_format(ctx, mconfig, |
@@ -475,6 +388,47 @@ static void skl_set_copier_format(struct skl_sst *ctx, | |||
475 | skl_setup_cpr_gateway_cfg(ctx, mconfig, cpr_mconfig); | 388 | skl_setup_cpr_gateway_cfg(ctx, mconfig, cpr_mconfig); |
476 | } | 389 | } |
477 | 390 | ||
391 | /* | ||
392 | * Algo module are DSP pre processing modules. Algo module take base module | ||
393 | * configuration and params | ||
394 | */ | ||
395 | |||
396 | static void skl_set_algo_format(struct skl_sst *ctx, | ||
397 | struct skl_module_cfg *mconfig, | ||
398 | struct skl_algo_cfg *algo_mcfg) | ||
399 | { | ||
400 | struct skl_base_cfg *base_cfg = (struct skl_base_cfg *)algo_mcfg; | ||
401 | |||
402 | skl_set_base_module_format(ctx, mconfig, base_cfg); | ||
403 | |||
404 | if (mconfig->formats_config.caps_size == 0) | ||
405 | return; | ||
406 | |||
407 | memcpy(algo_mcfg->params, | ||
408 | mconfig->formats_config.caps, | ||
409 | mconfig->formats_config.caps_size); | ||
410 | |||
411 | } | ||
412 | |||
413 | /* | ||
414 | * Mic select module allows selecting one or many input channels, thus | ||
415 | * acting as a demux. | ||
416 | * | ||
417 | * Mic select module take base module configuration and out-format | ||
418 | * configuration | ||
419 | */ | ||
420 | static void skl_set_base_outfmt_format(struct skl_sst *ctx, | ||
421 | struct skl_module_cfg *mconfig, | ||
422 | struct skl_base_outfmt_cfg *base_outfmt_mcfg) | ||
423 | { | ||
424 | struct skl_audio_data_format *out_fmt = &base_outfmt_mcfg->out_fmt; | ||
425 | struct skl_base_cfg *base_cfg = | ||
426 | (struct skl_base_cfg *)base_outfmt_mcfg; | ||
427 | |||
428 | skl_set_base_module_format(ctx, mconfig, base_cfg); | ||
429 | skl_setup_out_format(ctx, mconfig, out_fmt); | ||
430 | } | ||
431 | |||
478 | static u16 skl_get_module_param_size(struct skl_sst *ctx, | 432 | static u16 skl_get_module_param_size(struct skl_sst *ctx, |
479 | struct skl_module_cfg *mconfig) | 433 | struct skl_module_cfg *mconfig) |
480 | { | 434 | { |
@@ -492,6 +446,14 @@ static u16 skl_get_module_param_size(struct skl_sst *ctx, | |||
492 | case SKL_MODULE_TYPE_UPDWMIX: | 446 | case SKL_MODULE_TYPE_UPDWMIX: |
493 | return sizeof(struct skl_up_down_mixer_cfg); | 447 | return sizeof(struct skl_up_down_mixer_cfg); |
494 | 448 | ||
449 | case SKL_MODULE_TYPE_ALGO: | ||
450 | param_size = sizeof(struct skl_base_cfg); | ||
451 | param_size += mconfig->formats_config.caps_size; | ||
452 | return param_size; | ||
453 | |||
454 | case SKL_MODULE_TYPE_BASE_OUTFMT: | ||
455 | return sizeof(struct skl_base_outfmt_cfg); | ||
456 | |||
495 | default: | 457 | default: |
496 | /* | 458 | /* |
497 | * return only base cfg when no specific module type is | 459 | * return only base cfg when no specific module type is |
@@ -538,6 +500,14 @@ static int skl_set_module_format(struct skl_sst *ctx, | |||
538 | skl_set_updown_mixer_format(ctx, module_config, *param_data); | 500 | skl_set_updown_mixer_format(ctx, module_config, *param_data); |
539 | break; | 501 | break; |
540 | 502 | ||
503 | case SKL_MODULE_TYPE_ALGO: | ||
504 | skl_set_algo_format(ctx, module_config, *param_data); | ||
505 | break; | ||
506 | |||
507 | case SKL_MODULE_TYPE_BASE_OUTFMT: | ||
508 | skl_set_base_outfmt_format(ctx, module_config, *param_data); | ||
509 | break; | ||
510 | |||
541 | default: | 511 | default: |
542 | skl_set_base_module_format(ctx, module_config, *param_data); | 512 | skl_set_base_module_format(ctx, module_config, *param_data); |
543 | break; | 513 | break; |
@@ -571,10 +541,10 @@ static int skl_get_queue_index(struct skl_module_pin *mpin, | |||
571 | * In static, the pin_index is fixed based on module_id and instance id | 541 | * In static, the pin_index is fixed based on module_id and instance id |
572 | */ | 542 | */ |
573 | static int skl_alloc_queue(struct skl_module_pin *mpin, | 543 | static int skl_alloc_queue(struct skl_module_pin *mpin, |
574 | struct skl_module_inst_id id, int max) | 544 | struct skl_module_cfg *tgt_cfg, int max) |
575 | { | 545 | { |
576 | int i; | 546 | int i; |
577 | 547 | struct skl_module_inst_id id = tgt_cfg->id; | |
578 | /* | 548 | /* |
579 | * if pin in dynamic, find first free pin | 549 | * if pin in dynamic, find first free pin |
580 | * otherwise find match module and instance id pin as topology will | 550 | * otherwise find match module and instance id pin as topology will |
@@ -583,16 +553,23 @@ static int skl_alloc_queue(struct skl_module_pin *mpin, | |||
583 | */ | 553 | */ |
584 | for (i = 0; i < max; i++) { | 554 | for (i = 0; i < max; i++) { |
585 | if (mpin[i].is_dynamic) { | 555 | if (mpin[i].is_dynamic) { |
586 | if (!mpin[i].in_use) { | 556 | if (!mpin[i].in_use && |
557 | mpin[i].pin_state == SKL_PIN_UNBIND) { | ||
558 | |||
587 | mpin[i].in_use = true; | 559 | mpin[i].in_use = true; |
588 | mpin[i].id.module_id = id.module_id; | 560 | mpin[i].id.module_id = id.module_id; |
589 | mpin[i].id.instance_id = id.instance_id; | 561 | mpin[i].id.instance_id = id.instance_id; |
562 | mpin[i].tgt_mcfg = tgt_cfg; | ||
590 | return i; | 563 | return i; |
591 | } | 564 | } |
592 | } else { | 565 | } else { |
593 | if (mpin[i].id.module_id == id.module_id && | 566 | if (mpin[i].id.module_id == id.module_id && |
594 | mpin[i].id.instance_id == id.instance_id) | 567 | mpin[i].id.instance_id == id.instance_id && |
568 | mpin[i].pin_state == SKL_PIN_UNBIND) { | ||
569 | |||
570 | mpin[i].tgt_mcfg = tgt_cfg; | ||
595 | return i; | 571 | return i; |
572 | } | ||
596 | } | 573 | } |
597 | } | 574 | } |
598 | 575 | ||
@@ -606,6 +583,28 @@ static void skl_free_queue(struct skl_module_pin *mpin, int q_index) | |||
606 | mpin[q_index].id.module_id = 0; | 583 | mpin[q_index].id.module_id = 0; |
607 | mpin[q_index].id.instance_id = 0; | 584 | mpin[q_index].id.instance_id = 0; |
608 | } | 585 | } |
586 | mpin[q_index].pin_state = SKL_PIN_UNBIND; | ||
587 | mpin[q_index].tgt_mcfg = NULL; | ||
588 | } | ||
589 | |||
590 | /* Module state will be set to unint, if all the out pin state is UNBIND */ | ||
591 | |||
592 | static void skl_clear_module_state(struct skl_module_pin *mpin, int max, | ||
593 | struct skl_module_cfg *mcfg) | ||
594 | { | ||
595 | int i; | ||
596 | bool found = false; | ||
597 | |||
598 | for (i = 0; i < max; i++) { | ||
599 | if (mpin[i].pin_state == SKL_PIN_UNBIND) | ||
600 | continue; | ||
601 | found = true; | ||
602 | break; | ||
603 | } | ||
604 | |||
605 | if (!found) | ||
606 | mcfg->m_state = SKL_MODULE_UNINIT; | ||
607 | return; | ||
609 | } | 608 | } |
610 | 609 | ||
611 | /* | 610 | /* |
@@ -615,7 +614,7 @@ static void skl_free_queue(struct skl_module_pin *mpin, int q_index) | |||
615 | * invoke the DSP by sending IPC INIT_INSTANCE using ipc helper | 614 | * invoke the DSP by sending IPC INIT_INSTANCE using ipc helper |
616 | */ | 615 | */ |
617 | int skl_init_module(struct skl_sst *ctx, | 616 | int skl_init_module(struct skl_sst *ctx, |
618 | struct skl_module_cfg *mconfig, char *param) | 617 | struct skl_module_cfg *mconfig) |
619 | { | 618 | { |
620 | u16 module_config_size = 0; | 619 | u16 module_config_size = 0; |
621 | void *param_data = NULL; | 620 | void *param_data = NULL; |
@@ -682,37 +681,30 @@ int skl_unbind_modules(struct skl_sst *ctx, | |||
682 | struct skl_module_inst_id dst_id = dst_mcfg->id; | 681 | struct skl_module_inst_id dst_id = dst_mcfg->id; |
683 | int in_max = dst_mcfg->max_in_queue; | 682 | int in_max = dst_mcfg->max_in_queue; |
684 | int out_max = src_mcfg->max_out_queue; | 683 | int out_max = src_mcfg->max_out_queue; |
685 | int src_index, dst_index; | 684 | int src_index, dst_index, src_pin_state, dst_pin_state; |
686 | 685 | ||
687 | skl_dump_bind_info(ctx, src_mcfg, dst_mcfg); | 686 | skl_dump_bind_info(ctx, src_mcfg, dst_mcfg); |
688 | 687 | ||
689 | if (src_mcfg->m_state != SKL_MODULE_BIND_DONE) | ||
690 | return 0; | ||
691 | |||
692 | /* | ||
693 | * if intra module unbind, check if both modules are BIND, | ||
694 | * then send unbind | ||
695 | */ | ||
696 | if ((src_mcfg->pipe->ppl_id != dst_mcfg->pipe->ppl_id) && | ||
697 | dst_mcfg->m_state != SKL_MODULE_BIND_DONE) | ||
698 | return 0; | ||
699 | else if (src_mcfg->m_state < SKL_MODULE_INIT_DONE && | ||
700 | dst_mcfg->m_state < SKL_MODULE_INIT_DONE) | ||
701 | return 0; | ||
702 | |||
703 | /* get src queue index */ | 688 | /* get src queue index */ |
704 | src_index = skl_get_queue_index(src_mcfg->m_out_pin, dst_id, out_max); | 689 | src_index = skl_get_queue_index(src_mcfg->m_out_pin, dst_id, out_max); |
705 | if (src_index < 0) | 690 | if (src_index < 0) |
706 | return -EINVAL; | 691 | return -EINVAL; |
707 | 692 | ||
708 | msg.src_queue = src_mcfg->m_out_pin[src_index].pin_index; | 693 | msg.src_queue = src_index; |
709 | 694 | ||
710 | /* get dst queue index */ | 695 | /* get dst queue index */ |
711 | dst_index = skl_get_queue_index(dst_mcfg->m_in_pin, src_id, in_max); | 696 | dst_index = skl_get_queue_index(dst_mcfg->m_in_pin, src_id, in_max); |
712 | if (dst_index < 0) | 697 | if (dst_index < 0) |
713 | return -EINVAL; | 698 | return -EINVAL; |
714 | 699 | ||
715 | msg.dst_queue = dst_mcfg->m_in_pin[dst_index].pin_index; | 700 | msg.dst_queue = dst_index; |
701 | |||
702 | src_pin_state = src_mcfg->m_out_pin[src_index].pin_state; | ||
703 | dst_pin_state = dst_mcfg->m_in_pin[dst_index].pin_state; | ||
704 | |||
705 | if (src_pin_state != SKL_PIN_BIND_DONE || | ||
706 | dst_pin_state != SKL_PIN_BIND_DONE) | ||
707 | return 0; | ||
716 | 708 | ||
717 | msg.module_id = src_mcfg->id.module_id; | 709 | msg.module_id = src_mcfg->id.module_id; |
718 | msg.instance_id = src_mcfg->id.instance_id; | 710 | msg.instance_id = src_mcfg->id.instance_id; |
@@ -722,10 +714,15 @@ int skl_unbind_modules(struct skl_sst *ctx, | |||
722 | 714 | ||
723 | ret = skl_ipc_bind_unbind(&ctx->ipc, &msg); | 715 | ret = skl_ipc_bind_unbind(&ctx->ipc, &msg); |
724 | if (!ret) { | 716 | if (!ret) { |
725 | src_mcfg->m_state = SKL_MODULE_UNINIT; | ||
726 | /* free queue only if unbind is success */ | 717 | /* free queue only if unbind is success */ |
727 | skl_free_queue(src_mcfg->m_out_pin, src_index); | 718 | skl_free_queue(src_mcfg->m_out_pin, src_index); |
728 | skl_free_queue(dst_mcfg->m_in_pin, dst_index); | 719 | skl_free_queue(dst_mcfg->m_in_pin, dst_index); |
720 | |||
721 | /* | ||
722 | * check only if src module bind state, bind is | ||
723 | * always from src -> sink | ||
724 | */ | ||
725 | skl_clear_module_state(src_mcfg->m_out_pin, out_max, src_mcfg); | ||
729 | } | 726 | } |
730 | 727 | ||
731 | return ret; | 728 | return ret; |
@@ -744,8 +741,6 @@ int skl_bind_modules(struct skl_sst *ctx, | |||
744 | { | 741 | { |
745 | int ret; | 742 | int ret; |
746 | struct skl_ipc_bind_unbind_msg msg; | 743 | struct skl_ipc_bind_unbind_msg msg; |
747 | struct skl_module_inst_id src_id = src_mcfg->id; | ||
748 | struct skl_module_inst_id dst_id = dst_mcfg->id; | ||
749 | int in_max = dst_mcfg->max_in_queue; | 744 | int in_max = dst_mcfg->max_in_queue; |
750 | int out_max = src_mcfg->max_out_queue; | 745 | int out_max = src_mcfg->max_out_queue; |
751 | int src_index, dst_index; | 746 | int src_index, dst_index; |
@@ -756,18 +751,18 @@ int skl_bind_modules(struct skl_sst *ctx, | |||
756 | dst_mcfg->m_state < SKL_MODULE_INIT_DONE) | 751 | dst_mcfg->m_state < SKL_MODULE_INIT_DONE) |
757 | return 0; | 752 | return 0; |
758 | 753 | ||
759 | src_index = skl_alloc_queue(src_mcfg->m_out_pin, dst_id, out_max); | 754 | src_index = skl_alloc_queue(src_mcfg->m_out_pin, dst_mcfg, out_max); |
760 | if (src_index < 0) | 755 | if (src_index < 0) |
761 | return -EINVAL; | 756 | return -EINVAL; |
762 | 757 | ||
763 | msg.src_queue = src_mcfg->m_out_pin[src_index].pin_index; | 758 | msg.src_queue = src_index; |
764 | dst_index = skl_alloc_queue(dst_mcfg->m_in_pin, src_id, in_max); | 759 | dst_index = skl_alloc_queue(dst_mcfg->m_in_pin, src_mcfg, in_max); |
765 | if (dst_index < 0) { | 760 | if (dst_index < 0) { |
766 | skl_free_queue(src_mcfg->m_out_pin, src_index); | 761 | skl_free_queue(src_mcfg->m_out_pin, src_index); |
767 | return -EINVAL; | 762 | return -EINVAL; |
768 | } | 763 | } |
769 | 764 | ||
770 | msg.dst_queue = dst_mcfg->m_in_pin[dst_index].pin_index; | 765 | msg.dst_queue = dst_index; |
771 | 766 | ||
772 | dev_dbg(ctx->dev, "src queue = %d dst queue =%d\n", | 767 | dev_dbg(ctx->dev, "src queue = %d dst queue =%d\n", |
773 | msg.src_queue, msg.dst_queue); | 768 | msg.src_queue, msg.dst_queue); |
@@ -782,6 +777,8 @@ int skl_bind_modules(struct skl_sst *ctx, | |||
782 | 777 | ||
783 | if (!ret) { | 778 | if (!ret) { |
784 | src_mcfg->m_state = SKL_MODULE_BIND_DONE; | 779 | src_mcfg->m_state = SKL_MODULE_BIND_DONE; |
780 | src_mcfg->m_out_pin[src_index].pin_state = SKL_PIN_BIND_DONE; | ||
781 | dst_mcfg->m_in_pin[dst_index].pin_state = SKL_PIN_BIND_DONE; | ||
785 | } else { | 782 | } else { |
786 | /* error case , if IPC fails, clear the queue index */ | 783 | /* error case , if IPC fails, clear the queue index */ |
787 | skl_free_queue(src_mcfg->m_out_pin, src_index); | 784 | skl_free_queue(src_mcfg->m_out_pin, src_index); |
@@ -852,6 +849,8 @@ int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe) | |||
852 | ret = skl_ipc_delete_pipeline(&ctx->ipc, pipe->ppl_id); | 849 | ret = skl_ipc_delete_pipeline(&ctx->ipc, pipe->ppl_id); |
853 | if (ret < 0) | 850 | if (ret < 0) |
854 | dev_err(ctx->dev, "Failed to delete pipeline\n"); | 851 | dev_err(ctx->dev, "Failed to delete pipeline\n"); |
852 | |||
853 | pipe->state = SKL_PIPE_INVALID; | ||
855 | } | 854 | } |
856 | 855 | ||
857 | return ret; | 856 | return ret; |
@@ -916,3 +915,30 @@ int skl_stop_pipe(struct skl_sst *ctx, struct skl_pipe *pipe) | |||
916 | 915 | ||
917 | return 0; | 916 | return 0; |
918 | } | 917 | } |
918 | |||
919 | /* Algo parameter set helper function */ | ||
920 | int skl_set_module_params(struct skl_sst *ctx, u32 *params, int size, | ||
921 | u32 param_id, struct skl_module_cfg *mcfg) | ||
922 | { | ||
923 | struct skl_ipc_large_config_msg msg; | ||
924 | |||
925 | msg.module_id = mcfg->id.module_id; | ||
926 | msg.instance_id = mcfg->id.instance_id; | ||
927 | msg.param_data_size = size; | ||
928 | msg.large_param_id = param_id; | ||
929 | |||
930 | return skl_ipc_set_large_config(&ctx->ipc, &msg, params); | ||
931 | } | ||
932 | |||
933 | int skl_get_module_params(struct skl_sst *ctx, u32 *params, int size, | ||
934 | u32 param_id, struct skl_module_cfg *mcfg) | ||
935 | { | ||
936 | struct skl_ipc_large_config_msg msg; | ||
937 | |||
938 | msg.module_id = mcfg->id.module_id; | ||
939 | msg.instance_id = mcfg->id.instance_id; | ||
940 | msg.param_data_size = size; | ||
941 | msg.large_param_id = param_id; | ||
942 | |||
943 | return skl_ipc_get_large_config(&ctx->ipc, &msg, params); | ||
944 | } | ||