aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/au1x/psc-i2s.c2
-rw-r--r--sound/soc/codecs/wm9712.c10
-rw-r--r--sound/soc/soc-dapm.c105
3 files changed, 55 insertions, 62 deletions
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c
index ba4b5c199f21..9384702c7ebd 100644
--- a/sound/soc/au1x/psc-i2s.c
+++ b/sound/soc/au1x/psc-i2s.c
@@ -231,7 +231,7 @@ static int au1xpsc_i2s_stop(struct au1xpsc_audio_data *pscdata, int stype)
231 231
232 /* if both TX and RX are idle, disable PSC */ 232 /* if both TX and RX are idle, disable PSC */
233 stat = au_readl(I2S_STAT(pscdata)); 233 stat = au_readl(I2S_STAT(pscdata));
234 if (!(stat & (PSC_I2SSTAT_RB | PSC_I2SSTAT_RB))) { 234 if (!(stat & (PSC_I2SSTAT_TB | PSC_I2SSTAT_RB))) {
235 au_writel(0, I2S_CFG(pscdata)); 235 au_writel(0, I2S_CFG(pscdata));
236 au_sync(); 236 au_sync();
237 au_writel(PSC_CTRL_SUSPEND, PSC_CTRL(pscdata)); 237 au_writel(PSC_CTRL_SUSPEND, PSC_CTRL(pscdata));
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 9fc8edd82225..1fb7f9a7aecd 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -427,20 +427,20 @@ static const struct snd_soc_dapm_route audio_map[] = {
427 {"HPOUTR", NULL, "Headphone PGA"}, 427 {"HPOUTR", NULL, "Headphone PGA"},
428 {"Headphone PGA", NULL, "Right HP Mixer"}, 428 {"Headphone PGA", NULL, "Right HP Mixer"},
429 429
430 /* mono hp mixer */ 430 /* mono mixer */
431 {"Mono HP Mixer", NULL, "Left HP Mixer"}, 431 {"Mono Mixer", NULL, "Left HP Mixer"},
432 {"Mono HP Mixer", NULL, "Right HP Mixer"}, 432 {"Mono Mixer", NULL, "Right HP Mixer"},
433 433
434 /* Out3 Mux */ 434 /* Out3 Mux */
435 {"Out3 Mux", "Left", "Left HP Mixer"}, 435 {"Out3 Mux", "Left", "Left HP Mixer"},
436 {"Out3 Mux", "Mono", "Phone Mixer"}, 436 {"Out3 Mux", "Mono", "Phone Mixer"},
437 {"Out3 Mux", "Left + Right", "Mono HP Mixer"}, 437 {"Out3 Mux", "Left + Right", "Mono Mixer"},
438 {"Out 3 PGA", NULL, "Out3 Mux"}, 438 {"Out 3 PGA", NULL, "Out3 Mux"},
439 {"OUT3", NULL, "Out 3 PGA"}, 439 {"OUT3", NULL, "Out 3 PGA"},
440 440
441 /* speaker Mux */ 441 /* speaker Mux */
442 {"Speaker Mux", "Speaker Mix", "Speaker Mixer"}, 442 {"Speaker Mux", "Speaker Mix", "Speaker Mixer"},
443 {"Speaker Mux", "Headphone Mix", "Mono HP Mixer"}, 443 {"Speaker Mux", "Headphone Mix", "Mono Mixer"},
444 {"Speaker PGA", NULL, "Speaker Mux"}, 444 {"Speaker PGA", NULL, "Speaker Mux"},
445 {"LOUT2", NULL, "Speaker PGA"}, 445 {"LOUT2", NULL, "Speaker PGA"},
446 {"ROUT2", NULL, "Speaker PGA"}, 446 {"ROUT2", NULL, "Speaker PGA"},
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 2c87061c2a6b..820347c9ae4b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -523,24 +523,6 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
523 continue; 523 continue;
524 } 524 }
525 525
526 /* programmable gain/attenuation */
527 if (w->id == snd_soc_dapm_pga) {
528 int on;
529 in = is_connected_input_ep(w);
530 dapm_clear_walk(w->codec);
531 out = is_connected_output_ep(w);
532 dapm_clear_walk(w->codec);
533 w->power = on = (out != 0 && in != 0) ? 1 : 0;
534
535 if (!on)
536 dapm_set_pga(w, on); /* lower volume to reduce pops */
537 dapm_update_bits(w);
538 if (on)
539 dapm_set_pga(w, on); /* restore volume from zero */
540
541 continue;
542 }
543
544 /* pre and post event widgets */ 526 /* pre and post event widgets */
545 if (w->id == snd_soc_dapm_pre) { 527 if (w->id == snd_soc_dapm_pre) {
546 if (!w->event) 528 if (!w->event)
@@ -586,45 +568,56 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
586 power_change = (w->power == power) ? 0: 1; 568 power_change = (w->power == power) ? 0: 1;
587 w->power = power; 569 w->power = power;
588 570
571 if (!power_change)
572 continue;
573
589 /* call any power change event handlers */ 574 /* call any power change event handlers */
590 if (power_change) { 575 if (w->event)
591 if (w->event) { 576 pr_debug("power %s event for %s flags %x\n",
592 pr_debug("power %s event for %s flags %x\n", 577 w->power ? "on" : "off",
593 w->power ? "on" : "off", w->name, w->event_flags); 578 w->name, w->event_flags);
594 if (power) { 579
595 /* power up event */ 580 /* power up pre event */
596 if (w->event_flags & SND_SOC_DAPM_PRE_PMU) { 581 if (power && w->event &&
597 ret = w->event(w, 582 (w->event_flags & SND_SOC_DAPM_PRE_PMU)) {
598 NULL, SND_SOC_DAPM_PRE_PMU); 583 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU);
599 if (ret < 0) 584 if (ret < 0)
600 return ret; 585 return ret;
601 } 586 }
602 dapm_update_bits(w); 587
603 if (w->event_flags & SND_SOC_DAPM_POST_PMU){ 588 /* power down pre event */
604 ret = w->event(w, 589 if (!power && w->event &&
605 NULL, SND_SOC_DAPM_POST_PMU); 590 (w->event_flags & SND_SOC_DAPM_PRE_PMD)) {
606 if (ret < 0) 591 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD);
607 return ret; 592 if (ret < 0)
608 } 593 return ret;
609 } else { 594 }
610 /* power down event */ 595
611 if (w->event_flags & SND_SOC_DAPM_PRE_PMD) { 596 /* Lower PGA volume to reduce pops */
612 ret = w->event(w, 597 if (w->id == snd_soc_dapm_pga && !power)
613 NULL, SND_SOC_DAPM_PRE_PMD); 598 dapm_set_pga(w, power);
614 if (ret < 0) 599
615 return ret; 600 dapm_update_bits(w);
616 } 601
617 dapm_update_bits(w); 602 /* Raise PGA volume to reduce pops */
618 if (w->event_flags & SND_SOC_DAPM_POST_PMD) { 603 if (w->id == snd_soc_dapm_pga && power)
619 ret = w->event(w, 604 dapm_set_pga(w, power);
620 NULL, SND_SOC_DAPM_POST_PMD); 605
621 if (ret < 0) 606 /* power up post event */
622 return ret; 607 if (power && w->event &&
623 } 608 (w->event_flags & SND_SOC_DAPM_POST_PMU)) {
624 } 609 ret = w->event(w,
625 } else 610 NULL, SND_SOC_DAPM_POST_PMU);
626 /* no event handler */ 611 if (ret < 0)
627 dapm_update_bits(w); 612 return ret;
613 }
614
615 /* power down post event */
616 if (!power && w->event &&
617 (w->event_flags & SND_SOC_DAPM_POST_PMD)) {
618 ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD);
619 if (ret < 0)
620 return ret;
628 } 621 }
629 } 622 }
630 } 623 }