aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-07-17 10:06:51 -0400
committerTakashi Iwai <tiwai@suse.de>2008-07-17 10:17:17 -0400
commit9dd8d812d3b4d208a769ca3cf23a7f9294632d0d (patch)
tree779b9c5902acac0015a3875f10e4f74680e8d954 /sound
parent2927d6eeca0a5004d81fa5bedbdf3f2b1b842903 (diff)
ALSA: ASoC: Factor PGA DAPM handling into main
This allows pre and post event hooks to be provided for PGA widgets. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-dapm.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 17698ef58dfb..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)
@@ -611,8 +593,16 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
611 return ret; 593 return ret;
612 } 594 }
613 595
596 /* Lower PGA volume to reduce pops */
597 if (w->id == snd_soc_dapm_pga && !power)
598 dapm_set_pga(w, power);
599
614 dapm_update_bits(w); 600 dapm_update_bits(w);
615 601
602 /* Raise PGA volume to reduce pops */
603 if (w->id == snd_soc_dapm_pga && power)
604 dapm_set_pga(w, power);
605
616 /* power up post event */ 606 /* power up post event */
617 if (power && w->event && 607 if (power && w->event &&
618 (w->event_flags & SND_SOC_DAPM_POST_PMU)) { 608 (w->event_flags & SND_SOC_DAPM_POST_PMU)) {