From c559fb7c52e33b707338d4e319ecdb46317ff6ee Mon Sep 17 00:00:00 2001 From: Banajit Goswami Date: Mon, 21 Nov 2016 17:49:35 -0800 Subject: [PATCH] ALSA: jack: Add support to report second microphone ALSA jack framework currently supports reporting only one single microphone. Add support to report presence of the second microphone to userspace. Change-Id: I72d16892f2fa563c026bf90d847d9365dcf2233a Signed-off-by: Phani Kumar Uppalapati Signed-off-by: Banajit Goswami Signed-off-by: Sudheer Papothi Signed-off-by: Meng Wang --- include/sound/jack.h | 3 +++ include/uapi/linux/input-event-codes.h | 7 ++++++- sound/core/jack.c | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/sound/jack.h b/include/sound/jack.h index 19020ee43a19..5c80e057445a 100644 --- a/include/sound/jack.h +++ b/include/sound/jack.h @@ -47,6 +47,9 @@ enum snd_jack_types { SND_JACK_OC_HPHL = 0x0040, SND_JACK_OC_HPHR = 0x0080, SND_JACK_UNSUPPORTED = 0x0100, + SND_JACK_MICROPHONE2 = 0x0200, + SND_JACK_ANC_HEADPHONE = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | + SND_JACK_MICROPHONE2, #endif /* Kept separate from switches to facilitate implementation */ diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 35125b6c30de..4cc770c490d4 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -810,7 +810,12 @@ #define SW_PEN_INSERTED 0x0f /* set = pen inserted */ #define SW_HPHL_OVERCURRENT 0x10 /* set = over current on left hph */ #define SW_HPHR_OVERCURRENT 0x11 /* set = over current on right hph */ -#define SW_UNSUPPORT_INSERT 0x12 /* set = unsupported device inserted */ +#ifdef CONFIG_AUDIO_QGKI +#define SW_MICROPHONE2_INSERT 0x12 /* set = inserted */ +#define SW_UNSUPPORT_INSERT 0x13 /* set = unsupported device inserted */ +#else +#define SW_UNSUPPORT_INSERT 0x12 /* set = unsupported device inserted */ +#endif #define SW_MAX 0x20 #define SW_CNT (SW_MAX+1) diff --git a/sound/core/jack.c b/sound/core/jack.c index e1594d0ca61f..d548122fd823 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -29,6 +29,9 @@ static int jack_switch_types[] = { SW_HPHL_OVERCURRENT, SW_HPHR_OVERCURRENT, SW_UNSUPPORT_INSERT, +#ifdef CONFIG_AUDIO_QGKI + SW_MICROPHONE2_INSERT, +#endif }; #endif /* CONFIG_SND_JACK_INPUT_DEV */