Commit ae395937 authored by Jeeja KP's avatar Jeeja KP Committed by Mark Brown

ASoC: Intel: Skylake: Fix cleanup of dma buffer

During firmware download, dma buffers are allocated in prepare
and never freed on clean up. This patch frees the allocated dma
buffer in cldma controller clean up.
Signed-off-by: default avatarJeeja KP <jeeja.kp@intel.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent e03fc82d
...@@ -137,6 +137,11 @@ static void skl_cldma_cleanup(struct sst_dsp *ctx) ...@@ -137,6 +137,11 @@ static void skl_cldma_cleanup(struct sst_dsp *ctx)
sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_CBL, 0); sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_CBL, 0);
sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_LVI, 0); sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_LVI, 0);
if (&ctx->cl_dev.dmab_data)
ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_data);
if (&ctx->cl_dev.dmab_bdl)
ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_bdl);
} }
static int skl_cldma_wait_interruptible(struct sst_dsp *ctx) static int skl_cldma_wait_interruptible(struct sst_dsp *ctx)
......
...@@ -115,27 +115,28 @@ static int skl_load_base_firmware(struct sst_dsp *ctx) ...@@ -115,27 +115,28 @@ static int skl_load_base_firmware(struct sst_dsp *ctx)
dev_err(ctx->dev, dev_err(ctx->dev,
"Timeout waiting for ROM init done, reg:0x%x\n", reg); "Timeout waiting for ROM init done, reg:0x%x\n", reg);
ret = -EIO; ret = -EIO;
goto skl_load_base_firmware_failed; goto transfer_firmware_failed;
} }
ret = skl_transfer_firmware(ctx, ctx->fw->data, ctx->fw->size); ret = skl_transfer_firmware(ctx, ctx->fw->data, ctx->fw->size);
if (ret < 0) { if (ret < 0) {
dev_err(ctx->dev, "Transfer firmware failed%d\n", ret); dev_err(ctx->dev, "Transfer firmware failed%d\n", ret);
goto skl_load_base_firmware_failed; goto transfer_firmware_failed;
} else { } else {
ret = wait_event_timeout(skl->boot_wait, skl->boot_complete, ret = wait_event_timeout(skl->boot_wait, skl->boot_complete,
msecs_to_jiffies(SKL_IPC_BOOT_MSECS)); msecs_to_jiffies(SKL_IPC_BOOT_MSECS));
if (ret == 0) { if (ret == 0) {
dev_err(ctx->dev, "DSP boot failed, FW Ready timed-out\n"); dev_err(ctx->dev, "DSP boot failed, FW Ready timed-out\n");
ret = -EIO; ret = -EIO;
goto skl_load_base_firmware_failed; goto transfer_firmware_failed;
} }
dev_dbg(ctx->dev, "Download firmware successful%d\n", ret); dev_dbg(ctx->dev, "Download firmware successful%d\n", ret);
skl_dsp_set_state_locked(ctx, SKL_DSP_RUNNING); skl_dsp_set_state_locked(ctx, SKL_DSP_RUNNING);
} }
return 0; return 0;
transfer_firmware_failed:
ctx->cl_dev.ops.cl_cleanup_controller(ctx);
skl_load_base_firmware_failed: skl_load_base_firmware_failed:
skl_dsp_disable_core(ctx); skl_dsp_disable_core(ctx);
release_firmware(ctx->fw); release_firmware(ctx->fw);
...@@ -277,7 +278,6 @@ EXPORT_SYMBOL_GPL(skl_sst_dsp_init); ...@@ -277,7 +278,6 @@ EXPORT_SYMBOL_GPL(skl_sst_dsp_init);
void skl_sst_dsp_cleanup(struct device *dev, struct skl_sst *ctx) void skl_sst_dsp_cleanup(struct device *dev, struct skl_sst *ctx)
{ {
skl_ipc_free(&ctx->ipc); skl_ipc_free(&ctx->ipc);
ctx->dsp->cl_dev.ops.cl_cleanup_controller(ctx->dsp);
ctx->dsp->ops->free(ctx->dsp); ctx->dsp->ops->free(ctx->dsp);
} }
EXPORT_SYMBOL_GPL(skl_sst_dsp_cleanup); EXPORT_SYMBOL_GPL(skl_sst_dsp_cleanup);
......
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