Skip to contentSkip to conversation

SoC: rt5670: Add IRQ function

PATCH Superseded Bard Liao 1 participant 3 messages Mar 11, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bard Liao

author
#0 lore raw

PATCH 1/1 SoC: rt5670: Add IRQ function

This patch adds the IRQ function support of rt5670. We use a flag named dev_gpio in platform data to inform codec driver if the IRQ function is used or not. Also, we export rt5670_set_jack_detect for machine driver to pass the jack point.

---
 include/sound/rt5670.h    |   1 +
 sound/soc/codecs/rt5670.c | 176 +++++++++++++++++++++++++++++++++++++++++++++-
 sound/soc/codecs/rt5670.h |   4 ++
 3 files changed, 179 insertions(+), 2 deletions(-)
include/sound/rt5670.h +1 -0
index bd31119..b7d6051 100644
@@ -14,6 +14,7 @@
 struct rt5670_platform_data {
 	int jd_mode;
 	bool in2_diff;
+	bool dev_gpio;
 
 	bool dmic_en;
 	unsigned int dmic1_data_pin;
sound/soc/codecs/rt5670.c +174 -2

204 lines not on this page · raw message

sound/soc/codecs/rt5670.h +4 -0
index 0a67adb..0f3255a 100644
@@ -1988,6 +1988,8 @@ struct rt5670_priv {
 	struct snd_soc_codec *codec;
 	struct rt5670_platform_data pdata;
 	struct regmap *regmap;
+	struct snd_soc_jack *jack;
+	struct snd_soc_jack_gpio hp_gpio;
 
 	int sysclk;
 	int sysclk_src;
@@ -2004,4 +2006,6 @@ struct rt5670_priv {
 	int jack_type;
 };
 
+int rt5670_set_jack_detect(struct snd_soc_codec *codec,
+	struct snd_soc_jack *jack);
 #endif /* __RT5670_H__ */
Signature · 1 line
1.8.1.1.439.g50a6b54
author
#1 lore raw

PATCH v2 2/2 ASoC: rt5670: export jack suspend/resume APIs

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.

---
 sound/soc/codecs/rt5670.c | 18 ++++++++++++++++++
 sound/soc/codecs/rt5670.h |  3 +++
 2 files changed, 21 insertions(+)
sound/soc/codecs/rt5670.c +18 -0
index 23ca049..5999512 100644
@@ -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;
sound/soc/codecs/rt5670.h +3 -0
index 0f3255a..dc2b462 100644
@@ -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__ */
Signature · 1 line
1.8.1.1.439.g50a6b54