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-stereo-audio-output-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-stereo-audio-output-to-AV-jack.patch of Package kernel-adaptation-n900
From f157a78fa02f8f3083779551724e1b3725273194 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula <jhnikula@gmail.com> Date: Tue, 22 Jun 2010 17:10:39 +0300 Subject: [PATCH 14/42] ASoC: RX-51: Add stereo audio output to AV jack The TPA6130A2 headphone amplifier is used in Nokia N900/RX-51 to drive the audio output pins in 4-pole multifunction audio-video jack. This patch implements audio output functionality, extends the control 'Jack Function' and limits the TPA6130A2 output level. Limiting is done because the TPA6130A2 can output very high audio levels to headphones. A value for the maximum volume is found from the Maemo 2.6.28 kernel sources. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> --- sound/soc/omap/Kconfig | 1 + sound/soc/omap/rx51.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index a088db6..b592298 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig @@ -24,6 +24,7 @@ config SND_OMAP_SOC_RX51 select OMAP_MCBSP select SND_OMAP_SOC_MCBSP select SND_SOC_TLV320AIC3X + select SND_SOC_TPA6130A2 help Say Y if you want to add support for SoC audio on Nokia RX-51 hardware. This is also known as Nokia N900 product. diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index 04b5723..1f59fff 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c @@ -38,6 +38,7 @@ #include "omap-mcbsp.h" #include "omap-pcm.h" #include "../codecs/tlv320aic3x.h" +#include "../codecs/tpa6130a2.h" #define RX51_TVOUT_SEL_GPIO 40 #define RX51_JACK_DETECT_GPIO 177 @@ -49,7 +50,8 @@ enum { RX51_JACK_DISABLED, - RX51_JACK_TVOUT, /* tv-out */ + RX51_JACK_TVOUT, /* tv-out with stereo audio */ + RX51_JACK_HP, /* stereo output, no mic */ }; static int rx51_spk_func; @@ -58,6 +60,15 @@ static int rx51_jack_func; static void rx51_ext_control(struct snd_soc_codec *codec) { + int hp = 0; + + switch (rx51_jack_func) { + case RX51_JACK_TVOUT: + case RX51_JACK_HP: + hp = 1; + break; + } + if (rx51_spk_func) snd_soc_dapm_enable_pin(codec, "Ext Spk"); else @@ -66,6 +77,10 @@ static void rx51_ext_control(struct snd_soc_codec *codec) snd_soc_dapm_enable_pin(codec, "DMic"); else snd_soc_dapm_disable_pin(codec, "DMic"); + if (hp) + snd_soc_dapm_enable_pin(codec, "Headphone Jack"); + else + snd_soc_dapm_disable_pin(codec, "Headphone Jack"); gpio_set_value(RX51_TVOUT_SEL_GPIO, rx51_jack_func == RX51_JACK_TVOUT); @@ -212,6 +227,7 @@ static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = { static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = { SND_SOC_DAPM_SPK("Ext Spk", rx51_spk_event), SND_SOC_DAPM_MIC("DMic", NULL), + SND_SOC_DAPM_HP("Headphone Jack", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { @@ -220,11 +236,16 @@ static const struct snd_soc_dapm_route audio_map[] = { {"DMic Rate 64", NULL, "Mic Bias 2V"}, {"Mic Bias 2V", NULL, "DMic"}, + + {"Headphone Jack", NULL, "TPA6130A2 Headphone Left"}, + {"Headphone Jack", NULL, "TPA6130A2 Headphone Right"}, + {"TPA6130A2 Left", NULL, "LLOUT"}, + {"TPA6130A2 Right", NULL, "RLOUT"}, }; static const char *spk_function[] = {"Off", "On"}; static const char *input_function[] = {"ADC", "Digital Mic"}; -static const char *jack_function[] = {"Off", "TV-OUT"}; +static const char *jack_function[] = {"Off", "TV-OUT", "Headphone"}; static const struct soc_enum rx51_enum[] = { SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), @@ -261,6 +282,9 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) snd_soc_dapm_new_controls(codec, aic34_dapm_widgets, ARRAY_SIZE(aic34_dapm_widgets)); + tpa6130a2_add_controls(codec); + snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42); + /* Set up RX-51 specific audio path audio_map */ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); -- 1.7.0.4