Search
SailfishOS Open Build Service
>
Projects
>
home:dcthang:branches:nemo:devel:hw:ti:omap3:n900
>
kernel-adaptation-n900
> linux-2.6-ASoC-RX-51-Add-mic-input-to-AV-jack.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File linux-2.6-ASoC-RX-51-Add-mic-input-to-AV-jack.patch of Package kernel-adaptation-n900
From 1fb7361fed465b519a714cd39ddd4001e382b390 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula <jhnikula@gmail.com> Date: Tue, 29 Jun 2010 16:01:47 +0300 Subject: [PATCH 21/42] ASoC: RX-51: Add mic input to AV jack Mic input is connected to LINE1L of the AIC34A via ECI_SW2 (name took from the Maemo 2.6.28 kernel sources) switch. This patch adds the headset feature to AV jack. Headset is combination of headphone stereo output with mic input. This patch doesn't drive the mic bias so signal will be too weak to be usable. The mic bias feature will be introduced by another patch. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> --- sound/soc/omap/rx51.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index ee9e7cd..bbaaea9 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c @@ -43,6 +43,7 @@ #define RX51_TVOUT_SEL_GPIO 40 #define RX51_JACK_DETECT_GPIO 177 +#define RX51_ECI_SW2_GPIO 182 /* * REVISIT: TWL4030 GPIO base in RX-51. Now statically defined to 192. This * gpio is reserved in arch/arm/mach-omap2/board-rx51-peripherals.c @@ -53,6 +54,7 @@ enum { RX51_JACK_DISABLED, RX51_JACK_TVOUT, /* tv-out with stereo audio */ RX51_JACK_HP, /* stereo output, no mic */ + RX51_JACK_HS, /* stereo output with mic input */ }; static int rx51_spk_func; @@ -63,9 +65,11 @@ static int rx51_ear_func; static void rx51_ext_control(struct snd_soc_codec *codec) { - int hp = 0; + int hp = 0, mic = 0; switch (rx51_jack_func) { + case RX51_JACK_HS: + mic = 1; case RX51_JACK_TVOUT: case RX51_JACK_HP: hp = 1; @@ -92,6 +96,10 @@ static void rx51_ext_control(struct snd_soc_codec *codec) snd_soc_dapm_enable_pin(codec, "Earpiece"); else snd_soc_dapm_disable_pin(codec, "Earpiece"); + if (mic) + snd_soc_dapm_enable_pin(codec, "Mic Jack"); + else + snd_soc_dapm_disable_pin(codec, "Mic Jack"); gpio_set_value(RX51_TVOUT_SEL_GPIO, rx51_jack_func == RX51_JACK_TVOUT); @@ -285,6 +293,7 @@ static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_LINE("FM Transmitter", NULL), SND_SOC_DAPM_SPK("Earpiece", NULL), + SND_SOC_DAPM_MIC("Mic Jack", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { @@ -305,11 +314,13 @@ static const struct snd_soc_dapm_route audio_map[] = { {"34B_LINE2R", NULL, "MONO_LOUT"}, {"Earpiece", NULL, "34B_HPLOUT"}, {"Earpiece", NULL, "34B_HPLCOM"}, + + {"LINE1L", NULL, "Mic Jack"}, }; static const char *spk_function[] = {"Off", "On"}; static const char *input_function[] = {"ADC", "Digital Mic"}; -static const char *jack_function[] = {"Off", "TV-OUT", "Headphone"}; +static const char *jack_function[] = {"Off", "TV-OUT", "Headphone", "Headset"}; static const char *fmtx_function[] = {"Off", "On"}; static const char *ear_function[] = {"Off", "On"}; @@ -410,6 +421,10 @@ static int __init rx51_soc_init(void) if (err) goto err_gpio_tvout_sel; gpio_direction_output(RX51_TVOUT_SEL_GPIO, 0); + err = gpio_request(RX51_ECI_SW2_GPIO, "eci_sw2"); + if (err) + goto err_gpio_eci_sw2; + gpio_direction_output(RX51_ECI_SW2_GPIO, 1); rx51_snd_device = platform_device_alloc("soc-audio", -1); if (!rx51_snd_device) { @@ -427,6 +442,8 @@ static int __init rx51_soc_init(void) err2: platform_device_put(rx51_snd_device); err1: + gpio_free(RX51_ECI_SW2_GPIO); +err_gpio_eci_sw2: gpio_free(RX51_TVOUT_SEL_GPIO); err_gpio_tvout_sel: @@ -439,6 +456,7 @@ static void __exit rx51_soc_exit(void) rx51_av_jack_gpios); platform_device_unregister(rx51_snd_device); + gpio_free(RX51_ECI_SW2_GPIO); gpio_free(RX51_TVOUT_SEL_GPIO); } -- 1.7.0.4