aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/skylake
diff options
context:
space:
mode:
authorJeeja KP <jeeja.kp@intel.com>2016-03-28 12:41:31 -0400
committerMark Brown <broonie@kernel.org>2016-03-28 05:38:00 -0400
commit4f329d9fbab630af44db2f787eb79ca52e6ba22e (patch)
tree88b0dc6e499f501ba2a69760d28536293ba69ebc /sound/soc/intel/skylake
parentd643678b9a4e432a574b2ec601216afd720c69b6 (diff)
ASoC: Intel: Skylake: Fix DSP resource de-allocation
In PRE PMD of widget handler DSP resources are allocated after the creation of DSP pipe and modules and in POST PMD DSP resources are destroyed. If there is any failure in pipe or module creation in PRE PMD, pcm trigger fails and finally POST PMD gets called and DSP resources are freed, without getting allocated. Fixes the DSP resource de-allocation by allocating the resource before creation of pipe and module in PRE PMD and in POST PMD, free the resources. Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/skylake')
-rw-r--r--sound/soc/intel/skylake/skl-topology.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 3f393cbe1bfe..5a85f3a4699b 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -485,6 +485,8 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
485 if (!skl_is_pipe_mcps_avail(skl, mconfig)) 485 if (!skl_is_pipe_mcps_avail(skl, mconfig))
486 return -ENOMEM; 486 return -ENOMEM;
487 487
488 skl_tplg_alloc_pipe_mcps(skl, mconfig);
489
488 if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) { 490 if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) {
489 ret = ctx->dsp->fw_ops.load_mod(ctx->dsp, 491 ret = ctx->dsp->fw_ops.load_mod(ctx->dsp,
490 mconfig->id.module_id, mconfig->guid); 492 mconfig->id.module_id, mconfig->guid);
@@ -511,7 +513,6 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
511 ret = skl_tplg_set_module_params(w, ctx); 513 ret = skl_tplg_set_module_params(w, ctx);
512 if (ret < 0) 514 if (ret < 0)
513 return ret; 515 return ret;
514 skl_tplg_alloc_pipe_mcps(skl, mconfig);
515 } 516 }
516 517
517 return 0; 518 return 0;
@@ -561,6 +562,9 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
561 if (!skl_is_pipe_mem_avail(skl, mconfig)) 562 if (!skl_is_pipe_mem_avail(skl, mconfig))
562 return -ENOMEM; 563 return -ENOMEM;
563 564
565 skl_tplg_alloc_pipe_mem(skl, mconfig);
566 skl_tplg_alloc_pipe_mcps(skl, mconfig);
567
564 /* 568 /*
565 * Create a list of modules for pipe. 569 * Create a list of modules for pipe.
566 * This list contains modules from source to sink 570 * This list contains modules from source to sink
@@ -604,9 +608,6 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
604 src_module = dst_module; 608 src_module = dst_module;
605 } 609 }
606 610
607 skl_tplg_alloc_pipe_mem(skl, mconfig);
608 skl_tplg_alloc_pipe_mcps(skl, mconfig);
609
610 return 0; 611 return 0;
611} 612}
612 613