aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2010-01-08 03:11:18 -0500
committerJaroslav Kysela <perex@perex.cz>2010-01-08 03:11:18 -0500
commita4ad68d57e4dc4138304df23d1817eb094149389 (patch)
treeca7d8c4ce5377c4251560de06e15dd7be7063351 /sound
parentcd9d95a55550555da8e587ead9cbba5f98a371a3 (diff)
parentc97259df3f2e163c72f4d0685c61fb2e026dc989 (diff)
Merge branch 'topic/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 into devel
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/aaci.c177
-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_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/ac97/ac97_codec.c2
-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_codec.c58
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_hwdep.c14
-rw-r--r--sound/pci/hda/hda_intel.c49
-rw-r--r--sound/pci/hda/hda_local.h2
-rw-r--r--sound/pci/hda/patch_analog.c79
-rw-r--r--sound/pci/hda/patch_cirrus.c34
-rw-r--r--sound/pci/hda/patch_cmedia.c3
-rw-r--r--sound/pci/hda/patch_conexant.c43
-rw-r--r--sound/pci/hda/patch_realtek.c419
-rw-r--r--sound/pci/hda/patch_sigmatel.c135
-rw-r--r--sound/pci/hda/patch_via.c3
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c3
-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/twl4030.c10
-rw-r--r--sound/soc/codecs/wm8350.c25
-rw-r--r--sound/soc/codecs/wm8900.c2
-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/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.c2
-rw-r--r--sound/soc/soc-core.c2
-rw-r--r--sound/usb/usbaudio.c2
44 files changed, 824 insertions, 359 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/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 c7b35b20e659..0ee7e807c964 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -774,7 +774,7 @@ int snd_interval_ratnum(struct snd_interval *i,
774 int diff; 774 int diff;
775 if (q == 0) 775 if (q == 0)
776 q = 1; 776 q = 1;
777 den = div_down(num, q); 777 den = div_up(num, q);
778 if (den < rats[k].den_min) 778 if (den < rats[k].den_min)
779 continue; 779 continue;
780 if (den > rats[k].den_max) 780 if (den > rats[k].den_max)
@@ -810,7 +810,7 @@ int snd_interval_ratnum(struct snd_interval *i,
810 i->empty = 1; 810 i->empty = 1;
811 return -EINVAL; 811 return -EINVAL;
812 } 812 }
813 den = div_up(num, q); 813 den = div_down(num, q);
814 if (den > rats[k].den_max) 814 if (den > rats[k].den_max)
815 continue; 815 continue;
816 if (den < rats[k].den_min) 816 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/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/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 20cb60afb200..c11920623009 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -2122,7 +2122,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
2122 } 2122 }
2123 /* nothing should be in powerdown mode */ 2123 /* nothing should be in powerdown mode */
2124 snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); 2124 snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0);
2125 end_time = jiffies + msecs_to_jiffies(120); 2125 end_time = jiffies + msecs_to_jiffies(5000);
2126 do { 2126 do {
2127 if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) 2127 if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f)
2128 goto __ready_ok; 2128 goto __ready_ok;
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_codec.c b/sound/pci/hda/hda_codec.c
index c848ec0f085e..d02ea8926e7e 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -824,6 +824,9 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
824 struct hda_pincfg *pin; 824 struct hda_pincfg *pin;
825 unsigned int oldcfg; 825 unsigned int oldcfg;
826 826
827 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
828 return -EINVAL;
829
827 oldcfg = snd_hda_codec_get_pincfg(codec, nid); 830 oldcfg = snd_hda_codec_get_pincfg(codec, nid);
828 pin = look_up_pincfg(codec, list, nid); 831 pin = look_up_pincfg(codec, list, nid);
829 if (!pin) { 832 if (!pin) {
@@ -899,6 +902,25 @@ static void restore_pincfgs(struct hda_codec *codec)
899 } 902 }
900} 903}
901 904
905/**
906 * snd_hda_shutup_pins - Shut up all pins
907 * @codec: the HDA codec
908 *
909 * Clear all pin controls to shup up before suspend for avoiding click noise.
910 * The controls aren't cached so that they can be resumed properly.
911 */
912void snd_hda_shutup_pins(struct hda_codec *codec)
913{
914 int i;
915 for (i = 0; i < codec->init_pins.used; i++) {
916 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
917 /* use read here for syncing after issuing each verb */
918 snd_hda_codec_read(codec, pin->nid, 0,
919 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
920 }
921}
922EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);
923
902static void init_hda_cache(struct hda_cache_rec *cache, 924static void init_hda_cache(struct hda_cache_rec *cache,
903 unsigned int record_size); 925 unsigned int record_size);
904static void free_hda_cache(struct hda_cache_rec *cache); 926static void free_hda_cache(struct hda_cache_rec *cache);
@@ -1088,11 +1110,6 @@ int snd_hda_codec_configure(struct hda_codec *codec)
1088 if (err < 0) 1110 if (err < 0)
1089 return err; 1111 return err;
1090 } 1112 }
1091 /* audio codec should override the mixer name */
1092 if (codec->afg || !*codec->bus->card->mixername)
1093 snprintf(codec->bus->card->mixername,
1094 sizeof(codec->bus->card->mixername),
1095 "%s %s", codec->vendor_name, codec->chip_name);
1096 1113
1097 if (is_generic_config(codec)) { 1114 if (is_generic_config(codec)) {
1098 err = snd_hda_parse_generic_codec(codec); 1115 err = snd_hda_parse_generic_codec(codec);
@@ -1111,6 +1128,11 @@ int snd_hda_codec_configure(struct hda_codec *codec)
1111 patched: 1128 patched:
1112 if (!err && codec->patch_ops.unsol_event) 1129 if (!err && codec->patch_ops.unsol_event)
1113 err = init_unsol_queue(codec->bus); 1130 err = init_unsol_queue(codec->bus);
1131 /* audio codec should override the mixer name */
1132 if (!err && (codec->afg || !*codec->bus->card->mixername))
1133 snprintf(codec->bus->card->mixername,
1134 sizeof(codec->bus->card->mixername),
1135 "%s %s", codec->vendor_name, codec->chip_name);
1114 return err; 1136 return err;
1115} 1137}
1116EXPORT_SYMBOL_HDA(snd_hda_codec_configure); 1138EXPORT_SYMBOL_HDA(snd_hda_codec_configure);
@@ -3537,32 +3559,6 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew)
3537} 3559}
3538EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); 3560EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls);
3539 3561
3540/**
3541 * snd_hda_add_nids - assign nids to controls from the array
3542 * @codec: the HDA codec
3543 * @kctl: struct snd_kcontrol
3544 * @index: index to kctl
3545 * @nids: the array of hda_nid_t
3546 * @size: count of hda_nid_t items
3547 *
3548 * This helper function assigns NIDs in the given array to a control element.
3549 *
3550 * Returns 0 if successful, or a negative error code.
3551 */
3552int snd_hda_add_nids(struct hda_codec *codec, struct snd_kcontrol *kctl,
3553 unsigned int index, hda_nid_t *nids, unsigned int size)
3554{
3555 int err;
3556
3557 for ( ; size > 0; size--, nids++) {
3558 err = snd_hda_add_nid(codec, kctl, index, *nids);
3559 if (err < 0)
3560 return err;
3561 }
3562 return 0;
3563}
3564EXPORT_SYMBOL_HDA(snd_hda_add_nids);
3565
3566#ifdef CONFIG_SND_HDA_POWER_SAVE 3562#ifdef CONFIG_SND_HDA_POWER_SAVE
3567static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, 3563static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
3568 unsigned int power_state); 3564 unsigned int power_state);
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 0d08ad5bd898..11c4aa8ee996 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -898,6 +898,7 @@ int snd_hda_codec_set_pincfg(struct hda_codec *codec, hda_nid_t nid,
898 unsigned int cfg); 898 unsigned int cfg);
899int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, 899int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
900 hda_nid_t nid, unsigned int cfg); /* for hwdep */ 900 hda_nid_t nid, unsigned int cfg); /* for hwdep */
901void snd_hda_shutup_pins(struct hda_codec *codec);
901 902
902/* 903/*
903 * Mixer 904 * Mixer
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index d24328661c6a..b36919c0d363 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"
@@ -292,8 +293,11 @@ static ssize_t type##_store(struct device *dev, \
292{ \ 293{ \
293 struct snd_hwdep *hwdep = dev_get_drvdata(dev); \ 294 struct snd_hwdep *hwdep = dev_get_drvdata(dev); \
294 struct hda_codec *codec = hwdep->private_data; \ 295 struct hda_codec *codec = hwdep->private_data; \
295 char *after; \ 296 unsigned long val; \
296 codec->type = simple_strtoul(buf, &after, 0); \ 297 int err = strict_strtoul(buf, 0, &val); \
298 if (err < 0) \
299 return err; \
300 codec->type = val; \
297 return count; \ 301 return count; \
298} 302}
299 303
@@ -428,8 +432,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf)
428 char *key, *val; 432 char *key, *val;
429 struct hda_hint *hint; 433 struct hda_hint *hint;
430 434
431 while (isspace(*buf)) 435 buf = skip_spaces(buf);
432 buf++;
433 if (!*buf || *buf == '#' || *buf == '\n') 436 if (!*buf || *buf == '#' || *buf == '\n')
434 return 0; 437 return 0;
435 if (*buf == '=') 438 if (*buf == '=')
@@ -444,8 +447,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf)
444 return -EINVAL; 447 return -EINVAL;
445 } 448 }
446 *val++ = 0; 449 *val++ = 0;
447 while (isspace(*val)) 450 val = skip_spaces(val);
448 val++;
449 remove_trail_spaces(key); 451 remove_trail_spaces(key);
450 remove_trail_spaces(val); 452 remove_trail_spaces(val);
451 hint = get_hint(codec, key); 453 hint = get_hint(codec, key);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index e54420e691ae..1f516e668d88 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
@@ -2694,29 +2704,10 @@ static struct pci_device_id azx_ids[] = {
2694 /* ULI M5461 */ 2704 /* ULI M5461 */
2695 { PCI_DEVICE(0x10b9, 0x5461), .driver_data = AZX_DRIVER_ULI }, 2705 { PCI_DEVICE(0x10b9, 0x5461), .driver_data = AZX_DRIVER_ULI },
2696 /* NVIDIA MCP */ 2706 /* NVIDIA MCP */
2697 { PCI_DEVICE(0x10de, 0x026c), .driver_data = AZX_DRIVER_NVIDIA }, 2707 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID),
2698 { PCI_DEVICE(0x10de, 0x0371), .driver_data = AZX_DRIVER_NVIDIA }, 2708 .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
2699 { PCI_DEVICE(0x10de, 0x03e4), .driver_data = AZX_DRIVER_NVIDIA }, 2709 .class_mask = 0xffffff,
2700 { PCI_DEVICE(0x10de, 0x03f0), .driver_data = AZX_DRIVER_NVIDIA }, 2710 .driver_data = AZX_DRIVER_NVIDIA },
2701 { PCI_DEVICE(0x10de, 0x044a), .driver_data = AZX_DRIVER_NVIDIA },
2702 { PCI_DEVICE(0x10de, 0x044b), .driver_data = AZX_DRIVER_NVIDIA },
2703 { PCI_DEVICE(0x10de, 0x055c), .driver_data = AZX_DRIVER_NVIDIA },
2704 { PCI_DEVICE(0x10de, 0x055d), .driver_data = AZX_DRIVER_NVIDIA },
2705 { PCI_DEVICE(0x10de, 0x0590), .driver_data = AZX_DRIVER_NVIDIA },
2706 { PCI_DEVICE(0x10de, 0x0774), .driver_data = AZX_DRIVER_NVIDIA },
2707 { PCI_DEVICE(0x10de, 0x0775), .driver_data = AZX_DRIVER_NVIDIA },
2708 { PCI_DEVICE(0x10de, 0x0776), .driver_data = AZX_DRIVER_NVIDIA },
2709 { PCI_DEVICE(0x10de, 0x0777), .driver_data = AZX_DRIVER_NVIDIA },
2710 { PCI_DEVICE(0x10de, 0x07fc), .driver_data = AZX_DRIVER_NVIDIA },
2711 { PCI_DEVICE(0x10de, 0x07fd), .driver_data = AZX_DRIVER_NVIDIA },
2712 { PCI_DEVICE(0x10de, 0x0ac0), .driver_data = AZX_DRIVER_NVIDIA },
2713 { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA },
2714 { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA },
2715 { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA },
2716 { PCI_DEVICE(0x10de, 0x0d94), .driver_data = AZX_DRIVER_NVIDIA },
2717 { PCI_DEVICE(0x10de, 0x0d95), .driver_data = AZX_DRIVER_NVIDIA },
2718 { PCI_DEVICE(0x10de, 0x0d96), .driver_data = AZX_DRIVER_NVIDIA },
2719 { PCI_DEVICE(0x10de, 0x0d97), .driver_data = AZX_DRIVER_NVIDIA },
2720 /* Teradici */ 2711 /* Teradici */
2721 { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, 2712 { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA },
2722 /* Creative X-Fi (CA0110-IBG) */ 2713 /* Creative X-Fi (CA0110-IBG) */
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index d505d052972e..7cee364976ff 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -343,8 +343,6 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
343 const struct snd_pci_quirk *tbl); 343 const struct snd_pci_quirk *tbl);
344int snd_hda_add_new_ctls(struct hda_codec *codec, 344int snd_hda_add_new_ctls(struct hda_codec *codec,
345 struct snd_kcontrol_new *knew); 345 struct snd_kcontrol_new *knew);
346int snd_hda_add_nids(struct hda_codec *codec, struct snd_kcontrol *kctl,
347 unsigned int index, hda_nid_t *nids, unsigned int size);
348 346
349/* 347/*
350 * unsolicited event handler 348 * unsolicited event handler
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index e75b5e5a1d55..cecd3c108990 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -244,8 +244,7 @@ static int ad198x_build_controls(struct hda_codec *codec)
244 if (!kctl) 244 if (!kctl)
245 kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); 245 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
246 for (i = 0; kctl && i < kctl->count; i++) { 246 for (i = 0; kctl && i < kctl->count; i++) {
247 err = snd_hda_add_nids(codec, kctl, i, spec->capsrc_nids, 247 err = snd_hda_add_nid(codec, kctl, i, spec->capsrc_nids[i]);
248 spec->input_mux->num_items);
249 if (err < 0) 248 if (err < 0)
250 return err; 249 return err;
251 } 250 }
@@ -442,6 +441,11 @@ static int ad198x_build_pcms(struct hda_codec *codec)
442 return 0; 441 return 0;
443} 442}
444 443
444static inline void ad198x_shutup(struct hda_codec *codec)
445{
446 snd_hda_shutup_pins(codec);
447}
448
445static void ad198x_free_kctls(struct hda_codec *codec) 449static void ad198x_free_kctls(struct hda_codec *codec)
446{ 450{
447 struct ad198x_spec *spec = codec->spec; 451 struct ad198x_spec *spec = codec->spec;
@@ -455,6 +459,46 @@ static void ad198x_free_kctls(struct hda_codec *codec)
455 snd_array_free(&spec->kctls); 459 snd_array_free(&spec->kctls);
456} 460}
457 461
462static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front,
463 hda_nid_t hp)
464{
465 struct ad198x_spec *spec = codec->spec;
466 snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE,
467 !spec->inv_eapd ? 0x00 : 0x02);
468 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE,
469 !spec->inv_eapd ? 0x00 : 0x02);
470}
471
472static void ad198x_power_eapd(struct hda_codec *codec)
473{
474 /* We currently only handle front, HP */
475 switch (codec->vendor_id) {
476 case 0x11d41882:
477 case 0x11d4882a:
478 case 0x11d41884:
479 case 0x11d41984:
480 case 0x11d41883:
481 case 0x11d4184a:
482 case 0x11d4194a:
483 case 0x11d4194b:
484 ad198x_power_eapd_write(codec, 0x12, 0x11);
485 break;
486 case 0x11d41981:
487 case 0x11d41983:
488 ad198x_power_eapd_write(codec, 0x05, 0x06);
489 break;
490 case 0x11d41986:
491 ad198x_power_eapd_write(codec, 0x1b, 0x1a);
492 break;
493 case 0x11d41988:
494 case 0x11d4198b:
495 case 0x11d4989a:
496 case 0x11d4989b:
497 ad198x_power_eapd_write(codec, 0x29, 0x22);
498 break;
499 }
500}
501
458static void ad198x_free(struct hda_codec *codec) 502static void ad198x_free(struct hda_codec *codec)
459{ 503{
460 struct ad198x_spec *spec = codec->spec; 504 struct ad198x_spec *spec = codec->spec;
@@ -462,11 +506,29 @@ static void ad198x_free(struct hda_codec *codec)
462 if (!spec) 506 if (!spec)
463 return; 507 return;
464 508
509 ad198x_shutup(codec);
465 ad198x_free_kctls(codec); 510 ad198x_free_kctls(codec);
466 kfree(spec); 511 kfree(spec);
467 snd_hda_detach_beep_device(codec); 512 snd_hda_detach_beep_device(codec);
468} 513}
469 514
515#ifdef SND_HDA_NEEDS_RESUME
516static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
517{
518 ad198x_shutup(codec);
519 ad198x_power_eapd(codec);
520 return 0;
521}
522
523static int ad198x_resume(struct hda_codec *codec)
524{
525 ad198x_init(codec);
526 snd_hda_codec_resume_amp(codec);
527 snd_hda_codec_resume_cache(codec);
528 return 0;
529}
530#endif
531
470static struct hda_codec_ops ad198x_patch_ops = { 532static struct hda_codec_ops ad198x_patch_ops = {
471 .build_controls = ad198x_build_controls, 533 .build_controls = ad198x_build_controls,
472 .build_pcms = ad198x_build_pcms, 534 .build_pcms = ad198x_build_pcms,
@@ -475,6 +537,11 @@ static struct hda_codec_ops ad198x_patch_ops = {
475#ifdef CONFIG_SND_HDA_POWER_SAVE 537#ifdef CONFIG_SND_HDA_POWER_SAVE
476 .check_power_status = ad198x_check_power_status, 538 .check_power_status = ad198x_check_power_status,
477#endif 539#endif
540#ifdef SND_HDA_NEEDS_RESUME
541 .suspend = ad198x_suspend,
542 .resume = ad198x_resume,
543#endif
544 .reboot_notify = ad198x_shutup,
478}; 545};
479 546
480 547
@@ -1813,6 +1880,14 @@ static int patch_ad1981(struct hda_codec *codec)
1813 1880
1814 codec->patch_ops.init = ad1981_hp_init; 1881 codec->patch_ops.init = ad1981_hp_init;
1815 codec->patch_ops.unsol_event = ad1981_hp_unsol_event; 1882 codec->patch_ops.unsol_event = ad1981_hp_unsol_event;
1883 /* set the upper-limit for mixer amp to 0dB for avoiding the
1884 * possible damage by overloading
1885 */
1886 snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT,
1887 (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
1888 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
1889 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
1890 (1 << AC_AMPCAP_MUTE_SHIFT));
1816 break; 1891 break;
1817 case AD1981_THINKPAD: 1892 case AD1981_THINKPAD:
1818 spec->mixers[0] = ad1981_thinkpad_mixers; 1893 spec->mixers[0] = ad1981_thinkpad_mixers;
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index eeb91f6a06c2..7de782a5b8f4 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};
@@ -752,6 +753,7 @@ static int build_input(struct hda_codec *codec)
752 spec->capture_bind[1] = make_bind_capture(codec, &snd_hda_bind_vol); 753 spec->capture_bind[1] = make_bind_capture(codec, &snd_hda_bind_vol);
753 for (i = 0; i < 2; i++) { 754 for (i = 0; i < 2; i++) {
754 struct snd_kcontrol *kctl; 755 struct snd_kcontrol *kctl;
756 int n;
755 if (!spec->capture_bind[i]) 757 if (!spec->capture_bind[i])
756 return -ENOMEM; 758 return -ENOMEM;
757 kctl = snd_ctl_new1(&cs_capture_ctls[i], codec); 759 kctl = snd_ctl_new1(&cs_capture_ctls[i], codec);
@@ -761,10 +763,13 @@ static int build_input(struct hda_codec *codec)
761 err = snd_hda_ctl_add(codec, 0, kctl); 763 err = snd_hda_ctl_add(codec, 0, kctl);
762 if (err < 0) 764 if (err < 0)
763 return err; 765 return err;
764 err = snd_hda_add_nids(codec, kctl, 0, spec->adc_nid, 766 for (n = 0; n < AUTO_PIN_LAST; n++) {
765 spec->num_inputs); 767 if (!spec->adc_nid[n])
766 if (err < 0) 768 continue;
767 return err; 769 err = snd_hda_add_nid(codec, kctl, 0, spec->adc_nid[i]);
770 if (err < 0)
771 return err;
772 }
768 } 773 }
769 774
770 if (spec->num_inputs > 1 && !spec->mic_detect) { 775 if (spec->num_inputs > 1 && !spec->mic_detect) {
@@ -833,7 +838,8 @@ static void cs_automute(struct hda_codec *codec)
833 AC_VERB_SET_PIN_WIDGET_CONTROL, 838 AC_VERB_SET_PIN_WIDGET_CONTROL,
834 hp_present ? 0 : PIN_OUT); 839 hp_present ? 0 : PIN_OUT);
835 } 840 }
836 if (spec->board_config == CS420X_MBP55) { 841 if (spec->board_config == CS420X_MBP55 ||
842 spec->board_config == CS420X_IMAC27) {
837 unsigned int gpio = hp_present ? 0x02 : 0x08; 843 unsigned int gpio = hp_present ? 0x02 : 0x08;
838 snd_hda_codec_write(codec, 0x01, 0, 844 snd_hda_codec_write(codec, 0x01, 0,
839 AC_VERB_SET_GPIO_DATA, gpio); 845 AC_VERB_SET_GPIO_DATA, gpio);
@@ -1075,12 +1081,14 @@ static int cs_parse_auto_config(struct hda_codec *codec)
1075 1081
1076static const char *cs420x_models[CS420X_MODELS] = { 1082static const char *cs420x_models[CS420X_MODELS] = {
1077 [CS420X_MBP55] = "mbp55", 1083 [CS420X_MBP55] = "mbp55",
1084 [CS420X_IMAC27] = "imac27",
1078 [CS420X_AUTO] = "auto", 1085 [CS420X_AUTO] = "auto",
1079}; 1086};
1080 1087
1081 1088
1082static struct snd_pci_quirk cs420x_cfg_tbl[] = { 1089static struct snd_pci_quirk cs420x_cfg_tbl[] = {
1083 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1090 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
1091 SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),
1084 {} /* terminator */ 1092 {} /* terminator */
1085}; 1093};
1086 1094
@@ -1103,8 +1111,23 @@ static struct cs_pincfg mbp55_pincfgs[] = {
1103 {} /* terminator */ 1111 {} /* terminator */
1104}; 1112};
1105 1113
1114static struct cs_pincfg imac27_pincfgs[] = {
1115 { 0x09, 0x012b4050 },
1116 { 0x0a, 0x90100140 },
1117 { 0x0b, 0x90100142 },
1118 { 0x0c, 0x018b3020 },
1119 { 0x0d, 0x90a00110 },
1120 { 0x0e, 0x400000f0 },
1121 { 0x0f, 0x01cbe030 },
1122 { 0x10, 0x014be060 },
1123 { 0x12, 0x01ab9070 },
1124 { 0x15, 0x400000f0 },
1125 {} /* terminator */
1126};
1127
1106static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { 1128static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
1107 [CS420X_MBP55] = mbp55_pincfgs, 1129 [CS420X_MBP55] = mbp55_pincfgs,
1130 [CS420X_IMAC27] = imac27_pincfgs,
1108}; 1131};
1109 1132
1110static void fix_pincfg(struct hda_codec *codec, int model) 1133static void fix_pincfg(struct hda_codec *codec, int model)
@@ -1134,6 +1157,7 @@ static int patch_cs420x(struct hda_codec *codec)
1134 fix_pincfg(codec, spec->board_config); 1157 fix_pincfg(codec, spec->board_config);
1135 1158
1136 switch (spec->board_config) { 1159 switch (spec->board_config) {
1160 case CS420X_IMAC27:
1137 case CS420X_MBP55: 1161 case CS420X_MBP55:
1138 /* GPIO1 = headphones */ 1162 /* GPIO1 = headphones */
1139 /* GPIO3 = speakers */ 1163 /* GPIO3 = speakers */
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index cc1c22370a60..ff60908f4554 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -345,8 +345,7 @@ static int cmi9880_build_controls(struct hda_codec *codec)
345 /* assign Capture Source enums to NID */ 345 /* assign Capture Source enums to NID */
346 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); 346 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
347 for (i = 0; kctl && i < kctl->count; i++) { 347 for (i = 0; kctl && i < kctl->count; i++) {
348 err = snd_hda_add_nids(codec, kctl, i, spec->adc_nids, 348 err = snd_hda_add_nid(codec, kctl, i, spec->adc_nids[i]);
349 spec->input_mux->num_items);
350 if (err < 0) 349 if (err < 0)
351 return err; 350 return err;
352 } 351 }
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index b20c640f7502..01e46ba72690 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
@@ -2159,9 +2162,12 @@ static int cxt5066_mic_boost_mux_enum_get(struct snd_kcontrol *kcontrol,
2159{ 2162{
2160 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2163 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2161 int val; 2164 int val;
2165 hda_nid_t nid = kcontrol->private_value & 0xff;
2166 int inout = (kcontrol->private_value & 0x100) ?
2167 AC_AMP_GET_INPUT : AC_AMP_GET_OUTPUT;
2162 2168
2163 val = snd_hda_codec_read(codec, 0x17, 0, 2169 val = snd_hda_codec_read(codec, nid, 0,
2164 AC_VERB_GET_AMP_GAIN_MUTE, AC_AMP_GET_OUTPUT); 2170 AC_VERB_GET_AMP_GAIN_MUTE, inout);
2165 2171
2166 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; 2172 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN;
2167 return 0; 2173 return 0;
@@ -2173,6 +2179,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2173 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2179 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2174 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; 2180 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost;
2175 unsigned int idx; 2181 unsigned int idx;
2182 hda_nid_t nid = kcontrol->private_value & 0xff;
2183 int inout = (kcontrol->private_value & 0x100) ?
2184 AC_AMP_SET_INPUT : AC_AMP_SET_OUTPUT;
2176 2185
2177 if (!imux->num_items) 2186 if (!imux->num_items)
2178 return 0; 2187 return 0;
@@ -2180,9 +2189,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2180 if (idx >= imux->num_items) 2189 if (idx >= imux->num_items)
2181 idx = imux->num_items - 1; 2190 idx = imux->num_items - 1;
2182 2191
2183 snd_hda_codec_write_cache(codec, 0x17, 0, 2192 snd_hda_codec_write_cache(codec, nid, 0,
2184 AC_VERB_SET_AMP_GAIN_MUTE, 2193 AC_VERB_SET_AMP_GAIN_MUTE,
2185 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | AC_AMP_SET_OUTPUT | 2194 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | inout |
2186 imux->items[idx].index); 2195 imux->items[idx].index);
2187 2196
2188 return 1; 2197 return 1;
@@ -2252,10 +2261,11 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2252 2261
2253 { 2262 {
2254 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2263 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2255 .name = "Analog Mic Boost Capture Enum", 2264 .name = "Ext Mic Boost Capture Enum",
2256 .info = cxt5066_mic_boost_mux_enum_info, 2265 .info = cxt5066_mic_boost_mux_enum_info,
2257 .get = cxt5066_mic_boost_mux_enum_get, 2266 .get = cxt5066_mic_boost_mux_enum_get,
2258 .put = cxt5066_mic_boost_mux_enum_put, 2267 .put = cxt5066_mic_boost_mux_enum_put,
2268 .private_value = 0x17,
2259 }, 2269 },
2260 2270
2261 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), 2271 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others),
@@ -2263,6 +2273,19 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2263 {} 2273 {}
2264}; 2274};
2265 2275
2276static struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2277 {
2278 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2279 .name = "Int Mic Boost Capture Enum",
2280 .info = cxt5066_mic_boost_mux_enum_info,
2281 .get = cxt5066_mic_boost_mux_enum_get,
2282 .put = cxt5066_mic_boost_mux_enum_put,
2283 .private_value = 0x23 | 0x100,
2284 },
2285 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT),
2286 {}
2287};
2288
2266static struct hda_verb cxt5066_init_verbs[] = { 2289static struct hda_verb cxt5066_init_verbs[] = {
2267 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ 2290 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */
2268 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ 2291 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */
@@ -2448,11 +2471,16 @@ static struct hda_verb cxt5066_init_verbs_portd_lo[] = {
2448/* initialize jack-sensing, too */ 2471/* initialize jack-sensing, too */
2449static int cxt5066_init(struct hda_codec *codec) 2472static int cxt5066_init(struct hda_codec *codec)
2450{ 2473{
2474 struct conexant_spec *spec = codec->spec;
2475
2451 snd_printdd("CXT5066: init\n"); 2476 snd_printdd("CXT5066: init\n");
2452 conexant_init(codec); 2477 conexant_init(codec);
2453 if (codec->patch_ops.unsol_event) { 2478 if (codec->patch_ops.unsol_event) {
2454 cxt5066_hp_automute(codec); 2479 cxt5066_hp_automute(codec);
2455 cxt5066_automic(codec); 2480 if (spec->dell_vostro)
2481 cxt5066_vostro_automic(codec);
2482 else
2483 cxt5066_automic(codec);
2456 } 2484 }
2457 return 0; 2485 return 0;
2458} 2486}
@@ -2551,7 +2579,10 @@ static int patch_cxt5066(struct hda_codec *codec)
2551 spec->init_verbs[0] = cxt5066_init_verbs_vostro; 2579 spec->init_verbs[0] = cxt5066_init_verbs_vostro;
2552 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; 2580 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc;
2553 spec->mixers[spec->num_mixers++] = cxt5066_mixers; 2581 spec->mixers[spec->num_mixers++] = cxt5066_mixers;
2582 spec->mixers[spec->num_mixers++] = cxt5066_vostro_mixers;
2554 spec->port_d_mode = 0; 2583 spec->port_d_mode = 0;
2584 spec->dell_vostro = 1;
2585 snd_hda_attach_beep_device(codec, 0x13);
2555 2586
2556 /* no S/PDIF out */ 2587 /* no S/PDIF out */
2557 spec->multiout.dig_out_nid = 0; 2588 spec->multiout.dig_out_nid = 0;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index cb7679551bdc..141ff446104a 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);
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);
389#endif 395#endif
390}; 396};
391 397
@@ -902,6 +908,7 @@ static void setup_preset(struct hda_codec *codec,
902 spec->unsol_event = preset->unsol_event; 908 spec->unsol_event = preset->unsol_event;
903 spec->init_hook = preset->init_hook; 909 spec->init_hook = preset->init_hook;
904#ifdef CONFIG_SND_HDA_POWER_SAVE 910#ifdef CONFIG_SND_HDA_POWER_SAVE
911 spec->power_hook = preset->power_hook;
905 spec->loopback.amplist = preset->loopbacks; 912 spec->loopback.amplist = preset->loopbacks;
906#endif 913#endif
907 914
@@ -1667,9 +1674,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1667/* some bit here disables the other DACs. Init=0x4900 */ 1674/* some bit here disables the other DACs. Init=0x4900 */
1668 {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, 1675 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1669 {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, 1676 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1670/* Enable amplifiers */
1671 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1672 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1673/* DMIC fix 1677/* DMIC fix
1674 * This laptop has a stereo digital microphone. The mics are only 1cm apart 1678 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1675 * which makes the stereo useless. However, either the mic or the ALC889 1679 * which makes the stereo useless. However, either the mic or the ALC889
@@ -1782,6 +1786,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
1782 { } /* end */ 1786 { } /* end */
1783}; 1787};
1784 1788
1789static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1790 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1791 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1794 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1795 HDA_OUTPUT),
1796 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1797 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1798 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1799 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1800 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1802 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1804 { } /* end */
1805};
1806
1807
1785static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) 1808static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1786{ 1809{
1787 struct alc_spec *spec = codec->spec; 1810 struct alc_spec *spec = codec->spec;
@@ -2515,8 +2538,10 @@ static int alc_build_controls(struct hda_codec *codec)
2515 if (!kctl) 2538 if (!kctl)
2516 kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); 2539 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2517 for (i = 0; kctl && i < kctl->count; i++) { 2540 for (i = 0; kctl && i < kctl->count; i++) {
2518 err = snd_hda_add_nids(codec, kctl, i, spec->capsrc_nids, 2541 hda_nid_t *nids = spec->capsrc_nids;
2519 spec->input_mux->num_items); 2542 if (!nids)
2543 nids = spec->adc_nids;
2544 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2520 if (err < 0) 2545 if (err < 0)
2521 return err; 2546 return err;
2522 } 2547 }
@@ -3658,6 +3683,11 @@ static int alc_build_pcms(struct hda_codec *codec)
3658 return 0; 3683 return 0;
3659} 3684}
3660 3685
3686static inline void alc_shutup(struct hda_codec *codec)
3687{
3688 snd_hda_shutup_pins(codec);
3689}
3690
3661static void alc_free_kctls(struct hda_codec *codec) 3691static void alc_free_kctls(struct hda_codec *codec)
3662{ 3692{
3663 struct alc_spec *spec = codec->spec; 3693 struct alc_spec *spec = codec->spec;
@@ -3678,11 +3708,51 @@ static void alc_free(struct hda_codec *codec)
3678 if (!spec) 3708 if (!spec)
3679 return; 3709 return;
3680 3710
3711 alc_shutup(codec);
3681 alc_free_kctls(codec); 3712 alc_free_kctls(codec);
3682 kfree(spec); 3713 kfree(spec);
3683 snd_hda_detach_beep_device(codec); 3714 snd_hda_detach_beep_device(codec);
3684} 3715}
3685 3716
3717#ifdef CONFIG_SND_HDA_POWER_SAVE
3718static void alc_power_eapd(struct hda_codec *codec)
3719{
3720 /* We currently only handle front, HP */
3721 switch (codec->vendor_id) {
3722 case 0x10ec0260:
3723 snd_hda_codec_write(codec, 0x0f, 0,
3724 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3725 snd_hda_codec_write(codec, 0x10, 0,
3726 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3727 break;
3728 case 0x10ec0262:
3729 case 0x10ec0267:
3730 case 0x10ec0268:
3731 case 0x10ec0269:
3732 case 0x10ec0272:
3733 case 0x10ec0660:
3734 case 0x10ec0662:
3735 case 0x10ec0663:
3736 case 0x10ec0862:
3737 case 0x10ec0889:
3738 snd_hda_codec_write(codec, 0x14, 0,
3739 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3740 snd_hda_codec_write(codec, 0x15, 0,
3741 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3742 break;
3743 }
3744}
3745
3746static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3747{
3748 struct alc_spec *spec = codec->spec;
3749 alc_shutup(codec);
3750 if (spec && spec->power_hook)
3751 spec->power_hook(codec);
3752 return 0;
3753}
3754#endif
3755
3686#ifdef SND_HDA_NEEDS_RESUME 3756#ifdef SND_HDA_NEEDS_RESUME
3687static int alc_resume(struct hda_codec *codec) 3757static int alc_resume(struct hda_codec *codec)
3688{ 3758{
@@ -3705,8 +3775,10 @@ static struct hda_codec_ops alc_patch_ops = {
3705 .resume = alc_resume, 3775 .resume = alc_resume,
3706#endif 3776#endif
3707#ifdef CONFIG_SND_HDA_POWER_SAVE 3777#ifdef CONFIG_SND_HDA_POWER_SAVE
3778 .suspend = alc_suspend,
3708 .check_power_status = alc_check_power_status, 3779 .check_power_status = alc_check_power_status,
3709#endif 3780#endif
3781 .reboot_notify = alc_shutup,
3710}; 3782};
3711 3783
3712 3784
@@ -6334,6 +6406,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = {
6334 6406
6335static struct snd_pci_quirk alc260_cfg_tbl[] = { 6407static struct snd_pci_quirk alc260_cfg_tbl[] = {
6336 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), 6408 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6409 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6337 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), 6410 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6338 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), 6411 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6339 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), 6412 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
@@ -9004,7 +9077,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
9004 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), 9077 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9005 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), 9078 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9006 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ 9079 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9007 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), 9080 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9008 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), 9081 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9009 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), 9082 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9010 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), 9083 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
@@ -9367,6 +9440,7 @@ static struct alc_config_preset alc882_presets[] = {
9367 .dac_nids = alc883_dac_nids, 9440 .dac_nids = alc883_dac_nids,
9368 .adc_nids = alc883_adc_nids_alt, 9441 .adc_nids = alc883_adc_nids_alt,
9369 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9442 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9443 .capsrc_nids = alc883_capsrc_nids,
9370 .dig_out_nid = ALC883_DIGOUT_NID, 9444 .dig_out_nid = ALC883_DIGOUT_NID,
9371 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9445 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9372 .channel_mode = alc883_3ST_2ch_modes, 9446 .channel_mode = alc883_3ST_2ch_modes,
@@ -9463,10 +9537,11 @@ static struct alc_config_preset alc882_presets[] = {
9463 .init_hook = alc_automute_amp, 9537 .init_hook = alc_automute_amp,
9464 }, 9538 },
9465 [ALC888_ACER_ASPIRE_8930G] = { 9539 [ALC888_ACER_ASPIRE_8930G] = {
9466 .mixers = { alc888_base_mixer, 9540 .mixers = { alc889_acer_aspire_8930g_mixer,
9467 alc883_chmode_mixer }, 9541 alc883_chmode_mixer },
9468 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 9542 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9469 alc889_acer_aspire_8930g_verbs }, 9543 alc889_acer_aspire_8930g_verbs,
9544 alc889_eapd_verbs},
9470 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9545 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9471 .dac_nids = alc883_dac_nids, 9546 .dac_nids = alc883_dac_nids,
9472 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), 9547 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
@@ -9483,6 +9558,9 @@ static struct alc_config_preset alc882_presets[] = {
9483 .unsol_event = alc_automute_amp_unsol_event, 9558 .unsol_event = alc_automute_amp_unsol_event,
9484 .setup = alc889_acer_aspire_8930g_setup, 9559 .setup = alc889_acer_aspire_8930g_setup,
9485 .init_hook = alc_automute_amp, 9560 .init_hook = alc_automute_amp,
9561#ifdef CONFIG_SND_HDA_POWER_SAVE
9562 .power_hook = alc_power_eapd,
9563#endif
9486 }, 9564 },
9487 [ALC888_ACER_ASPIRE_7730G] = { 9565 [ALC888_ACER_ASPIRE_7730G] = {
9488 .mixers = { alc883_3ST_6ch_mixer, 9566 .mixers = { alc883_3ST_6ch_mixer,
@@ -9513,6 +9591,7 @@ static struct alc_config_preset alc882_presets[] = {
9513 .dac_nids = alc883_dac_nids, 9591 .dac_nids = alc883_dac_nids,
9514 .adc_nids = alc883_adc_nids_alt, 9592 .adc_nids = alc883_adc_nids_alt,
9515 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9593 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9594 .capsrc_nids = alc883_capsrc_nids,
9516 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 9595 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9517 .channel_mode = alc883_sixstack_modes, 9596 .channel_mode = alc883_sixstack_modes,
9518 .input_mux = &alc883_capture_source, 9597 .input_mux = &alc883_capture_source,
@@ -9574,6 +9653,7 @@ static struct alc_config_preset alc882_presets[] = {
9574 .dac_nids = alc883_dac_nids, 9653 .dac_nids = alc883_dac_nids,
9575 .adc_nids = alc883_adc_nids_alt, 9654 .adc_nids = alc883_adc_nids_alt,
9576 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9655 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9656 .capsrc_nids = alc883_capsrc_nids,
9577 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9657 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9578 .channel_mode = alc883_3ST_2ch_modes, 9658 .channel_mode = alc883_3ST_2ch_modes,
9579 .input_mux = &alc883_lenovo_101e_capture_source, 9659 .input_mux = &alc883_lenovo_101e_capture_source,
@@ -9753,6 +9833,7 @@ static struct alc_config_preset alc882_presets[] = {
9753 alc880_gpio1_init_verbs }, 9833 alc880_gpio1_init_verbs },
9754 .adc_nids = alc883_adc_nids, 9834 .adc_nids = alc883_adc_nids,
9755 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 9835 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9836 .capsrc_nids = alc883_capsrc_nids,
9756 .dac_nids = alc883_dac_nids, 9837 .dac_nids = alc883_dac_nids,
9757 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9838 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9758 .channel_mode = alc889A_mb31_6ch_modes, 9839 .channel_mode = alc889A_mb31_6ch_modes,
@@ -10775,6 +10856,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10775 {} 10856 {}
10776}; 10857};
10777 10858
10859static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10860 /* Front Mic pin: input vref at 50% */
10861 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10862 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10863 {}
10864};
10865
10778static struct hda_input_mux alc262_fujitsu_capture_source = { 10866static struct hda_input_mux alc262_fujitsu_capture_source = {
10779 .num_items = 3, 10867 .num_items = 3,
10780 .items = { 10868 .items = {
@@ -11829,7 +11917,8 @@ static struct alc_config_preset alc262_presets[] = {
11829 [ALC262_LENOVO_3000] = { 11917 [ALC262_LENOVO_3000] = {
11830 .mixers = { alc262_lenovo_3000_mixer }, 11918 .mixers = { alc262_lenovo_3000_mixer },
11831 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, 11919 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11832 alc262_lenovo_3000_unsol_verbs }, 11920 alc262_lenovo_3000_unsol_verbs,
11921 alc262_lenovo_3000_init_verbs },
11833 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 11922 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11834 .dac_nids = alc262_dac_nids, 11923 .dac_nids = alc262_dac_nids,
11835 .hp_nid = 0x03, 11924 .hp_nid = 0x03,
@@ -12969,7 +13058,7 @@ static int patch_alc268(struct hda_codec *codec)
12969 int board_config; 13058 int board_config;
12970 int i, has_beep, err; 13059 int i, has_beep, err;
12971 13060
12972 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 13061 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12973 if (spec == NULL) 13062 if (spec == NULL)
12974 return -ENOMEM; 13063 return -ENOMEM;
12975 13064
@@ -13346,10 +13435,12 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13346/* toggle speaker-output according to the hp-jack state */ 13435/* toggle speaker-output according to the hp-jack state */
13347static void alc269_speaker_automute(struct hda_codec *codec) 13436static void alc269_speaker_automute(struct hda_codec *codec)
13348{ 13437{
13438 struct alc_spec *spec = codec->spec;
13439 unsigned int nid = spec->autocfg.hp_pins[0];
13349 unsigned int present; 13440 unsigned int present;
13350 unsigned char bits; 13441 unsigned char bits;
13351 13442
13352 present = snd_hda_jack_detect(codec, 0x15); 13443 present = snd_hda_jack_detect(codec, nid);
13353 bits = present ? AMP_IN_MUTE(0) : 0; 13444 bits = present ? AMP_IN_MUTE(0) : 0;
13354 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 13445 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13355 AMP_IN_MUTE(0), bits); 13446 AMP_IN_MUTE(0), bits);
@@ -13574,8 +13665,8 @@ static void alc269_auto_init(struct hda_codec *codec)
13574static const char *alc269_models[ALC269_MODEL_LAST] = { 13665static const char *alc269_models[ALC269_MODEL_LAST] = {
13575 [ALC269_BASIC] = "basic", 13666 [ALC269_BASIC] = "basic",
13576 [ALC269_QUANTA_FL1] = "quanta", 13667 [ALC269_QUANTA_FL1] = "quanta",
13577 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", 13668 [ALC269_ASUS_AMIC] = "asus-amic",
13578 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", 13669 [ALC269_ASUS_DMIC] = "asus-dmic",
13579 [ALC269_FUJITSU] = "fujitsu", 13670 [ALC269_FUJITSU] = "fujitsu",
13580 [ALC269_LIFEBOOK] = "lifebook", 13671 [ALC269_LIFEBOOK] = "lifebook",
13581 [ALC269_AUTO] = "auto", 13672 [ALC269_AUTO] = "auto",
@@ -13584,18 +13675,41 @@ static const char *alc269_models[ALC269_MODEL_LAST] = {
13584static struct snd_pci_quirk alc269_cfg_tbl[] = { 13675static struct snd_pci_quirk alc269_cfg_tbl[] = {
13585 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), 13676 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13586 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 13677 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13587 ALC269_ASUS_EEEPC_P703), 13678 ALC269_ASUS_AMIC),
13588 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), 13679 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13589 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), 13680 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13590 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), 13681 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13591 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), 13682 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13592 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), 13683 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13593 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), 13684 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13685 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13686 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13687 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13688 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13689 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13690 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13691 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13692 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13693 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13694 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13695 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13696 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13697 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13698 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13699 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13700 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13701 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13702 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13703 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13704 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13705 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13706 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13594 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", 13707 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13595 ALC269_ASUS_EEEPC_P901), 13708 ALC269_ASUS_DMIC),
13596 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", 13709 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13597 ALC269_ASUS_EEEPC_P901), 13710 ALC269_ASUS_DMIC),
13598 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), 13711 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13712 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13599 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), 13713 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13600 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), 13714 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13601 {} 13715 {}
@@ -13625,7 +13739,7 @@ static struct alc_config_preset alc269_presets[] = {
13625 .setup = alc269_quanta_fl1_setup, 13739 .setup = alc269_quanta_fl1_setup,
13626 .init_hook = alc269_quanta_fl1_init_hook, 13740 .init_hook = alc269_quanta_fl1_init_hook,
13627 }, 13741 },
13628 [ALC269_ASUS_EEEPC_P703] = { 13742 [ALC269_ASUS_AMIC] = {
13629 .mixers = { alc269_eeepc_mixer }, 13743 .mixers = { alc269_eeepc_mixer },
13630 .cap_mixer = alc269_epc_capture_mixer, 13744 .cap_mixer = alc269_epc_capture_mixer,
13631 .init_verbs = { alc269_init_verbs, 13745 .init_verbs = { alc269_init_verbs,
@@ -13639,7 +13753,7 @@ static struct alc_config_preset alc269_presets[] = {
13639 .setup = alc269_eeepc_amic_setup, 13753 .setup = alc269_eeepc_amic_setup,
13640 .init_hook = alc269_eeepc_inithook, 13754 .init_hook = alc269_eeepc_inithook,
13641 }, 13755 },
13642 [ALC269_ASUS_EEEPC_P901] = { 13756 [ALC269_ASUS_DMIC] = {
13643 .mixers = { alc269_eeepc_mixer }, 13757 .mixers = { alc269_eeepc_mixer },
13644 .cap_mixer = alc269_epc_capture_mixer, 13758 .cap_mixer = alc269_epc_capture_mixer,
13645 .init_verbs = { alc269_init_verbs, 13759 .init_verbs = { alc269_init_verbs,
@@ -14882,9 +14996,13 @@ static int patch_alc861(struct hda_codec *codec)
14882 spec->vmaster_nid = 0x03; 14996 spec->vmaster_nid = 0x03;
14883 14997
14884 codec->patch_ops = alc_patch_ops; 14998 codec->patch_ops = alc_patch_ops;
14885 if (board_config == ALC861_AUTO) 14999 if (board_config == ALC861_AUTO) {
14886 spec->init_hook = alc861_auto_init; 15000 spec->init_hook = alc861_auto_init;
14887#ifdef CONFIG_SND_HDA_POWER_SAVE 15001#ifdef CONFIG_SND_HDA_POWER_SAVE
15002 spec->power_hook = alc_power_eapd;
15003#endif
15004 }
15005#ifdef CONFIG_SND_HDA_POWER_SAVE
14888 if (!spec->loopback.amplist) 15006 if (!spec->loopback.amplist)
14889 spec->loopback.amplist = alc861_loopbacks; 15007 spec->loopback.amplist = alc861_loopbacks;
14890#endif 15008#endif
@@ -16274,6 +16392,52 @@ static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16274 { } /* end */ 16392 { } /* end */
16275}; 16393};
16276 16394
16395static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16396 .ops = &snd_hda_bind_sw,
16397 .values = {
16398 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16399 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16400 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16401 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16402 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16403 0
16404 },
16405};
16406
16407static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16408 .ops = &snd_hda_bind_sw,
16409 .values = {
16410 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16411 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16412 0
16413 },
16414};
16415
16416static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16417 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16418 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16419 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16420 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16421 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16422 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16423 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16425 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16426 { } /* end */
16427};
16428
16429static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16430 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16431 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16432 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16433 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16434 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16436 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16437 { } /* end */
16438};
16439
16440
16277static struct snd_kcontrol_new alc662_chmode_mixer[] = { 16441static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16278 { 16442 {
16279 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 16443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -16561,6 +16725,45 @@ static struct hda_verb alc272_dell_init_verbs[] = {
16561 {} 16725 {}
16562}; 16726};
16563 16727
16728static struct hda_verb alc663_mode7_init_verbs[] = {
16729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16730 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16731 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16732 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16733 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16734 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16735 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16736 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16737 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16738 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16741 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16742 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16743 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16744 {}
16745};
16746
16747static struct hda_verb alc663_mode8_init_verbs[] = {
16748 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16752 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16753 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16754 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16756 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16757 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16758 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16761 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16762 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16763 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16764 {}
16765};
16766
16564static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { 16767static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16565 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 16768 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16566 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), 16769 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
@@ -16740,6 +16943,54 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16740 } 16943 }
16741} 16944}
16742 16945
16946static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16947{
16948 unsigned int present1, present2;
16949
16950 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16951 AC_VERB_GET_PIN_SENSE, 0)
16952 & AC_PINSENSE_PRESENCE;
16953 present2 = snd_hda_codec_read(codec, 0x21, 0,
16954 AC_VERB_GET_PIN_SENSE, 0)
16955 & AC_PINSENSE_PRESENCE;
16956
16957 if (present1 || present2) {
16958 snd_hda_codec_write_cache(codec, 0x14, 0,
16959 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16960 snd_hda_codec_write_cache(codec, 0x17, 0,
16961 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16962 } else {
16963 snd_hda_codec_write_cache(codec, 0x14, 0,
16964 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16965 snd_hda_codec_write_cache(codec, 0x17, 0,
16966 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16967 }
16968}
16969
16970static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16971{
16972 unsigned int present1, present2;
16973
16974 present1 = snd_hda_codec_read(codec, 0x21, 0,
16975 AC_VERB_GET_PIN_SENSE, 0)
16976 & AC_PINSENSE_PRESENCE;
16977 present2 = snd_hda_codec_read(codec, 0x15, 0,
16978 AC_VERB_GET_PIN_SENSE, 0)
16979 & AC_PINSENSE_PRESENCE;
16980
16981 if (present1 || present2) {
16982 snd_hda_codec_write_cache(codec, 0x14, 0,
16983 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16984 snd_hda_codec_write_cache(codec, 0x17, 0,
16985 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16986 } else {
16987 snd_hda_codec_write_cache(codec, 0x14, 0,
16988 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16989 snd_hda_codec_write_cache(codec, 0x17, 0,
16990 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16991 }
16992}
16993
16743static void alc663_m51va_unsol_event(struct hda_codec *codec, 16994static void alc663_m51va_unsol_event(struct hda_codec *codec,
16744 unsigned int res) 16995 unsigned int res)
16745{ 16996{
@@ -16759,7 +17010,7 @@ static void alc663_m51va_setup(struct hda_codec *codec)
16759 spec->ext_mic.pin = 0x18; 17010 spec->ext_mic.pin = 0x18;
16760 spec->ext_mic.mux_idx = 0; 17011 spec->ext_mic.mux_idx = 0;
16761 spec->int_mic.pin = 0x12; 17012 spec->int_mic.pin = 0x12;
16762 spec->int_mic.mux_idx = 1; 17013 spec->int_mic.mux_idx = 9;
16763 spec->auto_mic = 1; 17014 spec->auto_mic = 1;
16764} 17015}
16765 17016
@@ -16771,7 +17022,17 @@ static void alc663_m51va_inithook(struct hda_codec *codec)
16771 17022
16772/* ***************** Mode1 ******************************/ 17023/* ***************** Mode1 ******************************/
16773#define alc663_mode1_unsol_event alc663_m51va_unsol_event 17024#define alc663_mode1_unsol_event alc663_m51va_unsol_event
16774#define alc663_mode1_setup alc663_m51va_setup 17025
17026static void alc663_mode1_setup(struct hda_codec *codec)
17027{
17028 struct alc_spec *spec = codec->spec;
17029 spec->ext_mic.pin = 0x18;
17030 spec->ext_mic.mux_idx = 0;
17031 spec->int_mic.pin = 0x19;
17032 spec->int_mic.mux_idx = 1;
17033 spec->auto_mic = 1;
17034}
17035
16775#define alc663_mode1_inithook alc663_m51va_inithook 17036#define alc663_mode1_inithook alc663_m51va_inithook
16776 17037
16777/* ***************** Mode2 ******************************/ 17038/* ***************** Mode2 ******************************/
@@ -16788,7 +17049,7 @@ static void alc662_mode2_unsol_event(struct hda_codec *codec,
16788 } 17049 }
16789} 17050}
16790 17051
16791#define alc662_mode2_setup alc663_m51va_setup 17052#define alc662_mode2_setup alc663_mode1_setup
16792 17053
16793static void alc662_mode2_inithook(struct hda_codec *codec) 17054static void alc662_mode2_inithook(struct hda_codec *codec)
16794{ 17055{
@@ -16809,7 +17070,7 @@ static void alc663_mode3_unsol_event(struct hda_codec *codec,
16809 } 17070 }
16810} 17071}
16811 17072
16812#define alc663_mode3_setup alc663_m51va_setup 17073#define alc663_mode3_setup alc663_mode1_setup
16813 17074
16814static void alc663_mode3_inithook(struct hda_codec *codec) 17075static void alc663_mode3_inithook(struct hda_codec *codec)
16815{ 17076{
@@ -16830,7 +17091,7 @@ static void alc663_mode4_unsol_event(struct hda_codec *codec,
16830 } 17091 }
16831} 17092}
16832 17093
16833#define alc663_mode4_setup alc663_m51va_setup 17094#define alc663_mode4_setup alc663_mode1_setup
16834 17095
16835static void alc663_mode4_inithook(struct hda_codec *codec) 17096static void alc663_mode4_inithook(struct hda_codec *codec)
16836{ 17097{
@@ -16851,7 +17112,7 @@ static void alc663_mode5_unsol_event(struct hda_codec *codec,
16851 } 17112 }
16852} 17113}
16853 17114
16854#define alc663_mode5_setup alc663_m51va_setup 17115#define alc663_mode5_setup alc663_mode1_setup
16855 17116
16856static void alc663_mode5_inithook(struct hda_codec *codec) 17117static void alc663_mode5_inithook(struct hda_codec *codec)
16857{ 17118{
@@ -16872,7 +17133,7 @@ static void alc663_mode6_unsol_event(struct hda_codec *codec,
16872 } 17133 }
16873} 17134}
16874 17135
16875#define alc663_mode6_setup alc663_m51va_setup 17136#define alc663_mode6_setup alc663_mode1_setup
16876 17137
16877static void alc663_mode6_inithook(struct hda_codec *codec) 17138static void alc663_mode6_inithook(struct hda_codec *codec)
16878{ 17139{
@@ -16880,6 +17141,50 @@ static void alc663_mode6_inithook(struct hda_codec *codec)
16880 alc_mic_automute(codec); 17141 alc_mic_automute(codec);
16881} 17142}
16882 17143
17144/* ***************** Mode7 ******************************/
17145static void alc663_mode7_unsol_event(struct hda_codec *codec,
17146 unsigned int res)
17147{
17148 switch (res >> 26) {
17149 case ALC880_HP_EVENT:
17150 alc663_two_hp_m7_speaker_automute(codec);
17151 break;
17152 case ALC880_MIC_EVENT:
17153 alc_mic_automute(codec);
17154 break;
17155 }
17156}
17157
17158#define alc663_mode7_setup alc663_mode1_setup
17159
17160static void alc663_mode7_inithook(struct hda_codec *codec)
17161{
17162 alc663_two_hp_m7_speaker_automute(codec);
17163 alc_mic_automute(codec);
17164}
17165
17166/* ***************** Mode8 ******************************/
17167static void alc663_mode8_unsol_event(struct hda_codec *codec,
17168 unsigned int res)
17169{
17170 switch (res >> 26) {
17171 case ALC880_HP_EVENT:
17172 alc663_two_hp_m8_speaker_automute(codec);
17173 break;
17174 case ALC880_MIC_EVENT:
17175 alc_mic_automute(codec);
17176 break;
17177 }
17178}
17179
17180#define alc663_mode8_setup alc663_m51va_setup
17181
17182static void alc663_mode8_inithook(struct hda_codec *codec)
17183{
17184 alc663_two_hp_m8_speaker_automute(codec);
17185 alc_mic_automute(codec);
17186}
17187
16883static void alc663_g71v_hp_automute(struct hda_codec *codec) 17188static void alc663_g71v_hp_automute(struct hda_codec *codec)
16884{ 17189{
16885 unsigned int present; 17190 unsigned int present;
@@ -17014,6 +17319,8 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
17014 [ALC663_ASUS_MODE4] = "asus-mode4", 17319 [ALC663_ASUS_MODE4] = "asus-mode4",
17015 [ALC663_ASUS_MODE5] = "asus-mode5", 17320 [ALC663_ASUS_MODE5] = "asus-mode5",
17016 [ALC663_ASUS_MODE6] = "asus-mode6", 17321 [ALC663_ASUS_MODE6] = "asus-mode6",
17322 [ALC663_ASUS_MODE7] = "asus-mode7",
17323 [ALC663_ASUS_MODE8] = "asus-mode8",
17017 [ALC272_DELL] = "dell", 17324 [ALC272_DELL] = "dell",
17018 [ALC272_DELL_ZM1] = "dell-zm1", 17325 [ALC272_DELL_ZM1] = "dell-zm1",
17019 [ALC272_SAMSUNG_NC10] = "samsung-nc10", 17326 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
@@ -17030,12 +17337,22 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
17030 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), 17337 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17031 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), 17338 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17032 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), 17339 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17340 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17341 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17033 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), 17342 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17343 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17344 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17345 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17346 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17347 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17034 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), 17348 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17349 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17350 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17035 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), 17351 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17036 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), 17352 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17037 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), 17353 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17038 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), 17354 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17355 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17039 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), 17356 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17040 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), 17357 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17041 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), 17358 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
@@ -17319,6 +17636,36 @@ static struct alc_config_preset alc662_presets[] = {
17319 .setup = alc663_mode6_setup, 17636 .setup = alc663_mode6_setup,
17320 .init_hook = alc663_mode6_inithook, 17637 .init_hook = alc663_mode6_inithook,
17321 }, 17638 },
17639 [ALC663_ASUS_MODE7] = {
17640 .mixers = { alc663_mode7_mixer },
17641 .cap_mixer = alc662_auto_capture_mixer,
17642 .init_verbs = { alc662_init_verbs,
17643 alc663_mode7_init_verbs },
17644 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17645 .hp_nid = 0x03,
17646 .dac_nids = alc662_dac_nids,
17647 .dig_out_nid = ALC662_DIGOUT_NID,
17648 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17649 .channel_mode = alc662_3ST_2ch_modes,
17650 .unsol_event = alc663_mode7_unsol_event,
17651 .setup = alc663_mode7_setup,
17652 .init_hook = alc663_mode7_inithook,
17653 },
17654 [ALC663_ASUS_MODE8] = {
17655 .mixers = { alc663_mode8_mixer },
17656 .cap_mixer = alc662_auto_capture_mixer,
17657 .init_verbs = { alc662_init_verbs,
17658 alc663_mode8_init_verbs },
17659 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17660 .hp_nid = 0x03,
17661 .dac_nids = alc662_dac_nids,
17662 .dig_out_nid = ALC662_DIGOUT_NID,
17663 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17664 .channel_mode = alc662_3ST_2ch_modes,
17665 .unsol_event = alc663_mode8_unsol_event,
17666 .setup = alc663_mode8_setup,
17667 .init_hook = alc663_mode8_inithook,
17668 },
17322 [ALC272_DELL] = { 17669 [ALC272_DELL] = {
17323 .mixers = { alc663_m51va_mixer }, 17670 .mixers = { alc663_m51va_mixer },
17324 .cap_mixer = alc272_auto_capture_mixer, 17671 .cap_mixer = alc272_auto_capture_mixer,
@@ -17802,7 +18149,9 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
17802 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, 18149 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17803 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, 18150 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17804 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, 18151 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18152 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
17805 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, 18153 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18154 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
17806 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 18155 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17807 .patch = patch_alc861 }, 18156 .patch = patch_alc861 },
17808 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, 18157 { .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 0bafea9d5106..e28c810bc00c 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),
@@ -3778,15 +3781,16 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3778 err = snd_hda_attach_beep_device(codec, nid); 3781 err = snd_hda_attach_beep_device(codec, nid);
3779 if (err < 0) 3782 if (err < 0)
3780 return err; 3783 return err;
3781 /* IDT/STAC codecs have linear beep tone parameter */ 3784 if (codec->beep) {
3782 codec->beep->linear_tone = 1; 3785 /* IDT/STAC codecs have linear beep tone parameter */
3783 /* if no beep switch is available, make its own one */ 3786 codec->beep->linear_tone = 1;
3784 caps = query_amp_caps(codec, nid, HDA_OUTPUT); 3787 /* if no beep switch is available, make its own one */
3785 if (codec->beep && 3788 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3786 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { 3789 if (!(caps & AC_AMPCAP_MUTE)) {
3787 err = stac92xx_beep_switch_ctl(codec); 3790 err = stac92xx_beep_switch_ctl(codec);
3788 if (err < 0) 3791 if (err < 0)
3789 return err; 3792 return err;
3793 }
3790 } 3794 }
3791 } 3795 }
3792#endif 3796#endif
@@ -4155,34 +4159,52 @@ static void stac92xx_power_down(struct hda_codec *codec)
4155static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, 4159static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
4156 int enable); 4160 int enable);
4157 4161
4162static inline int get_int_hint(struct hda_codec *codec, const char *key,
4163 int *valp)
4164{
4165 const char *p;
4166 p = snd_hda_get_hint(codec, key);
4167 if (p) {
4168 unsigned long val;
4169 if (!strict_strtoul(p, 0, &val)) {
4170 *valp = val;
4171 return 1;
4172 }
4173 }
4174 return 0;
4175}
4176
4158/* override some hints from the hwdep entry */ 4177/* override some hints from the hwdep entry */
4159static void stac_store_hints(struct hda_codec *codec) 4178static void stac_store_hints(struct hda_codec *codec)
4160{ 4179{
4161 struct sigmatel_spec *spec = codec->spec; 4180 struct sigmatel_spec *spec = codec->spec;
4162 const char *p;
4163 int val; 4181 int val;
4164 4182
4165 val = snd_hda_get_bool_hint(codec, "hp_detect"); 4183 val = snd_hda_get_bool_hint(codec, "hp_detect");
4166 if (val >= 0) 4184 if (val >= 0)
4167 spec->hp_detect = val; 4185 spec->hp_detect = val;
4168 p = snd_hda_get_hint(codec, "gpio_mask"); 4186 if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
4169 if (p) {
4170 spec->gpio_mask = simple_strtoul(p, NULL, 0);
4171 spec->eapd_mask = spec->gpio_dir = spec->gpio_data = 4187 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
4172 spec->gpio_mask; 4188 spec->gpio_mask;
4173 } 4189 }
4174 p = snd_hda_get_hint(codec, "gpio_dir"); 4190 if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
4175 if (p) 4191 spec->gpio_mask &= spec->gpio_mask;
4176 spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask; 4192 if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
4177 p = snd_hda_get_hint(codec, "gpio_data"); 4193 spec->gpio_dir &= spec->gpio_mask;
4178 if (p) 4194 if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
4179 spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask; 4195 spec->eapd_mask &= spec->gpio_mask;
4180 p = snd_hda_get_hint(codec, "eapd_mask"); 4196 if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
4181 if (p) 4197 spec->gpio_mute &= spec->gpio_mask;
4182 spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
4183 val = snd_hda_get_bool_hint(codec, "eapd_switch"); 4198 val = snd_hda_get_bool_hint(codec, "eapd_switch");
4184 if (val >= 0) 4199 if (val >= 0)
4185 spec->eapd_switch = val; 4200 spec->eapd_switch = val;
4201 get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity);
4202 if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
4203 spec->gpio_mask |= spec->gpio_led;
4204 spec->gpio_dir |= spec->gpio_led;
4205 if (spec->gpio_led_polarity)
4206 spec->gpio_data |= spec->gpio_led;
4207 }
4186} 4208}
4187 4209
4188static int stac92xx_init(struct hda_codec *codec) 4210static int stac92xx_init(struct hda_codec *codec)
@@ -4367,18 +4389,8 @@ static void stac92xx_free_kctls(struct hda_codec *codec)
4367static void stac92xx_shutup(struct hda_codec *codec) 4389static void stac92xx_shutup(struct hda_codec *codec)
4368{ 4390{
4369 struct sigmatel_spec *spec = codec->spec; 4391 struct sigmatel_spec *spec = codec->spec;
4370 int i;
4371 hda_nid_t nid;
4372 4392
4373 /* reset each pin before powering down DAC/ADC to avoid click noise */ 4393 snd_hda_shutup_pins(codec);
4374 nid = codec->start_nid;
4375 for (i = 0; i < codec->num_nodes; i++, nid++) {
4376 unsigned int wcaps = get_wcaps(codec, nid);
4377 unsigned int wid_type = get_wcaps_type(wcaps);
4378 if (wid_type == AC_WID_PIN)
4379 snd_hda_codec_read(codec, nid, 0,
4380 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
4381 }
4382 4394
4383 if (spec->eapd_mask) 4395 if (spec->eapd_mask)
4384 stac_gpio_set(codec, spec->gpio_mask, 4396 stac_gpio_set(codec, spec->gpio_mask,
@@ -5402,6 +5414,54 @@ static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec,
5402 return 0; 5414 return 0;
5403} 5415}
5404 5416
5417/* HP dv7 bass switch - GPIO5 */
5418#define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
5419static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
5420 struct snd_ctl_elem_value *ucontrol)
5421{
5422 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5423 struct sigmatel_spec *spec = codec->spec;
5424 ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
5425 return 0;
5426}
5427
5428static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
5429 struct snd_ctl_elem_value *ucontrol)
5430{
5431 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5432 struct sigmatel_spec *spec = codec->spec;
5433 unsigned int gpio_data;
5434
5435 gpio_data = (spec->gpio_data & ~0x20) |
5436 (ucontrol->value.integer.value[0] ? 0x20 : 0);
5437 if (gpio_data == spec->gpio_data)
5438 return 0;
5439 spec->gpio_data = gpio_data;
5440 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
5441 return 1;
5442}
5443
5444static struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
5445 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5446 .info = stac_hp_bass_gpio_info,
5447 .get = stac_hp_bass_gpio_get,
5448 .put = stac_hp_bass_gpio_put,
5449};
5450
5451static int stac_add_hp_bass_switch(struct hda_codec *codec)
5452{
5453 struct sigmatel_spec *spec = codec->spec;
5454
5455 if (!stac_control_new(spec, &stac_hp_bass_sw_ctrl,
5456 "Bass Speaker Playback Switch", 0))
5457 return -ENOMEM;
5458
5459 spec->gpio_mask |= 0x20;
5460 spec->gpio_dir |= 0x20;
5461 spec->gpio_data |= 0x20;
5462 return 0;
5463}
5464
5405static int patch_stac92hd71bxx(struct hda_codec *codec) 5465static int patch_stac92hd71bxx(struct hda_codec *codec)
5406{ 5466{
5407 struct sigmatel_spec *spec; 5467 struct sigmatel_spec *spec;
@@ -5642,6 +5702,15 @@ again:
5642 return err; 5702 return err;
5643 } 5703 }
5644 5704
5705 /* enable bass on HP dv7 */
5706 if (spec->board_config == STAC_HP_DV5) {
5707 unsigned int cap;
5708 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
5709 cap &= AC_GPIO_IO_COUNT;
5710 if (cap >= 6)
5711 stac_add_hp_bass_switch(codec);
5712 }
5713
5645 codec->proc_widget_hook = stac92hd7x_proc_hook; 5714 codec->proc_widget_hook = stac92hd7x_proc_hook;
5646 5715
5647 return 0; 5716 return 0;
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index de4839e46762..9ddc37300f6b 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -1907,8 +1907,7 @@ static int via_build_controls(struct hda_codec *codec)
1907 /* assign Capture Source enums to NID */ 1907 /* assign Capture Source enums to NID */
1908 kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); 1908 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
1909 for (i = 0; kctl && i < kctl->count; i++) { 1909 for (i = 0; kctl && i < kctl->count; i++) {
1910 err = snd_hda_add_nids(codec, kctl, i, spec->mux_nids, 1910 err = snd_hda_add_nid(codec, kctl, i, spec->mux_nids[i]);
1911 spec->input_mux->num_items);
1912 if (err < 0) 1911 if (err < 0)
1913 return err; 1912 return err;
1914 } 1913 }
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/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/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/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/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.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;