summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJin Yao <yao.jin@linux.intel.com>2015-03-17 10:23:30 +0800
committerMark Brown <broonie@kernel.org>2015-03-17 12:17:13 +0000
commit066d7b87fa11213d7eca7af8fdd8447e1c62117b (patch)
treec19c9423f658f7043b15c6b3a7a09c5290e6745c
parent3ee5990d0835d5f10c9aad2a856860a213df638a (diff)
ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
On Braswell, we need to add some machine specific setting before suspend and after resume. For example, disable/enable jack detection in codec so use snd_soc_card suspend_pre and resume_post ops for this purpose. Signed-off-by: Jin Yao <yao.jin@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/intel/cht_bsw_rt5672.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c
index 279df4c43de1..c41fae3eb9ca 100644
--- a/sound/soc/intel/cht_bsw_rt5672.c
+++ b/sound/soc/intel/cht_bsw_rt5672.c
@@ -267,6 +267,35 @@ static struct snd_soc_dai_link cht_dailink[] = {
},
};
+static int cht_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-10EC5670:00")) {
+ dev_dbg(codec->dev, "disabling jack detect before going to suspend.\n");
+ rt5670_jack_suspend(codec);
+ break;
+ }
+ }
+ return 0;
+}
+
+static int cht_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-10EC5670:00")) {
+ dev_dbg(codec->dev, "enabling jack detect for resume.\n");
+ rt5670_jack_resume(codec);
+ break;
+ }
+ }
+
+ return 0;
+}
+
/* SoC card */
static struct snd_soc_card snd_soc_card_cht = {
.name = "cherrytrailcraudio",
@@ -278,6 +307,8 @@ static struct snd_soc_card snd_soc_card_cht = {
.num_dapm_routes = ARRAY_SIZE(cht_audio_map),
.controls = cht_mc_controls,
.num_controls = ARRAY_SIZE(cht_mc_controls),
+ .suspend_pre = cht_suspend_pre,
+ .resume_post = cht_resume_post,
};
static int snd_cht_mc_probe(struct platform_device *pdev)