Commit edd8ed49 authored by Jie Yang's avatar Jie Yang Committed by Mark Brown

ASoC: Intel: handle haswell pcm suspend including runtime modules freeing

It needs free pcm runtime modules before unloading firmware, here
add hsw_pcm_suspend() to handle this procedure:
suspends firmware ==> frees runtime modules ==> unloads firmware.

This fixes the broadwell module unload failed issue.
Signed-off-by: default avatarJie Yang <yang.jie@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2dbc80ca
...@@ -1209,6 +1209,20 @@ static int hsw_pcm_runtime_idle(struct device *dev) ...@@ -1209,6 +1209,20 @@ static int hsw_pcm_runtime_idle(struct device *dev)
return 0; return 0;
} }
static int hsw_pcm_suspend(struct device *dev)
{
struct hsw_priv_data *pdata = dev_get_drvdata(dev);
struct sst_hsw *hsw = pdata->hsw;
/* enter D3 state and stall */
sst_hsw_dsp_runtime_suspend(hsw);
/* free all runtime modules */
hsw_pcm_free_modules(pdata);
/* put the DSP to sleep, fw unloaded after runtime modules freed */
sst_hsw_dsp_runtime_sleep(hsw);
return 0;
}
static int hsw_pcm_runtime_suspend(struct device *dev) static int hsw_pcm_runtime_suspend(struct device *dev)
{ {
struct hsw_priv_data *pdata = dev_get_drvdata(dev); struct hsw_priv_data *pdata = dev_get_drvdata(dev);
...@@ -1225,8 +1239,7 @@ static int hsw_pcm_runtime_suspend(struct device *dev) ...@@ -1225,8 +1239,7 @@ static int hsw_pcm_runtime_suspend(struct device *dev)
return ret; return ret;
sst_hsw_set_module_enabled_rtd3(hsw, SST_HSW_MODULE_WAVES); sst_hsw_set_module_enabled_rtd3(hsw, SST_HSW_MODULE_WAVES);
} }
sst_hsw_dsp_runtime_suspend(hsw); hsw_pcm_suspend(dev);
sst_hsw_dsp_runtime_sleep(hsw);
pdata->pm_state = HSW_PM_STATE_RTD3; pdata->pm_state = HSW_PM_STATE_RTD3;
return 0; return 0;
...@@ -1366,10 +1379,7 @@ static int hsw_pcm_prepare(struct device *dev) ...@@ -1366,10 +1379,7 @@ static int hsw_pcm_prepare(struct device *dev)
if (err < 0) if (err < 0)
dev_err(dev, "failed to save context for PCM %d\n", i); dev_err(dev, "failed to save context for PCM %d\n", i);
} }
/* enter D3 state and stall */ hsw_pcm_suspend(dev);
sst_hsw_dsp_runtime_suspend(hsw);
/* put the DSP to sleep */
sst_hsw_dsp_runtime_sleep(hsw);
} }
snd_soc_suspend(pdata->soc_card->dev); snd_soc_suspend(pdata->soc_card->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment