aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap
diff options
context:
space:
mode:
authorLopez Cruz, Misael <x0052729@ti.com>2009-03-12 22:45:27 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-03-13 08:08:53 -0400
commit77dd7e17b86bd81b3638e01d784a72652071508b (patch)
treed54adf7cb0cb2691cb1bb23c17cce0c5beea71d2 /sound/soc/omap
parenteb5f6d753e337834c7ceb07824ee472e43d9a7a2 (diff)
ASoC: Move headset jack registration to device initialization for SDP3430
Move headset jack registration to the codec/machine specific initialization. Having the jack registration in machine init causes that the jack device gets initialized but not registered since the sound card is registered before the jack. Moving jack registration to device initialization will register the jack device along with all other devices associated to the card when the card is registed. As a consequence of jack device registered properly, the jack is detected as an input device. Signed-off-by: Misael Lopez Cruz <x0052729@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/omap')
-rw-r--r--sound/soc/omap/sdp3430.c74
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
42static struct snd_soc_card snd_soc_sdp3430;
43
42static int sdp3430_hw_params(struct snd_pcm_substream *substream, 44static 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 */
88static struct snd_soc_jack hs_jack;
89
90/* Headset jack detection DAPM pins */
91static 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 */
99static 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 */
86static const struct snd_soc_dapm_widget sdp3430_twl4030_dapm_widgets[] = { 109static 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),
149static 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),
152static 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;
160static 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 */
170static struct snd_soc_dai_link sdp3430_dai = { 188static 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
235err1: 239err1:
236 printk(KERN_ERR "Unable to add platform device\n"); 240 printk(KERN_ERR "Unable to add platform device\n");