diff mbox

ASoC: Intel: Add suspend_pre and resume_post for Broadwell snd_soc_card

Message ID 1425012869-11429-1-git-send-email-yang.jie@intel.com (mailing list archive)
State Accepted
Commit 1a5ab21c2e0f3d6b25ee9f7ca3429fac57027f76
Headers show

Commit Message

Jie, Yang Feb. 27, 2015, 4:54 a.m. UTC
For broadwell machine, we need do some machine related setting before
suspend and after resume, e.g. disable/enable jack detection, here
adding snd_soc_card suspend_pre and resume_post for this task.

Signed-off-by: Jie Yang <yang.jie@intel.com>
---
 sound/soc/intel/broadwell.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Mark Brown March 6, 2015, 8:17 p.m. UTC | #1
On Fri, Feb 27, 2015 at 12:54:29PM +0800, Jie Yang wrote:
> For broadwell machine, we need do some machine related setting before
> suspend and after resume, e.g. disable/enable jack detection, here
> adding snd_soc_card suspend_pre and resume_post for this task.

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/intel/broadwell.c b/sound/soc/intel/broadwell.c
index fba2ef5..af5d730 100644
--- a/sound/soc/intel/broadwell.c
+++ b/sound/soc/intel/broadwell.c
@@ -225,6 +225,32 @@  static struct snd_soc_dai_link broadwell_rt286_dais[] = {
 	},
 };
 
+static int broadwell_suspend(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")) {
+			dev_dbg(codec->dev, "disabling jack detect before going to suspend.\n");
+			rt286_mic_detect(codec, NULL);
+			break;
+		}
+	}
+	return 0;
+}
+
+static int broadwell_resume(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")) {
+			dev_dbg(codec->dev, "enabling jack detect for resume.\n");
+			rt286_mic_detect(codec, &broadwell_headset);
+			break;
+		}
+	}
+	return 0;
+}
+
 /* broadwell audio machine driver for WPT + RT286S */
 static struct snd_soc_card broadwell_rt286 = {
 	.name = "broadwell-rt286",
@@ -238,6 +264,8 @@  static struct snd_soc_card broadwell_rt286 = {
 	.dapm_routes = broadwell_rt286_map,
 	.num_dapm_routes = ARRAY_SIZE(broadwell_rt286_map),
 	.fully_routed = true,
+	.suspend_pre = broadwell_suspend,
+	.resume_post = broadwell_resume,
 };
 
 static int broadwell_audio_probe(struct platform_device *pdev)