All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: Intel: Skylake: Fix for unloading module only when it is loaded
@ 2016-03-28 16:41 jeeja.kp
  2016-03-28 16:41 ` [PATCH 2/2] ASoC: Intel: Skylake: Fix DSP resource de-allocation jeeja.kp
  2016-03-29  7:38 ` Applied "ASoC: Intel: Skylake: Fix for unloading module only when it is loaded" " Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: jeeja.kp @ 2016-03-28 16:41 UTC (permalink / raw)
  To: alsa-devel, broonie, liam.r.girdwood, tiwai, vinod.koul, patches.audio
  Cc: Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

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.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/skylake/skl-topology.c | 5 ++++-
 sound/soc/intel/skylake/skl-topology.h | 8 ++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 545b4e7..3f393cb 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -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);
 	}
diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h
index de3c401..d2d9230 100644
--- a/sound/soc/intel/skylake/skl-topology.h
+++ b/sound/soc/intel/skylake/skl-topology.h
@@ -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 {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-29  7:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-28 16:41 [PATCH 1/2] ASoC: Intel: Skylake: Fix for unloading module only when it is loaded jeeja.kp
2016-03-28 16:41 ` [PATCH 2/2] ASoC: Intel: Skylake: Fix DSP resource de-allocation jeeja.kp
2016-03-29  7:38   ` Applied "ASoC: Intel: Skylake: Fix DSP resource de-allocation" to the asoc tree Mark Brown
2016-03-29  7:38 ` Applied "ASoC: Intel: Skylake: Fix for unloading module only when it is loaded" " Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.