From b033c2d9ee2237520754857a7638bc875f658be3 Mon Sep 17 00:00:00 2001
From: Francois Mazard <f-mazard@ti.com>
Date: Wed, 8 Dec 2010 13:53:15 +0100
Subject: [PATCH 48/60] ASoc: sdp4430: Allow voice call during suspend

commit f53886268eec59f0007b3220dbd340a1ef8d5263 upstream

ASoC suspend doesn't check if DAIs are shared between
suspendable and non-suspendable DAI links. During voice
call, modem DAI link and associated DAIs need to continue
active, even if the DAIs are shared with non-suspendable
DAI links.

Temporal solution is to mark DAI links using shared DAIs as
non-suspendables. In Android, the non-suspendable DAI links
are not active when suspend happens. This solution should be
reworked when ASoC framework adds more support for non-
suspendable streams.

Change-Id: I34643d8cfd9951f476ce7adc25cb9f48cf59a6c0
Signed-off-by: Francois Mazard <f-mazard@ti.com>
Integrated-by: Jingdong Lu <jingdong.lu@windriver.com>
---
 sound/soc/omap/sdp4430.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index 7bb65d1..ac7306f 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -387,8 +387,16 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
 	snd_soc_dapm_enable_pin(dapm, "Ext Spk");
 	snd_soc_dapm_enable_pin(dapm, "AFML");
 	snd_soc_dapm_enable_pin(dapm, "AFMR");
-	snd_soc_dapm_enable_pin(dapm, "Headset Mic");
-	snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
+	snd_soc_dapm_disable_pin(dapm, "Headset Mic");
+	snd_soc_dapm_disable_pin(dapm, "Headset Stereophone");
+
+	/* allow modem audio paths to run during suspend */
+	snd_soc_dapm_ignore_suspend(dapm, "Ext Mic");
+	snd_soc_dapm_ignore_suspend(dapm, "Ext Spk");
+	snd_soc_dapm_ignore_suspend(dapm, "AFML");
+	snd_soc_dapm_ignore_suspend(dapm, "AFMR");
+	snd_soc_dapm_ignore_suspend(dapm, "Headset Mic");
+	snd_soc_dapm_ignore_suspend(dapm, "Headset Stereophone");
 
 	ret = snd_soc_dapm_sync(dapm);
 	if (ret)
@@ -602,6 +610,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.fe_playback_channels = 2,
 		.fe_capture_channels = 2,
 		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = "SDP4430 Media LP",
@@ -658,6 +667,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.codec_name = "twl6040-codec",
 
 		.ops = &sdp4430_mcpdm_ops,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = "Legacy DMIC",
@@ -672,6 +682,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.codec_name = "dmic-codec.0",
 
 		.ops = &sdp4430_dmic_ops,
+		.ignore_suspend = 1,
 	},
 
 /*
@@ -695,6 +706,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.init = sdp4430_twl6040_init,
 		.ops = &sdp4430_mcpdm_ops,
 		.be_id = OMAP_ABE_DAI_PDM_DL1,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = OMAP_ABE_BE_PDM_UL1,
@@ -711,6 +723,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.no_pcm = 1, /* don't create ALSA pcm for this */
 		.ops = &sdp4430_mcpdm_ops,
 		.be_id = OMAP_ABE_DAI_PDM_UL,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = OMAP_ABE_BE_PDM_DL2,
@@ -727,6 +740,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.no_pcm = 1, /* don't create ALSA pcm for this */
 		.ops = &sdp4430_mcpdm_ops,
 		.be_id = OMAP_ABE_DAI_PDM_DL2,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = OMAP_ABE_BE_PDM_VIB,
@@ -743,6 +757,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.no_pcm = 1, /* don't create ALSA pcm for this */
 		.ops = &sdp4430_mcpdm_ops,
 		.be_id = OMAP_ABE_DAI_PDM_VIB,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = OMAP_ABE_BE_BT_VX,
@@ -760,6 +775,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.be_hw_params_fixup = mcbsp_be_hw_params_fixup,
 		.ops = &sdp4430_mcbsp_ops,
 		.be_id = OMAP_ABE_DAI_BT_VX,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = OMAP_ABE_BE_MM_EXT0,
@@ -794,6 +810,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.be_hw_params_fixup = mcbsp_be_hw_params_fixup,
 		.ops = &sdp4430_mcbsp_ops,
 		.be_id = OMAP_ABE_DAI_MODEM,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = OMAP_ABE_BE_DMIC0,
@@ -811,6 +828,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.no_pcm = 1, /* don't create ALSA pcm for this */
 		.be_hw_params_fixup = dmic_be_hw_params_fixup,
 		.be_id = OMAP_ABE_DAI_DMIC0,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = OMAP_ABE_BE_DMIC1,
@@ -828,6 +846,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.no_pcm = 1, /* don't create ALSA pcm for this */
 		.be_hw_params_fixup = dmic_be_hw_params_fixup,
 		.be_id = OMAP_ABE_DAI_DMIC1,
+		.ignore_suspend = 1,
 	},
 	{
 		.name = OMAP_ABE_BE_DMIC2,
@@ -845,6 +864,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = {
 		.no_pcm = 1, /* don't create ALSA pcm for this */
 		.be_hw_params_fixup = dmic_be_hw_params_fixup,
 		.be_id = OMAP_ABE_DAI_DMIC2,
+		.ignore_suspend = 1,
 	},
 };
 
-- 
1.7.4.1

