aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Nikula <jhnikula@gmail.com>2011-02-14 10:20:21 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-02-15 16:53:59 -0500
commit31164c7cf1190729292126b2d6d27d792adfcec5 (patch)
tree3b1e45861acea1bd18f50197c2f2bc5dc01b65dc
parentd8ec598e5d0d66e68184664073e06b432e3dd140 (diff)
ASoC: omap: rx51: Add headset support
This patch adds support for headset microphone in Nokia RX-51/N900. The mic signal from audio jack is routed to codec A LINE1L via two switches and the mic bias is coming from codec B part. First switch is the tv-out switch that is already supported and the second switch selects between voltage detection circuit and codecs. As there is no use for voltage detection at the moment the second switch is connected statically to codecs in rx51_soc_init. Headset can be active when control "Jack Function" is set to "Headset". Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--sound/soc/omap/rx51.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 9411969d6f79..9860018cc2e5 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -40,6 +40,7 @@
40 40
41#define RX51_TVOUT_SEL_GPIO 40 41#define RX51_TVOUT_SEL_GPIO 40
42#define RX51_JACK_DETECT_GPIO 177 42#define RX51_JACK_DETECT_GPIO 177
43#define RX51_ECI_SW_GPIO 182
43/* 44/*
44 * REVISIT: TWL4030 GPIO base in RX-51. Now statically defined to 192. This 45 * REVISIT: TWL4030 GPIO base in RX-51. Now statically defined to 192. This
45 * gpio is reserved in arch/arm/mach-omap2/board-rx51-peripherals.c 46 * gpio is reserved in arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -50,6 +51,7 @@ enum {
50 RX51_JACK_DISABLED, 51 RX51_JACK_DISABLED,
51 RX51_JACK_TVOUT, /* tv-out with stereo output */ 52 RX51_JACK_TVOUT, /* tv-out with stereo output */
52 RX51_JACK_HP, /* headphone: stereo output, no mic */ 53 RX51_JACK_HP, /* headphone: stereo output, no mic */
54 RX51_JACK_HS, /* headset: stereo output with mic */
53}; 55};
54 56
55static int rx51_spk_func; 57static int rx51_spk_func;
@@ -59,11 +61,15 @@ static int rx51_jack_func;
59static void rx51_ext_control(struct snd_soc_codec *codec) 61static void rx51_ext_control(struct snd_soc_codec *codec)
60{ 62{
61 struct snd_soc_dapm_context *dapm = &codec->dapm; 63 struct snd_soc_dapm_context *dapm = &codec->dapm;
62 int hp = 0, tvout = 0; 64 int hp = 0, hs = 0, tvout = 0;
63 65
64 switch (rx51_jack_func) { 66 switch (rx51_jack_func) {
65 case RX51_JACK_TVOUT: 67 case RX51_JACK_TVOUT:
66 tvout = 1; 68 tvout = 1;
69 hp = 1;
70 break;
71 case RX51_JACK_HS:
72 hs = 1;
67 case RX51_JACK_HP: 73 case RX51_JACK_HP:
68 hp = 1; 74 hp = 1;
69 break; 75 break;
@@ -81,6 +87,10 @@ static void rx51_ext_control(struct snd_soc_codec *codec)
81 snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); 87 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
82 else 88 else
83 snd_soc_dapm_disable_pin(dapm, "Headphone Jack"); 89 snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
90 if (hs)
91 snd_soc_dapm_enable_pin(dapm, "HS Mic");
92 else
93 snd_soc_dapm_disable_pin(dapm, "HS Mic");
84 94
85 gpio_set_value(RX51_TVOUT_SEL_GPIO, tvout); 95 gpio_set_value(RX51_TVOUT_SEL_GPIO, tvout);
86 96
@@ -240,6 +250,7 @@ static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = {
240 SND_SOC_DAPM_SPK("Ext Spk", rx51_spk_event), 250 SND_SOC_DAPM_SPK("Ext Spk", rx51_spk_event),
241 SND_SOC_DAPM_MIC("DMic", NULL), 251 SND_SOC_DAPM_MIC("DMic", NULL),
242 SND_SOC_DAPM_HP("Headphone Jack", rx51_hp_event), 252 SND_SOC_DAPM_HP("Headphone Jack", rx51_hp_event),
253 SND_SOC_DAPM_MIC("HS Mic", NULL),
243}; 254};
244 255
245static const struct snd_soc_dapm_widget aic34_dapm_widgetsb[] = { 256static const struct snd_soc_dapm_widget aic34_dapm_widgetsb[] = {
@@ -259,11 +270,14 @@ static const struct snd_soc_dapm_route audio_map[] = {
259static const struct snd_soc_dapm_route audio_mapb[] = { 270static const struct snd_soc_dapm_route audio_mapb[] = {
260 {"b LINE2R", NULL, "MONO_LOUT"}, 271 {"b LINE2R", NULL, "MONO_LOUT"},
261 {"Earphone", NULL, "b HPLOUT"}, 272 {"Earphone", NULL, "b HPLOUT"},
273
274 {"LINE1L", NULL, "b Mic Bias 2.5V"},
275 {"b Mic Bias 2.5V", NULL, "HS Mic"}
262}; 276};
263 277
264static const char *spk_function[] = {"Off", "On"}; 278static const char *spk_function[] = {"Off", "On"};
265static const char *input_function[] = {"ADC", "Digital Mic"}; 279static const char *input_function[] = {"ADC", "Digital Mic"};
266static const char *jack_function[] = {"Off", "TV-OUT", "Headphone"}; 280static const char *jack_function[] = {"Off", "TV-OUT", "Headphone", "Headset"};
267 281
268static const struct soc_enum rx51_enum[] = { 282static const struct soc_enum rx51_enum[] = {
269 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), 283 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function),
@@ -398,6 +412,10 @@ static int __init rx51_soc_init(void)
398 GPIOF_DIR_OUT | GPIOF_INIT_LOW, "tvout_sel"); 412 GPIOF_DIR_OUT | GPIOF_INIT_LOW, "tvout_sel");
399 if (err) 413 if (err)
400 goto err_gpio_tvout_sel; 414 goto err_gpio_tvout_sel;
415 err = gpio_request_one(RX51_ECI_SW_GPIO,
416 GPIOF_DIR_OUT | GPIOF_INIT_HIGH, "eci_sw");
417 if (err)
418 goto err_gpio_eci_sw;
401 419
402 rx51_snd_device = platform_device_alloc("soc-audio", -1); 420 rx51_snd_device = platform_device_alloc("soc-audio", -1);
403 if (!rx51_snd_device) { 421 if (!rx51_snd_device) {
@@ -415,6 +433,8 @@ static int __init rx51_soc_init(void)
415err2: 433err2:
416 platform_device_put(rx51_snd_device); 434 platform_device_put(rx51_snd_device);
417err1: 435err1:
436 gpio_free(RX51_ECI_SW_GPIO);
437err_gpio_eci_sw:
418 gpio_free(RX51_TVOUT_SEL_GPIO); 438 gpio_free(RX51_TVOUT_SEL_GPIO);
419err_gpio_tvout_sel: 439err_gpio_tvout_sel:
420 440
@@ -427,6 +447,7 @@ static void __exit rx51_soc_exit(void)
427 rx51_av_jack_gpios); 447 rx51_av_jack_gpios);
428 448
429 platform_device_unregister(rx51_snd_device); 449 platform_device_unregister(rx51_snd_device);
450 gpio_free(RX51_ECI_SW_GPIO);
430 gpio_free(RX51_TVOUT_SEL_GPIO); 451 gpio_free(RX51_TVOUT_SEL_GPIO);
431} 452}
432 453