diff options
author | vivian, zhang <vivian.zhang@intel.com> | 2012-06-25 12:09:17 +0800 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-07-12 14:45:46 +0300 |
commit | 2b45454c4d5f4b3467eceb10e41bb26fccbbcb94 (patch) | |
tree | 676277f2824de7b93a80e32f7be6bf2cff97468b /sound | |
parent | 670100dad26d86f968cfee829bcb8f8e54994ecd (diff) | |
download | kernel-mfld-blackbay-2b45454c4d5f4b3467eceb10e41bb26fccbbcb94.tar.gz kernel-mfld-blackbay-2b45454c4d5f4b3467eceb10e41bb26fccbbcb94.tar.bz2 kernel-mfld-blackbay-2b45454c4d5f4b3467eceb10e41bb26fccbbcb94.zip |
Sound: import Jack Monitoring Interface from samsung
It is used to set jack status: earjack_online, earkey_online;
these status are required for earjack type detecting in avsystem project.
Signed-off-by: Vivian Zhang <vivian.zhang@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/mid-x86/mfld_machine.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c index 05a7cd3b7c7..ada89a039ac 100644 --- a/sound/soc/mid-x86/mfld_machine.c +++ b/sound/soc/mid-x86/mfld_machine.c @@ -33,6 +33,7 @@ #include <linux/wakelock.h> #include <linux/gpio.h> #include <linux/ipc_device.h> +#include <linux/jack.h> #include <asm/intel-mid.h> #include <asm/intel_scu_ipcutil.h> #include <asm/intel_mid_gpadc.h> @@ -47,6 +48,12 @@ #define MFLD_JACK_DEBOUNCE_TIME 250 /* mS */ #define MFLD_GPIO_HEADSET_DET_PIN 77 +#ifdef CONFIG_JACK_MON +#define JACK_UEVENT_NAME "earjack" +#define JACK_KEY_UEVENT_NAME "earkey" +#define SND_JACK_NONE 0x00 +#endif + /* jack detection voltage zones */ static struct snd_soc_jack_zone mfld_zones[] = { {MFLD_MV_START, MFLD_MV_AM_HS, SND_JACK_HEADPHONE}, @@ -71,6 +78,42 @@ static void mfld_jack_disable_mic_bias(struct snd_soc_codec *codec) mutex_unlock(&codec->mutex); } +static void mfld_jack_status_set(int jack) +{ + if (jack < SND_JACK_BTN_0) { + /* JACK */ + switch (jack) { + case SND_JACK_NONE: + pr_debug("Jack is detached\n"); + break; + case SND_JACK_HEADPHONE: + pr_debug("Jack is Earjack3\n"); + break; + case SND_JACK_HEADSET: + pr_debug("Jack is Earjack4\n"); + break; + default: + pr_debug("Jack is unknown\n"); + return; + } + jack_event_handler(JACK_UEVENT_NAME, jack); + } else { + /* JACK Key */ + switch (jack) { + case SND_JACK_BTN_0: + pr_debug("EAR_SEND_END is pressed\n"); + break; + case SND_JACK_BTN_1: + case SND_JACK_BTN_2: + default: + pr_debug("The key is unknown\n"); + return; + } + jack_event_handler(JACK_KEY_UEVENT_NAME, jack); + } +} + + static int mfld_get_headset_state(struct snd_soc_jack *jack) { int micbias, jack_type, hs_gpio = 1; @@ -193,6 +236,9 @@ void mfld_jack_wq(struct work_struct *work) pr_err("Invalid intr_id:0x%x\n", intr_id); return; } +#ifdef CONFIG_JACK_MON + mfld_jack_status_set(status); +#endif mfld_jack_report(jack, status); } |