ASoC: Intel: Add suspend_pre and resume_post for Broadwell snd_soc_card
authorJie Yang <yang.jie@intel.com>
Fri, 27 Feb 2015 04:54:29 +0000 (12:54 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 6 Mar 2015 20:17:40 +0000 (20:17 +0000)
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/broadwell.c

index fba2ef5dac4280d9e4c200352743999bc64eb562..af5d73070f60f9ef5215a9a0c50727e92442bea1 100644 (file)
@@ -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)