From 8c43fc2fdda0858879ee4dd7d7ed8e67890f699f Mon Sep 17 00:00:00 2001 From: "Lu, Han" Date: Tue, 10 Mar 2015 10:41:21 +0800 Subject: ASoC: Intel: add function to load sound effect module waves Try to load module waves and allocate runtime blocks for it if the firmware image of module waves exists. Signed-off-by: Lu, Han Signed-off-by: Mark Brown --- sound/soc/intel/sst-haswell-pcm.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'sound/soc/intel/sst-haswell-pcm.c') diff --git a/sound/soc/intel/sst-haswell-pcm.c b/sound/soc/intel/sst-haswell-pcm.c index 7e21e8f85885..a604cc442111 100644 --- a/sound/soc/intel/sst-haswell-pcm.c +++ b/sound/soc/intel/sst-haswell-pcm.c @@ -807,6 +807,17 @@ static int hsw_pcm_create_modules(struct hsw_priv_data *pdata) pcm_data->runtime->persistent_offset; } + /* create runtime blocks for module waves */ + if (sst_hsw_is_module_loaded(hsw, SST_HSW_MODULE_WAVES)) { + pcm_data = &pdata->pcm[HSW_PCM_COUNT-1][0]; + pcm_data->runtime = sst_hsw_runtime_module_create(hsw, + SST_HSW_MODULE_WAVES, pcm_data->persistent_offset); + if (pcm_data->runtime == NULL) + goto err; + pcm_data->persistent_offset = + pcm_data->runtime->persistent_offset; + } + return 0; err: @@ -820,12 +831,16 @@ err: static void hsw_pcm_free_modules(struct hsw_priv_data *pdata) { + struct sst_hsw *hsw = pdata->hsw; struct hsw_pcm_data *pcm_data; int i; for (i = 0; i < ARRAY_SIZE(mod_map); i++) { pcm_data = &pdata->pcm[mod_map[i].dai_id][mod_map[i].stream]; - + sst_hsw_runtime_module_free(pcm_data->runtime); + } + if (sst_hsw_is_module_loaded(hsw, SST_HSW_MODULE_WAVES)) { + pcm_data = &pdata->pcm[HSW_PCM_COUNT-1][0]; sst_hsw_runtime_module_free(pcm_data->runtime); } } @@ -984,7 +999,9 @@ static int hsw_pcm_probe(struct snd_soc_platform *platform) } /* allocate runtime modules */ - hsw_pcm_create_modules(priv_data); + ret = hsw_pcm_create_modules(priv_data); + if (ret < 0) + goto err; /* enable runtime PM with auto suspend */ pm_runtime_set_autosuspend_delay(platform->dev, -- cgit v1.2.3-59-g8ed1b