ASoC: Intel: Skylake: Fix for unloading module only when it is loaded
Subsystems (3)
PATCH 1/2 ASoC: Intel: Skylake: Fix for unloading module only when it is loaded
From: Jeeja KP <[email protected]>
Module needs to be unloaded only when it is loaded successfully. To fix this, first correct the module state sequence and set module state to LOADED if module is loaded successfully.
When unloading the module check if module state is not in UNINIT, then unload it.
--- sound/soc/intel/skylake/skl-topology.c | 5 ++++- sound/soc/intel/skylake/skl-topology.h | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl-topology.c +4 -1
@@ -490,6 +490,8 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) mconfig->id.module_id, mconfig->guid);if (ret <0 )return ret; + + mconfig->m_state =SKL_MODULE_LOADED ; }/* update blob if blob is null for be with default value */
@@ -524,7 +526,8 @@ static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx,list_for_each_entry (w_module, &pipe->w_list, node) { mconfig = w_module->w->priv; -if (mconfig->is_loadable && ctx->dsp->fw_ops.unload_mod) +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->id.module_id); }
sound/soc/intel/skylake/skl-topology.h +4 -4
@@ -274,10 +274,10 @@ struct skl_pipe {enum skl_module_state {SKL_MODULE_UNINIT =0 , -SKL_MODULE_INIT_DONE =1 , -SKL_MODULE_LOADED =2 , -SKL_MODULE_UNLOADED =3 , -SKL_MODULE_BIND_DONE =4 +SKL_MODULE_LOADED =1 , +SKL_MODULE_INIT_DONE =2 , +SKL_MODULE_BIND_DONE =3 , +SKL_MODULE_UNLOADED =4 , };struct skl_module_cfg {
Signature · 1 line
2.5.0
PATCH 2/2 ASoC: Intel: Skylake: Fix DSP resource de-allocation
From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/skylake/skl-topology.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/intel/skylake/skl-topology.c +5 -4
@@ -485,6 +485,8 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)if (!skl_is_pipe_mcps_avail (skl, mconfig))return -ENOMEM ; +skl_tplg_alloc_pipe_mcps (skl, mconfig); +if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) { ret = ctx->dsp->fw_ops.load_mod (ctx->dsp, mconfig->id.module_id, mconfig->guid);
@@ -511,7 +513,6 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) ret =skl_tplg_set_module_params (w, ctx);if (ret <0 )return ret; -skl_tplg_alloc_pipe_mcps (skl, mconfig); }return 0 ;
@@ -561,6 +562,9 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,if (!skl_is_pipe_mem_avail (skl, mconfig))return -ENOMEM ; +skl_tplg_alloc_pipe_mem (skl, mconfig); +skl_tplg_alloc_pipe_mcps (skl, mconfig); +/* * Create a list of modules for pipe. * 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, src_module = dst_module; } -skl_tplg_alloc_pipe_mem (skl, mconfig); -skl_tplg_alloc_pipe_mcps (skl, mconfig); -return 0 ; }
Signature · 1 line
2.5.0
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Fix DSP resource de-allocation" to the asoc tree
The patch
ASoC: Intel: Skylake: Fix DSP resource de-allocation
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
4f329d9fbab630af44db2f787eb79ca52e6ba22eMon Sep 17 00:00:00 2001
From: Jeeja KP <[email protected]>
Date: Mon, 28 Mar 2016 22:11:31 +0530
Subject: [PATCH] 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.
--- sound/soc/intel/skylake/skl-topology.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/intel/skylake/skl-topology.c +5 -4
@@ -485,6 +485,8 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)if (!skl_is_pipe_mcps_avail (skl, mconfig))return -ENOMEM ; +skl_tplg_alloc_pipe_mcps (skl, mconfig); +if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) { ret = ctx->dsp->fw_ops.load_mod (ctx->dsp, mconfig->id.module_id, mconfig->guid);
@@ -511,7 +513,6 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) ret =skl_tplg_set_module_params (w, ctx);if (ret <0 )return ret; -skl_tplg_alloc_pipe_mcps (skl, mconfig); }return 0 ;
@@ -561,6 +562,9 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,if (!skl_is_pipe_mem_avail (skl, mconfig))return -ENOMEM ; +skl_tplg_alloc_pipe_mem (skl, mconfig); +skl_tplg_alloc_pipe_mcps (skl, mconfig); +/* * Create a list of modules for pipe. * 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, src_module = dst_module; } -skl_tplg_alloc_pipe_mem (skl, mconfig); -skl_tplg_alloc_pipe_mcps (skl, mconfig); -return 0 ; }
Signature · 1 line
2.8.0.rc3
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Fix for unloading module only when it is loaded" to the asoc tree
In reply to [email protected]The patch
ASoC: Intel: Skylake: Fix for unloading module only when it is loaded
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
d643678b9a4e432a574b2ec601216afd720c69b6Mon Sep 17 00:00:00 2001
From: Jeeja KP <[email protected]>
Date: Mon, 28 Mar 2016 22:11:30 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Fix for unloading module only when it
is loaded
Module needs to be unloaded only when it is loaded successfully. To fix this, first correct the module state sequence and set module state to LOADED if module is loaded successfully.
When unloading the module check if module state is not in UNINIT, then unload it.
--- sound/soc/intel/skylake/skl-topology.c | 5 ++++- sound/soc/intel/skylake/skl-topology.h | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl-topology.c +4 -1
@@ -490,6 +490,8 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) mconfig->id.module_id, mconfig->guid);if (ret <0 )return ret; + + mconfig->m_state =SKL_MODULE_LOADED ; }/* update blob if blob is null for be with default value */
@@ -524,7 +526,8 @@ static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx,list_for_each_entry (w_module, &pipe->w_list, node) { mconfig = w_module->w->priv; -if (mconfig->is_loadable && ctx->dsp->fw_ops.unload_mod) +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->id.module_id); }
sound/soc/intel/skylake/skl-topology.h +4 -4
@@ -274,10 +274,10 @@ struct skl_pipe {enum skl_module_state {SKL_MODULE_UNINIT =0 , -SKL_MODULE_INIT_DONE =1 , -SKL_MODULE_LOADED =2 , -SKL_MODULE_UNLOADED =3 , -SKL_MODULE_BIND_DONE =4 +SKL_MODULE_LOADED =1 , +SKL_MODULE_INIT_DONE =2 , +SKL_MODULE_BIND_DONE =3 , +SKL_MODULE_UNLOADED =4 , };struct skl_module_cfg {
Signature · 1 line
2.8.0.rc3