asoc: tegra-alt: add nvfx flush method

Add nvfx flush method to support seek

Bug 200034859

Change-Id: Ibc6e0d2ba5d2e69ee3baa399fabe22c31ea16b49
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/680640
GVS: Gerrit_Virtual_Submit
Reviewed-by: Stephen Holmes <sholmes@nvidia.com>
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
This commit is contained in:
Viraj Karandikar
2015-02-05 11:52:11 +05:30
committed by Sameer Pujar
parent 3151fe4c79
commit 5923b73016

View File

@@ -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); 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, static int tegra210_adsp_send_reset_msg(struct tegra210_adsp_app *app,
uint32_t flags) 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, tegra210_adsp_send_state_msg(prtd->fe_apm,
nvfx_state_inactive, nvfx_state_inactive,
TEGRA210_ADSP_MSG_FLAG_SEND); 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); TEGRA210_ADSP_MSG_FLAG_SEND);
snd_compr_drain_notify(prtd->cstream); snd_compr_drain_notify(prtd->cstream);
prtd->is_draining = 0; 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; 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) { if (prtd) {
prtd->fe_apm->fe = 0; prtd->fe_apm->fe = 0;
devm_kfree(prtd->dev, prtd); devm_kfree(prtd->dev, prtd);
@@ -865,7 +880,7 @@ static int tegra210_adsp_compr_trigger(struct snd_compr_stream *cstream,
return ret; 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); TEGRA210_ADSP_MSG_FLAG_SEND);
if (ret < 0) { if (ret < 0) {
dev_err(prtd->dev, "Failed to reset"); 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__); dev_vdbg(prtd->dev, "%s", __func__);
if (prtd) { if (prtd) {
tegra210_adsp_send_reset_msg(prtd->fe_apm,
TEGRA210_ADSP_MSG_FLAG_SEND);
prtd->fe_apm->fe = 1; prtd->fe_apm->fe = 1;
devm_kfree(prtd->dev, prtd); devm_kfree(prtd->dev, prtd);
} }
@@ -1161,7 +1179,7 @@ static int tegra210_adsp_pcm_trigger(struct snd_pcm_substream *substream,
return ret; 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); TEGRA210_ADSP_MSG_FLAG_SEND);
if (ret < 0) { if (ret < 0) {
dev_err(prtd->dev, "Failed to reset"); dev_err(prtd->dev, "Failed to reset");