1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
index 5cc1ef2..643dae3 100644
--- a/sound/soc/s3c24xx/neo1973_wm8753.c
+++ b/sound/soc/s3c24xx/neo1973_wm8753.c
@@ -23,6 +23,7 @@
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
+#include <sound/jack.h>
#include <sound/tlv.h>
#include <asm/mach-types.h>
@@ -38,6 +39,9 @@
#include "lm4857.h"
#include <linux/i2c.h>
+static struct snd_soc_card neo1973;
+static struct snd_soc_jack hs_jack;
+
#ifdef CONFIG_MACH_NEO1973_GTA01
static struct lm4857 {
@@ -495,6 +499,29 @@ static const struct snd_kcontrol_new wm8753_neo1973_gta02_controls[] = {};
static const struct snd_soc_dapm_widget wm8753_dapm_widgets_gta02[] = {};
#endif
+static struct snd_soc_jack_pin hs_jack_pins[] = {
+ {
+ .pin = "Headset Mic",
+ .mask = SND_JACK_MICROPHONE,
+ },
+ {
+ .pin = "Stereo Out",
+ .mask = SND_JACK_HEADPHONE,
+ .invert = 1,
+ },
+};
+
+static struct snd_soc_jack_gpio hs_jack_gpios[] = {
+ {
+ .gpio = GTA02_GPIO_JACK_INSERT,
+ .name = "headset-gpio",
+ .report = SND_JACK_HEADSET,
+ .debounce_time = 100,
+ },
+};
+
+
+
static int neo1973_wm8753_init(struct snd_soc_codec *codec)
{
int err;
@@ -566,6 +593,24 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec)
snd_soc_dapm_sync(codec);
+ err = snd_soc_jack_new(&neo1973, "Headset Jack", SND_JACK_HEADSET, &hs_jack);
+ if (err) {
+ dev_err(codec->card->dev, "failed to alloc headset jack\n");
+ return err;
+ }
+
+ err = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), hs_jack_pins);
+ if (err) {
+ dev_err(codec->card->dev, "failed to add headset jack pins\n");
+ return err;
+ }
+
+ err = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios), hs_jack_gpios);
+ if (err) {
+ dev_err(codec->card->dev, "failed to add headset jack gpios\n");
+ return err;
+ }
+
return 0;
}
@@ -740,6 +785,7 @@ static inline void neo1973_gta02_exit(void) {}
static void __exit neo1973_exit(void)
{
snd_soc_unregister_dai(&bt_dai);
+ snd_soc_jack_free_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios), hs_jack_gpios);
platform_device_unregister(neo1973_snd_device);
if (machine_is_neo1973_gta01())
|