aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/sdp4430.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/sdp4430.c')
-rw-r--r--sound/soc/omap/sdp4430.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index ebbd62fc447c..189e03900637 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -24,6 +24,7 @@
24#include <sound/core.h> 24#include <sound/core.h>
25#include <sound/pcm.h> 25#include <sound/pcm.h>
26#include <sound/soc.h> 26#include <sound/soc.h>
27#include <sound/jack.h>
27 28
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29#include <plat/hardware.h> 30#include <plat/hardware.h>
@@ -65,6 +66,21 @@ static struct snd_soc_ops sdp4430_ops = {
65 .hw_params = sdp4430_hw_params, 66 .hw_params = sdp4430_hw_params,
66}; 67};
67 68
69/* Headset jack */
70static struct snd_soc_jack hs_jack;
71
72/*Headset jack detection DAPM pins */
73static struct snd_soc_jack_pin hs_jack_pins[] = {
74 {
75 .pin = "Headset Mic",
76 .mask = SND_JACK_MICROPHONE,
77 },
78 {
79 .pin = "Headset Stereophone",
80 .mask = SND_JACK_HEADPHONE,
81 },
82};
83
68static int sdp4430_get_power_mode(struct snd_kcontrol *kcontrol, 84static int sdp4430_get_power_mode(struct snd_kcontrol *kcontrol,
69 struct snd_ctl_elem_value *ucontrol) 85 struct snd_ctl_elem_value *ucontrol)
70{ 86{
@@ -101,6 +117,7 @@ static const struct snd_soc_dapm_widget sdp4430_twl6040_dapm_widgets[] = {
101 SND_SOC_DAPM_MIC("Headset Mic", NULL), 117 SND_SOC_DAPM_MIC("Headset Mic", NULL),
102 SND_SOC_DAPM_HP("Headset Stereophone", NULL), 118 SND_SOC_DAPM_HP("Headset Stereophone", NULL),
103 SND_SOC_DAPM_SPK("Earphone Spk", NULL), 119 SND_SOC_DAPM_SPK("Earphone Spk", NULL),
120 SND_SOC_DAPM_INPUT("Aux/FM Stereo In"),
104}; 121};
105 122
106static const struct snd_soc_dapm_route audio_map[] = { 123static const struct snd_soc_dapm_route audio_map[] = {
@@ -123,6 +140,10 @@ static const struct snd_soc_dapm_route audio_map[] = {
123 140
124 /* Earphone speaker */ 141 /* Earphone speaker */
125 {"Earphone Spk", NULL, "EP"}, 142 {"Earphone Spk", NULL, "EP"},
143
144 /* Aux/FM Stereo In: AFML, AFMR */
145 {"AFML", NULL, "Aux/FM Stereo In"},
146 {"AFMR", NULL, "Aux/FM Stereo In"},
126}; 147};
127 148
128static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) 149static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
@@ -149,14 +170,28 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
149 /* SDP4430 connected pins */ 170 /* SDP4430 connected pins */
150 snd_soc_dapm_enable_pin(dapm, "Ext Mic"); 171 snd_soc_dapm_enable_pin(dapm, "Ext Mic");
151 snd_soc_dapm_enable_pin(dapm, "Ext Spk"); 172 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
173 snd_soc_dapm_enable_pin(dapm, "AFML");
174 snd_soc_dapm_enable_pin(dapm, "AFMR");
152 snd_soc_dapm_enable_pin(dapm, "Headset Mic"); 175 snd_soc_dapm_enable_pin(dapm, "Headset Mic");
153 snd_soc_dapm_enable_pin(dapm, "Headset Stereophone"); 176 snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
154 177
155 /* TWL6040 not connected pins */
156 snd_soc_dapm_nc_pin(dapm, "AFML");
157 snd_soc_dapm_nc_pin(dapm, "AFMR");
158
159 ret = snd_soc_dapm_sync(dapm); 178 ret = snd_soc_dapm_sync(dapm);
179 if (ret)
180 return ret;
181
182 /* Headset jack detection */
183 ret = snd_soc_jack_new(codec, "Headset Jack",
184 SND_JACK_HEADSET, &hs_jack);
185 if (ret)
186 return ret;
187
188 ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
189 hs_jack_pins);
190
191 if (machine_is_omap_4430sdp())
192 twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET);
193 else
194 snd_soc_jack_report(&hs_jack, SND_JACK_HEADSET, SND_JACK_HEADSET);
160 195
161 return ret; 196 return ret;
162} 197}