aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/omap/Kconfig1
-rw-r--r--sound/soc/omap/rx51.c43
2 files changed, 40 insertions, 4 deletions
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index a088db6d5091..b5922984eac6 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -24,6 +24,7 @@ config SND_OMAP_SOC_RX51
24 select OMAP_MCBSP 24 select OMAP_MCBSP
25 select SND_OMAP_SOC_MCBSP 25 select SND_OMAP_SOC_MCBSP
26 select SND_SOC_TLV320AIC3X 26 select SND_SOC_TLV320AIC3X
27 select SND_SOC_TPA6130A2
27 help 28 help
28 Say Y if you want to add support for SoC audio on Nokia RX-51 29 Say Y if you want to add support for SoC audio on Nokia RX-51
29 hardware. This is also known as Nokia N900 product. 30 hardware. This is also known as Nokia N900 product.
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 09fb0df8d416..251afbe303c6 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -31,6 +31,7 @@
31#include <sound/pcm.h> 31#include <sound/pcm.h>
32#include <sound/soc.h> 32#include <sound/soc.h>
33#include <plat/mcbsp.h> 33#include <plat/mcbsp.h>
34#include "../codecs/tpa6130a2.h"
34 35
35#include <asm/mach-types.h> 36#include <asm/mach-types.h>
36 37
@@ -47,7 +48,8 @@
47 48
48enum { 49enum {
49 RX51_JACK_DISABLED, 50 RX51_JACK_DISABLED,
50 RX51_JACK_TVOUT, /* tv-out */ 51 RX51_JACK_TVOUT, /* tv-out with stereo output */
52 RX51_JACK_HP, /* headphone: stereo output, no mic */
51}; 53};
52 54
53static int rx51_spk_func; 55static int rx51_spk_func;
@@ -57,6 +59,15 @@ static int rx51_jack_func;
57static void rx51_ext_control(struct snd_soc_codec *codec) 59static void rx51_ext_control(struct snd_soc_codec *codec)
58{ 60{
59 struct snd_soc_dapm_context *dapm = &codec->dapm; 61 struct snd_soc_dapm_context *dapm = &codec->dapm;
62 int hp = 0, tvout = 0;
63
64 switch (rx51_jack_func) {
65 case RX51_JACK_TVOUT:
66 tvout = 1;
67 case RX51_JACK_HP:
68 hp = 1;
69 break;
70 }
60 71
61 if (rx51_spk_func) 72 if (rx51_spk_func)
62 snd_soc_dapm_enable_pin(dapm, "Ext Spk"); 73 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
@@ -66,9 +77,12 @@ static void rx51_ext_control(struct snd_soc_codec *codec)
66 snd_soc_dapm_enable_pin(dapm, "DMic"); 77 snd_soc_dapm_enable_pin(dapm, "DMic");
67 else 78 else
68 snd_soc_dapm_disable_pin(dapm, "DMic"); 79 snd_soc_dapm_disable_pin(dapm, "DMic");
80 if (hp)
81 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
82 else
83 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
69 84
70 gpio_set_value(RX51_TVOUT_SEL_GPIO, 85 gpio_set_value(RX51_TVOUT_SEL_GPIO, tvout);
71 rx51_jack_func == RX51_JACK_TVOUT);
72 86
73 snd_soc_dapm_sync(dapm); 87 snd_soc_dapm_sync(dapm);
74} 88}
@@ -153,6 +167,19 @@ static int rx51_spk_event(struct snd_soc_dapm_widget *w,
153 return 0; 167 return 0;
154} 168}
155 169
170static int rx51_hp_event(struct snd_soc_dapm_widget *w,
171 struct snd_kcontrol *k, int event)
172{
173 struct snd_soc_codec *codec = w->dapm->codec;
174
175 if (SND_SOC_DAPM_EVENT_ON(event))
176 tpa6130a2_stereo_enable(codec, 1);
177 else
178 tpa6130a2_stereo_enable(codec, 0);
179
180 return 0;
181}
182
156static int rx51_get_input(struct snd_kcontrol *kcontrol, 183static int rx51_get_input(struct snd_kcontrol *kcontrol,
157 struct snd_ctl_elem_value *ucontrol) 184 struct snd_ctl_elem_value *ucontrol)
158{ 185{
@@ -212,11 +239,14 @@ static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = {
212static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = { 239static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = {
213 SND_SOC_DAPM_SPK("Ext Spk", rx51_spk_event), 240 SND_SOC_DAPM_SPK("Ext Spk", rx51_spk_event),
214 SND_SOC_DAPM_MIC("DMic", NULL), 241 SND_SOC_DAPM_MIC("DMic", NULL),
242 SND_SOC_DAPM_HP("Headphone Jack", rx51_hp_event),
215}; 243};
216 244
217static const struct snd_soc_dapm_route audio_map[] = { 245static const struct snd_soc_dapm_route audio_map[] = {
218 {"Ext Spk", NULL, "HPLOUT"}, 246 {"Ext Spk", NULL, "HPLOUT"},
219 {"Ext Spk", NULL, "HPROUT"}, 247 {"Ext Spk", NULL, "HPROUT"},
248 {"Headphone Jack", NULL, "LLOUT"},
249 {"Headphone Jack", NULL, "RLOUT"},
220 250
221 {"DMic Rate 64", NULL, "Mic Bias 2V"}, 251 {"DMic Rate 64", NULL, "Mic Bias 2V"},
222 {"Mic Bias 2V", NULL, "DMic"}, 252 {"Mic Bias 2V", NULL, "DMic"},
@@ -224,7 +254,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
224 254
225static const char *spk_function[] = {"Off", "On"}; 255static const char *spk_function[] = {"Off", "On"};
226static const char *input_function[] = {"ADC", "Digital Mic"}; 256static const char *input_function[] = {"ADC", "Digital Mic"};
227static const char *jack_function[] = {"Off", "TV-OUT"}; 257static const char *jack_function[] = {"Off", "TV-OUT", "Headphone"};
228 258
229static const struct soc_enum rx51_enum[] = { 259static const struct soc_enum rx51_enum[] = {
230 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), 260 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function),
@@ -265,6 +295,11 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
265 /* Set up RX-51 specific audio path audio_map */ 295 /* Set up RX-51 specific audio path audio_map */
266 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); 296 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
267 297
298 err = tpa6130a2_add_controls(codec);
299 if (err < 0)
300 return err;
301 snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42);
302
268 snd_soc_dapm_sync(dapm); 303 snd_soc_dapm_sync(dapm);
269 304
270 /* AV jack detection */ 305 /* AV jack detection */