diff options
author | NeilBrown <neilb@suse.de> | 2012-08-18 07:58:33 +1000 |
---|---|---|
committer | H. Nikolaus Schaller <hns@goldelico.com> | 2013-07-22 16:46:48 +0200 |
commit | b5cbb6b873d899c67769deca6ceecb34a29f272d (patch) | |
tree | 067e66f6f5e9beff217ccefebd2d7442979b9522 | |
parent | 0735f4d7918284acb167be22d829e75827702355 (diff) | |
download | kernel_goldelico_gta04-b5cbb6b873d899c67769deca6ceecb34a29f272d.zip kernel_goldelico_gta04-b5cbb6b873d899c67769deca6ceecb34a29f272d.tar.gz kernel_goldelico_gta04-b5cbb6b873d899c67769deca6ceecb34a29f272d.tar.bz2 |
GTA04: add simple headset-jack detection support.
As headset-insert doesn't generate an interrupt we need to
poll the MICSENSE line to see if a headset is present.
We do this every 500ms. It takes nearly that long to physically
insert a jack, so much faster wouldn't help and would impact
power drain more.
As detection is done by polling, a jack-insert or removal event cannot
wake the device from suspend. Events are only detected while device
is awake.
We keep the HSMIC bias enabled whenever the 'input' device is open,
except during suspend so that we can poll reliably. Turning it off
and on seems to interfere with reliable measurements.
Currently a reading below 100 is 'nothing plugged in' while a reading
above that is 'mic and headphone plugged in'.
I measure between 19 and 26 when nothing is plugged in, and between
804 and 811 when a headset is plugged in.
Input device will appear as
/dev/input/jack
if the udev rules file in GTA04/udev-rules/input.rules
is installed.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | GTA04/udev-rules/input.rules | 2 | ||||
-rw-r--r-- | sound/soc/omap/gta04-audio.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/GTA04/udev-rules/input.rules b/GTA04/udev-rules/input.rules index 2cc8df9..a96feb8 100644 --- a/GTA04/udev-rules/input.rules +++ b/GTA04/udev-rules/input.rules @@ -4,4 +4,4 @@ SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0,3,*a0,1, SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0,1,*k74,*", SYMLINK+="input/power" SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0,1,*kA9,*", SYMLINK+="input/aux" SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0,1,*kF0,*", SYMLINK+="input/incoming" -SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0*,5,*w[24678D]*", SYMLINK+="input/jack" +SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0,5,*w[24678D]*", SYMLINK+="input/jack" diff --git a/sound/soc/omap/gta04-audio.c b/sound/soc/omap/gta04-audio.c index 86d4d8a..c820727 100644 --- a/sound/soc/omap/gta04-audio.c +++ b/sound/soc/omap/gta04-audio.c @@ -34,6 +34,8 @@ #include <linux/i2c/twl4030-madc.h> +#include <linux/i2c/twl4030-madc.h> + #include "omap-mcbsp.h" #include "../codecs/twl4030.h" @@ -279,8 +281,12 @@ static int omap3gta04_init(struct snd_soc_pcm_runtime *runtime) * but we need to poll :-( */ ret = snd_soc_jack_new(codec, "Headset Jack", +<<<<<<< HEAD SND_JACK_HEADSET | SND_JACK_BTN_0, &jack.hs_jack); +======= + SND_JACK_HEADSET, &jack.hs_jack); +>>>>>>> GTA04: add simple headset-jack detection support. if (ret) return ret; INIT_DELAYED_WORK(&jack.jack_work, gta04_audio_jack_work); |