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-FM-transmitter.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File linux-2.6-ASoC-RX-51-Add-support-for-FM-transmitter.patch of Package kernel-adaptation-n900
From e866a364ff2105c6ff3a932306cc2545e0044b18 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula <jhnikula@gmail.com> Date: Tue, 22 Jun 2010 18:11:32 +0300 Subject: [PATCH 17/42] ASoC: RX-51: Add support for FM transmitter Nokia N900/RX-51 has Si4713 FM transmitter which shares the same codec line-out output than the TPA6130A2 amplifier. Add route to transmitter and kcontrol 'FMTX Function' which used to indicate to DAPM when the route to FM transmitter should be active. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> --- sound/soc/omap/rx51.c | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index 1f59fff..a85194a 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c @@ -57,6 +57,7 @@ enum { static int rx51_spk_func; static int rx51_dmic_func; static int rx51_jack_func; +static int rx51_fmtx_func; static void rx51_ext_control(struct snd_soc_codec *codec) { @@ -81,6 +82,10 @@ static void rx51_ext_control(struct snd_soc_codec *codec) snd_soc_dapm_enable_pin(codec, "Headphone Jack"); else snd_soc_dapm_disable_pin(codec, "Headphone Jack"); + if (rx51_fmtx_func) + snd_soc_dapm_enable_pin(codec, "FM Transmitter"); + else + snd_soc_dapm_disable_pin(codec, "FM Transmitter"); gpio_set_value(RX51_TVOUT_SEL_GPIO, rx51_jack_func == RX51_JACK_TVOUT); @@ -212,6 +217,28 @@ static int rx51_set_jack(struct snd_kcontrol *kcontrol, return 1; } +static int rx51_get_fmtx(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + ucontrol->value.integer.value[0] = rx51_fmtx_func; + + return 0; +} + +static int rx51_set_fmtx(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); + + if (rx51_fmtx_func == ucontrol->value.integer.value[0]) + return 0; + + rx51_fmtx_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[] = { @@ -228,6 +255,7 @@ 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), + SND_SOC_DAPM_LINE("FM Transmitter", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { @@ -241,16 +269,21 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Headphone Jack", NULL, "TPA6130A2 Headphone Right"}, {"TPA6130A2 Left", NULL, "LLOUT"}, {"TPA6130A2 Right", NULL, "RLOUT"}, + + {"FM Transmitter", NULL, "LLOUT"}, + {"FM Transmitter", 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", "Headphone"}; +static const char *fmtx_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), }; static const struct snd_kcontrol_new aic34_rx51_controls[] = { @@ -260,6 +293,8 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = { rx51_get_input, rx51_set_input), SOC_ENUM_EXT("Jack Function", rx51_enum[2], rx51_get_jack, rx51_set_jack), + SOC_ENUM_EXT("FMTX Function", rx51_enum[3], + rx51_get_fmtx, rx51_set_fmtx), }; static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) -- 1.7.0.4