aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/omap/sdp3430.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 4eab4b491dee..715c648203a4 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -28,6 +28,7 @@
28#include <sound/pcm.h> 28#include <sound/pcm.h>
29#include <sound/soc.h> 29#include <sound/soc.h>
30#include <sound/soc-dapm.h> 30#include <sound/soc-dapm.h>
31#include <sound/jack.h>
31 32
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33#include <mach/hardware.h> 34#include <mach/hardware.h>
@@ -122,7 +123,7 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
122 /* SDP3430 connected pins */ 123 /* SDP3430 connected pins */
123 snd_soc_dapm_enable_pin(codec, "Ext Mic"); 124 snd_soc_dapm_enable_pin(codec, "Ext Mic");
124 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 125 snd_soc_dapm_enable_pin(codec, "Ext Spk");
125 snd_soc_dapm_enable_pin(codec, "Headset Jack"); 126 snd_soc_dapm_disable_pin(codec, "Headset Jack");
126 127
127 /* TWL4030 not connected pins */ 128 /* TWL4030 not connected pins */
128 snd_soc_dapm_nc_pin(codec, "AUXL"); 129 snd_soc_dapm_nc_pin(codec, "AUXL");
@@ -144,6 +145,27 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
144 return ret; 145 return ret;
145} 146}
146 147
148/* Headset jack */
149static struct snd_soc_jack hs_jack;
150
151/* Headset jack detection DAPM pins */
152static struct snd_soc_jack_pin hs_jack_pins[] = {
153 {
154 .pin = "Headset Jack",
155 .mask = SND_JACK_HEADSET,
156 },
157};
158
159/* Headset jack detection gpios */
160static struct snd_soc_jack_gpio hs_jack_gpios[] = {
161 {
162 .gpio = (OMAP_MAX_GPIO_LINES + 2),
163 .name = "hsdet-gpio",
164 .report = SND_JACK_HEADSET,
165 .debounce_time = 200,
166 },
167};
168
147/* Digital audio interface glue - connects codec <--> CPU */ 169/* Digital audio interface glue - connects codec <--> CPU */
148static struct snd_soc_dai_link sdp3430_dai = { 170static struct snd_soc_dai_link sdp3430_dai = {
149 .name = "TWL4030", 171 .name = "TWL4030",
@@ -194,7 +216,21 @@ static int __init sdp3430_soc_init(void)
194 if (ret) 216 if (ret)
195 goto err1; 217 goto err1;
196 218
197 return 0; 219 /* Headset jack detection */
220 ret = snd_soc_jack_new(&snd_soc_sdp3430, "SDP3430 headset jack",
221 SND_JACK_HEADSET, &hs_jack);
222 if (ret)
223 return ret;
224
225 ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
226 hs_jack_pins);
227 if (ret)
228 return ret;
229
230 ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
231 hs_jack_gpios);
232
233 return ret;
198 234
199err1: 235err1:
200 printk(KERN_ERR "Unable to add platform device\n"); 236 printk(KERN_ERR "Unable to add platform device\n");
@@ -206,6 +242,9 @@ module_init(sdp3430_soc_init);
206 242
207static void __exit sdp3430_soc_exit(void) 243static void __exit sdp3430_soc_exit(void)
208{ 244{
245 snd_soc_jack_free_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
246 hs_jack_gpios);
247
209 platform_device_unregister(sdp3430_snd_device); 248 platform_device_unregister(sdp3430_snd_device);
210} 249}
211module_exit(sdp3430_soc_exit); 250module_exit(sdp3430_soc_exit);