aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/aaci.c177
-rw-r--r--sound/arm/aaci.h2
-rw-r--r--sound/core/Kconfig1
-rw-r--r--sound/core/pcm_lib.c4
-rw-r--r--sound/core/pcm_timer.c17
-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/hda/hda_codec.c10
-rw-r--r--sound/pci/hda/hda_intel.c1
-rw-r--r--sound/pci/hda/patch_cirrus.c22
-rw-r--r--sound/pci/hda/patch_conexant.c43
-rw-r--r--sound/pci/hda/patch_realtek.c387
-rw-r--r--sound/pci/hda/patch_sigmatel.c22
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c2
-rw-r--r--sound/soc/codecs/ak4642.c2
-rw-r--r--sound/soc/codecs/stac9766.c18
-rw-r--r--sound/soc/codecs/wm8974.c2
-rw-r--r--sound/soc/codecs/wm9712.c3
-rw-r--r--sound/soc/imx/mx27vis_wm8974.c3
-rw-r--r--sound/soc/sh/fsi.c2
-rw-r--r--sound/usb/usbaudio.c2
23 files changed, 514 insertions, 222 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 1497dce1b04a..c5699863643b 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)
@@ -507,18 +450,22 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
507 450
508 err = snd_pcm_lib_malloc_pages(substream, 451 err = snd_pcm_lib_malloc_pages(substream,
509 params_buffer_bytes(params)); 452 params_buffer_bytes(params));
510 if (err < 0) 453 if (err >= 0) {
511 goto out; 454 unsigned int rate = params_rate(params);
455 int dbl = rate > 48000;
512 456
513 err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), 457 err = snd_ac97_pcm_open(aacirun->pcm, rate,
514 params_channels(params), 458 params_channels(params),
515 aacirun->pcm->r[0].slots); 459 aacirun->pcm->r[dbl].slots);
516 if (err)
517 goto out;
518 460
519 aacirun->pcm_open = 1; 461 aacirun->pcm_open = err == 0;
462 aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16;
463 aacirun->fifosz = aaci->fifosize * 4;
464
465 if (aacirun->cr & CR_COMPACT)
466 aacirun->fifosz >>= 1;
467 }
520 468
521 out:
522 return err; 469 return err;
523} 470}
524 471
@@ -527,7 +474,7 @@ static int aaci_pcm_prepare(struct snd_pcm_substream *substream)
527 struct snd_pcm_runtime *runtime = substream->runtime; 474 struct snd_pcm_runtime *runtime = substream->runtime;
528 struct aaci_runtime *aacirun = runtime->private_data; 475 struct aaci_runtime *aacirun = runtime->private_data;
529 476
530 aacirun->start = (void *)runtime->dma_area; 477 aacirun->start = runtime->dma_area;
531 aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream); 478 aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream);
532 aacirun->ptr = aacirun->start; 479 aacirun->ptr = aacirun->start;
533 aacirun->period = 480 aacirun->period =
@@ -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}
@@ -721,18 +664,10 @@ static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream,
721 int ret; 664 int ret;
722 665
723 ret = aaci_pcm_hw_params(substream, aacirun, params); 666 ret = aaci_pcm_hw_params(substream, aacirun, params);
724 667 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 */ 668 /* Line in record: slot 3 and 4 */
729 aacirun->cr |= CR_SL3 | CR_SL4; 669 aacirun->cr |= CR_SL3 | CR_SL4;
730 670
731 aacirun->fifosz = aaci->fifosize * 4;
732
733 if (aacirun->cr & CR_COMPACT)
734 aacirun->fifosz >>= 1;
735 }
736 return ret; 671 return ret;
737} 672}
738 673
@@ -740,7 +675,7 @@ static void aaci_pcm_capture_stop(struct aaci_runtime *aacirun)
740{ 675{
741 u32 ie; 676 u32 ie;
742 677
743 aaci_chan_wait_ready(aacirun); 678 aaci_chan_wait_ready(aacirun, SR_RXB);
744 679
745 ie = readl(aacirun->base + AACI_IE); 680 ie = readl(aacirun->base + AACI_IE);
746 ie &= ~(IE_ORIE | IE_RXIE); 681 ie &= ~(IE_ORIE | IE_RXIE);
@@ -755,7 +690,7 @@ static void aaci_pcm_capture_start(struct aaci_runtime *aacirun)
755{ 690{
756 u32 ie; 691 u32 ie;
757 692
758 aaci_chan_wait_ready(aacirun); 693 aaci_chan_wait_ready(aacirun, SR_RXB);
759 694
760#ifdef DEBUG 695#ifdef DEBUG
761 /* RX Timeout value: bits 28:17 in RXCR */ 696 /* RX Timeout value: bits 28:17 in RXCR */
@@ -772,12 +707,11 @@ static void aaci_pcm_capture_start(struct aaci_runtime *aacirun)
772 707
773static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd) 708static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd)
774{ 709{
775 struct aaci *aaci = substream->private_data;
776 struct aaci_runtime *aacirun = substream->runtime->private_data; 710 struct aaci_runtime *aacirun = substream->runtime->private_data;
777 unsigned long flags; 711 unsigned long flags;
778 int ret = 0; 712 int ret = 0;
779 713
780 spin_lock_irqsave(&aaci->lock, flags); 714 spin_lock_irqsave(&aacirun->lock, flags);
781 715
782 switch (cmd) { 716 switch (cmd) {
783 case SNDRV_PCM_TRIGGER_START: 717 case SNDRV_PCM_TRIGGER_START:
@@ -806,7 +740,7 @@ static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd
806 ret = -EINVAL; 740 ret = -EINVAL;
807 } 741 }
808 742
809 spin_unlock_irqrestore(&aaci->lock, flags); 743 spin_unlock_irqrestore(&aacirun->lock, flags);
810 744
811 return ret; 745 return ret;
812} 746}
@@ -889,6 +823,12 @@ static struct ac97_pcm ac97_defs[] __devinitdata = {
889 (1 << AC97_SLOT_PCM_SRIGHT) | 823 (1 << AC97_SLOT_PCM_SRIGHT) |
890 (1 << AC97_SLOT_LFE), 824 (1 << AC97_SLOT_LFE),
891 }, 825 },
826 [1] = {
827 .slots = (1 << AC97_SLOT_PCM_LEFT) |
828 (1 << AC97_SLOT_PCM_RIGHT) |
829 (1 << AC97_SLOT_PCM_LEFT_0) |
830 (1 << AC97_SLOT_PCM_RIGHT_0),
831 },
892 }, 832 },
893 }, 833 },
894 [1] = { /* PCM in */ 834 [1] = { /* PCM in */
@@ -1001,7 +941,6 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
1001 941
1002 aaci = card->private_data; 942 aaci = card->private_data;
1003 mutex_init(&aaci->ac97_sem); 943 mutex_init(&aaci->ac97_sem);
1004 spin_lock_init(&aaci->lock);
1005 aaci->card = card; 944 aaci->card = card;
1006 aaci->dev = dev; 945 aaci->dev = dev;
1007 946
@@ -1028,7 +967,7 @@ static int __devinit aaci_init_pcm(struct aaci *aaci)
1028 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); 967 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); 968 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, 969 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1031 NULL, 0, 64 * 104); 970 NULL, 0, 64 * 1024);
1032 } 971 }
1033 972
1034 return ret; 973 return ret;
@@ -1088,12 +1027,14 @@ static int __devinit aaci_probe(struct amba_device *dev, struct amba_id *id)
1088 /* 1027 /*
1089 * Playback uses AACI channel 0 1028 * Playback uses AACI channel 0
1090 */ 1029 */
1030 spin_lock_init(&aaci->playback.lock);
1091 aaci->playback.base = aaci->base + AACI_CSCH1; 1031 aaci->playback.base = aaci->base + AACI_CSCH1;
1092 aaci->playback.fifo = aaci->base + AACI_DR1; 1032 aaci->playback.fifo = aaci->base + AACI_DR1;
1093 1033
1094 /* 1034 /*
1095 * Capture uses AACI channel 0 1035 * Capture uses AACI channel 0
1096 */ 1036 */
1037 spin_lock_init(&aaci->capture.lock);
1097 aaci->capture.base = aaci->base + AACI_CSCH1; 1038 aaci->capture.base = aaci->base + AACI_CSCH1;
1098 aaci->capture.fifo = aaci->base + AACI_DR1; 1039 aaci->capture.fifo = aaci->base + AACI_DR1;
1099 1040
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/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_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/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/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 9cfdb771928c..950ee5cfcacf 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);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 9b56f937913e..ff8ad46cc50e 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2322,6 +2322,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev)
2322 * white/black-list for enable_msi 2322 * white/black-list for enable_msi
2323 */ 2323 */
2324static struct snd_pci_quirk msi_black_list[] __devinitdata = { 2324static struct snd_pci_quirk msi_black_list[] __devinitdata = {
2325 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
2325 {} 2326 {}
2326}; 2327};
2327 2328
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_conexant.c b/sound/pci/hda/patch_conexant.c
index a09c03c3f62b..c578c28f368e 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -29,6 +29,7 @@
29 29
30#include "hda_codec.h" 30#include "hda_codec.h"
31#include "hda_local.h" 31#include "hda_local.h"
32#include "hda_beep.h"
32 33
33#define CXT_PIN_DIR_IN 0x00 34#define CXT_PIN_DIR_IN 0x00
34#define CXT_PIN_DIR_OUT 0x01 35#define CXT_PIN_DIR_OUT 0x01
@@ -111,6 +112,7 @@ struct conexant_spec {
111 unsigned int dell_automute; 112 unsigned int dell_automute;
112 unsigned int port_d_mode; 113 unsigned int port_d_mode;
113 unsigned char ext_mic_bias; 114 unsigned char ext_mic_bias;
115 unsigned int dell_vostro;
114}; 116};
115 117
116static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, 118static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo,
@@ -476,6 +478,7 @@ static void conexant_free(struct hda_codec *codec)
476 snd_array_free(&spec->jacks); 478 snd_array_free(&spec->jacks);
477 } 479 }
478#endif 480#endif
481 snd_hda_detach_beep_device(codec);
479 kfree(codec->spec); 482 kfree(codec->spec);
480} 483}
481 484
@@ -2109,9 +2112,12 @@ static int cxt5066_mic_boost_mux_enum_get(struct snd_kcontrol *kcontrol,
2109{ 2112{
2110 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2113 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2111 int val; 2114 int val;
2115 hda_nid_t nid = kcontrol->private_value & 0xff;
2116 int inout = (kcontrol->private_value & 0x100) ?
2117 AC_AMP_GET_INPUT : AC_AMP_GET_OUTPUT;
2112 2118
2113 val = snd_hda_codec_read(codec, 0x17, 0, 2119 val = snd_hda_codec_read(codec, nid, 0,
2114 AC_VERB_GET_AMP_GAIN_MUTE, AC_AMP_GET_OUTPUT); 2120 AC_VERB_GET_AMP_GAIN_MUTE, inout);
2115 2121
2116 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; 2122 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN;
2117 return 0; 2123 return 0;
@@ -2123,6 +2129,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2123 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2129 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2124 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; 2130 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost;
2125 unsigned int idx; 2131 unsigned int idx;
2132 hda_nid_t nid = kcontrol->private_value & 0xff;
2133 int inout = (kcontrol->private_value & 0x100) ?
2134 AC_AMP_SET_INPUT : AC_AMP_SET_OUTPUT;
2126 2135
2127 if (!imux->num_items) 2136 if (!imux->num_items)
2128 return 0; 2137 return 0;
@@ -2130,9 +2139,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2130 if (idx >= imux->num_items) 2139 if (idx >= imux->num_items)
2131 idx = imux->num_items - 1; 2140 idx = imux->num_items - 1;
2132 2141
2133 snd_hda_codec_write_cache(codec, 0x17, 0, 2142 snd_hda_codec_write_cache(codec, nid, 0,
2134 AC_VERB_SET_AMP_GAIN_MUTE, 2143 AC_VERB_SET_AMP_GAIN_MUTE,
2135 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | AC_AMP_SET_OUTPUT | 2144 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | inout |
2136 imux->items[idx].index); 2145 imux->items[idx].index);
2137 2146
2138 return 1; 2147 return 1;
@@ -2201,10 +2210,11 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2201 2210
2202 { 2211 {
2203 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2204 .name = "Analog Mic Boost Capture Enum", 2213 .name = "Ext Mic Boost Capture Enum",
2205 .info = cxt5066_mic_boost_mux_enum_info, 2214 .info = cxt5066_mic_boost_mux_enum_info,
2206 .get = cxt5066_mic_boost_mux_enum_get, 2215 .get = cxt5066_mic_boost_mux_enum_get,
2207 .put = cxt5066_mic_boost_mux_enum_put, 2216 .put = cxt5066_mic_boost_mux_enum_put,
2217 .private_value = 0x17,
2208 }, 2218 },
2209 2219
2210 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), 2220 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others),
@@ -2212,6 +2222,19 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2212 {} 2222 {}
2213}; 2223};
2214 2224
2225static struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2226 {
2227 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2228 .name = "Int Mic Boost Capture Enum",
2229 .info = cxt5066_mic_boost_mux_enum_info,
2230 .get = cxt5066_mic_boost_mux_enum_get,
2231 .put = cxt5066_mic_boost_mux_enum_put,
2232 .private_value = 0x23 | 0x100,
2233 },
2234 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT),
2235 {}
2236};
2237
2215static struct hda_verb cxt5066_init_verbs[] = { 2238static struct hda_verb cxt5066_init_verbs[] = {
2216 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ 2239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */
2217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ 2240 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */
@@ -2397,11 +2420,16 @@ static struct hda_verb cxt5066_init_verbs_portd_lo[] = {
2397/* initialize jack-sensing, too */ 2420/* initialize jack-sensing, too */
2398static int cxt5066_init(struct hda_codec *codec) 2421static int cxt5066_init(struct hda_codec *codec)
2399{ 2422{
2423 struct conexant_spec *spec = codec->spec;
2424
2400 snd_printdd("CXT5066: init\n"); 2425 snd_printdd("CXT5066: init\n");
2401 conexant_init(codec); 2426 conexant_init(codec);
2402 if (codec->patch_ops.unsol_event) { 2427 if (codec->patch_ops.unsol_event) {
2403 cxt5066_hp_automute(codec); 2428 cxt5066_hp_automute(codec);
2404 cxt5066_automic(codec); 2429 if (spec->dell_vostro)
2430 cxt5066_vostro_automic(codec);
2431 else
2432 cxt5066_automic(codec);
2405 } 2433 }
2406 return 0; 2434 return 0;
2407} 2435}
@@ -2500,7 +2528,10 @@ static int patch_cxt5066(struct hda_codec *codec)
2500 spec->init_verbs[0] = cxt5066_init_verbs_vostro; 2528 spec->init_verbs[0] = cxt5066_init_verbs_vostro;
2501 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; 2529 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc;
2502 spec->mixers[spec->num_mixers++] = cxt5066_mixers; 2530 spec->mixers[spec->num_mixers++] = cxt5066_mixers;
2531 spec->mixers[spec->num_mixers++] = cxt5066_vostro_mixers;
2503 spec->port_d_mode = 0; 2532 spec->port_d_mode = 0;
2533 spec->dell_vostro = 1;
2534 snd_hda_attach_beep_device(codec, 0x13);
2504 2535
2505 /* no S/PDIF out */ 2536 /* no S/PDIF out */
2506 spec->multiout.dig_out_nid = 0; 2537 spec->multiout.dig_out_nid = 0;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index aeed4cc5aa79..c7465053d6bb 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -131,8 +131,8 @@ enum {
131enum { 131enum {
132 ALC269_BASIC, 132 ALC269_BASIC,
133 ALC269_QUANTA_FL1, 133 ALC269_QUANTA_FL1,
134 ALC269_ASUS_EEEPC_P703, 134 ALC269_ASUS_AMIC,
135 ALC269_ASUS_EEEPC_P901, 135 ALC269_ASUS_DMIC,
136 ALC269_FUJITSU, 136 ALC269_FUJITSU,
137 ALC269_LIFEBOOK, 137 ALC269_LIFEBOOK,
138 ALC269_AUTO, 138 ALC269_AUTO,
@@ -188,6 +188,8 @@ enum {
188 ALC663_ASUS_MODE4, 188 ALC663_ASUS_MODE4,
189 ALC663_ASUS_MODE5, 189 ALC663_ASUS_MODE5,
190 ALC663_ASUS_MODE6, 190 ALC663_ASUS_MODE6,
191 ALC663_ASUS_MODE7,
192 ALC663_ASUS_MODE8,
191 ALC272_DELL, 193 ALC272_DELL,
192 ALC272_DELL_ZM1, 194 ALC272_DELL_ZM1,
193 ALC272_SAMSUNG_NC10, 195 ALC272_SAMSUNG_NC10,
@@ -335,6 +337,9 @@ struct alc_spec {
335 /* hooks */ 337 /* hooks */
336 void (*init_hook)(struct hda_codec *codec); 338 void (*init_hook)(struct hda_codec *codec);
337 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
338 343
339 /* for pin sensing */ 344 /* for pin sensing */
340 unsigned int sense_updated: 1; 345 unsigned int sense_updated: 1;
@@ -386,6 +391,7 @@ struct alc_config_preset {
386 void (*init_hook)(struct hda_codec *); 391 void (*init_hook)(struct hda_codec *);
387#ifdef CONFIG_SND_HDA_POWER_SAVE 392#ifdef CONFIG_SND_HDA_POWER_SAVE
388 struct hda_amp_list *loopbacks; 393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec, int power);
389#endif 395#endif
390}; 396};
391 397
@@ -898,6 +904,7 @@ static void setup_preset(struct hda_codec *codec,
898 spec->unsol_event = preset->unsol_event; 904 spec->unsol_event = preset->unsol_event;
899 spec->init_hook = preset->init_hook; 905 spec->init_hook = preset->init_hook;
900#ifdef CONFIG_SND_HDA_POWER_SAVE 906#ifdef CONFIG_SND_HDA_POWER_SAVE
907 spec->power_hook = preset->power_hook;
901 spec->loopback.amplist = preset->loopbacks; 908 spec->loopback.amplist = preset->loopbacks;
902#endif 909#endif
903 910
@@ -1663,9 +1670,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1663/* some bit here disables the other DACs. Init=0x4900 */ 1670/* some bit here disables the other DACs. Init=0x4900 */
1664 {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, 1671 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1665 {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, 1672 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1666/* Enable amplifiers */
1667 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1668 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1669/* DMIC fix 1673/* DMIC fix
1670 * 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
1671 * 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
@@ -1778,6 +1782,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
1778 { } /* end */ 1782 { } /* end */
1779}; 1783};
1780 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
1781static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) 1804static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1782{ 1805{
1783 struct alc_spec *spec = codec->spec; 1806 struct alc_spec *spec = codec->spec;
@@ -1808,6 +1831,16 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1808 spec->autocfg.speaker_pins[2] = 0x1b; 1831 spec->autocfg.speaker_pins[2] = 0x1b;
1809} 1832}
1810 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
1811/* 1844/*
1812 * ALC880 3-stack model 1845 * ALC880 3-stack model
1813 * 1846 *
@@ -3601,12 +3634,29 @@ static void alc_free(struct hda_codec *codec)
3601 snd_hda_detach_beep_device(codec); 3634 snd_hda_detach_beep_device(codec);
3602} 3635}
3603 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
3604#ifdef SND_HDA_NEEDS_RESUME 3647#ifdef SND_HDA_NEEDS_RESUME
3605static int alc_resume(struct hda_codec *codec) 3648static int alc_resume(struct hda_codec *codec)
3606{ 3649{
3650#ifdef CONFIG_SND_HDA_POWER_SAVE
3651 struct alc_spec *spec = codec->spec;
3652#endif
3607 codec->patch_ops.init(codec); 3653 codec->patch_ops.init(codec);
3608 snd_hda_codec_resume_amp(codec); 3654 snd_hda_codec_resume_amp(codec);
3609 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
3610 return 0; 3660 return 0;
3611} 3661}
3612#endif 3662#endif
@@ -3623,6 +3673,7 @@ static struct hda_codec_ops alc_patch_ops = {
3623 .resume = alc_resume, 3673 .resume = alc_resume,
3624#endif 3674#endif
3625#ifdef CONFIG_SND_HDA_POWER_SAVE 3675#ifdef CONFIG_SND_HDA_POWER_SAVE
3676 .suspend = alc_suspend,
3626 .check_power_status = alc_check_power_status, 3677 .check_power_status = alc_check_power_status,
3627#endif 3678#endif
3628}; 3679};
@@ -8919,7 +8970,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
8919 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), 8970 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8920 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), 8971 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8921 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ 8972 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8922 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), 8973 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8923 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), 8974 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8924 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), 8975 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8925 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), 8976 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
@@ -9282,6 +9333,7 @@ static struct alc_config_preset alc882_presets[] = {
9282 .dac_nids = alc883_dac_nids, 9333 .dac_nids = alc883_dac_nids,
9283 .adc_nids = alc883_adc_nids_alt, 9334 .adc_nids = alc883_adc_nids_alt,
9284 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9335 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9336 .capsrc_nids = alc883_capsrc_nids,
9285 .dig_out_nid = ALC883_DIGOUT_NID, 9337 .dig_out_nid = ALC883_DIGOUT_NID,
9286 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9338 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9287 .channel_mode = alc883_3ST_2ch_modes, 9339 .channel_mode = alc883_3ST_2ch_modes,
@@ -9378,10 +9430,11 @@ static struct alc_config_preset alc882_presets[] = {
9378 .init_hook = alc_automute_amp, 9430 .init_hook = alc_automute_amp,
9379 }, 9431 },
9380 [ALC888_ACER_ASPIRE_8930G] = { 9432 [ALC888_ACER_ASPIRE_8930G] = {
9381 .mixers = { alc888_base_mixer, 9433 .mixers = { alc889_acer_aspire_8930g_mixer,
9382 alc883_chmode_mixer }, 9434 alc883_chmode_mixer },
9383 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 9435 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9384 alc889_acer_aspire_8930g_verbs }, 9436 alc889_acer_aspire_8930g_verbs,
9437 alc889_eapd_verbs},
9385 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9438 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9386 .dac_nids = alc883_dac_nids, 9439 .dac_nids = alc883_dac_nids,
9387 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), 9440 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
@@ -9398,6 +9451,9 @@ static struct alc_config_preset alc882_presets[] = {
9398 .unsol_event = alc_automute_amp_unsol_event, 9451 .unsol_event = alc_automute_amp_unsol_event,
9399 .setup = alc889_acer_aspire_8930g_setup, 9452 .setup = alc889_acer_aspire_8930g_setup,
9400 .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
9401 }, 9457 },
9402 [ALC888_ACER_ASPIRE_7730G] = { 9458 [ALC888_ACER_ASPIRE_7730G] = {
9403 .mixers = { alc883_3ST_6ch_mixer, 9459 .mixers = { alc883_3ST_6ch_mixer,
@@ -9428,6 +9484,7 @@ static struct alc_config_preset alc882_presets[] = {
9428 .dac_nids = alc883_dac_nids, 9484 .dac_nids = alc883_dac_nids,
9429 .adc_nids = alc883_adc_nids_alt, 9485 .adc_nids = alc883_adc_nids_alt,
9430 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9486 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9487 .capsrc_nids = alc883_capsrc_nids,
9431 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 9488 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9432 .channel_mode = alc883_sixstack_modes, 9489 .channel_mode = alc883_sixstack_modes,
9433 .input_mux = &alc883_capture_source, 9490 .input_mux = &alc883_capture_source,
@@ -9489,6 +9546,7 @@ static struct alc_config_preset alc882_presets[] = {
9489 .dac_nids = alc883_dac_nids, 9546 .dac_nids = alc883_dac_nids,
9490 .adc_nids = alc883_adc_nids_alt, 9547 .adc_nids = alc883_adc_nids_alt,
9491 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9548 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9549 .capsrc_nids = alc883_capsrc_nids,
9492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9550 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9493 .channel_mode = alc883_3ST_2ch_modes, 9551 .channel_mode = alc883_3ST_2ch_modes,
9494 .input_mux = &alc883_lenovo_101e_capture_source, 9552 .input_mux = &alc883_lenovo_101e_capture_source,
@@ -9668,6 +9726,7 @@ static struct alc_config_preset alc882_presets[] = {
9668 alc880_gpio1_init_verbs }, 9726 alc880_gpio1_init_verbs },
9669 .adc_nids = alc883_adc_nids, 9727 .adc_nids = alc883_adc_nids,
9670 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 9728 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9729 .capsrc_nids = alc883_capsrc_nids,
9671 .dac_nids = alc883_dac_nids, 9730 .dac_nids = alc883_dac_nids,
9672 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9731 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9673 .channel_mode = alc889A_mb31_6ch_modes, 9732 .channel_mode = alc889A_mb31_6ch_modes,
@@ -10678,6 +10737,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10678 {} 10737 {}
10679}; 10738};
10680 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
10681static struct hda_input_mux alc262_fujitsu_capture_source = { 10747static struct hda_input_mux alc262_fujitsu_capture_source = {
10682 .num_items = 3, 10748 .num_items = 3,
10683 .items = { 10749 .items = {
@@ -11720,7 +11786,8 @@ static struct alc_config_preset alc262_presets[] = {
11720 [ALC262_LENOVO_3000] = { 11786 [ALC262_LENOVO_3000] = {
11721 .mixers = { alc262_lenovo_3000_mixer }, 11787 .mixers = { alc262_lenovo_3000_mixer },
11722 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, 11788 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11723 alc262_lenovo_3000_unsol_verbs }, 11789 alc262_lenovo_3000_unsol_verbs,
11790 alc262_lenovo_3000_init_verbs },
11724 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 11791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11725 .dac_nids = alc262_dac_nids, 11792 .dac_nids = alc262_dac_nids,
11726 .hp_nid = 0x03, 11793 .hp_nid = 0x03,
@@ -12857,7 +12924,7 @@ static int patch_alc268(struct hda_codec *codec)
12857 int board_config; 12924 int board_config;
12858 int i, has_beep, err; 12925 int i, has_beep, err;
12859 12926
12860 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 12927 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12861 if (spec == NULL) 12928 if (spec == NULL)
12862 return -ENOMEM; 12929 return -ENOMEM;
12863 12930
@@ -13232,10 +13299,12 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13232/* toggle speaker-output according to the hp-jack state */ 13299/* toggle speaker-output according to the hp-jack state */
13233static void alc269_speaker_automute(struct hda_codec *codec) 13300static void alc269_speaker_automute(struct hda_codec *codec)
13234{ 13301{
13302 struct alc_spec *spec = codec->spec;
13303 unsigned int nid = spec->autocfg.hp_pins[0];
13235 unsigned int present; 13304 unsigned int present;
13236 unsigned char bits; 13305 unsigned char bits;
13237 13306
13238 present = snd_hda_jack_detect(codec, 0x15); 13307 present = snd_hda_jack_detect(codec, nid);
13239 bits = present ? AMP_IN_MUTE(0) : 0; 13308 bits = present ? AMP_IN_MUTE(0) : 0;
13240 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 13309 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13241 AMP_IN_MUTE(0), bits); 13310 AMP_IN_MUTE(0), bits);
@@ -13460,8 +13529,8 @@ static void alc269_auto_init(struct hda_codec *codec)
13460static const char *alc269_models[ALC269_MODEL_LAST] = { 13529static const char *alc269_models[ALC269_MODEL_LAST] = {
13461 [ALC269_BASIC] = "basic", 13530 [ALC269_BASIC] = "basic",
13462 [ALC269_QUANTA_FL1] = "quanta", 13531 [ALC269_QUANTA_FL1] = "quanta",
13463 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", 13532 [ALC269_ASUS_AMIC] = "asus-amic",
13464 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", 13533 [ALC269_ASUS_DMIC] = "asus-dmic",
13465 [ALC269_FUJITSU] = "fujitsu", 13534 [ALC269_FUJITSU] = "fujitsu",
13466 [ALC269_LIFEBOOK] = "lifebook", 13535 [ALC269_LIFEBOOK] = "lifebook",
13467 [ALC269_AUTO] = "auto", 13536 [ALC269_AUTO] = "auto",
@@ -13470,18 +13539,41 @@ static const char *alc269_models[ALC269_MODEL_LAST] = {
13470static struct snd_pci_quirk alc269_cfg_tbl[] = { 13539static struct snd_pci_quirk alc269_cfg_tbl[] = {
13471 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), 13540 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13472 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 13541 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13473 ALC269_ASUS_EEEPC_P703), 13542 ALC269_ASUS_AMIC),
13474 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), 13543 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13475 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), 13544 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13476 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), 13545 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13477 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), 13546 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13478 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), 13547 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13479 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), 13548 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13549 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13550 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13551 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13552 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13553 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13554 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13555 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13556 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13557 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13558 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13559 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13560 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13561 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13562 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13563 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13564 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13565 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13566 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13567 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13568 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13569 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13570 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13480 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", 13571 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13481 ALC269_ASUS_EEEPC_P901), 13572 ALC269_ASUS_DMIC),
13482 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", 13573 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13483 ALC269_ASUS_EEEPC_P901), 13574 ALC269_ASUS_DMIC),
13484 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), 13575 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13576 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13485 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), 13577 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13486 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), 13578 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13487 {} 13579 {}
@@ -13511,7 +13603,7 @@ static struct alc_config_preset alc269_presets[] = {
13511 .setup = alc269_quanta_fl1_setup, 13603 .setup = alc269_quanta_fl1_setup,
13512 .init_hook = alc269_quanta_fl1_init_hook, 13604 .init_hook = alc269_quanta_fl1_init_hook,
13513 }, 13605 },
13514 [ALC269_ASUS_EEEPC_P703] = { 13606 [ALC269_ASUS_AMIC] = {
13515 .mixers = { alc269_eeepc_mixer }, 13607 .mixers = { alc269_eeepc_mixer },
13516 .cap_mixer = alc269_epc_capture_mixer, 13608 .cap_mixer = alc269_epc_capture_mixer,
13517 .init_verbs = { alc269_init_verbs, 13609 .init_verbs = { alc269_init_verbs,
@@ -13525,7 +13617,7 @@ static struct alc_config_preset alc269_presets[] = {
13525 .setup = alc269_eeepc_amic_setup, 13617 .setup = alc269_eeepc_amic_setup,
13526 .init_hook = alc269_eeepc_inithook, 13618 .init_hook = alc269_eeepc_inithook,
13527 }, 13619 },
13528 [ALC269_ASUS_EEEPC_P901] = { 13620 [ALC269_ASUS_DMIC] = {
13529 .mixers = { alc269_eeepc_mixer }, 13621 .mixers = { alc269_eeepc_mixer },
13530 .cap_mixer = alc269_epc_capture_mixer, 13622 .cap_mixer = alc269_epc_capture_mixer,
13531 .init_verbs = { alc269_init_verbs, 13623 .init_verbs = { alc269_init_verbs,
@@ -16160,6 +16252,52 @@ static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16160 { } /* end */ 16252 { } /* end */
16161}; 16253};
16162 16254
16255static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16256 .ops = &snd_hda_bind_sw,
16257 .values = {
16258 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16259 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16260 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16261 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16262 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16263 0
16264 },
16265};
16266
16267static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16268 .ops = &snd_hda_bind_sw,
16269 .values = {
16270 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16271 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16272 0
16273 },
16274};
16275
16276static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16277 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16278 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16279 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16280 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16281 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16282 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16283 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16286 { } /* end */
16287};
16288
16289static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16290 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16291 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16292 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16293 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16294 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16297 { } /* end */
16298};
16299
16300
16163static struct snd_kcontrol_new alc662_chmode_mixer[] = { 16301static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16164 { 16302 {
16165 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 16303 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -16447,6 +16585,45 @@ static struct hda_verb alc272_dell_init_verbs[] = {
16447 {} 16585 {}
16448}; 16586};
16449 16587
16588static struct hda_verb alc663_mode7_init_verbs[] = {
16589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16590 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16591 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16592 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16593 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16594 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16595 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16596 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16597 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16598 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16601 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16602 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16603 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16604 {}
16605};
16606
16607static struct hda_verb alc663_mode8_init_verbs[] = {
16608 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16611 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16613 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16614 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16615 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16616 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16617 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16618 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16621 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16622 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16623 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16624 {}
16625};
16626
16450static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { 16627static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16451 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 16628 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16452 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), 16629 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
@@ -16626,6 +16803,54 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16626 } 16803 }
16627} 16804}
16628 16805
16806static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16807{
16808 unsigned int present1, present2;
16809
16810 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16811 AC_VERB_GET_PIN_SENSE, 0)
16812 & AC_PINSENSE_PRESENCE;
16813 present2 = snd_hda_codec_read(codec, 0x21, 0,
16814 AC_VERB_GET_PIN_SENSE, 0)
16815 & AC_PINSENSE_PRESENCE;
16816
16817 if (present1 || present2) {
16818 snd_hda_codec_write_cache(codec, 0x14, 0,
16819 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16820 snd_hda_codec_write_cache(codec, 0x17, 0,
16821 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16822 } else {
16823 snd_hda_codec_write_cache(codec, 0x14, 0,
16824 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16825 snd_hda_codec_write_cache(codec, 0x17, 0,
16826 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16827 }
16828}
16829
16830static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16831{
16832 unsigned int present1, present2;
16833
16834 present1 = snd_hda_codec_read(codec, 0x21, 0,
16835 AC_VERB_GET_PIN_SENSE, 0)
16836 & AC_PINSENSE_PRESENCE;
16837 present2 = snd_hda_codec_read(codec, 0x15, 0,
16838 AC_VERB_GET_PIN_SENSE, 0)
16839 & AC_PINSENSE_PRESENCE;
16840
16841 if (present1 || present2) {
16842 snd_hda_codec_write_cache(codec, 0x14, 0,
16843 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16844 snd_hda_codec_write_cache(codec, 0x17, 0,
16845 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16846 } else {
16847 snd_hda_codec_write_cache(codec, 0x14, 0,
16848 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16849 snd_hda_codec_write_cache(codec, 0x17, 0,
16850 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16851 }
16852}
16853
16629static void alc663_m51va_unsol_event(struct hda_codec *codec, 16854static void alc663_m51va_unsol_event(struct hda_codec *codec,
16630 unsigned int res) 16855 unsigned int res)
16631{ 16856{
@@ -16645,7 +16870,7 @@ static void alc663_m51va_setup(struct hda_codec *codec)
16645 spec->ext_mic.pin = 0x18; 16870 spec->ext_mic.pin = 0x18;
16646 spec->ext_mic.mux_idx = 0; 16871 spec->ext_mic.mux_idx = 0;
16647 spec->int_mic.pin = 0x12; 16872 spec->int_mic.pin = 0x12;
16648 spec->int_mic.mux_idx = 1; 16873 spec->int_mic.mux_idx = 9;
16649 spec->auto_mic = 1; 16874 spec->auto_mic = 1;
16650} 16875}
16651 16876
@@ -16657,7 +16882,17 @@ static void alc663_m51va_inithook(struct hda_codec *codec)
16657 16882
16658/* ***************** Mode1 ******************************/ 16883/* ***************** Mode1 ******************************/
16659#define alc663_mode1_unsol_event alc663_m51va_unsol_event 16884#define alc663_mode1_unsol_event alc663_m51va_unsol_event
16660#define alc663_mode1_setup alc663_m51va_setup 16885
16886static void alc663_mode1_setup(struct hda_codec *codec)
16887{
16888 struct alc_spec *spec = codec->spec;
16889 spec->ext_mic.pin = 0x18;
16890 spec->ext_mic.mux_idx = 0;
16891 spec->int_mic.pin = 0x19;
16892 spec->int_mic.mux_idx = 1;
16893 spec->auto_mic = 1;
16894}
16895
16661#define alc663_mode1_inithook alc663_m51va_inithook 16896#define alc663_mode1_inithook alc663_m51va_inithook
16662 16897
16663/* ***************** Mode2 ******************************/ 16898/* ***************** Mode2 ******************************/
@@ -16674,7 +16909,7 @@ static void alc662_mode2_unsol_event(struct hda_codec *codec,
16674 } 16909 }
16675} 16910}
16676 16911
16677#define alc662_mode2_setup alc663_m51va_setup 16912#define alc662_mode2_setup alc663_mode1_setup
16678 16913
16679static void alc662_mode2_inithook(struct hda_codec *codec) 16914static void alc662_mode2_inithook(struct hda_codec *codec)
16680{ 16915{
@@ -16695,7 +16930,7 @@ static void alc663_mode3_unsol_event(struct hda_codec *codec,
16695 } 16930 }
16696} 16931}
16697 16932
16698#define alc663_mode3_setup alc663_m51va_setup 16933#define alc663_mode3_setup alc663_mode1_setup
16699 16934
16700static void alc663_mode3_inithook(struct hda_codec *codec) 16935static void alc663_mode3_inithook(struct hda_codec *codec)
16701{ 16936{
@@ -16716,7 +16951,7 @@ static void alc663_mode4_unsol_event(struct hda_codec *codec,
16716 } 16951 }
16717} 16952}
16718 16953
16719#define alc663_mode4_setup alc663_m51va_setup 16954#define alc663_mode4_setup alc663_mode1_setup
16720 16955
16721static void alc663_mode4_inithook(struct hda_codec *codec) 16956static void alc663_mode4_inithook(struct hda_codec *codec)
16722{ 16957{
@@ -16737,7 +16972,7 @@ static void alc663_mode5_unsol_event(struct hda_codec *codec,
16737 } 16972 }
16738} 16973}
16739 16974
16740#define alc663_mode5_setup alc663_m51va_setup 16975#define alc663_mode5_setup alc663_mode1_setup
16741 16976
16742static void alc663_mode5_inithook(struct hda_codec *codec) 16977static void alc663_mode5_inithook(struct hda_codec *codec)
16743{ 16978{
@@ -16758,7 +16993,7 @@ static void alc663_mode6_unsol_event(struct hda_codec *codec,
16758 } 16993 }
16759} 16994}
16760 16995
16761#define alc663_mode6_setup alc663_m51va_setup 16996#define alc663_mode6_setup alc663_mode1_setup
16762 16997
16763static void alc663_mode6_inithook(struct hda_codec *codec) 16998static void alc663_mode6_inithook(struct hda_codec *codec)
16764{ 16999{
@@ -16766,6 +17001,50 @@ static void alc663_mode6_inithook(struct hda_codec *codec)
16766 alc_mic_automute(codec); 17001 alc_mic_automute(codec);
16767} 17002}
16768 17003
17004/* ***************** Mode7 ******************************/
17005static void alc663_mode7_unsol_event(struct hda_codec *codec,
17006 unsigned int res)
17007{
17008 switch (res >> 26) {
17009 case ALC880_HP_EVENT:
17010 alc663_two_hp_m7_speaker_automute(codec);
17011 break;
17012 case ALC880_MIC_EVENT:
17013 alc_mic_automute(codec);
17014 break;
17015 }
17016}
17017
17018#define alc663_mode7_setup alc663_mode1_setup
17019
17020static void alc663_mode7_inithook(struct hda_codec *codec)
17021{
17022 alc663_two_hp_m7_speaker_automute(codec);
17023 alc_mic_automute(codec);
17024}
17025
17026/* ***************** Mode8 ******************************/
17027static void alc663_mode8_unsol_event(struct hda_codec *codec,
17028 unsigned int res)
17029{
17030 switch (res >> 26) {
17031 case ALC880_HP_EVENT:
17032 alc663_two_hp_m8_speaker_automute(codec);
17033 break;
17034 case ALC880_MIC_EVENT:
17035 alc_mic_automute(codec);
17036 break;
17037 }
17038}
17039
17040#define alc663_mode8_setup alc663_m51va_setup
17041
17042static void alc663_mode8_inithook(struct hda_codec *codec)
17043{
17044 alc663_two_hp_m8_speaker_automute(codec);
17045 alc_mic_automute(codec);
17046}
17047
16769static void alc663_g71v_hp_automute(struct hda_codec *codec) 17048static void alc663_g71v_hp_automute(struct hda_codec *codec)
16770{ 17049{
16771 unsigned int present; 17050 unsigned int present;
@@ -16900,6 +17179,8 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
16900 [ALC663_ASUS_MODE4] = "asus-mode4", 17179 [ALC663_ASUS_MODE4] = "asus-mode4",
16901 [ALC663_ASUS_MODE5] = "asus-mode5", 17180 [ALC663_ASUS_MODE5] = "asus-mode5",
16902 [ALC663_ASUS_MODE6] = "asus-mode6", 17181 [ALC663_ASUS_MODE6] = "asus-mode6",
17182 [ALC663_ASUS_MODE7] = "asus-mode7",
17183 [ALC663_ASUS_MODE8] = "asus-mode8",
16903 [ALC272_DELL] = "dell", 17184 [ALC272_DELL] = "dell",
16904 [ALC272_DELL_ZM1] = "dell-zm1", 17185 [ALC272_DELL_ZM1] = "dell-zm1",
16905 [ALC272_SAMSUNG_NC10] = "samsung-nc10", 17186 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
@@ -16916,12 +17197,22 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
16916 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), 17197 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16917 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), 17198 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16918 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), 17199 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17200 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17201 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
16919 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), 17202 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17203 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17204 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17205 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17206 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17207 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
16920 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), 17208 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17209 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17210 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
16921 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), 17211 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16922 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), 17212 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16923 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), 17213 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16924 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), 17214 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17215 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
16925 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), 17216 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16926 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), 17217 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16927 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), 17218 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
@@ -17205,6 +17496,36 @@ static struct alc_config_preset alc662_presets[] = {
17205 .setup = alc663_mode6_setup, 17496 .setup = alc663_mode6_setup,
17206 .init_hook = alc663_mode6_inithook, 17497 .init_hook = alc663_mode6_inithook,
17207 }, 17498 },
17499 [ALC663_ASUS_MODE7] = {
17500 .mixers = { alc663_mode7_mixer },
17501 .cap_mixer = alc662_auto_capture_mixer,
17502 .init_verbs = { alc662_init_verbs,
17503 alc663_mode7_init_verbs },
17504 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17505 .hp_nid = 0x03,
17506 .dac_nids = alc662_dac_nids,
17507 .dig_out_nid = ALC662_DIGOUT_NID,
17508 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17509 .channel_mode = alc662_3ST_2ch_modes,
17510 .unsol_event = alc663_mode7_unsol_event,
17511 .setup = alc663_mode7_setup,
17512 .init_hook = alc663_mode7_inithook,
17513 },
17514 [ALC663_ASUS_MODE8] = {
17515 .mixers = { alc663_mode8_mixer },
17516 .cap_mixer = alc662_auto_capture_mixer,
17517 .init_verbs = { alc662_init_verbs,
17518 alc663_mode8_init_verbs },
17519 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17520 .hp_nid = 0x03,
17521 .dac_nids = alc662_dac_nids,
17522 .dig_out_nid = ALC662_DIGOUT_NID,
17523 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17524 .channel_mode = alc662_3ST_2ch_modes,
17525 .unsol_event = alc663_mode8_unsol_event,
17526 .setup = alc663_mode8_setup,
17527 .init_hook = alc663_mode8_inithook,
17528 },
17208 [ALC272_DELL] = { 17529 [ALC272_DELL] = {
17209 .mixers = { alc663_m51va_mixer }, 17530 .mixers = { alc663_m51va_mixer },
17210 .cap_mixer = alc272_auto_capture_mixer, 17531 .cap_mixer = alc272_auto_capture_mixer,
@@ -17688,7 +18009,9 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
17688 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, 18009 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17689 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, 18010 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17690 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, 18011 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18012 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
17691 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, 18013 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18014 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
17692 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 18015 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17693 .patch = patch_alc861 }, 18016 .patch = patch_alc861 },
17694 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, 18017 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 3d59f8325848..eeda7beeb57a 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
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/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/wm8974.c b/sound/soc/codecs/wm8974.c
index 81c57b5c591c..a808675388fc 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;
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/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/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;