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-support-for-earpiece.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File linux-2.6-ASoC-RX-51-Add-support-for-earpiece.patch of Package kernel-adaptation-n900
From 9a86d04b734cf72704bf9c4cbec092e3efe8b021 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula <jhnikula@gmail.com> Date: Tue, 29 Jun 2010 15:16:17 +0300 Subject: [PATCH 20/42] ASoC: RX-51: Add support for earpiece Earpiece is connected to HPL pins of the second TLV320AIC34 codec instance. Audio routings between AIC34A, AIC34B and earpiece is following AIC34A MONO_LOUT -> AIC34B LINE2R -> AIC34B HPL -> earpiece Add support for this routing by using the aic34b_dummy driver. As the aic34b_dummy should vanish after the ASoC multi-component is ready, also this patch must be edited by modifying the audio_map accordingly. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> --- sound/soc/omap/rx51.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index a85194a..ee9e7cd 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c @@ -39,6 +39,7 @@ #include "omap-pcm.h" #include "../codecs/tlv320aic3x.h" #include "../codecs/tpa6130a2.h" +#include "aic34b_dummy.h" #define RX51_TVOUT_SEL_GPIO 40 #define RX51_JACK_DETECT_GPIO 177 @@ -58,6 +59,7 @@ static int rx51_spk_func; static int rx51_dmic_func; static int rx51_jack_func; static int rx51_fmtx_func; +static int rx51_ear_func; static void rx51_ext_control(struct snd_soc_codec *codec) { @@ -86,6 +88,10 @@ static void rx51_ext_control(struct snd_soc_codec *codec) snd_soc_dapm_enable_pin(codec, "FM Transmitter"); else snd_soc_dapm_disable_pin(codec, "FM Transmitter"); + if (rx51_ear_func) + snd_soc_dapm_enable_pin(codec, "Earpiece"); + else + snd_soc_dapm_disable_pin(codec, "Earpiece"); gpio_set_value(RX51_TVOUT_SEL_GPIO, rx51_jack_func == RX51_JACK_TVOUT); @@ -239,6 +245,28 @@ static int rx51_set_fmtx(struct snd_kcontrol *kcontrol, return 1; } +static int rx51_get_ear(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + ucontrol->value.integer.value[0] = rx51_ear_func; + + return 0; +} + +static int rx51_set_ear(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); + + if (rx51_ear_func == ucontrol->value.integer.value[0]) + return 0; + + rx51_ear_func = ucontrol->value.integer.value[0]; + rx51_ext_control(codec); + + return 1; +} + static struct snd_soc_jack rx51_av_jack; static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = { @@ -256,6 +284,7 @@ static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = { SND_SOC_DAPM_MIC("DMic", NULL), SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_LINE("FM Transmitter", NULL), + SND_SOC_DAPM_SPK("Earpiece", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { @@ -272,18 +301,24 @@ static const struct snd_soc_dapm_route audio_map[] = { {"FM Transmitter", NULL, "LLOUT"}, {"FM Transmitter", NULL, "RLOUT"}, + + {"34B_LINE2R", NULL, "MONO_LOUT"}, + {"Earpiece", NULL, "34B_HPLOUT"}, + {"Earpiece", NULL, "34B_HPLCOM"}, }; 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 *fmtx_function[] = {"Off", "On"}; +static const char *ear_function[] = {"Off", "On"}; static const struct soc_enum rx51_enum[] = { SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(input_function), input_function), SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(jack_function), jack_function), SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(fmtx_function), fmtx_function), + SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(ear_function), ear_function), }; static const struct snd_kcontrol_new aic34_rx51_controls[] = { @@ -295,6 +330,8 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = { rx51_get_jack, rx51_set_jack), SOC_ENUM_EXT("FMTX Function", rx51_enum[3], rx51_get_fmtx, rx51_set_fmtx), + SOC_ENUM_EXT("Earpiece Function", rx51_enum[4], + rx51_get_ear, rx51_set_ear), }; static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) @@ -320,6 +357,8 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) tpa6130a2_add_controls(codec); snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42); + aic34b_add_controls(codec); + /* 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