diff options
author | Jie Yang <yang.jie@intel.com> | 2015-05-30 10:33:59 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-06-02 10:34:12 -0400 |
commit | edd8ed496b98f1b9d9fda5170a90fe41e7f86e6e (patch) | |
tree | 80bfb402305a250d163f6ff56842261a2f14252d | |
parent | 2dbc80caf7e93c3d49787cf939fc416873125c1b (diff) |
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: Jie Yang <yang.jie@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/intel/haswell/sst-haswell-pcm.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c index f97fa5ab93d3..e593e7a4b7a7 100644 --- a/sound/soc/intel/haswell/sst-haswell-pcm.c +++ b/sound/soc/intel/haswell/sst-haswell-pcm.c | |||
@@ -1209,6 +1209,20 @@ static int hsw_pcm_runtime_idle(struct device *dev) | |||
1209 | return 0; | 1209 | return 0; |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | static int hsw_pcm_suspend(struct device *dev) | ||
1213 | { | ||
1214 | struct hsw_priv_data *pdata = dev_get_drvdata(dev); | ||
1215 | struct sst_hsw *hsw = pdata->hsw; | ||
1216 | |||
1217 | /* enter D3 state and stall */ | ||
1218 | sst_hsw_dsp_runtime_suspend(hsw); | ||
1219 | /* free all runtime modules */ | ||
1220 | hsw_pcm_free_modules(pdata); | ||
1221 | /* put the DSP to sleep, fw unloaded after runtime modules freed */ | ||
1222 | sst_hsw_dsp_runtime_sleep(hsw); | ||
1223 | return 0; | ||
1224 | } | ||
1225 | |||
1212 | static int hsw_pcm_runtime_suspend(struct device *dev) | 1226 | static int hsw_pcm_runtime_suspend(struct device *dev) |
1213 | { | 1227 | { |
1214 | struct hsw_priv_data *pdata = dev_get_drvdata(dev); | 1228 | struct hsw_priv_data *pdata = dev_get_drvdata(dev); |
@@ -1225,8 +1239,7 @@ static int hsw_pcm_runtime_suspend(struct device *dev) | |||
1225 | return ret; | 1239 | return ret; |
1226 | sst_hsw_set_module_enabled_rtd3(hsw, SST_HSW_MODULE_WAVES); | 1240 | sst_hsw_set_module_enabled_rtd3(hsw, SST_HSW_MODULE_WAVES); |
1227 | } | 1241 | } |
1228 | sst_hsw_dsp_runtime_suspend(hsw); | 1242 | hsw_pcm_suspend(dev); |
1229 | sst_hsw_dsp_runtime_sleep(hsw); | ||
1230 | pdata->pm_state = HSW_PM_STATE_RTD3; | 1243 | pdata->pm_state = HSW_PM_STATE_RTD3; |
1231 | 1244 | ||
1232 | return 0; | 1245 | return 0; |
@@ -1366,10 +1379,7 @@ static int hsw_pcm_prepare(struct device *dev) | |||
1366 | if (err < 0) | 1379 | if (err < 0) |
1367 | dev_err(dev, "failed to save context for PCM %d\n", i); | 1380 | dev_err(dev, "failed to save context for PCM %d\n", i); |
1368 | } | 1381 | } |
1369 | /* enter D3 state and stall */ | 1382 | hsw_pcm_suspend(dev); |
1370 | sst_hsw_dsp_runtime_suspend(hsw); | ||
1371 | /* put the DSP to sleep */ | ||
1372 | sst_hsw_dsp_runtime_sleep(hsw); | ||
1373 | } | 1383 | } |
1374 | 1384 | ||
1375 | snd_soc_suspend(pdata->soc_card->dev); | 1385 | snd_soc_suspend(pdata->soc_card->dev); |