diff options
Diffstat (limited to 'sound')
100 files changed, 1563 insertions, 811 deletions
diff --git a/sound/Kconfig b/sound/Kconfig index b3e53e616ec9..fcad760f5691 100644 --- a/sound/Kconfig +++ b/sound/Kconfig | |||
@@ -1,6 +1,3 @@ | |||
1 | # sound/Config.in | ||
2 | # | ||
3 | |||
4 | menuconfig SOUND | 1 | menuconfig SOUND |
5 | tristate "Sound card support" | 2 | tristate "Sound card support" |
6 | depends on HAS_IOMEM | 3 | depends on HAS_IOMEM |
@@ -136,4 +133,3 @@ config AC97_BUS | |||
136 | sound subsystem and other function drivers completely unrelated to | 133 | sound subsystem and other function drivers completely unrelated to |
137 | sound although they're sharing the AC97 bus. Concerned drivers | 134 | sound although they're sharing the AC97 bus. Concerned drivers |
138 | should "select" this. | 135 | should "select" this. |
139 | |||
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c index 586965f9605f..7a437da05646 100644 --- a/sound/aoa/fabrics/layout.c +++ b/sound/aoa/fabrics/layout.c | |||
@@ -768,7 +768,7 @@ static int check_codec(struct aoa_codec *codec, | |||
768 | "required property %s not present\n", propname); | 768 | "required property %s not present\n", propname); |
769 | return -ENODEV; | 769 | return -ENODEV; |
770 | } | 770 | } |
771 | if (*ref != codec->node->linux_phandle) { | 771 | if (*ref != codec->node->phandle) { |
772 | printk(KERN_INFO "snd-aoa-fabric-layout: " | 772 | printk(KERN_INFO "snd-aoa-fabric-layout: " |
773 | "%s doesn't match!\n", propname); | 773 | "%s doesn't match!\n", propname); |
774 | return -ENODEV; | 774 | return -ENODEV; |
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 1497dce1b04a..656e474dca47 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -172,14 +172,15 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | |||
172 | return v; | 172 | return v; |
173 | } | 173 | } |
174 | 174 | ||
175 | static inline void aaci_chan_wait_ready(struct aaci_runtime *aacirun) | 175 | static inline void |
176 | aaci_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 | |||
334 | struct aaci_stream { | ||
335 | unsigned char codec_idx; | ||
336 | unsigned char rate_idx; | ||
337 | }; | ||
338 | |||
339 | static 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 | |||
354 | static 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 | |||
360 | static 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 | */ | ||
369 | static int | ||
370 | aaci_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 | |||
390 | static struct snd_pcm_hardware aaci_hw_info = { | 341 | static struct snd_pcm_hardware aaci_hw_info = { |
391 | .info = SNDRV_PCM_INFO_MMAP | | 342 | .info = SNDRV_PCM_INFO_MMAP | |
392 | SNDRV_PCM_INFO_MMAP_VALID | | 343 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -400,10 +351,7 @@ static struct snd_pcm_hardware aaci_hw_info = { | |||
400 | */ | 351 | */ |
401 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 352 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
402 | 353 | ||
403 | /* should this be continuous or knot? */ | 354 | /* rates are setup from the AC'97 codec */ |
404 | .rates = SNDRV_PCM_RATE_CONTINUOUS, | ||
405 | .rate_max = 48000, | ||
406 | .rate_min = 4000, | ||
407 | .channels_min = 2, | 355 | .channels_min = 2, |
408 | .channels_max = 6, | 356 | .channels_max = 6, |
409 | .buffer_bytes_max = 64 * 1024, | 357 | .buffer_bytes_max = 64 * 1024, |
@@ -423,6 +371,12 @@ static int __aaci_pcm_open(struct aaci *aaci, | |||
423 | aacirun->substream = substream; | 371 | aacirun->substream = substream; |
424 | runtime->private_data = aacirun; | 372 | runtime->private_data = aacirun; |
425 | runtime->hw = aaci_hw_info; | 373 | runtime->hw = aaci_hw_info; |
374 | runtime->hw.rates = aacirun->pcm->rates; | ||
375 | snd_pcm_limit_hw_rates(runtime); | ||
376 | |||
377 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | ||
378 | aacirun->pcm->r[1].slots) | ||
379 | snd_ac97_pcm_double_rate_rules(runtime); | ||
426 | 380 | ||
427 | /* | 381 | /* |
428 | * FIXME: ALSA specifies fifo_size in bytes. If we're in normal | 382 | * FIXME: ALSA specifies fifo_size in bytes. If we're in normal |
@@ -433,17 +387,6 @@ static int __aaci_pcm_open(struct aaci *aaci, | |||
433 | */ | 387 | */ |
434 | runtime->hw.fifo_size = aaci->fifosize * 2; | 388 | runtime->hw.fifo_size = aaci->fifosize * 2; |
435 | 389 | ||
436 | /* | ||
437 | * Add rule describing hardware rate dependency | ||
438 | * on the number of channels. | ||
439 | */ | ||
440 | ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, | ||
441 | aaci_rule_rate_by_channels, aaci, | ||
442 | SNDRV_PCM_HW_PARAM_CHANNELS, | ||
443 | SNDRV_PCM_HW_PARAM_RATE, -1); | ||
444 | if (ret) | ||
445 | goto out; | ||
446 | |||
447 | ret = request_irq(aaci->dev->irq[0], aaci_irq, IRQF_SHARED|IRQF_DISABLED, | 390 | ret = request_irq(aaci->dev->irq[0], aaci_irq, IRQF_SHARED|IRQF_DISABLED, |
448 | DRIVER_NAME, aaci); | 391 | DRIVER_NAME, aaci); |
449 | if (ret) | 392 | if (ret) |
@@ -498,6 +441,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, | |||
498 | struct snd_pcm_hw_params *params) | 441 | struct snd_pcm_hw_params *params) |
499 | { | 442 | { |
500 | int err; | 443 | int err; |
444 | struct aaci *aaci = substream->private_data; | ||
501 | 445 | ||
502 | aaci_pcm_hw_free(substream); | 446 | aaci_pcm_hw_free(substream); |
503 | if (aacirun->pcm_open) { | 447 | if (aacirun->pcm_open) { |
@@ -507,18 +451,22 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, | |||
507 | 451 | ||
508 | err = snd_pcm_lib_malloc_pages(substream, | 452 | err = snd_pcm_lib_malloc_pages(substream, |
509 | params_buffer_bytes(params)); | 453 | params_buffer_bytes(params)); |
510 | if (err < 0) | 454 | if (err >= 0) { |
511 | goto out; | 455 | unsigned int rate = params_rate(params); |
456 | int dbl = rate > 48000; | ||
512 | 457 | ||
513 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), | 458 | err = snd_ac97_pcm_open(aacirun->pcm, rate, |
514 | params_channels(params), | 459 | params_channels(params), |
515 | aacirun->pcm->r[0].slots); | 460 | aacirun->pcm->r[dbl].slots); |
516 | if (err) | ||
517 | goto out; | ||
518 | 461 | ||
519 | aacirun->pcm_open = 1; | 462 | aacirun->pcm_open = err == 0; |
463 | aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16; | ||
464 | aacirun->fifosz = aaci->fifosize * 4; | ||
465 | |||
466 | if (aacirun->cr & CR_COMPACT) | ||
467 | aacirun->fifosz >>= 1; | ||
468 | } | ||
520 | 469 | ||
521 | out: | ||
522 | return err; | 470 | return err; |
523 | } | 471 | } |
524 | 472 | ||
@@ -527,7 +475,7 @@ static int aaci_pcm_prepare(struct snd_pcm_substream *substream) | |||
527 | struct snd_pcm_runtime *runtime = substream->runtime; | 475 | struct snd_pcm_runtime *runtime = substream->runtime; |
528 | struct aaci_runtime *aacirun = runtime->private_data; | 476 | struct aaci_runtime *aacirun = runtime->private_data; |
529 | 477 | ||
530 | aacirun->start = (void *)runtime->dma_area; | 478 | aacirun->start = runtime->dma_area; |
531 | aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream); | 479 | aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream); |
532 | aacirun->ptr = aacirun->start; | 480 | aacirun->ptr = aacirun->start; |
533 | aacirun->period = | 481 | aacirun->period = |
@@ -613,7 +561,6 @@ static int aaci_pcm_open(struct snd_pcm_substream *substream) | |||
613 | static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, | 561 | static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, |
614 | struct snd_pcm_hw_params *params) | 562 | struct snd_pcm_hw_params *params) |
615 | { | 563 | { |
616 | struct aaci *aaci = substream->private_data; | ||
617 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 564 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
618 | unsigned int channels = params_channels(params); | 565 | unsigned int channels = params_channels(params); |
619 | int ret; | 566 | int ret; |
@@ -627,14 +574,9 @@ static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, | |||
627 | * Enable FIFO, compact mode, 16 bits per sample. | 574 | * Enable FIFO, compact mode, 16 bits per sample. |
628 | * FIXME: double rate slots? | 575 | * FIXME: double rate slots? |
629 | */ | 576 | */ |
630 | if (ret >= 0) { | 577 | if (ret >= 0) |
631 | aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16; | ||
632 | aacirun->cr |= channels_to_txmask[channels]; | 578 | aacirun->cr |= channels_to_txmask[channels]; |
633 | 579 | ||
634 | aacirun->fifosz = aaci->fifosize * 4; | ||
635 | if (aacirun->cr & CR_COMPACT) | ||
636 | aacirun->fifosz >>= 1; | ||
637 | } | ||
638 | return ret; | 580 | return ret; |
639 | } | 581 | } |
640 | 582 | ||
@@ -646,7 +588,7 @@ static void aaci_pcm_playback_stop(struct aaci_runtime *aacirun) | |||
646 | ie &= ~(IE_URIE|IE_TXIE); | 588 | ie &= ~(IE_URIE|IE_TXIE); |
647 | writel(ie, aacirun->base + AACI_IE); | 589 | writel(ie, aacirun->base + AACI_IE); |
648 | aacirun->cr &= ~CR_EN; | 590 | aacirun->cr &= ~CR_EN; |
649 | aaci_chan_wait_ready(aacirun); | 591 | aaci_chan_wait_ready(aacirun, SR_TXB); |
650 | writel(aacirun->cr, aacirun->base + AACI_TXCR); | 592 | writel(aacirun->cr, aacirun->base + AACI_TXCR); |
651 | } | 593 | } |
652 | 594 | ||
@@ -654,7 +596,7 @@ static void aaci_pcm_playback_start(struct aaci_runtime *aacirun) | |||
654 | { | 596 | { |
655 | u32 ie; | 597 | u32 ie; |
656 | 598 | ||
657 | aaci_chan_wait_ready(aacirun); | 599 | aaci_chan_wait_ready(aacirun, SR_TXB); |
658 | aacirun->cr |= CR_EN; | 600 | aacirun->cr |= CR_EN; |
659 | 601 | ||
660 | ie = readl(aacirun->base + AACI_IE); | 602 | ie = readl(aacirun->base + AACI_IE); |
@@ -665,12 +607,12 @@ static void aaci_pcm_playback_start(struct aaci_runtime *aacirun) | |||
665 | 607 | ||
666 | static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd) | 608 | static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd) |
667 | { | 609 | { |
668 | struct aaci *aaci = substream->private_data; | ||
669 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 610 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
670 | unsigned long flags; | 611 | unsigned long flags; |
671 | int ret = 0; | 612 | int ret = 0; |
672 | 613 | ||
673 | spin_lock_irqsave(&aaci->lock, flags); | 614 | spin_lock_irqsave(&aacirun->lock, flags); |
615 | |||
674 | switch (cmd) { | 616 | switch (cmd) { |
675 | case SNDRV_PCM_TRIGGER_START: | 617 | case SNDRV_PCM_TRIGGER_START: |
676 | aaci_pcm_playback_start(aacirun); | 618 | aaci_pcm_playback_start(aacirun); |
@@ -697,7 +639,8 @@ static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cm | |||
697 | default: | 639 | default: |
698 | ret = -EINVAL; | 640 | ret = -EINVAL; |
699 | } | 641 | } |
700 | spin_unlock_irqrestore(&aaci->lock, flags); | 642 | |
643 | spin_unlock_irqrestore(&aacirun->lock, flags); | ||
701 | 644 | ||
702 | return ret; | 645 | return ret; |
703 | } | 646 | } |
@@ -716,23 +659,14 @@ static struct snd_pcm_ops aaci_playback_ops = { | |||
716 | static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, | 659 | static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, |
717 | struct snd_pcm_hw_params *params) | 660 | struct snd_pcm_hw_params *params) |
718 | { | 661 | { |
719 | struct aaci *aaci = substream->private_data; | ||
720 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 662 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
721 | int ret; | 663 | int ret; |
722 | 664 | ||
723 | ret = aaci_pcm_hw_params(substream, aacirun, params); | 665 | ret = aaci_pcm_hw_params(substream, aacirun, params); |
724 | 666 | if (ret >= 0) | |
725 | if (ret >= 0) { | ||
726 | aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16; | ||
727 | |||
728 | /* Line in record: slot 3 and 4 */ | 667 | /* Line in record: slot 3 and 4 */ |
729 | aacirun->cr |= CR_SL3 | CR_SL4; | 668 | aacirun->cr |= CR_SL3 | CR_SL4; |
730 | 669 | ||
731 | aacirun->fifosz = aaci->fifosize * 4; | ||
732 | |||
733 | if (aacirun->cr & CR_COMPACT) | ||
734 | aacirun->fifosz >>= 1; | ||
735 | } | ||
736 | return ret; | 670 | return ret; |
737 | } | 671 | } |
738 | 672 | ||
@@ -740,7 +674,7 @@ static void aaci_pcm_capture_stop(struct aaci_runtime *aacirun) | |||
740 | { | 674 | { |
741 | u32 ie; | 675 | u32 ie; |
742 | 676 | ||
743 | aaci_chan_wait_ready(aacirun); | 677 | aaci_chan_wait_ready(aacirun, SR_RXB); |
744 | 678 | ||
745 | ie = readl(aacirun->base + AACI_IE); | 679 | ie = readl(aacirun->base + AACI_IE); |
746 | ie &= ~(IE_ORIE | IE_RXIE); | 680 | ie &= ~(IE_ORIE | IE_RXIE); |
@@ -755,7 +689,7 @@ static void aaci_pcm_capture_start(struct aaci_runtime *aacirun) | |||
755 | { | 689 | { |
756 | u32 ie; | 690 | u32 ie; |
757 | 691 | ||
758 | aaci_chan_wait_ready(aacirun); | 692 | aaci_chan_wait_ready(aacirun, SR_RXB); |
759 | 693 | ||
760 | #ifdef DEBUG | 694 | #ifdef DEBUG |
761 | /* RX Timeout value: bits 28:17 in RXCR */ | 695 | /* RX Timeout value: bits 28:17 in RXCR */ |
@@ -772,12 +706,11 @@ static void aaci_pcm_capture_start(struct aaci_runtime *aacirun) | |||
772 | 706 | ||
773 | static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd) | 707 | static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd) |
774 | { | 708 | { |
775 | struct aaci *aaci = substream->private_data; | ||
776 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 709 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
777 | unsigned long flags; | 710 | unsigned long flags; |
778 | int ret = 0; | 711 | int ret = 0; |
779 | 712 | ||
780 | spin_lock_irqsave(&aaci->lock, flags); | 713 | spin_lock_irqsave(&aacirun->lock, flags); |
781 | 714 | ||
782 | switch (cmd) { | 715 | switch (cmd) { |
783 | case SNDRV_PCM_TRIGGER_START: | 716 | case SNDRV_PCM_TRIGGER_START: |
@@ -806,7 +739,7 @@ static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd | |||
806 | ret = -EINVAL; | 739 | ret = -EINVAL; |
807 | } | 740 | } |
808 | 741 | ||
809 | spin_unlock_irqrestore(&aaci->lock, flags); | 742 | spin_unlock_irqrestore(&aacirun->lock, flags); |
810 | 743 | ||
811 | return ret; | 744 | return ret; |
812 | } | 745 | } |
@@ -889,6 +822,12 @@ static struct ac97_pcm ac97_defs[] __devinitdata = { | |||
889 | (1 << AC97_SLOT_PCM_SRIGHT) | | 822 | (1 << AC97_SLOT_PCM_SRIGHT) | |
890 | (1 << AC97_SLOT_LFE), | 823 | (1 << AC97_SLOT_LFE), |
891 | }, | 824 | }, |
825 | [1] = { | ||
826 | .slots = (1 << AC97_SLOT_PCM_LEFT) | | ||
827 | (1 << AC97_SLOT_PCM_RIGHT) | | ||
828 | (1 << AC97_SLOT_PCM_LEFT_0) | | ||
829 | (1 << AC97_SLOT_PCM_RIGHT_0), | ||
830 | }, | ||
892 | }, | 831 | }, |
893 | }, | 832 | }, |
894 | [1] = { /* PCM in */ | 833 | [1] = { /* PCM in */ |
@@ -1001,7 +940,6 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev) | |||
1001 | 940 | ||
1002 | aaci = card->private_data; | 941 | aaci = card->private_data; |
1003 | mutex_init(&aaci->ac97_sem); | 942 | mutex_init(&aaci->ac97_sem); |
1004 | spin_lock_init(&aaci->lock); | ||
1005 | aaci->card = card; | 943 | aaci->card = card; |
1006 | aaci->dev = dev; | 944 | aaci->dev = dev; |
1007 | 945 | ||
@@ -1028,7 +966,7 @@ static int __devinit aaci_init_pcm(struct aaci *aaci) | |||
1028 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); | 966 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); |
1029 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); | 967 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); |
1030 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 968 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1031 | NULL, 0, 64 * 104); | 969 | NULL, 0, 64 * 1024); |
1032 | } | 970 | } |
1033 | 971 | ||
1034 | return ret; | 972 | return ret; |
@@ -1088,12 +1026,14 @@ static int __devinit aaci_probe(struct amba_device *dev, struct amba_id *id) | |||
1088 | /* | 1026 | /* |
1089 | * Playback uses AACI channel 0 | 1027 | * Playback uses AACI channel 0 |
1090 | */ | 1028 | */ |
1029 | spin_lock_init(&aaci->playback.lock); | ||
1091 | aaci->playback.base = aaci->base + AACI_CSCH1; | 1030 | aaci->playback.base = aaci->base + AACI_CSCH1; |
1092 | aaci->playback.fifo = aaci->base + AACI_DR1; | 1031 | aaci->playback.fifo = aaci->base + AACI_DR1; |
1093 | 1032 | ||
1094 | /* | 1033 | /* |
1095 | * Capture uses AACI channel 0 | 1034 | * Capture uses AACI channel 0 |
1096 | */ | 1035 | */ |
1036 | spin_lock_init(&aaci->capture.lock); | ||
1097 | aaci->capture.base = aaci->base + AACI_CSCH1; | 1037 | aaci->capture.base = aaci->base + AACI_CSCH1; |
1098 | aaci->capture.fifo = aaci->base + AACI_DR1; | 1038 | aaci->capture.fifo = aaci->base + AACI_DR1; |
1099 | 1039 | ||
diff --git a/sound/arm/aaci.h b/sound/arm/aaci.h index 924f69c1c44c..6a4a2eebdda1 100644 --- a/sound/arm/aaci.h +++ b/sound/arm/aaci.h | |||
@@ -202,6 +202,7 @@ | |||
202 | struct aaci_runtime { | 202 | struct 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 | ||
162 | static struct dev_pm_ops pxa2xx_ac97_pm_ops = { | 162 | static 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 | |||
5 | config SND_PCM | 5 | config SND_PCM |
6 | tristate | 6 | tristate |
7 | select SND_TIMER | 7 | select SND_TIMER |
8 | select GCD | ||
8 | 9 | ||
9 | config SND_HWDEP | 10 | config SND_HWDEP |
10 | tristate | 11 | tristate |
diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c index 34c7d48f5061..7f4d744ae40a 100644 --- a/sound/core/hrtimer.c +++ b/sound/core/hrtimer.c | |||
@@ -37,14 +37,22 @@ static unsigned int resolution; | |||
37 | struct snd_hrtimer { | 37 | struct snd_hrtimer { |
38 | struct snd_timer *timer; | 38 | struct snd_timer *timer; |
39 | struct hrtimer hrt; | 39 | struct hrtimer hrt; |
40 | atomic_t running; | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) | 43 | static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) |
43 | { | 44 | { |
44 | struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt); | 45 | struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt); |
45 | struct snd_timer *t = stime->timer; | 46 | struct snd_timer *t = stime->timer; |
47 | |||
48 | if (!atomic_read(&stime->running)) | ||
49 | return HRTIMER_NORESTART; | ||
50 | |||
46 | hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution)); | 51 | hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution)); |
47 | snd_timer_interrupt(stime->timer, t->sticks); | 52 | snd_timer_interrupt(stime->timer, t->sticks); |
53 | |||
54 | if (!atomic_read(&stime->running)) | ||
55 | return HRTIMER_NORESTART; | ||
48 | return HRTIMER_RESTART; | 56 | return HRTIMER_RESTART; |
49 | } | 57 | } |
50 | 58 | ||
@@ -58,6 +66,7 @@ static int snd_hrtimer_open(struct snd_timer *t) | |||
58 | hrtimer_init(&stime->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 66 | hrtimer_init(&stime->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
59 | stime->timer = t; | 67 | stime->timer = t; |
60 | stime->hrt.function = snd_hrtimer_callback; | 68 | stime->hrt.function = snd_hrtimer_callback; |
69 | atomic_set(&stime->running, 0); | ||
61 | t->private_data = stime; | 70 | t->private_data = stime; |
62 | return 0; | 71 | return 0; |
63 | } | 72 | } |
@@ -78,16 +87,18 @@ static int snd_hrtimer_start(struct snd_timer *t) | |||
78 | { | 87 | { |
79 | struct snd_hrtimer *stime = t->private_data; | 88 | struct snd_hrtimer *stime = t->private_data; |
80 | 89 | ||
90 | atomic_set(&stime->running, 0); | ||
91 | hrtimer_cancel(&stime->hrt); | ||
81 | hrtimer_start(&stime->hrt, ns_to_ktime(t->sticks * resolution), | 92 | hrtimer_start(&stime->hrt, ns_to_ktime(t->sticks * resolution), |
82 | HRTIMER_MODE_REL); | 93 | HRTIMER_MODE_REL); |
94 | atomic_set(&stime->running, 1); | ||
83 | return 0; | 95 | return 0; |
84 | } | 96 | } |
85 | 97 | ||
86 | static int snd_hrtimer_stop(struct snd_timer *t) | 98 | static int snd_hrtimer_stop(struct snd_timer *t) |
87 | { | 99 | { |
88 | struct snd_hrtimer *stime = t->private_data; | 100 | struct snd_hrtimer *stime = t->private_data; |
89 | 101 | atomic_set(&stime->running, 0); | |
90 | hrtimer_cancel(&stime->hrt); | ||
91 | return 0; | 102 | return 0; |
92 | } | 103 | } |
93 | 104 | ||
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 30f410832a25..a27545b23ee9 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -758,7 +758,7 @@ int snd_interval_ratnum(struct snd_interval *i, | |||
758 | int diff; | 758 | int diff; |
759 | if (q == 0) | 759 | if (q == 0) |
760 | q = 1; | 760 | q = 1; |
761 | den = div_down(num, q); | 761 | den = div_up(num, q); |
762 | if (den < rats[k].den_min) | 762 | if (den < rats[k].den_min) |
763 | continue; | 763 | continue; |
764 | if (den > rats[k].den_max) | 764 | if (den > rats[k].den_max) |
@@ -794,7 +794,7 @@ int snd_interval_ratnum(struct snd_interval *i, | |||
794 | i->empty = 1; | 794 | i->empty = 1; |
795 | return -EINVAL; | 795 | return -EINVAL; |
796 | } | 796 | } |
797 | den = div_up(num, q); | 797 | den = div_down(num, q); |
798 | if (den > rats[k].den_max) | 798 | if (den > rats[k].den_max) |
799 | continue; | 799 | continue; |
800 | if (den < rats[k].den_min) | 800 | if (den < rats[k].den_min) |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 29ab46a12e11..25b0641e6b8c 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1918,13 +1918,13 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) | |||
1918 | 1918 | ||
1919 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, | 1919 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, |
1920 | hw->rate_min, hw->rate_max); | 1920 | hw->rate_min, hw->rate_max); |
1921 | if (err < 0) | 1921 | if (err < 0) |
1922 | return err; | 1922 | return err; |
1923 | 1923 | ||
1924 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, | 1924 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, |
1925 | hw->period_bytes_min, hw->period_bytes_max); | 1925 | hw->period_bytes_min, hw->period_bytes_max); |
1926 | if (err < 0) | 1926 | if (err < 0) |
1927 | return err; | 1927 | return err; |
1928 | 1928 | ||
1929 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, | 1929 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, |
1930 | hw->periods_min, hw->periods_max); | 1930 | hw->periods_min, hw->periods_max); |
diff --git a/sound/core/pcm_timer.c b/sound/core/pcm_timer.c index ca8068b63d6c..b01d9481d632 100644 --- a/sound/core/pcm_timer.c +++ b/sound/core/pcm_timer.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/time.h> | 22 | #include <linux/time.h> |
23 | #include <linux/gcd.h> | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include <sound/pcm.h> | 25 | #include <sound/pcm.h> |
25 | #include <sound/timer.h> | 26 | #include <sound/timer.h> |
@@ -28,22 +29,6 @@ | |||
28 | * Timer functions | 29 | * Timer functions |
29 | */ | 30 | */ |
30 | 31 | ||
31 | /* Greatest common divisor */ | ||
32 | static 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 | |||
47 | void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) | 32 | void 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/core/rawmidi.c b/sound/core/rawmidi.c index 2f766123b158..0f5a194695d9 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -1257,7 +1257,7 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, | |||
1257 | break; | 1257 | break; |
1258 | count -= count1; | 1258 | count -= count1; |
1259 | } | 1259 | } |
1260 | if (file->f_flags & O_SYNC) { | 1260 | if (file->f_flags & O_DSYNC) { |
1261 | spin_lock_irq(&runtime->lock); | 1261 | spin_lock_irq(&runtime->lock); |
1262 | while (runtime->avail != runtime->buffer_size) { | 1262 | while (runtime->avail != runtime->buffer_size) { |
1263 | wait_queue_t wait; | 1263 | wait_queue_t wait; |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 7872a02f6ca9..563d1967a0ad 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -468,5 +468,5 @@ static void __exit alsa_sound_exit(void) | |||
468 | unregister_chrdev(major, "alsa"); | 468 | unregister_chrdev(major, "alsa"); |
469 | } | 469 | } |
470 | 470 | ||
471 | module_init(alsa_sound_init) | 471 | subsys_initcall(alsa_sound_init); |
472 | module_exit(alsa_sound_exit) | 472 | module_exit(alsa_sound_exit); |
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index 7fe12264ff80..0c164e5e4322 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
@@ -93,7 +93,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev) | |||
93 | default: | 93 | default: |
94 | return -EINVAL; | 94 | return -EINVAL; |
95 | } | 95 | } |
96 | if (snd_BUG_ON(minor < 0 || minor >= SNDRV_OSS_MINORS)) | 96 | if (minor < 0 || minor >= SNDRV_OSS_MINORS) |
97 | return -EINVAL; | 97 | return -EINVAL; |
98 | return minor; | 98 | return minor; |
99 | } | 99 | } |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 93fa6720d197..cc15d1d65a22 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -177,7 +177,7 @@ static struct pnp_card_device_id snd_cs423x_pnpids[] = { | |||
177 | { .id = "CSC0437", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, | 177 | { .id = "CSC0437", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, |
178 | /* Digital PC 5000 Onboard - CS4236B */ | 178 | /* Digital PC 5000 Onboard - CS4236B */ |
179 | { .id = "CSC0735", .devs = { { "CSC0000" }, { "CSC0010" } } }, | 179 | { .id = "CSC0735", .devs = { { "CSC0000" }, { "CSC0010" } } }, |
180 | /* some uknown CS4236B */ | 180 | /* some unknown CS4236B */ |
181 | { .id = "CSC0b35", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, | 181 | { .id = "CSC0b35", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, |
182 | /* Intel PR440FX Onboard sound */ | 182 | /* Intel PR440FX Onboard sound */ |
183 | { .id = "CSC0b36", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, | 183 | { .id = "CSC0b36", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } }, |
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/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 6123c7531110..b865e45a8f9b 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -133,7 +133,7 @@ struct snd_miro { | |||
133 | static struct snd_miro_aci aci_device; | 133 | static struct snd_miro_aci aci_device; |
134 | 134 | ||
135 | static char * snd_opti9xx_names[] = { | 135 | static char * snd_opti9xx_names[] = { |
136 | "unkown", | 136 | "unknown", |
137 | "82C928", "82C929", | 137 | "82C928", "82C929", |
138 | "82C924", "82C925", | 138 | "82C924", "82C925", |
139 | "82C930", "82C931", "82C933" | 139 | "82C930", "82C931", "82C933" |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index d08c38906449..c8a8da0d4036 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -135,6 +135,8 @@ struct snd_opti9xx { | |||
135 | unsigned long mc_base_size; | 135 | unsigned long mc_base_size; |
136 | #ifdef OPTi93X | 136 | #ifdef OPTi93X |
137 | unsigned long mc_indir_index; | 137 | unsigned long mc_indir_index; |
138 | unsigned long mc_indir_size; | ||
139 | struct resource *res_mc_indir; | ||
138 | struct snd_wss *codec; | 140 | struct snd_wss *codec; |
139 | #endif /* OPTi93X */ | 141 | #endif /* OPTi93X */ |
140 | unsigned long pwd_reg; | 142 | unsigned long pwd_reg; |
@@ -177,7 +179,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_opti9xx_pnpids); | |||
177 | #endif | 179 | #endif |
178 | 180 | ||
179 | static char * snd_opti9xx_names[] = { | 181 | static char * snd_opti9xx_names[] = { |
180 | "unkown", | 182 | "unknown", |
181 | "82C928", "82C929", | 183 | "82C928", "82C929", |
182 | "82C924", "82C925", | 184 | "82C924", "82C925", |
183 | "82C930", "82C931", "82C933" | 185 | "82C930", "82C931", "82C933" |
@@ -231,7 +233,10 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, | |||
231 | case OPTi9XX_HW_82C931: | 233 | case OPTi9XX_HW_82C931: |
232 | case OPTi9XX_HW_82C933: | 234 | case OPTi9XX_HW_82C933: |
233 | chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d; | 235 | chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d; |
234 | chip->mc_indir_index = 0xe0e; | 236 | if (!chip->mc_indir_index) { |
237 | chip->mc_indir_index = 0xe0e; | ||
238 | chip->mc_indir_size = 2; | ||
239 | } | ||
235 | chip->password = 0xe4; | 240 | chip->password = 0xe4; |
236 | chip->pwd_reg = 0; | 241 | chip->pwd_reg = 0; |
237 | break; | 242 | break; |
@@ -543,10 +548,13 @@ __skip_mpu: | |||
543 | 548 | ||
544 | static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) | 549 | static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) |
545 | { | 550 | { |
546 | struct snd_wss *codec = dev_id; | 551 | struct snd_opti9xx *chip = dev_id; |
547 | struct snd_opti9xx *chip = codec->card->private_data; | 552 | struct snd_wss *codec = chip->codec; |
548 | unsigned char status; | 553 | unsigned char status; |
549 | 554 | ||
555 | if (!codec) | ||
556 | return IRQ_HANDLED; | ||
557 | |||
550 | status = snd_opti9xx_read(chip, OPTi9XX_MC_REG(11)); | 558 | status = snd_opti9xx_read(chip, OPTi9XX_MC_REG(11)); |
551 | if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream) | 559 | if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream) |
552 | snd_pcm_period_elapsed(codec->playback_substream); | 560 | snd_pcm_period_elapsed(codec->playback_substream); |
@@ -560,57 +568,69 @@ static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) | |||
560 | 568 | ||
561 | #endif /* OPTi93X */ | 569 | #endif /* OPTi93X */ |
562 | 570 | ||
563 | static int __devinit snd_card_opti9xx_detect(struct snd_card *card, | 571 | static int __devinit snd_opti9xx_read_check(struct snd_opti9xx *chip) |
564 | struct snd_opti9xx *chip) | ||
565 | { | 572 | { |
566 | int i, err; | 573 | unsigned char value; |
574 | #ifdef OPTi93X | ||
575 | unsigned long flags; | ||
576 | #endif | ||
567 | 577 | ||
578 | chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, | ||
579 | "OPTi9xx MC"); | ||
580 | if (chip->res_mc_base == NULL) | ||
581 | return -EBUSY; | ||
568 | #ifndef OPTi93X | 582 | #ifndef OPTi93X |
569 | for (i = OPTi9XX_HW_82C928; i < OPTi9XX_HW_82C930; i++) { | 583 | value = snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)); |
570 | unsigned char value; | 584 | if (value != 0xff && value != inb(chip->mc_base + OPTi9XX_MC_REG(1))) |
585 | if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1))) | ||
586 | return 0; | ||
587 | #else /* OPTi93X */ | ||
588 | chip->res_mc_indir = request_region(chip->mc_indir_index, | ||
589 | chip->mc_indir_size, | ||
590 | "OPTi93x MC"); | ||
591 | if (chip->res_mc_indir == NULL) | ||
592 | return -EBUSY; | ||
571 | 593 | ||
572 | if ((err = snd_opti9xx_init(chip, i)) < 0) | 594 | spin_lock_irqsave(&chip->lock, flags); |
573 | return err; | 595 | outb(chip->password, chip->mc_base + chip->pwd_reg); |
596 | outb(((chip->mc_indir_index & 0x1f0) >> 4), chip->mc_base); | ||
597 | spin_unlock_irqrestore(&chip->lock, flags); | ||
574 | 598 | ||
575 | if ((chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, "OPTi9xx MC")) == NULL) | 599 | value = snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)); |
576 | continue; | 600 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(7), 0xff - value); |
601 | if (snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)) == 0xff - value) | ||
602 | return 0; | ||
577 | 603 | ||
578 | value = snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)); | 604 | release_and_free_resource(chip->res_mc_indir); |
579 | if ((value != 0xff) && (value != inb(chip->mc_base + 1))) | 605 | chip->res_mc_indir = NULL; |
580 | if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1))) | 606 | #endif /* OPTi93X */ |
581 | return 1; | 607 | release_and_free_resource(chip->res_mc_base); |
608 | chip->res_mc_base = NULL; | ||
582 | 609 | ||
583 | release_and_free_resource(chip->res_mc_base); | 610 | return -ENODEV; |
584 | chip->res_mc_base = NULL; | 611 | } |
585 | 612 | ||
586 | } | 613 | static int __devinit snd_card_opti9xx_detect(struct snd_card *card, |
587 | #else /* OPTi93X */ | 614 | struct snd_opti9xx *chip) |
588 | for (i = OPTi9XX_HW_82C931; i >= OPTi9XX_HW_82C930; i--) { | 615 | { |
589 | unsigned long flags; | 616 | int i, err; |
590 | unsigned char value; | ||
591 | 617 | ||
592 | if ((err = snd_opti9xx_init(chip, i)) < 0) | 618 | #ifndef OPTi93X |
619 | for (i = OPTi9XX_HW_82C928; i < OPTi9XX_HW_82C930; i++) { | ||
620 | #else | ||
621 | for (i = OPTi9XX_HW_82C931; i >= OPTi9XX_HW_82C930; i--) { | ||
622 | #endif | ||
623 | err = snd_opti9xx_init(chip, i); | ||
624 | if (err < 0) | ||
593 | return err; | 625 | return err; |
594 | 626 | ||
595 | if ((chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, "OPTi9xx MC")) == NULL) | 627 | err = snd_opti9xx_read_check(chip); |
596 | continue; | 628 | if (err == 0) |
597 | |||
598 | spin_lock_irqsave(&chip->lock, flags); | ||
599 | outb(chip->password, chip->mc_base + chip->pwd_reg); | ||
600 | outb(((chip->mc_indir_index & (1 << 8)) >> 4) | | ||
601 | ((chip->mc_indir_index & 0xf0) >> 4), chip->mc_base); | ||
602 | spin_unlock_irqrestore(&chip->lock, flags); | ||
603 | |||
604 | value = snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)); | ||
605 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(7), 0xff - value); | ||
606 | if (snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)) == 0xff - value) | ||
607 | return 1; | 629 | return 1; |
608 | 630 | #ifdef OPTi93X | |
609 | release_and_free_resource(chip->res_mc_base); | 631 | chip->mc_indir_index = 0; |
610 | chip->res_mc_base = NULL; | 632 | #endif |
611 | } | 633 | } |
612 | #endif /* OPTi93X */ | ||
613 | |||
614 | return -ENODEV; | 634 | return -ENODEV; |
615 | } | 635 | } |
616 | 636 | ||
@@ -639,6 +659,8 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
639 | #ifdef OPTi93X | 659 | #ifdef OPTi93X |
640 | port = pnp_port_start(pdev, 0) - 4; | 660 | port = pnp_port_start(pdev, 0) - 4; |
641 | fm_port = pnp_port_start(pdev, 1) + 8; | 661 | fm_port = pnp_port_start(pdev, 1) + 8; |
662 | chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; | ||
663 | chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; | ||
642 | #else | 664 | #else |
643 | if (pid->driver_data != 0x0924) | 665 | if (pid->driver_data != 0x0924) |
644 | port = pnp_port_start(pdev, 1); | 666 | port = pnp_port_start(pdev, 1); |
@@ -669,14 +691,14 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
669 | static void snd_card_opti9xx_free(struct snd_card *card) | 691 | static void snd_card_opti9xx_free(struct snd_card *card) |
670 | { | 692 | { |
671 | struct snd_opti9xx *chip = card->private_data; | 693 | struct snd_opti9xx *chip = card->private_data; |
672 | 694 | ||
673 | if (chip) { | 695 | if (chip) { |
674 | #ifdef OPTi93X | 696 | #ifdef OPTi93X |
675 | struct snd_wss *codec = chip->codec; | 697 | if (chip->irq > 0) { |
676 | if (codec && codec->irq > 0) { | 698 | disable_irq(chip->irq); |
677 | disable_irq(codec->irq); | 699 | free_irq(chip->irq, chip); |
678 | free_irq(codec->irq, codec); | ||
679 | } | 700 | } |
701 | release_and_free_resource(chip->res_mc_indir); | ||
680 | #endif | 702 | #endif |
681 | release_and_free_resource(chip->res_mc_base); | 703 | release_and_free_resource(chip->res_mc_base); |
682 | } | 704 | } |
@@ -696,11 +718,6 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
696 | struct snd_rawmidi *rmidi; | 718 | struct snd_rawmidi *rmidi; |
697 | struct snd_hwdep *synth; | 719 | struct snd_hwdep *synth; |
698 | 720 | ||
699 | if (! chip->res_mc_base && | ||
700 | (chip->res_mc_base = request_region(chip->mc_base, chip->mc_base_size, | ||
701 | "OPTi9xx MC")) == NULL) | ||
702 | return -ENOMEM; | ||
703 | |||
704 | #if defined(CS4231) || defined(OPTi93X) | 721 | #if defined(CS4231) || defined(OPTi93X) |
705 | xdma2 = dma2; | 722 | xdma2 = dma2; |
706 | #else | 723 | #else |
@@ -744,9 +761,9 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
744 | #endif | 761 | #endif |
745 | #ifdef OPTi93X | 762 | #ifdef OPTi93X |
746 | error = request_irq(irq, snd_opti93x_interrupt, | 763 | error = request_irq(irq, snd_opti93x_interrupt, |
747 | IRQF_DISABLED, DEV_NAME" - WSS", codec); | 764 | IRQF_DISABLED, DEV_NAME" - WSS", chip); |
748 | if (error < 0) { | 765 | if (error < 0) { |
749 | snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); | 766 | snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", irq); |
750 | return error; | 767 | return error; |
751 | } | 768 | } |
752 | #endif | 769 | #endif |
@@ -954,6 +971,13 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, | |||
954 | } | 971 | } |
955 | if (hw <= OPTi9XX_HW_82C930) | 972 | if (hw <= OPTi9XX_HW_82C930) |
956 | chip->mc_base -= 0x80; | 973 | chip->mc_base -= 0x80; |
974 | |||
975 | error = snd_opti9xx_read_check(chip); | ||
976 | if (error) { | ||
977 | snd_printk(KERN_ERR "OPTI chip not found\n"); | ||
978 | snd_card_free(card); | ||
979 | return error; | ||
980 | } | ||
957 | snd_card_set_dev(card, &pcard->card->dev); | 981 | snd_card_set_dev(card, &pcard->card->dev); |
958 | if ((error = snd_opti9xx_probe(card)) < 0) { | 982 | if ((error = snd_opti9xx_probe(card)) < 0) { |
959 | snd_card_free(card); | 983 | snd_card_free(card); |
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c index 96678d5d3834..0c40951b6523 100644 --- a/sound/isa/sb/emu8000.c +++ b/sound/isa/sb/emu8000.c | |||
@@ -377,12 +377,13 @@ init_arrays(struct snd_emu8000 *emu) | |||
377 | static void __devinit | 377 | static void __devinit |
378 | size_dram(struct snd_emu8000 *emu) | 378 | size_dram(struct snd_emu8000 *emu) |
379 | { | 379 | { |
380 | int i, size; | 380 | int i, size, detected_size; |
381 | 381 | ||
382 | if (emu->dram_checked) | 382 | if (emu->dram_checked) |
383 | return; | 383 | return; |
384 | 384 | ||
385 | size = 0; | 385 | size = 0; |
386 | detected_size = 0; | ||
386 | 387 | ||
387 | /* write out a magic number */ | 388 | /* write out a magic number */ |
388 | snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE); | 389 | snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE); |
@@ -414,7 +415,9 @@ size_dram(struct snd_emu8000 *emu) | |||
414 | /*snd_emu8000_read_wait(emu);*/ | 415 | /*snd_emu8000_read_wait(emu);*/ |
415 | EMU8000_SMLD_READ(emu); /* discard stale data */ | 416 | EMU8000_SMLD_READ(emu); /* discard stale data */ |
416 | if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) | 417 | if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) |
417 | break; /* we must have wrapped around */ | 418 | break; /* no memory at this address */ |
419 | |||
420 | detected_size = size; | ||
418 | 421 | ||
419 | snd_emu8000_read_wait(emu); | 422 | snd_emu8000_read_wait(emu); |
420 | 423 | ||
@@ -442,9 +445,9 @@ size_dram(struct snd_emu8000 *emu) | |||
442 | snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); | 445 | snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); |
443 | 446 | ||
444 | snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", | 447 | snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", |
445 | emu->port1, size/1024); | 448 | emu->port1, detected_size/1024); |
446 | 449 | ||
447 | emu->mem_size = size; | 450 | emu->mem_size = detected_size; |
448 | emu->dram_checked = 1; | 451 | emu->dram_checked = 1; |
449 | } | 452 | } |
450 | 453 | ||
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/Kconfig b/sound/oss/Kconfig index 135a2b77cc4a..a513651fa149 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig | |||
@@ -1,5 +1,3 @@ | |||
1 | # drivers/sound/Config.in | ||
2 | # | ||
3 | # 18 Apr 1998, Michael Elizabeth Chastain, <mailto:mec@shout.net> | 1 | # 18 Apr 1998, Michael Elizabeth Chastain, <mailto:mec@shout.net> |
4 | # More hacking for modularisation. | 2 | # More hacking for modularisation. |
5 | # | 3 | # |
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index 4191acccbcdb..c1070e33b32f 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c | |||
@@ -614,7 +614,8 @@ start_adc(struct au1550_state *s) | |||
614 | /* Put two buffers on the ring to get things started. | 614 | /* Put two buffers on the ring to get things started. |
615 | */ | 615 | */ |
616 | for (i=0; i<2; i++) { | 616 | for (i=0; i<2; i++) { |
617 | au1xxx_dbdma_put_dest(db->dmanr, db->nextIn, db->dma_fragsize); | 617 | au1xxx_dbdma_put_dest(db->dmanr, virt_to_phys(db->nextIn), |
618 | db->dma_fragsize, DDMA_FLAGS_IE); | ||
618 | 619 | ||
619 | db->nextIn += db->dma_fragsize; | 620 | db->nextIn += db->dma_fragsize; |
620 | if (db->nextIn >= db->rawbuf + db->dmasize) | 621 | if (db->nextIn >= db->rawbuf + db->dmasize) |
@@ -732,8 +733,9 @@ static void dac_dma_interrupt(int irq, void *dev_id) | |||
732 | db->dma_qcount--; | 733 | db->dma_qcount--; |
733 | 734 | ||
734 | if (db->count >= db->fragsize) { | 735 | if (db->count >= db->fragsize) { |
735 | if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut, | 736 | if (au1xxx_dbdma_put_source(db->dmanr, |
736 | db->fragsize) == 0) { | 737 | virt_to_phys(db->nextOut), db->fragsize, |
738 | DDMA_FLAGS_IE) == 0) { | ||
737 | err("qcount < 2 and no ring room!"); | 739 | err("qcount < 2 and no ring room!"); |
738 | } | 740 | } |
739 | db->nextOut += db->fragsize; | 741 | db->nextOut += db->fragsize; |
@@ -777,7 +779,8 @@ static void adc_dma_interrupt(int irq, void *dev_id) | |||
777 | 779 | ||
778 | /* Put a new empty buffer on the destination DMA. | 780 | /* Put a new empty buffer on the destination DMA. |
779 | */ | 781 | */ |
780 | au1xxx_dbdma_put_dest(dp->dmanr, dp->nextIn, dp->dma_fragsize); | 782 | au1xxx_dbdma_put_dest(dp->dmanr, virt_to_phys(dp->nextIn), |
783 | dp->dma_fragsize, DDMA_FLAGS_IE); | ||
781 | 784 | ||
782 | dp->nextIn += dp->dma_fragsize; | 785 | dp->nextIn += dp->dma_fragsize; |
783 | if (dp->nextIn >= dp->rawbuf + dp->dmasize) | 786 | if (dp->nextIn >= dp->rawbuf + dp->dmasize) |
@@ -1177,8 +1180,9 @@ au1550_write(struct file *file, const char *buffer, size_t count, loff_t * ppos) | |||
1177 | * we know the dma has stopped. | 1180 | * we know the dma has stopped. |
1178 | */ | 1181 | */ |
1179 | while ((db->dma_qcount < 2) && (db->count >= db->fragsize)) { | 1182 | while ((db->dma_qcount < 2) && (db->count >= db->fragsize)) { |
1180 | if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut, | 1183 | if (au1xxx_dbdma_put_source(db->dmanr, |
1181 | db->fragsize) == 0) { | 1184 | virt_to_phys(db->nextOut), db->fragsize, |
1185 | DDMA_FLAGS_IE) == 0) { | ||
1182 | err("qcount < 2 and no ring room!"); | 1186 | err("qcount < 2 and no ring room!"); |
1183 | } | 1187 | } |
1184 | db->nextOut += db->fragsize; | 1188 | db->nextOut += db->fragsize; |
diff --git a/sound/oss/dev_table.c b/sound/oss/dev_table.c index 08274c995d06..727bdb9ba2dc 100644 --- a/sound/oss/dev_table.c +++ b/sound/oss/dev_table.c | |||
@@ -67,14 +67,15 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver, | |||
67 | return -(EBUSY); | 67 | return -(EBUSY); |
68 | } | 68 | } |
69 | d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver))); | 69 | d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver))); |
70 | 70 | sound_nblocks++; | |
71 | if (sound_nblocks < 1024) | 71 | if (sound_nblocks >= MAX_MEM_BLOCKS) |
72 | sound_nblocks++; | 72 | sound_nblocks = MAX_MEM_BLOCKS - 1; |
73 | 73 | ||
74 | op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations))); | 74 | op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations))); |
75 | sound_nblocks++; | ||
76 | if (sound_nblocks >= MAX_MEM_BLOCKS) | ||
77 | sound_nblocks = MAX_MEM_BLOCKS - 1; | ||
75 | 78 | ||
76 | if (sound_nblocks < 1024) | ||
77 | sound_nblocks++; | ||
78 | if (d == NULL || op == NULL) { | 79 | if (d == NULL || op == NULL) { |
79 | printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name); | 80 | printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name); |
80 | sound_unload_audiodev(num); | 81 | sound_unload_audiodev(num); |
@@ -128,9 +129,10 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver, | |||
128 | until you unload sound! */ | 129 | until you unload sound! */ |
129 | 130 | ||
130 | op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations))); | 131 | op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations))); |
132 | sound_nblocks++; | ||
133 | if (sound_nblocks >= MAX_MEM_BLOCKS) | ||
134 | sound_nblocks = MAX_MEM_BLOCKS - 1; | ||
131 | 135 | ||
132 | if (sound_nblocks < 1024) | ||
133 | sound_nblocks++; | ||
134 | if (op == NULL) { | 136 | if (op == NULL) { |
135 | printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); | 137 | printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); |
136 | return -ENOMEM; | 138 | return -ENOMEM; |
diff --git a/sound/oss/dmasound/dmasound_paula.c b/sound/oss/dmasound/dmasound_paula.c index 06e9e88e4c05..bb14e4c67e89 100644 --- a/sound/oss/dmasound/dmasound_paula.c +++ b/sound/oss/dmasound/dmasound_paula.c | |||
@@ -657,7 +657,7 @@ static int AmiStateInfo(char *buffer, size_t space) | |||
657 | len += sprintf(buffer+len, "\tsound.volume_right = %d [0...64]\n", | 657 | len += sprintf(buffer+len, "\tsound.volume_right = %d [0...64]\n", |
658 | dmasound.volume_right); | 658 | dmasound.volume_right); |
659 | if (len >= space) { | 659 | if (len >= space) { |
660 | printk(KERN_ERR "dmasound_paula: overlowed state buffer alloc.\n") ; | 660 | printk(KERN_ERR "dmasound_paula: overflowed state buffer alloc.\n") ; |
661 | len = space ; | 661 | len = space ; |
662 | } | 662 | } |
663 | return len; | 663 | return len; |
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/oss/sound_config.h b/sound/oss/sound_config.h index 55271fbe7f49..9d35c4c65b9b 100644 --- a/sound/oss/sound_config.h +++ b/sound/oss/sound_config.h | |||
@@ -142,4 +142,6 @@ static inline int translate_mode(struct file *file) | |||
142 | #define TIMER_ARMED 121234 | 142 | #define TIMER_ARMED 121234 |
143 | #define TIMER_NOT_ARMED 1 | 143 | #define TIMER_NOT_ARMED 1 |
144 | 144 | ||
145 | #define MAX_MEM_BLOCKS 1024 | ||
146 | |||
145 | #endif | 147 | #endif |
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 61aaedae6b7e..c62530943888 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -56,7 +56,7 @@ | |||
56 | /* | 56 | /* |
57 | * Table for permanently allocated memory (used when unloading the module) | 57 | * Table for permanently allocated memory (used when unloading the module) |
58 | */ | 58 | */ |
59 | void * sound_mem_blocks[1024]; | 59 | void * sound_mem_blocks[MAX_MEM_BLOCKS]; |
60 | int sound_nblocks = 0; | 60 | int sound_nblocks = 0; |
61 | 61 | ||
62 | /* Persistent DMA buffers */ | 62 | /* Persistent DMA buffers */ |
@@ -574,7 +574,7 @@ static int __init oss_init(void) | |||
574 | NULL, "%s%d", dev_list[i].name, j); | 574 | NULL, "%s%d", dev_list[i].name, j); |
575 | } | 575 | } |
576 | 576 | ||
577 | if (sound_nblocks >= 1024) | 577 | if (sound_nblocks >= MAX_MEM_BLOCKS - 1) |
578 | printk(KERN_ERR "Sound warning: Deallocation table was too small.\n"); | 578 | printk(KERN_ERR "Sound warning: Deallocation table was too small.\n"); |
579 | 579 | ||
580 | return 0; | 580 | return 0; |
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 20cb60afb200..a7630e9edf8a 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -83,6 +83,7 @@ static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = { | |||
83 | { 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL }, | 83 | { 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL }, |
84 | { 0x50534300, 0xffffff00, "Philips", NULL, NULL }, | 84 | { 0x50534300, 0xffffff00, "Philips", NULL, NULL }, |
85 | { 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL }, | 85 | { 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL }, |
86 | { 0x53544d00, 0xffffff00, "STMicroelectronics", NULL, NULL }, | ||
86 | { 0x54524100, 0xffffff00, "TriTech", NULL, NULL }, | 87 | { 0x54524100, 0xffffff00, "TriTech", NULL, NULL }, |
87 | { 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL }, | 88 | { 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL }, |
88 | { 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL }, | 89 | { 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL }, |
@@ -161,6 +162,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { | |||
161 | { 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix | 162 | { 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix |
162 | { 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL }, | 163 | { 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL }, |
163 | { 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH }, | 164 | { 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH }, |
165 | { 0x53544d02, 0xffffffff, "ST7597", NULL, NULL }, | ||
164 | { 0x54524102, 0xffffffff, "TR28022", NULL, NULL }, | 166 | { 0x54524102, 0xffffffff, "TR28022", NULL, NULL }, |
165 | { 0x54524103, 0xffffffff, "TR28023", NULL, NULL }, | 167 | { 0x54524103, 0xffffffff, "TR28023", NULL, NULL }, |
166 | { 0x54524106, 0xffffffff, "TR28026", NULL, NULL }, | 168 | { 0x54524106, 0xffffffff, "TR28026", NULL, NULL }, |
@@ -213,6 +215,14 @@ static int snd_ac97_valid_reg(struct snd_ac97 *ac97, unsigned short reg) | |||
213 | { | 215 | { |
214 | /* filter some registers for buggy codecs */ | 216 | /* filter some registers for buggy codecs */ |
215 | switch (ac97->id) { | 217 | switch (ac97->id) { |
218 | case AC97_ID_ST_AC97_ID4: | ||
219 | if (reg == 0x08) | ||
220 | return 0; | ||
221 | /* fall through */ | ||
222 | case AC97_ID_ST7597: | ||
223 | if (reg == 0x22 || reg == 0x7a) | ||
224 | return 1; | ||
225 | /* fall through */ | ||
216 | case AC97_ID_AK4540: | 226 | case AC97_ID_AK4540: |
217 | case AC97_ID_AK4542: | 227 | case AC97_ID_AK4542: |
218 | if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c) | 228 | if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c) |
@@ -2122,7 +2132,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2122 | } | 2132 | } |
2123 | /* nothing should be in powerdown mode */ | 2133 | /* nothing should be in powerdown mode */ |
2124 | snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); | 2134 | snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); |
2125 | end_time = jiffies + msecs_to_jiffies(120); | 2135 | end_time = jiffies + msecs_to_jiffies(5000); |
2126 | do { | 2136 | do { |
2127 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) | 2137 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) |
2128 | goto __ready_ok; | 2138 | goto __ready_ok; |
diff --git a/sound/pci/ac97/ac97_id.h b/sound/pci/ac97/ac97_id.h index c129492c82b3..d603147c4a96 100644 --- a/sound/pci/ac97/ac97_id.h +++ b/sound/pci/ac97/ac97_id.h | |||
@@ -62,3 +62,5 @@ | |||
62 | #define AC97_ID_CM9761_78 0x434d4978 | 62 | #define AC97_ID_CM9761_78 0x434d4978 |
63 | #define AC97_ID_CM9761_82 0x434d4982 | 63 | #define AC97_ID_CM9761_82 0x434d4982 |
64 | #define AC97_ID_CM9761_83 0x434d4983 | 64 | #define AC97_ID_CM9761_83 0x434d4983 |
65 | #define AC97_ID_ST7597 0x53544d02 | ||
66 | #define AC97_ID_ST_AC97_ID4 0x53544d04 | ||
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 139cf3b2b9d7..d9266bae2849 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -1870,6 +1870,7 @@ static unsigned int ad1981_jacks_blacklist[] = { | |||
1870 | 0x10140554, /* Thinkpad T42p/R50p */ | 1870 | 0x10140554, /* Thinkpad T42p/R50p */ |
1871 | 0x10140567, /* Thinkpad T43p 2668-G7U */ | 1871 | 0x10140567, /* Thinkpad T43p 2668-G7U */ |
1872 | 0x10140581, /* Thinkpad X41-2527 */ | 1872 | 0x10140581, /* Thinkpad X41-2527 */ |
1873 | 0x10280160, /* Dell Dimension 2400 */ | ||
1873 | 0x104380b0, /* Asus A7V8X-MX */ | 1874 | 0x104380b0, /* Asus A7V8X-MX */ |
1874 | 0x11790241, /* Toshiba Satellite A-15 S127 */ | 1875 | 0x11790241, /* Toshiba Satellite A-15 S127 */ |
1875 | 0x144dc01a, /* Samsung NP-X20C004/SEG */ | 1876 | 0x144dc01a, /* Samsung NP-X20C004/SEG */ |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index d6752dff2a44..42b4fbbd8e2b 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -297,6 +297,7 @@ static struct pci_device_id snd_atiixp_ids[] = { | |||
297 | MODULE_DEVICE_TABLE(pci, snd_atiixp_ids); | 297 | MODULE_DEVICE_TABLE(pci, snd_atiixp_ids); |
298 | 298 | ||
299 | static struct snd_pci_quirk atiixp_quirks[] __devinitdata = { | 299 | static struct snd_pci_quirk atiixp_quirks[] __devinitdata = { |
300 | SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0), | ||
300 | SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0), | 301 | SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0), |
301 | { } /* terminator */ | 302 | { } /* terminator */ |
302 | }; | 303 | }; |
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c index 15523e60351c..0470461cc03e 100644 --- a/sound/pci/ca0106/ca0106_proc.c +++ b/sound/pci/ca0106/ca0106_proc.c | |||
@@ -233,7 +233,7 @@ static void snd_ca0106_proc_dump_iec958( struct snd_info_buffer *buffer, u32 val | |||
233 | snd_iprintf(buffer, "user-defined\n"); | 233 | snd_iprintf(buffer, "user-defined\n"); |
234 | break; | 234 | break; |
235 | default: | 235 | default: |
236 | snd_iprintf(buffer, "unkown\n"); | 236 | snd_iprintf(buffer, "unknown\n"); |
237 | break; | 237 | break; |
238 | } | 238 | } |
239 | snd_iprintf(buffer, "Sample Bits: "); | 239 | snd_iprintf(buffer, "Sample Bits: "); |
diff --git a/sound/pci/cs46xx/imgs/cwcdma.asp b/sound/pci/cs46xx/imgs/cwcdma.asp index 09d24c76f034..a65e1193c89a 100644 --- a/sound/pci/cs46xx/imgs/cwcdma.asp +++ b/sound/pci/cs46xx/imgs/cwcdma.asp | |||
@@ -26,10 +26,11 @@ | |||
26 | // | 26 | // |
27 | // | 27 | // |
28 | // The purpose of this code is very simple: make it possible to tranfser | 28 | // The purpose of this code is very simple: make it possible to tranfser |
29 | // the samples 'as they are' with no alteration from a PCMreader SCB (DMA from host) | 29 | // the samples 'as they are' with no alteration from a PCMreader |
30 | // to any other SCB. This is useful for AC3 throug SPDIF. SRC (source rate converters) | 30 | // SCB (DMA from host) to any other SCB. This is useful for AC3 through SPDIF. |
31 | // task always alters the samples in some how, however it's from 48khz -> 48khz. The | 31 | // SRC (source rate converters) task always alters the samples in somehow, |
32 | // alterations are not audible, but AC3 wont work. | 32 | // however it's from 48khz -> 48khz. |
33 | // The alterations are not audible, but AC3 wont work. | ||
33 | // | 34 | // |
34 | // ... | 35 | // ... |
35 | // | | 36 | // | |
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 | ||
5 | snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o | 5 | snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o |
6 | snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o | 6 | snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o |
7 | ifdef CONFIG_MGEODE_LX | ||
8 | snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o | 7 | snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o |
9 | endif | ||
10 | 8 | ||
11 | # Toplevel Module Dependency | 9 | # Toplevel Module Dependency |
12 | obj-$(CONFIG_SND_CS5535AUDIO) += snd-cs5535audio.o | 10 | obj-$(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 | ||
390 | static void __devexit snd_cs5535audio_remove(struct pci_dev *pci) | 390 | static 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); | |||
99 | int snd_cs5535audio_resume(struct pci_dev *pci); | 99 | int 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 |
103 | void __devinit olpc_prequirks(struct snd_card *card, | 103 | void __devinit olpc_prequirks(struct snd_card *card, |
104 | struct snd_ac97_template *ac97); | 104 | struct snd_ac97_template *ac97); |
105 | int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97); | 105 | int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97); |
106 | void __devexit olpc_quirks_cleanup(void); | ||
106 | void olpc_analog_input(struct snd_ac97 *ac97, int on); | 107 | void olpc_analog_input(struct snd_ac97 *ac97, int on); |
107 | void olpc_mic_bias(struct snd_ac97 *ac97, int on); | 108 | void 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 | } |
132 | static inline void olpc_quirks_cleanup(void) { } | ||
131 | static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { } | 133 | static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { } |
132 | static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { } | 134 | static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { } |
133 | static inline void olpc_capture_open(struct snd_ac97 *ac97) { } | 135 | static 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 | ||
74 | static int olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v) | 74 | static 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 | |||
188 | void __devexit olpc_quirks_cleanup(void) | ||
189 | { | ||
190 | gpio_free(OLPC_GPIO_MIC_AC); | ||
191 | } | ||
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index cb65bd0dd35b..459c1f62783b 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -166,18 +166,7 @@ static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm) | |||
166 | 166 | ||
167 | static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index) | 167 | static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index) |
168 | { | 168 | { |
169 | struct ct_vm *vm; | 169 | return atc->vm->get_ptp_phys(atc->vm, index); |
170 | void *kvirt_addr; | ||
171 | unsigned long phys_addr; | ||
172 | |||
173 | vm = atc->vm; | ||
174 | kvirt_addr = vm->get_ptp_virt(vm, index); | ||
175 | if (kvirt_addr == NULL) | ||
176 | phys_addr = (~0UL); | ||
177 | else | ||
178 | phys_addr = virt_to_phys(kvirt_addr); | ||
179 | |||
180 | return phys_addr; | ||
181 | } | 170 | } |
182 | 171 | ||
183 | static unsigned int convert_format(snd_pcm_format_t snd_format) | 172 | static unsigned int convert_format(snd_pcm_format_t snd_format) |
@@ -1669,7 +1658,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, | |||
1669 | } | 1658 | } |
1670 | 1659 | ||
1671 | /* Set up device virtual memory management object */ | 1660 | /* Set up device virtual memory management object */ |
1672 | err = ct_vm_create(&atc->vm); | 1661 | err = ct_vm_create(&atc->vm, pci); |
1673 | if (err < 0) | 1662 | if (err < 0) |
1674 | goto error1; | 1663 | goto error1; |
1675 | 1664 | ||
diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c index 6b78752e9503..65da6e466f80 100644 --- a/sound/pci/ctxfi/ctvmem.c +++ b/sound/pci/ctxfi/ctvmem.c | |||
@@ -138,7 +138,7 @@ ct_vm_map(struct ct_vm *vm, struct snd_pcm_substream *substream, int size) | |||
138 | return NULL; | 138 | return NULL; |
139 | } | 139 | } |
140 | 140 | ||
141 | ptp = vm->ptp[0]; | 141 | ptp = (unsigned long *)vm->ptp[0].area; |
142 | pte_start = (block->addr >> CT_PAGE_SHIFT); | 142 | pte_start = (block->addr >> CT_PAGE_SHIFT); |
143 | pages = block->size >> CT_PAGE_SHIFT; | 143 | pages = block->size >> CT_PAGE_SHIFT; |
144 | for (i = 0; i < pages; i++) { | 144 | for (i = 0; i < pages; i++) { |
@@ -158,25 +158,25 @@ static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block) | |||
158 | } | 158 | } |
159 | 159 | ||
160 | /* * | 160 | /* * |
161 | * return the host (kmalloced) addr of the @index-th device | 161 | * return the host physical addr of the @index-th device |
162 | * page talbe page on success, or NULL on failure. | 162 | * page table page on success, or ~0UL on failure. |
163 | * The first returned NULL indicates the termination. | 163 | * The first returned ~0UL indicates the termination. |
164 | * */ | 164 | * */ |
165 | static void * | 165 | static dma_addr_t |
166 | ct_get_ptp_virt(struct ct_vm *vm, int index) | 166 | ct_get_ptp_phys(struct ct_vm *vm, int index) |
167 | { | 167 | { |
168 | void *addr; | 168 | dma_addr_t addr; |
169 | 169 | ||
170 | addr = (index >= CT_PTP_NUM) ? NULL : vm->ptp[index]; | 170 | addr = (index >= CT_PTP_NUM) ? ~0UL : vm->ptp[index].addr; |
171 | 171 | ||
172 | return addr; | 172 | return addr; |
173 | } | 173 | } |
174 | 174 | ||
175 | int ct_vm_create(struct ct_vm **rvm) | 175 | int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci) |
176 | { | 176 | { |
177 | struct ct_vm *vm; | 177 | struct ct_vm *vm; |
178 | struct ct_vm_block *block; | 178 | struct ct_vm_block *block; |
179 | int i; | 179 | int i, err = 0; |
180 | 180 | ||
181 | *rvm = NULL; | 181 | *rvm = NULL; |
182 | 182 | ||
@@ -188,23 +188,21 @@ int ct_vm_create(struct ct_vm **rvm) | |||
188 | 188 | ||
189 | /* Allocate page table pages */ | 189 | /* Allocate page table pages */ |
190 | for (i = 0; i < CT_PTP_NUM; i++) { | 190 | for (i = 0; i < CT_PTP_NUM; i++) { |
191 | vm->ptp[i] = kmalloc(PAGE_SIZE, GFP_KERNEL); | 191 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
192 | if (!vm->ptp[i]) | 192 | snd_dma_pci_data(pci), |
193 | PAGE_SIZE, &vm->ptp[i]); | ||
194 | if (err < 0) | ||
193 | break; | 195 | break; |
194 | } | 196 | } |
195 | if (!i) { | 197 | if (err < 0) { |
196 | /* no page table pages are allocated */ | 198 | /* no page table pages are allocated */ |
197 | kfree(vm); | 199 | ct_vm_destroy(vm); |
198 | return -ENOMEM; | 200 | return -ENOMEM; |
199 | } | 201 | } |
200 | vm->size = CT_ADDRS_PER_PAGE * i; | 202 | vm->size = CT_ADDRS_PER_PAGE * i; |
201 | /* Initialise remaining ptps */ | ||
202 | for (; i < CT_PTP_NUM; i++) | ||
203 | vm->ptp[i] = NULL; | ||
204 | |||
205 | vm->map = ct_vm_map; | 203 | vm->map = ct_vm_map; |
206 | vm->unmap = ct_vm_unmap; | 204 | vm->unmap = ct_vm_unmap; |
207 | vm->get_ptp_virt = ct_get_ptp_virt; | 205 | vm->get_ptp_phys = ct_get_ptp_phys; |
208 | INIT_LIST_HEAD(&vm->unused); | 206 | INIT_LIST_HEAD(&vm->unused); |
209 | INIT_LIST_HEAD(&vm->used); | 207 | INIT_LIST_HEAD(&vm->used); |
210 | block = kzalloc(sizeof(*block), GFP_KERNEL); | 208 | block = kzalloc(sizeof(*block), GFP_KERNEL); |
@@ -242,7 +240,7 @@ void ct_vm_destroy(struct ct_vm *vm) | |||
242 | 240 | ||
243 | /* free allocated page table pages */ | 241 | /* free allocated page table pages */ |
244 | for (i = 0; i < CT_PTP_NUM; i++) | 242 | for (i = 0; i < CT_PTP_NUM; i++) |
245 | kfree(vm->ptp[i]); | 243 | snd_dma_free_pages(&vm->ptp[i]); |
246 | 244 | ||
247 | vm->size = 0; | 245 | vm->size = 0; |
248 | 246 | ||
diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h index 01e4fd0386a3..b23adfca4de6 100644 --- a/sound/pci/ctxfi/ctvmem.h +++ b/sound/pci/ctxfi/ctvmem.h | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/pci.h> | ||
26 | #include <sound/memalloc.h> | ||
25 | 27 | ||
26 | /* The chip can handle the page table of 4k pages | 28 | /* The chip can handle the page table of 4k pages |
27 | * (emu20k1 can handle even 8k pages, but we don't use it right now) | 29 | * (emu20k1 can handle even 8k pages, but we don't use it right now) |
@@ -41,7 +43,7 @@ struct snd_pcm_substream; | |||
41 | 43 | ||
42 | /* Virtual memory management object for card device */ | 44 | /* Virtual memory management object for card device */ |
43 | struct ct_vm { | 45 | struct ct_vm { |
44 | void *ptp[CT_PTP_NUM]; /* Device page table pages */ | 46 | struct snd_dma_buffer ptp[CT_PTP_NUM]; /* Device page table pages */ |
45 | unsigned int size; /* Available addr space in bytes */ | 47 | unsigned int size; /* Available addr space in bytes */ |
46 | struct list_head unused; /* List of unused blocks */ | 48 | struct list_head unused; /* List of unused blocks */ |
47 | struct list_head used; /* List of used blocks */ | 49 | struct list_head used; /* List of used blocks */ |
@@ -52,10 +54,10 @@ struct ct_vm { | |||
52 | int size); | 54 | int size); |
53 | /* Unmap device logical addr area. */ | 55 | /* Unmap device logical addr area. */ |
54 | void (*unmap)(struct ct_vm *, struct ct_vm_block *block); | 56 | void (*unmap)(struct ct_vm *, struct ct_vm_block *block); |
55 | void *(*get_ptp_virt)(struct ct_vm *vm, int index); | 57 | dma_addr_t (*get_ptp_phys)(struct ct_vm *vm, int index); |
56 | }; | 58 | }; |
57 | 59 | ||
58 | int ct_vm_create(struct ct_vm **rvm); | 60 | int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci); |
59 | void ct_vm_destroy(struct ct_vm *vm); | 61 | void ct_vm_destroy(struct ct_vm *vm); |
60 | 62 | ||
61 | #endif /* CTVMEM_H */ | 63 | #endif /* CTVMEM_H */ |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 6b8ae7b5cd54..1d369ff73805 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -184,7 +184,7 @@ MODULE_PARM_DESC(enable, "Enable the EMU10K1X soundcard."); | |||
184 | * The hardware has 3 channels for playback and 1 for capture. | 184 | * The hardware has 3 channels for playback and 1 for capture. |
185 | * - channel 0 is the front channel | 185 | * - channel 0 is the front channel |
186 | * - channel 1 is the rear channel | 186 | * - channel 1 is the rear channel |
187 | * - channel 2 is the center/lfe chanel | 187 | * - channel 2 is the center/lfe channel |
188 | * Volume is controlled by the AC97 for the front and rear channels by | 188 | * Volume is controlled by the AC97 for the front and rear channels by |
189 | * the PCM Playback Volume, Sigmatel Surround Playback Volume and | 189 | * the PCM Playback Volume, Sigmatel Surround Playback Volume and |
190 | * Surround Playback Volume. The Sigmatel 4-Speaker Stereo switch affects | 190 | * Surround Playback Volume. The Sigmatel 4-Speaker Stereo switch affects |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 5fe34a8d8c81..e4581a42ace5 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -42,7 +42,7 @@ static void snd_hda_generate_beep(struct work_struct *work) | |||
42 | return; | 42 | return; |
43 | 43 | ||
44 | /* generate tone */ | 44 | /* generate tone */ |
45 | snd_hda_codec_write_cache(codec, beep->nid, 0, | 45 | snd_hda_codec_write(codec, beep->nid, 0, |
46 | AC_VERB_SET_BEEP_CONTROL, beep->tone); | 46 | AC_VERB_SET_BEEP_CONTROL, beep->tone); |
47 | } | 47 | } |
48 | 48 | ||
@@ -119,7 +119,7 @@ static void snd_hda_do_detach(struct hda_beep *beep) | |||
119 | beep->dev = NULL; | 119 | beep->dev = NULL; |
120 | cancel_work_sync(&beep->beep_work); | 120 | cancel_work_sync(&beep->beep_work); |
121 | /* turn off beep for sure */ | 121 | /* turn off beep for sure */ |
122 | snd_hda_codec_write_cache(beep->codec, beep->nid, 0, | 122 | snd_hda_codec_write(beep->codec, beep->nid, 0, |
123 | AC_VERB_SET_BEEP_CONTROL, 0); | 123 | AC_VERB_SET_BEEP_CONTROL, 0); |
124 | } | 124 | } |
125 | 125 | ||
@@ -192,7 +192,7 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) | |||
192 | beep->enabled = enable; | 192 | beep->enabled = enable; |
193 | if (!enable) { | 193 | if (!enable) { |
194 | /* turn off beep */ | 194 | /* turn off beep */ |
195 | snd_hda_codec_write_cache(beep->codec, beep->nid, 0, | 195 | snd_hda_codec_write(beep->codec, beep->nid, 0, |
196 | AC_VERB_SET_BEEP_CONTROL, 0); | 196 | AC_VERB_SET_BEEP_CONTROL, 0); |
197 | } | 197 | } |
198 | if (beep->mode == HDA_BEEP_MODE_SWREG) { | 198 | if (beep->mode == HDA_BEEP_MODE_SWREG) { |
@@ -239,8 +239,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
239 | mutex_init(&beep->mutex); | 239 | mutex_init(&beep->mutex); |
240 | 240 | ||
241 | if (beep->mode == HDA_BEEP_MODE_ON) { | 241 | if (beep->mode == HDA_BEEP_MODE_ON) { |
242 | beep->enabled = 1; | 242 | int err = snd_hda_do_attach(beep); |
243 | snd_hda_do_register(&beep->register_work); | 243 | if (err < 0) { |
244 | kfree(beep); | ||
245 | codec->beep = NULL; | ||
246 | return err; | ||
247 | } | ||
244 | } | 248 | } |
245 | 249 | ||
246 | return 0; | 250 | return 0; |
@@ -253,7 +257,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec) | |||
253 | if (beep) { | 257 | if (beep) { |
254 | cancel_work_sync(&beep->register_work); | 258 | cancel_work_sync(&beep->register_work); |
255 | cancel_delayed_work(&beep->unregister_work); | 259 | cancel_delayed_work(&beep->unregister_work); |
256 | if (beep->enabled) | 260 | if (beep->dev) |
257 | snd_hda_do_detach(beep); | 261 | snd_hda_do_detach(beep); |
258 | codec->beep = NULL; | 262 | codec->beep = NULL; |
259 | kfree(beep); | 263 | kfree(beep); |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 9cfdb771928c..f98b47cd6cfb 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1086,11 +1086,6 @@ int snd_hda_codec_configure(struct hda_codec *codec) | |||
1086 | if (err < 0) | 1086 | if (err < 0) |
1087 | return err; | 1087 | return err; |
1088 | } | 1088 | } |
1089 | /* audio codec should override the mixer name */ | ||
1090 | if (codec->afg || !*codec->bus->card->mixername) | ||
1091 | snprintf(codec->bus->card->mixername, | ||
1092 | sizeof(codec->bus->card->mixername), | ||
1093 | "%s %s", codec->vendor_name, codec->chip_name); | ||
1094 | 1089 | ||
1095 | if (is_generic_config(codec)) { | 1090 | if (is_generic_config(codec)) { |
1096 | err = snd_hda_parse_generic_codec(codec); | 1091 | err = snd_hda_parse_generic_codec(codec); |
@@ -1109,6 +1104,11 @@ int snd_hda_codec_configure(struct hda_codec *codec) | |||
1109 | patched: | 1104 | patched: |
1110 | if (!err && codec->patch_ops.unsol_event) | 1105 | if (!err && codec->patch_ops.unsol_event) |
1111 | err = init_unsol_queue(codec->bus); | 1106 | err = init_unsol_queue(codec->bus); |
1107 | /* audio codec should override the mixer name */ | ||
1108 | if (!err && (codec->afg || !*codec->bus->card->mixername)) | ||
1109 | snprintf(codec->bus->card->mixername, | ||
1110 | sizeof(codec->bus->card->mixername), | ||
1111 | "%s %s", codec->vendor_name, codec->chip_name); | ||
1112 | return err; | 1112 | return err; |
1113 | } | 1113 | } |
1114 | EXPORT_SYMBOL_HDA(snd_hda_codec_configure); | 1114 | EXPORT_SYMBOL_HDA(snd_hda_codec_configure); |
@@ -1327,11 +1327,13 @@ EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps); | |||
1327 | */ | 1327 | */ |
1328 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) | 1328 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
1329 | { | 1329 | { |
1330 | u32 pincap = snd_hda_query_pin_caps(codec, nid); | 1330 | u32 pincap; |
1331 | |||
1332 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | ||
1333 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
1334 | 1331 | ||
1332 | if (!codec->no_trigger_sense) { | ||
1333 | pincap = snd_hda_query_pin_caps(codec, nid); | ||
1334 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | ||
1335 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
1336 | } | ||
1335 | return snd_hda_codec_read(codec, nid, 0, | 1337 | return snd_hda_codec_read(codec, nid, 0, |
1336 | AC_VERB_GET_PIN_SENSE, 0); | 1338 | AC_VERB_GET_PIN_SENSE, 0); |
1337 | } | 1339 | } |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 2d627613aea3..0a770a28e71f 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -255,9 +255,13 @@ enum { | |||
255 | * in HD-audio specification | 255 | * in HD-audio specification |
256 | */ | 256 | */ |
257 | #define AC_PINCAP_HDMI (1<<7) /* HDMI pin */ | 257 | #define AC_PINCAP_HDMI (1<<7) /* HDMI pin */ |
258 | #define AC_PINCAP_DP (1<<24) /* DisplayPort pin, can | ||
259 | * coexist with AC_PINCAP_HDMI | ||
260 | */ | ||
258 | #define AC_PINCAP_VREF (0x37<<8) | 261 | #define AC_PINCAP_VREF (0x37<<8) |
259 | #define AC_PINCAP_VREF_SHIFT 8 | 262 | #define AC_PINCAP_VREF_SHIFT 8 |
260 | #define AC_PINCAP_EAPD (1<<16) /* EAPD capable */ | 263 | #define AC_PINCAP_EAPD (1<<16) /* EAPD capable */ |
264 | #define AC_PINCAP_HBR (1<<27) /* High Bit Rate */ | ||
261 | /* Vref status (used in pin cap) */ | 265 | /* Vref status (used in pin cap) */ |
262 | #define AC_PINCAP_VREF_HIZ (1<<0) /* Hi-Z */ | 266 | #define AC_PINCAP_VREF_HIZ (1<<0) /* Hi-Z */ |
263 | #define AC_PINCAP_VREF_50 (1<<1) /* 50% */ | 267 | #define AC_PINCAP_VREF_50 (1<<1) /* 50% */ |
@@ -635,6 +639,7 @@ struct hda_bus { | |||
635 | unsigned int rirb_error:1; /* error in codec communication */ | 639 | unsigned int rirb_error:1; /* error in codec communication */ |
636 | unsigned int response_reset:1; /* controller was reset */ | 640 | unsigned int response_reset:1; /* controller was reset */ |
637 | unsigned int in_reset:1; /* during reset operation */ | 641 | unsigned int in_reset:1; /* during reset operation */ |
642 | unsigned int power_keep_link_on:1; /* don't power off HDA link */ | ||
638 | }; | 643 | }; |
639 | 644 | ||
640 | /* | 645 | /* |
@@ -812,6 +817,7 @@ struct hda_codec { | |||
812 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index | 817 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index |
813 | * (e.g. Conexant codecs) | 818 | * (e.g. Conexant codecs) |
814 | */ | 819 | */ |
820 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ | ||
815 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 821 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
816 | unsigned int power_on :1; /* current (global) power-state */ | 822 | unsigned int power_on :1; /* current (global) power-state */ |
817 | unsigned int power_transition :1; /* power-state in transition */ | 823 | unsigned int power_transition :1; /* power-state in transition */ |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index d24328661c6a..40ccb419b6e9 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/compat.h> | 24 | #include <linux/compat.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/string.h> | ||
27 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include "hda_codec.h" | 30 | #include "hda_codec.h" |
@@ -428,8 +429,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf) | |||
428 | char *key, *val; | 429 | char *key, *val; |
429 | struct hda_hint *hint; | 430 | struct hda_hint *hint; |
430 | 431 | ||
431 | while (isspace(*buf)) | 432 | buf = skip_spaces(buf); |
432 | buf++; | ||
433 | if (!*buf || *buf == '#' || *buf == '\n') | 433 | if (!*buf || *buf == '#' || *buf == '\n') |
434 | return 0; | 434 | return 0; |
435 | if (*buf == '=') | 435 | if (*buf == '=') |
@@ -444,8 +444,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf) | |||
444 | return -EINVAL; | 444 | return -EINVAL; |
445 | } | 445 | } |
446 | *val++ = 0; | 446 | *val++ = 0; |
447 | while (isspace(*val)) | 447 | val = skip_spaces(val); |
448 | val++; | ||
449 | remove_trail_spaces(key); | 448 | remove_trail_spaces(key); |
450 | remove_trail_spaces(val); | 449 | remove_trail_spaces(val); |
451 | hint = get_hint(codec, key); | 450 | hint = get_hint(codec, key); |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index d822bfc6cad6..ff6da6f386d1 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; |
@@ -425,6 +426,7 @@ struct azx { | |||
425 | 426 | ||
426 | /* flags */ | 427 | /* flags */ |
427 | int position_fix; | 428 | int position_fix; |
429 | int poll_count; | ||
428 | unsigned int running :1; | 430 | unsigned int running :1; |
429 | unsigned int initialized :1; | 431 | unsigned int initialized :1; |
430 | unsigned int single_cmd :1; | 432 | unsigned int single_cmd :1; |
@@ -505,7 +507,7 @@ static char *driver_short_names[] __devinitdata = { | |||
505 | #define get_azx_dev(substream) (substream->runtime->private_data) | 507 | #define get_azx_dev(substream) (substream->runtime->private_data) |
506 | 508 | ||
507 | static int azx_acquire_irq(struct azx *chip, int do_disconnect); | 509 | static int azx_acquire_irq(struct azx *chip, int do_disconnect); |
508 | 510 | static int azx_send_cmd(struct hda_bus *bus, unsigned int val); | |
509 | /* | 511 | /* |
510 | * Interface for HD codec | 512 | * Interface for HD codec |
511 | */ | 513 | */ |
@@ -663,11 +665,12 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus, | |||
663 | { | 665 | { |
664 | struct azx *chip = bus->private_data; | 666 | struct azx *chip = bus->private_data; |
665 | unsigned long timeout; | 667 | unsigned long timeout; |
668 | int do_poll = 0; | ||
666 | 669 | ||
667 | again: | 670 | again: |
668 | timeout = jiffies + msecs_to_jiffies(1000); | 671 | timeout = jiffies + msecs_to_jiffies(1000); |
669 | for (;;) { | 672 | for (;;) { |
670 | if (chip->polling_mode) { | 673 | if (chip->polling_mode || do_poll) { |
671 | spin_lock_irq(&chip->reg_lock); | 674 | spin_lock_irq(&chip->reg_lock); |
672 | azx_update_rirb(chip); | 675 | azx_update_rirb(chip); |
673 | spin_unlock_irq(&chip->reg_lock); | 676 | spin_unlock_irq(&chip->reg_lock); |
@@ -675,6 +678,9 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus, | |||
675 | if (!chip->rirb.cmds[addr]) { | 678 | if (!chip->rirb.cmds[addr]) { |
676 | smp_rmb(); | 679 | smp_rmb(); |
677 | bus->rirb_error = 0; | 680 | bus->rirb_error = 0; |
681 | |||
682 | if (!do_poll) | ||
683 | chip->poll_count = 0; | ||
678 | return chip->rirb.res[addr]; /* the last value */ | 684 | return chip->rirb.res[addr]; /* the last value */ |
679 | } | 685 | } |
680 | if (time_after(jiffies, timeout)) | 686 | if (time_after(jiffies, timeout)) |
@@ -687,6 +693,16 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus, | |||
687 | } | 693 | } |
688 | } | 694 | } |
689 | 695 | ||
696 | if (!chip->polling_mode && chip->poll_count < 2) { | ||
697 | snd_printdd(SFX "azx_get_response timeout, " | ||
698 | "polling the codec once: last cmd=0x%08x\n", | ||
699 | chip->last_cmd[addr]); | ||
700 | do_poll = 1; | ||
701 | chip->poll_count++; | ||
702 | goto again; | ||
703 | } | ||
704 | |||
705 | |||
690 | if (!chip->polling_mode) { | 706 | if (!chip->polling_mode) { |
691 | snd_printk(KERN_WARNING SFX "azx_get_response timeout, " | 707 | snd_printk(KERN_WARNING SFX "azx_get_response timeout, " |
692 | "switching to polling mode: last cmd=0x%08x\n", | 708 | "switching to polling mode: last cmd=0x%08x\n", |
@@ -1441,10 +1457,13 @@ static int __devinit azx_codec_configure(struct azx *chip) | |||
1441 | */ | 1457 | */ |
1442 | 1458 | ||
1443 | /* assign a stream for the PCM */ | 1459 | /* assign a stream for the PCM */ |
1444 | static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) | 1460 | static inline struct azx_dev * |
1461 | azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) | ||
1445 | { | 1462 | { |
1446 | int dev, i, nums; | 1463 | int dev, i, nums; |
1447 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { | 1464 | struct azx_dev *res = NULL; |
1465 | |||
1466 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
1448 | dev = chip->playback_index_offset; | 1467 | dev = chip->playback_index_offset; |
1449 | nums = chip->playback_streams; | 1468 | nums = chip->playback_streams; |
1450 | } else { | 1469 | } else { |
@@ -1453,10 +1472,15 @@ static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) | |||
1453 | } | 1472 | } |
1454 | for (i = 0; i < nums; i++, dev++) | 1473 | for (i = 0; i < nums; i++, dev++) |
1455 | if (!chip->azx_dev[dev].opened) { | 1474 | if (!chip->azx_dev[dev].opened) { |
1456 | chip->azx_dev[dev].opened = 1; | 1475 | res = &chip->azx_dev[dev]; |
1457 | return &chip->azx_dev[dev]; | 1476 | if (res->device == substream->pcm->device) |
1477 | break; | ||
1458 | } | 1478 | } |
1459 | return NULL; | 1479 | if (res) { |
1480 | res->opened = 1; | ||
1481 | res->device = substream->pcm->device; | ||
1482 | } | ||
1483 | return res; | ||
1460 | } | 1484 | } |
1461 | 1485 | ||
1462 | /* release the assigned stream */ | 1486 | /* release the assigned stream */ |
@@ -1505,7 +1529,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1505 | int err; | 1529 | int err; |
1506 | 1530 | ||
1507 | mutex_lock(&chip->open_mutex); | 1531 | mutex_lock(&chip->open_mutex); |
1508 | azx_dev = azx_assign_device(chip, substream->stream); | 1532 | azx_dev = azx_assign_device(chip, substream); |
1509 | if (azx_dev == NULL) { | 1533 | if (azx_dev == NULL) { |
1510 | mutex_unlock(&chip->open_mutex); | 1534 | mutex_unlock(&chip->open_mutex); |
1511 | return -EBUSY; | 1535 | return -EBUSY; |
@@ -1869,6 +1893,9 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) | |||
1869 | 1893 | ||
1870 | if (!bdl_pos_adj[chip->dev_index]) | 1894 | if (!bdl_pos_adj[chip->dev_index]) |
1871 | return 1; /* no delayed ack */ | 1895 | return 1; /* no delayed ack */ |
1896 | if (WARN_ONCE(!azx_dev->period_bytes, | ||
1897 | "hda-intel: zero azx_dev->period_bytes")) | ||
1898 | return 0; /* this shouldn't happen! */ | ||
1872 | if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) | 1899 | if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) |
1873 | return 0; /* NG - it's below the period boundary */ | 1900 | return 0; /* NG - it's below the period boundary */ |
1874 | return 1; /* OK, it's fine */ | 1901 | return 1; /* OK, it's fine */ |
@@ -2034,7 +2061,7 @@ static int azx_acquire_irq(struct azx *chip, int do_disconnect) | |||
2034 | { | 2061 | { |
2035 | if (request_irq(chip->pci->irq, azx_interrupt, | 2062 | if (request_irq(chip->pci->irq, azx_interrupt, |
2036 | chip->msi ? 0 : IRQF_SHARED, | 2063 | chip->msi ? 0 : IRQF_SHARED, |
2037 | "HDA Intel", chip)) { | 2064 | "hda_intel", chip)) { |
2038 | printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " | 2065 | printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " |
2039 | "disabling device\n", chip->pci->irq); | 2066 | "disabling device\n", chip->pci->irq); |
2040 | if (do_disconnect) | 2067 | if (do_disconnect) |
@@ -2082,7 +2109,8 @@ static void azx_power_notify(struct hda_bus *bus) | |||
2082 | } | 2109 | } |
2083 | if (power_on) | 2110 | if (power_on) |
2084 | azx_init_chip(chip); | 2111 | azx_init_chip(chip); |
2085 | else if (chip->running && power_save_controller) | 2112 | else if (chip->running && power_save_controller && |
2113 | !bus->power_keep_link_on) | ||
2086 | azx_stop_chip(chip); | 2114 | azx_stop_chip(chip); |
2087 | } | 2115 | } |
2088 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | 2116 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
@@ -2321,6 +2349,8 @@ static void __devinit check_probe_mask(struct azx *chip, int dev) | |||
2321 | * white/black-list for enable_msi | 2349 | * white/black-list for enable_msi |
2322 | */ | 2350 | */ |
2323 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { | 2351 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { |
2352 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ | ||
2353 | SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ | ||
2324 | {} | 2354 | {} |
2325 | }; | 2355 | }; |
2326 | 2356 | ||
@@ -2450,6 +2480,11 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2450 | } | 2480 | } |
2451 | } | 2481 | } |
2452 | 2482 | ||
2483 | /* disable 64bit DMA address for Teradici */ | ||
2484 | /* it does not work with device 6549:1200 subsys e4a2:040b */ | ||
2485 | if (chip->driver_type == AZX_DRIVER_TERA) | ||
2486 | gcap &= ~ICH6_GCAP_64OK; | ||
2487 | |||
2453 | /* allow 64bit DMA address if supported by H/W */ | 2488 | /* allow 64bit DMA address if supported by H/W */ |
2454 | if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) | 2489 | if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) |
2455 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); | 2490 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); |
@@ -2707,6 +2742,9 @@ static struct pci_device_id azx_ids[] = { | |||
2707 | { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, | 2742 | { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, |
2708 | { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, | 2743 | { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, |
2709 | { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, | 2744 | { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, |
2745 | { PCI_DEVICE(0x10de, 0x0be2), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2746 | { PCI_DEVICE(0x10de, 0x0be3), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2747 | { PCI_DEVICE(0x10de, 0x0be4), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2710 | { PCI_DEVICE(0x10de, 0x0d94), .driver_data = AZX_DRIVER_NVIDIA }, | 2748 | { PCI_DEVICE(0x10de, 0x0d94), .driver_data = AZX_DRIVER_NVIDIA }, |
2711 | { PCI_DEVICE(0x10de, 0x0d95), .driver_data = AZX_DRIVER_NVIDIA }, | 2749 | { PCI_DEVICE(0x10de, 0x0d95), .driver_data = AZX_DRIVER_NVIDIA }, |
2712 | { PCI_DEVICE(0x10de, 0x0d96), .driver_data = AZX_DRIVER_NVIDIA }, | 2750 | { PCI_DEVICE(0x10de, 0x0d96), .driver_data = AZX_DRIVER_NVIDIA }, |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 09476fc1ab64..c9afc04adac8 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -240,9 +240,14 @@ static void print_pin_caps(struct snd_info_buffer *buffer, | |||
240 | /* Realtek uses this bit as a different meaning */ | 240 | /* Realtek uses this bit as a different meaning */ |
241 | if ((codec->vendor_id >> 16) == 0x10ec) | 241 | if ((codec->vendor_id >> 16) == 0x10ec) |
242 | snd_iprintf(buffer, " R/L"); | 242 | snd_iprintf(buffer, " R/L"); |
243 | else | 243 | else { |
244 | if (caps & AC_PINCAP_HBR) | ||
245 | snd_iprintf(buffer, " HBR"); | ||
244 | snd_iprintf(buffer, " HDMI"); | 246 | snd_iprintf(buffer, " HDMI"); |
247 | } | ||
245 | } | 248 | } |
249 | if (caps & AC_PINCAP_DP) | ||
250 | snd_iprintf(buffer, " DP"); | ||
246 | if (caps & AC_PINCAP_TRIG_REQ) | 251 | if (caps & AC_PINCAP_TRIG_REQ) |
247 | snd_iprintf(buffer, " Trigger"); | 252 | snd_iprintf(buffer, " Trigger"); |
248 | if (caps & AC_PINCAP_IMP_SENSE) | 253 | if (caps & AC_PINCAP_IMP_SENSE) |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 455a0494f907..69a941c7b158 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -72,7 +72,8 @@ struct ad198x_spec { | |||
72 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | 72 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
73 | 73 | ||
74 | unsigned int jack_present :1; | 74 | unsigned int jack_present :1; |
75 | unsigned int inv_jack_detect:1; | 75 | unsigned int inv_jack_detect:1; /* inverted jack-detection */ |
76 | unsigned int inv_eapd:1; /* inverted EAPD implementation */ | ||
76 | 77 | ||
77 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 78 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
78 | struct hda_loopback_check loopback; | 79 | struct hda_loopback_check loopback; |
@@ -458,7 +459,7 @@ static struct hda_codec_ops ad198x_patch_ops = { | |||
458 | 459 | ||
459 | /* | 460 | /* |
460 | * EAPD control | 461 | * EAPD control |
461 | * the private value = nid | (invert << 8) | 462 | * the private value = nid |
462 | */ | 463 | */ |
463 | #define ad198x_eapd_info snd_ctl_boolean_mono_info | 464 | #define ad198x_eapd_info snd_ctl_boolean_mono_info |
464 | 465 | ||
@@ -467,8 +468,7 @@ static int ad198x_eapd_get(struct snd_kcontrol *kcontrol, | |||
467 | { | 468 | { |
468 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 469 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
469 | struct ad198x_spec *spec = codec->spec; | 470 | struct ad198x_spec *spec = codec->spec; |
470 | int invert = (kcontrol->private_value >> 8) & 1; | 471 | if (spec->inv_eapd) |
471 | if (invert) | ||
472 | ucontrol->value.integer.value[0] = ! spec->cur_eapd; | 472 | ucontrol->value.integer.value[0] = ! spec->cur_eapd; |
473 | else | 473 | else |
474 | ucontrol->value.integer.value[0] = spec->cur_eapd; | 474 | ucontrol->value.integer.value[0] = spec->cur_eapd; |
@@ -480,11 +480,10 @@ static int ad198x_eapd_put(struct snd_kcontrol *kcontrol, | |||
480 | { | 480 | { |
481 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 481 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
482 | struct ad198x_spec *spec = codec->spec; | 482 | struct ad198x_spec *spec = codec->spec; |
483 | int invert = (kcontrol->private_value >> 8) & 1; | ||
484 | hda_nid_t nid = kcontrol->private_value & 0xff; | 483 | hda_nid_t nid = kcontrol->private_value & 0xff; |
485 | unsigned int eapd; | 484 | unsigned int eapd; |
486 | eapd = !!ucontrol->value.integer.value[0]; | 485 | eapd = !!ucontrol->value.integer.value[0]; |
487 | if (invert) | 486 | if (spec->inv_eapd) |
488 | eapd = !eapd; | 487 | eapd = !eapd; |
489 | if (eapd == spec->cur_eapd) | 488 | if (eapd == spec->cur_eapd) |
490 | return 0; | 489 | return 0; |
@@ -705,7 +704,7 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { | |||
705 | .info = ad198x_eapd_info, | 704 | .info = ad198x_eapd_info, |
706 | .get = ad198x_eapd_get, | 705 | .get = ad198x_eapd_get, |
707 | .put = ad198x_eapd_put, | 706 | .put = ad198x_eapd_put, |
708 | .private_value = 0x1b | (1 << 8), /* port-D, inversed */ | 707 | .private_value = 0x1b, /* port-D */ |
709 | }, | 708 | }, |
710 | { } /* end */ | 709 | { } /* end */ |
711 | }; | 710 | }; |
@@ -1074,6 +1073,7 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
1074 | spec->loopback.amplist = ad1986a_loopbacks; | 1073 | spec->loopback.amplist = ad1986a_loopbacks; |
1075 | #endif | 1074 | #endif |
1076 | spec->vmaster_nid = 0x1b; | 1075 | spec->vmaster_nid = 0x1b; |
1076 | spec->inv_eapd = 1; /* AD1986A has the inverted EAPD implementation */ | ||
1077 | 1077 | ||
1078 | codec->patch_ops = ad198x_patch_ops; | 1078 | codec->patch_ops = ad198x_patch_ops; |
1079 | 1079 | ||
@@ -1186,6 +1186,8 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
1186 | */ | 1186 | */ |
1187 | spec->multiout.no_share_stream = 1; | 1187 | spec->multiout.no_share_stream = 1; |
1188 | 1188 | ||
1189 | codec->no_trigger_sense = 1; | ||
1190 | |||
1189 | return 0; | 1191 | return 0; |
1190 | } | 1192 | } |
1191 | 1193 | ||
@@ -1371,6 +1373,8 @@ static int patch_ad1983(struct hda_codec *codec) | |||
1371 | 1373 | ||
1372 | codec->patch_ops = ad198x_patch_ops; | 1374 | codec->patch_ops = ad198x_patch_ops; |
1373 | 1375 | ||
1376 | codec->no_trigger_sense = 1; | ||
1377 | |||
1374 | return 0; | 1378 | return 0; |
1375 | } | 1379 | } |
1376 | 1380 | ||
@@ -1789,6 +1793,14 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1789 | 1793 | ||
1790 | codec->patch_ops.init = ad1981_hp_init; | 1794 | codec->patch_ops.init = ad1981_hp_init; |
1791 | codec->patch_ops.unsol_event = ad1981_hp_unsol_event; | 1795 | codec->patch_ops.unsol_event = ad1981_hp_unsol_event; |
1796 | /* set the upper-limit for mixer amp to 0dB for avoiding the | ||
1797 | * possible damage by overloading | ||
1798 | */ | ||
1799 | snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT, | ||
1800 | (0x17 << AC_AMPCAP_OFFSET_SHIFT) | | ||
1801 | (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
1802 | (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
1803 | (1 << AC_AMPCAP_MUTE_SHIFT)); | ||
1792 | break; | 1804 | break; |
1793 | case AD1981_THINKPAD: | 1805 | case AD1981_THINKPAD: |
1794 | spec->mixers[0] = ad1981_thinkpad_mixers; | 1806 | spec->mixers[0] = ad1981_thinkpad_mixers; |
@@ -1805,6 +1817,9 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1805 | codec->patch_ops.unsol_event = ad1981_hp_unsol_event; | 1817 | codec->patch_ops.unsol_event = ad1981_hp_unsol_event; |
1806 | break; | 1818 | break; |
1807 | } | 1819 | } |
1820 | |||
1821 | codec->no_trigger_sense = 1; | ||
1822 | |||
1808 | return 0; | 1823 | return 0; |
1809 | } | 1824 | } |
1810 | 1825 | ||
@@ -2124,7 +2139,7 @@ static struct snd_kcontrol_new ad1988_laptop_mixers[] = { | |||
2124 | .info = ad198x_eapd_info, | 2139 | .info = ad198x_eapd_info, |
2125 | .get = ad198x_eapd_get, | 2140 | .get = ad198x_eapd_get, |
2126 | .put = ad198x_eapd_put, | 2141 | .put = ad198x_eapd_put, |
2127 | .private_value = 0x12 | (1 << 8), /* port-D, inversed */ | 2142 | .private_value = 0x12, /* port-D */ |
2128 | }, | 2143 | }, |
2129 | 2144 | ||
2130 | { } /* end */ | 2145 | { } /* end */ |
@@ -3065,6 +3080,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
3065 | spec->input_mux = &ad1988_laptop_capture_source; | 3080 | spec->input_mux = &ad1988_laptop_capture_source; |
3066 | spec->num_mixers = 1; | 3081 | spec->num_mixers = 1; |
3067 | spec->mixers[0] = ad1988_laptop_mixers; | 3082 | spec->mixers[0] = ad1988_laptop_mixers; |
3083 | spec->inv_eapd = 1; /* inverted EAPD */ | ||
3068 | spec->num_init_verbs = 1; | 3084 | spec->num_init_verbs = 1; |
3069 | spec->init_verbs[0] = ad1988_laptop_init_verbs; | 3085 | spec->init_verbs[0] = ad1988_laptop_init_verbs; |
3070 | if (board_config == AD1988_LAPTOP_DIG) | 3086 | if (board_config == AD1988_LAPTOP_DIG) |
@@ -3109,6 +3125,8 @@ static int patch_ad1988(struct hda_codec *codec) | |||
3109 | #endif | 3125 | #endif |
3110 | spec->vmaster_nid = 0x04; | 3126 | spec->vmaster_nid = 0x04; |
3111 | 3127 | ||
3128 | codec->no_trigger_sense = 1; | ||
3129 | |||
3112 | return 0; | 3130 | return 0; |
3113 | } | 3131 | } |
3114 | 3132 | ||
@@ -3321,6 +3339,8 @@ static int patch_ad1884(struct hda_codec *codec) | |||
3321 | 3339 | ||
3322 | codec->patch_ops = ad198x_patch_ops; | 3340 | codec->patch_ops = ad198x_patch_ops; |
3323 | 3341 | ||
3342 | codec->no_trigger_sense = 1; | ||
3343 | |||
3324 | return 0; | 3344 | return 0; |
3325 | } | 3345 | } |
3326 | 3346 | ||
@@ -4278,6 +4298,8 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
4278 | break; | 4298 | break; |
4279 | } | 4299 | } |
4280 | 4300 | ||
4301 | codec->no_trigger_sense = 1; | ||
4302 | |||
4281 | return 0; | 4303 | return 0; |
4282 | } | 4304 | } |
4283 | 4305 | ||
@@ -4614,6 +4636,9 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4614 | spec->mixers[2] = ad1882_6stack_mixers; | 4636 | spec->mixers[2] = ad1882_6stack_mixers; |
4615 | break; | 4637 | break; |
4616 | } | 4638 | } |
4639 | |||
4640 | codec->no_trigger_sense = 1; | ||
4641 | |||
4617 | return 0; | 4642 | return 0; |
4618 | } | 4643 | } |
4619 | 4644 | ||
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 2439e84dcb21..fe0423c39598 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -66,6 +66,7 @@ struct cs_spec { | |||
66 | /* available models */ | 66 | /* available models */ |
67 | enum { | 67 | enum { |
68 | CS420X_MBP55, | 68 | CS420X_MBP55, |
69 | CS420X_IMAC27, | ||
69 | CS420X_AUTO, | 70 | CS420X_AUTO, |
70 | CS420X_MODELS | 71 | CS420X_MODELS |
71 | }; | 72 | }; |
@@ -827,7 +828,8 @@ static void cs_automute(struct hda_codec *codec) | |||
827 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 828 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
828 | hp_present ? 0 : PIN_OUT); | 829 | hp_present ? 0 : PIN_OUT); |
829 | } | 830 | } |
830 | if (spec->board_config == CS420X_MBP55) { | 831 | if (spec->board_config == CS420X_MBP55 || |
832 | spec->board_config == CS420X_IMAC27) { | ||
831 | unsigned int gpio = hp_present ? 0x02 : 0x08; | 833 | unsigned int gpio = hp_present ? 0x02 : 0x08; |
832 | snd_hda_codec_write(codec, 0x01, 0, | 834 | snd_hda_codec_write(codec, 0x01, 0, |
833 | AC_VERB_SET_GPIO_DATA, gpio); | 835 | AC_VERB_SET_GPIO_DATA, gpio); |
@@ -938,7 +940,7 @@ static void init_input(struct hda_codec *codec) | |||
938 | coef |= 0x0500; /* DMIC2 enable 2 channels, disable GPIO1 */ | 940 | coef |= 0x0500; /* DMIC2 enable 2 channels, disable GPIO1 */ |
939 | if (is_active_pin(codec, CS_DMIC1_PIN_NID)) | 941 | if (is_active_pin(codec, CS_DMIC1_PIN_NID)) |
940 | coef |= 0x1800; /* DMIC1 enable 2 channels, disable GPIO0 | 942 | coef |= 0x1800; /* DMIC1 enable 2 channels, disable GPIO0 |
941 | * No effect if SPDIF_OUT2 is slected in | 943 | * No effect if SPDIF_OUT2 is selected in |
942 | * IDX_SPDIF_CTL. | 944 | * IDX_SPDIF_CTL. |
943 | */ | 945 | */ |
944 | cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); | 946 | cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); |
@@ -1069,12 +1071,14 @@ static int cs_parse_auto_config(struct hda_codec *codec) | |||
1069 | 1071 | ||
1070 | static const char *cs420x_models[CS420X_MODELS] = { | 1072 | static const char *cs420x_models[CS420X_MODELS] = { |
1071 | [CS420X_MBP55] = "mbp55", | 1073 | [CS420X_MBP55] = "mbp55", |
1074 | [CS420X_IMAC27] = "imac27", | ||
1072 | [CS420X_AUTO] = "auto", | 1075 | [CS420X_AUTO] = "auto", |
1073 | }; | 1076 | }; |
1074 | 1077 | ||
1075 | 1078 | ||
1076 | static struct snd_pci_quirk cs420x_cfg_tbl[] = { | 1079 | static struct snd_pci_quirk cs420x_cfg_tbl[] = { |
1077 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), | 1080 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), |
1081 | SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27), | ||
1078 | {} /* terminator */ | 1082 | {} /* terminator */ |
1079 | }; | 1083 | }; |
1080 | 1084 | ||
@@ -1097,8 +1101,23 @@ static struct cs_pincfg mbp55_pincfgs[] = { | |||
1097 | {} /* terminator */ | 1101 | {} /* terminator */ |
1098 | }; | 1102 | }; |
1099 | 1103 | ||
1104 | static struct cs_pincfg imac27_pincfgs[] = { | ||
1105 | { 0x09, 0x012b4050 }, | ||
1106 | { 0x0a, 0x90100140 }, | ||
1107 | { 0x0b, 0x90100142 }, | ||
1108 | { 0x0c, 0x018b3020 }, | ||
1109 | { 0x0d, 0x90a00110 }, | ||
1110 | { 0x0e, 0x400000f0 }, | ||
1111 | { 0x0f, 0x01cbe030 }, | ||
1112 | { 0x10, 0x014be060 }, | ||
1113 | { 0x12, 0x01ab9070 }, | ||
1114 | { 0x15, 0x400000f0 }, | ||
1115 | {} /* terminator */ | ||
1116 | }; | ||
1117 | |||
1100 | static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { | 1118 | static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { |
1101 | [CS420X_MBP55] = mbp55_pincfgs, | 1119 | [CS420X_MBP55] = mbp55_pincfgs, |
1120 | [CS420X_IMAC27] = imac27_pincfgs, | ||
1102 | }; | 1121 | }; |
1103 | 1122 | ||
1104 | static void fix_pincfg(struct hda_codec *codec, int model) | 1123 | static void fix_pincfg(struct hda_codec *codec, int model) |
@@ -1128,6 +1147,7 @@ static int patch_cs420x(struct hda_codec *codec) | |||
1128 | fix_pincfg(codec, spec->board_config); | 1147 | fix_pincfg(codec, spec->board_config); |
1129 | 1148 | ||
1130 | switch (spec->board_config) { | 1149 | switch (spec->board_config) { |
1150 | case CS420X_IMAC27: | ||
1131 | case CS420X_MBP55: | 1151 | case CS420X_MBP55: |
1132 | /* GPIO1 = headphones */ | 1152 | /* GPIO1 = headphones */ |
1133 | /* GPIO3 = speakers */ | 1153 | /* GPIO3 = speakers */ |
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index 85c81feb10cf..a45c1169762b 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -66,7 +66,7 @@ struct cmi_spec { | |||
66 | 66 | ||
67 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 67 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
68 | 68 | ||
69 | /* pin deafault configuration */ | 69 | /* pin default configuration */ |
70 | hda_nid_t pin_nid[NUM_PINS]; | 70 | hda_nid_t pin_nid[NUM_PINS]; |
71 | unsigned int def_conf[NUM_PINS]; | 71 | unsigned int def_conf[NUM_PINS]; |
72 | unsigned int pin_def_confs; | 72 | unsigned int pin_def_confs; |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index a09c03c3f62b..c578c28f368e 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include "hda_codec.h" | 30 | #include "hda_codec.h" |
31 | #include "hda_local.h" | 31 | #include "hda_local.h" |
32 | #include "hda_beep.h" | ||
32 | 33 | ||
33 | #define CXT_PIN_DIR_IN 0x00 | 34 | #define CXT_PIN_DIR_IN 0x00 |
34 | #define CXT_PIN_DIR_OUT 0x01 | 35 | #define CXT_PIN_DIR_OUT 0x01 |
@@ -111,6 +112,7 @@ struct conexant_spec { | |||
111 | unsigned int dell_automute; | 112 | unsigned int dell_automute; |
112 | unsigned int port_d_mode; | 113 | unsigned int port_d_mode; |
113 | unsigned char ext_mic_bias; | 114 | unsigned char ext_mic_bias; |
115 | unsigned int dell_vostro; | ||
114 | }; | 116 | }; |
115 | 117 | ||
116 | static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, | 118 | static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, |
@@ -476,6 +478,7 @@ static void conexant_free(struct hda_codec *codec) | |||
476 | snd_array_free(&spec->jacks); | 478 | snd_array_free(&spec->jacks); |
477 | } | 479 | } |
478 | #endif | 480 | #endif |
481 | snd_hda_detach_beep_device(codec); | ||
479 | kfree(codec->spec); | 482 | kfree(codec->spec); |
480 | } | 483 | } |
481 | 484 | ||
@@ -2109,9 +2112,12 @@ static int cxt5066_mic_boost_mux_enum_get(struct snd_kcontrol *kcontrol, | |||
2109 | { | 2112 | { |
2110 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2113 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2111 | int val; | 2114 | int val; |
2115 | hda_nid_t nid = kcontrol->private_value & 0xff; | ||
2116 | int inout = (kcontrol->private_value & 0x100) ? | ||
2117 | AC_AMP_GET_INPUT : AC_AMP_GET_OUTPUT; | ||
2112 | 2118 | ||
2113 | val = snd_hda_codec_read(codec, 0x17, 0, | 2119 | val = snd_hda_codec_read(codec, nid, 0, |
2114 | AC_VERB_GET_AMP_GAIN_MUTE, AC_AMP_GET_OUTPUT); | 2120 | AC_VERB_GET_AMP_GAIN_MUTE, inout); |
2115 | 2121 | ||
2116 | ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; | 2122 | ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; |
2117 | return 0; | 2123 | return 0; |
@@ -2123,6 +2129,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
2123 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2129 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2124 | const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; | 2130 | const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; |
2125 | unsigned int idx; | 2131 | unsigned int idx; |
2132 | hda_nid_t nid = kcontrol->private_value & 0xff; | ||
2133 | int inout = (kcontrol->private_value & 0x100) ? | ||
2134 | AC_AMP_SET_INPUT : AC_AMP_SET_OUTPUT; | ||
2126 | 2135 | ||
2127 | if (!imux->num_items) | 2136 | if (!imux->num_items) |
2128 | return 0; | 2137 | return 0; |
@@ -2130,9 +2139,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
2130 | if (idx >= imux->num_items) | 2139 | if (idx >= imux->num_items) |
2131 | idx = imux->num_items - 1; | 2140 | idx = imux->num_items - 1; |
2132 | 2141 | ||
2133 | snd_hda_codec_write_cache(codec, 0x17, 0, | 2142 | snd_hda_codec_write_cache(codec, nid, 0, |
2134 | AC_VERB_SET_AMP_GAIN_MUTE, | 2143 | AC_VERB_SET_AMP_GAIN_MUTE, |
2135 | AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | AC_AMP_SET_OUTPUT | | 2144 | AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | inout | |
2136 | imux->items[idx].index); | 2145 | imux->items[idx].index); |
2137 | 2146 | ||
2138 | return 1; | 2147 | return 1; |
@@ -2201,10 +2210,11 @@ static struct snd_kcontrol_new cxt5066_mixers[] = { | |||
2201 | 2210 | ||
2202 | { | 2211 | { |
2203 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2204 | .name = "Analog Mic Boost Capture Enum", | 2213 | .name = "Ext Mic Boost Capture Enum", |
2205 | .info = cxt5066_mic_boost_mux_enum_info, | 2214 | .info = cxt5066_mic_boost_mux_enum_info, |
2206 | .get = cxt5066_mic_boost_mux_enum_get, | 2215 | .get = cxt5066_mic_boost_mux_enum_get, |
2207 | .put = cxt5066_mic_boost_mux_enum_put, | 2216 | .put = cxt5066_mic_boost_mux_enum_put, |
2217 | .private_value = 0x17, | ||
2208 | }, | 2218 | }, |
2209 | 2219 | ||
2210 | HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), | 2220 | HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), |
@@ -2212,6 +2222,19 @@ static struct snd_kcontrol_new cxt5066_mixers[] = { | |||
2212 | {} | 2222 | {} |
2213 | }; | 2223 | }; |
2214 | 2224 | ||
2225 | static struct snd_kcontrol_new cxt5066_vostro_mixers[] = { | ||
2226 | { | ||
2227 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2228 | .name = "Int Mic Boost Capture Enum", | ||
2229 | .info = cxt5066_mic_boost_mux_enum_info, | ||
2230 | .get = cxt5066_mic_boost_mux_enum_get, | ||
2231 | .put = cxt5066_mic_boost_mux_enum_put, | ||
2232 | .private_value = 0x23 | 0x100, | ||
2233 | }, | ||
2234 | HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT), | ||
2235 | {} | ||
2236 | }; | ||
2237 | |||
2215 | static struct hda_verb cxt5066_init_verbs[] = { | 2238 | static struct hda_verb cxt5066_init_verbs[] = { |
2216 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ | 2239 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ |
2217 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ | 2240 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ |
@@ -2397,11 +2420,16 @@ static struct hda_verb cxt5066_init_verbs_portd_lo[] = { | |||
2397 | /* initialize jack-sensing, too */ | 2420 | /* initialize jack-sensing, too */ |
2398 | static int cxt5066_init(struct hda_codec *codec) | 2421 | static int cxt5066_init(struct hda_codec *codec) |
2399 | { | 2422 | { |
2423 | struct conexant_spec *spec = codec->spec; | ||
2424 | |||
2400 | snd_printdd("CXT5066: init\n"); | 2425 | snd_printdd("CXT5066: init\n"); |
2401 | conexant_init(codec); | 2426 | conexant_init(codec); |
2402 | if (codec->patch_ops.unsol_event) { | 2427 | if (codec->patch_ops.unsol_event) { |
2403 | cxt5066_hp_automute(codec); | 2428 | cxt5066_hp_automute(codec); |
2404 | cxt5066_automic(codec); | 2429 | if (spec->dell_vostro) |
2430 | cxt5066_vostro_automic(codec); | ||
2431 | else | ||
2432 | cxt5066_automic(codec); | ||
2405 | } | 2433 | } |
2406 | return 0; | 2434 | return 0; |
2407 | } | 2435 | } |
@@ -2500,7 +2528,10 @@ static int patch_cxt5066(struct hda_codec *codec) | |||
2500 | spec->init_verbs[0] = cxt5066_init_verbs_vostro; | 2528 | spec->init_verbs[0] = cxt5066_init_verbs_vostro; |
2501 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; | 2529 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; |
2502 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; | 2530 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; |
2531 | spec->mixers[spec->num_mixers++] = cxt5066_vostro_mixers; | ||
2503 | spec->port_d_mode = 0; | 2532 | spec->port_d_mode = 0; |
2533 | spec->dell_vostro = 1; | ||
2534 | snd_hda_attach_beep_device(codec, 0x13); | ||
2504 | 2535 | ||
2505 | /* no S/PDIF out */ | 2536 | /* no S/PDIF out */ |
2506 | spec->multiout.dig_out_nid = 0; | 2537 | spec->multiout.dig_out_nid = 0; |
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index 928df59be5d8..918f40378d52 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c | |||
@@ -146,38 +146,78 @@ struct cea_channel_speaker_allocation { | |||
146 | }; | 146 | }; |
147 | 147 | ||
148 | /* | 148 | /* |
149 | * ALSA sequence is: | ||
150 | * | ||
151 | * surround40 surround41 surround50 surround51 surround71 | ||
152 | * ch0 front left = = = = | ||
153 | * ch1 front right = = = = | ||
154 | * ch2 rear left = = = = | ||
155 | * ch3 rear right = = = = | ||
156 | * ch4 LFE center center center | ||
157 | * ch5 LFE LFE | ||
158 | * ch6 side left | ||
159 | * ch7 side right | ||
160 | * | ||
161 | * surround71 = {FL, FR, RLC, RRC, FC, LFE, RL, RR} | ||
162 | */ | ||
163 | static int hdmi_channel_mapping[0x32][8] = { | ||
164 | /* stereo */ | ||
165 | [0x00] = { 0x00, 0x11, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
166 | /* 2.1 */ | ||
167 | [0x01] = { 0x00, 0x11, 0x22, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
168 | /* Dolby Surround */ | ||
169 | [0x02] = { 0x00, 0x11, 0x23, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
170 | /* surround40 */ | ||
171 | [0x08] = { 0x00, 0x11, 0x24, 0x35, 0xf3, 0xf2, 0xf6, 0xf7 }, | ||
172 | /* 4ch */ | ||
173 | [0x03] = { 0x00, 0x11, 0x23, 0x32, 0x44, 0xf5, 0xf6, 0xf7 }, | ||
174 | /* surround41 */ | ||
175 | [0x09] = { 0x00, 0x11, 0x24, 0x34, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
176 | /* surround50 */ | ||
177 | [0x0a] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
178 | /* surround51 */ | ||
179 | [0x0b] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0x52, 0xf6, 0xf7 }, | ||
180 | /* 7.1 */ | ||
181 | [0x13] = { 0x00, 0x11, 0x26, 0x37, 0x43, 0x52, 0x64, 0x75 }, | ||
182 | }; | ||
183 | |||
184 | /* | ||
149 | * This is an ordered list! | 185 | * This is an ordered list! |
150 | * | 186 | * |
151 | * The preceding ones have better chances to be selected by | 187 | * The preceding ones have better chances to be selected by |
152 | * hdmi_setup_channel_allocation(). | 188 | * hdmi_setup_channel_allocation(). |
153 | */ | 189 | */ |
154 | static struct cea_channel_speaker_allocation channel_allocations[] = { | 190 | static struct cea_channel_speaker_allocation channel_allocations[] = { |
155 | /* channel: 8 7 6 5 4 3 2 1 */ | 191 | /* channel: 7 6 5 4 3 2 1 0 */ |
156 | { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, | 192 | { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, |
157 | /* 2.1 */ | 193 | /* 2.1 */ |
158 | { .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, | 194 | { .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, |
159 | /* Dolby Surround */ | 195 | /* Dolby Surround */ |
160 | { .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, | 196 | { .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, |
197 | /* surround40 */ | ||
198 | { .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, | ||
199 | /* surround41 */ | ||
200 | { .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, | ||
201 | /* surround50 */ | ||
202 | { .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, | ||
203 | /* surround51 */ | ||
204 | { .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, | ||
205 | /* 6.1 */ | ||
206 | { .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, | ||
207 | /* surround71 */ | ||
208 | { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, | ||
209 | |||
161 | { .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, | 210 | { .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, |
162 | { .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, | 211 | { .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, |
163 | { .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, | 212 | { .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, |
164 | { .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, | 213 | { .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, |
165 | { .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, | 214 | { .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, |
166 | { .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, | ||
167 | { .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, | ||
168 | { .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, | ||
169 | /* 5.1 */ | ||
170 | { .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, | ||
171 | { .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, | 215 | { .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, |
172 | { .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, | 216 | { .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, |
173 | { .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, | 217 | { .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, |
174 | /* 6.1 */ | ||
175 | { .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, | ||
176 | { .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, | 218 | { .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, |
177 | { .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, | 219 | { .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, |
178 | { .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, | 220 | { .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, |
179 | /* 7.1 */ | ||
180 | { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, | ||
181 | { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, | 221 | { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, |
182 | { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, | 222 | { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, |
183 | { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, | 223 | { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, |
@@ -210,7 +250,6 @@ static struct cea_channel_speaker_allocation channel_allocations[] = { | |||
210 | { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, | 250 | { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, |
211 | }; | 251 | }; |
212 | 252 | ||
213 | |||
214 | /* | 253 | /* |
215 | * HDA/HDMI auto parsing | 254 | * HDA/HDMI auto parsing |
216 | */ | 255 | */ |
@@ -344,7 +383,7 @@ static int intel_hdmi_parse_codec(struct hda_codec *codec) | |||
344 | break; | 383 | break; |
345 | case AC_WID_PIN: | 384 | case AC_WID_PIN: |
346 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | 385 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
347 | if (!(caps & AC_PINCAP_HDMI)) | 386 | if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) |
348 | continue; | 387 | continue; |
349 | if (intel_hdmi_add_pin(codec, nid) < 0) | 388 | if (intel_hdmi_add_pin(codec, nid) < 0) |
350 | return -EINVAL; | 389 | return -EINVAL; |
@@ -352,6 +391,17 @@ static int intel_hdmi_parse_codec(struct hda_codec *codec) | |||
352 | } | 391 | } |
353 | } | 392 | } |
354 | 393 | ||
394 | /* | ||
395 | * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event | ||
396 | * can be lost and presence sense verb will become inaccurate if the | ||
397 | * HDA link is powered off at hot plug or hw initialization time. | ||
398 | */ | ||
399 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
400 | if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & | ||
401 | AC_PWRST_EPSS)) | ||
402 | codec->bus->power_keep_link_on = 1; | ||
403 | #endif | ||
404 | |||
355 | return 0; | 405 | return 0; |
356 | } | 406 | } |
357 | 407 | ||
@@ -436,14 +486,15 @@ static void hdmi_set_channel_count(struct hda_codec *codec, | |||
436 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); | 486 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); |
437 | } | 487 | } |
438 | 488 | ||
439 | static void hdmi_debug_channel_mapping(struct hda_codec *codec, hda_nid_t nid) | 489 | static void hdmi_debug_channel_mapping(struct hda_codec *codec, |
490 | hda_nid_t pin_nid) | ||
440 | { | 491 | { |
441 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 492 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
442 | int i; | 493 | int i; |
443 | int slot; | 494 | int slot; |
444 | 495 | ||
445 | for (i = 0; i < 8; i++) { | 496 | for (i = 0; i < 8; i++) { |
446 | slot = snd_hda_codec_read(codec, nid, 0, | 497 | slot = snd_hda_codec_read(codec, pin_nid, 0, |
447 | AC_VERB_GET_HDMI_CHAN_SLOT, i); | 498 | AC_VERB_GET_HDMI_CHAN_SLOT, i); |
448 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", | 499 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", |
449 | slot >> 4, slot & 0xf); | 500 | slot >> 4, slot & 0xf); |
@@ -619,25 +670,32 @@ static int hdmi_setup_channel_allocation(struct hda_codec *codec, hda_nid_t nid, | |||
619 | return ai->CA; | 670 | return ai->CA; |
620 | } | 671 | } |
621 | 672 | ||
622 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, hda_nid_t nid, | 673 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, |
674 | hda_nid_t pin_nid, | ||
623 | struct hdmi_audio_infoframe *ai) | 675 | struct hdmi_audio_infoframe *ai) |
624 | { | 676 | { |
625 | int i; | 677 | int i; |
678 | int ca = ai->CA; | ||
679 | int err; | ||
626 | 680 | ||
627 | if (!ai->CA) | 681 | if (hdmi_channel_mapping[ca][1] == 0) { |
628 | return; | 682 | for (i = 0; i < channel_allocations[ca].channels; i++) |
629 | 683 | hdmi_channel_mapping[ca][i] = i | (i << 4); | |
630 | /* | 684 | for (; i < 8; i++) |
631 | * TODO: adjust channel mapping if necessary | 685 | hdmi_channel_mapping[ca][i] = 0xf | (i << 4); |
632 | * ALSA sequence is front/surr/clfe/side? | 686 | } |
633 | */ | ||
634 | 687 | ||
635 | for (i = 0; i < 8; i++) | 688 | for (i = 0; i < 8; i++) { |
636 | snd_hda_codec_write(codec, nid, 0, | 689 | err = snd_hda_codec_write(codec, pin_nid, 0, |
637 | AC_VERB_SET_HDMI_CHAN_SLOT, | 690 | AC_VERB_SET_HDMI_CHAN_SLOT, |
638 | (i << 4) | i); | 691 | hdmi_channel_mapping[ca][i]); |
692 | if (err) { | ||
693 | snd_printdd(KERN_INFO "HDMI: channel mapping failed\n"); | ||
694 | break; | ||
695 | } | ||
696 | } | ||
639 | 697 | ||
640 | hdmi_debug_channel_mapping(codec, nid); | 698 | hdmi_debug_channel_mapping(codec, pin_nid); |
641 | } | 699 | } |
642 | 700 | ||
643 | static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, | 701 | static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, |
@@ -676,7 +734,6 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, | |||
676 | }; | 734 | }; |
677 | 735 | ||
678 | hdmi_setup_channel_allocation(codec, nid, &ai); | 736 | hdmi_setup_channel_allocation(codec, nid, &ai); |
679 | hdmi_setup_channel_mapping(codec, nid, &ai); | ||
680 | 737 | ||
681 | for (i = 0; i < spec->num_pins; i++) { | 738 | for (i = 0; i < spec->num_pins; i++) { |
682 | if (spec->pin_cvt[i] != nid) | 739 | if (spec->pin_cvt[i] != nid) |
@@ -686,6 +743,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, | |||
686 | 743 | ||
687 | pin_nid = spec->pin[i]; | 744 | pin_nid = spec->pin[i]; |
688 | if (!hdmi_infoframe_uptodate(codec, pin_nid, &ai)) { | 745 | if (!hdmi_infoframe_uptodate(codec, pin_nid, &ai)) { |
746 | hdmi_setup_channel_mapping(codec, pin_nid, &ai); | ||
689 | hdmi_stop_infoframe_trans(codec, pin_nid); | 747 | hdmi_stop_infoframe_trans(codec, pin_nid); |
690 | hdmi_fill_audio_infoframe(codec, pin_nid, &ai); | 748 | hdmi_fill_audio_infoframe(codec, pin_nid, &ai); |
691 | hdmi_start_infoframe_trans(codec, pin_nid); | 749 | hdmi_start_infoframe_trans(codec, pin_nid); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d967836f36bb..da34095c707f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -131,8 +131,8 @@ enum { | |||
131 | enum { | 131 | enum { |
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, |
@@ -208,6 +210,7 @@ enum { | |||
208 | ALC885_MBP3, | 210 | ALC885_MBP3, |
209 | ALC885_MB5, | 211 | ALC885_MB5, |
210 | ALC885_IMAC24, | 212 | ALC885_IMAC24, |
213 | ALC885_IMAC91, | ||
211 | ALC883_3ST_2ch_DIG, | 214 | ALC883_3ST_2ch_DIG, |
212 | ALC883_3ST_6ch_DIG, | 215 | ALC883_3ST_6ch_DIG, |
213 | ALC883_3ST_6ch, | 216 | ALC883_3ST_6ch, |
@@ -334,6 +337,9 @@ struct alc_spec { | |||
334 | /* hooks */ | 337 | /* hooks */ |
335 | void (*init_hook)(struct hda_codec *codec); | 338 | void (*init_hook)(struct hda_codec *codec); |
336 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | 339 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
340 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
341 | void (*power_hook)(struct hda_codec *codec, int power); | ||
342 | #endif | ||
337 | 343 | ||
338 | /* for pin sensing */ | 344 | /* for pin sensing */ |
339 | unsigned int sense_updated: 1; | 345 | unsigned int sense_updated: 1; |
@@ -385,6 +391,7 @@ struct alc_config_preset { | |||
385 | void (*init_hook)(struct hda_codec *); | 391 | void (*init_hook)(struct hda_codec *); |
386 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 392 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
387 | struct hda_amp_list *loopbacks; | 393 | struct hda_amp_list *loopbacks; |
394 | void (*power_hook)(struct hda_codec *codec, int power); | ||
388 | #endif | 395 | #endif |
389 | }; | 396 | }; |
390 | 397 | ||
@@ -897,6 +904,7 @@ static void setup_preset(struct hda_codec *codec, | |||
897 | spec->unsol_event = preset->unsol_event; | 904 | spec->unsol_event = preset->unsol_event; |
898 | spec->init_hook = preset->init_hook; | 905 | spec->init_hook = preset->init_hook; |
899 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 906 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
907 | spec->power_hook = preset->power_hook; | ||
900 | spec->loopback.amplist = preset->loopbacks; | 908 | spec->loopback.amplist = preset->loopbacks; |
901 | #endif | 909 | #endif |
902 | 910 | ||
@@ -1085,6 +1093,16 @@ static void alc889_coef_init(struct hda_codec *codec) | |||
1085 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | 1093 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
1086 | } | 1094 | } |
1087 | 1095 | ||
1096 | /* turn on/off EAPD control (only if available) */ | ||
1097 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) | ||
1098 | { | ||
1099 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | ||
1100 | return; | ||
1101 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | ||
1102 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | ||
1103 | on ? 2 : 0); | ||
1104 | } | ||
1105 | |||
1088 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | 1106 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
1089 | { | 1107 | { |
1090 | unsigned int tmp; | 1108 | unsigned int tmp; |
@@ -1102,25 +1120,22 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) | |||
1102 | case ALC_INIT_DEFAULT: | 1120 | case ALC_INIT_DEFAULT: |
1103 | switch (codec->vendor_id) { | 1121 | switch (codec->vendor_id) { |
1104 | case 0x10ec0260: | 1122 | case 0x10ec0260: |
1105 | snd_hda_codec_write(codec, 0x0f, 0, | 1123 | set_eapd(codec, 0x0f, 1); |
1106 | AC_VERB_SET_EAPD_BTLENABLE, 2); | 1124 | set_eapd(codec, 0x10, 1); |
1107 | snd_hda_codec_write(codec, 0x10, 0, | ||
1108 | AC_VERB_SET_EAPD_BTLENABLE, 2); | ||
1109 | break; | 1125 | break; |
1110 | case 0x10ec0262: | 1126 | case 0x10ec0262: |
1111 | case 0x10ec0267: | 1127 | case 0x10ec0267: |
1112 | case 0x10ec0268: | 1128 | case 0x10ec0268: |
1113 | case 0x10ec0269: | 1129 | case 0x10ec0269: |
1130 | case 0x10ec0270: | ||
1114 | case 0x10ec0272: | 1131 | case 0x10ec0272: |
1115 | case 0x10ec0660: | 1132 | case 0x10ec0660: |
1116 | case 0x10ec0662: | 1133 | case 0x10ec0662: |
1117 | case 0x10ec0663: | 1134 | case 0x10ec0663: |
1118 | case 0x10ec0862: | 1135 | case 0x10ec0862: |
1119 | case 0x10ec0889: | 1136 | case 0x10ec0889: |
1120 | snd_hda_codec_write(codec, 0x14, 0, | 1137 | set_eapd(codec, 0x14, 1); |
1121 | AC_VERB_SET_EAPD_BTLENABLE, 2); | 1138 | set_eapd(codec, 0x15, 1); |
1122 | snd_hda_codec_write(codec, 0x15, 0, | ||
1123 | AC_VERB_SET_EAPD_BTLENABLE, 2); | ||
1124 | break; | 1139 | break; |
1125 | } | 1140 | } |
1126 | switch (codec->vendor_id) { | 1141 | switch (codec->vendor_id) { |
@@ -1222,6 +1237,8 @@ static void alc_init_auto_mic(struct hda_codec *codec) | |||
1222 | return; /* invalid entry */ | 1237 | return; /* invalid entry */ |
1223 | } | 1238 | } |
1224 | } | 1239 | } |
1240 | if (!ext || !fixed) | ||
1241 | return; | ||
1225 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) | 1242 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
1226 | return; /* no unsol support */ | 1243 | return; /* no unsol support */ |
1227 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | 1244 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
@@ -1662,9 +1679,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { | |||
1662 | /* some bit here disables the other DACs. Init=0x4900 */ | 1679 | /* some bit here disables the other DACs. Init=0x4900 */ |
1663 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | 1680 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
1664 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | 1681 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
1665 | /* Enable amplifiers */ | ||
1666 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
1667 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
1668 | /* DMIC fix | 1682 | /* DMIC fix |
1669 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | 1683 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
1670 | * which makes the stereo useless. However, either the mic or the ALC889 | 1684 | * which makes the stereo useless. However, either the mic or the ALC889 |
@@ -1777,6 +1791,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = { | |||
1777 | { } /* end */ | 1791 | { } /* end */ |
1778 | }; | 1792 | }; |
1779 | 1793 | ||
1794 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | ||
1795 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1796 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1797 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
1798 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
1799 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
1800 | HDA_OUTPUT), | ||
1801 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
1802 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
1803 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
1804 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1805 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1806 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1807 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
1808 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1809 | { } /* end */ | ||
1810 | }; | ||
1811 | |||
1812 | |||
1780 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | 1813 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
1781 | { | 1814 | { |
1782 | struct alc_spec *spec = codec->spec; | 1815 | struct alc_spec *spec = codec->spec; |
@@ -1807,6 +1840,14 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | |||
1807 | spec->autocfg.speaker_pins[2] = 0x1b; | 1840 | spec->autocfg.speaker_pins[2] = 0x1b; |
1808 | } | 1841 | } |
1809 | 1842 | ||
1843 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
1844 | static void alc889_power_eapd(struct hda_codec *codec, int power) | ||
1845 | { | ||
1846 | set_eapd(codec, 0x14, power); | ||
1847 | set_eapd(codec, 0x15, power); | ||
1848 | } | ||
1849 | #endif | ||
1850 | |||
1810 | /* | 1851 | /* |
1811 | * ALC880 3-stack model | 1852 | * ALC880 3-stack model |
1812 | * | 1853 | * |
@@ -2400,6 +2441,8 @@ static const char *alc_slave_sws[] = { | |||
2400 | "Speaker Playback Switch", | 2441 | "Speaker Playback Switch", |
2401 | "Mono Playback Switch", | 2442 | "Mono Playback Switch", |
2402 | "IEC958 Playback Switch", | 2443 | "IEC958 Playback Switch", |
2444 | "Line-Out Playback Switch", | ||
2445 | "PCM Playback Switch", | ||
2403 | NULL, | 2446 | NULL, |
2404 | }; | 2447 | }; |
2405 | 2448 | ||
@@ -3598,12 +3641,29 @@ static void alc_free(struct hda_codec *codec) | |||
3598 | snd_hda_detach_beep_device(codec); | 3641 | snd_hda_detach_beep_device(codec); |
3599 | } | 3642 | } |
3600 | 3643 | ||
3644 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3645 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) | ||
3646 | { | ||
3647 | struct alc_spec *spec = codec->spec; | ||
3648 | if (spec && spec->power_hook) | ||
3649 | spec->power_hook(codec, 0); | ||
3650 | return 0; | ||
3651 | } | ||
3652 | #endif | ||
3653 | |||
3601 | #ifdef SND_HDA_NEEDS_RESUME | 3654 | #ifdef SND_HDA_NEEDS_RESUME |
3602 | static int alc_resume(struct hda_codec *codec) | 3655 | static int alc_resume(struct hda_codec *codec) |
3603 | { | 3656 | { |
3657 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3658 | struct alc_spec *spec = codec->spec; | ||
3659 | #endif | ||
3604 | codec->patch_ops.init(codec); | 3660 | codec->patch_ops.init(codec); |
3605 | snd_hda_codec_resume_amp(codec); | 3661 | snd_hda_codec_resume_amp(codec); |
3606 | snd_hda_codec_resume_cache(codec); | 3662 | snd_hda_codec_resume_cache(codec); |
3663 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3664 | if (spec && spec->power_hook) | ||
3665 | spec->power_hook(codec, 1); | ||
3666 | #endif | ||
3607 | return 0; | 3667 | return 0; |
3608 | } | 3668 | } |
3609 | #endif | 3669 | #endif |
@@ -3620,6 +3680,7 @@ static struct hda_codec_ops alc_patch_ops = { | |||
3620 | .resume = alc_resume, | 3680 | .resume = alc_resume, |
3621 | #endif | 3681 | #endif |
3622 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3682 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3683 | .suspend = alc_suspend, | ||
3623 | .check_power_status = alc_check_power_status, | 3684 | .check_power_status = alc_check_power_status, |
3624 | #endif | 3685 | #endif |
3625 | }; | 3686 | }; |
@@ -4758,6 +4819,49 @@ static void fixup_automic_adc(struct hda_codec *codec) | |||
4758 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | 4819 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
4759 | } | 4820 | } |
4760 | 4821 | ||
4822 | /* choose the ADC/MUX containing the input pin and initialize the setup */ | ||
4823 | static void fixup_single_adc(struct hda_codec *codec) | ||
4824 | { | ||
4825 | struct alc_spec *spec = codec->spec; | ||
4826 | hda_nid_t pin; | ||
4827 | int i; | ||
4828 | |||
4829 | /* search for the input pin; there must be only one */ | ||
4830 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
4831 | if (spec->autocfg.input_pins[i]) { | ||
4832 | pin = spec->autocfg.input_pins[i]; | ||
4833 | break; | ||
4834 | } | ||
4835 | } | ||
4836 | if (!pin) | ||
4837 | return; | ||
4838 | |||
4839 | /* set the default connection to that pin */ | ||
4840 | for (i = 0; i < spec->num_adc_nids; i++) { | ||
4841 | hda_nid_t cap = spec->capsrc_nids ? | ||
4842 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
4843 | int idx; | ||
4844 | |||
4845 | idx = get_connection_index(codec, cap, pin); | ||
4846 | if (idx < 0) | ||
4847 | continue; | ||
4848 | /* use only this ADC */ | ||
4849 | if (spec->capsrc_nids) | ||
4850 | spec->capsrc_nids += i; | ||
4851 | spec->adc_nids += i; | ||
4852 | spec->num_adc_nids = 1; | ||
4853 | /* select or unmute this route */ | ||
4854 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { | ||
4855 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, | ||
4856 | HDA_AMP_MUTE, 0); | ||
4857 | } else { | ||
4858 | snd_hda_codec_write_cache(codec, cap, 0, | ||
4859 | AC_VERB_SET_CONNECT_SEL, idx); | ||
4860 | } | ||
4861 | return; | ||
4862 | } | ||
4863 | } | ||
4864 | |||
4761 | static void set_capture_mixer(struct hda_codec *codec) | 4865 | static void set_capture_mixer(struct hda_codec *codec) |
4762 | { | 4866 | { |
4763 | struct alc_spec *spec = codec->spec; | 4867 | struct alc_spec *spec = codec->spec; |
@@ -4770,14 +4874,15 @@ static void set_capture_mixer(struct hda_codec *codec) | |||
4770 | alc_capture_mixer3 }, | 4874 | alc_capture_mixer3 }, |
4771 | }; | 4875 | }; |
4772 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { | 4876 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
4773 | int mux; | 4877 | int mux = 0; |
4774 | if (spec->auto_mic) { | 4878 | if (spec->auto_mic) |
4775 | mux = 0; | ||
4776 | fixup_automic_adc(codec); | 4879 | fixup_automic_adc(codec); |
4777 | } else if (spec->input_mux && spec->input_mux->num_items > 1) | 4880 | else if (spec->input_mux) { |
4778 | mux = 1; | 4881 | if (spec->input_mux->num_items > 1) |
4779 | else | 4882 | mux = 1; |
4780 | mux = 0; | 4883 | else if (spec->input_mux->num_items == 1) |
4884 | fixup_single_adc(codec); | ||
4885 | } | ||
4781 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; | 4886 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
4782 | } | 4887 | } |
4783 | } | 4888 | } |
@@ -6245,6 +6350,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = { | |||
6245 | 6350 | ||
6246 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | 6351 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
6247 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), | 6352 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
6353 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), | ||
6248 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), | 6354 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
6249 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), | 6355 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
6250 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), | 6356 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
@@ -6618,7 +6724,7 @@ static struct hda_input_mux alc889A_mb31_capture_source = { | |||
6618 | /* Front Mic (0x01) unused */ | 6724 | /* Front Mic (0x01) unused */ |
6619 | { "Line", 0x2 }, | 6725 | { "Line", 0x2 }, |
6620 | /* Line 2 (0x03) unused */ | 6726 | /* Line 2 (0x03) unused */ |
6621 | /* CD (0x04) unsused? */ | 6727 | /* CD (0x04) unused? */ |
6622 | }, | 6728 | }, |
6623 | }; | 6729 | }; |
6624 | 6730 | ||
@@ -7039,8 +7145,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |||
7039 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | 7145 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
7040 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | 7146 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
7041 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | 7147 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
7042 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | 7148 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
7043 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), | 7149 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
7044 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | 7150 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7045 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 7151 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
7046 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 7152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
@@ -7050,6 +7156,20 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |||
7050 | { } /* end */ | 7156 | { } /* end */ |
7051 | }; | 7157 | }; |
7052 | 7158 | ||
7159 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { | ||
7160 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
7161 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), | ||
7162 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), | ||
7163 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | ||
7164 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7165 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7166 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | ||
7167 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | ||
7168 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | ||
7169 | { } /* end */ | ||
7170 | }; | ||
7171 | |||
7172 | |||
7053 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { | 7173 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
7054 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7174 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7055 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 7175 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
@@ -7427,6 +7547,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = { | |||
7427 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 7547 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
7428 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 7548 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
7429 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | 7549 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
7550 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
7430 | /* Front Mic pin: input vref at 80% */ | 7551 | /* Front Mic pin: input vref at 80% */ |
7431 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 7552 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
7432 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 7553 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
@@ -7505,6 +7626,66 @@ static struct hda_verb alc885_mbp3_init_verbs[] = { | |||
7505 | { } | 7626 | { } |
7506 | }; | 7627 | }; |
7507 | 7628 | ||
7629 | /* iMac 9,1 */ | ||
7630 | static struct hda_verb alc885_imac91_init_verbs[] = { | ||
7631 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ | ||
7632 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7633 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7634 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7635 | /* Rear mixer */ | ||
7636 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
7637 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7638 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
7639 | /* HP Pin: output 0 (0x0c) */ | ||
7640 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
7641 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
7642 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7643 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
7644 | /* Internal Speakers: output 0 (0x0d) */ | ||
7645 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7646 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7647 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7648 | /* Mic (rear) pin: input vref at 80% */ | ||
7649 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
7650 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7651 | /* Front Mic pin: input vref at 80% */ | ||
7652 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
7653 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7654 | /* Line In pin: use output 1 when in LineOut mode */ | ||
7655 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
7656 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
7657 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
7658 | |||
7659 | /* FIXME: use matrix-type input source selection */ | ||
7660 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
7661 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
7662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7663 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7664 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7665 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7666 | /* Input mixer2 */ | ||
7667 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7668 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7669 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7670 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7671 | /* Input mixer3 */ | ||
7672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
7674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
7675 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
7676 | /* ADC1: mute amp left and right */ | ||
7677 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7678 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7679 | /* ADC2: mute amp left and right */ | ||
7680 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7681 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7682 | /* ADC3: mute amp left and right */ | ||
7683 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
7684 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7685 | |||
7686 | { } | ||
7687 | }; | ||
7688 | |||
7508 | /* iMac 24 mixer. */ | 7689 | /* iMac 24 mixer. */ |
7509 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | 7690 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
7510 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | 7691 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
@@ -7551,6 +7732,47 @@ static void alc885_mbp3_setup(struct hda_codec *codec) | |||
7551 | spec->autocfg.speaker_pins[0] = 0x14; | 7732 | spec->autocfg.speaker_pins[0] = 0x14; |
7552 | } | 7733 | } |
7553 | 7734 | ||
7735 | static void alc885_mb5_automute(struct hda_codec *codec) | ||
7736 | { | ||
7737 | unsigned int present; | ||
7738 | |||
7739 | present = snd_hda_codec_read(codec, 0x14, 0, | ||
7740 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
7741 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, | ||
7742 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7743 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | ||
7744 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7745 | |||
7746 | } | ||
7747 | |||
7748 | static void alc885_mb5_unsol_event(struct hda_codec *codec, | ||
7749 | unsigned int res) | ||
7750 | { | ||
7751 | /* Headphone insertion or removal. */ | ||
7752 | if ((res >> 26) == ALC880_HP_EVENT) | ||
7753 | alc885_mb5_automute(codec); | ||
7754 | } | ||
7755 | |||
7756 | static void alc885_imac91_automute(struct hda_codec *codec) | ||
7757 | { | ||
7758 | unsigned int present; | ||
7759 | |||
7760 | present = snd_hda_codec_read(codec, 0x14, 0, | ||
7761 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
7762 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
7763 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7764 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | ||
7765 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7766 | |||
7767 | } | ||
7768 | |||
7769 | static void alc885_imac91_unsol_event(struct hda_codec *codec, | ||
7770 | unsigned int res) | ||
7771 | { | ||
7772 | /* Headphone insertion or removal. */ | ||
7773 | if ((res >> 26) == ALC880_HP_EVENT) | ||
7774 | alc885_imac91_automute(codec); | ||
7775 | } | ||
7554 | 7776 | ||
7555 | static struct hda_verb alc882_targa_verbs[] = { | 7777 | static struct hda_verb alc882_targa_verbs[] = { |
7556 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7778 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
@@ -8718,6 +8940,7 @@ static const char *alc882_models[ALC882_MODEL_LAST] = { | |||
8718 | [ALC885_MB5] = "mb5", | 8940 | [ALC885_MB5] = "mb5", |
8719 | [ALC885_MBP3] = "mbp3", | 8941 | [ALC885_MBP3] = "mbp3", |
8720 | [ALC885_IMAC24] = "imac24", | 8942 | [ALC885_IMAC24] = "imac24", |
8943 | [ALC885_IMAC91] = "imac91", | ||
8721 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", | 8944 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
8722 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | 8945 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
8723 | [ALC883_3ST_6ch] = "3stack-6ch", | 8946 | [ALC883_3ST_6ch] = "3stack-6ch", |
@@ -8820,7 +9043,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { | |||
8820 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | 9043 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
8821 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | 9044 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
8822 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | 9045 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
8823 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), | 9046 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
8824 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | 9047 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
8825 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | 9048 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
8826 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | 9049 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
@@ -8891,6 +9114,7 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |||
8891 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | 9114 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
8892 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | 9115 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
8893 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | 9116 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
9117 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), | ||
8894 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), | 9118 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
8895 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, | 9119 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
8896 | * so apparently no perfect solution yet | 9120 | * so apparently no perfect solution yet |
@@ -8975,6 +9199,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
8975 | .input_mux = &mb5_capture_source, | 9199 | .input_mux = &mb5_capture_source, |
8976 | .dig_out_nid = ALC882_DIGOUT_NID, | 9200 | .dig_out_nid = ALC882_DIGOUT_NID, |
8977 | .dig_in_nid = ALC882_DIGIN_NID, | 9201 | .dig_in_nid = ALC882_DIGIN_NID, |
9202 | .unsol_event = alc885_mb5_unsol_event, | ||
9203 | .init_hook = alc885_mb5_automute, | ||
8978 | }, | 9204 | }, |
8979 | [ALC885_MACPRO] = { | 9205 | [ALC885_MACPRO] = { |
8980 | .mixers = { alc882_macpro_mixer }, | 9206 | .mixers = { alc882_macpro_mixer }, |
@@ -9002,6 +9228,20 @@ static struct alc_config_preset alc882_presets[] = { | |||
9002 | .setup = alc885_imac24_setup, | 9228 | .setup = alc885_imac24_setup, |
9003 | .init_hook = alc885_imac24_init_hook, | 9229 | .init_hook = alc885_imac24_init_hook, |
9004 | }, | 9230 | }, |
9231 | [ALC885_IMAC91] = { | ||
9232 | .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, | ||
9233 | .init_verbs = { alc885_imac91_init_verbs, | ||
9234 | alc880_gpio1_init_verbs }, | ||
9235 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
9236 | .dac_nids = alc882_dac_nids, | ||
9237 | .channel_mode = alc885_mbp_4ch_modes, | ||
9238 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | ||
9239 | .input_mux = &alc882_capture_source, | ||
9240 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
9241 | .dig_in_nid = ALC882_DIGIN_NID, | ||
9242 | .unsol_event = alc885_imac91_unsol_event, | ||
9243 | .init_hook = alc885_imac91_automute, | ||
9244 | }, | ||
9005 | [ALC882_TARGA] = { | 9245 | [ALC882_TARGA] = { |
9006 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | 9246 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
9007 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | 9247 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
@@ -9168,6 +9408,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9168 | .dac_nids = alc883_dac_nids, | 9408 | .dac_nids = alc883_dac_nids, |
9169 | .adc_nids = alc883_adc_nids_alt, | 9409 | .adc_nids = alc883_adc_nids_alt, |
9170 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | 9410 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
9411 | .capsrc_nids = alc883_capsrc_nids, | ||
9171 | .dig_out_nid = ALC883_DIGOUT_NID, | 9412 | .dig_out_nid = ALC883_DIGOUT_NID, |
9172 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 9413 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
9173 | .channel_mode = alc883_3ST_2ch_modes, | 9414 | .channel_mode = alc883_3ST_2ch_modes, |
@@ -9237,6 +9478,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9237 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 9478 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
9238 | .channel_mode = alc883_3ST_6ch_modes, | 9479 | .channel_mode = alc883_3ST_6ch_modes, |
9239 | .need_dac_fix = 1, | 9480 | .need_dac_fix = 1, |
9481 | .const_channel_count = 6, | ||
9240 | .num_mux_defs = | 9482 | .num_mux_defs = |
9241 | ARRAY_SIZE(alc888_2_capture_sources), | 9483 | ARRAY_SIZE(alc888_2_capture_sources), |
9242 | .input_mux = alc888_2_capture_sources, | 9484 | .input_mux = alc888_2_capture_sources, |
@@ -9264,10 +9506,11 @@ static struct alc_config_preset alc882_presets[] = { | |||
9264 | .init_hook = alc_automute_amp, | 9506 | .init_hook = alc_automute_amp, |
9265 | }, | 9507 | }, |
9266 | [ALC888_ACER_ASPIRE_8930G] = { | 9508 | [ALC888_ACER_ASPIRE_8930G] = { |
9267 | .mixers = { alc888_base_mixer, | 9509 | .mixers = { alc889_acer_aspire_8930g_mixer, |
9268 | alc883_chmode_mixer }, | 9510 | alc883_chmode_mixer }, |
9269 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | 9511 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
9270 | alc889_acer_aspire_8930g_verbs }, | 9512 | alc889_acer_aspire_8930g_verbs, |
9513 | alc889_eapd_verbs}, | ||
9271 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9514 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9272 | .dac_nids = alc883_dac_nids, | 9515 | .dac_nids = alc883_dac_nids, |
9273 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | 9516 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
@@ -9284,6 +9527,9 @@ static struct alc_config_preset alc882_presets[] = { | |||
9284 | .unsol_event = alc_automute_amp_unsol_event, | 9527 | .unsol_event = alc_automute_amp_unsol_event, |
9285 | .setup = alc889_acer_aspire_8930g_setup, | 9528 | .setup = alc889_acer_aspire_8930g_setup, |
9286 | .init_hook = alc_automute_amp, | 9529 | .init_hook = alc_automute_amp, |
9530 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
9531 | .power_hook = alc889_power_eapd, | ||
9532 | #endif | ||
9287 | }, | 9533 | }, |
9288 | [ALC888_ACER_ASPIRE_7730G] = { | 9534 | [ALC888_ACER_ASPIRE_7730G] = { |
9289 | .mixers = { alc883_3ST_6ch_mixer, | 9535 | .mixers = { alc883_3ST_6ch_mixer, |
@@ -9314,6 +9560,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9314 | .dac_nids = alc883_dac_nids, | 9560 | .dac_nids = alc883_dac_nids, |
9315 | .adc_nids = alc883_adc_nids_alt, | 9561 | .adc_nids = alc883_adc_nids_alt, |
9316 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | 9562 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
9563 | .capsrc_nids = alc883_capsrc_nids, | ||
9317 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 9564 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
9318 | .channel_mode = alc883_sixstack_modes, | 9565 | .channel_mode = alc883_sixstack_modes, |
9319 | .input_mux = &alc883_capture_source, | 9566 | .input_mux = &alc883_capture_source, |
@@ -9375,6 +9622,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9375 | .dac_nids = alc883_dac_nids, | 9622 | .dac_nids = alc883_dac_nids, |
9376 | .adc_nids = alc883_adc_nids_alt, | 9623 | .adc_nids = alc883_adc_nids_alt, |
9377 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | 9624 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
9625 | .capsrc_nids = alc883_capsrc_nids, | ||
9378 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 9626 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
9379 | .channel_mode = alc883_3ST_2ch_modes, | 9627 | .channel_mode = alc883_3ST_2ch_modes, |
9380 | .input_mux = &alc883_lenovo_101e_capture_source, | 9628 | .input_mux = &alc883_lenovo_101e_capture_source, |
@@ -9554,6 +9802,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9554 | alc880_gpio1_init_verbs }, | 9802 | alc880_gpio1_init_verbs }, |
9555 | .adc_nids = alc883_adc_nids, | 9803 | .adc_nids = alc883_adc_nids, |
9556 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | 9804 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
9805 | .capsrc_nids = alc883_capsrc_nids, | ||
9557 | .dac_nids = alc883_dac_nids, | 9806 | .dac_nids = alc883_dac_nids, |
9558 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9807 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9559 | .channel_mode = alc889A_mb31_6ch_modes, | 9808 | .channel_mode = alc889A_mb31_6ch_modes, |
@@ -9908,10 +10157,12 @@ static int patch_alc882(struct hda_codec *codec) | |||
9908 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ | 10157 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
9909 | 10158 | ||
9910 | if (!spec->adc_nids && spec->input_mux) { | 10159 | if (!spec->adc_nids && spec->input_mux) { |
9911 | int i; | 10160 | int i, j; |
9912 | spec->num_adc_nids = 0; | 10161 | spec->num_adc_nids = 0; |
9913 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { | 10162 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
10163 | const struct hda_input_mux *imux = spec->input_mux; | ||
9914 | hda_nid_t cap; | 10164 | hda_nid_t cap; |
10165 | hda_nid_t items[16]; | ||
9915 | hda_nid_t nid = alc882_adc_nids[i]; | 10166 | hda_nid_t nid = alc882_adc_nids[i]; |
9916 | unsigned int wcap = get_wcaps(codec, nid); | 10167 | unsigned int wcap = get_wcaps(codec, nid); |
9917 | /* get type */ | 10168 | /* get type */ |
@@ -9922,6 +10173,15 @@ static int patch_alc882(struct hda_codec *codec) | |||
9922 | err = snd_hda_get_connections(codec, nid, &cap, 1); | 10173 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
9923 | if (err < 0) | 10174 | if (err < 0) |
9924 | continue; | 10175 | continue; |
10176 | err = snd_hda_get_connections(codec, cap, items, | ||
10177 | ARRAY_SIZE(items)); | ||
10178 | if (err < 0) | ||
10179 | continue; | ||
10180 | for (j = 0; j < imux->num_items; j++) | ||
10181 | if (imux->items[j].index >= err) | ||
10182 | break; | ||
10183 | if (j < imux->num_items) | ||
10184 | continue; | ||
9925 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; | 10185 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
9926 | spec->num_adc_nids++; | 10186 | spec->num_adc_nids++; |
9927 | } | 10187 | } |
@@ -10123,7 +10383,7 @@ static void alc262_hp_t5735_setup(struct hda_codec *codec) | |||
10123 | struct alc_spec *spec = codec->spec; | 10383 | struct alc_spec *spec = codec->spec; |
10124 | 10384 | ||
10125 | spec->autocfg.hp_pins[0] = 0x15; | 10385 | spec->autocfg.hp_pins[0] = 0x15; |
10126 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ | 10386 | spec->autocfg.speaker_pins[0] = 0x14; |
10127 | } | 10387 | } |
10128 | 10388 | ||
10129 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | 10389 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
@@ -10553,6 +10813,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | |||
10553 | {} | 10813 | {} |
10554 | }; | 10814 | }; |
10555 | 10815 | ||
10816 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { | ||
10817 | /* Front Mic pin: input vref at 50% */ | ||
10818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
10819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
10820 | {} | ||
10821 | }; | ||
10822 | |||
10556 | static struct hda_input_mux alc262_fujitsu_capture_source = { | 10823 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
10557 | .num_items = 3, | 10824 | .num_items = 3, |
10558 | .items = { | 10825 | .items = { |
@@ -10988,7 +11255,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
10988 | } | 11255 | } |
10989 | 11256 | ||
10990 | #define alc262_auto_create_input_ctls \ | 11257 | #define alc262_auto_create_input_ctls \ |
10991 | alc880_auto_create_input_ctls | 11258 | alc882_auto_create_input_ctls |
10992 | 11259 | ||
10993 | /* | 11260 | /* |
10994 | * generic initialization of ADC, input mixers and output mixers | 11261 | * generic initialization of ADC, input mixers and output mixers |
@@ -11527,9 +11794,9 @@ static struct alc_config_preset alc262_presets[] = { | |||
11527 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | 11794 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
11528 | .channel_mode = alc262_modes, | 11795 | .channel_mode = alc262_modes, |
11529 | .input_mux = &alc262_capture_source, | 11796 | .input_mux = &alc262_capture_source, |
11530 | .unsol_event = alc_automute_amp_unsol_event, | 11797 | .unsol_event = alc_sku_unsol_event, |
11531 | .setup = alc262_hp_t5735_setup, | 11798 | .setup = alc262_hp_t5735_setup, |
11532 | .init_hook = alc_automute_amp, | 11799 | .init_hook = alc_inithook, |
11533 | }, | 11800 | }, |
11534 | [ALC262_HP_RP5700] = { | 11801 | [ALC262_HP_RP5700] = { |
11535 | .mixers = { alc262_hp_rp5700_mixer }, | 11802 | .mixers = { alc262_hp_rp5700_mixer }, |
@@ -11595,7 +11862,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11595 | [ALC262_LENOVO_3000] = { | 11862 | [ALC262_LENOVO_3000] = { |
11596 | .mixers = { alc262_lenovo_3000_mixer }, | 11863 | .mixers = { alc262_lenovo_3000_mixer }, |
11597 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | 11864 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
11598 | alc262_lenovo_3000_unsol_verbs }, | 11865 | alc262_lenovo_3000_unsol_verbs, |
11866 | alc262_lenovo_3000_init_verbs }, | ||
11599 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | 11867 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
11600 | .dac_nids = alc262_dac_nids, | 11868 | .dac_nids = alc262_dac_nids, |
11601 | .hp_nid = 0x03, | 11869 | .hp_nid = 0x03, |
@@ -12279,6 +12547,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |||
12279 | dac = 0x02; | 12547 | dac = 0x02; |
12280 | break; | 12548 | break; |
12281 | case 0x15: | 12549 | case 0x15: |
12550 | case 0x21: | ||
12282 | dac = 0x03; | 12551 | dac = 0x03; |
12283 | break; | 12552 | break; |
12284 | default: | 12553 | default: |
@@ -12732,7 +13001,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
12732 | int board_config; | 13001 | int board_config; |
12733 | int i, has_beep, err; | 13002 | int i, has_beep, err; |
12734 | 13003 | ||
12735 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 13004 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
12736 | if (spec == NULL) | 13005 | if (spec == NULL) |
12737 | return -ENOMEM; | 13006 | return -ENOMEM; |
12738 | 13007 | ||
@@ -13107,10 +13376,12 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = { | |||
13107 | /* toggle speaker-output according to the hp-jack state */ | 13376 | /* toggle speaker-output according to the hp-jack state */ |
13108 | static void alc269_speaker_automute(struct hda_codec *codec) | 13377 | static void alc269_speaker_automute(struct hda_codec *codec) |
13109 | { | 13378 | { |
13379 | struct alc_spec *spec = codec->spec; | ||
13380 | unsigned int nid = spec->autocfg.hp_pins[0]; | ||
13110 | unsigned int present; | 13381 | unsigned int present; |
13111 | unsigned char bits; | 13382 | unsigned char bits; |
13112 | 13383 | ||
13113 | present = snd_hda_jack_detect(codec, 0x15); | 13384 | present = snd_hda_jack_detect(codec, nid); |
13114 | bits = present ? AMP_IN_MUTE(0) : 0; | 13385 | bits = present ? AMP_IN_MUTE(0) : 0; |
13115 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 13386 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
13116 | AMP_IN_MUTE(0), bits); | 13387 | AMP_IN_MUTE(0), bits); |
@@ -13335,8 +13606,8 @@ static void alc269_auto_init(struct hda_codec *codec) | |||
13335 | static const char *alc269_models[ALC269_MODEL_LAST] = { | 13606 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
13336 | [ALC269_BASIC] = "basic", | 13607 | [ALC269_BASIC] = "basic", |
13337 | [ALC269_QUANTA_FL1] = "quanta", | 13608 | [ALC269_QUANTA_FL1] = "quanta", |
13338 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", | 13609 | [ALC269_ASUS_AMIC] = "asus-amic", |
13339 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", | 13610 | [ALC269_ASUS_DMIC] = "asus-dmic", |
13340 | [ALC269_FUJITSU] = "fujitsu", | 13611 | [ALC269_FUJITSU] = "fujitsu", |
13341 | [ALC269_LIFEBOOK] = "lifebook", | 13612 | [ALC269_LIFEBOOK] = "lifebook", |
13342 | [ALC269_AUTO] = "auto", | 13613 | [ALC269_AUTO] = "auto", |
@@ -13345,18 +13616,41 @@ static const char *alc269_models[ALC269_MODEL_LAST] = { | |||
13345 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | 13616 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
13346 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), | 13617 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
13347 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | 13618 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
13348 | ALC269_ASUS_EEEPC_P703), | 13619 | ALC269_ASUS_AMIC), |
13349 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), | 13620 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC), |
13350 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), | 13621 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC), |
13351 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), | 13622 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC), |
13352 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), | 13623 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC), |
13353 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), | 13624 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC), |
13354 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), | 13625 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC), |
13626 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC), | ||
13627 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC), | ||
13628 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC), | ||
13629 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC), | ||
13630 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC), | ||
13631 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC), | ||
13632 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC), | ||
13633 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC), | ||
13634 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC), | ||
13635 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC), | ||
13636 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC), | ||
13637 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC), | ||
13638 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC), | ||
13639 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC), | ||
13640 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC), | ||
13641 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC), | ||
13642 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC), | ||
13643 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC), | ||
13644 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC), | ||
13645 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC), | ||
13646 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC), | ||
13647 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC), | ||
13355 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | 13648 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
13356 | ALC269_ASUS_EEEPC_P901), | 13649 | ALC269_ASUS_DMIC), |
13357 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", | 13650 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
13358 | ALC269_ASUS_EEEPC_P901), | 13651 | ALC269_ASUS_DMIC), |
13359 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), | 13652 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC), |
13653 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC), | ||
13360 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | 13654 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
13361 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), | 13655 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
13362 | {} | 13656 | {} |
@@ -13386,7 +13680,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
13386 | .setup = alc269_quanta_fl1_setup, | 13680 | .setup = alc269_quanta_fl1_setup, |
13387 | .init_hook = alc269_quanta_fl1_init_hook, | 13681 | .init_hook = alc269_quanta_fl1_init_hook, |
13388 | }, | 13682 | }, |
13389 | [ALC269_ASUS_EEEPC_P703] = { | 13683 | [ALC269_ASUS_AMIC] = { |
13390 | .mixers = { alc269_eeepc_mixer }, | 13684 | .mixers = { alc269_eeepc_mixer }, |
13391 | .cap_mixer = alc269_epc_capture_mixer, | 13685 | .cap_mixer = alc269_epc_capture_mixer, |
13392 | .init_verbs = { alc269_init_verbs, | 13686 | .init_verbs = { alc269_init_verbs, |
@@ -13400,7 +13694,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
13400 | .setup = alc269_eeepc_amic_setup, | 13694 | .setup = alc269_eeepc_amic_setup, |
13401 | .init_hook = alc269_eeepc_inithook, | 13695 | .init_hook = alc269_eeepc_inithook, |
13402 | }, | 13696 | }, |
13403 | [ALC269_ASUS_EEEPC_P901] = { | 13697 | [ALC269_ASUS_DMIC] = { |
13404 | .mixers = { alc269_eeepc_mixer }, | 13698 | .mixers = { alc269_eeepc_mixer }, |
13405 | .cap_mixer = alc269_epc_capture_mixer, | 13699 | .cap_mixer = alc269_epc_capture_mixer, |
13406 | .init_verbs = { alc269_init_verbs, | 13700 | .init_verbs = { alc269_init_verbs, |
@@ -14638,6 +14932,8 @@ static int patch_alc861(struct hda_codec *codec) | |||
14638 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | 14932 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
14639 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | 14933 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
14640 | 14934 | ||
14935 | if (!spec->cap_mixer) | ||
14936 | set_capture_mixer(codec); | ||
14641 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); | 14937 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
14642 | 14938 | ||
14643 | spec->vmaster_nid = 0x03; | 14939 | spec->vmaster_nid = 0x03; |
@@ -15276,7 +15572,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
15276 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, | 15572 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
15277 | const struct auto_pin_cfg *cfg) | 15573 | const struct auto_pin_cfg *cfg) |
15278 | { | 15574 | { |
15279 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); | 15575 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0); |
15280 | } | 15576 | } |
15281 | 15577 | ||
15282 | 15578 | ||
@@ -16035,6 +16331,52 @@ static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |||
16035 | { } /* end */ | 16331 | { } /* end */ |
16036 | }; | 16332 | }; |
16037 | 16333 | ||
16334 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { | ||
16335 | .ops = &snd_hda_bind_sw, | ||
16336 | .values = { | ||
16337 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
16338 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
16339 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | ||
16340 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
16341 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
16342 | 0 | ||
16343 | }, | ||
16344 | }; | ||
16345 | |||
16346 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | ||
16347 | .ops = &snd_hda_bind_sw, | ||
16348 | .values = { | ||
16349 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
16350 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | ||
16351 | 0 | ||
16352 | }, | ||
16353 | }; | ||
16354 | |||
16355 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { | ||
16356 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | ||
16357 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | ||
16358 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | ||
16359 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
16360 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
16361 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
16362 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
16363 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
16364 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
16365 | { } /* end */ | ||
16366 | }; | ||
16367 | |||
16368 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { | ||
16369 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | ||
16370 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | ||
16371 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | ||
16372 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
16373 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
16374 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
16375 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
16376 | { } /* end */ | ||
16377 | }; | ||
16378 | |||
16379 | |||
16038 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { | 16380 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
16039 | { | 16381 | { |
16040 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 16382 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -16322,6 +16664,45 @@ static struct hda_verb alc272_dell_init_verbs[] = { | |||
16322 | {} | 16664 | {} |
16323 | }; | 16665 | }; |
16324 | 16666 | ||
16667 | static struct hda_verb alc663_mode7_init_verbs[] = { | ||
16668 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16669 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16670 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
16671 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16672 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
16673 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16674 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
16675 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
16676 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16677 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
16678 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
16679 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
16680 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
16681 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
16682 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
16683 | {} | ||
16684 | }; | ||
16685 | |||
16686 | static struct hda_verb alc663_mode8_init_verbs[] = { | ||
16687 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16688 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
16689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16690 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
16691 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16692 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
16693 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16694 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16695 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
16696 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16697 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
16698 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
16699 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
16700 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
16701 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
16702 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
16703 | {} | ||
16704 | }; | ||
16705 | |||
16325 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { | 16706 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
16326 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | 16707 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
16327 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | 16708 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
@@ -16501,6 +16882,54 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |||
16501 | } | 16882 | } |
16502 | } | 16883 | } |
16503 | 16884 | ||
16885 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) | ||
16886 | { | ||
16887 | unsigned int present1, present2; | ||
16888 | |||
16889 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | ||
16890 | AC_VERB_GET_PIN_SENSE, 0) | ||
16891 | & AC_PINSENSE_PRESENCE; | ||
16892 | present2 = snd_hda_codec_read(codec, 0x21, 0, | ||
16893 | AC_VERB_GET_PIN_SENSE, 0) | ||
16894 | & AC_PINSENSE_PRESENCE; | ||
16895 | |||
16896 | if (present1 || present2) { | ||
16897 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
16898 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
16899 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
16900 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
16901 | } else { | ||
16902 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
16903 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
16904 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
16905 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
16906 | } | ||
16907 | } | ||
16908 | |||
16909 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) | ||
16910 | { | ||
16911 | unsigned int present1, present2; | ||
16912 | |||
16913 | present1 = snd_hda_codec_read(codec, 0x21, 0, | ||
16914 | AC_VERB_GET_PIN_SENSE, 0) | ||
16915 | & AC_PINSENSE_PRESENCE; | ||
16916 | present2 = snd_hda_codec_read(codec, 0x15, 0, | ||
16917 | AC_VERB_GET_PIN_SENSE, 0) | ||
16918 | & AC_PINSENSE_PRESENCE; | ||
16919 | |||
16920 | if (present1 || present2) { | ||
16921 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
16922 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
16923 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
16924 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
16925 | } else { | ||
16926 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
16927 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
16928 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
16929 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
16930 | } | ||
16931 | } | ||
16932 | |||
16504 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | 16933 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
16505 | unsigned int res) | 16934 | unsigned int res) |
16506 | { | 16935 | { |
@@ -16520,7 +16949,7 @@ static void alc663_m51va_setup(struct hda_codec *codec) | |||
16520 | spec->ext_mic.pin = 0x18; | 16949 | spec->ext_mic.pin = 0x18; |
16521 | spec->ext_mic.mux_idx = 0; | 16950 | spec->ext_mic.mux_idx = 0; |
16522 | spec->int_mic.pin = 0x12; | 16951 | spec->int_mic.pin = 0x12; |
16523 | spec->int_mic.mux_idx = 1; | 16952 | spec->int_mic.mux_idx = 9; |
16524 | spec->auto_mic = 1; | 16953 | spec->auto_mic = 1; |
16525 | } | 16954 | } |
16526 | 16955 | ||
@@ -16532,7 +16961,17 @@ static void alc663_m51va_inithook(struct hda_codec *codec) | |||
16532 | 16961 | ||
16533 | /* ***************** Mode1 ******************************/ | 16962 | /* ***************** Mode1 ******************************/ |
16534 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event | 16963 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
16535 | #define alc663_mode1_setup alc663_m51va_setup | 16964 | |
16965 | static void alc663_mode1_setup(struct hda_codec *codec) | ||
16966 | { | ||
16967 | struct alc_spec *spec = codec->spec; | ||
16968 | spec->ext_mic.pin = 0x18; | ||
16969 | spec->ext_mic.mux_idx = 0; | ||
16970 | spec->int_mic.pin = 0x19; | ||
16971 | spec->int_mic.mux_idx = 1; | ||
16972 | spec->auto_mic = 1; | ||
16973 | } | ||
16974 | |||
16536 | #define alc663_mode1_inithook alc663_m51va_inithook | 16975 | #define alc663_mode1_inithook alc663_m51va_inithook |
16537 | 16976 | ||
16538 | /* ***************** Mode2 ******************************/ | 16977 | /* ***************** Mode2 ******************************/ |
@@ -16549,7 +16988,7 @@ static void alc662_mode2_unsol_event(struct hda_codec *codec, | |||
16549 | } | 16988 | } |
16550 | } | 16989 | } |
16551 | 16990 | ||
16552 | #define alc662_mode2_setup alc663_m51va_setup | 16991 | #define alc662_mode2_setup alc663_mode1_setup |
16553 | 16992 | ||
16554 | static void alc662_mode2_inithook(struct hda_codec *codec) | 16993 | static void alc662_mode2_inithook(struct hda_codec *codec) |
16555 | { | 16994 | { |
@@ -16570,7 +17009,7 @@ static void alc663_mode3_unsol_event(struct hda_codec *codec, | |||
16570 | } | 17009 | } |
16571 | } | 17010 | } |
16572 | 17011 | ||
16573 | #define alc663_mode3_setup alc663_m51va_setup | 17012 | #define alc663_mode3_setup alc663_mode1_setup |
16574 | 17013 | ||
16575 | static void alc663_mode3_inithook(struct hda_codec *codec) | 17014 | static void alc663_mode3_inithook(struct hda_codec *codec) |
16576 | { | 17015 | { |
@@ -16591,7 +17030,7 @@ static void alc663_mode4_unsol_event(struct hda_codec *codec, | |||
16591 | } | 17030 | } |
16592 | } | 17031 | } |
16593 | 17032 | ||
16594 | #define alc663_mode4_setup alc663_m51va_setup | 17033 | #define alc663_mode4_setup alc663_mode1_setup |
16595 | 17034 | ||
16596 | static void alc663_mode4_inithook(struct hda_codec *codec) | 17035 | static void alc663_mode4_inithook(struct hda_codec *codec) |
16597 | { | 17036 | { |
@@ -16612,7 +17051,7 @@ static void alc663_mode5_unsol_event(struct hda_codec *codec, | |||
16612 | } | 17051 | } |
16613 | } | 17052 | } |
16614 | 17053 | ||
16615 | #define alc663_mode5_setup alc663_m51va_setup | 17054 | #define alc663_mode5_setup alc663_mode1_setup |
16616 | 17055 | ||
16617 | static void alc663_mode5_inithook(struct hda_codec *codec) | 17056 | static void alc663_mode5_inithook(struct hda_codec *codec) |
16618 | { | 17057 | { |
@@ -16633,7 +17072,7 @@ static void alc663_mode6_unsol_event(struct hda_codec *codec, | |||
16633 | } | 17072 | } |
16634 | } | 17073 | } |
16635 | 17074 | ||
16636 | #define alc663_mode6_setup alc663_m51va_setup | 17075 | #define alc663_mode6_setup alc663_mode1_setup |
16637 | 17076 | ||
16638 | static void alc663_mode6_inithook(struct hda_codec *codec) | 17077 | static void alc663_mode6_inithook(struct hda_codec *codec) |
16639 | { | 17078 | { |
@@ -16641,6 +17080,50 @@ static void alc663_mode6_inithook(struct hda_codec *codec) | |||
16641 | alc_mic_automute(codec); | 17080 | alc_mic_automute(codec); |
16642 | } | 17081 | } |
16643 | 17082 | ||
17083 | /* ***************** Mode7 ******************************/ | ||
17084 | static void alc663_mode7_unsol_event(struct hda_codec *codec, | ||
17085 | unsigned int res) | ||
17086 | { | ||
17087 | switch (res >> 26) { | ||
17088 | case ALC880_HP_EVENT: | ||
17089 | alc663_two_hp_m7_speaker_automute(codec); | ||
17090 | break; | ||
17091 | case ALC880_MIC_EVENT: | ||
17092 | alc_mic_automute(codec); | ||
17093 | break; | ||
17094 | } | ||
17095 | } | ||
17096 | |||
17097 | #define alc663_mode7_setup alc663_mode1_setup | ||
17098 | |||
17099 | static void alc663_mode7_inithook(struct hda_codec *codec) | ||
17100 | { | ||
17101 | alc663_two_hp_m7_speaker_automute(codec); | ||
17102 | alc_mic_automute(codec); | ||
17103 | } | ||
17104 | |||
17105 | /* ***************** Mode8 ******************************/ | ||
17106 | static void alc663_mode8_unsol_event(struct hda_codec *codec, | ||
17107 | unsigned int res) | ||
17108 | { | ||
17109 | switch (res >> 26) { | ||
17110 | case ALC880_HP_EVENT: | ||
17111 | alc663_two_hp_m8_speaker_automute(codec); | ||
17112 | break; | ||
17113 | case ALC880_MIC_EVENT: | ||
17114 | alc_mic_automute(codec); | ||
17115 | break; | ||
17116 | } | ||
17117 | } | ||
17118 | |||
17119 | #define alc663_mode8_setup alc663_m51va_setup | ||
17120 | |||
17121 | static void alc663_mode8_inithook(struct hda_codec *codec) | ||
17122 | { | ||
17123 | alc663_two_hp_m8_speaker_automute(codec); | ||
17124 | alc_mic_automute(codec); | ||
17125 | } | ||
17126 | |||
16644 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | 17127 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
16645 | { | 17128 | { |
16646 | unsigned int present; | 17129 | unsigned int present; |
@@ -16775,6 +17258,8 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { | |||
16775 | [ALC663_ASUS_MODE4] = "asus-mode4", | 17258 | [ALC663_ASUS_MODE4] = "asus-mode4", |
16776 | [ALC663_ASUS_MODE5] = "asus-mode5", | 17259 | [ALC663_ASUS_MODE5] = "asus-mode5", |
16777 | [ALC663_ASUS_MODE6] = "asus-mode6", | 17260 | [ALC663_ASUS_MODE6] = "asus-mode6", |
17261 | [ALC663_ASUS_MODE7] = "asus-mode7", | ||
17262 | [ALC663_ASUS_MODE8] = "asus-mode8", | ||
16778 | [ALC272_DELL] = "dell", | 17263 | [ALC272_DELL] = "dell", |
16779 | [ALC272_DELL_ZM1] = "dell-zm1", | 17264 | [ALC272_DELL_ZM1] = "dell-zm1", |
16780 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", | 17265 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
@@ -16791,12 +17276,22 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { | |||
16791 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | 17276 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
16792 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | 17277 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
16793 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | 17278 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
17279 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), | ||
17280 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | ||
16794 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | 17281 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
17282 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), | ||
17283 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | ||
17284 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | ||
17285 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | ||
17286 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | ||
16795 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | 17287 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
17288 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), | ||
17289 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | ||
16796 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | 17290 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
16797 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | 17291 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
16798 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | 17292 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
16799 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | 17293 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
17294 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), | ||
16800 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), | 17295 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
16801 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | 17296 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
16802 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | 17297 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
@@ -16835,7 +17330,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { | |||
16835 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | 17330 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
16836 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | 17331 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
16837 | ALC662_3ST_6ch_DIG), | 17332 | ALC662_3ST_6ch_DIG), |
16838 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), | 17333 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
16839 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), | 17334 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
16840 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | 17335 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
16841 | ALC662_3ST_6ch_DIG), | 17336 | ALC662_3ST_6ch_DIG), |
@@ -16846,6 +17341,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { | |||
16846 | ALC662_3ST_6ch_DIG), | 17341 | ALC662_3ST_6ch_DIG), |
16847 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", | 17342 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
16848 | ALC663_ASUS_H13), | 17343 | ALC663_ASUS_H13), |
17344 | SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG), | ||
16849 | {} | 17345 | {} |
16850 | }; | 17346 | }; |
16851 | 17347 | ||
@@ -17079,6 +17575,36 @@ static struct alc_config_preset alc662_presets[] = { | |||
17079 | .setup = alc663_mode6_setup, | 17575 | .setup = alc663_mode6_setup, |
17080 | .init_hook = alc663_mode6_inithook, | 17576 | .init_hook = alc663_mode6_inithook, |
17081 | }, | 17577 | }, |
17578 | [ALC663_ASUS_MODE7] = { | ||
17579 | .mixers = { alc663_mode7_mixer }, | ||
17580 | .cap_mixer = alc662_auto_capture_mixer, | ||
17581 | .init_verbs = { alc662_init_verbs, | ||
17582 | alc663_mode7_init_verbs }, | ||
17583 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
17584 | .hp_nid = 0x03, | ||
17585 | .dac_nids = alc662_dac_nids, | ||
17586 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
17587 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
17588 | .channel_mode = alc662_3ST_2ch_modes, | ||
17589 | .unsol_event = alc663_mode7_unsol_event, | ||
17590 | .setup = alc663_mode7_setup, | ||
17591 | .init_hook = alc663_mode7_inithook, | ||
17592 | }, | ||
17593 | [ALC663_ASUS_MODE8] = { | ||
17594 | .mixers = { alc663_mode8_mixer }, | ||
17595 | .cap_mixer = alc662_auto_capture_mixer, | ||
17596 | .init_verbs = { alc662_init_verbs, | ||
17597 | alc663_mode8_init_verbs }, | ||
17598 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
17599 | .hp_nid = 0x03, | ||
17600 | .dac_nids = alc662_dac_nids, | ||
17601 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
17602 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
17603 | .channel_mode = alc662_3ST_2ch_modes, | ||
17604 | .unsol_event = alc663_mode8_unsol_event, | ||
17605 | .setup = alc663_mode8_setup, | ||
17606 | .init_hook = alc663_mode8_inithook, | ||
17607 | }, | ||
17082 | [ALC272_DELL] = { | 17608 | [ALC272_DELL] = { |
17083 | .mixers = { alc663_m51va_mixer }, | 17609 | .mixers = { alc663_m51va_mixer }, |
17084 | .cap_mixer = alc272_auto_capture_mixer, | 17610 | .cap_mixer = alc272_auto_capture_mixer, |
@@ -17562,7 +18088,9 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
17562 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | 18088 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
17563 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, | 18089 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
17564 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, | 18090 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
18091 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, | ||
17565 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, | 18092 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
18093 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, | ||
17566 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", | 18094 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
17567 | .patch = patch_alc861 }, | 18095 | .patch = patch_alc861 }, |
17568 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, | 18096 | { .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 6b0bc040c3b1..799ba2570902 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -209,6 +209,7 @@ struct sigmatel_spec { | |||
209 | unsigned int gpio_data; | 209 | unsigned int gpio_data; |
210 | unsigned int gpio_mute; | 210 | unsigned int gpio_mute; |
211 | unsigned int gpio_led; | 211 | unsigned int gpio_led; |
212 | unsigned int gpio_led_polarity; | ||
212 | 213 | ||
213 | /* stream */ | 214 | /* stream */ |
214 | unsigned int stream_delay; | 215 | unsigned int stream_delay; |
@@ -1538,6 +1539,13 @@ static unsigned int alienware_m17x_pin_configs[13] = { | |||
1538 | 0x904601b0, | 1539 | 0x904601b0, |
1539 | }; | 1540 | }; |
1540 | 1541 | ||
1542 | static unsigned int intel_dg45id_pin_configs[14] = { | ||
1543 | 0x02214230, 0x02A19240, 0x01013214, 0x01014210, | ||
1544 | 0x01A19250, 0x01011212, 0x01016211, 0x40f000f0, | ||
1545 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x014510A0, | ||
1546 | 0x074510B0, 0x40f000f0 | ||
1547 | }; | ||
1548 | |||
1541 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { | 1549 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
1542 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, | 1550 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
1543 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, | 1551 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, |
@@ -1545,6 +1553,7 @@ static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { | |||
1545 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, | 1553 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, |
1546 | [STAC_DELL_EQ] = dell_m6_pin_configs, | 1554 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
1547 | [STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs, | 1555 | [STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs, |
1556 | [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs, | ||
1548 | }; | 1557 | }; |
1549 | 1558 | ||
1550 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | 1559 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
@@ -2095,6 +2104,7 @@ static unsigned int ref9205_pin_configs[12] = { | |||
2095 | 10280204 | 2104 | 10280204 |
2096 | 1028021F | 2105 | 1028021F |
2097 | 10280228 (Dell Vostro 1500) | 2106 | 10280228 (Dell Vostro 1500) |
2107 | 10280229 (Dell Vostro 1700) | ||
2098 | */ | 2108 | */ |
2099 | static unsigned int dell_9205_m42_pin_configs[12] = { | 2109 | static unsigned int dell_9205_m42_pin_configs[12] = { |
2100 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, | 2110 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
@@ -2180,6 +2190,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = { | |||
2180 | "Dell Inspiron", STAC_9205_DELL_M44), | 2190 | "Dell Inspiron", STAC_9205_DELL_M44), |
2181 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, | 2191 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
2182 | "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), | ||
2183 | /* Gateway */ | 2195 | /* Gateway */ |
2184 | SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), | 2196 | SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), |
2185 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), | 2197 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), |
@@ -3770,15 +3782,16 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3770 | err = snd_hda_attach_beep_device(codec, nid); | 3782 | err = snd_hda_attach_beep_device(codec, nid); |
3771 | if (err < 0) | 3783 | if (err < 0) |
3772 | return err; | 3784 | return err; |
3773 | /* IDT/STAC codecs have linear beep tone parameter */ | 3785 | if (codec->beep) { |
3774 | codec->beep->linear_tone = 1; | 3786 | /* IDT/STAC codecs have linear beep tone parameter */ |
3775 | /* if no beep switch is available, make its own one */ | 3787 | codec->beep->linear_tone = 1; |
3776 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); | 3788 | /* if no beep switch is available, make its own one */ |
3777 | if (codec->beep && | 3789 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
3778 | !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { | 3790 | if (!(caps & AC_AMPCAP_MUTE)) { |
3779 | err = stac92xx_beep_switch_ctl(codec); | 3791 | err = stac92xx_beep_switch_ctl(codec); |
3780 | if (err < 0) | 3792 | if (err < 0) |
3781 | return err; | 3793 | return err; |
3794 | } | ||
3782 | } | 3795 | } |
3783 | } | 3796 | } |
3784 | #endif | 3797 | #endif |
@@ -4440,14 +4453,7 @@ static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) | |||
4440 | { | 4453 | { |
4441 | if (!nid) | 4454 | if (!nid) |
4442 | return 0; | 4455 | return 0; |
4443 | /* NOTE: we can't use snd_hda_jack_detect() here because STAC/IDT | 4456 | return snd_hda_jack_detect(codec, nid); |
4444 | * codecs behave wrongly when SET_PIN_SENSE is triggered, although | ||
4445 | * the pincap gives TRIG_REQ bit. | ||
4446 | */ | ||
4447 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0) & | ||
4448 | AC_PINSENSE_PRESENCE) | ||
4449 | return 1; | ||
4450 | return 0; | ||
4451 | } | 4457 | } |
4452 | 4458 | ||
4453 | static void stac92xx_line_out_detect(struct hda_codec *codec, | 4459 | static void stac92xx_line_out_detect(struct hda_codec *codec, |
@@ -4724,13 +4730,88 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | |||
4724 | } | 4730 | } |
4725 | } | 4731 | } |
4726 | 4732 | ||
4727 | static int hp_bseries_system(u32 subsystem_id) | 4733 | static int hp_blike_system(u32 subsystem_id); |
4734 | |||
4735 | static void set_hp_led_gpio(struct hda_codec *codec) | ||
4736 | { | ||
4737 | struct sigmatel_spec *spec = codec->spec; | ||
4738 | switch (codec->vendor_id) { | ||
4739 | case 0x111d7608: | ||
4740 | /* GPIO 0 */ | ||
4741 | spec->gpio_led = 0x01; | ||
4742 | break; | ||
4743 | case 0x111d7600: | ||
4744 | case 0x111d7601: | ||
4745 | case 0x111d7602: | ||
4746 | case 0x111d7603: | ||
4747 | /* GPIO 3 */ | ||
4748 | spec->gpio_led = 0x08; | ||
4749 | break; | ||
4750 | } | ||
4751 | } | ||
4752 | |||
4753 | /* | ||
4754 | * This method searches for the mute LED GPIO configuration | ||
4755 | * provided as OEM string in SMBIOS. The format of that string | ||
4756 | * is HP_Mute_LED_P_G or HP_Mute_LED_P | ||
4757 | * where P can be 0 or 1 and defines mute LED GPIO control state (low/high) | ||
4758 | * that corresponds to the NOT muted state of the master volume | ||
4759 | * and G is the index of the GPIO to use as the mute LED control (0..9) | ||
4760 | * If _G portion is missing it is assigned based on the codec ID | ||
4761 | * | ||
4762 | * So, HP B-series like systems may have HP_Mute_LED_0 (current models) | ||
4763 | * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings | ||
4764 | * | ||
4765 | * | ||
4766 | * The dv-series laptops don't seem to have the HP_Mute_LED* strings in | ||
4767 | * SMBIOS - at least the ones I have seen do not have them - which include | ||
4768 | * my own system (HP Pavilion dv6-1110ax) and my cousin's | ||
4769 | * HP Pavilion dv9500t CTO. | ||
4770 | * Need more information on whether it is true across the entire series. | ||
4771 | * -- kunal | ||
4772 | */ | ||
4773 | static int find_mute_led_gpio(struct hda_codec *codec) | ||
4774 | { | ||
4775 | struct sigmatel_spec *spec = codec->spec; | ||
4776 | const struct dmi_device *dev = NULL; | ||
4777 | |||
4778 | if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) { | ||
4779 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, | ||
4780 | NULL, dev))) { | ||
4781 | if (sscanf(dev->name, "HP_Mute_LED_%d_%d", | ||
4782 | &spec->gpio_led_polarity, | ||
4783 | &spec->gpio_led) == 2) { | ||
4784 | spec->gpio_led = 1 << spec->gpio_led; | ||
4785 | return 1; | ||
4786 | } | ||
4787 | if (sscanf(dev->name, "HP_Mute_LED_%d", | ||
4788 | &spec->gpio_led_polarity) == 1) { | ||
4789 | set_hp_led_gpio(codec); | ||
4790 | return 1; | ||
4791 | } | ||
4792 | } | ||
4793 | |||
4794 | /* | ||
4795 | * Fallback case - if we don't find the DMI strings, | ||
4796 | * we statically set the GPIO - if not a B-series system. | ||
4797 | */ | ||
4798 | if (!hp_blike_system(codec->subsystem_id)) { | ||
4799 | set_hp_led_gpio(codec); | ||
4800 | spec->gpio_led_polarity = 1; | ||
4801 | return 1; | ||
4802 | } | ||
4803 | } | ||
4804 | return 0; | ||
4805 | } | ||
4806 | |||
4807 | static int hp_blike_system(u32 subsystem_id) | ||
4728 | { | 4808 | { |
4729 | switch (subsystem_id) { | 4809 | switch (subsystem_id) { |
4730 | case 0x103c307e: | 4810 | case 0x103c1520: |
4731 | case 0x103c307f: | 4811 | case 0x103c1521: |
4732 | case 0x103c3080: | 4812 | case 0x103c1523: |
4733 | case 0x103c3081: | 4813 | case 0x103c1524: |
4814 | case 0x103c1525: | ||
4734 | case 0x103c1722: | 4815 | case 0x103c1722: |
4735 | case 0x103c1723: | 4816 | case 0x103c1723: |
4736 | case 0x103c1724: | 4817 | case 0x103c1724: |
@@ -4739,6 +4820,14 @@ static int hp_bseries_system(u32 subsystem_id) | |||
4739 | case 0x103c1727: | 4820 | case 0x103c1727: |
4740 | case 0x103c1728: | 4821 | case 0x103c1728: |
4741 | case 0x103c1729: | 4822 | case 0x103c1729: |
4823 | case 0x103c172a: | ||
4824 | case 0x103c172b: | ||
4825 | case 0x103c307e: | ||
4826 | case 0x103c307f: | ||
4827 | case 0x103c3080: | ||
4828 | case 0x103c3081: | ||
4829 | case 0x103c7007: | ||
4830 | case 0x103c7008: | ||
4742 | return 1; | 4831 | return 1; |
4743 | } | 4832 | } |
4744 | return 0; | 4833 | return 0; |
@@ -4833,7 +4922,7 @@ static int stac92xx_hp_check_power_status(struct hda_codec *codec, | |||
4833 | else | 4922 | else |
4834 | spec->gpio_data |= spec->gpio_led; /* white */ | 4923 | spec->gpio_data |= spec->gpio_led; /* white */ |
4835 | 4924 | ||
4836 | if (hp_bseries_system(codec->subsystem_id)) { | 4925 | if (!spec->gpio_led_polarity) { |
4837 | /* LED state is inverted on these systems */ | 4926 | /* LED state is inverted on these systems */ |
4838 | spec->gpio_data ^= spec->gpio_led; | 4927 | spec->gpio_data ^= spec->gpio_led; |
4839 | } | 4928 | } |
@@ -4893,6 +4982,7 @@ static int patch_stac9200(struct hda_codec *codec) | |||
4893 | if (spec == NULL) | 4982 | if (spec == NULL) |
4894 | return -ENOMEM; | 4983 | return -ENOMEM; |
4895 | 4984 | ||
4985 | codec->no_trigger_sense = 1; | ||
4896 | codec->spec = spec; | 4986 | codec->spec = spec; |
4897 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); | 4987 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
4898 | spec->pin_nids = stac9200_pin_nids; | 4988 | spec->pin_nids = stac9200_pin_nids; |
@@ -4955,6 +5045,7 @@ static int patch_stac925x(struct hda_codec *codec) | |||
4955 | if (spec == NULL) | 5045 | if (spec == NULL) |
4956 | return -ENOMEM; | 5046 | return -ENOMEM; |
4957 | 5047 | ||
5048 | codec->no_trigger_sense = 1; | ||
4958 | codec->spec = spec; | 5049 | codec->spec = spec; |
4959 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); | 5050 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
4960 | spec->pin_nids = stac925x_pin_nids; | 5051 | spec->pin_nids = stac925x_pin_nids; |
@@ -5039,6 +5130,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec) | |||
5039 | if (spec == NULL) | 5130 | if (spec == NULL) |
5040 | return -ENOMEM; | 5131 | return -ENOMEM; |
5041 | 5132 | ||
5133 | codec->no_trigger_sense = 1; | ||
5042 | codec->spec = spec; | 5134 | codec->spec = spec; |
5043 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; | 5135 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; |
5044 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); | 5136 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
@@ -5186,6 +5278,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
5186 | if (spec == NULL) | 5278 | if (spec == NULL) |
5187 | return -ENOMEM; | 5279 | return -ENOMEM; |
5188 | 5280 | ||
5281 | codec->no_trigger_sense = 1; | ||
5189 | codec->spec = spec; | 5282 | codec->spec = spec; |
5190 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; | 5283 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
5191 | spec->digbeep_nid = 0x21; | 5284 | spec->digbeep_nid = 0x21; |
@@ -5349,6 +5442,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
5349 | if (spec == NULL) | 5442 | if (spec == NULL) |
5350 | return -ENOMEM; | 5443 | return -ENOMEM; |
5351 | 5444 | ||
5445 | codec->no_trigger_sense = 1; | ||
5352 | codec->spec = spec; | 5446 | codec->spec = spec; |
5353 | codec->patch_ops = stac92xx_patch_ops; | 5447 | codec->patch_ops = stac92xx_patch_ops; |
5354 | spec->num_pins = STAC92HD71BXX_NUM_PINS; | 5448 | spec->num_pins = STAC92HD71BXX_NUM_PINS; |
@@ -5481,6 +5575,8 @@ again: | |||
5481 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | 5575 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
5482 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); | 5576 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); |
5483 | 5577 | ||
5578 | snd_printdd("Found board config: %d\n", spec->board_config); | ||
5579 | |||
5484 | switch (spec->board_config) { | 5580 | switch (spec->board_config) { |
5485 | case STAC_HP_M4: | 5581 | case STAC_HP_M4: |
5486 | /* enable internal microphone */ | 5582 | /* enable internal microphone */ |
@@ -5526,7 +5622,7 @@ again: | |||
5526 | break; | 5622 | break; |
5527 | } | 5623 | } |
5528 | 5624 | ||
5529 | if (hp_bseries_system(codec->subsystem_id)) { | 5625 | if (hp_blike_system(codec->subsystem_id)) { |
5530 | pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f); | 5626 | pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f); |
5531 | if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT || | 5627 | if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT || |
5532 | get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER || | 5628 | get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER || |
@@ -5544,26 +5640,10 @@ again: | |||
5544 | } | 5640 | } |
5545 | } | 5641 | } |
5546 | 5642 | ||
5547 | if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) { | 5643 | if (find_mute_led_gpio(codec)) |
5548 | const struct dmi_device *dev = NULL; | 5644 | snd_printd("mute LED gpio %d polarity %d\n", |
5549 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, | 5645 | spec->gpio_led, |
5550 | NULL, dev))) { | 5646 | spec->gpio_led_polarity); |
5551 | if (strcmp(dev->name, "HP_Mute_LED_1")) { | ||
5552 | switch (codec->vendor_id) { | ||
5553 | case 0x111d7608: | ||
5554 | spec->gpio_led = 0x01; | ||
5555 | break; | ||
5556 | case 0x111d7600: | ||
5557 | case 0x111d7601: | ||
5558 | case 0x111d7602: | ||
5559 | case 0x111d7603: | ||
5560 | spec->gpio_led = 0x08; | ||
5561 | break; | ||
5562 | } | ||
5563 | break; | ||
5564 | } | ||
5565 | } | ||
5566 | } | ||
5567 | 5647 | ||
5568 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5648 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5569 | if (spec->gpio_led) { | 5649 | if (spec->gpio_led) { |
@@ -5608,6 +5688,7 @@ static int patch_stac922x(struct hda_codec *codec) | |||
5608 | if (spec == NULL) | 5688 | if (spec == NULL) |
5609 | return -ENOMEM; | 5689 | return -ENOMEM; |
5610 | 5690 | ||
5691 | codec->no_trigger_sense = 1; | ||
5611 | codec->spec = spec; | 5692 | codec->spec = spec; |
5612 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); | 5693 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
5613 | spec->pin_nids = stac922x_pin_nids; | 5694 | spec->pin_nids = stac922x_pin_nids; |
@@ -5711,6 +5792,7 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5711 | if (spec == NULL) | 5792 | if (spec == NULL) |
5712 | return -ENOMEM; | 5793 | return -ENOMEM; |
5713 | 5794 | ||
5795 | codec->no_trigger_sense = 1; | ||
5714 | codec->spec = spec; | 5796 | codec->spec = spec; |
5715 | codec->slave_dig_outs = stac927x_slave_dig_outs; | 5797 | codec->slave_dig_outs = stac927x_slave_dig_outs; |
5716 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); | 5798 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
@@ -5845,6 +5927,7 @@ static int patch_stac9205(struct hda_codec *codec) | |||
5845 | if (spec == NULL) | 5927 | if (spec == NULL) |
5846 | return -ENOMEM; | 5928 | return -ENOMEM; |
5847 | 5929 | ||
5930 | codec->no_trigger_sense = 1; | ||
5848 | codec->spec = spec; | 5931 | codec->spec = spec; |
5849 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); | 5932 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
5850 | spec->pin_nids = stac9205_pin_nids; | 5933 | spec->pin_nids = stac9205_pin_nids; |
@@ -6000,6 +6083,7 @@ static int patch_stac9872(struct hda_codec *codec) | |||
6000 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 6083 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
6001 | if (spec == NULL) | 6084 | if (spec == NULL) |
6002 | return -ENOMEM; | 6085 | return -ENOMEM; |
6086 | codec->no_trigger_sense = 1; | ||
6003 | codec->spec = spec; | 6087 | codec->spec = spec; |
6004 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); | 6088 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); |
6005 | spec->pin_nids = stac9872_pin_nids; | 6089 | spec->pin_nids = stac9872_pin_nids; |
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 110d16e52733..9e66f6d306f8 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c | |||
@@ -689,42 +689,27 @@ static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
689 | return change; | 689 | return change; |
690 | } | 690 | } |
691 | 691 | ||
692 | static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1); | 692 | static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -10000, 100, 1); |
693 | static const DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1); | 693 | static const DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1); |
694 | static const DECLARE_TLV_DB_SCALE(db_scale_wm_adc, -1200, 100, 0); | 694 | static const DECLARE_TLV_DB_SCALE(db_scale_wm_adc, -1200, 100, 0); |
695 | static const DECLARE_TLV_DB_SCALE(db_scale_ac97_master, -4650, 150, 0); | 695 | static const DECLARE_TLV_DB_SCALE(db_scale_ac97_master, -4650, 150, 0); |
696 | static const DECLARE_TLV_DB_SCALE(db_scale_ac97_gain, -3450, 150, 0); | 696 | static const DECLARE_TLV_DB_SCALE(db_scale_ac97_gain, -3450, 150, 0); |
697 | 697 | ||
698 | /* | 698 | #define WM_VOL_MAX 100 |
699 | * Logarithmic volume values for WM8770 | 699 | #define WM_VOL_CNT 101 /* 0dB .. -100dB */ |
700 | * Computed as 20 * Log10(255 / x) | ||
701 | */ | ||
702 | static const unsigned char wm_vol[256] = { | ||
703 | 127, 48, 42, 39, 36, 34, 33, 31, 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 23, | ||
704 | 23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, 17, 17, 17, | ||
705 | 17, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13, 13, | ||
706 | 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, | ||
707 | 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, | ||
708 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, | ||
709 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
710 | 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, | ||
711 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
712 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
713 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
714 | 0, 0 | ||
715 | }; | ||
716 | |||
717 | #define WM_VOL_MAX (sizeof(wm_vol) - 1) | ||
718 | #define WM_VOL_MUTE 0x8000 | 700 | #define WM_VOL_MUTE 0x8000 |
719 | 701 | ||
720 | static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) | 702 | static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) |
721 | { | 703 | { |
722 | unsigned char nvol; | 704 | unsigned char nvol; |
723 | 705 | ||
724 | if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) | 706 | if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) { |
725 | nvol = 0; | 707 | nvol = 0; |
726 | else | 708 | } else { |
727 | nvol = 127 - wm_vol[(((vol & ~WM_VOL_MUTE) * (master & ~WM_VOL_MUTE)) / 127) & WM_VOL_MAX]; | 709 | nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) / |
710 | WM_VOL_MAX; | ||
711 | nvol += 0x1b; | ||
712 | } | ||
728 | 713 | ||
729 | wm_put(ice, index, nvol); | 714 | wm_put(ice, index, nvol); |
730 | wm_put_nocache(ice, index, 0x180 | nvol); | 715 | wm_put_nocache(ice, index, 0x180 | nvol); |
@@ -795,7 +780,7 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
795 | for (ch = 0; ch < 2; ch++) { | 780 | for (ch = 0; ch < 2; ch++) { |
796 | unsigned int vol = ucontrol->value.integer.value[ch]; | 781 | unsigned int vol = ucontrol->value.integer.value[ch]; |
797 | if (vol > WM_VOL_MAX) | 782 | if (vol > WM_VOL_MAX) |
798 | continue; | 783 | vol = WM_VOL_MAX; |
799 | vol |= spec->master[ch] & WM_VOL_MUTE; | 784 | vol |= spec->master[ch] & WM_VOL_MUTE; |
800 | if (vol != spec->master[ch]) { | 785 | if (vol != spec->master[ch]) { |
801 | int dac; | 786 | int dac; |
@@ -820,7 +805,7 @@ static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info * | |||
820 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 805 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
821 | uinfo->count = voices; | 806 | uinfo->count = voices; |
822 | uinfo->value.integer.min = 0; /* mute (-101dB) */ | 807 | uinfo->value.integer.min = 0; /* mute (-101dB) */ |
823 | uinfo->value.integer.max = 0x7F; /* 0dB */ | 808 | uinfo->value.integer.max = WM_VOL_MAX; /* 0dB */ |
824 | return 0; | 809 | return 0; |
825 | } | 810 | } |
826 | 811 | ||
@@ -850,9 +835,9 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value * | |||
850 | snd_ice1712_save_gpio_status(ice); | 835 | snd_ice1712_save_gpio_status(ice); |
851 | for (i = 0; i < voices; i++) { | 836 | for (i = 0; i < voices; i++) { |
852 | unsigned int vol = ucontrol->value.integer.value[i]; | 837 | unsigned int vol = ucontrol->value.integer.value[i]; |
853 | if (vol > 0x7f) | 838 | if (vol > WM_VOL_MAX) |
854 | continue; | 839 | vol = WM_VOL_MAX; |
855 | vol |= spec->vol[ofs+i]; | 840 | vol |= spec->vol[ofs+i] & WM_VOL_MUTE; |
856 | if (vol != spec->vol[ofs+i]) { | 841 | if (vol != spec->vol[ofs+i]) { |
857 | spec->vol[ofs+i] = vol; | 842 | spec->vol[ofs+i] = vol; |
858 | idx = WM_DAC_ATTEN + ofs + i; | 843 | idx = WM_DAC_ATTEN + ofs + i; |
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index 0c9413d5341b..98bc3b7681b5 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -380,7 +380,7 @@ static struct snd_kcontrol_new juli_mute_controls[] __devinitdata = { | |||
380 | * inputs) are fed from Xilinx. | 380 | * inputs) are fed from Xilinx. |
381 | * | 381 | * |
382 | * I even checked traces on board and coded a support in driver for | 382 | * I even checked traces on board and coded a support in driver for |
383 | * an alternative possiblity - the unused I2S ICE output channels | 383 | * an alternative possibility - the unused I2S ICE output channels |
384 | * switched to HW-IN/SPDIF-IN and providing the monitoring signal to | 384 | * switched to HW-IN/SPDIF-IN and providing the monitoring signal to |
385 | * the DAC - to no avail. The I2S outputs seem to be unconnected. | 385 | * the DAC - to no avail. The I2S outputs seem to be unconnected. |
386 | * | 386 | * |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index b5ca02e2038c..e66ef2b69b5d 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -1058,7 +1058,7 @@ setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate) | |||
1058 | rptr.retwords[2] != M && | 1058 | rptr.retwords[2] != M && |
1059 | rptr.retwords[3] != N && | 1059 | rptr.retwords[3] != N && |
1060 | i++ < MAX_WRITE_RETRY); | 1060 | i++ < MAX_WRITE_RETRY); |
1061 | if (i == MAX_WRITE_RETRY) { | 1061 | if (i > MAX_WRITE_RETRY) { |
1062 | snd_printdd("sent samplerate %d: %d failed\n", | 1062 | snd_printdd("sent samplerate %d: %d failed\n", |
1063 | *intdec, rate); | 1063 | *intdec, rate); |
1064 | return -EIO; | 1064 | return -EIO; |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 0dce331a2a3b..a1b10d1a384d 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -3017,7 +3017,7 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry, | |||
3017 | insel = "Coaxial"; | 3017 | insel = "Coaxial"; |
3018 | break; | 3018 | break; |
3019 | default: | 3019 | default: |
3020 | insel = "Unkown"; | 3020 | insel = "Unknown"; |
3021 | } | 3021 | } |
3022 | 3022 | ||
3023 | switch (hdspm->control_register & HDSPM_SyncRefMask) { | 3023 | switch (hdspm->control_register & HDSPM_SyncRefMask) { |
@@ -3028,7 +3028,7 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry, | |||
3028 | syncref = "MADI"; | 3028 | syncref = "MADI"; |
3029 | break; | 3029 | break; |
3030 | default: | 3030 | default: |
3031 | syncref = "Unkown"; | 3031 | syncref = "Unknown"; |
3032 | } | 3032 | } |
3033 | snd_iprintf(buffer, "Inputsel = %s, SyncRef = %s\n", insel, | 3033 | snd_iprintf(buffer, "Inputsel = %s, SyncRef = %s\n", insel, |
3034 | syncref); | 3034 | syncref); |
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/ppc/awacs.c b/sound/ppc/awacs.c index 2e156467b814..b36679384b27 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c | |||
@@ -751,8 +751,8 @@ static void snd_pmac_awacs_suspend(struct snd_pmac *chip) | |||
751 | 751 | ||
752 | static void snd_pmac_awacs_resume(struct snd_pmac *chip) | 752 | static void snd_pmac_awacs_resume(struct snd_pmac *chip) |
753 | { | 753 | { |
754 | if (machine_is_compatible("PowerBook3,1") | 754 | if (of_machine_is_compatible("PowerBook3,1") |
755 | || machine_is_compatible("PowerBook3,2")) { | 755 | || of_machine_is_compatible("PowerBook3,2")) { |
756 | msleep(100); | 756 | msleep(100); |
757 | snd_pmac_awacs_write_reg(chip, 1, | 757 | snd_pmac_awacs_write_reg(chip, 1, |
758 | chip->awacs_reg[1] & ~MASK_PAROUT); | 758 | chip->awacs_reg[1] & ~MASK_PAROUT); |
@@ -780,16 +780,16 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip) | |||
780 | } | 780 | } |
781 | #endif /* CONFIG_PM */ | 781 | #endif /* CONFIG_PM */ |
782 | 782 | ||
783 | #define IS_PM7500 (machine_is_compatible("AAPL,7500") \ | 783 | #define IS_PM7500 (of_machine_is_compatible("AAPL,7500") \ |
784 | || machine_is_compatible("AAPL,8500") \ | 784 | || of_machine_is_compatible("AAPL,8500") \ |
785 | || machine_is_compatible("AAPL,9500")) | 785 | || of_machine_is_compatible("AAPL,9500")) |
786 | #define IS_PM5500 (machine_is_compatible("AAPL,e411")) | 786 | #define IS_PM5500 (of_machine_is_compatible("AAPL,e411")) |
787 | #define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) | 787 | #define IS_BEIGE (of_machine_is_compatible("AAPL,Gossamer")) |
788 | #define IS_IMAC1 (machine_is_compatible("PowerMac2,1")) | 788 | #define IS_IMAC1 (of_machine_is_compatible("PowerMac2,1")) |
789 | #define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \ | 789 | #define IS_IMAC2 (of_machine_is_compatible("PowerMac2,2") \ |
790 | || machine_is_compatible("PowerMac4,1")) | 790 | || of_machine_is_compatible("PowerMac4,1")) |
791 | #define IS_G4AGP (machine_is_compatible("PowerMac3,1")) | 791 | #define IS_G4AGP (of_machine_is_compatible("PowerMac3,1")) |
792 | #define IS_LOMBARD (machine_is_compatible("PowerBook1,1")) | 792 | #define IS_LOMBARD (of_machine_is_compatible("PowerBook1,1")) |
793 | 793 | ||
794 | static int imac1, imac2; | 794 | static int imac1, imac2; |
795 | 795 | ||
diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c index 0accfe49735b..1f72e1c786bf 100644 --- a/sound/ppc/burgundy.c +++ b/sound/ppc/burgundy.c | |||
@@ -582,7 +582,7 @@ static int snd_pmac_burgundy_detect_headphone(struct snd_pmac *chip) | |||
582 | static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_notify) | 582 | static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_notify) |
583 | { | 583 | { |
584 | if (chip->auto_mute) { | 584 | if (chip->auto_mute) { |
585 | int imac = machine_is_compatible("iMac"); | 585 | int imac = of_machine_is_compatible("iMac"); |
586 | int reg, oreg; | 586 | int reg, oreg; |
587 | reg = oreg = snd_pmac_burgundy_rcb(chip, | 587 | reg = oreg = snd_pmac_burgundy_rcb(chip, |
588 | MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES); | 588 | MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES); |
@@ -620,7 +620,7 @@ static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_noti | |||
620 | */ | 620 | */ |
621 | int __devinit snd_pmac_burgundy_init(struct snd_pmac *chip) | 621 | int __devinit snd_pmac_burgundy_init(struct snd_pmac *chip) |
622 | { | 622 | { |
623 | int imac = machine_is_compatible("iMac"); | 623 | int imac = of_machine_is_compatible("iMac"); |
624 | int i, err; | 624 | int i, err; |
625 | 625 | ||
626 | /* Checks to see the chip is alive and kicking */ | 626 | /* Checks to see the chip is alive and kicking */ |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 7bc492ee77ec..85081172403f 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
@@ -922,11 +922,11 @@ static void __devinit detect_byte_swap(struct snd_pmac *chip) | |||
922 | } | 922 | } |
923 | 923 | ||
924 | /* it seems the Pismo & iBook can't byte-swap in hardware. */ | 924 | /* it seems the Pismo & iBook can't byte-swap in hardware. */ |
925 | if (machine_is_compatible("PowerBook3,1") || | 925 | if (of_machine_is_compatible("PowerBook3,1") || |
926 | machine_is_compatible("PowerBook2,1")) | 926 | of_machine_is_compatible("PowerBook2,1")) |
927 | chip->can_byte_swap = 0 ; | 927 | chip->can_byte_swap = 0 ; |
928 | 928 | ||
929 | if (machine_is_compatible("PowerBook2,1")) | 929 | if (of_machine_is_compatible("PowerBook2,1")) |
930 | chip->can_duplex = 0; | 930 | chip->can_duplex = 0; |
931 | } | 931 | } |
932 | 932 | ||
@@ -959,11 +959,11 @@ static int __devinit snd_pmac_detect(struct snd_pmac *chip) | |||
959 | chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ | 959 | chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ |
960 | 960 | ||
961 | /* check machine type */ | 961 | /* check machine type */ |
962 | if (machine_is_compatible("AAPL,3400/2400") | 962 | if (of_machine_is_compatible("AAPL,3400/2400") |
963 | || machine_is_compatible("AAPL,3500")) | 963 | || of_machine_is_compatible("AAPL,3500")) |
964 | chip->is_pbook_3400 = 1; | 964 | chip->is_pbook_3400 = 1; |
965 | else if (machine_is_compatible("PowerBook1,1") | 965 | else if (of_machine_is_compatible("PowerBook1,1") |
966 | || machine_is_compatible("AAPL,PowerBook1998")) | 966 | || of_machine_is_compatible("AAPL,PowerBook1998")) |
967 | chip->is_pbook_G3 = 1; | 967 | chip->is_pbook_G3 = 1; |
968 | chip->node = of_find_node_by_name(NULL, "awacs"); | 968 | chip->node = of_find_node_by_name(NULL, "awacs"); |
969 | sound = of_node_get(chip->node); | 969 | sound = of_node_get(chip->node); |
@@ -1033,8 +1033,8 @@ static int __devinit snd_pmac_detect(struct snd_pmac *chip) | |||
1033 | } | 1033 | } |
1034 | if (of_device_is_compatible(sound, "tumbler")) { | 1034 | if (of_device_is_compatible(sound, "tumbler")) { |
1035 | chip->model = PMAC_TUMBLER; | 1035 | chip->model = PMAC_TUMBLER; |
1036 | chip->can_capture = machine_is_compatible("PowerMac4,2") | 1036 | chip->can_capture = of_machine_is_compatible("PowerMac4,2") |
1037 | || machine_is_compatible("PowerBook4,1"); | 1037 | || of_machine_is_compatible("PowerBook4,1"); |
1038 | chip->can_duplex = 0; | 1038 | chip->can_duplex = 0; |
1039 | // chip->can_byte_swap = 0; /* FIXME: check this */ | 1039 | // chip->can_byte_swap = 0; /* FIXME: check this */ |
1040 | chip->num_freqs = ARRAY_SIZE(tumbler_freqs); | 1040 | chip->num_freqs = ARRAY_SIZE(tumbler_freqs); |
diff --git a/sound/soc/au1x/Kconfig b/sound/soc/au1x/Kconfig index 410a893aa66b..4b67140fdec3 100644 --- a/sound/soc/au1x/Kconfig +++ b/sound/soc/au1x/Kconfig | |||
@@ -22,11 +22,13 @@ config SND_SOC_AU1XPSC_AC97 | |||
22 | ## | 22 | ## |
23 | ## Boards | 23 | ## Boards |
24 | ## | 24 | ## |
25 | config SND_SOC_SAMPLE_PSC_AC97 | 25 | config SND_SOC_DB1200 |
26 | tristate "Sample Au12x0/Au1550 PSC AC97 sound machine" | 26 | tristate "DB1200 AC97+I2S audio support" |
27 | depends on SND_SOC_AU1XPSC | 27 | depends on SND_SOC_AU1XPSC |
28 | select SND_SOC_AU1XPSC_AC97 | 28 | select SND_SOC_AU1XPSC_AC97 |
29 | select SND_SOC_AC97_CODEC | 29 | select SND_SOC_AC97_CODEC |
30 | select SND_SOC_AU1XPSC_I2S | ||
31 | select SND_SOC_WM8731 | ||
30 | help | 32 | help |
31 | This is a sample AC97 sound machine for use in Au12x0/Au1550 | 33 | Select this option to enable audio (AC97 or I2S) on the |
32 | based systems which have audio on PSC1 (e.g. Db1200 demoboard). | 34 | Alchemy/AMD/RMI DB1200 demoboard. |
diff --git a/sound/soc/au1x/Makefile b/sound/soc/au1x/Makefile index 6c6950b8003a..16873076e8c4 100644 --- a/sound/soc/au1x/Makefile +++ b/sound/soc/au1x/Makefile | |||
@@ -8,6 +8,6 @@ obj-$(CONFIG_SND_SOC_AU1XPSC_I2S) += snd-soc-au1xpsc-i2s.o | |||
8 | obj-$(CONFIG_SND_SOC_AU1XPSC_AC97) += snd-soc-au1xpsc-ac97.o | 8 | obj-$(CONFIG_SND_SOC_AU1XPSC_AC97) += snd-soc-au1xpsc-ac97.o |
9 | 9 | ||
10 | # Boards | 10 | # Boards |
11 | snd-soc-sample-ac97-objs := sample-ac97.o | 11 | snd-soc-db1200-objs := db1200.o |
12 | 12 | ||
13 | obj-$(CONFIG_SND_SOC_SAMPLE_PSC_AC97) += snd-soc-sample-ac97.o | 13 | obj-$(CONFIG_SND_SOC_DB1200) += snd-soc-db1200.o |
diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c new file mode 100644 index 000000000000..cdf7be1b9b91 --- /dev/null +++ b/sound/soc/au1x/db1200.c | |||
@@ -0,0 +1,141 @@ | |||
1 | /* | ||
2 | * DB1200 ASoC audio fabric support code. | ||
3 | * | ||
4 | * (c) 2008-9 Manuel Lauss <manuel.lauss@gmail.com> | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/module.h> | ||
9 | #include <linux/moduleparam.h> | ||
10 | #include <linux/timer.h> | ||
11 | #include <linux/interrupt.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | #include <sound/core.h> | ||
14 | #include <sound/pcm.h> | ||
15 | #include <sound/soc.h> | ||
16 | #include <sound/soc-dapm.h> | ||
17 | #include <asm/mach-au1x00/au1000.h> | ||
18 | #include <asm/mach-au1x00/au1xxx_psc.h> | ||
19 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | ||
20 | #include <asm/mach-db1x00/bcsr.h> | ||
21 | |||
22 | #include "../codecs/ac97.h" | ||
23 | #include "../codecs/wm8731.h" | ||
24 | #include "psc.h" | ||
25 | |||
26 | /*------------------------- AC97 PART ---------------------------*/ | ||
27 | |||
28 | static struct snd_soc_dai_link db1200_ac97_dai = { | ||
29 | .name = "AC97", | ||
30 | .stream_name = "AC97 HiFi", | ||
31 | .cpu_dai = &au1xpsc_ac97_dai, | ||
32 | .codec_dai = &ac97_dai, | ||
33 | }; | ||
34 | |||
35 | static struct snd_soc_card db1200_ac97_machine = { | ||
36 | .name = "DB1200_AC97", | ||
37 | .dai_link = &db1200_ac97_dai, | ||
38 | .num_links = 1, | ||
39 | .platform = &au1xpsc_soc_platform, | ||
40 | }; | ||
41 | |||
42 | static struct snd_soc_device db1200_ac97_devdata = { | ||
43 | .card = &db1200_ac97_machine, | ||
44 | .codec_dev = &soc_codec_dev_ac97, | ||
45 | }; | ||
46 | |||
47 | /*------------------------- I2S PART ---------------------------*/ | ||
48 | |||
49 | static int db1200_i2s_startup(struct snd_pcm_substream *substream) | ||
50 | { | ||
51 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
52 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | ||
53 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
54 | int ret; | ||
55 | |||
56 | /* WM8731 has its own 12MHz crystal */ | ||
57 | snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, | ||
58 | 12000000, SND_SOC_CLOCK_IN); | ||
59 | |||
60 | /* codec is bitclock and lrclk master */ | ||
61 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J | | ||
62 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
63 | if (ret < 0) | ||
64 | goto out; | ||
65 | |||
66 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_LEFT_J | | ||
67 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
68 | if (ret < 0) | ||
69 | goto out; | ||
70 | |||
71 | ret = 0; | ||
72 | out: | ||
73 | return ret; | ||
74 | } | ||
75 | |||
76 | static struct snd_soc_ops db1200_i2s_wm8731_ops = { | ||
77 | .startup = db1200_i2s_startup, | ||
78 | }; | ||
79 | |||
80 | static struct snd_soc_dai_link db1200_i2s_dai = { | ||
81 | .name = "WM8731", | ||
82 | .stream_name = "WM8731 PCM", | ||
83 | .cpu_dai = &au1xpsc_i2s_dai, | ||
84 | .codec_dai = &wm8731_dai, | ||
85 | .ops = &db1200_i2s_wm8731_ops, | ||
86 | }; | ||
87 | |||
88 | static struct snd_soc_card db1200_i2s_machine = { | ||
89 | .name = "DB1200_I2S", | ||
90 | .dai_link = &db1200_i2s_dai, | ||
91 | .num_links = 1, | ||
92 | .platform = &au1xpsc_soc_platform, | ||
93 | }; | ||
94 | |||
95 | static struct snd_soc_device db1200_i2s_devdata = { | ||
96 | .card = &db1200_i2s_machine, | ||
97 | .codec_dev = &soc_codec_dev_wm8731, | ||
98 | }; | ||
99 | |||
100 | /*------------------------- COMMON PART ---------------------------*/ | ||
101 | |||
102 | static struct platform_device *db1200_asoc_dev; | ||
103 | |||
104 | static int __init db1200_audio_load(void) | ||
105 | { | ||
106 | int ret; | ||
107 | |||
108 | ret = -ENOMEM; | ||
109 | db1200_asoc_dev = platform_device_alloc("soc-audio", -1); | ||
110 | if (!db1200_asoc_dev) | ||
111 | goto out; | ||
112 | |||
113 | /* DB1200 board setup set PSC1MUX to preferred audio device */ | ||
114 | if (bcsr_read(BCSR_RESETS) & BCSR_RESETS_PSC1MUX) | ||
115 | platform_set_drvdata(db1200_asoc_dev, &db1200_i2s_devdata); | ||
116 | else | ||
117 | platform_set_drvdata(db1200_asoc_dev, &db1200_ac97_devdata); | ||
118 | |||
119 | db1200_ac97_devdata.dev = &db1200_asoc_dev->dev; | ||
120 | db1200_i2s_devdata.dev = &db1200_asoc_dev->dev; | ||
121 | ret = platform_device_add(db1200_asoc_dev); | ||
122 | |||
123 | if (ret) { | ||
124 | platform_device_put(db1200_asoc_dev); | ||
125 | db1200_asoc_dev = NULL; | ||
126 | } | ||
127 | out: | ||
128 | return ret; | ||
129 | } | ||
130 | |||
131 | static void __exit db1200_audio_unload(void) | ||
132 | { | ||
133 | platform_device_unregister(db1200_asoc_dev); | ||
134 | } | ||
135 | |||
136 | module_init(db1200_audio_load); | ||
137 | module_exit(db1200_audio_unload); | ||
138 | |||
139 | MODULE_LICENSE("GPL"); | ||
140 | MODULE_DESCRIPTION("DB1200 ASoC audio support"); | ||
141 | MODULE_AUTHOR("Manuel Lauss"); | ||
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 19e4d37eba1c..6d9f4c624949 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c | |||
@@ -51,8 +51,8 @@ struct au1xpsc_audio_dmadata { | |||
51 | struct snd_pcm_substream *substream; | 51 | struct snd_pcm_substream *substream; |
52 | unsigned long curr_period; /* current segment DDMA is working on */ | 52 | unsigned long curr_period; /* current segment DDMA is working on */ |
53 | unsigned long q_period; /* queue period(s) */ | 53 | unsigned long q_period; /* queue period(s) */ |
54 | unsigned long dma_area; /* address of queued DMA area */ | 54 | dma_addr_t dma_area; /* address of queued DMA area */ |
55 | unsigned long dma_area_s; /* start address of DMA area */ | 55 | dma_addr_t dma_area_s; /* start address of DMA area */ |
56 | unsigned long pos; /* current byte position being played */ | 56 | unsigned long pos; /* current byte position being played */ |
57 | unsigned long periods; /* number of SG segments in total */ | 57 | unsigned long periods; /* number of SG segments in total */ |
58 | unsigned long period_bytes; /* size in bytes of one SG segment */ | 58 | unsigned long period_bytes; /* size in bytes of one SG segment */ |
@@ -94,8 +94,7 @@ static const struct snd_pcm_hardware au1xpsc_pcm_hardware = { | |||
94 | 94 | ||
95 | static void au1x_pcm_queue_tx(struct au1xpsc_audio_dmadata *cd) | 95 | static void au1x_pcm_queue_tx(struct au1xpsc_audio_dmadata *cd) |
96 | { | 96 | { |
97 | au1xxx_dbdma_put_source_flags(cd->ddma_chan, | 97 | au1xxx_dbdma_put_source(cd->ddma_chan, cd->dma_area, |
98 | (void *)phys_to_virt(cd->dma_area), | ||
99 | cd->period_bytes, DDMA_FLAGS_IE); | 98 | cd->period_bytes, DDMA_FLAGS_IE); |
100 | 99 | ||
101 | /* update next-to-queue period */ | 100 | /* update next-to-queue period */ |
@@ -109,9 +108,8 @@ static void au1x_pcm_queue_tx(struct au1xpsc_audio_dmadata *cd) | |||
109 | 108 | ||
110 | static void au1x_pcm_queue_rx(struct au1xpsc_audio_dmadata *cd) | 109 | static void au1x_pcm_queue_rx(struct au1xpsc_audio_dmadata *cd) |
111 | { | 110 | { |
112 | au1xxx_dbdma_put_dest_flags(cd->ddma_chan, | 111 | au1xxx_dbdma_put_dest(cd->ddma_chan, cd->dma_area, |
113 | (void *)phys_to_virt(cd->dma_area), | 112 | cd->period_bytes, DDMA_FLAGS_IE); |
114 | cd->period_bytes, DDMA_FLAGS_IE); | ||
115 | 113 | ||
116 | /* update next-to-queue period */ | 114 | /* update next-to-queue period */ |
117 | ++cd->q_period; | 115 | ++cd->q_period; |
@@ -233,7 +231,7 @@ static int au1xpsc_pcm_hw_params(struct snd_pcm_substream *substream, | |||
233 | pcd->substream = substream; | 231 | pcd->substream = substream; |
234 | pcd->period_bytes = params_period_bytes(params); | 232 | pcd->period_bytes = params_period_bytes(params); |
235 | pcd->periods = params_periods(params); | 233 | pcd->periods = params_periods(params); |
236 | pcd->dma_area_s = pcd->dma_area = (unsigned long)runtime->dma_addr; | 234 | pcd->dma_area_s = pcd->dma_area = runtime->dma_addr; |
237 | pcd->q_period = 0; | 235 | pcd->q_period = 0; |
238 | pcd->curr_period = 0; | 236 | pcd->curr_period = 0; |
239 | pcd->pos = 0; | 237 | pcd->pos = 0; |
diff --git a/sound/soc/au1x/sample-ac97.c b/sound/soc/au1x/sample-ac97.c deleted file mode 100644 index 27683eb7905e..000000000000 --- a/sound/soc/au1x/sample-ac97.c +++ /dev/null | |||
@@ -1,144 +0,0 @@ | |||
1 | /* | ||
2 | * Sample Au12x0/Au1550 PSC AC97 sound machine. | ||
3 | * | ||
4 | * Copyright (c) 2007-2008 Manuel Lauss <mano@roarinelk.homelinux.net> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms outlined in the file COPYING at the root of this | ||
8 | * source archive. | ||
9 | * | ||
10 | * This is a very generic AC97 sound machine driver for boards which | ||
11 | * have (AC97) audio at PSC1 (e.g. DB1200 demoboards). | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/moduleparam.h> | ||
16 | #include <linux/timer.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <sound/core.h> | ||
20 | #include <sound/pcm.h> | ||
21 | #include <sound/soc.h> | ||
22 | #include <sound/soc-dapm.h> | ||
23 | #include <asm/mach-au1x00/au1000.h> | ||
24 | #include <asm/mach-au1x00/au1xxx_psc.h> | ||
25 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | ||
26 | |||
27 | #include "../codecs/ac97.h" | ||
28 | #include "psc.h" | ||
29 | |||
30 | static int au1xpsc_sample_ac97_init(struct snd_soc_codec *codec) | ||
31 | { | ||
32 | snd_soc_dapm_sync(codec); | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static struct snd_soc_dai_link au1xpsc_sample_ac97_dai = { | ||
37 | .name = "AC97", | ||
38 | .stream_name = "AC97 HiFi", | ||
39 | .cpu_dai = &au1xpsc_ac97_dai, /* see psc-ac97.c */ | ||
40 | .codec_dai = &ac97_dai, /* see codecs/ac97.c */ | ||
41 | .init = au1xpsc_sample_ac97_init, | ||
42 | .ops = NULL, | ||
43 | }; | ||
44 | |||
45 | static struct snd_soc_card au1xpsc_sample_ac97_machine = { | ||
46 | .name = "Au1xxx PSC AC97 Audio", | ||
47 | .dai_link = &au1xpsc_sample_ac97_dai, | ||
48 | .num_links = 1, | ||
49 | }; | ||
50 | |||
51 | static struct snd_soc_device au1xpsc_sample_ac97_devdata = { | ||
52 | .card = &au1xpsc_sample_ac97_machine, | ||
53 | .platform = &au1xpsc_soc_platform, /* see dbdma2.c */ | ||
54 | .codec_dev = &soc_codec_dev_ac97, | ||
55 | }; | ||
56 | |||
57 | static struct resource au1xpsc_psc1_res[] = { | ||
58 | [0] = { | ||
59 | .start = CPHYSADDR(PSC1_BASE_ADDR), | ||
60 | .end = CPHYSADDR(PSC1_BASE_ADDR) + 0x000fffff, | ||
61 | .flags = IORESOURCE_MEM, | ||
62 | }, | ||
63 | [1] = { | ||
64 | #ifdef CONFIG_SOC_AU1200 | ||
65 | .start = AU1200_PSC1_INT, | ||
66 | .end = AU1200_PSC1_INT, | ||
67 | #elif defined(CONFIG_SOC_AU1550) | ||
68 | .start = AU1550_PSC1_INT, | ||
69 | .end = AU1550_PSC1_INT, | ||
70 | #endif | ||
71 | .flags = IORESOURCE_IRQ, | ||
72 | }, | ||
73 | [2] = { | ||
74 | .start = DSCR_CMD0_PSC1_TX, | ||
75 | .end = DSCR_CMD0_PSC1_TX, | ||
76 | .flags = IORESOURCE_DMA, | ||
77 | }, | ||
78 | [3] = { | ||
79 | .start = DSCR_CMD0_PSC1_RX, | ||
80 | .end = DSCR_CMD0_PSC1_RX, | ||
81 | .flags = IORESOURCE_DMA, | ||
82 | }, | ||
83 | }; | ||
84 | |||
85 | static struct platform_device *au1xpsc_sample_ac97_dev; | ||
86 | |||
87 | static int __init au1xpsc_sample_ac97_load(void) | ||
88 | { | ||
89 | int ret; | ||
90 | |||
91 | #ifdef CONFIG_SOC_AU1200 | ||
92 | unsigned long io; | ||
93 | |||
94 | /* modify sys_pinfunc for AC97 on PSC1 */ | ||
95 | io = au_readl(SYS_PINFUNC); | ||
96 | io |= SYS_PINFUNC_P1C; | ||
97 | io &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B); | ||
98 | au_writel(io, SYS_PINFUNC); | ||
99 | au_sync(); | ||
100 | #endif | ||
101 | |||
102 | ret = -ENOMEM; | ||
103 | |||
104 | /* setup PSC clock source for AC97 part: external clock provided | ||
105 | * by codec. The psc-ac97.c driver depends on this setting! | ||
106 | */ | ||
107 | au_writel(PSC_SEL_CLK_SERCLK, PSC1_BASE_ADDR + PSC_SEL_OFFSET); | ||
108 | au_sync(); | ||
109 | |||
110 | au1xpsc_sample_ac97_dev = platform_device_alloc("soc-audio", -1); | ||
111 | if (!au1xpsc_sample_ac97_dev) | ||
112 | goto out; | ||
113 | |||
114 | au1xpsc_sample_ac97_dev->resource = | ||
115 | kmemdup(au1xpsc_psc1_res, sizeof(struct resource) * | ||
116 | ARRAY_SIZE(au1xpsc_psc1_res), GFP_KERNEL); | ||
117 | au1xpsc_sample_ac97_dev->num_resources = ARRAY_SIZE(au1xpsc_psc1_res); | ||
118 | au1xpsc_sample_ac97_dev->id = 1; | ||
119 | |||
120 | platform_set_drvdata(au1xpsc_sample_ac97_dev, | ||
121 | &au1xpsc_sample_ac97_devdata); | ||
122 | au1xpsc_sample_ac97_devdata.dev = &au1xpsc_sample_ac97_dev->dev; | ||
123 | ret = platform_device_add(au1xpsc_sample_ac97_dev); | ||
124 | |||
125 | if (ret) { | ||
126 | platform_device_put(au1xpsc_sample_ac97_dev); | ||
127 | au1xpsc_sample_ac97_dev = NULL; | ||
128 | } | ||
129 | |||
130 | out: | ||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | static void __exit au1xpsc_sample_ac97_exit(void) | ||
135 | { | ||
136 | platform_device_unregister(au1xpsc_sample_ac97_dev); | ||
137 | } | ||
138 | |||
139 | module_init(au1xpsc_sample_ac97_load); | ||
140 | module_exit(au1xpsc_sample_ac97_exit); | ||
141 | |||
142 | MODULE_LICENSE("GPL"); | ||
143 | MODULE_DESCRIPTION("Au1xxx PSC sample AC97 machine"); | ||
144 | MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>"); | ||
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index 69bd0acc81c8..a1bbe16b7f96 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c | |||
@@ -102,6 +102,12 @@ static int ac97_soc_probe(struct platform_device *pdev) | |||
102 | INIT_LIST_HEAD(&codec->dapm_widgets); | 102 | INIT_LIST_HEAD(&codec->dapm_widgets); |
103 | INIT_LIST_HEAD(&codec->dapm_paths); | 103 | INIT_LIST_HEAD(&codec->dapm_paths); |
104 | 104 | ||
105 | ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); | ||
106 | if (ret < 0) { | ||
107 | printk(KERN_ERR "ASoC: failed to init gen ac97 glue\n"); | ||
108 | goto err; | ||
109 | } | ||
110 | |||
105 | /* register pcms */ | 111 | /* register pcms */ |
106 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | 112 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); |
107 | if (ret < 0) | 113 | if (ret < 0) |
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index b69861d52161..3ef16bbc8c83 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c | |||
@@ -470,7 +470,7 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_ak4642); | |||
470 | 470 | ||
471 | static int __init ak4642_modinit(void) | 471 | static 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 | ||
224 | static 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 | |||
240 | static int stac9766_set_bias_level(struct snd_soc_codec *codec, | 225 | static 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 | ||
316 | static struct snd_soc_dai_ops stac9766_dai_ops_digital = { | 301 | static 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 | ||
321 | struct snd_soc_dai stac9766_dai[] = { | 305 | struct snd_soc_dai stac9766_dai[] = { |
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index a9dc5fb54774..da589d8664d0 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -627,7 +627,7 @@ static int tlv320aic23_resume(struct platform_device *pdev) | |||
627 | u16 reg; | 627 | u16 reg; |
628 | 628 | ||
629 | /* Sync reg_cache with the hardware */ | 629 | /* Sync reg_cache with the hardware */ |
630 | for (reg = 0; reg < TLV320AIC23_RESET; reg++) { | 630 | for (reg = 0; reg <= TLV320AIC23_ACTIVE; reg++) { |
631 | u16 val = tlv320aic23_read_reg_cache(codec, reg); | 631 | u16 val = tlv320aic23_read_reg_cache(codec, reg); |
632 | tlv320aic23_write(codec, reg, val); | 632 | tlv320aic23_write(codec, reg, val); |
633 | } | 633 | } |
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/uda134x.c b/sound/soc/codecs/uda134x.c index aa40d985138f..3e99fe5131dd 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
@@ -101,7 +101,7 @@ static int uda134x_write(struct snd_soc_codec *codec, unsigned int reg, | |||
101 | pr_debug("%s reg: %02X, value:%02X\n", __func__, reg, value); | 101 | pr_debug("%s reg: %02X, value:%02X\n", __func__, reg, value); |
102 | 102 | ||
103 | if (reg >= UDA134X_REGS_NUM) { | 103 | if (reg >= UDA134X_REGS_NUM) { |
104 | printk(KERN_ERR "%s unkown register: reg: %u", | 104 | printk(KERN_ERR "%s unknown register: reg: %u", |
105 | __func__, reg); | 105 | __func__, reg); |
106 | return -EINVAL; | 106 | return -EINVAL; |
107 | } | 107 | } |
@@ -552,7 +552,7 @@ static int uda134x_soc_probe(struct platform_device *pdev) | |||
552 | ARRAY_SIZE(uda1341_snd_controls)); | 552 | ARRAY_SIZE(uda1341_snd_controls)); |
553 | break; | 553 | break; |
554 | default: | 554 | default: |
555 | printk(KERN_ERR "%s unkown codec type: %d", | 555 | printk(KERN_ERR "%s unknown codec type: %d", |
556 | __func__, pd->model); | 556 | __func__, pd->model); |
557 | return -EINVAL; | 557 | return -EINVAL; |
558 | } | 558 | } |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index f82125d9e85a..718ef912e758 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -925,7 +925,7 @@ static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
925 | iface |= 0x3 << 8; | 925 | iface |= 0x3 << 8; |
926 | break; | 926 | break; |
927 | case SND_SOC_DAIFMT_DSP_B: | 927 | case SND_SOC_DAIFMT_DSP_B: |
928 | iface |= 0x3 << 8; /* lg not sure which mode */ | 928 | iface |= 0x3 << 8 | WM8350_AIF_LRCLK_INV; |
929 | break; | 929 | break; |
930 | default: | 930 | default: |
931 | return -EINVAL; | 931 | return -EINVAL; |
@@ -1340,9 +1340,10 @@ static int wm8350_resume(struct platform_device *pdev) | |||
1340 | return 0; | 1340 | return 0; |
1341 | } | 1341 | } |
1342 | 1342 | ||
1343 | static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data) | 1343 | static irqreturn_t wm8350_hp_jack_handler(int irq, void *data) |
1344 | { | 1344 | { |
1345 | struct wm8350_data *priv = data; | 1345 | struct wm8350_data *priv = data; |
1346 | struct wm8350 *wm8350 = priv->codec.control_data; | ||
1346 | u16 reg; | 1347 | u16 reg; |
1347 | int report; | 1348 | int report; |
1348 | int mask; | 1349 | int mask; |
@@ -1365,7 +1366,7 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data) | |||
1365 | 1366 | ||
1366 | if (!jack->jack) { | 1367 | if (!jack->jack) { |
1367 | dev_warn(wm8350->dev, "Jack interrupt called with no jack\n"); | 1368 | dev_warn(wm8350->dev, "Jack interrupt called with no jack\n"); |
1368 | return; | 1369 | return IRQ_NONE; |
1369 | } | 1370 | } |
1370 | 1371 | ||
1371 | /* Debounce */ | 1372 | /* Debounce */ |
@@ -1378,6 +1379,8 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data) | |||
1378 | report = 0; | 1379 | report = 0; |
1379 | 1380 | ||
1380 | snd_soc_jack_report(jack->jack, report, jack->report); | 1381 | snd_soc_jack_report(jack->jack, report, jack->report); |
1382 | |||
1383 | return IRQ_HANDLED; | ||
1381 | } | 1384 | } |
1382 | 1385 | ||
1383 | /** | 1386 | /** |
@@ -1421,9 +1424,7 @@ int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, | |||
1421 | wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena); | 1424 | wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena); |
1422 | 1425 | ||
1423 | /* Sync status */ | 1426 | /* Sync status */ |
1424 | wm8350_hp_jack_handler(wm8350, irq, priv); | 1427 | wm8350_hp_jack_handler(irq, priv); |
1425 | |||
1426 | wm8350_unmask_irq(wm8350, irq); | ||
1427 | 1428 | ||
1428 | return 0; | 1429 | return 0; |
1429 | } | 1430 | } |
@@ -1482,12 +1483,16 @@ static int wm8350_probe(struct platform_device *pdev) | |||
1482 | wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME, | 1483 | wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME, |
1483 | WM8350_OUT2_VU | WM8350_OUT2R_MUTE); | 1484 | WM8350_OUT2_VU | WM8350_OUT2R_MUTE); |
1484 | 1485 | ||
1485 | wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L); | 1486 | /* Make sure jack detect is disabled to start off with */ |
1486 | wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R); | 1487 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, |
1488 | WM8350_JDL_ENA | WM8350_JDR_ENA); | ||
1489 | |||
1487 | wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, | 1490 | wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, |
1488 | wm8350_hp_jack_handler, priv); | 1491 | wm8350_hp_jack_handler, 0, "Left jack detect", |
1492 | priv); | ||
1489 | wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, | 1493 | wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, |
1490 | wm8350_hp_jack_handler, priv); | 1494 | wm8350_hp_jack_handler, 0, "Right jack detect", |
1495 | priv); | ||
1491 | 1496 | ||
1492 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | 1497 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); |
1493 | if (ret < 0) { | 1498 | if (ret < 0) { |
@@ -1516,8 +1521,6 @@ static int wm8350_remove(struct platform_device *pdev) | |||
1516 | WM8350_JDL_ENA | WM8350_JDR_ENA); | 1521 | WM8350_JDL_ENA | WM8350_JDR_ENA); |
1517 | wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA); | 1522 | wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA); |
1518 | 1523 | ||
1519 | wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L); | ||
1520 | wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R); | ||
1521 | wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L); | 1524 | wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L); |
1522 | wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R); | 1525 | wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R); |
1523 | 1526 | ||
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 265e68c75df8..af8cb6995a1f 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c | |||
@@ -424,23 +424,23 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream, | |||
424 | 424 | ||
425 | /* filter coefficient */ | 425 | /* filter coefficient */ |
426 | switch (params_rate(params)) { | 426 | switch (params_rate(params)) { |
427 | case SNDRV_PCM_RATE_8000: | 427 | case 8000: |
428 | adn |= 0x5 << 1; | 428 | adn |= 0x5 << 1; |
429 | break; | 429 | break; |
430 | case SNDRV_PCM_RATE_11025: | 430 | case 11025: |
431 | adn |= 0x4 << 1; | 431 | adn |= 0x4 << 1; |
432 | break; | 432 | break; |
433 | case SNDRV_PCM_RATE_16000: | 433 | case 16000: |
434 | adn |= 0x3 << 1; | 434 | adn |= 0x3 << 1; |
435 | break; | 435 | break; |
436 | case SNDRV_PCM_RATE_22050: | 436 | case 22050: |
437 | adn |= 0x2 << 1; | 437 | adn |= 0x2 << 1; |
438 | break; | 438 | break; |
439 | case SNDRV_PCM_RATE_32000: | 439 | case 32000: |
440 | adn |= 0x1 << 1; | 440 | adn |= 0x1 << 1; |
441 | break; | 441 | break; |
442 | case SNDRV_PCM_RATE_44100: | 442 | case 44100: |
443 | case SNDRV_PCM_RATE_48000: | 443 | case 48000: |
444 | break; | 444 | break; |
445 | } | 445 | } |
446 | 446 | ||
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index c9438dd62df3..dbc368c08263 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -199,7 +199,7 @@ static void wm8900_reset(struct snd_soc_codec *codec) | |||
199 | snd_soc_write(codec, WM8900_REG_RESET, 0); | 199 | snd_soc_write(codec, WM8900_REG_RESET, 0); |
200 | 200 | ||
201 | memcpy(codec->reg_cache, wm8900_reg_defaults, | 201 | memcpy(codec->reg_cache, wm8900_reg_defaults, |
202 | sizeof(codec->reg_cache)); | 202 | sizeof(wm8900_reg_defaults)); |
203 | } | 203 | } |
204 | 204 | ||
205 | static int wm8900_hp_event(struct snd_soc_dapm_widget *w, | 205 | static int wm8900_hp_event(struct snd_soc_dapm_widget *w, |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index b8cae1758642..3595bd57c4eb 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -607,7 +607,7 @@ SOC_SINGLE("Right Input PGA Common Mode Switch", WM8903_ANALOGUE_RIGHT_INPUT_1, | |||
607 | SOC_SINGLE("DRC Switch", WM8903_DRC_0, 15, 1, 0), | 607 | SOC_SINGLE("DRC Switch", WM8903_DRC_0, 15, 1, 0), |
608 | SOC_ENUM("DRC Compressor Slope R0", drc_slope_r0), | 608 | SOC_ENUM("DRC Compressor Slope R0", drc_slope_r0), |
609 | SOC_ENUM("DRC Compressor Slope R1", drc_slope_r1), | 609 | SOC_ENUM("DRC Compressor Slope R1", drc_slope_r1), |
610 | SOC_SINGLE_TLV("DRC Compressor Threashold Volume", WM8903_DRC_3, 5, 124, 1, | 610 | SOC_SINGLE_TLV("DRC Compressor Threshold Volume", WM8903_DRC_3, 5, 124, 1, |
611 | drc_tlv_thresh), | 611 | drc_tlv_thresh), |
612 | SOC_SINGLE_TLV("DRC Volume", WM8903_DRC_3, 0, 30, 1, drc_tlv_amp), | 612 | SOC_SINGLE_TLV("DRC Volume", WM8903_DRC_3, 0, 30, 1, drc_tlv_amp), |
613 | SOC_SINGLE_TLV("DRC Minimum Gain Volume", WM8903_DRC_1, 2, 3, 1, drc_tlv_min), | 613 | SOC_SINGLE_TLV("DRC Minimum Gain Volume", WM8903_DRC_1, 2, 3, 1, drc_tlv_min), |
@@ -617,11 +617,11 @@ SOC_ENUM("DRC Decay Rate", drc_decay), | |||
617 | SOC_ENUM("DRC FF Delay", drc_ff_delay), | 617 | SOC_ENUM("DRC FF Delay", drc_ff_delay), |
618 | SOC_SINGLE("DRC Anticlip Switch", WM8903_DRC_0, 1, 1, 0), | 618 | SOC_SINGLE("DRC Anticlip Switch", WM8903_DRC_0, 1, 1, 0), |
619 | SOC_SINGLE("DRC QR Switch", WM8903_DRC_0, 2, 1, 0), | 619 | SOC_SINGLE("DRC QR Switch", WM8903_DRC_0, 2, 1, 0), |
620 | SOC_SINGLE_TLV("DRC QR Threashold Volume", WM8903_DRC_0, 6, 3, 0, drc_tlv_max), | 620 | SOC_SINGLE_TLV("DRC QR Threshold Volume", WM8903_DRC_0, 6, 3, 0, drc_tlv_max), |
621 | SOC_ENUM("DRC QR Decay Rate", drc_qr_decay), | 621 | SOC_ENUM("DRC QR Decay Rate", drc_qr_decay), |
622 | SOC_SINGLE("DRC Smoothing Switch", WM8903_DRC_0, 3, 1, 0), | 622 | SOC_SINGLE("DRC Smoothing Switch", WM8903_DRC_0, 3, 1, 0), |
623 | SOC_SINGLE("DRC Smoothing Hysteresis Switch", WM8903_DRC_0, 0, 1, 0), | 623 | SOC_SINGLE("DRC Smoothing Hysteresis Switch", WM8903_DRC_0, 0, 1, 0), |
624 | SOC_ENUM("DRC Smoothing Threashold", drc_smoothing), | 624 | SOC_ENUM("DRC Smoothing Threshold", drc_smoothing), |
625 | SOC_SINGLE_TLV("DRC Startup Volume", WM8903_DRC_0, 6, 18, 0, drc_tlv_startup), | 625 | SOC_SINGLE_TLV("DRC Startup Volume", WM8903_DRC_0, 6, 18, 0, drc_tlv_startup), |
626 | 626 | ||
627 | SOC_DOUBLE_R_TLV("Digital Capture Volume", WM8903_ADC_DIGITAL_VOLUME_LEFT, | 627 | SOC_DOUBLE_R_TLV("Digital Capture Volume", WM8903_ADC_DIGITAL_VOLUME_LEFT, |
@@ -1504,7 +1504,7 @@ static int wm8903_resume(struct platform_device *pdev) | |||
1504 | struct i2c_client *i2c = codec->control_data; | 1504 | struct i2c_client *i2c = codec->control_data; |
1505 | int i; | 1505 | int i; |
1506 | u16 *reg_cache = codec->reg_cache; | 1506 | u16 *reg_cache = codec->reg_cache; |
1507 | u16 *tmp_cache = kmemdup(codec->reg_cache, sizeof(wm8903_reg_defaults), | 1507 | u16 *tmp_cache = kmemdup(reg_cache, sizeof(wm8903_reg_defaults), |
1508 | GFP_KERNEL); | 1508 | GFP_KERNEL); |
1509 | 1509 | ||
1510 | /* Bring the codec back up to standby first to minimise pop/clicks */ | 1510 | /* Bring the codec back up to standby first to minimise pop/clicks */ |
@@ -1516,6 +1516,7 @@ static int wm8903_resume(struct platform_device *pdev) | |||
1516 | for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++) | 1516 | for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++) |
1517 | if (tmp_cache[i] != reg_cache[i]) | 1517 | if (tmp_cache[i] != reg_cache[i]) |
1518 | snd_soc_write(codec, i, tmp_cache[i]); | 1518 | snd_soc_write(codec, i, tmp_cache[i]); |
1519 | kfree(tmp_cache); | ||
1519 | } else { | 1520 | } else { |
1520 | dev_err(&i2c->dev, "Failed to allocate temporary cache\n"); | 1521 | dev_err(&i2c->dev, "Failed to allocate temporary cache\n"); |
1521 | } | 1522 | } |
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 3d850b97037a..31e39ffd1d8e 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c | |||
@@ -378,23 +378,23 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream, | |||
378 | iface |= (1 << 9); | 378 | iface |= (1 << 9); |
379 | 379 | ||
380 | switch (params_rate(params)) { | 380 | switch (params_rate(params)) { |
381 | case SNDRV_PCM_RATE_8000: | 381 | case 8000: |
382 | addcntrl |= (0x5 << 1); | 382 | addcntrl |= (0x5 << 1); |
383 | break; | 383 | break; |
384 | case SNDRV_PCM_RATE_11025: | 384 | case 11025: |
385 | addcntrl |= (0x4 << 1); | 385 | addcntrl |= (0x4 << 1); |
386 | break; | 386 | break; |
387 | case SNDRV_PCM_RATE_16000: | 387 | case 16000: |
388 | addcntrl |= (0x3 << 1); | 388 | addcntrl |= (0x3 << 1); |
389 | break; | 389 | break; |
390 | case SNDRV_PCM_RATE_22050: | 390 | case 22050: |
391 | addcntrl |= (0x2 << 1); | 391 | addcntrl |= (0x2 << 1); |
392 | break; | 392 | break; |
393 | case SNDRV_PCM_RATE_32000: | 393 | case 32000: |
394 | addcntrl |= (0x1 << 1); | 394 | addcntrl |= (0x1 << 1); |
395 | break; | 395 | break; |
396 | case SNDRV_PCM_RATE_44100: | 396 | case 44100: |
397 | case SNDRV_PCM_RATE_48000: | 397 | case 48000: |
398 | break; | 398 | break; |
399 | } | 399 | } |
400 | ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl); | 400 | ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl); |
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index 81c57b5c591c..8812751da8c9 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c | |||
@@ -47,7 +47,7 @@ static const u16 wm8974_reg[WM8974_CACHEREGNUM] = { | |||
47 | }; | 47 | }; |
48 | 48 | ||
49 | #define WM8974_POWER1_BIASEN 0x08 | 49 | #define WM8974_POWER1_BIASEN 0x08 |
50 | #define WM8974_POWER1_BUFIOEN 0x10 | 50 | #define WM8974_POWER1_BUFIOEN 0x04 |
51 | 51 | ||
52 | struct wm8974_priv { | 52 | struct wm8974_priv { |
53 | struct snd_soc_codec codec; | 53 | struct snd_soc_codec codec; |
@@ -482,23 +482,23 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream, | |||
482 | 482 | ||
483 | /* filter coefficient */ | 483 | /* filter coefficient */ |
484 | switch (params_rate(params)) { | 484 | switch (params_rate(params)) { |
485 | case SNDRV_PCM_RATE_8000: | 485 | case 8000: |
486 | adn |= 0x5 << 1; | 486 | adn |= 0x5 << 1; |
487 | break; | 487 | break; |
488 | case SNDRV_PCM_RATE_11025: | 488 | case 11025: |
489 | adn |= 0x4 << 1; | 489 | adn |= 0x4 << 1; |
490 | break; | 490 | break; |
491 | case SNDRV_PCM_RATE_16000: | 491 | case 16000: |
492 | adn |= 0x3 << 1; | 492 | adn |= 0x3 << 1; |
493 | break; | 493 | break; |
494 | case SNDRV_PCM_RATE_22050: | 494 | case 22050: |
495 | adn |= 0x2 << 1; | 495 | adn |= 0x2 << 1; |
496 | break; | 496 | break; |
497 | case SNDRV_PCM_RATE_32000: | 497 | case 32000: |
498 | adn |= 0x1 << 1; | 498 | adn |= 0x1 << 1; |
499 | break; | 499 | break; |
500 | case SNDRV_PCM_RATE_44100: | 500 | case 44100: |
501 | case SNDRV_PCM_RATE_48000: | 501 | case 48000: |
502 | break; | 502 | break; |
503 | } | 503 | } |
504 | 504 | ||
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 5e32f2ed5fc2..2981afae842c 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
@@ -689,7 +689,7 @@ SOC_DOUBLE_TLV("Digital Sidetone Volume", WM8993_DIGITAL_SIDE_TONE, | |||
689 | 689 | ||
690 | SOC_SINGLE("DRC Switch", WM8993_DRC_CONTROL_1, 15, 1, 0), | 690 | SOC_SINGLE("DRC Switch", WM8993_DRC_CONTROL_1, 15, 1, 0), |
691 | SOC_ENUM("DRC Path", drc_path), | 691 | SOC_ENUM("DRC Path", drc_path), |
692 | SOC_SINGLE_TLV("DRC Compressor Threashold Volume", WM8993_DRC_CONTROL_2, | 692 | SOC_SINGLE_TLV("DRC Compressor Threshold Volume", WM8993_DRC_CONTROL_2, |
693 | 2, 60, 1, drc_comp_threash), | 693 | 2, 60, 1, drc_comp_threash), |
694 | SOC_SINGLE_TLV("DRC Compressor Amplitude Volume", WM8993_DRC_CONTROL_3, | 694 | SOC_SINGLE_TLV("DRC Compressor Amplitude Volume", WM8993_DRC_CONTROL_3, |
695 | 11, 30, 1, drc_comp_amp), | 695 | 11, 30, 1, drc_comp_amp), |
@@ -709,7 +709,7 @@ SOC_SINGLE_TLV("DRC Quick Release Volume", WM8993_DRC_CONTROL_3, 2, 3, 0, | |||
709 | SOC_ENUM("DRC Quick Release Rate", drc_qr_rate), | 709 | SOC_ENUM("DRC Quick Release Rate", drc_qr_rate), |
710 | SOC_SINGLE("DRC Smoothing Switch", WM8993_DRC_CONTROL_1, 11, 1, 0), | 710 | SOC_SINGLE("DRC Smoothing Switch", WM8993_DRC_CONTROL_1, 11, 1, 0), |
711 | SOC_SINGLE("DRC Smoothing Hysteresis Switch", WM8993_DRC_CONTROL_1, 8, 1, 0), | 711 | SOC_SINGLE("DRC Smoothing Hysteresis Switch", WM8993_DRC_CONTROL_1, 8, 1, 0), |
712 | SOC_ENUM("DRC Smoothing Hysteresis Threashold", drc_smooth), | 712 | SOC_ENUM("DRC Smoothing Hysteresis Threshold", drc_smooth), |
713 | SOC_SINGLE_TLV("DRC Startup Volume", WM8993_DRC_CONTROL_4, 8, 18, 0, | 713 | SOC_SINGLE_TLV("DRC Startup Volume", WM8993_DRC_CONTROL_4, 8, 18, 0, |
714 | drc_startup_tlv), | 714 | drc_startup_tlv), |
715 | 715 | ||
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/fsl/efika-audio-fabric.c b/sound/soc/fsl/efika-audio-fabric.c index 3326e2a1e863..1a5b8e0d6a34 100644 --- a/sound/soc/fsl/efika-audio-fabric.c +++ b/sound/soc/fsl/efika-audio-fabric.c | |||
@@ -55,7 +55,7 @@ static __init int efika_fabric_init(void) | |||
55 | struct platform_device *pdev; | 55 | struct platform_device *pdev; |
56 | int rc; | 56 | int rc; |
57 | 57 | ||
58 | if (!machine_is_compatible("bplan,efika")) | 58 | if (!of_machine_is_compatible("bplan,efika")) |
59 | return -ENODEV; | 59 | return -ENODEV; |
60 | 60 | ||
61 | card.platform = &mpc5200_audio_dma_platform; | 61 | card.platform = &mpc5200_audio_dma_platform; |
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index b928ef7d28eb..6644cba7cbf2 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c | |||
@@ -55,7 +55,7 @@ static __init int pcm030_fabric_init(void) | |||
55 | struct platform_device *pdev; | 55 | struct platform_device *pdev; |
56 | int rc; | 56 | int rc; |
57 | 57 | ||
58 | if (!machine_is_compatible("phytec,pcm030")) | 58 | if (!of_machine_is_compatible("phytec,pcm030")) |
59 | return -ENODEV; | 59 | return -ENODEV; |
60 | 60 | ||
61 | card.platform = &mpc5200_audio_dma_platform; | 61 | card.platform = &mpc5200_audio_dma_platform; |
diff --git a/sound/soc/imx/mx1_mx2-pcm.c b/sound/soc/imx/mx1_mx2-pcm.c index b83866529397..bffffcd5ff34 100644 --- a/sound/soc/imx/mx1_mx2-pcm.c +++ b/sound/soc/imx/mx1_mx2-pcm.c | |||
@@ -322,12 +322,12 @@ static int mx1_mx2_pcm_open(struct snd_pcm_substream *substream) | |||
322 | 322 | ||
323 | pr_debug("%s: Requesting dma channel (%s)\n", __func__, | 323 | pr_debug("%s: Requesting dma channel (%s)\n", __func__, |
324 | prtd->dma_params->name); | 324 | prtd->dma_params->name); |
325 | prtd->dma_ch = imx_dma_request_by_prio(prtd->dma_params->name, | 325 | ret = imx_dma_request_by_prio(prtd->dma_params->name, DMA_PRIO_HIGH); |
326 | DMA_PRIO_HIGH); | 326 | if (ret < 0) { |
327 | if (prtd->dma_ch < 0) { | ||
328 | printk(KERN_ERR "Error %d requesting dma channel\n", ret); | 327 | printk(KERN_ERR "Error %d requesting dma channel\n", ret); |
329 | return ret; | 328 | return ret; |
330 | } | 329 | } |
330 | prtd->dma_ch = ret; | ||
331 | imx_dma_config_burstlen(prtd->dma_ch, | 331 | imx_dma_config_burstlen(prtd->dma_ch, |
332 | prtd->dma_params->watermark_level); | 332 | prtd->dma_params->watermark_level); |
333 | 333 | ||
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/Makefile b/sound/soc/omap/Makefile index d49458a29bb7..19283e5edfbf 100644 --- a/sound/soc/omap/Makefile +++ b/sound/soc/omap/Makefile | |||
@@ -23,9 +23,9 @@ obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o | |||
23 | obj-$(CONFIG_SND_OMAP_SOC_AMS_DELTA) += snd-soc-ams-delta.o | 23 | obj-$(CONFIG_SND_OMAP_SOC_AMS_DELTA) += snd-soc-ams-delta.o |
24 | obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o | 24 | obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o |
25 | obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o | 25 | obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o |
26 | obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o | 26 | obj-$(CONFIG_SND_OMAP_SOC_OMAP2EVM) += snd-soc-omap2evm.o |
27 | obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o | 27 | obj-$(CONFIG_SND_OMAP_SOC_OMAP3EVM) += snd-soc-omap3evm.o |
28 | obj-$(CONFIG_MACH_OMAP3517EVM) += snd-soc-am3517evm.o | 28 | obj-$(CONFIG_SND_OMAP_SOC_AM3517EVM) += snd-soc-am3517evm.o |
29 | obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o | 29 | obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o |
30 | obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o | 30 | obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o |
31 | obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o | 31 | obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o |
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c index 71b2c161158d..68980c19a3bc 100644 --- a/sound/soc/omap/omap3pandora.c +++ b/sound/soc/omap/omap3pandora.c | |||
@@ -145,6 +145,7 @@ static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = { | |||
145 | }; | 145 | }; |
146 | 146 | ||
147 | static const struct snd_soc_dapm_route omap3pandora_out_map[] = { | 147 | static const struct snd_soc_dapm_route omap3pandora_out_map[] = { |
148 | {"PCM DAC", NULL, "APLL Enable"}, | ||
148 | {"Headphone Amplifier", NULL, "PCM DAC"}, | 149 | {"Headphone Amplifier", NULL, "PCM DAC"}, |
149 | {"Line Out", NULL, "PCM DAC"}, | 150 | {"Line Out", NULL, "PCM DAC"}, |
150 | {"Headphone Jack", NULL, "Headphone Amplifier"}, | 151 | {"Headphone Jack", NULL, "Headphone Amplifier"}, |
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 507b2ed5d58b..4984754f3298 100644 --- a/sound/soc/s3c24xx/s3c24xx_simtec.c +++ b/sound/soc/s3c24xx/s3c24xx_simtec.c | |||
@@ -270,7 +270,7 @@ static int attach_gpio_amp(struct device *dev, | |||
270 | gpio_direction_output(pd->amp_gain[1], 0); | 270 | gpio_direction_output(pd->amp_gain[1], 0); |
271 | } | 271 | } |
272 | 272 | ||
273 | /* note, curently we assume GPA0 isn't valid amp */ | 273 | /* note, currently we assume GPA0 isn't valid amp */ |
274 | if (pdata->amp_gpio > 0) { | 274 | if (pdata->amp_gpio > 0) { |
275 | ret = gpio_request(pd->amp_gpio, "gpio-amp"); | 275 | ret = gpio_request(pd->amp_gpio, "gpio-amp"); |
276 | if (ret) { | 276 | if (ret) { |
@@ -312,7 +312,7 @@ int simtec_audio_resume(struct device *dev) | |||
312 | return 0; | 312 | return 0; |
313 | } | 313 | } |
314 | 314 | ||
315 | struct dev_pm_ops simtec_audio_pmops = { | 315 | const struct dev_pm_ops simtec_audio_pmops = { |
316 | .resume = simtec_audio_resume, | 316 | .resume = simtec_audio_resume, |
317 | }; | 317 | }; |
318 | EXPORT_SYMBOL_GPL(simtec_audio_pmops); | 318 | EXPORT_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, | |||
15 | extern int simtec_audio_remove(struct platform_device *pdev); | 15 | extern int simtec_audio_remove(struct platform_device *pdev); |
16 | 16 | ||
17 | #ifdef CONFIG_PM | 17 | #ifdef CONFIG_PM |
18 | extern struct dev_pm_ops simtec_audio_pmops; | 18 | extern 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/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c index 0eb1722f6581..1d61109e09fa 100644 --- a/sound/soc/s6000/s6000-pcm.c +++ b/sound/soc/s6000/s6000-pcm.c | |||
@@ -196,7 +196,7 @@ static int s6000_pcm_start(struct snd_pcm_substream *substream) | |||
196 | 0 /* destination skip after chunk (impossible) */, | 196 | 0 /* destination skip after chunk (impossible) */, |
197 | 4 /* 16 byte burst size */, | 197 | 4 /* 16 byte burst size */, |
198 | -1 /* don't conserve bandwidth */, | 198 | -1 /* don't conserve bandwidth */, |
199 | 0 /* low watermark irq descriptor theshold */, | 199 | 0 /* low watermark irq descriptor threshold */, |
200 | 0 /* disable hardware timestamps */, | 200 | 0 /* disable hardware timestamps */, |
201 | 1 /* enable channel */); | 201 | 1 /* enable channel */); |
202 | 202 | ||
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index c7af09729c6e..5263ab18f827 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c | |||
@@ -42,42 +42,12 @@ static struct snd_soc_device fsi_snd_devdata = { | |||
42 | .codec_dev = &soc_codec_dev_ak4642, | 42 | .codec_dev = &soc_codec_dev_ak4642, |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #define AK4642_BUS 0 | ||
46 | #define AK4642_ADR 0x12 | ||
47 | static int ak4642_add_i2c_device(void) | ||
48 | { | ||
49 | struct i2c_board_info info; | ||
50 | struct i2c_adapter *adapter; | ||
51 | struct i2c_client *client; | ||
52 | |||
53 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
54 | info.addr = AK4642_ADR; | ||
55 | strlcpy(info.type, "ak4642", I2C_NAME_SIZE); | ||
56 | |||
57 | adapter = i2c_get_adapter(AK4642_BUS); | ||
58 | if (!adapter) { | ||
59 | printk(KERN_DEBUG "can't get i2c adapter\n"); | ||
60 | return -ENODEV; | ||
61 | } | ||
62 | |||
63 | client = i2c_new_device(adapter, &info); | ||
64 | i2c_put_adapter(adapter); | ||
65 | if (!client) { | ||
66 | printk(KERN_DEBUG "can't add i2c device\n"); | ||
67 | return -ENODEV; | ||
68 | } | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static struct platform_device *fsi_snd_device; | 45 | static struct platform_device *fsi_snd_device; |
74 | 46 | ||
75 | static int __init fsi_ak4642_init(void) | 47 | static int __init fsi_ak4642_init(void) |
76 | { | 48 | { |
77 | int ret = -ENOMEM; | 49 | int ret = -ENOMEM; |
78 | 50 | ||
79 | ak4642_add_i2c_device(); | ||
80 | |||
81 | fsi_snd_device = platform_device_alloc("soc-audio", -1); | 51 | fsi_snd_device = platform_device_alloc("soc-audio", -1); |
82 | if (!fsi_snd_device) | 52 | if (!fsi_snd_device) |
83 | goto out; | 53 | goto out; |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 9c49c11c43ce..42813b808389 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -876,7 +876,7 @@ static int fsi_probe(struct platform_device *pdev) | |||
876 | 876 | ||
877 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 877 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
878 | irq = platform_get_irq(pdev, 0); | 878 | irq = platform_get_irq(pdev, 0); |
879 | if (!res || !irq) { | 879 | if (!res || (int)irq <= 0) { |
880 | dev_err(&pdev->dev, "Not enough FSI platform resources.\n"); | 880 | dev_err(&pdev->dev, "Not enough FSI platform resources.\n"); |
881 | ret = -ENODEV; | 881 | ret = -ENODEV; |
882 | goto exit; | 882 | goto exit; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index ef8f28284cb9..0a6440c6f54a 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1236,7 +1236,7 @@ static int soc_poweroff(struct device *dev) | |||
1236 | return 0; | 1236 | return 0; |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | static struct dev_pm_ops soc_pm_ops = { | 1239 | static 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/sound_core.c b/sound/sound_core.c index 49c998186592..7c2d677a2df5 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -61,7 +61,7 @@ static void __exit cleanup_soundcore(void) | |||
61 | class_destroy(sound_class); | 61 | class_destroy(sound_class); |
62 | } | 62 | } |
63 | 63 | ||
64 | module_init(init_soundcore); | 64 | subsys_initcall(init_soundcore); |
65 | module_exit(cleanup_soundcore); | 65 | module_exit(cleanup_soundcore); |
66 | 66 | ||
67 | 67 | ||
@@ -353,7 +353,7 @@ static struct sound_unit *chains[SOUND_STEP]; | |||
353 | * @dev: device pointer | 353 | * @dev: device pointer |
354 | * | 354 | * |
355 | * Allocate a special sound device by minor number from the sound | 355 | * Allocate a special sound device by minor number from the sound |
356 | * subsystem. The allocated number is returned on succes. On failure | 356 | * subsystem. The allocated number is returned on success. On failure |
357 | * a negative error code is returned. | 357 | * a negative error code is returned. |
358 | */ | 358 | */ |
359 | 359 | ||
diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index 63c8f45c0c22..67c91230c197 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c | |||
@@ -374,7 +374,7 @@ sf_zone_new(struct snd_sf_list *sflist, struct snd_soundfont *sf) | |||
374 | 374 | ||
375 | 375 | ||
376 | /* | 376 | /* |
377 | * increment sample couter | 377 | * increment sample counter |
378 | */ | 378 | */ |
379 | static void | 379 | static void |
380 | set_sample_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf, | 380 | set_sample_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf, |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index b074a594c595..9edef4684978 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; |
@@ -1936,7 +1936,7 @@ static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction) | |||
1936 | struct snd_usb_stream *as = snd_pcm_substream_chip(substream); | 1936 | struct snd_usb_stream *as = snd_pcm_substream_chip(substream); |
1937 | struct snd_usb_substream *subs = &as->substream[direction]; | 1937 | struct snd_usb_substream *subs = &as->substream[direction]; |
1938 | 1938 | ||
1939 | if (subs->interface >= 0) { | 1939 | if (!as->chip->shutdown && subs->interface >= 0) { |
1940 | usb_set_interface(subs->dev, subs->interface, 0); | 1940 | usb_set_interface(subs->dev, subs->interface, 0); |
1941 | subs->interface = -1; | 1941 | subs->interface = -1; |
1942 | } | 1942 | } |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index f71cd28eca6b..91bb29666d26 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -194,7 +194,8 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) | |||
194 | if (!us122l->first) | 194 | if (!us122l->first) |
195 | us122l->first = file; | 195 | us122l->first = file; |
196 | 196 | ||
197 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { | 197 | if (us122l->dev->descriptor.idProduct == USB_ID_US144 || |
198 | us122l->dev->descriptor.idProduct == USB_ID_US144MKII) { | ||
198 | iface = usb_ifnum_to_if(us122l->dev, 0); | 199 | iface = usb_ifnum_to_if(us122l->dev, 0); |
199 | usb_autopm_get_interface(iface); | 200 | usb_autopm_get_interface(iface); |
200 | } | 201 | } |
@@ -209,7 +210,8 @@ static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file) | |||
209 | struct usb_interface *iface; | 210 | struct usb_interface *iface; |
210 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); | 211 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); |
211 | 212 | ||
212 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { | 213 | if (us122l->dev->descriptor.idProduct == USB_ID_US144 || |
214 | us122l->dev->descriptor.idProduct == USB_ID_US144MKII) { | ||
213 | iface = usb_ifnum_to_if(us122l->dev, 0); | 215 | iface = usb_ifnum_to_if(us122l->dev, 0); |
214 | usb_autopm_put_interface(iface); | 216 | usb_autopm_put_interface(iface); |
215 | } | 217 | } |
@@ -476,7 +478,8 @@ static bool us122l_create_card(struct snd_card *card) | |||
476 | int err; | 478 | int err; |
477 | struct us122l *us122l = US122L(card); | 479 | struct us122l *us122l = US122L(card); |
478 | 480 | ||
479 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { | 481 | if (us122l->dev->descriptor.idProduct == USB_ID_US144 || |
482 | us122l->dev->descriptor.idProduct == USB_ID_US144MKII) { | ||
480 | err = usb_set_interface(us122l->dev, 0, 1); | 483 | err = usb_set_interface(us122l->dev, 0, 1); |
481 | if (err) { | 484 | if (err) { |
482 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 485 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
@@ -495,7 +498,8 @@ static bool us122l_create_card(struct snd_card *card) | |||
495 | if (!us122l_start(us122l, 44100, 256)) | 498 | if (!us122l_start(us122l, 44100, 256)) |
496 | return false; | 499 | return false; |
497 | 500 | ||
498 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) | 501 | if (us122l->dev->descriptor.idProduct == USB_ID_US144 || |
502 | us122l->dev->descriptor.idProduct == USB_ID_US144MKII) | ||
499 | err = us144_create_usbmidi(card); | 503 | err = us144_create_usbmidi(card); |
500 | else | 504 | else |
501 | err = us122l_create_usbmidi(card); | 505 | err = us122l_create_usbmidi(card); |
@@ -597,7 +601,8 @@ static int snd_us122l_probe(struct usb_interface *intf, | |||
597 | struct snd_card *card; | 601 | struct snd_card *card; |
598 | int err; | 602 | int err; |
599 | 603 | ||
600 | if (device->descriptor.idProduct == USB_ID_US144 | 604 | if ((device->descriptor.idProduct == USB_ID_US144 || |
605 | device->descriptor.idProduct == USB_ID_US144MKII) | ||
601 | && device->speed == USB_SPEED_HIGH) { | 606 | && device->speed == USB_SPEED_HIGH) { |
602 | snd_printk(KERN_ERR "disable ehci-hcd to run US-144 \n"); | 607 | snd_printk(KERN_ERR "disable ehci-hcd to run US-144 \n"); |
603 | return -ENODEV; | 608 | return -ENODEV; |
@@ -692,7 +697,8 @@ static int snd_us122l_resume(struct usb_interface *intf) | |||
692 | 697 | ||
693 | mutex_lock(&us122l->mutex); | 698 | mutex_lock(&us122l->mutex); |
694 | /* needed, doesn't restart without: */ | 699 | /* needed, doesn't restart without: */ |
695 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { | 700 | if (us122l->dev->descriptor.idProduct == USB_ID_US144 || |
701 | us122l->dev->descriptor.idProduct == USB_ID_US144MKII) { | ||
696 | err = usb_set_interface(us122l->dev, 0, 1); | 702 | err = usb_set_interface(us122l->dev, 0, 1); |
697 | if (err) { | 703 | if (err) { |
698 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 704 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
@@ -737,6 +743,16 @@ static struct usb_device_id snd_us122l_usb_id_table[] = { | |||
737 | .idVendor = 0x0644, | 743 | .idVendor = 0x0644, |
738 | .idProduct = USB_ID_US144 | 744 | .idProduct = USB_ID_US144 |
739 | }, | 745 | }, |
746 | { | ||
747 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, | ||
748 | .idVendor = 0x0644, | ||
749 | .idProduct = USB_ID_US122MKII | ||
750 | }, | ||
751 | { | ||
752 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, | ||
753 | .idVendor = 0x0644, | ||
754 | .idProduct = USB_ID_US144MKII | ||
755 | }, | ||
740 | { /* terminator */ } | 756 | { /* terminator */ } |
741 | }; | 757 | }; |
742 | 758 | ||
diff --git a/sound/usb/usx2y/us122l.h b/sound/usb/usx2y/us122l.h index 4daf1982e821..f263b3f96c86 100644 --- a/sound/usb/usx2y/us122l.h +++ b/sound/usb/usx2y/us122l.h | |||
@@ -25,5 +25,7 @@ struct us122l { | |||
25 | 25 | ||
26 | #define USB_ID_US122L 0x800E | 26 | #define USB_ID_US122L 0x800E |
27 | #define USB_ID_US144 0x800F | 27 | #define USB_ID_US144 0x800F |
28 | #define USB_ID_US122MKII 0x8021 | ||
29 | #define USB_ID_US144MKII 0x8020 | ||
28 | 30 | ||
29 | #endif | 31 | #endif |