All of lore.kernel.org
 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, mengdong.lin@intel.com, john.lin@realtek.com,
	Jin Yao <yao.jin@linux.intel.com>,
	Bard Liao <bardliao@realtek.com>,
	yao.jin@intel.com, flove@realtek.com
Subject: [PATCH v2 2/2] ASoC: rt5670: export jack suspend/resume APIs
Date: Wed, 11 Mar 2015 11:42:45 +0800	[thread overview]
Message-ID: <1426045365-15975-2-git-send-email-bardliao@realtek.com> (raw)
In-Reply-To: <1426045365-15975-1-git-send-email-bardliao@realtek.com>

We force enable "Mic Det Power" when a jack is inserted. Also, we
set codec idle_bias_off = true. As a result, codec driver will not
suspend as we expect.

On Braswell, we don't need the jack detection when suspend but need
it after resume, so export the jack suspend/resume APIs which are
provided for machine driver to control during suspend/resume.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt5670.c | 18 ++++++++++++++++++
 sound/soc/codecs/rt5670.h |  3 +++
 2 files changed, 21 insertions(+)

diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
index 23ca049..5999512 100644
--- a/sound/soc/codecs/rt5670.c
+++ b/sound/soc/codecs/rt5670.c
@@ -461,6 +461,24 @@ static int rt5670_headset_detect(struct snd_soc_codec *codec, int jack_insert)
 	return rt5670->jack_type;
 }
 
+void rt5670_jack_suspend(struct snd_soc_codec *codec)
+{
+	struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
+
+	rt5670->jack_type_saved = rt5670->jack_type;
+	rt5670_headset_detect(codec, 0);
+}
+EXPORT_SYMBOL_GPL(rt5670_jack_suspend);
+
+void rt5670_jack_resume(struct snd_soc_codec *codec)
+{
+	struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
+
+	if (rt5670->jack_type_saved)
+		rt5670_headset_detect(codec, 1);
+}
+EXPORT_SYMBOL_GPL(rt5670_jack_resume);
+
 static int rt5670_button_detect(struct snd_soc_codec *codec)
 {
 	int btn_type, val;
diff --git a/sound/soc/codecs/rt5670.h b/sound/soc/codecs/rt5670.h
index 0f3255a..dc2b462 100644
--- a/sound/soc/codecs/rt5670.h
+++ b/sound/soc/codecs/rt5670.h
@@ -2004,8 +2004,11 @@ struct rt5670_priv {
 	int dsp_sw; /* expected parameter setting */
 	int dsp_rate;
 	int jack_type;
+	int jack_type_saved;
 };
 
+void rt5670_jack_suspend(struct snd_soc_codec *codec);
+void rt5670_jack_resume(struct snd_soc_codec *codec);
 int rt5670_set_jack_detect(struct snd_soc_codec *codec,
 	struct snd_soc_jack *jack);
 #endif /* __RT5670_H__ */
-- 
1.8.1.1.439.g50a6b54

  reply	other threads:[~2015-03-11  3:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11  3:42 [PATCH v2 1/2] ASoC: rt5670: Add IRQ function Bard Liao
2015-03-11  3:42 ` Bard Liao [this message]
2015-03-11 12:51   ` [PATCH v2 2/2] ASoC: rt5670: export jack suspend/resume APIs Mark Brown
2015-03-11 12:08 ` [PATCH v2 1/2] ASoC: rt5670: Add IRQ function Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2015-03-11  3:39 [PATCH] SoC: " Bard Liao
2015-03-11  3:39 ` [PATCH v2 2/2] ASoC: rt5670: export jack suspend/resume APIs Bard Liao

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=1426045365-15975-2-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=john.lin@realtek.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=mengdong.lin@intel.com \
    --cc=oder_chiou@realtek.com \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.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 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.