alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Bard Liao <bardliao@realtek.com>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: oder_chiou@realtek.com, alsa-devel@alsa-project.org,
	lars@metafoo.de, vinod.koul@intel.com,
	Bard Liao <bardliao@realtek.com>,
	senthilnathanx.veppur@intel.com, flove@realtek.com
Subject: [PATCH] ASoC: rt298: Add jack suspend and resume functions.
Date: Mon, 13 Jun 2016 20:28:39 +0800	[thread overview]
Message-ID: <1465820919-6105-1-git-send-email-bardliao@realtek.com> (raw)

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 results in no audio
after system resumes from a suspend.

Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt298.c | 20 ++++++++++++++++++++
 sound/soc/codecs/rt298.h |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index d403c20..629b038 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -1270,6 +1270,26 @@ static int rt298_i2c_remove(struct i2c_client *i2c)
 	return 0;
 }
 
+void rt298_jack_suspend(struct snd_soc_codec *codec)
+{
+	struct rt298_priv *rt298 = snd_soc_codec_get_drvdata(codec);
+	struct snd_soc_dapm_context *dapm;
+
+	dapm = snd_soc_codec_get_dapm(rt298->codec);
+	snd_soc_dapm_disable_pin(dapm, "LDO1");
+	snd_soc_dapm_sync(dapm);
+}
+EXPORT_SYMBOL_GPL(rt298_jack_suspend);
+
+void rt298_jack_resume(struct snd_soc_codec *codec)
+{
+	struct rt298_priv *rt298 = snd_soc_codec_get_drvdata(codec);
+	bool hp = false;
+	bool mic = false;
+
+	rt298_jack_detect(rt298, &hp, &mic);
+}
+EXPORT_SYMBOL_GPL(rt298_jack_resume);
 
 static struct i2c_driver rt298_i2c_driver = {
 	.driver = {
diff --git a/sound/soc/codecs/rt298.h b/sound/soc/codecs/rt298.h
index 3638f3d..2de342f 100644
--- a/sound/soc/codecs/rt298.h
+++ b/sound/soc/codecs/rt298.h
@@ -211,6 +211,8 @@ enum {
 };
 
 int rt298_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack);
+void rt298_jack_suspend(struct snd_soc_codec *codec);
+void rt298_jack_resume(struct snd_soc_codec *codec);
 
 #endif /* __RT298_H__ */
 
-- 
1.8.1.1.439.g50a6b54

             reply	other threads:[~2016-06-13 12:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 12:28 Bard Liao [this message]
2016-06-13 14:09 ` [PATCH] ASoC: rt298: Add jack suspend and resume functions Mark Brown
2016-06-13 16:55   ` Vinod Koul
2016-06-13 16:50     ` Mark Brown
2016-06-13 17:04       ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465820919-6105-1-git-send-email-bardliao@realtek.com \
    --to=bardliao@realtek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=flove@realtek.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=oder_chiou@realtek.com \
    --cc=senthilnathanx.veppur@intel.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).