From 5923b73016de34e51a801026731b92e64559038f Mon Sep 17 00:00:00 2001 From: Viraj Karandikar Date: Thu, 5 Feb 2015 11:52:11 +0530 Subject: [PATCH] asoc: tegra-alt: add nvfx flush method Add nvfx flush method to support seek Bug 200034859 Change-Id: Ibc6e0d2ba5d2e69ee3baa399fabe22c31ea16b49 Signed-off-by: Viraj Karandikar Reviewed-on: http://git-master/r/680640 GVS: Gerrit_Virtual_Submit Reviewed-by: Stephen Holmes Reviewed-by: Sumit Bhattacharya --- sound/soc/tegra-alt/tegra210_adsp_alt.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/sound/soc/tegra-alt/tegra210_adsp_alt.c b/sound/soc/tegra-alt/tegra210_adsp_alt.c index 15d7d880..b8f7fa44 100644 --- a/sound/soc/tegra-alt/tegra210_adsp_alt.c +++ b/sound/soc/tegra-alt/tegra210_adsp_alt.c @@ -440,6 +440,18 @@ static int tegra210_adsp_send_state_msg(struct tegra210_adsp_app *app, return tegra210_adsp_send_msg(app->apm, &apm_msg, flags); } +static int tegra210_adsp_send_flush_msg(struct tegra210_adsp_app *app, + uint32_t flags) +{ + apm_msg_t apm_msg; + + apm_msg.msgq_msg.size = MSGQ_MSG_WSIZE(nvfx_flush_params_t); + apm_msg.msg.call_params.size = sizeof(nvfx_flush_params_t); + apm_msg.msg.call_params.method = nvfx_method_flush; + + return tegra210_adsp_send_msg(app->apm, &apm_msg, flags); +} + static int tegra210_adsp_send_reset_msg(struct tegra210_adsp_app *app, uint32_t flags) { @@ -705,7 +717,7 @@ static int tegra210_adsp_compr_msg_handler(struct tegra210_adsp_app *app, tegra210_adsp_send_state_msg(prtd->fe_apm, nvfx_state_inactive, TEGRA210_ADSP_MSG_FLAG_SEND); - tegra210_adsp_send_reset_msg(prtd->fe_apm, + tegra210_adsp_send_flush_msg(prtd->fe_apm, TEGRA210_ADSP_MSG_FLAG_SEND); snd_compr_drain_notify(prtd->cstream); prtd->is_draining = 0; @@ -770,6 +782,9 @@ static int tegra210_adsp_compr_free(struct snd_compr_stream *cstream) { struct tegra210_adsp_compr_rtd *prtd = cstream->runtime->private_data; + tegra210_adsp_send_reset_msg(prtd->fe_apm, + TEGRA210_ADSP_MSG_FLAG_SEND); + if (prtd) { prtd->fe_apm->fe = 0; devm_kfree(prtd->dev, prtd); @@ -865,7 +880,7 @@ static int tegra210_adsp_compr_trigger(struct snd_compr_stream *cstream, return ret; } - ret = tegra210_adsp_send_reset_msg(prtd->fe_apm, + ret = tegra210_adsp_send_flush_msg(prtd->fe_apm, TEGRA210_ADSP_MSG_FLAG_SEND); if (ret < 0) { dev_err(prtd->dev, "Failed to reset"); @@ -1087,6 +1102,9 @@ static int tegra210_adsp_pcm_close(struct snd_pcm_substream *substream) dev_vdbg(prtd->dev, "%s", __func__); if (prtd) { + tegra210_adsp_send_reset_msg(prtd->fe_apm, + TEGRA210_ADSP_MSG_FLAG_SEND); + prtd->fe_apm->fe = 1; devm_kfree(prtd->dev, prtd); } @@ -1161,7 +1179,7 @@ static int tegra210_adsp_pcm_trigger(struct snd_pcm_substream *substream, return ret; } - ret = tegra210_adsp_send_reset_msg(prtd->fe_apm, + ret = tegra210_adsp_send_flush_msg(prtd->fe_apm, TEGRA210_ADSP_MSG_FLAG_SEND); if (ret < 0) { dev_err(prtd->dev, "Failed to reset");