From 1a83c79388a125db75f0d7e090f646077f6d7a1a Mon Sep 17 00:00:00 2001 From: Viraj Karandikar Date: Wed, 13 May 2015 14:12:44 +0530 Subject: [PATCH] tegra-alt: adsp: get/put from compress open/free During device switch, runtime count becomes zero and runtime_suspend gets called which suspends ADSP OS. ADSP OS is resume immediately when resuming playback on new device. ADSP OS suspend/resume can happen while ADMA is running, which disturbs SW/HW sync causing noisy output. Prevent ADSP OS suspend as long as compress stream is open by acquiring a runtime get() from stream open and releasing it in stream free. Bug 200100093 Change-Id: Id0da81c16efa3682131e98f6132aa02c8e7cfcab Signed-off-by: Viraj Karandikar Reviewed-on: http://git-master/r/742105 (cherry picked from commit 6f11140bb41166a9797b2d7fe3bfb1610b55b513) Reviewed-on: http://git-master/r/747319 --- sound/soc/tegra-alt/tegra210_adsp_alt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/tegra-alt/tegra210_adsp_alt.c b/sound/soc/tegra-alt/tegra210_adsp_alt.c index 6508924b..26b97024 100644 --- a/sound/soc/tegra-alt/tegra210_adsp_alt.c +++ b/sound/soc/tegra-alt/tegra210_adsp_alt.c @@ -953,6 +953,7 @@ static int tegra210_adsp_compr_open(struct snd_compr_stream *cstream) prtd->cstream = cstream; prtd->dev = adsp->dev; cstream->runtime->private_data = prtd; + pm_runtime_get_sync(adsp->dev); return 0; } @@ -966,6 +967,8 @@ static int tegra210_adsp_compr_free(struct snd_compr_stream *cstream) tegra210_adsp_send_reset_msg(prtd->fe_apm, TEGRA210_ADSP_MSG_FLAG_SEND); + pm_runtime_put(prtd->dev); + prtd->fe_apm->fe = 0; cstream->runtime->private_data = NULL; devm_kfree(prtd->dev, prtd);