Commit 9dd8d812d3b4d208a769ca3cf23a7f9294632d0d
Committed by
Takashi Iwai
1 parent
2927d6eeca
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 8 additions and 18 deletions Side-by-side Diff
sound/soc/soc-dapm.c
... | ... | @@ -523,24 +523,6 @@ |
523 | 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 | 526 | /* pre and post event widgets */ |
545 | 527 | if (w->id == snd_soc_dapm_pre) { |
546 | 528 | if (!w->event) |
547 | 529 | |
... | ... | @@ -611,7 +593,15 @@ |
611 | 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 | 600 | dapm_update_bits(w); |
601 | + | |
602 | + /* Raise PGA volume to reduce pops */ | |
603 | + if (w->id == snd_soc_dapm_pga && power) | |
604 | + dapm_set_pga(w, power); | |
615 | 605 | |
616 | 606 | /* power up post event */ |
617 | 607 | if (power && w->event && |