diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:32:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:32:54 -0500 |
commit | 66dc918d42eaaa9afe42a47d07526765162017a9 (patch) | |
tree | 947411841773dfb076f1aa78bc5be868bc4281a6 /sound/soc/omap/ams-delta.c | |
parent | b2034d474b7e1e8578bd5c2977024b51693269d9 (diff) | |
parent | 6db9a0f326d3144d790d9479309df480a8f562e4 (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: (348 commits)
ALSA: hda - Fix NULL-derefence with a single mic in STAC auto-mic detection
ALSA: hda - Add missing NID 0x19 fixup for Sony VAIO
ALSA: hda - Fix ALC275 enable hardware EQ for SONY VAIO
ALSA: oxygen: fix Xonar DG input
ALSA: hda - Fix EAPD on Lenovo NB ALC269 to low
ALSA: hda - Fix missing EAPD for Acer 4930G
ALSA: hda: Disable 4/6 channels on some NVIDIA GPUs.
ALSA: hda - Add static_hdmi_pcm option to HDMI codec parser
ALSA: hda - Don't refer ELD when unplugged
ASoC: tpa6130a2: Fix compiler warning
ASoC: tlv320dac33: Add DAPM selection for LOM invert
ASoC: DMIC codec: Adding a generic DMIC codec
ALSA: snd-usb-us122l: Fix missing NULL checks
ALSA: snd-usb-us122l: Fix MIDI output
ASoC: soc-cache: Fix invalid memory access during snd_soc_lzo_cache_sync()
ASoC: Fix section mismatch in wm8995.c
ALSA: oxygen: add S/PDIF source selection for Claro cards
ALSA: oxygen: fix CD/MIDI for X-Meridian (2G)
ASoC: fix migor audio build
ALSA: include delay.h for msleep in Xonar DG support
...
Diffstat (limited to 'sound/soc/omap/ams-delta.c')
-rw-r--r-- | sound/soc/omap/ams-delta.c | 82 |
1 files changed, 43 insertions, 39 deletions
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index 438146addbb8..2101bdcee21f 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/tty.h> | 27 | #include <linux/tty.h> |
28 | 28 | ||
29 | #include <sound/soc-dapm.h> | 29 | #include <sound/soc.h> |
30 | #include <sound/jack.h> | 30 | #include <sound/jack.h> |
31 | 31 | ||
32 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
@@ -94,6 +94,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, | |||
94 | struct snd_ctl_elem_value *ucontrol) | 94 | struct snd_ctl_elem_value *ucontrol) |
95 | { | 95 | { |
96 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 96 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
97 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
97 | struct soc_enum *control = (struct soc_enum *)kcontrol->private_value; | 98 | struct soc_enum *control = (struct soc_enum *)kcontrol->private_value; |
98 | unsigned short pins; | 99 | unsigned short pins; |
99 | int pin, changed = 0; | 100 | int pin, changed = 0; |
@@ -112,48 +113,48 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, | |||
112 | 113 | ||
113 | /* Setup pins after corresponding bits if changed */ | 114 | /* Setup pins after corresponding bits if changed */ |
114 | pin = !!(pins & (1 << AMS_DELTA_MOUTHPIECE)); | 115 | pin = !!(pins & (1 << AMS_DELTA_MOUTHPIECE)); |
115 | if (pin != snd_soc_dapm_get_pin_status(codec, "Mouthpiece")) { | 116 | if (pin != snd_soc_dapm_get_pin_status(dapm, "Mouthpiece")) { |
116 | changed = 1; | 117 | changed = 1; |
117 | if (pin) | 118 | if (pin) |
118 | snd_soc_dapm_enable_pin(codec, "Mouthpiece"); | 119 | snd_soc_dapm_enable_pin(dapm, "Mouthpiece"); |
119 | else | 120 | else |
120 | snd_soc_dapm_disable_pin(codec, "Mouthpiece"); | 121 | snd_soc_dapm_disable_pin(dapm, "Mouthpiece"); |
121 | } | 122 | } |
122 | pin = !!(pins & (1 << AMS_DELTA_EARPIECE)); | 123 | pin = !!(pins & (1 << AMS_DELTA_EARPIECE)); |
123 | if (pin != snd_soc_dapm_get_pin_status(codec, "Earpiece")) { | 124 | if (pin != snd_soc_dapm_get_pin_status(dapm, "Earpiece")) { |
124 | changed = 1; | 125 | changed = 1; |
125 | if (pin) | 126 | if (pin) |
126 | snd_soc_dapm_enable_pin(codec, "Earpiece"); | 127 | snd_soc_dapm_enable_pin(dapm, "Earpiece"); |
127 | else | 128 | else |
128 | snd_soc_dapm_disable_pin(codec, "Earpiece"); | 129 | snd_soc_dapm_disable_pin(dapm, "Earpiece"); |
129 | } | 130 | } |
130 | pin = !!(pins & (1 << AMS_DELTA_MICROPHONE)); | 131 | pin = !!(pins & (1 << AMS_DELTA_MICROPHONE)); |
131 | if (pin != snd_soc_dapm_get_pin_status(codec, "Microphone")) { | 132 | if (pin != snd_soc_dapm_get_pin_status(dapm, "Microphone")) { |
132 | changed = 1; | 133 | changed = 1; |
133 | if (pin) | 134 | if (pin) |
134 | snd_soc_dapm_enable_pin(codec, "Microphone"); | 135 | snd_soc_dapm_enable_pin(dapm, "Microphone"); |
135 | else | 136 | else |
136 | snd_soc_dapm_disable_pin(codec, "Microphone"); | 137 | snd_soc_dapm_disable_pin(dapm, "Microphone"); |
137 | } | 138 | } |
138 | pin = !!(pins & (1 << AMS_DELTA_SPEAKER)); | 139 | pin = !!(pins & (1 << AMS_DELTA_SPEAKER)); |
139 | if (pin != snd_soc_dapm_get_pin_status(codec, "Speaker")) { | 140 | if (pin != snd_soc_dapm_get_pin_status(dapm, "Speaker")) { |
140 | changed = 1; | 141 | changed = 1; |
141 | if (pin) | 142 | if (pin) |
142 | snd_soc_dapm_enable_pin(codec, "Speaker"); | 143 | snd_soc_dapm_enable_pin(dapm, "Speaker"); |
143 | else | 144 | else |
144 | snd_soc_dapm_disable_pin(codec, "Speaker"); | 145 | snd_soc_dapm_disable_pin(dapm, "Speaker"); |
145 | } | 146 | } |
146 | pin = !!(pins & (1 << AMS_DELTA_AGC)); | 147 | pin = !!(pins & (1 << AMS_DELTA_AGC)); |
147 | if (pin != ams_delta_audio_agc) { | 148 | if (pin != ams_delta_audio_agc) { |
148 | ams_delta_audio_agc = pin; | 149 | ams_delta_audio_agc = pin; |
149 | changed = 1; | 150 | changed = 1; |
150 | if (pin) | 151 | if (pin) |
151 | snd_soc_dapm_enable_pin(codec, "AGCIN"); | 152 | snd_soc_dapm_enable_pin(dapm, "AGCIN"); |
152 | else | 153 | else |
153 | snd_soc_dapm_disable_pin(codec, "AGCIN"); | 154 | snd_soc_dapm_disable_pin(dapm, "AGCIN"); |
154 | } | 155 | } |
155 | if (changed) | 156 | if (changed) |
156 | snd_soc_dapm_sync(codec); | 157 | snd_soc_dapm_sync(dapm); |
157 | 158 | ||
158 | mutex_unlock(&codec->mutex); | 159 | mutex_unlock(&codec->mutex); |
159 | 160 | ||
@@ -164,19 +165,20 @@ static int ams_delta_get_audio_mode(struct snd_kcontrol *kcontrol, | |||
164 | struct snd_ctl_elem_value *ucontrol) | 165 | struct snd_ctl_elem_value *ucontrol) |
165 | { | 166 | { |
166 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 167 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
168 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
167 | unsigned short pins, mode; | 169 | unsigned short pins, mode; |
168 | 170 | ||
169 | pins = ((snd_soc_dapm_get_pin_status(codec, "Mouthpiece") << | 171 | pins = ((snd_soc_dapm_get_pin_status(dapm, "Mouthpiece") << |
170 | AMS_DELTA_MOUTHPIECE) | | 172 | AMS_DELTA_MOUTHPIECE) | |
171 | (snd_soc_dapm_get_pin_status(codec, "Earpiece") << | 173 | (snd_soc_dapm_get_pin_status(dapm, "Earpiece") << |
172 | AMS_DELTA_EARPIECE)); | 174 | AMS_DELTA_EARPIECE)); |
173 | if (pins) | 175 | if (pins) |
174 | pins |= (snd_soc_dapm_get_pin_status(codec, "Microphone") << | 176 | pins |= (snd_soc_dapm_get_pin_status(dapm, "Microphone") << |
175 | AMS_DELTA_MICROPHONE); | 177 | AMS_DELTA_MICROPHONE); |
176 | else | 178 | else |
177 | pins = ((snd_soc_dapm_get_pin_status(codec, "Microphone") << | 179 | pins = ((snd_soc_dapm_get_pin_status(dapm, "Microphone") << |
178 | AMS_DELTA_MICROPHONE) | | 180 | AMS_DELTA_MICROPHONE) | |
179 | (snd_soc_dapm_get_pin_status(codec, "Speaker") << | 181 | (snd_soc_dapm_get_pin_status(dapm, "Speaker") << |
180 | AMS_DELTA_SPEAKER) | | 182 | AMS_DELTA_SPEAKER) | |
181 | (ams_delta_audio_agc << AMS_DELTA_AGC)); | 183 | (ams_delta_audio_agc << AMS_DELTA_AGC)); |
182 | 184 | ||
@@ -300,6 +302,7 @@ static int cx81801_open(struct tty_struct *tty) | |||
300 | static void cx81801_close(struct tty_struct *tty) | 302 | static void cx81801_close(struct tty_struct *tty) |
301 | { | 303 | { |
302 | struct snd_soc_codec *codec = tty->disc_data; | 304 | struct snd_soc_codec *codec = tty->disc_data; |
305 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
303 | 306 | ||
304 | del_timer_sync(&cx81801_timer); | 307 | del_timer_sync(&cx81801_timer); |
305 | 308 | ||
@@ -312,12 +315,12 @@ static void cx81801_close(struct tty_struct *tty) | |||
312 | v253_ops.close(tty); | 315 | v253_ops.close(tty); |
313 | 316 | ||
314 | /* Revert back to default audio input/output constellation */ | 317 | /* Revert back to default audio input/output constellation */ |
315 | snd_soc_dapm_disable_pin(codec, "Mouthpiece"); | 318 | snd_soc_dapm_disable_pin(dapm, "Mouthpiece"); |
316 | snd_soc_dapm_enable_pin(codec, "Earpiece"); | 319 | snd_soc_dapm_enable_pin(dapm, "Earpiece"); |
317 | snd_soc_dapm_enable_pin(codec, "Microphone"); | 320 | snd_soc_dapm_enable_pin(dapm, "Microphone"); |
318 | snd_soc_dapm_disable_pin(codec, "Speaker"); | 321 | snd_soc_dapm_disable_pin(dapm, "Speaker"); |
319 | snd_soc_dapm_disable_pin(codec, "AGCIN"); | 322 | snd_soc_dapm_disable_pin(dapm, "AGCIN"); |
320 | snd_soc_dapm_sync(codec); | 323 | snd_soc_dapm_sync(dapm); |
321 | } | 324 | } |
322 | 325 | ||
323 | /* Line discipline .hangup() */ | 326 | /* Line discipline .hangup() */ |
@@ -432,16 +435,16 @@ static int ams_delta_set_bias_level(struct snd_soc_card *card, | |||
432 | case SND_SOC_BIAS_ON: | 435 | case SND_SOC_BIAS_ON: |
433 | case SND_SOC_BIAS_PREPARE: | 436 | case SND_SOC_BIAS_PREPARE: |
434 | case SND_SOC_BIAS_STANDBY: | 437 | case SND_SOC_BIAS_STANDBY: |
435 | if (codec->bias_level == SND_SOC_BIAS_OFF) | 438 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) |
436 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, | 439 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, |
437 | AMS_DELTA_LATCH2_MODEM_NRESET); | 440 | AMS_DELTA_LATCH2_MODEM_NRESET); |
438 | break; | 441 | break; |
439 | case SND_SOC_BIAS_OFF: | 442 | case SND_SOC_BIAS_OFF: |
440 | if (codec->bias_level != SND_SOC_BIAS_OFF) | 443 | if (codec->dapm.bias_level != SND_SOC_BIAS_OFF) |
441 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, | 444 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, |
442 | 0); | 445 | 0); |
443 | } | 446 | } |
444 | codec->bias_level = level; | 447 | codec->dapm.bias_level = level; |
445 | 448 | ||
446 | return 0; | 449 | return 0; |
447 | } | 450 | } |
@@ -492,6 +495,7 @@ static void ams_delta_shutdown(struct snd_pcm_substream *substream) | |||
492 | static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) | 495 | static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) |
493 | { | 496 | { |
494 | struct snd_soc_codec *codec = rtd->codec; | 497 | struct snd_soc_codec *codec = rtd->codec; |
498 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
495 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | 499 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
496 | struct snd_soc_card *card = rtd->card; | 500 | struct snd_soc_card *card = rtd->card; |
497 | int ret; | 501 | int ret; |
@@ -541,7 +545,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) | |||
541 | } | 545 | } |
542 | 546 | ||
543 | /* Add board specific DAPM widgets and routes */ | 547 | /* Add board specific DAPM widgets and routes */ |
544 | ret = snd_soc_dapm_new_controls(codec, ams_delta_dapm_widgets, | 548 | ret = snd_soc_dapm_new_controls(dapm, ams_delta_dapm_widgets, |
545 | ARRAY_SIZE(ams_delta_dapm_widgets)); | 549 | ARRAY_SIZE(ams_delta_dapm_widgets)); |
546 | if (ret) { | 550 | if (ret) { |
547 | dev_warn(card->dev, | 551 | dev_warn(card->dev, |
@@ -550,7 +554,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) | |||
550 | return 0; | 554 | return 0; |
551 | } | 555 | } |
552 | 556 | ||
553 | ret = snd_soc_dapm_add_routes(codec, ams_delta_audio_map, | 557 | ret = snd_soc_dapm_add_routes(dapm, ams_delta_audio_map, |
554 | ARRAY_SIZE(ams_delta_audio_map)); | 558 | ARRAY_SIZE(ams_delta_audio_map)); |
555 | if (ret) { | 559 | if (ret) { |
556 | dev_warn(card->dev, | 560 | dev_warn(card->dev, |
@@ -560,13 +564,13 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) | |||
560 | } | 564 | } |
561 | 565 | ||
562 | /* Set up initial pin constellation */ | 566 | /* Set up initial pin constellation */ |
563 | snd_soc_dapm_disable_pin(codec, "Mouthpiece"); | 567 | snd_soc_dapm_disable_pin(dapm, "Mouthpiece"); |
564 | snd_soc_dapm_enable_pin(codec, "Earpiece"); | 568 | snd_soc_dapm_enable_pin(dapm, "Earpiece"); |
565 | snd_soc_dapm_enable_pin(codec, "Microphone"); | 569 | snd_soc_dapm_enable_pin(dapm, "Microphone"); |
566 | snd_soc_dapm_disable_pin(codec, "Speaker"); | 570 | snd_soc_dapm_disable_pin(dapm, "Speaker"); |
567 | snd_soc_dapm_disable_pin(codec, "AGCIN"); | 571 | snd_soc_dapm_disable_pin(dapm, "AGCIN"); |
568 | snd_soc_dapm_disable_pin(codec, "AGCOUT"); | 572 | snd_soc_dapm_disable_pin(dapm, "AGCOUT"); |
569 | snd_soc_dapm_sync(codec); | 573 | snd_soc_dapm_sync(dapm); |
570 | 574 | ||
571 | /* Add virtual switch */ | 575 | /* Add virtual switch */ |
572 | ret = snd_soc_add_controls(codec, ams_delta_audio_controls, | 576 | ret = snd_soc_add_controls(codec, ams_delta_audio_controls, |