[alsa-devel] [PATCH 2/2] ASoC: sdp4430: Add Jack support
From: Jorge Eduardo Candelaria jorge.candelaria@ti.com
Use jack framework to enable detection for the headset microphone and stereo output.
Signed-off-by: Jorge Eduardo Candelaria jorge.candelaria@ti.com Signed-off-by: Margarita Olaya Cabrera magi.olaya@ti.com --- sound/soc/omap/sdp4430.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 0c37c51..ca7fb90 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -24,6 +24,7 @@ #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> +#include <sound/jack.h>
#include <asm/mach-types.h> #include <plat/hardware.h> @@ -65,6 +66,21 @@ static struct snd_soc_ops sdp4430_ops = { .hw_params = sdp4430_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 Mic", + .mask = SND_JACK_MICROPHONE, + }, + { + .pin = "Headset Stereophone", + .mask = SND_JACK_HEADPHONE, + }, +}; + static int sdp4430_get_power_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -160,7 +176,19 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
ret = snd_soc_dapm_sync(dapm); + if (ret) + return ret; + + /* Headset jack detection */ + ret = snd_soc_jack_new(codec, "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);
+ twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); return ret; }
On Mon, Dec 06, 2010 at 04:34:53PM -0600, Olaya, Margarita wrote:
From: Jorge Eduardo Candelaria jorge.candelaria@ti.com
Use jack framework to enable detection for the headset microphone and stereo output.
This looks OK but...
- twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); return ret;
...this function doesn't appear to be in mainline yet?
-----Original Message----- From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com] Sent: Monday, December 06, 2010 4:56 PM To: Olaya, Margarita Cc: Liam Girdwood; alsa-devel@alsa-project.org Subject: Re: [PATCH 2/2] ASoC: sdp4430: Add Jack support
On Mon, Dec 06, 2010 at 04:34:53PM -0600, Olaya, Margarita wrote:
From: Jorge Eduardo Candelaria jorge.candelaria@ti.com
Use jack framework to enable detection for the headset microphone and stereo output.
This looks OK but...
- twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); return ret;
...this function doesn't appear to be in mainline yet?
ups I'll resubmit with the missing patch.
Regards, Margarita
participants (2)
-
Mark Brown
-
Olaya, Margarita