diff options
Diffstat (limited to 'sound/soc/omap')
-rw-r--r-- | sound/soc/omap/sdp3430.c | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c index 715c648203a4..0a41de677e77 100644 --- a/sound/soc/omap/sdp3430.c +++ b/sound/soc/omap/sdp3430.c | |||
@@ -39,6 +39,8 @@ | |||
39 | #include "omap-pcm.h" | 39 | #include "omap-pcm.h" |
40 | #include "../codecs/twl4030.h" | 40 | #include "../codecs/twl4030.h" |
41 | 41 | ||
42 | static struct snd_soc_card snd_soc_sdp3430; | ||
43 | |||
42 | static int sdp3430_hw_params(struct snd_pcm_substream *substream, | 44 | static int sdp3430_hw_params(struct snd_pcm_substream *substream, |
43 | struct snd_pcm_hw_params *params) | 45 | struct snd_pcm_hw_params *params) |
44 | { | 46 | { |
@@ -82,6 +84,27 @@ static struct snd_soc_ops sdp3430_ops = { | |||
82 | .hw_params = sdp3430_hw_params, | 84 | .hw_params = sdp3430_hw_params, |
83 | }; | 85 | }; |
84 | 86 | ||
87 | /* Headset jack */ | ||
88 | static struct snd_soc_jack hs_jack; | ||
89 | |||
90 | /* Headset jack detection DAPM pins */ | ||
91 | static struct snd_soc_jack_pin hs_jack_pins[] = { | ||
92 | { | ||
93 | .pin = "Headset Jack", | ||
94 | .mask = SND_JACK_HEADSET, | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | /* Headset jack detection gpios */ | ||
99 | static struct snd_soc_jack_gpio hs_jack_gpios[] = { | ||
100 | { | ||
101 | .gpio = (OMAP_MAX_GPIO_LINES + 2), | ||
102 | .name = "hsdet-gpio", | ||
103 | .report = SND_JACK_HEADSET, | ||
104 | .debounce_time = 200, | ||
105 | }, | ||
106 | }; | ||
107 | |||
85 | /* SDP3430 machine DAPM */ | 108 | /* SDP3430 machine DAPM */ |
86 | static const struct snd_soc_dapm_widget sdp3430_twl4030_dapm_widgets[] = { | 109 | static const struct snd_soc_dapm_widget sdp3430_twl4030_dapm_widgets[] = { |
87 | SND_SOC_DAPM_MIC("Ext Mic", NULL), | 110 | SND_SOC_DAPM_MIC("Ext Mic", NULL), |
@@ -141,30 +164,25 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec) | |||
141 | snd_soc_dapm_nc_pin(codec, "CARKITR"); | 164 | snd_soc_dapm_nc_pin(codec, "CARKITR"); |
142 | 165 | ||
143 | ret = snd_soc_dapm_sync(codec); | 166 | ret = snd_soc_dapm_sync(codec); |
167 | if (ret) | ||
168 | return ret; | ||
144 | 169 | ||
145 | return ret; | 170 | /* Headset jack detection */ |
146 | } | 171 | ret = snd_soc_jack_new(&snd_soc_sdp3430, "Headset Jack", |
172 | SND_JACK_HEADSET, &hs_jack); | ||
173 | if (ret) | ||
174 | return ret; | ||
147 | 175 | ||
148 | /* Headset jack */ | 176 | ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), |
149 | static struct snd_soc_jack hs_jack; | 177 | hs_jack_pins); |
178 | if (ret) | ||
179 | return ret; | ||
150 | 180 | ||
151 | /* Headset jack detection DAPM pins */ | 181 | ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios), |
152 | static struct snd_soc_jack_pin hs_jack_pins[] = { | 182 | hs_jack_gpios); |
153 | { | ||
154 | .pin = "Headset Jack", | ||
155 | .mask = SND_JACK_HEADSET, | ||
156 | }, | ||
157 | }; | ||
158 | 183 | ||
159 | /* Headset jack detection gpios */ | 184 | return ret; |
160 | static struct snd_soc_jack_gpio hs_jack_gpios[] = { | 185 | } |
161 | { | ||
162 | .gpio = (OMAP_MAX_GPIO_LINES + 2), | ||
163 | .name = "hsdet-gpio", | ||
164 | .report = SND_JACK_HEADSET, | ||
165 | .debounce_time = 200, | ||
166 | }, | ||
167 | }; | ||
168 | 186 | ||
169 | /* Digital audio interface glue - connects codec <--> CPU */ | 187 | /* Digital audio interface glue - connects codec <--> CPU */ |
170 | static struct snd_soc_dai_link sdp3430_dai = { | 188 | static struct snd_soc_dai_link sdp3430_dai = { |
@@ -216,21 +234,7 @@ static int __init sdp3430_soc_init(void) | |||
216 | if (ret) | 234 | if (ret) |
217 | goto err1; | 235 | goto err1; |
218 | 236 | ||
219 | /* Headset jack detection */ | 237 | return 0; |
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; | ||
234 | 238 | ||
235 | err1: | 239 | err1: |
236 | printk(KERN_ERR "Unable to add platform device\n"); | 240 | printk(KERN_ERR "Unable to add platform device\n"); |