diff options
Diffstat (limited to 'sound/soc/omap/rx51.c')
-rw-r--r-- | sound/soc/omap/rx51.c | 25 |
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 | ||
55 | static int rx51_spk_func; | 57 | static int rx51_spk_func; |
@@ -59,11 +61,15 @@ static int rx51_jack_func; | |||
59 | static void rx51_ext_control(struct snd_soc_codec *codec) | 61 | static 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 | ||
245 | static const struct snd_soc_dapm_widget aic34_dapm_widgetsb[] = { | 256 | static const struct snd_soc_dapm_widget aic34_dapm_widgetsb[] = { |
@@ -259,11 +270,14 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
259 | static const struct snd_soc_dapm_route audio_mapb[] = { | 270 | static 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 | ||
264 | static const char *spk_function[] = {"Off", "On"}; | 278 | static const char *spk_function[] = {"Off", "On"}; |
265 | static const char *input_function[] = {"ADC", "Digital Mic"}; | 279 | static const char *input_function[] = {"ADC", "Digital Mic"}; |
266 | static const char *jack_function[] = {"Off", "TV-OUT", "Headphone"}; | 280 | static const char *jack_function[] = {"Off", "TV-OUT", "Headphone", "Headset"}; |
267 | 281 | ||
268 | static const struct soc_enum rx51_enum[] = { | 282 | static 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) | |||
415 | err2: | 433 | err2: |
416 | platform_device_put(rx51_snd_device); | 434 | platform_device_put(rx51_snd_device); |
417 | err1: | 435 | err1: |
436 | gpio_free(RX51_ECI_SW_GPIO); | ||
437 | err_gpio_eci_sw: | ||
418 | gpio_free(RX51_TVOUT_SEL_GPIO); | 438 | gpio_free(RX51_TVOUT_SEL_GPIO); |
419 | err_gpio_tvout_sel: | 439 | err_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 | ||