Commit de0b9888 authored by Lopez Cruz, Misael's avatar Lopez Cruz, Misael Committed by Mark Brown

ASoC: Add headset jack detection for SDP3430 machine driver

Add headset jack detection for SDP3430 boards using SoC jack
reporting interface. Headset detection on SDP3430 board is
achieved through TWL4030 GPIO_2 pin.
Signed-off-by: default avatarMisael Lopez Cruz <x0052729@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent a454dad1
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include <sound/jack.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/hardware.h> #include <mach/hardware.h>
...@@ -122,7 +123,7 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec) ...@@ -122,7 +123,7 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
/* SDP3430 connected pins */ /* SDP3430 connected pins */
snd_soc_dapm_enable_pin(codec, "Ext Mic"); snd_soc_dapm_enable_pin(codec, "Ext Mic");
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(codec, "Ext Spk");
snd_soc_dapm_enable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(codec, "Headset Jack");
/* TWL4030 not connected pins */ /* TWL4030 not connected pins */
snd_soc_dapm_nc_pin(codec, "AUXL"); snd_soc_dapm_nc_pin(codec, "AUXL");
...@@ -144,6 +145,27 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec) ...@@ -144,6 +145,27 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
return ret; return ret;
} }
/* Headset jack */
static struct snd_soc_jack hs_jack;
/* Headset jack detection DAPM pins */
static struct snd_soc_jack_pin hs_jack_pins[] = {
{
.pin = "Headset Jack",
.mask = SND_JACK_HEADSET,
},
};
/* Headset jack detection gpios */
static struct snd_soc_jack_gpio hs_jack_gpios[] = {
{
.gpio = (OMAP_MAX_GPIO_LINES + 2),
.name = "hsdet-gpio",
.report = SND_JACK_HEADSET,
.debounce_time = 200,
},
};
/* Digital audio interface glue - connects codec <--> CPU */ /* Digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link sdp3430_dai = { static struct snd_soc_dai_link sdp3430_dai = {
.name = "TWL4030", .name = "TWL4030",
...@@ -194,7 +216,21 @@ static int __init sdp3430_soc_init(void) ...@@ -194,7 +216,21 @@ static int __init sdp3430_soc_init(void)
if (ret) if (ret)
goto err1; goto err1;
return 0; /* Headset jack detection */
ret = snd_soc_jack_new(&snd_soc_sdp3430, "SDP3430 headset jack",
SND_JACK_HEADSET, &hs_jack);
if (ret)
return ret;
ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
hs_jack_pins);
if (ret)
return ret;
ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
hs_jack_gpios);
return ret;
err1: err1:
printk(KERN_ERR "Unable to add platform device\n"); printk(KERN_ERR "Unable to add platform device\n");
...@@ -206,6 +242,9 @@ module_init(sdp3430_soc_init); ...@@ -206,6 +242,9 @@ module_init(sdp3430_soc_init);
static void __exit sdp3430_soc_exit(void) static void __exit sdp3430_soc_exit(void)
{ {
snd_soc_jack_free_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
hs_jack_gpios);
platform_device_unregister(sdp3430_snd_device); platform_device_unregister(sdp3430_snd_device);
} }
module_exit(sdp3430_soc_exit); module_exit(sdp3430_soc_exit);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment