diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-18 13:46:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-18 13:46:37 -0400 |
commit | d3e458d78167102cc961237cfceef6fffc80c0b3 (patch) | |
tree | e9195c1294daf053614e63ac52b0b44a28479017 /sound/soc/omap | |
parent | f2e1fbb5f2177227f71c4fc0491e531dd7acd385 (diff) | |
parent | d351cf4603edb2a5bfa9a48d06c425511c63f2a3 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (308 commits)
ALSA: sound/pci/asihpi: check adapter index in hpi_ioctl
ALSA: aloop - Fix possible IRQ lock inversion
ALSA: sound/core: merge list_del()/list_add_tail() to list_move_tail()
ALSA: ctxfi - use list_move() instead of list_del()/list_add() combination
ALSA: firewire - msleep needs delay.h
ALSA: firewire-lib, firewire-speakers: handle packet queueing errors
ALSA: firewire-lib: allocate DMA buffer separately
ALSA: firewire-lib: use no-info SYT for packets without SYT sample
ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver
ALSA: hda - Remove an unused variable in patch_realtek.c
ALSA: hda - pin-adc-mux-dmic auto-configuration of 92HD8X codecs
ALSA: hda - fix digital mic selection in mixer on 92HD8X codecs
ALSA: hda - Move default input-src selection to init part
ALSA: hda - Initialize special cases for input src in init phase
ALSA: ctxfi - Clear input settings before initialization
ALSA: ctxfi - Fix SPDIF status retrieval
ALSA: ctxfi - Fix incorrect SPDIF status bit mask
ALSA: ctxfi - Fix microphone boost codes/comments
ALSA: atiixp - Fix wrong time-out checks during ac-link reset
ALSA: intel8x0m: append 'm' to "r_intel8x0"
...
Diffstat (limited to 'sound/soc/omap')
-rw-r--r-- | sound/soc/omap/Kconfig | 1 | ||||
-rw-r--r-- | sound/soc/omap/rx51.c | 131 |
2 files changed, 124 insertions, 8 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..d0986220eff9 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 | ||
@@ -39,6 +40,7 @@ | |||
39 | 40 | ||
40 | #define RX51_TVOUT_SEL_GPIO 40 | 41 | #define RX51_TVOUT_SEL_GPIO 40 |
41 | #define RX51_JACK_DETECT_GPIO 177 | 42 | #define RX51_JACK_DETECT_GPIO 177 |
43 | #define RX51_ECI_SW_GPIO 182 | ||
42 | /* | 44 | /* |
43 | * 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 |
44 | * 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 |
@@ -47,7 +49,9 @@ | |||
47 | 49 | ||
48 | enum { | 50 | enum { |
49 | RX51_JACK_DISABLED, | 51 | RX51_JACK_DISABLED, |
50 | RX51_JACK_TVOUT, /* tv-out */ | 52 | RX51_JACK_TVOUT, /* tv-out with stereo output */ |
53 | RX51_JACK_HP, /* headphone: stereo output, no mic */ | ||
54 | RX51_JACK_HS, /* headset: stereo output with mic */ | ||
51 | }; | 55 | }; |
52 | 56 | ||
53 | static int rx51_spk_func; | 57 | static int rx51_spk_func; |
@@ -57,6 +61,19 @@ static int rx51_jack_func; | |||
57 | static void rx51_ext_control(struct snd_soc_codec *codec) | 61 | static void rx51_ext_control(struct snd_soc_codec *codec) |
58 | { | 62 | { |
59 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 63 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
64 | int hp = 0, hs = 0, tvout = 0; | ||
65 | |||
66 | switch (rx51_jack_func) { | ||
67 | case RX51_JACK_TVOUT: | ||
68 | tvout = 1; | ||
69 | hp = 1; | ||
70 | break; | ||
71 | case RX51_JACK_HS: | ||
72 | hs = 1; | ||
73 | case RX51_JACK_HP: | ||
74 | hp = 1; | ||
75 | break; | ||
76 | } | ||
60 | 77 | ||
61 | if (rx51_spk_func) | 78 | if (rx51_spk_func) |
62 | snd_soc_dapm_enable_pin(dapm, "Ext Spk"); | 79 | snd_soc_dapm_enable_pin(dapm, "Ext Spk"); |
@@ -66,9 +83,16 @@ static void rx51_ext_control(struct snd_soc_codec *codec) | |||
66 | snd_soc_dapm_enable_pin(dapm, "DMic"); | 83 | snd_soc_dapm_enable_pin(dapm, "DMic"); |
67 | else | 84 | else |
68 | snd_soc_dapm_disable_pin(dapm, "DMic"); | 85 | snd_soc_dapm_disable_pin(dapm, "DMic"); |
86 | if (hp) | ||
87 | snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); | ||
88 | else | ||
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"); | ||
69 | 94 | ||
70 | gpio_set_value(RX51_TVOUT_SEL_GPIO, | 95 | gpio_set_value(RX51_TVOUT_SEL_GPIO, tvout); |
71 | rx51_jack_func == RX51_JACK_TVOUT); | ||
72 | 96 | ||
73 | snd_soc_dapm_sync(dapm); | 97 | snd_soc_dapm_sync(dapm); |
74 | } | 98 | } |
@@ -153,6 +177,19 @@ static int rx51_spk_event(struct snd_soc_dapm_widget *w, | |||
153 | return 0; | 177 | return 0; |
154 | } | 178 | } |
155 | 179 | ||
180 | static int rx51_hp_event(struct snd_soc_dapm_widget *w, | ||
181 | struct snd_kcontrol *k, int event) | ||
182 | { | ||
183 | struct snd_soc_codec *codec = w->dapm->codec; | ||
184 | |||
185 | if (SND_SOC_DAPM_EVENT_ON(event)) | ||
186 | tpa6130a2_stereo_enable(codec, 1); | ||
187 | else | ||
188 | tpa6130a2_stereo_enable(codec, 0); | ||
189 | |||
190 | return 0; | ||
191 | } | ||
192 | |||
156 | static int rx51_get_input(struct snd_kcontrol *kcontrol, | 193 | static int rx51_get_input(struct snd_kcontrol *kcontrol, |
157 | struct snd_ctl_elem_value *ucontrol) | 194 | struct snd_ctl_elem_value *ucontrol) |
158 | { | 195 | { |
@@ -203,7 +240,7 @@ static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = { | |||
203 | { | 240 | { |
204 | .gpio = RX51_JACK_DETECT_GPIO, | 241 | .gpio = RX51_JACK_DETECT_GPIO, |
205 | .name = "avdet-gpio", | 242 | .name = "avdet-gpio", |
206 | .report = SND_JACK_VIDEOOUT, | 243 | .report = SND_JACK_HEADSET, |
207 | .invert = 1, | 244 | .invert = 1, |
208 | .debounce_time = 200, | 245 | .debounce_time = 200, |
209 | }, | 246 | }, |
@@ -212,19 +249,38 @@ static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = { | |||
212 | static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = { | 249 | static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = { |
213 | SND_SOC_DAPM_SPK("Ext Spk", rx51_spk_event), | 250 | SND_SOC_DAPM_SPK("Ext Spk", rx51_spk_event), |
214 | SND_SOC_DAPM_MIC("DMic", NULL), | 251 | SND_SOC_DAPM_MIC("DMic", NULL), |
252 | SND_SOC_DAPM_HP("Headphone Jack", rx51_hp_event), | ||
253 | SND_SOC_DAPM_MIC("HS Mic", NULL), | ||
254 | SND_SOC_DAPM_LINE("FM Transmitter", NULL), | ||
255 | }; | ||
256 | |||
257 | static const struct snd_soc_dapm_widget aic34_dapm_widgetsb[] = { | ||
258 | SND_SOC_DAPM_SPK("Earphone", NULL), | ||
215 | }; | 259 | }; |
216 | 260 | ||
217 | static const struct snd_soc_dapm_route audio_map[] = { | 261 | static const struct snd_soc_dapm_route audio_map[] = { |
218 | {"Ext Spk", NULL, "HPLOUT"}, | 262 | {"Ext Spk", NULL, "HPLOUT"}, |
219 | {"Ext Spk", NULL, "HPROUT"}, | 263 | {"Ext Spk", NULL, "HPROUT"}, |
264 | {"Headphone Jack", NULL, "LLOUT"}, | ||
265 | {"Headphone Jack", NULL, "RLOUT"}, | ||
266 | {"FM Transmitter", NULL, "LLOUT"}, | ||
267 | {"FM Transmitter", NULL, "RLOUT"}, | ||
220 | 268 | ||
221 | {"DMic Rate 64", NULL, "Mic Bias 2V"}, | 269 | {"DMic Rate 64", NULL, "Mic Bias 2V"}, |
222 | {"Mic Bias 2V", NULL, "DMic"}, | 270 | {"Mic Bias 2V", NULL, "DMic"}, |
223 | }; | 271 | }; |
224 | 272 | ||
273 | static const struct snd_soc_dapm_route audio_mapb[] = { | ||
274 | {"b LINE2R", NULL, "MONO_LOUT"}, | ||
275 | {"Earphone", NULL, "b HPLOUT"}, | ||
276 | |||
277 | {"LINE1L", NULL, "b Mic Bias 2.5V"}, | ||
278 | {"b Mic Bias 2.5V", NULL, "HS Mic"} | ||
279 | }; | ||
280 | |||
225 | static const char *spk_function[] = {"Off", "On"}; | 281 | static const char *spk_function[] = {"Off", "On"}; |
226 | static const char *input_function[] = {"ADC", "Digital Mic"}; | 282 | static const char *input_function[] = {"ADC", "Digital Mic"}; |
227 | static const char *jack_function[] = {"Off", "TV-OUT"}; | 283 | static const char *jack_function[] = {"Off", "TV-OUT", "Headphone", "Headset"}; |
228 | 284 | ||
229 | static const struct soc_enum rx51_enum[] = { | 285 | static const struct soc_enum rx51_enum[] = { |
230 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), | 286 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), |
@@ -239,6 +295,11 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = { | |||
239 | rx51_get_input, rx51_set_input), | 295 | rx51_get_input, rx51_set_input), |
240 | SOC_ENUM_EXT("Jack Function", rx51_enum[2], | 296 | SOC_ENUM_EXT("Jack Function", rx51_enum[2], |
241 | rx51_get_jack, rx51_set_jack), | 297 | rx51_get_jack, rx51_set_jack), |
298 | SOC_DAPM_PIN_SWITCH("FM Transmitter"), | ||
299 | }; | ||
300 | |||
301 | static const struct snd_kcontrol_new aic34_rx51_controlsb[] = { | ||
302 | SOC_DAPM_PIN_SWITCH("Earphone"), | ||
242 | }; | 303 | }; |
243 | 304 | ||
244 | static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) | 305 | static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) |
@@ -265,11 +326,21 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) | |||
265 | /* Set up RX-51 specific audio path audio_map */ | 326 | /* Set up RX-51 specific audio path audio_map */ |
266 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | 327 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
267 | 328 | ||
329 | err = tpa6130a2_add_controls(codec); | ||
330 | if (err < 0) | ||
331 | return err; | ||
332 | snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42); | ||
333 | |||
334 | err = omap_mcbsp_st_add_controls(codec, 1); | ||
335 | if (err < 0) | ||
336 | return err; | ||
337 | |||
268 | snd_soc_dapm_sync(dapm); | 338 | snd_soc_dapm_sync(dapm); |
269 | 339 | ||
270 | /* AV jack detection */ | 340 | /* AV jack detection */ |
271 | err = snd_soc_jack_new(codec, "AV Jack", | 341 | err = snd_soc_jack_new(codec, "AV Jack", |
272 | SND_JACK_VIDEOOUT, &rx51_av_jack); | 342 | SND_JACK_HEADSET | SND_JACK_VIDEOOUT, |
343 | &rx51_av_jack); | ||
273 | if (err) | 344 | if (err) |
274 | return err; | 345 | return err; |
275 | err = snd_soc_jack_add_gpios(&rx51_av_jack, | 346 | err = snd_soc_jack_add_gpios(&rx51_av_jack, |
@@ -279,6 +350,24 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) | |||
279 | return err; | 350 | return err; |
280 | } | 351 | } |
281 | 352 | ||
353 | static int rx51_aic34b_init(struct snd_soc_dapm_context *dapm) | ||
354 | { | ||
355 | int err; | ||
356 | |||
357 | err = snd_soc_add_controls(dapm->codec, aic34_rx51_controlsb, | ||
358 | ARRAY_SIZE(aic34_rx51_controlsb)); | ||
359 | if (err < 0) | ||
360 | return err; | ||
361 | |||
362 | err = snd_soc_dapm_new_controls(dapm, aic34_dapm_widgetsb, | ||
363 | ARRAY_SIZE(aic34_dapm_widgetsb)); | ||
364 | if (err < 0) | ||
365 | return 0; | ||
366 | |||
367 | return snd_soc_dapm_add_routes(dapm, audio_mapb, | ||
368 | ARRAY_SIZE(audio_mapb)); | ||
369 | } | ||
370 | |||
282 | /* Digital audio interface glue - connects codec <--> CPU */ | 371 | /* Digital audio interface glue - connects codec <--> CPU */ |
283 | static struct snd_soc_dai_link rx51_dai[] = { | 372 | static struct snd_soc_dai_link rx51_dai[] = { |
284 | { | 373 | { |
@@ -293,11 +382,30 @@ static struct snd_soc_dai_link rx51_dai[] = { | |||
293 | }, | 382 | }, |
294 | }; | 383 | }; |
295 | 384 | ||
385 | struct snd_soc_aux_dev rx51_aux_dev[] = { | ||
386 | { | ||
387 | .name = "TLV320AIC34b", | ||
388 | .codec_name = "tlv320aic3x-codec.2-0019", | ||
389 | .init = rx51_aic34b_init, | ||
390 | }, | ||
391 | }; | ||
392 | |||
393 | static struct snd_soc_codec_conf rx51_codec_conf[] = { | ||
394 | { | ||
395 | .dev_name = "tlv320aic3x-codec.2-0019", | ||
396 | .name_prefix = "b", | ||
397 | }, | ||
398 | }; | ||
399 | |||
296 | /* Audio card */ | 400 | /* Audio card */ |
297 | static struct snd_soc_card rx51_sound_card = { | 401 | static struct snd_soc_card rx51_sound_card = { |
298 | .name = "RX-51", | 402 | .name = "RX-51", |
299 | .dai_link = rx51_dai, | 403 | .dai_link = rx51_dai, |
300 | .num_links = ARRAY_SIZE(rx51_dai), | 404 | .num_links = ARRAY_SIZE(rx51_dai), |
405 | .aux_dev = rx51_aux_dev, | ||
406 | .num_aux_devs = ARRAY_SIZE(rx51_aux_dev), | ||
407 | .codec_conf = rx51_codec_conf, | ||
408 | .num_configs = ARRAY_SIZE(rx51_codec_conf), | ||
301 | }; | 409 | }; |
302 | 410 | ||
303 | static struct platform_device *rx51_snd_device; | 411 | static struct platform_device *rx51_snd_device; |
@@ -309,10 +417,14 @@ static int __init rx51_soc_init(void) | |||
309 | if (!machine_is_nokia_rx51()) | 417 | if (!machine_is_nokia_rx51()) |
310 | return -ENODEV; | 418 | return -ENODEV; |
311 | 419 | ||
312 | err = gpio_request(RX51_TVOUT_SEL_GPIO, "tvout_sel"); | 420 | err = gpio_request_one(RX51_TVOUT_SEL_GPIO, |
421 | GPIOF_DIR_OUT | GPIOF_INIT_LOW, "tvout_sel"); | ||
313 | if (err) | 422 | if (err) |
314 | goto err_gpio_tvout_sel; | 423 | goto err_gpio_tvout_sel; |
315 | gpio_direction_output(RX51_TVOUT_SEL_GPIO, 0); | 424 | err = gpio_request_one(RX51_ECI_SW_GPIO, |
425 | GPIOF_DIR_OUT | GPIOF_INIT_HIGH, "eci_sw"); | ||
426 | if (err) | ||
427 | goto err_gpio_eci_sw; | ||
316 | 428 | ||
317 | rx51_snd_device = platform_device_alloc("soc-audio", -1); | 429 | rx51_snd_device = platform_device_alloc("soc-audio", -1); |
318 | if (!rx51_snd_device) { | 430 | if (!rx51_snd_device) { |
@@ -330,6 +442,8 @@ static int __init rx51_soc_init(void) | |||
330 | err2: | 442 | err2: |
331 | platform_device_put(rx51_snd_device); | 443 | platform_device_put(rx51_snd_device); |
332 | err1: | 444 | err1: |
445 | gpio_free(RX51_ECI_SW_GPIO); | ||
446 | err_gpio_eci_sw: | ||
333 | gpio_free(RX51_TVOUT_SEL_GPIO); | 447 | gpio_free(RX51_TVOUT_SEL_GPIO); |
334 | err_gpio_tvout_sel: | 448 | err_gpio_tvout_sel: |
335 | 449 | ||
@@ -342,6 +456,7 @@ static void __exit rx51_soc_exit(void) | |||
342 | rx51_av_jack_gpios); | 456 | rx51_av_jack_gpios); |
343 | 457 | ||
344 | platform_device_unregister(rx51_snd_device); | 458 | platform_device_unregister(rx51_snd_device); |
459 | gpio_free(RX51_ECI_SW_GPIO); | ||
345 | gpio_free(RX51_TVOUT_SEL_GPIO); | 460 | gpio_free(RX51_TVOUT_SEL_GPIO); |
346 | } | 461 | } |
347 | 462 | ||