All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card
@ 2015-03-11  3:48 Jin Yao
  2015-03-11 11:50 ` Mark Brown
  2015-03-11 12:50 ` Mark Brown
  0 siblings, 2 replies; 8+ messages in thread
From: Jin Yao @ 2015-03-11  3:48 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: mengdong.lin, alsa-devel, subhransu.s.prusty, yao.jin, bardliao

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>
---
 sound/soc/intel/cht_bsw_rt5672.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c
index 279df4c..c41fae3 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)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-03-13  3:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-11  3:48 [PATCH] ASoC: Intel: Add suspend_pre and resume_post for Braswell snd_soc_card Jin Yao
2015-03-11 11:50 ` Mark Brown
2015-03-11 12:50 ` Mark Brown
2015-03-12  0:52   ` Jin, Yao
2015-03-12  2:38     ` Bard Liao
2015-03-12 12:42       ` Jin, Yao
2015-03-12 18:01         ` Mark Brown
2015-03-13  3:17           ` Jin, Yao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.