[alsa-devel] [PATCH] ASoC: rt286: add irq enable/disable APIs and export

Jie Yang yang.jie at intel.com
Wed Feb 4 13:44:55 CET 2015


Some platforms, e.g. WSB, don't need irq handler and jack detection when
system is in Suspend, for power save reason.

Here add irq enable/disable APIs and export them, also disable LDO1,
which is used for jack detection when headphone is plugged in.

Signed-off-by: Jie Yang <yang.jie at intel.com>
Reviewed-by: Bard Liao <bardliao at realtek.com>
---
 sound/soc/codecs/rt286.c | 24 ++++++++++++++++++++++++
 sound/soc/codecs/rt286.h |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
index 8104d22..66afb9b 100644
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -400,6 +400,30 @@ int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
 }
 EXPORT_SYMBOL_GPL(rt286_mic_detect);
 
+int rt286_enable_irq(struct snd_soc_codec *codec)
+{
+	struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec);
+
+	if (rt286->jack->status | SND_JACK_HEADPHONE)
+		snd_soc_dapm_force_enable_pin(&rt286->codec->dapm, "LDO1");
+	snd_soc_dapm_sync(&rt286->codec->dapm);
+	enable_irq(rt286->i2c->irq);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(rt286_enable_irq);
+
+int rt286_disable_irq(struct snd_soc_codec *codec)
+{
+	struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec);
+
+	disable_irq(rt286->i2c->irq);
+
+	snd_soc_dapm_disable_pin(&rt286->codec->dapm, "LDO1");
+	snd_soc_dapm_sync(&rt286->codec->dapm);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(rt286_disable_irq);
+
 static int is_mclk_mode(struct snd_soc_dapm_widget *source,
 			 struct snd_soc_dapm_widget *sink)
 {
diff --git a/sound/soc/codecs/rt286.h b/sound/soc/codecs/rt286.h
index b539b73..fb18331 100644
--- a/sound/soc/codecs/rt286.h
+++ b/sound/soc/codecs/rt286.h
@@ -193,6 +193,8 @@ enum {
 };
 
 int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack);
+int rt286_enable_irq(struct snd_soc_codec *codec);
+int rt286_disable_irq(struct snd_soc_codec *codec);
 
 #endif /* __RT286_H__ */
 
-- 
1.9.1



More information about the Alsa-devel mailing list