diff options
author | Lu, Han <han.lu@intel.com> | 2015-02-24 19:26:21 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-06 16:08:12 -0500 |
commit | 3fe0607a04ed7deea7c048052fd63b8670e7a176 (patch) | |
tree | 0e07803925df6382da8544cc17f81bacfcf9c5dc /sound/soc | |
parent | de251d773bb214fa5e7666a0da1225528e07da5e (diff) |
ASoC: Intel: remove conflicts when load/unload multiple firmware images
Details:
1. Unload all modules on fw_list of dsp when suspend, and reload all
modules on fw_list when resume.
2. A DSP expects only one scratch, but hsw_parse_fw_image() allocates
scratch blocks for each firmware image it parses. Move the allocate function
sst_block_alloc_scratch() out of hsw_parse_fw_image() to make sure a scratch
be allocated only after all firmware images be parsed.
Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/intel/sst-haswell-dsp.c | 3 | ||||
-rw-r--r-- | sound/soc/intel/sst-haswell-ipc.c | 32 |
2 files changed, 24 insertions, 11 deletions
diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c index 57039b00efc2..f6e1e6b2b18e 100644 --- a/sound/soc/intel/sst-haswell-dsp.c +++ b/sound/soc/intel/sst-haswell-dsp.c | |||
@@ -207,9 +207,6 @@ static int hsw_parse_fw_image(struct sst_fw *sst_fw) | |||
207 | module = (void *)module + sizeof(*module) + module->mod_size; | 207 | module = (void *)module + sizeof(*module) + module->mod_size; |
208 | } | 208 | } |
209 | 209 | ||
210 | /* allocate scratch mem regions */ | ||
211 | sst_block_alloc_scratch(dsp); | ||
212 | |||
213 | return 0; | 210 | return 0; |
214 | } | 211 | } |
215 | 212 | ||
diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c index 8156cc1accb7..6c7052a40e36 100644 --- a/sound/soc/intel/sst-haswell-ipc.c +++ b/sound/soc/intel/sst-haswell-ipc.c | |||
@@ -1870,6 +1870,7 @@ static void sst_hsw_drop_all(struct sst_hsw *hsw) | |||
1870 | int sst_hsw_dsp_load(struct sst_hsw *hsw) | 1870 | int sst_hsw_dsp_load(struct sst_hsw *hsw) |
1871 | { | 1871 | { |
1872 | struct sst_dsp *dsp = hsw->dsp; | 1872 | struct sst_dsp *dsp = hsw->dsp; |
1873 | struct sst_fw *sst_fw, *t; | ||
1873 | int ret; | 1874 | int ret; |
1874 | 1875 | ||
1875 | dev_dbg(hsw->dev, "loading audio DSP...."); | 1876 | dev_dbg(hsw->dev, "loading audio DSP...."); |
@@ -1886,12 +1887,17 @@ int sst_hsw_dsp_load(struct sst_hsw *hsw) | |||
1886 | return ret; | 1887 | return ret; |
1887 | } | 1888 | } |
1888 | 1889 | ||
1889 | ret = sst_fw_reload(hsw->sst_fw); | 1890 | list_for_each_entry_safe_reverse(sst_fw, t, &dsp->fw_list, list) { |
1890 | if (ret < 0) { | 1891 | ret = sst_fw_reload(sst_fw); |
1891 | dev_err(hsw->dev, "error: SST FW reload failed\n"); | 1892 | if (ret < 0) { |
1892 | sst_dsp_dma_put_channel(dsp); | 1893 | dev_err(hsw->dev, "error: SST FW reload failed\n"); |
1893 | return -ENOMEM; | 1894 | sst_dsp_dma_put_channel(dsp); |
1895 | return -ENOMEM; | ||
1896 | } | ||
1894 | } | 1897 | } |
1898 | ret = sst_block_alloc_scratch(hsw->dsp); | ||
1899 | if (ret < 0) | ||
1900 | return -EINVAL; | ||
1895 | 1901 | ||
1896 | sst_dsp_dma_put_channel(dsp); | 1902 | sst_dsp_dma_put_channel(dsp); |
1897 | return 0; | 1903 | return 0; |
@@ -1947,12 +1953,17 @@ int sst_hsw_dsp_runtime_suspend(struct sst_hsw *hsw) | |||
1947 | 1953 | ||
1948 | int sst_hsw_dsp_runtime_sleep(struct sst_hsw *hsw) | 1954 | int sst_hsw_dsp_runtime_sleep(struct sst_hsw *hsw) |
1949 | { | 1955 | { |
1950 | sst_fw_unload(hsw->sst_fw); | 1956 | struct sst_fw *sst_fw, *t; |
1951 | sst_block_free_scratch(hsw->dsp); | 1957 | struct sst_dsp *dsp = hsw->dsp; |
1958 | |||
1959 | list_for_each_entry_safe(sst_fw, t, &dsp->fw_list, list) { | ||
1960 | sst_fw_unload(sst_fw); | ||
1961 | } | ||
1962 | sst_block_free_scratch(dsp); | ||
1952 | 1963 | ||
1953 | hsw->boot_complete = false; | 1964 | hsw->boot_complete = false; |
1954 | 1965 | ||
1955 | sst_dsp_sleep(hsw->dsp); | 1966 | sst_dsp_sleep(dsp); |
1956 | 1967 | ||
1957 | return 0; | 1968 | return 0; |
1958 | } | 1969 | } |
@@ -2081,6 +2092,11 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) | |||
2081 | goto fw_err; | 2092 | goto fw_err; |
2082 | } | 2093 | } |
2083 | 2094 | ||
2095 | /* allocate scratch mem regions */ | ||
2096 | ret = sst_block_alloc_scratch(hsw->dsp); | ||
2097 | if (ret < 0) | ||
2098 | goto boot_err; | ||
2099 | |||
2084 | /* wait for DSP boot completion */ | 2100 | /* wait for DSP boot completion */ |
2085 | sst_dsp_boot(hsw->dsp); | 2101 | sst_dsp_boot(hsw->dsp); |
2086 | ret = wait_event_timeout(hsw->boot_wait, hsw->boot_complete, | 2102 | ret = wait_event_timeout(hsw->boot_wait, hsw->boot_complete, |