[alsa-devel] [PATCH] ASoC: rt5682: Add option to select pulse IRQ in jack detect

Akshu Agrawal akshu.agrawal at amd.com
Fri Dec 20 07:12:19 CET 2019


Some SoC need to set IRQ type as pulse along with other JD1 options.

Signed-off-by: Akshu Agrawal <akshu.agrawal at amd.com>
---
 include/sound/rt5682.h    | 1 +
 sound/soc/codecs/rt5682.c | 3 +++
 sound/soc/codecs/rt5682.h | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/include/sound/rt5682.h b/include/sound/rt5682.h
index bc2c31734df1..64cfa77ec9ee 100644
--- a/include/sound/rt5682.h
+++ b/include/sound/rt5682.h
@@ -22,6 +22,7 @@ enum rt5682_dmic1_clk_pin {
 enum rt5682_jd_src {
 	RT5682_JD_NULL,
 	RT5682_JD1,
+	RT5682_JD2,
 };
 
 struct rt5682_platform_data {
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index ae6f6121bc1b..5135d7757361 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -1009,6 +1009,9 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,
 	}
 
 	switch (rt5682->pdata.jd_src) {
+	case RT5682_JD2:
+		regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2,
+			RT5682_JD1_PULSE_MASK, RT5682_JD1_PULSE_EN);
 	case RT5682_JD1:
 		snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_2,
 			RT5682_EXT_JD_SRC, RT5682_EXT_JD_SRC_MANUAL);
diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
index 18faaa2a49a0..434b1c9778b2 100644
--- a/sound/soc/codecs/rt5682.h
+++ b/sound/soc/codecs/rt5682.h
@@ -1091,6 +1091,8 @@
 #define RT5682_JD1_POL_MASK			(0x1 << 13)
 #define RT5682_JD1_POL_NOR			(0x0 << 13)
 #define RT5682_JD1_POL_INV			(0x1 << 13)
+#define RT5682_JD1_PULSE_MASK			(0x1 << 10)
+#define RT5682_JD1_PULSE_EN			(0x1 << 10)
 
 /* IRQ Control 3 (0x00b8) */
 #define RT5682_IL_IRQ_MASK			(0x1 << 7)
-- 
2.17.1



More information about the Alsa-devel mailing list