diff mbox

ASoC: Intel: Add pre & post suspend calls in bxt machine

Message ID 1480673024-28608-1-git-send-email-vinod.koul@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul Dec. 2, 2016, 10:03 a.m. UTC
We need to disable jack detection before entering suspend and
enable it after resume.

This was essential as headphone jack widget will always
remain ON if a jack is inserted and this results in no audio
after system resumes from a suspend.

Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/intel/boards/bxt_rt298.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Mark Brown Dec. 5, 2016, 11:44 a.m. UTC | #1
On Fri, Dec 02, 2016 at 03:33:44PM +0530, Vinod Koul wrote:
> We need to disable jack detection before entering suspend and
> enable it after resume.

> This was essential as headphone jack widget will always
> remain ON if a jack is inserted and this results in no audio
> after system resumes from a suspend.

This needs clarification - a lot of systems do keep jack detection
active during suspend and use it as a wake source in order to have
things like play/pause functionality via headset available.  This sounds
like there's some limitation with one of the drivers in the system that
is being worked around here instead.
diff mbox

Patch

diff --git a/sound/soc/intel/boards/bxt_rt298.c b/sound/soc/intel/boards/bxt_rt298.c
index 1309405b3808..b272b72e6a77 100644
--- a/sound/soc/intel/boards/bxt_rt298.c
+++ b/sound/soc/intel/boards/bxt_rt298.c
@@ -432,6 +432,33 @@  static int bxt_fe_startup(struct snd_pcm_substream *substream)
 	},
 };
 
+static int bxt_suspend_pre(struct snd_soc_card *card)
+{
+	struct snd_soc_codec *codec;
+
+	list_for_each_entry(codec, &card->codec_dev_list, card_list) {
+		if (!strcmp(codec->component.name, "i2c-INT343A:00")) {
+			rt298_mic_detect(codec, NULL);
+			break;
+		}
+	}
+	return 0;
+}
+
+static int bxt_resume_post(struct snd_soc_card *card)
+{
+	struct snd_soc_codec *codec;
+
+	list_for_each_entry(codec, &card->codec_dev_list, card_list) {
+		if (!strcmp(codec->component.name, "i2c-INT343A:00")) {
+			rt298_mic_detect(codec, &broxton_headset);
+			break;
+		}
+	}
+	return 0;
+}
+
+
 /* broxton audio machine driver for SPT + RT298S */
 static struct snd_soc_card broxton_rt298 = {
 	.name = "broxton-rt298",
@@ -445,6 +472,9 @@  static int bxt_fe_startup(struct snd_pcm_substream *substream)
 	.dapm_routes = broxton_rt298_map,
 	.num_dapm_routes = ARRAY_SIZE(broxton_rt298_map),
 	.fully_routed = true,
+	.suspend_pre = bxt_suspend_pre,
+	.resume_post = bxt_resume_post,
+
 };
 
 static int broxton_audio_probe(struct platform_device *pdev)