aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2010-01-08 03:26:34 -0500
committerJaroslav Kysela <perex@perex.cz>2010-01-08 03:26:34 -0500
commit1cb4f624ea38361b6397966470f0a1bed5532483 (patch)
tree418b05ddc854b09d64f7d5ee0c78875e42b5f151 /sound
parent444c1953d496d272208902ff7010dc70d1f887f0 (diff)
parent2c1f1895ef2aa8f0e5497893eff71304aef332e1 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into fixes
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/aaci.c180
-rw-r--r--sound/arm/aaci.h2
-rw-r--r--sound/arm/pxa2xx-ac97.c2
-rw-r--r--sound/core/Kconfig1
-rw-r--r--sound/core/pcm_lib.c4
-rw-r--r--sound/core/pcm_native.c8
-rw-r--r--sound/core/pcm_timer.c17
-rw-r--r--sound/isa/gus/gus_mem.c3
-rw-r--r--sound/isa/msnd/msnd_midi.c2
-rw-r--r--sound/isa/sb/emu8000.c6
-rw-r--r--sound/mips/sgio2audio.c2
-rw-r--r--sound/oss/pss.c6
-rw-r--r--sound/pci/cs5535audio/Makefile2
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c1
-rw-r--r--sound/pci/cs5535audio/cs5535audio.h4
-rw-r--r--sound/pci/cs5535audio/cs5535audio_olpc.c26
-rw-r--r--sound/pci/hda/hda_beep.c16
-rw-r--r--sound/pci/hda/hda_codec.c20
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_hwdep.c7
-rw-r--r--sound/pci/hda/hda_intel.c22
-rw-r--r--sound/pci/hda/patch_analog.c16
-rw-r--r--sound/pci/hda/patch_cirrus.c22
-rw-r--r--sound/pci/hda/patch_realtek.c75
-rw-r--r--sound/pci/hda/patch_sigmatel.c40
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c3
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c2
-rw-r--r--sound/soc/codecs/ac97.c6
-rw-r--r--sound/soc/codecs/ak4642.c2
-rw-r--r--sound/soc/codecs/stac9766.c18
-rw-r--r--sound/soc/codecs/twl4030.c10
-rw-r--r--sound/soc/codecs/wm8350.c25
-rw-r--r--sound/soc/codecs/wm8510.c14
-rw-r--r--sound/soc/codecs/wm8900.c2
-rw-r--r--sound/soc/codecs/wm8940.c14
-rw-r--r--sound/soc/codecs/wm8974.c16
-rw-r--r--sound/soc/codecs/wm9712.c3
-rw-r--r--sound/soc/imx/mx27vis_wm8974.c3
-rw-r--r--sound/soc/omap/sdp3430.c6
-rw-r--r--sound/soc/s3c24xx/s3c24xx_simtec.c2
-rw-r--r--sound/soc/s3c24xx/s3c24xx_simtec.h2
-rw-r--r--sound/soc/sh/fsi-ak4642.c30
-rw-r--r--sound/soc/sh/fsi.c2
-rw-r--r--sound/soc/soc-core.c2
-rw-r--r--sound/usb/usbaudio.c2
45 files changed, 337 insertions, 312 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 1497dce1b04a..656e474dca47 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -172,14 +172,15 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
172 return v; 172 return v;
173} 173}
174 174
175static inline void aaci_chan_wait_ready(struct aaci_runtime *aacirun) 175static inline void
176aaci_chan_wait_ready(struct aaci_runtime *aacirun, unsigned long mask)
176{ 177{
177 u32 val; 178 u32 val;
178 int timeout = 5000; 179 int timeout = 5000;
179 180
180 do { 181 do {
181 val = readl(aacirun->base + AACI_SR); 182 val = readl(aacirun->base + AACI_SR);
182 } while (val & (SR_TXB|SR_RXB) && timeout--); 183 } while (val & mask && timeout--);
183} 184}
184 185
185 186
@@ -208,8 +209,10 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
208 writel(0, aacirun->base + AACI_IE); 209 writel(0, aacirun->base + AACI_IE);
209 return; 210 return;
210 } 211 }
211 ptr = aacirun->ptr;
212 212
213 spin_lock(&aacirun->lock);
214
215 ptr = aacirun->ptr;
213 do { 216 do {
214 unsigned int len = aacirun->fifosz; 217 unsigned int len = aacirun->fifosz;
215 u32 val; 218 u32 val;
@@ -217,9 +220,9 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
217 if (aacirun->bytes <= 0) { 220 if (aacirun->bytes <= 0) {
218 aacirun->bytes += aacirun->period; 221 aacirun->bytes += aacirun->period;
219 aacirun->ptr = ptr; 222 aacirun->ptr = ptr;
220 spin_unlock(&aaci->lock); 223 spin_unlock(&aacirun->lock);
221 snd_pcm_period_elapsed(aacirun->substream); 224 snd_pcm_period_elapsed(aacirun->substream);
222 spin_lock(&aaci->lock); 225 spin_lock(&aacirun->lock);
223 } 226 }
224 if (!(aacirun->cr & CR_EN)) 227 if (!(aacirun->cr & CR_EN))
225 break; 228 break;
@@ -245,7 +248,10 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
245 ptr = aacirun->start; 248 ptr = aacirun->start;
246 } 249 }
247 } while(1); 250 } while(1);
251
248 aacirun->ptr = ptr; 252 aacirun->ptr = ptr;
253
254 spin_unlock(&aacirun->lock);
249 } 255 }
250 256
251 if (mask & ISR_URINTR) { 257 if (mask & ISR_URINTR) {
@@ -263,6 +269,8 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
263 return; 269 return;
264 } 270 }
265 271
272 spin_lock(&aacirun->lock);
273
266 ptr = aacirun->ptr; 274 ptr = aacirun->ptr;
267 do { 275 do {
268 unsigned int len = aacirun->fifosz; 276 unsigned int len = aacirun->fifosz;
@@ -271,9 +279,9 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
271 if (aacirun->bytes <= 0) { 279 if (aacirun->bytes <= 0) {
272 aacirun->bytes += aacirun->period; 280 aacirun->bytes += aacirun->period;
273 aacirun->ptr = ptr; 281 aacirun->ptr = ptr;
274 spin_unlock(&aaci->lock); 282 spin_unlock(&aacirun->lock);
275 snd_pcm_period_elapsed(aacirun->substream); 283 snd_pcm_period_elapsed(aacirun->substream);
276 spin_lock(&aaci->lock); 284 spin_lock(&aacirun->lock);
277 } 285 }
278 if (!(aacirun->cr & CR_EN)) 286 if (!(aacirun->cr & CR_EN))
279 break; 287 break;
@@ -301,6 +309,8 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
301 } while (1); 309 } while (1);
302 310
303 aacirun->ptr = ptr; 311 aacirun->ptr = ptr;
312
313 spin_unlock(&aacirun->lock);
304 } 314 }
305} 315}
306 316
@@ -310,7 +320,6 @@ static irqreturn_t aaci_irq(int irq, void *devid)
310 u32 mask; 320 u32 mask;
311 int i; 321 int i;
312 322
313 spin_lock(&aaci->lock);
314 mask = readl(aaci->base + AACI_ALLINTS); 323 mask = readl(aaci->base + AACI_ALLINTS);
315 if (mask) { 324 if (mask) {
316 u32 m = mask; 325 u32 m = mask;
@@ -320,7 +329,6 @@ static irqreturn_t aaci_irq(int irq, void *devid)
320 } 329 }
321 } 330 }
322 } 331 }
323 spin_unlock(&aaci->lock);
324 332
325 return mask ? IRQ_HANDLED : IRQ_NONE; 333 return mask ? IRQ_HANDLED : IRQ_NONE;
326} 334}
@@ -330,63 +338,6 @@ static irqreturn_t aaci_irq(int irq, void *devid)
330/* 338/*
331 * ALSA support. 339 * ALSA support.
332 */ 340 */
333
334struct aaci_stream {
335 unsigned char codec_idx;
336 unsigned char rate_idx;
337};
338
339static struct aaci_stream aaci_streams[] = {
340 [ACSTREAM_FRONT] = {
341 .codec_idx = 0,
342 .rate_idx = AC97_RATES_FRONT_DAC,
343 },
344 [ACSTREAM_SURROUND] = {
345 .codec_idx = 0,
346 .rate_idx = AC97_RATES_SURR_DAC,
347 },
348 [ACSTREAM_LFE] = {
349 .codec_idx = 0,
350 .rate_idx = AC97_RATES_LFE_DAC,
351 },
352};
353
354static inline unsigned int aaci_rate_mask(struct aaci *aaci, int streamid)
355{
356 struct aaci_stream *s = aaci_streams + streamid;
357 return aaci->ac97_bus->codec[s->codec_idx]->rates[s->rate_idx];
358}
359
360static unsigned int rate_list[] = {
361 5512, 8000, 11025, 16000, 22050, 32000, 44100,
362 48000, 64000, 88200, 96000, 176400, 192000
363};
364
365/*
366 * Double-rate rule: we can support double rate iff channels == 2
367 * (unimplemented)
368 */
369static int
370aaci_rule_rate_by_channels(struct snd_pcm_hw_params *p, struct snd_pcm_hw_rule *rule)
371{
372 struct aaci *aaci = rule->private;
373 unsigned int rate_mask = SNDRV_PCM_RATE_8000_48000|SNDRV_PCM_RATE_5512;
374 struct snd_interval *c = hw_param_interval(p, SNDRV_PCM_HW_PARAM_CHANNELS);
375
376 switch (c->max) {
377 case 6:
378 rate_mask &= aaci_rate_mask(aaci, ACSTREAM_LFE);
379 case 4:
380 rate_mask &= aaci_rate_mask(aaci, ACSTREAM_SURROUND);
381 case 2:
382 rate_mask &= aaci_rate_mask(aaci, ACSTREAM_FRONT);
383 }
384
385 return snd_interval_list(hw_param_interval(p, rule->var),
386 ARRAY_SIZE(rate_list), rate_list,
387 rate_mask);
388}
389
390static struct snd_pcm_hardware aaci_hw_info = { 341static struct snd_pcm_hardware aaci_hw_info = {
391 .info = SNDRV_PCM_INFO_MMAP | 342 .info = SNDRV_PCM_INFO_MMAP |
392 SNDRV_PCM_INFO_MMAP_VALID | 343 SNDRV_PCM_INFO_MMAP_VALID |
@@ -400,10 +351,7 @@ static struct snd_pcm_hardware aaci_hw_info = {
400 */ 351 */
401 .formats = SNDRV_PCM_FMTBIT_S16_LE, 352 .formats = SNDRV_PCM_FMTBIT_S16_LE,
402 353
403 /* should this be continuous or knot? */ 354 /* rates are setup from the AC'97 codec */
404 .rates = SNDRV_PCM_RATE_CONTINUOUS,
405 .rate_max = 48000,
406 .rate_min = 4000,
407 .channels_min = 2, 355 .channels_min = 2,
408 .channels_max = 6, 356 .channels_max = 6,
409 .buffer_bytes_max = 64 * 1024, 357 .buffer_bytes_max = 64 * 1024,
@@ -423,6 +371,12 @@ static int __aaci_pcm_open(struct aaci *aaci,
423 aacirun->substream = substream; 371 aacirun->substream = substream;
424 runtime->private_data = aacirun; 372 runtime->private_data = aacirun;
425 runtime->hw = aaci_hw_info; 373 runtime->hw = aaci_hw_info;
374 runtime->hw.rates = aacirun->pcm->rates;
375 snd_pcm_limit_hw_rates(runtime);
376
377 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
378 aacirun->pcm->r[1].slots)
379 snd_ac97_pcm_double_rate_rules(runtime);
426 380
427 /* 381 /*
428 * FIXME: ALSA specifies fifo_size in bytes. If we're in normal 382 * FIXME: ALSA specifies fifo_size in bytes. If we're in normal
@@ -433,17 +387,6 @@ static int __aaci_pcm_open(struct aaci *aaci,
433 */ 387 */
434 runtime->hw.fifo_size = aaci->fifosize * 2; 388 runtime->hw.fifo_size = aaci->fifosize * 2;
435 389
436 /*
437 * Add rule describing hardware rate dependency
438 * on the number of channels.
439 */
440 ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
441 aaci_rule_rate_by_channels, aaci,
442 SNDRV_PCM_HW_PARAM_CHANNELS,
443 SNDRV_PCM_HW_PARAM_RATE, -1);
444 if (ret)
445 goto out;
446
447 ret = request_irq(aaci->dev->irq[0], aaci_irq, IRQF_SHARED|IRQF_DISABLED, 390 ret = request_irq(aaci->dev->irq[0], aaci_irq, IRQF_SHARED|IRQF_DISABLED,
448 DRIVER_NAME, aaci); 391 DRIVER_NAME, aaci);
449 if (ret) 392 if (ret)
@@ -498,6 +441,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
498 struct snd_pcm_hw_params *params) 441 struct snd_pcm_hw_params *params)
499{ 442{
500 int err; 443 int err;
444 struct aaci *aaci = substream->private_data;
501 445
502 aaci_pcm_hw_free(substream); 446 aaci_pcm_hw_free(substream);
503 if (aacirun->pcm_open) { 447 if (aacirun->pcm_open) {
@@ -507,18 +451,22 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
507 451
508 err = snd_pcm_lib_malloc_pages(substream, 452 err = snd_pcm_lib_malloc_pages(substream,
509 params_buffer_bytes(params)); 453 params_buffer_bytes(params));
510 if (err < 0) 454 if (err >= 0) {
511 goto out; 455 unsigned int rate = params_rate(params);
456 int dbl = rate > 48000;
512 457
513 err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), 458 err = snd_ac97_pcm_open(aacirun->pcm, rate,
514 params_channels(params), 459 params_channels(params),
515 aacirun->pcm->r[0].slots); 460 aacirun->pcm->r[dbl].slots);
516 if (err)
517 goto out;
518 461
519 aacirun->pcm_open = 1; 462 aacirun->pcm_open = err == 0;
463 aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16;
464 aacirun->fifosz = aaci->fifosize * 4;
465
466 if (aacirun->cr & CR_COMPACT)
467 aacirun->fifosz >>= 1;
468 }
520 469
521 out:
522 return err; 470 return err;
523} 471}
524 472
@@ -527,7 +475,7 @@ static int aaci_pcm_prepare(struct snd_pcm_substream *substream)
527 struct snd_pcm_runtime *runtime = substream->runtime; 475 struct snd_pcm_runtime *runtime = substream->runtime;
528 struct aaci_runtime *aacirun = runtime->private_data; 476 struct aaci_runtime *aacirun = runtime->private_data;
529 477
530 aacirun->start = (void *)runtime->dma_area; 478 aacirun->start = runtime->dma_area;
531 aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream); 479 aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream);
532 aacirun->ptr = aacirun->start; 480 aacirun->ptr = aacirun->start;
533 aacirun->period = 481 aacirun->period =
@@ -613,7 +561,6 @@ static int aaci_pcm_open(struct snd_pcm_substream *substream)
613static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, 561static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream,
614 struct snd_pcm_hw_params *params) 562 struct snd_pcm_hw_params *params)
615{ 563{
616 struct aaci *aaci = substream->private_data;
617 struct aaci_runtime *aacirun = substream->runtime->private_data; 564 struct aaci_runtime *aacirun = substream->runtime->private_data;
618 unsigned int channels = params_channels(params); 565 unsigned int channels = params_channels(params);
619 int ret; 566 int ret;
@@ -627,14 +574,9 @@ static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream,
627 * Enable FIFO, compact mode, 16 bits per sample. 574 * Enable FIFO, compact mode, 16 bits per sample.
628 * FIXME: double rate slots? 575 * FIXME: double rate slots?
629 */ 576 */
630 if (ret >= 0) { 577 if (ret >= 0)
631 aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16;
632 aacirun->cr |= channels_to_txmask[channels]; 578 aacirun->cr |= channels_to_txmask[channels];
633 579
634 aacirun->fifosz = aaci->fifosize * 4;
635 if (aacirun->cr & CR_COMPACT)
636 aacirun->fifosz >>= 1;
637 }
638 return ret; 580 return ret;
639} 581}
640 582
@@ -646,7 +588,7 @@ static void aaci_pcm_playback_stop(struct aaci_runtime *aacirun)
646 ie &= ~(IE_URIE|IE_TXIE); 588 ie &= ~(IE_URIE|IE_TXIE);
647 writel(ie, aacirun->base + AACI_IE); 589 writel(ie, aacirun->base + AACI_IE);
648 aacirun->cr &= ~CR_EN; 590 aacirun->cr &= ~CR_EN;
649 aaci_chan_wait_ready(aacirun); 591 aaci_chan_wait_ready(aacirun, SR_TXB);
650 writel(aacirun->cr, aacirun->base + AACI_TXCR); 592 writel(aacirun->cr, aacirun->base + AACI_TXCR);
651} 593}
652 594
@@ -654,7 +596,7 @@ static void aaci_pcm_playback_start(struct aaci_runtime *aacirun)
654{ 596{
655 u32 ie; 597 u32 ie;
656 598
657 aaci_chan_wait_ready(aacirun); 599 aaci_chan_wait_ready(aacirun, SR_TXB);
658 aacirun->cr |= CR_EN; 600 aacirun->cr |= CR_EN;
659 601
660 ie = readl(aacirun->base + AACI_IE); 602 ie = readl(aacirun->base + AACI_IE);
@@ -665,12 +607,12 @@ static void aaci_pcm_playback_start(struct aaci_runtime *aacirun)
665 607
666static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd) 608static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd)
667{ 609{
668 struct aaci *aaci = substream->private_data;
669 struct aaci_runtime *aacirun = substream->runtime->private_data; 610 struct aaci_runtime *aacirun = substream->runtime->private_data;
670 unsigned long flags; 611 unsigned long flags;
671 int ret = 0; 612 int ret = 0;
672 613
673 spin_lock_irqsave(&aaci->lock, flags); 614 spin_lock_irqsave(&aacirun->lock, flags);
615
674 switch (cmd) { 616 switch (cmd) {
675 case SNDRV_PCM_TRIGGER_START: 617 case SNDRV_PCM_TRIGGER_START:
676 aaci_pcm_playback_start(aacirun); 618 aaci_pcm_playback_start(aacirun);
@@ -697,7 +639,8 @@ static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cm
697 default: 639 default:
698 ret = -EINVAL; 640 ret = -EINVAL;
699 } 641 }
700 spin_unlock_irqrestore(&aaci->lock, flags); 642
643 spin_unlock_irqrestore(&aacirun->lock, flags);
701 644
702 return ret; 645 return ret;
703} 646}
@@ -716,23 +659,14 @@ static struct snd_pcm_ops aaci_playback_ops = {
716static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, 659static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream,
717 struct snd_pcm_hw_params *params) 660 struct snd_pcm_hw_params *params)
718{ 661{
719 struct aaci *aaci = substream->private_data;
720 struct aaci_runtime *aacirun = substream->runtime->private_data; 662 struct aaci_runtime *aacirun = substream->runtime->private_data;
721 int ret; 663 int ret;
722 664
723 ret = aaci_pcm_hw_params(substream, aacirun, params); 665 ret = aaci_pcm_hw_params(substream, aacirun, params);
724 666 if (ret >= 0)
725 if (ret >= 0) {
726 aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16;
727
728 /* Line in record: slot 3 and 4 */ 667 /* Line in record: slot 3 and 4 */
729 aacirun->cr |= CR_SL3 | CR_SL4; 668 aacirun->cr |= CR_SL3 | CR_SL4;
730 669
731 aacirun->fifosz = aaci->fifosize * 4;
732
733 if (aacirun->cr & CR_COMPACT)
734 aacirun->fifosz >>= 1;
735 }
736 return ret; 670 return ret;
737} 671}
738 672
@@ -740,7 +674,7 @@ static void aaci_pcm_capture_stop(struct aaci_runtime *aacirun)
740{ 674{
741 u32 ie; 675 u32 ie;
742 676
743 aaci_chan_wait_ready(aacirun); 677 aaci_chan_wait_ready(aacirun, SR_RXB);
744 678
745 ie = readl(aacirun->base + AACI_IE); 679 ie = readl(aacirun->base + AACI_IE);
746 ie &= ~(IE_ORIE | IE_RXIE); 680 ie &= ~(IE_ORIE | IE_RXIE);
@@ -755,7 +689,7 @@ static void aaci_pcm_capture_start(struct aaci_runtime *aacirun)
755{ 689{
756 u32 ie; 690 u32 ie;
757 691
758 aaci_chan_wait_ready(aacirun); 692 aaci_chan_wait_ready(aacirun, SR_RXB);
759 693
760#ifdef DEBUG 694#ifdef DEBUG
761 /* RX Timeout value: bits 28:17 in RXCR */ 695 /* RX Timeout value: bits 28:17 in RXCR */
@@ -772,12 +706,11 @@ static void aaci_pcm_capture_start(struct aaci_runtime *aacirun)
772 706
773static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd) 707static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd)
774{ 708{
775 struct aaci *aaci = substream->private_data;
776 struct aaci_runtime *aacirun = substream->runtime->private_data; 709 struct aaci_runtime *aacirun = substream->runtime->private_data;
777 unsigned long flags; 710 unsigned long flags;
778 int ret = 0; 711 int ret = 0;
779 712
780 spin_lock_irqsave(&aaci->lock, flags); 713 spin_lock_irqsave(&aacirun->lock, flags);
781 714
782 switch (cmd) { 715 switch (cmd) {
783 case SNDRV_PCM_TRIGGER_START: 716 case SNDRV_PCM_TRIGGER_START:
@@ -806,7 +739,7 @@ static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd
806 ret = -EINVAL; 739 ret = -EINVAL;
807 } 740 }
808 741
809 spin_unlock_irqrestore(&aaci->lock, flags); 742 spin_unlock_irqrestore(&aacirun->lock, flags);
810 743
811 return ret; 744 return ret;
812} 745}
@@ -889,6 +822,12 @@ static struct ac97_pcm ac97_defs[] __devinitdata = {
889 (1 << AC97_SLOT_PCM_SRIGHT) | 822 (1 << AC97_SLOT_PCM_SRIGHT) |
890 (1 << AC97_SLOT_LFE), 823 (1 << AC97_SLOT_LFE),
891 }, 824 },
825 [1] = {
826 .slots = (1 << AC97_SLOT_PCM_LEFT) |
827 (1 << AC97_SLOT_PCM_RIGHT) |
828 (1 << AC97_SLOT_PCM_LEFT_0) |
829 (1 << AC97_SLOT_PCM_RIGHT_0),
830 },
892 }, 831 },
893 }, 832 },
894 [1] = { /* PCM in */ 833 [1] = { /* PCM in */
@@ -1001,7 +940,6 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
1001 940
1002 aaci = card->private_data; 941 aaci = card->private_data;
1003 mutex_init(&aaci->ac97_sem); 942 mutex_init(&aaci->ac97_sem);
1004 spin_lock_init(&aaci->lock);
1005 aaci->card = card; 943 aaci->card = card;
1006 aaci->dev = dev; 944 aaci->dev = dev;
1007 945
@@ -1028,7 +966,7 @@ static int __devinit aaci_init_pcm(struct aaci *aaci)
1028 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); 966 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops);
1029 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); 967 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops);
1030 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 968 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1031 NULL, 0, 64 * 104); 969 NULL, 0, 64 * 1024);
1032 } 970 }
1033 971
1034 return ret; 972 return ret;
@@ -1088,12 +1026,14 @@ static int __devinit aaci_probe(struct amba_device *dev, struct amba_id *id)
1088 /* 1026 /*
1089 * Playback uses AACI channel 0 1027 * Playback uses AACI channel 0
1090 */ 1028 */
1029 spin_lock_init(&aaci->playback.lock);
1091 aaci->playback.base = aaci->base + AACI_CSCH1; 1030 aaci->playback.base = aaci->base + AACI_CSCH1;
1092 aaci->playback.fifo = aaci->base + AACI_DR1; 1031 aaci->playback.fifo = aaci->base + AACI_DR1;
1093 1032
1094 /* 1033 /*
1095 * Capture uses AACI channel 0 1034 * Capture uses AACI channel 0
1096 */ 1035 */
1036 spin_lock_init(&aaci->capture.lock);
1097 aaci->capture.base = aaci->base + AACI_CSCH1; 1037 aaci->capture.base = aaci->base + AACI_CSCH1;
1098 aaci->capture.fifo = aaci->base + AACI_DR1; 1038 aaci->capture.fifo = aaci->base + AACI_DR1;
1099 1039
diff --git a/sound/arm/aaci.h b/sound/arm/aaci.h
index 924f69c1c44c..6a4a2eebdda1 100644
--- a/sound/arm/aaci.h
+++ b/sound/arm/aaci.h
@@ -202,6 +202,7 @@
202struct aaci_runtime { 202struct aaci_runtime {
203 void __iomem *base; 203 void __iomem *base;
204 void __iomem *fifo; 204 void __iomem *fifo;
205 spinlock_t lock;
205 206
206 struct ac97_pcm *pcm; 207 struct ac97_pcm *pcm;
207 int pcm_open; 208 int pcm_open;
@@ -232,7 +233,6 @@ struct aaci {
232 struct snd_ac97 *ac97; 233 struct snd_ac97 *ac97;
233 234
234 u32 maincr; 235 u32 maincr;
235 spinlock_t lock;
236 236
237 struct aaci_runtime playback; 237 struct aaci_runtime playback;
238 struct aaci_runtime capture; 238 struct aaci_runtime capture;
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index b4b48afb6de6..5d9411839cd7 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -159,7 +159,7 @@ static int pxa2xx_ac97_resume(struct device *dev)
159 return ret; 159 return ret;
160} 160}
161 161
162static struct dev_pm_ops pxa2xx_ac97_pm_ops = { 162static const struct dev_pm_ops pxa2xx_ac97_pm_ops = {
163 .suspend = pxa2xx_ac97_suspend, 163 .suspend = pxa2xx_ac97_suspend,
164 .resume = pxa2xx_ac97_resume, 164 .resume = pxa2xx_ac97_resume,
165}; 165};
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index c15682a2f9db..475455c76610 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -5,6 +5,7 @@ config SND_TIMER
5config SND_PCM 5config SND_PCM
6 tristate 6 tristate
7 select SND_TIMER 7 select SND_TIMER
8 select GCD
8 9
9config SND_HWDEP 10config SND_HWDEP
10 tristate 11 tristate
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 30f410832a25..a27545b23ee9 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -758,7 +758,7 @@ int snd_interval_ratnum(struct snd_interval *i,
758 int diff; 758 int diff;
759 if (q == 0) 759 if (q == 0)
760 q = 1; 760 q = 1;
761 den = div_down(num, q); 761 den = div_up(num, q);
762 if (den < rats[k].den_min) 762 if (den < rats[k].den_min)
763 continue; 763 continue;
764 if (den > rats[k].den_max) 764 if (den > rats[k].den_max)
@@ -794,7 +794,7 @@ int snd_interval_ratnum(struct snd_interval *i,
794 i->empty = 1; 794 i->empty = 1;
795 return -EINVAL; 795 return -EINVAL;
796 } 796 }
797 den = div_up(num, q); 797 den = div_down(num, q);
798 if (den > rats[k].den_max) 798 if (den > rats[k].den_max)
799 continue; 799 continue;
800 if (den < rats[k].den_min) 800 if (den < rats[k].den_min)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 29ab46a12e11..25b0641e6b8c 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1918,13 +1918,13 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
1918 1918
1919 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, 1919 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
1920 hw->rate_min, hw->rate_max); 1920 hw->rate_min, hw->rate_max);
1921 if (err < 0) 1921 if (err < 0)
1922 return err; 1922 return err;
1923 1923
1924 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1924 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1925 hw->period_bytes_min, hw->period_bytes_max); 1925 hw->period_bytes_min, hw->period_bytes_max);
1926 if (err < 0) 1926 if (err < 0)
1927 return err; 1927 return err;
1928 1928
1929 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, 1929 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
1930 hw->periods_min, hw->periods_max); 1930 hw->periods_min, hw->periods_max);
diff --git a/sound/core/pcm_timer.c b/sound/core/pcm_timer.c
index ca8068b63d6c..b01d9481d632 100644
--- a/sound/core/pcm_timer.c
+++ b/sound/core/pcm_timer.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/time.h> 22#include <linux/time.h>
23#include <linux/gcd.h>
23#include <sound/core.h> 24#include <sound/core.h>
24#include <sound/pcm.h> 25#include <sound/pcm.h>
25#include <sound/timer.h> 26#include <sound/timer.h>
@@ -28,22 +29,6 @@
28 * Timer functions 29 * Timer functions
29 */ 30 */
30 31
31/* Greatest common divisor */
32static unsigned long gcd(unsigned long a, unsigned long b)
33{
34 unsigned long r;
35 if (a < b) {
36 r = a;
37 a = b;
38 b = r;
39 }
40 while ((r = a % b) != 0) {
41 a = b;
42 b = r;
43 }
44 return b;
45}
46
47void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) 32void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream)
48{ 33{
49 unsigned long rate, mult, fsize, l, post; 34 unsigned long rate, mult, fsize, l, post;
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index 661205c4dcea..af888a022fc0 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -127,7 +127,8 @@ static struct snd_gf1_mem_block *snd_gf1_mem_share(struct snd_gf1_mem * alloc,
127 !share_id[2] && !share_id[3]) 127 !share_id[2] && !share_id[3])
128 return NULL; 128 return NULL;
129 for (block = alloc->first; block; block = block->next) 129 for (block = alloc->first; block; block = block->next)
130 if (!memcmp(share_id, block->share_id, sizeof(share_id))) 130 if (!memcmp(share_id, block->share_id,
131 sizeof(block->share_id)))
131 return block; 132 return block;
132 return NULL; 133 return NULL;
133} 134}
diff --git a/sound/isa/msnd/msnd_midi.c b/sound/isa/msnd/msnd_midi.c
index cb9aa4c4edd0..4be562b2cf21 100644
--- a/sound/isa/msnd/msnd_midi.c
+++ b/sound/isa/msnd/msnd_midi.c
@@ -162,7 +162,7 @@ int snd_msndmidi_new(struct snd_card *card, int device)
162 err = snd_rawmidi_new(card, "MSND-MIDI", device, 1, 1, &rmidi); 162 err = snd_rawmidi_new(card, "MSND-MIDI", device, 1, 1, &rmidi);
163 if (err < 0) 163 if (err < 0)
164 return err; 164 return err;
165 mpu = kcalloc(1, sizeof(*mpu), GFP_KERNEL); 165 mpu = kzalloc(sizeof(*mpu), GFP_KERNEL);
166 if (mpu == NULL) { 166 if (mpu == NULL) {
167 snd_device_free(card, rmidi); 167 snd_device_free(card, rmidi);
168 return -ENOMEM; 168 return -ENOMEM;
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 96678d5d3834..751762f1c59a 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -393,8 +393,6 @@ size_dram(struct snd_emu8000 *emu)
393 393
394 while (size < EMU8000_MAX_DRAM) { 394 while (size < EMU8000_MAX_DRAM) {
395 395
396 size += 512 * 1024; /* increment 512kbytes */
397
398 /* Write a unique data on the test address. 396 /* Write a unique data on the test address.
399 * if the address is out of range, the data is written on 397 * if the address is out of range, the data is written on
400 * 0x200000(=EMU8000_DRAM_OFFSET). Then the id word is 398 * 0x200000(=EMU8000_DRAM_OFFSET). Then the id word is
@@ -414,7 +412,9 @@ size_dram(struct snd_emu8000 *emu)
414 /*snd_emu8000_read_wait(emu);*/ 412 /*snd_emu8000_read_wait(emu);*/
415 EMU8000_SMLD_READ(emu); /* discard stale data */ 413 EMU8000_SMLD_READ(emu); /* discard stale data */
416 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 414 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2)
417 break; /* we must have wrapped around */ 415 break; /* no memory at this address */
416
417 size += 512 * 1024; /* increment 512kbytes */
418 418
419 snd_emu8000_read_wait(emu); 419 snd_emu8000_read_wait(emu);
420 420
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index 8691f4cf6191..f1d9d16b5486 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -609,7 +609,7 @@ static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream,
609 /* alloc virtual 'dma' area */ 609 /* alloc virtual 'dma' area */
610 if (runtime->dma_area) 610 if (runtime->dma_area)
611 vfree(runtime->dma_area); 611 vfree(runtime->dma_area);
612 runtime->dma_area = vmalloc(size); 612 runtime->dma_area = vmalloc_user(size);
613 if (runtime->dma_area == NULL) 613 if (runtime->dma_area == NULL)
614 return -ENOMEM; 614 return -ENOMEM;
615 runtime->dma_bytes = size; 615 runtime->dma_bytes = size;
diff --git a/sound/oss/pss.c b/sound/oss/pss.c
index 83f5ee236b12..e19dd5dcc2de 100644
--- a/sound/oss/pss.c
+++ b/sound/oss/pss.c
@@ -269,7 +269,7 @@ static int pss_reset_dsp(pss_confdata * devc)
269 unsigned long i, limit = jiffies + HZ/10; 269 unsigned long i, limit = jiffies + HZ/10;
270 270
271 outw(0x2000, REG(PSS_CONTROL)); 271 outw(0x2000, REG(PSS_CONTROL));
272 for (i = 0; i < 32768 && (limit-jiffies >= 0); i++) 272 for (i = 0; i < 32768 && time_after_eq(limit, jiffies); i++)
273 inw(REG(PSS_CONTROL)); 273 inw(REG(PSS_CONTROL));
274 outw(0x0000, REG(PSS_CONTROL)); 274 outw(0x0000, REG(PSS_CONTROL));
275 return 1; 275 return 1;
@@ -369,11 +369,11 @@ static int pss_download_boot(pss_confdata * devc, unsigned char *block, int size
369 outw(0, REG(PSS_DATA)); 369 outw(0, REG(PSS_DATA));
370 370
371 limit = jiffies + HZ/10; 371 limit = jiffies + HZ/10;
372 for (i = 0; i < 32768 && (limit - jiffies >= 0); i++) 372 for (i = 0; i < 32768 && time_after_eq(limit, jiffies); i++)
373 val = inw(REG(PSS_STATUS)); 373 val = inw(REG(PSS_STATUS));
374 374
375 limit = jiffies + HZ/10; 375 limit = jiffies + HZ/10;
376 for (i = 0; i < 32768 && (limit-jiffies >= 0); i++) 376 for (i = 0; i < 32768 && time_after_eq(limit, jiffies); i++)
377 { 377 {
378 val = inw(REG(PSS_STATUS)); 378 val = inw(REG(PSS_STATUS));
379 if (val & 0x4000) 379 if (val & 0x4000)
diff --git a/sound/pci/cs5535audio/Makefile b/sound/pci/cs5535audio/Makefile
index fda7a94c992f..ccc642269b9e 100644
--- a/sound/pci/cs5535audio/Makefile
+++ b/sound/pci/cs5535audio/Makefile
@@ -4,9 +4,7 @@
4 4
5snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o 5snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o
6snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o 6snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o
7ifdef CONFIG_MGEODE_LX
8snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o 7snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o
9endif
10 8
11# Toplevel Module Dependency 9# Toplevel Module Dependency
12obj-$(CONFIG_SND_CS5535AUDIO) += snd-cs5535audio.o 10obj-$(CONFIG_SND_CS5535AUDIO) += snd-cs5535audio.o
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 05f56e04849b..91e7faf69bbb 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -389,6 +389,7 @@ probefail_out:
389 389
390static void __devexit snd_cs5535audio_remove(struct pci_dev *pci) 390static void __devexit snd_cs5535audio_remove(struct pci_dev *pci)
391{ 391{
392 olpc_quirks_cleanup();
392 snd_card_free(pci_get_drvdata(pci)); 393 snd_card_free(pci_get_drvdata(pci));
393 pci_set_drvdata(pci, NULL); 394 pci_set_drvdata(pci, NULL);
394} 395}
diff --git a/sound/pci/cs5535audio/cs5535audio.h b/sound/pci/cs5535audio/cs5535audio.h
index 7a298ac662e3..51966d782a3c 100644
--- a/sound/pci/cs5535audio/cs5535audio.h
+++ b/sound/pci/cs5535audio/cs5535audio.h
@@ -99,10 +99,11 @@ int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state);
99int snd_cs5535audio_resume(struct pci_dev *pci); 99int snd_cs5535audio_resume(struct pci_dev *pci);
100#endif 100#endif
101 101
102#if defined(CONFIG_OLPC) && defined(CONFIG_MGEODE_LX) 102#ifdef CONFIG_OLPC
103void __devinit olpc_prequirks(struct snd_card *card, 103void __devinit olpc_prequirks(struct snd_card *card,
104 struct snd_ac97_template *ac97); 104 struct snd_ac97_template *ac97);
105int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97); 105int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97);
106void __devexit olpc_quirks_cleanup(void);
106void olpc_analog_input(struct snd_ac97 *ac97, int on); 107void olpc_analog_input(struct snd_ac97 *ac97, int on);
107void olpc_mic_bias(struct snd_ac97 *ac97, int on); 108void olpc_mic_bias(struct snd_ac97 *ac97, int on);
108 109
@@ -128,6 +129,7 @@ static inline int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
128{ 129{
129 return 0; 130 return 0;
130} 131}
132static inline void olpc_quirks_cleanup(void) { }
131static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { } 133static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { }
132static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { } 134static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { }
133static inline void olpc_capture_open(struct snd_ac97 *ac97) { } 135static inline void olpc_capture_open(struct snd_ac97 *ac97) { }
diff --git a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c
index 5c6814335cd7..50da49be9ae5 100644
--- a/sound/pci/cs5535audio/cs5535audio_olpc.c
+++ b/sound/pci/cs5535audio/cs5535audio_olpc.c
@@ -13,10 +13,13 @@
13#include <sound/info.h> 13#include <sound/info.h>
14#include <sound/control.h> 14#include <sound/control.h>
15#include <sound/ac97_codec.h> 15#include <sound/ac97_codec.h>
16#include <linux/gpio.h>
16 17
17#include <asm/olpc.h> 18#include <asm/olpc.h>
18#include "cs5535audio.h" 19#include "cs5535audio.h"
19 20
21#define DRV_NAME "cs5535audio-olpc"
22
20/* 23/*
21 * OLPC has an additional feature on top of the regular AD1888 codec features. 24 * OLPC has an additional feature on top of the regular AD1888 codec features.
22 * It has an Analog Input mode that is switched into (after disabling the 25 * It has an Analog Input mode that is switched into (after disabling the
@@ -38,10 +41,7 @@ void olpc_analog_input(struct snd_ac97 *ac97, int on)
38 } 41 }
39 42
40 /* set Analog Input through GPIO */ 43 /* set Analog Input through GPIO */
41 if (on) 44 gpio_set_value(OLPC_GPIO_MIC_AC, on);
42 geode_gpio_set(OLPC_GPIO_MIC_AC, GPIO_OUTPUT_VAL);
43 else
44 geode_gpio_clear(OLPC_GPIO_MIC_AC, GPIO_OUTPUT_VAL);
45} 45}
46 46
47/* 47/*
@@ -73,8 +73,7 @@ static int olpc_dc_info(struct snd_kcontrol *kctl,
73 73
74static int olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v) 74static int olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v)
75{ 75{
76 v->value.integer.value[0] = geode_gpio_isset(OLPC_GPIO_MIC_AC, 76 v->value.integer.value[0] = gpio_get_value(OLPC_GPIO_MIC_AC);
77 GPIO_OUTPUT_VAL);
78 return 0; 77 return 0;
79} 78}
80 79
@@ -153,6 +152,12 @@ int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
153 if (!machine_is_olpc()) 152 if (!machine_is_olpc())
154 return 0; 153 return 0;
155 154
155 if (gpio_request(OLPC_GPIO_MIC_AC, DRV_NAME)) {
156 printk(KERN_ERR DRV_NAME ": unable to allocate MIC GPIO\n");
157 return -EIO;
158 }
159 gpio_direction_output(OLPC_GPIO_MIC_AC, 0);
160
156 /* drop the original AD1888 HPF control */ 161 /* drop the original AD1888 HPF control */
157 memset(&elem, 0, sizeof(elem)); 162 memset(&elem, 0, sizeof(elem));
158 elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 163 elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
@@ -169,11 +174,18 @@ int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
169 for (i = 0; i < ARRAY_SIZE(olpc_cs5535audio_ctls); i++) { 174 for (i = 0; i < ARRAY_SIZE(olpc_cs5535audio_ctls); i++) {
170 err = snd_ctl_add(card, snd_ctl_new1(&olpc_cs5535audio_ctls[i], 175 err = snd_ctl_add(card, snd_ctl_new1(&olpc_cs5535audio_ctls[i],
171 ac97->private_data)); 176 ac97->private_data));
172 if (err < 0) 177 if (err < 0) {
178 gpio_free(OLPC_GPIO_MIC_AC);
173 return err; 179 return err;
180 }
174 } 181 }
175 182
176 /* turn off the mic by default */ 183 /* turn off the mic by default */
177 olpc_mic_bias(ac97, 0); 184 olpc_mic_bias(ac97, 0);
178 return 0; 185 return 0;
179} 186}
187
188void __devexit olpc_quirks_cleanup(void)
189{
190 gpio_free(OLPC_GPIO_MIC_AC);
191}
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 5fe34a8d8c81..e4581a42ace5 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -42,7 +42,7 @@ static void snd_hda_generate_beep(struct work_struct *work)
42 return; 42 return;
43 43
44 /* generate tone */ 44 /* generate tone */
45 snd_hda_codec_write_cache(codec, beep->nid, 0, 45 snd_hda_codec_write(codec, beep->nid, 0,
46 AC_VERB_SET_BEEP_CONTROL, beep->tone); 46 AC_VERB_SET_BEEP_CONTROL, beep->tone);
47} 47}
48 48
@@ -119,7 +119,7 @@ static void snd_hda_do_detach(struct hda_beep *beep)
119 beep->dev = NULL; 119 beep->dev = NULL;
120 cancel_work_sync(&beep->beep_work); 120 cancel_work_sync(&beep->beep_work);
121 /* turn off beep for sure */ 121 /* turn off beep for sure */
122 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 122 snd_hda_codec_write(beep->codec, beep->nid, 0,
123 AC_VERB_SET_BEEP_CONTROL, 0); 123 AC_VERB_SET_BEEP_CONTROL, 0);
124} 124}
125 125
@@ -192,7 +192,7 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
192 beep->enabled = enable; 192 beep->enabled = enable;
193 if (!enable) { 193 if (!enable) {
194 /* turn off beep */ 194 /* turn off beep */
195 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 195 snd_hda_codec_write(beep->codec, beep->nid, 0,
196 AC_VERB_SET_BEEP_CONTROL, 0); 196 AC_VERB_SET_BEEP_CONTROL, 0);
197 } 197 }
198 if (beep->mode == HDA_BEEP_MODE_SWREG) { 198 if (beep->mode == HDA_BEEP_MODE_SWREG) {
@@ -239,8 +239,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
239 mutex_init(&beep->mutex); 239 mutex_init(&beep->mutex);
240 240
241 if (beep->mode == HDA_BEEP_MODE_ON) { 241 if (beep->mode == HDA_BEEP_MODE_ON) {
242 beep->enabled = 1; 242 int err = snd_hda_do_attach(beep);
243 snd_hda_do_register(&beep->register_work); 243 if (err < 0) {
244 kfree(beep);
245 codec->beep = NULL;
246 return err;
247 }
244 } 248 }
245 249
246 return 0; 250 return 0;
@@ -253,7 +257,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
253 if (beep) { 257 if (beep) {
254 cancel_work_sync(&beep->register_work); 258 cancel_work_sync(&beep->register_work);
255 cancel_delayed_work(&beep->unregister_work); 259 cancel_delayed_work(&beep->unregister_work);
256 if (beep->enabled) 260 if (beep->dev)
257 snd_hda_do_detach(beep); 261 snd_hda_do_detach(beep);
258 codec->beep = NULL; 262 codec->beep = NULL;
259 kfree(beep); 263 kfree(beep);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 9cfdb771928c..f98b47cd6cfb 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1086,11 +1086,6 @@ int snd_hda_codec_configure(struct hda_codec *codec)
1086 if (err < 0) 1086 if (err < 0)
1087 return err; 1087 return err;
1088 } 1088 }
1089 /* audio codec should override the mixer name */
1090 if (codec->afg || !*codec->bus->card->mixername)
1091 snprintf(codec->bus->card->mixername,
1092 sizeof(codec->bus->card->mixername),
1093 "%s %s", codec->vendor_name, codec->chip_name);
1094 1089
1095 if (is_generic_config(codec)) { 1090 if (is_generic_config(codec)) {
1096 err = snd_hda_parse_generic_codec(codec); 1091 err = snd_hda_parse_generic_codec(codec);
@@ -1109,6 +1104,11 @@ int snd_hda_codec_configure(struct hda_codec *codec)
1109 patched: 1104 patched:
1110 if (!err && codec->patch_ops.unsol_event) 1105 if (!err && codec->patch_ops.unsol_event)
1111 err = init_unsol_queue(codec->bus); 1106 err = init_unsol_queue(codec->bus);
1107 /* audio codec should override the mixer name */
1108 if (!err && (codec->afg || !*codec->bus->card->mixername))
1109 snprintf(codec->bus->card->mixername,
1110 sizeof(codec->bus->card->mixername),
1111 "%s %s", codec->vendor_name, codec->chip_name);
1112 return err; 1112 return err;
1113} 1113}
1114EXPORT_SYMBOL_HDA(snd_hda_codec_configure); 1114EXPORT_SYMBOL_HDA(snd_hda_codec_configure);
@@ -1327,11 +1327,13 @@ EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps);
1327 */ 1327 */
1328u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) 1328u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
1329{ 1329{
1330 u32 pincap = snd_hda_query_pin_caps(codec, nid); 1330 u32 pincap;
1331
1332 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1333 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1334 1331
1332 if (!codec->no_trigger_sense) {
1333 pincap = snd_hda_query_pin_caps(codec, nid);
1334 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1335 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1336 }
1335 return snd_hda_codec_read(codec, nid, 0, 1337 return snd_hda_codec_read(codec, nid, 0,
1336 AC_VERB_GET_PIN_SENSE, 0); 1338 AC_VERB_GET_PIN_SENSE, 0);
1337} 1339}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 1d541b7f5547..0a770a28e71f 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -817,6 +817,7 @@ struct hda_codec {
817 unsigned int pin_amp_workaround:1; /* pin out-amp takes index 817 unsigned int pin_amp_workaround:1; /* pin out-amp takes index
818 * (e.g. Conexant codecs) 818 * (e.g. Conexant codecs)
819 */ 819 */
820 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
820#ifdef CONFIG_SND_HDA_POWER_SAVE 821#ifdef CONFIG_SND_HDA_POWER_SAVE
821 unsigned int power_on :1; /* current (global) power-state */ 822 unsigned int power_on :1; /* current (global) power-state */
822 unsigned int power_transition :1; /* power-state in transition */ 823 unsigned int power_transition :1; /* power-state in transition */
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index d24328661c6a..40ccb419b6e9 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -24,6 +24,7 @@
24#include <linux/compat.h> 24#include <linux/compat.h>
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/ctype.h> 26#include <linux/ctype.h>
27#include <linux/string.h>
27#include <linux/firmware.h> 28#include <linux/firmware.h>
28#include <sound/core.h> 29#include <sound/core.h>
29#include "hda_codec.h" 30#include "hda_codec.h"
@@ -428,8 +429,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf)
428 char *key, *val; 429 char *key, *val;
429 struct hda_hint *hint; 430 struct hda_hint *hint;
430 431
431 while (isspace(*buf)) 432 buf = skip_spaces(buf);
432 buf++;
433 if (!*buf || *buf == '#' || *buf == '\n') 433 if (!*buf || *buf == '#' || *buf == '\n')
434 return 0; 434 return 0;
435 if (*buf == '=') 435 if (*buf == '=')
@@ -444,8 +444,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf)
444 return -EINVAL; 444 return -EINVAL;
445 } 445 }
446 *val++ = 0; 446 *val++ = 0;
447 while (isspace(*val)) 447 val = skip_spaces(val);
448 val++;
449 remove_trail_spaces(key); 448 remove_trail_spaces(key);
450 remove_trail_spaces(val); 449 remove_trail_spaces(val);
451 hint = get_hint(codec, key); 450 hint = get_hint(codec, key);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 9b56f937913e..ec9c348336cc 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -356,6 +356,7 @@ struct azx_dev {
356 */ 356 */
357 unsigned char stream_tag; /* assigned stream */ 357 unsigned char stream_tag; /* assigned stream */
358 unsigned char index; /* stream index */ 358 unsigned char index; /* stream index */
359 int device; /* last device number assigned to */
359 360
360 unsigned int opened :1; 361 unsigned int opened :1;
361 unsigned int running :1; 362 unsigned int running :1;
@@ -1441,10 +1442,13 @@ static int __devinit azx_codec_configure(struct azx *chip)
1441 */ 1442 */
1442 1443
1443/* assign a stream for the PCM */ 1444/* assign a stream for the PCM */
1444static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) 1445static inline struct azx_dev *
1446azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
1445{ 1447{
1446 int dev, i, nums; 1448 int dev, i, nums;
1447 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 1449 struct azx_dev *res = NULL;
1450
1451 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1448 dev = chip->playback_index_offset; 1452 dev = chip->playback_index_offset;
1449 nums = chip->playback_streams; 1453 nums = chip->playback_streams;
1450 } else { 1454 } else {
@@ -1453,10 +1457,15 @@ static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream)
1453 } 1457 }
1454 for (i = 0; i < nums; i++, dev++) 1458 for (i = 0; i < nums; i++, dev++)
1455 if (!chip->azx_dev[dev].opened) { 1459 if (!chip->azx_dev[dev].opened) {
1456 chip->azx_dev[dev].opened = 1; 1460 res = &chip->azx_dev[dev];
1457 return &chip->azx_dev[dev]; 1461 if (res->device == substream->pcm->device)
1462 break;
1458 } 1463 }
1459 return NULL; 1464 if (res) {
1465 res->opened = 1;
1466 res->device = substream->pcm->device;
1467 }
1468 return res;
1460} 1469}
1461 1470
1462/* release the assigned stream */ 1471/* release the assigned stream */
@@ -1505,7 +1514,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1505 int err; 1514 int err;
1506 1515
1507 mutex_lock(&chip->open_mutex); 1516 mutex_lock(&chip->open_mutex);
1508 azx_dev = azx_assign_device(chip, substream->stream); 1517 azx_dev = azx_assign_device(chip, substream);
1509 if (azx_dev == NULL) { 1518 if (azx_dev == NULL) {
1510 mutex_unlock(&chip->open_mutex); 1519 mutex_unlock(&chip->open_mutex);
1511 return -EBUSY; 1520 return -EBUSY;
@@ -2322,6 +2331,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev)
2322 * white/black-list for enable_msi 2331 * white/black-list for enable_msi
2323 */ 2332 */
2324static struct snd_pci_quirk msi_black_list[] __devinitdata = { 2333static struct snd_pci_quirk msi_black_list[] __devinitdata = {
2334 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
2325 {} 2335 {}
2326}; 2336};
2327 2337
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 1a36137e13ec..69a941c7b158 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1186,6 +1186,8 @@ static int patch_ad1986a(struct hda_codec *codec)
1186 */ 1186 */
1187 spec->multiout.no_share_stream = 1; 1187 spec->multiout.no_share_stream = 1;
1188 1188
1189 codec->no_trigger_sense = 1;
1190
1189 return 0; 1191 return 0;
1190} 1192}
1191 1193
@@ -1371,6 +1373,8 @@ static int patch_ad1983(struct hda_codec *codec)
1371 1373
1372 codec->patch_ops = ad198x_patch_ops; 1374 codec->patch_ops = ad198x_patch_ops;
1373 1375
1376 codec->no_trigger_sense = 1;
1377
1374 return 0; 1378 return 0;
1375} 1379}
1376 1380
@@ -1813,6 +1817,9 @@ static int patch_ad1981(struct hda_codec *codec)
1813 codec->patch_ops.unsol_event = ad1981_hp_unsol_event; 1817 codec->patch_ops.unsol_event = ad1981_hp_unsol_event;
1814 break; 1818 break;
1815 } 1819 }
1820
1821 codec->no_trigger_sense = 1;
1822
1816 return 0; 1823 return 0;
1817} 1824}
1818 1825
@@ -3118,6 +3125,8 @@ static int patch_ad1988(struct hda_codec *codec)
3118#endif 3125#endif
3119 spec->vmaster_nid = 0x04; 3126 spec->vmaster_nid = 0x04;
3120 3127
3128 codec->no_trigger_sense = 1;
3129
3121 return 0; 3130 return 0;
3122} 3131}
3123 3132
@@ -3330,6 +3339,8 @@ static int patch_ad1884(struct hda_codec *codec)
3330 3339
3331 codec->patch_ops = ad198x_patch_ops; 3340 codec->patch_ops = ad198x_patch_ops;
3332 3341
3342 codec->no_trigger_sense = 1;
3343
3333 return 0; 3344 return 0;
3334} 3345}
3335 3346
@@ -4287,6 +4298,8 @@ static int patch_ad1884a(struct hda_codec *codec)
4287 break; 4298 break;
4288 } 4299 }
4289 4300
4301 codec->no_trigger_sense = 1;
4302
4290 return 0; 4303 return 0;
4291} 4304}
4292 4305
@@ -4623,6 +4636,9 @@ static int patch_ad1882(struct hda_codec *codec)
4623 spec->mixers[2] = ad1882_6stack_mixers; 4636 spec->mixers[2] = ad1882_6stack_mixers;
4624 break; 4637 break;
4625 } 4638 }
4639
4640 codec->no_trigger_sense = 1;
4641
4626 return 0; 4642 return 0;
4627} 4643}
4628 4644
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 4b200da1bd18..fe0423c39598 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -66,6 +66,7 @@ struct cs_spec {
66/* available models */ 66/* available models */
67enum { 67enum {
68 CS420X_MBP55, 68 CS420X_MBP55,
69 CS420X_IMAC27,
69 CS420X_AUTO, 70 CS420X_AUTO,
70 CS420X_MODELS 71 CS420X_MODELS
71}; 72};
@@ -827,7 +828,8 @@ static void cs_automute(struct hda_codec *codec)
827 AC_VERB_SET_PIN_WIDGET_CONTROL, 828 AC_VERB_SET_PIN_WIDGET_CONTROL,
828 hp_present ? 0 : PIN_OUT); 829 hp_present ? 0 : PIN_OUT);
829 } 830 }
830 if (spec->board_config == CS420X_MBP55) { 831 if (spec->board_config == CS420X_MBP55 ||
832 spec->board_config == CS420X_IMAC27) {
831 unsigned int gpio = hp_present ? 0x02 : 0x08; 833 unsigned int gpio = hp_present ? 0x02 : 0x08;
832 snd_hda_codec_write(codec, 0x01, 0, 834 snd_hda_codec_write(codec, 0x01, 0,
833 AC_VERB_SET_GPIO_DATA, gpio); 835 AC_VERB_SET_GPIO_DATA, gpio);
@@ -1069,12 +1071,14 @@ static int cs_parse_auto_config(struct hda_codec *codec)
1069 1071
1070static const char *cs420x_models[CS420X_MODELS] = { 1072static const char *cs420x_models[CS420X_MODELS] = {
1071 [CS420X_MBP55] = "mbp55", 1073 [CS420X_MBP55] = "mbp55",
1074 [CS420X_IMAC27] = "imac27",
1072 [CS420X_AUTO] = "auto", 1075 [CS420X_AUTO] = "auto",
1073}; 1076};
1074 1077
1075 1078
1076static struct snd_pci_quirk cs420x_cfg_tbl[] = { 1079static struct snd_pci_quirk cs420x_cfg_tbl[] = {
1077 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1080 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
1081 SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),
1078 {} /* terminator */ 1082 {} /* terminator */
1079}; 1083};
1080 1084
@@ -1097,8 +1101,23 @@ static struct cs_pincfg mbp55_pincfgs[] = {
1097 {} /* terminator */ 1101 {} /* terminator */
1098}; 1102};
1099 1103
1104static struct cs_pincfg imac27_pincfgs[] = {
1105 { 0x09, 0x012b4050 },
1106 { 0x0a, 0x90100140 },
1107 { 0x0b, 0x90100142 },
1108 { 0x0c, 0x018b3020 },
1109 { 0x0d, 0x90a00110 },
1110 { 0x0e, 0x400000f0 },
1111 { 0x0f, 0x01cbe030 },
1112 { 0x10, 0x014be060 },
1113 { 0x12, 0x01ab9070 },
1114 { 0x15, 0x400000f0 },
1115 {} /* terminator */
1116};
1117
1100static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { 1118static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
1101 [CS420X_MBP55] = mbp55_pincfgs, 1119 [CS420X_MBP55] = mbp55_pincfgs,
1120 [CS420X_IMAC27] = imac27_pincfgs,
1102}; 1121};
1103 1122
1104static void fix_pincfg(struct hda_codec *codec, int model) 1123static void fix_pincfg(struct hda_codec *codec, int model)
@@ -1128,6 +1147,7 @@ static int patch_cs420x(struct hda_codec *codec)
1128 fix_pincfg(codec, spec->board_config); 1147 fix_pincfg(codec, spec->board_config);
1129 1148
1130 switch (spec->board_config) { 1149 switch (spec->board_config) {
1150 case CS420X_IMAC27:
1131 case CS420X_MBP55: 1151 case CS420X_MBP55:
1132 /* GPIO1 = headphones */ 1152 /* GPIO1 = headphones */
1133 /* GPIO3 = speakers */ 1153 /* GPIO3 = speakers */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 2d3f4f893ef3..c7465053d6bb 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -337,6 +337,9 @@ struct alc_spec {
337 /* hooks */ 337 /* hooks */
338 void (*init_hook)(struct hda_codec *codec); 338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res); 339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340#ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec, int power);
342#endif
340 343
341 /* for pin sensing */ 344 /* for pin sensing */
342 unsigned int sense_updated: 1; 345 unsigned int sense_updated: 1;
@@ -388,6 +391,7 @@ struct alc_config_preset {
388 void (*init_hook)(struct hda_codec *); 391 void (*init_hook)(struct hda_codec *);
389#ifdef CONFIG_SND_HDA_POWER_SAVE 392#ifdef CONFIG_SND_HDA_POWER_SAVE
390 struct hda_amp_list *loopbacks; 393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec, int power);
391#endif 395#endif
392}; 396};
393 397
@@ -900,6 +904,7 @@ static void setup_preset(struct hda_codec *codec,
900 spec->unsol_event = preset->unsol_event; 904 spec->unsol_event = preset->unsol_event;
901 spec->init_hook = preset->init_hook; 905 spec->init_hook = preset->init_hook;
902#ifdef CONFIG_SND_HDA_POWER_SAVE 906#ifdef CONFIG_SND_HDA_POWER_SAVE
907 spec->power_hook = preset->power_hook;
903 spec->loopback.amplist = preset->loopbacks; 908 spec->loopback.amplist = preset->loopbacks;
904#endif 909#endif
905 910
@@ -1665,9 +1670,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1665/* some bit here disables the other DACs. Init=0x4900 */ 1670/* some bit here disables the other DACs. Init=0x4900 */
1666 {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, 1671 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1667 {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, 1672 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1668/* Enable amplifiers */
1669 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1670 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1671/* DMIC fix 1673/* DMIC fix
1672 * This laptop has a stereo digital microphone. The mics are only 1cm apart 1674 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1673 * which makes the stereo useless. However, either the mic or the ALC889 1675 * which makes the stereo useless. However, either the mic or the ALC889
@@ -1780,6 +1782,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
1780 { } /* end */ 1782 { } /* end */
1781}; 1783};
1782 1784
1785static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1786 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1789 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1790 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1791 HDA_OUTPUT),
1792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1799 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1800 { } /* end */
1801};
1802
1803
1783static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) 1804static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1784{ 1805{
1785 struct alc_spec *spec = codec->spec; 1806 struct alc_spec *spec = codec->spec;
@@ -1810,6 +1831,16 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1810 spec->autocfg.speaker_pins[2] = 0x1b; 1831 spec->autocfg.speaker_pins[2] = 0x1b;
1811} 1832}
1812 1833
1834#ifdef CONFIG_SND_HDA_POWER_SAVE
1835static void alc889_power_eapd(struct hda_codec *codec, int power)
1836{
1837 snd_hda_codec_write(codec, 0x14, 0,
1838 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1839 snd_hda_codec_write(codec, 0x15, 0,
1840 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1841}
1842#endif
1843
1813/* 1844/*
1814 * ALC880 3-stack model 1845 * ALC880 3-stack model
1815 * 1846 *
@@ -3603,12 +3634,29 @@ static void alc_free(struct hda_codec *codec)
3603 snd_hda_detach_beep_device(codec); 3634 snd_hda_detach_beep_device(codec);
3604} 3635}
3605 3636
3637#ifdef CONFIG_SND_HDA_POWER_SAVE
3638static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3639{
3640 struct alc_spec *spec = codec->spec;
3641 if (spec && spec->power_hook)
3642 spec->power_hook(codec, 0);
3643 return 0;
3644}
3645#endif
3646
3606#ifdef SND_HDA_NEEDS_RESUME 3647#ifdef SND_HDA_NEEDS_RESUME
3607static int alc_resume(struct hda_codec *codec) 3648static int alc_resume(struct hda_codec *codec)
3608{ 3649{
3650#ifdef CONFIG_SND_HDA_POWER_SAVE
3651 struct alc_spec *spec = codec->spec;
3652#endif
3609 codec->patch_ops.init(codec); 3653 codec->patch_ops.init(codec);
3610 snd_hda_codec_resume_amp(codec); 3654 snd_hda_codec_resume_amp(codec);
3611 snd_hda_codec_resume_cache(codec); 3655 snd_hda_codec_resume_cache(codec);
3656#ifdef CONFIG_SND_HDA_POWER_SAVE
3657 if (spec && spec->power_hook)
3658 spec->power_hook(codec, 1);
3659#endif
3612 return 0; 3660 return 0;
3613} 3661}
3614#endif 3662#endif
@@ -3625,6 +3673,7 @@ static struct hda_codec_ops alc_patch_ops = {
3625 .resume = alc_resume, 3673 .resume = alc_resume,
3626#endif 3674#endif
3627#ifdef CONFIG_SND_HDA_POWER_SAVE 3675#ifdef CONFIG_SND_HDA_POWER_SAVE
3676 .suspend = alc_suspend,
3628 .check_power_status = alc_check_power_status, 3677 .check_power_status = alc_check_power_status,
3629#endif 3678#endif
3630}; 3679};
@@ -9381,10 +9430,11 @@ static struct alc_config_preset alc882_presets[] = {
9381 .init_hook = alc_automute_amp, 9430 .init_hook = alc_automute_amp,
9382 }, 9431 },
9383 [ALC888_ACER_ASPIRE_8930G] = { 9432 [ALC888_ACER_ASPIRE_8930G] = {
9384 .mixers = { alc888_base_mixer, 9433 .mixers = { alc889_acer_aspire_8930g_mixer,
9385 alc883_chmode_mixer }, 9434 alc883_chmode_mixer },
9386 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 9435 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9387 alc889_acer_aspire_8930g_verbs }, 9436 alc889_acer_aspire_8930g_verbs,
9437 alc889_eapd_verbs},
9388 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9438 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9389 .dac_nids = alc883_dac_nids, 9439 .dac_nids = alc883_dac_nids,
9390 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), 9440 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
@@ -9401,6 +9451,9 @@ static struct alc_config_preset alc882_presets[] = {
9401 .unsol_event = alc_automute_amp_unsol_event, 9451 .unsol_event = alc_automute_amp_unsol_event,
9402 .setup = alc889_acer_aspire_8930g_setup, 9452 .setup = alc889_acer_aspire_8930g_setup,
9403 .init_hook = alc_automute_amp, 9453 .init_hook = alc_automute_amp,
9454#ifdef CONFIG_SND_HDA_POWER_SAVE
9455 .power_hook = alc889_power_eapd,
9456#endif
9404 }, 9457 },
9405 [ALC888_ACER_ASPIRE_7730G] = { 9458 [ALC888_ACER_ASPIRE_7730G] = {
9406 .mixers = { alc883_3ST_6ch_mixer, 9459 .mixers = { alc883_3ST_6ch_mixer,
@@ -10684,6 +10737,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10684 {} 10737 {}
10685}; 10738};
10686 10739
10740static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10741 /* Front Mic pin: input vref at 50% */
10742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10744 {}
10745};
10746
10687static struct hda_input_mux alc262_fujitsu_capture_source = { 10747static struct hda_input_mux alc262_fujitsu_capture_source = {
10688 .num_items = 3, 10748 .num_items = 3,
10689 .items = { 10749 .items = {
@@ -11726,7 +11786,8 @@ static struct alc_config_preset alc262_presets[] = {
11726 [ALC262_LENOVO_3000] = { 11786 [ALC262_LENOVO_3000] = {
11727 .mixers = { alc262_lenovo_3000_mixer }, 11787 .mixers = { alc262_lenovo_3000_mixer },
11728 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, 11788 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11729 alc262_lenovo_3000_unsol_verbs }, 11789 alc262_lenovo_3000_unsol_verbs,
11790 alc262_lenovo_3000_init_verbs },
11730 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 11791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11731 .dac_nids = alc262_dac_nids, 11792 .dac_nids = alc262_dac_nids,
11732 .hp_nid = 0x03, 11793 .hp_nid = 0x03,
@@ -12863,7 +12924,7 @@ static int patch_alc268(struct hda_codec *codec)
12863 int board_config; 12924 int board_config;
12864 int i, has_beep, err; 12925 int i, has_beep, err;
12865 12926
12866 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 12927 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12867 if (spec == NULL) 12928 if (spec == NULL)
12868 return -ENOMEM; 12929 return -ENOMEM;
12869 12930
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 3d59f8325848..2291a8396817 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2104,6 +2104,7 @@ static unsigned int ref9205_pin_configs[12] = {
2104 10280204 2104 10280204
2105 1028021F 2105 1028021F
2106 10280228 (Dell Vostro 1500) 2106 10280228 (Dell Vostro 1500)
2107 10280229 (Dell Vostro 1700)
2107*/ 2108*/
2108static unsigned int dell_9205_m42_pin_configs[12] = { 2109static unsigned int dell_9205_m42_pin_configs[12] = {
2109 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, 2110 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
@@ -2189,6 +2190,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2189 "Dell Inspiron", STAC_9205_DELL_M44), 2190 "Dell Inspiron", STAC_9205_DELL_M44),
2190 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, 2191 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2191 "Dell Vostro 1500", STAC_9205_DELL_M42), 2192 "Dell Vostro 1500", STAC_9205_DELL_M42),
2193 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
2194 "Dell Vostro 1700", STAC_9205_DELL_M42),
2192 /* Gateway */ 2195 /* Gateway */
2193 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), 2196 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
2194 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), 2197 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
@@ -3779,15 +3782,16 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3779 err = snd_hda_attach_beep_device(codec, nid); 3782 err = snd_hda_attach_beep_device(codec, nid);
3780 if (err < 0) 3783 if (err < 0)
3781 return err; 3784 return err;
3782 /* IDT/STAC codecs have linear beep tone parameter */ 3785 if (codec->beep) {
3783 codec->beep->linear_tone = 1; 3786 /* IDT/STAC codecs have linear beep tone parameter */
3784 /* if no beep switch is available, make its own one */ 3787 codec->beep->linear_tone = 1;
3785 caps = query_amp_caps(codec, nid, HDA_OUTPUT); 3788 /* if no beep switch is available, make its own one */
3786 if (codec->beep && 3789 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3787 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { 3790 if (!(caps & AC_AMPCAP_MUTE)) {
3788 err = stac92xx_beep_switch_ctl(codec); 3791 err = stac92xx_beep_switch_ctl(codec);
3789 if (err < 0) 3792 if (err < 0)
3790 return err; 3793 return err;
3794 }
3791 } 3795 }
3792 } 3796 }
3793#endif 3797#endif
@@ -4449,14 +4453,7 @@ static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4449{ 4453{
4450 if (!nid) 4454 if (!nid)
4451 return 0; 4455 return 0;
4452 /* NOTE: we can't use snd_hda_jack_detect() here because STAC/IDT 4456 return snd_hda_jack_detect(codec, nid);
4453 * codecs behave wrongly when SET_PIN_SENSE is triggered, although
4454 * the pincap gives TRIG_REQ bit.
4455 */
4456 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0) &
4457 AC_PINSENSE_PRESENCE)
4458 return 1;
4459 return 0;
4460} 4457}
4461 4458
4462static void stac92xx_line_out_detect(struct hda_codec *codec, 4459static void stac92xx_line_out_detect(struct hda_codec *codec,
@@ -4958,6 +4955,7 @@ static int patch_stac9200(struct hda_codec *codec)
4958 if (spec == NULL) 4955 if (spec == NULL)
4959 return -ENOMEM; 4956 return -ENOMEM;
4960 4957
4958 codec->no_trigger_sense = 1;
4961 codec->spec = spec; 4959 codec->spec = spec;
4962 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 4960 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4963 spec->pin_nids = stac9200_pin_nids; 4961 spec->pin_nids = stac9200_pin_nids;
@@ -5020,6 +5018,7 @@ static int patch_stac925x(struct hda_codec *codec)
5020 if (spec == NULL) 5018 if (spec == NULL)
5021 return -ENOMEM; 5019 return -ENOMEM;
5022 5020
5021 codec->no_trigger_sense = 1;
5023 codec->spec = spec; 5022 codec->spec = spec;
5024 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 5023 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5025 spec->pin_nids = stac925x_pin_nids; 5024 spec->pin_nids = stac925x_pin_nids;
@@ -5104,6 +5103,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5104 if (spec == NULL) 5103 if (spec == NULL)
5105 return -ENOMEM; 5104 return -ENOMEM;
5106 5105
5106 codec->no_trigger_sense = 1;
5107 codec->spec = spec; 5107 codec->spec = spec;
5108 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5108 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5109 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); 5109 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
@@ -5251,6 +5251,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5251 if (spec == NULL) 5251 if (spec == NULL)
5252 return -ENOMEM; 5252 return -ENOMEM;
5253 5253
5254 codec->no_trigger_sense = 1;
5254 codec->spec = spec; 5255 codec->spec = spec;
5255 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5256 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5256 spec->digbeep_nid = 0x21; 5257 spec->digbeep_nid = 0x21;
@@ -5414,6 +5415,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5414 if (spec == NULL) 5415 if (spec == NULL)
5415 return -ENOMEM; 5416 return -ENOMEM;
5416 5417
5418 codec->no_trigger_sense = 1;
5417 codec->spec = spec; 5419 codec->spec = spec;
5418 codec->patch_ops = stac92xx_patch_ops; 5420 codec->patch_ops = stac92xx_patch_ops;
5419 spec->num_pins = STAC92HD71BXX_NUM_PINS; 5421 spec->num_pins = STAC92HD71BXX_NUM_PINS;
@@ -5657,6 +5659,7 @@ static int patch_stac922x(struct hda_codec *codec)
5657 if (spec == NULL) 5659 if (spec == NULL)
5658 return -ENOMEM; 5660 return -ENOMEM;
5659 5661
5662 codec->no_trigger_sense = 1;
5660 codec->spec = spec; 5663 codec->spec = spec;
5661 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); 5664 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5662 spec->pin_nids = stac922x_pin_nids; 5665 spec->pin_nids = stac922x_pin_nids;
@@ -5760,6 +5763,7 @@ static int patch_stac927x(struct hda_codec *codec)
5760 if (spec == NULL) 5763 if (spec == NULL)
5761 return -ENOMEM; 5764 return -ENOMEM;
5762 5765
5766 codec->no_trigger_sense = 1;
5763 codec->spec = spec; 5767 codec->spec = spec;
5764 codec->slave_dig_outs = stac927x_slave_dig_outs; 5768 codec->slave_dig_outs = stac927x_slave_dig_outs;
5765 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); 5769 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
@@ -5894,6 +5898,7 @@ static int patch_stac9205(struct hda_codec *codec)
5894 if (spec == NULL) 5898 if (spec == NULL)
5895 return -ENOMEM; 5899 return -ENOMEM;
5896 5900
5901 codec->no_trigger_sense = 1;
5897 codec->spec = spec; 5902 codec->spec = spec;
5898 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); 5903 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5899 spec->pin_nids = stac9205_pin_nids; 5904 spec->pin_nids = stac9205_pin_nids;
@@ -6049,6 +6054,7 @@ static int patch_stac9872(struct hda_codec *codec)
6049 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6054 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6050 if (spec == NULL) 6055 if (spec == NULL)
6051 return -ENOMEM; 6056 return -ENOMEM;
6057 codec->no_trigger_sense = 1;
6052 codec->spec = spec; 6058 codec->spec = spec;
6053 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); 6059 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6054 spec->pin_nids = stac9872_pin_nids; 6060 spec->pin_nids = stac9872_pin_nids;
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index 7717e01fc071..edaa729126bb 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -143,7 +143,8 @@ static int snd_pdacf_probe(struct pcmcia_device *link)
143 link->io.NumPorts1 = 16; 143 link->io.NumPorts1 = 16;
144 144
145 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_FORCED_PULSE; 145 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_FORCED_PULSE;
146 // link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 146 /* FIXME: This driver should be updated to allow for dynamic IRQ sharing */
147 /* link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_FORCED_PULSE; */
147 148
148 link->irq.Handler = pdacf_interrupt; 149 link->irq.Handler = pdacf_interrupt;
149 link->conf.Attributes = CONF_ENABLE_IRQ; 150 link->conf.Attributes = CONF_ENABLE_IRQ;
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index d057e6489643..5cfa608823f7 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -51,7 +51,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t s
51 return 0; /* already enough large */ 51 return 0; /* already enough large */
52 vfree(runtime->dma_area); 52 vfree(runtime->dma_area);
53 } 53 }
54 runtime->dma_area = vmalloc_32(size); 54 runtime->dma_area = vmalloc_32_user(size);
55 if (! runtime->dma_area) 55 if (! runtime->dma_area)
56 return -ENOMEM; 56 return -ENOMEM;
57 runtime->dma_bytes = size; 57 runtime->dma_bytes = size;
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index 69bd0acc81c8..a1bbe16b7f96 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -102,6 +102,12 @@ static int ac97_soc_probe(struct platform_device *pdev)
102 INIT_LIST_HEAD(&codec->dapm_widgets); 102 INIT_LIST_HEAD(&codec->dapm_widgets);
103 INIT_LIST_HEAD(&codec->dapm_paths); 103 INIT_LIST_HEAD(&codec->dapm_paths);
104 104
105 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
106 if (ret < 0) {
107 printk(KERN_ERR "ASoC: failed to init gen ac97 glue\n");
108 goto err;
109 }
110
105 /* register pcms */ 111 /* register pcms */
106 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 112 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
107 if (ret < 0) 113 if (ret < 0)
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index b69861d52161..3ef16bbc8c83 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -470,7 +470,7 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_ak4642);
470 470
471static int __init ak4642_modinit(void) 471static int __init ak4642_modinit(void)
472{ 472{
473 int ret; 473 int ret = 0;
474#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 474#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
475 ret = i2c_add_driver(&ak4642_i2c_driver); 475 ret = i2c_add_driver(&ak4642_i2c_driver);
476#endif 476#endif
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index bbc72c2ddfca..81b8c9dfe7fc 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -191,6 +191,7 @@ static int ac97_analog_prepare(struct snd_pcm_substream *substream,
191 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS); 191 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
192 192
193 vra |= 0x1; /* enable variable rate audio */ 193 vra |= 0x1; /* enable variable rate audio */
194 vra &= ~0x4; /* disable SPDIF output */
194 195
195 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra); 196 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra);
196 197
@@ -221,22 +222,6 @@ static int ac97_digital_prepare(struct snd_pcm_substream *substream,
221 return stac9766_ac97_write(codec, reg, runtime->rate); 222 return stac9766_ac97_write(codec, reg, runtime->rate);
222} 223}
223 224
224static int ac97_digital_trigger(struct snd_pcm_substream *substream,
225 int cmd, struct snd_soc_dai *dai)
226{
227 struct snd_soc_codec *codec = dai->codec;
228 unsigned short vra;
229
230 switch (cmd) {
231 case SNDRV_PCM_TRIGGER_STOP:
232 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
233 vra &= !0x04;
234 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra);
235 break;
236 }
237 return 0;
238}
239
240static int stac9766_set_bias_level(struct snd_soc_codec *codec, 225static int stac9766_set_bias_level(struct snd_soc_codec *codec,
241 enum snd_soc_bias_level level) 226 enum snd_soc_bias_level level)
242{ 227{
@@ -315,7 +300,6 @@ static struct snd_soc_dai_ops stac9766_dai_ops_analog = {
315 300
316static struct snd_soc_dai_ops stac9766_dai_ops_digital = { 301static struct snd_soc_dai_ops stac9766_dai_ops_digital = {
317 .prepare = ac97_digital_prepare, 302 .prepare = ac97_digital_prepare,
318 .trigger = ac97_digital_trigger,
319}; 303};
320 304
321struct snd_soc_dai stac9766_dai[] = { 305struct snd_soc_dai stac9766_dai[] = {
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 5f1681f6ca76..2a27f7b56726 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -26,7 +26,7 @@
26#include <linux/pm.h> 26#include <linux/pm.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/i2c/twl4030.h> 29#include <linux/i2c/twl.h>
30#include <sound/core.h> 30#include <sound/core.h>
31#include <sound/pcm.h> 31#include <sound/pcm.h>
32#include <sound/pcm_params.h> 32#include <sound/pcm_params.h>
@@ -175,7 +175,7 @@ static int twl4030_write(struct snd_soc_codec *codec,
175{ 175{
176 twl4030_write_reg_cache(codec, reg, value); 176 twl4030_write_reg_cache(codec, reg, value);
177 if (likely(reg < TWL4030_REG_SW_SHADOW)) 177 if (likely(reg < TWL4030_REG_SW_SHADOW))
178 return twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, value, 178 return twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, value,
179 reg); 179 reg);
180 else 180 else
181 return 0; 181 return 0;
@@ -261,7 +261,7 @@ static void twl4030_power_up(struct snd_soc_codec *codec)
261 do { 261 do {
262 /* this takes a little while, so don't slam i2c */ 262 /* this takes a little while, so don't slam i2c */
263 udelay(2000); 263 udelay(2000);
264 twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte, 264 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte,
265 TWL4030_REG_ANAMICL); 265 TWL4030_REG_ANAMICL);
266 } while ((i++ < 100) && 266 } while ((i++ < 100) &&
267 ((byte & TWL4030_CNCL_OFFSET_START) == 267 ((byte & TWL4030_CNCL_OFFSET_START) ==
@@ -542,7 +542,7 @@ static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \
542 break; \ 542 break; \
543 case SND_SOC_DAPM_POST_PMD: \ 543 case SND_SOC_DAPM_POST_PMD: \
544 reg_val = twl4030_read_reg_cache(w->codec, reg); \ 544 reg_val = twl4030_read_reg_cache(w->codec, reg); \
545 twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, \ 545 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, \
546 reg_val & (~mask), \ 546 reg_val & (~mask), \
547 reg); \ 547 reg); \
548 break; \ 548 break; \
@@ -679,7 +679,7 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
679 mdelay((ramp_base[(hs_pop & TWL4030_RAMP_DELAY) >> 2] / 679 mdelay((ramp_base[(hs_pop & TWL4030_RAMP_DELAY) >> 2] /
680 twl4030->sysclk) + 1); 680 twl4030->sysclk) + 1);
681 /* Bypass the reg_cache to mute the headset */ 681 /* Bypass the reg_cache to mute the headset */
682 twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, 682 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
683 hs_gain & (~0x0f), 683 hs_gain & (~0x0f),
684 TWL4030_REG_HS_GAIN_SET); 684 TWL4030_REG_HS_GAIN_SET);
685 685
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index f82125d9e85a..ebbf11b653a4 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -1340,9 +1340,10 @@ static int wm8350_resume(struct platform_device *pdev)
1340 return 0; 1340 return 0;
1341} 1341}
1342 1342
1343static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data) 1343static irqreturn_t wm8350_hp_jack_handler(int irq, void *data)
1344{ 1344{
1345 struct wm8350_data *priv = data; 1345 struct wm8350_data *priv = data;
1346 struct wm8350 *wm8350 = priv->codec.control_data;
1346 u16 reg; 1347 u16 reg;
1347 int report; 1348 int report;
1348 int mask; 1349 int mask;
@@ -1365,7 +1366,7 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data)
1365 1366
1366 if (!jack->jack) { 1367 if (!jack->jack) {
1367 dev_warn(wm8350->dev, "Jack interrupt called with no jack\n"); 1368 dev_warn(wm8350->dev, "Jack interrupt called with no jack\n");
1368 return; 1369 return IRQ_NONE;
1369 } 1370 }
1370 1371
1371 /* Debounce */ 1372 /* Debounce */
@@ -1378,6 +1379,8 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data)
1378 report = 0; 1379 report = 0;
1379 1380
1380 snd_soc_jack_report(jack->jack, report, jack->report); 1381 snd_soc_jack_report(jack->jack, report, jack->report);
1382
1383 return IRQ_HANDLED;
1381} 1384}
1382 1385
1383/** 1386/**
@@ -1421,9 +1424,7 @@ int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
1421 wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena); 1424 wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena);
1422 1425
1423 /* Sync status */ 1426 /* Sync status */
1424 wm8350_hp_jack_handler(wm8350, irq, priv); 1427 wm8350_hp_jack_handler(irq, priv);
1425
1426 wm8350_unmask_irq(wm8350, irq);
1427 1428
1428 return 0; 1429 return 0;
1429} 1430}
@@ -1482,12 +1483,16 @@ static int wm8350_probe(struct platform_device *pdev)
1482 wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME, 1483 wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME,
1483 WM8350_OUT2_VU | WM8350_OUT2R_MUTE); 1484 WM8350_OUT2_VU | WM8350_OUT2R_MUTE);
1484 1485
1485 wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L); 1486 /* Make sure jack detect is disabled to start off with */
1486 wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R); 1487 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
1488 WM8350_JDL_ENA | WM8350_JDR_ENA);
1489
1487 wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, 1490 wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L,
1488 wm8350_hp_jack_handler, priv); 1491 wm8350_hp_jack_handler, 0, "Left jack detect",
1492 priv);
1489 wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, 1493 wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R,
1490 wm8350_hp_jack_handler, priv); 1494 wm8350_hp_jack_handler, 0, "Right jack detect",
1495 priv);
1491 1496
1492 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1497 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
1493 if (ret < 0) { 1498 if (ret < 0) {
@@ -1516,8 +1521,6 @@ static int wm8350_remove(struct platform_device *pdev)
1516 WM8350_JDL_ENA | WM8350_JDR_ENA); 1521 WM8350_JDL_ENA | WM8350_JDR_ENA);
1517 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA); 1522 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA);
1518 1523
1519 wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L);
1520 wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R);
1521 wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L); 1524 wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L);
1522 wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R); 1525 wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R);
1523 1526
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 265e68c75df8..af8cb6995a1f 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -424,23 +424,23 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream,
424 424
425 /* filter coefficient */ 425 /* filter coefficient */
426 switch (params_rate(params)) { 426 switch (params_rate(params)) {
427 case SNDRV_PCM_RATE_8000: 427 case 8000:
428 adn |= 0x5 << 1; 428 adn |= 0x5 << 1;
429 break; 429 break;
430 case SNDRV_PCM_RATE_11025: 430 case 11025:
431 adn |= 0x4 << 1; 431 adn |= 0x4 << 1;
432 break; 432 break;
433 case SNDRV_PCM_RATE_16000: 433 case 16000:
434 adn |= 0x3 << 1; 434 adn |= 0x3 << 1;
435 break; 435 break;
436 case SNDRV_PCM_RATE_22050: 436 case 22050:
437 adn |= 0x2 << 1; 437 adn |= 0x2 << 1;
438 break; 438 break;
439 case SNDRV_PCM_RATE_32000: 439 case 32000:
440 adn |= 0x1 << 1; 440 adn |= 0x1 << 1;
441 break; 441 break;
442 case SNDRV_PCM_RATE_44100: 442 case 44100:
443 case SNDRV_PCM_RATE_48000: 443 case 48000:
444 break; 444 break;
445 } 445 }
446 446
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index c9438dd62df3..dbc368c08263 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -199,7 +199,7 @@ static void wm8900_reset(struct snd_soc_codec *codec)
199 snd_soc_write(codec, WM8900_REG_RESET, 0); 199 snd_soc_write(codec, WM8900_REG_RESET, 0);
200 200
201 memcpy(codec->reg_cache, wm8900_reg_defaults, 201 memcpy(codec->reg_cache, wm8900_reg_defaults,
202 sizeof(codec->reg_cache)); 202 sizeof(wm8900_reg_defaults));
203} 203}
204 204
205static int wm8900_hp_event(struct snd_soc_dapm_widget *w, 205static int wm8900_hp_event(struct snd_soc_dapm_widget *w,
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 3d850b97037a..31e39ffd1d8e 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -378,23 +378,23 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream,
378 iface |= (1 << 9); 378 iface |= (1 << 9);
379 379
380 switch (params_rate(params)) { 380 switch (params_rate(params)) {
381 case SNDRV_PCM_RATE_8000: 381 case 8000:
382 addcntrl |= (0x5 << 1); 382 addcntrl |= (0x5 << 1);
383 break; 383 break;
384 case SNDRV_PCM_RATE_11025: 384 case 11025:
385 addcntrl |= (0x4 << 1); 385 addcntrl |= (0x4 << 1);
386 break; 386 break;
387 case SNDRV_PCM_RATE_16000: 387 case 16000:
388 addcntrl |= (0x3 << 1); 388 addcntrl |= (0x3 << 1);
389 break; 389 break;
390 case SNDRV_PCM_RATE_22050: 390 case 22050:
391 addcntrl |= (0x2 << 1); 391 addcntrl |= (0x2 << 1);
392 break; 392 break;
393 case SNDRV_PCM_RATE_32000: 393 case 32000:
394 addcntrl |= (0x1 << 1); 394 addcntrl |= (0x1 << 1);
395 break; 395 break;
396 case SNDRV_PCM_RATE_44100: 396 case 44100:
397 case SNDRV_PCM_RATE_48000: 397 case 48000:
398 break; 398 break;
399 } 399 }
400 ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl); 400 ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl);
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 81c57b5c591c..8812751da8c9 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -47,7 +47,7 @@ static const u16 wm8974_reg[WM8974_CACHEREGNUM] = {
47}; 47};
48 48
49#define WM8974_POWER1_BIASEN 0x08 49#define WM8974_POWER1_BIASEN 0x08
50#define WM8974_POWER1_BUFIOEN 0x10 50#define WM8974_POWER1_BUFIOEN 0x04
51 51
52struct wm8974_priv { 52struct wm8974_priv {
53 struct snd_soc_codec codec; 53 struct snd_soc_codec codec;
@@ -482,23 +482,23 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream,
482 482
483 /* filter coefficient */ 483 /* filter coefficient */
484 switch (params_rate(params)) { 484 switch (params_rate(params)) {
485 case SNDRV_PCM_RATE_8000: 485 case 8000:
486 adn |= 0x5 << 1; 486 adn |= 0x5 << 1;
487 break; 487 break;
488 case SNDRV_PCM_RATE_11025: 488 case 11025:
489 adn |= 0x4 << 1; 489 adn |= 0x4 << 1;
490 break; 490 break;
491 case SNDRV_PCM_RATE_16000: 491 case 16000:
492 adn |= 0x3 << 1; 492 adn |= 0x3 << 1;
493 break; 493 break;
494 case SNDRV_PCM_RATE_22050: 494 case 22050:
495 adn |= 0x2 << 1; 495 adn |= 0x2 << 1;
496 break; 496 break;
497 case SNDRV_PCM_RATE_32000: 497 case 32000:
498 adn |= 0x1 << 1; 498 adn |= 0x1 << 1;
499 break; 499 break;
500 case SNDRV_PCM_RATE_44100: 500 case 44100:
501 case SNDRV_PCM_RATE_48000: 501 case 48000:
502 break; 502 break;
503 } 503 }
504 504
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 0ac1215dcd9b..e237bf615129 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -463,7 +463,8 @@ static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
463{ 463{
464 u16 *cache = codec->reg_cache; 464 u16 *cache = codec->reg_cache;
465 465
466 soc_ac97_ops.write(codec->ac97, reg, val); 466 if (reg < 0x7c)
467 soc_ac97_ops.write(codec->ac97, reg, val);
467 reg = reg >> 1; 468 reg = reg >> 1;
468 if (reg < (ARRAY_SIZE(wm9712_reg))) 469 if (reg < (ARRAY_SIZE(wm9712_reg)))
469 cache[reg] = val; 470 cache[reg] = val;
diff --git a/sound/soc/imx/mx27vis_wm8974.c b/sound/soc/imx/mx27vis_wm8974.c
index 0267d2d91685..07d2a248438c 100644
--- a/sound/soc/imx/mx27vis_wm8974.c
+++ b/sound/soc/imx/mx27vis_wm8974.c
@@ -180,7 +180,8 @@ static int mx27vis_hifi_hw_free(struct snd_pcm_substream *substream)
180 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 180 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
181 181
182 /* disable the PLL */ 182 /* disable the PLL */
183 return codec_dai->ops->set_pll(codec_dai, IGNORED_ARG, 0, 0); 183 return codec_dai->ops->set_pll(codec_dai, IGNORED_ARG, IGNORED_ARG,
184 0, 0);
184} 185}
185 186
186/* 187/*
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index c071f9603a38..3c85c0f92823 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -24,7 +24,7 @@
24 24
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/i2c/twl4030.h> 27#include <linux/i2c/twl.h>
28#include <sound/core.h> 28#include <sound/core.h>
29#include <sound/pcm.h> 29#include <sound/pcm.h>
30#include <sound/soc.h> 30#include <sound/soc.h>
@@ -321,11 +321,11 @@ static int __init sdp3430_soc_init(void)
321 *(unsigned int *)sdp3430_dai[1].cpu_dai->private_data = 2; /* McBSP3 */ 321 *(unsigned int *)sdp3430_dai[1].cpu_dai->private_data = 2; /* McBSP3 */
322 322
323 /* Set TWL4030 GPIO6 as EXTMUTE signal */ 323 /* Set TWL4030 GPIO6 as EXTMUTE signal */
324 twl4030_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux, 324 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux,
325 TWL4030_INTBR_PMBR1); 325 TWL4030_INTBR_PMBR1);
326 pin_mux &= ~TWL4030_GPIO6_PWM0_MUTE(0x03); 326 pin_mux &= ~TWL4030_GPIO6_PWM0_MUTE(0x03);
327 pin_mux |= TWL4030_GPIO6_PWM0_MUTE(0x02); 327 pin_mux |= TWL4030_GPIO6_PWM0_MUTE(0x02);
328 twl4030_i2c_write_u8(TWL4030_MODULE_INTBR, pin_mux, 328 twl_i2c_write_u8(TWL4030_MODULE_INTBR, pin_mux,
329 TWL4030_INTBR_PMBR1); 329 TWL4030_INTBR_PMBR1);
330 330
331 ret = platform_device_add(sdp3430_snd_device); 331 ret = platform_device_add(sdp3430_snd_device);
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec.c b/sound/soc/s3c24xx/s3c24xx_simtec.c
index d441c3b64631..4984754f3298 100644
--- a/sound/soc/s3c24xx/s3c24xx_simtec.c
+++ b/sound/soc/s3c24xx/s3c24xx_simtec.c
@@ -312,7 +312,7 @@ int simtec_audio_resume(struct device *dev)
312 return 0; 312 return 0;
313} 313}
314 314
315struct dev_pm_ops simtec_audio_pmops = { 315const struct dev_pm_ops simtec_audio_pmops = {
316 .resume = simtec_audio_resume, 316 .resume = simtec_audio_resume,
317}; 317};
318EXPORT_SYMBOL_GPL(simtec_audio_pmops); 318EXPORT_SYMBOL_GPL(simtec_audio_pmops);
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec.h b/sound/soc/s3c24xx/s3c24xx_simtec.h
index 2714203af161..e18faee30cce 100644
--- a/sound/soc/s3c24xx/s3c24xx_simtec.h
+++ b/sound/soc/s3c24xx/s3c24xx_simtec.h
@@ -15,7 +15,7 @@ extern int simtec_audio_core_probe(struct platform_device *pdev,
15extern int simtec_audio_remove(struct platform_device *pdev); 15extern int simtec_audio_remove(struct platform_device *pdev);
16 16
17#ifdef CONFIG_PM 17#ifdef CONFIG_PM
18extern struct dev_pm_ops simtec_audio_pmops; 18extern const struct dev_pm_ops simtec_audio_pmops;
19#define simtec_audio_pm &simtec_audio_pmops 19#define simtec_audio_pm &simtec_audio_pmops
20#else 20#else
21#define simtec_audio_pm NULL 21#define simtec_audio_pm NULL
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c
index c7af09729c6e..5263ab18f827 100644
--- a/sound/soc/sh/fsi-ak4642.c
+++ b/sound/soc/sh/fsi-ak4642.c
@@ -42,42 +42,12 @@ static struct snd_soc_device fsi_snd_devdata = {
42 .codec_dev = &soc_codec_dev_ak4642, 42 .codec_dev = &soc_codec_dev_ak4642,
43}; 43};
44 44
45#define AK4642_BUS 0
46#define AK4642_ADR 0x12
47static int ak4642_add_i2c_device(void)
48{
49 struct i2c_board_info info;
50 struct i2c_adapter *adapter;
51 struct i2c_client *client;
52
53 memset(&info, 0, sizeof(struct i2c_board_info));
54 info.addr = AK4642_ADR;
55 strlcpy(info.type, "ak4642", I2C_NAME_SIZE);
56
57 adapter = i2c_get_adapter(AK4642_BUS);
58 if (!adapter) {
59 printk(KERN_DEBUG "can't get i2c adapter\n");
60 return -ENODEV;
61 }
62
63 client = i2c_new_device(adapter, &info);
64 i2c_put_adapter(adapter);
65 if (!client) {
66 printk(KERN_DEBUG "can't add i2c device\n");
67 return -ENODEV;
68 }
69
70 return 0;
71}
72
73static struct platform_device *fsi_snd_device; 45static struct platform_device *fsi_snd_device;
74 46
75static int __init fsi_ak4642_init(void) 47static int __init fsi_ak4642_init(void)
76{ 48{
77 int ret = -ENOMEM; 49 int ret = -ENOMEM;
78 50
79 ak4642_add_i2c_device();
80
81 fsi_snd_device = platform_device_alloc("soc-audio", -1); 51 fsi_snd_device = platform_device_alloc("soc-audio", -1);
82 if (!fsi_snd_device) 52 if (!fsi_snd_device)
83 goto out; 53 goto out;
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 9c49c11c43ce..42813b808389 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -876,7 +876,7 @@ static int fsi_probe(struct platform_device *pdev)
876 876
877 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 877 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
878 irq = platform_get_irq(pdev, 0); 878 irq = platform_get_irq(pdev, 0);
879 if (!res || !irq) { 879 if (!res || (int)irq <= 0) {
880 dev_err(&pdev->dev, "Not enough FSI platform resources.\n"); 880 dev_err(&pdev->dev, "Not enough FSI platform resources.\n");
881 ret = -ENODEV; 881 ret = -ENODEV;
882 goto exit; 882 goto exit;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ef8f28284cb9..0a6440c6f54a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1236,7 +1236,7 @@ static int soc_poweroff(struct device *dev)
1236 return 0; 1236 return 0;
1237} 1237}
1238 1238
1239static struct dev_pm_ops soc_pm_ops = { 1239static const struct dev_pm_ops soc_pm_ops = {
1240 .suspend = soc_suspend, 1240 .suspend = soc_suspend,
1241 .resume = soc_resume, 1241 .resume = soc_resume,
1242 .poweroff = soc_poweroff, 1242 .poweroff = soc_poweroff,
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index b074a594c595..4963defee18a 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -752,7 +752,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t s
752 return 0; /* already large enough */ 752 return 0; /* already large enough */
753 vfree(runtime->dma_area); 753 vfree(runtime->dma_area);
754 } 754 }
755 runtime->dma_area = vmalloc(size); 755 runtime->dma_area = vmalloc_user(size);
756 if (!runtime->dma_area) 756 if (!runtime->dma_area)
757 return -ENOMEM; 757 return -ENOMEM;
758 runtime->dma_bytes = size; 758 runtime->dma_bytes = size;