Commit 77dd7e17 authored by Lopez Cruz, Misael's avatar Lopez Cruz, Misael Committed by Mark Brown

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: default avatarMisael Lopez Cruz <x0052729@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent eb5f6d75
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include "omap-pcm.h" #include "omap-pcm.h"
#include "../codecs/twl4030.h" #include "../codecs/twl4030.h"
static struct snd_soc_card snd_soc_sdp3430;
static int sdp3430_hw_params(struct snd_pcm_substream *substream, static int sdp3430_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
...@@ -82,6 +84,27 @@ static struct snd_soc_ops sdp3430_ops = { ...@@ -82,6 +84,27 @@ static struct snd_soc_ops sdp3430_ops = {
.hw_params = sdp3430_hw_params, .hw_params = sdp3430_hw_params,
}; };
/* Headset jack */
static struct snd_soc_jack hs_jack;
/* Headset jack detection DAPM pins */
static struct snd_soc_jack_pin hs_jack_pins[] = {
{
.pin = "Headset Jack",
.mask = SND_JACK_HEADSET,
},
};
/* Headset jack detection gpios */
static struct snd_soc_jack_gpio hs_jack_gpios[] = {
{
.gpio = (OMAP_MAX_GPIO_LINES + 2),
.name = "hsdet-gpio",
.report = SND_JACK_HEADSET,
.debounce_time = 200,
},
};
/* SDP3430 machine DAPM */ /* SDP3430 machine DAPM */
static const struct snd_soc_dapm_widget sdp3430_twl4030_dapm_widgets[] = { static const struct snd_soc_dapm_widget sdp3430_twl4030_dapm_widgets[] = {
SND_SOC_DAPM_MIC("Ext Mic", NULL), SND_SOC_DAPM_MIC("Ext Mic", NULL),
...@@ -141,30 +164,25 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec) ...@@ -141,30 +164,25 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
snd_soc_dapm_nc_pin(codec, "CARKITR"); snd_soc_dapm_nc_pin(codec, "CARKITR");
ret = snd_soc_dapm_sync(codec); ret = snd_soc_dapm_sync(codec);
if (ret)
return ret;
/* Headset jack detection */
ret = snd_soc_jack_new(&snd_soc_sdp3430, "Headset Jack",
SND_JACK_HEADSET, &hs_jack);
if (ret)
return ret; return ret;
}
/* Headset jack */ ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
static struct snd_soc_jack hs_jack; hs_jack_pins);
if (ret)
return ret;
/* Headset jack detection DAPM pins */ ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
static struct snd_soc_jack_pin hs_jack_pins[] = { hs_jack_gpios);
{
.pin = "Headset Jack",
.mask = SND_JACK_HEADSET,
},
};
/* Headset jack detection gpios */ return ret;
static struct snd_soc_jack_gpio hs_jack_gpios[] = { }
{
.gpio = (OMAP_MAX_GPIO_LINES + 2),
.name = "hsdet-gpio",
.report = SND_JACK_HEADSET,
.debounce_time = 200,
},
};
/* Digital audio interface glue - connects codec <--> CPU */ /* Digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link sdp3430_dai = { static struct snd_soc_dai_link sdp3430_dai = {
...@@ -216,21 +234,7 @@ static int __init sdp3430_soc_init(void) ...@@ -216,21 +234,7 @@ static int __init sdp3430_soc_init(void)
if (ret) if (ret)
goto err1; goto err1;
/* Headset jack detection */ return 0;
ret = snd_soc_jack_new(&snd_soc_sdp3430, "SDP3430 headset jack",
SND_JACK_HEADSET, &hs_jack);
if (ret)
return ret;
ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
hs_jack_pins);
if (ret)
return ret;
ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
hs_jack_gpios);
return ret;
err1: err1:
printk(KERN_ERR "Unable to add platform device\n"); printk(KERN_ERR "Unable to add platform device\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment