forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
2927d6eeca
commit
9dd8d812d3
@ -523,24 +523,6 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* programmable gain/attenuation */
|
|
||||||
if (w->id == snd_soc_dapm_pga) {
|
|
||||||
int on;
|
|
||||||
in = is_connected_input_ep(w);
|
|
||||||
dapm_clear_walk(w->codec);
|
|
||||||
out = is_connected_output_ep(w);
|
|
||||||
dapm_clear_walk(w->codec);
|
|
||||||
w->power = on = (out != 0 && in != 0) ? 1 : 0;
|
|
||||||
|
|
||||||
if (!on)
|
|
||||||
dapm_set_pga(w, on); /* lower volume to reduce pops */
|
|
||||||
dapm_update_bits(w);
|
|
||||||
if (on)
|
|
||||||
dapm_set_pga(w, on); /* restore volume from zero */
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* pre and post event widgets */
|
/* pre and post event widgets */
|
||||||
if (w->id == snd_soc_dapm_pre) {
|
if (w->id == snd_soc_dapm_pre) {
|
||||||
if (!w->event)
|
if (!w->event)
|
||||||
@ -611,8 +593,16 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Lower PGA volume to reduce pops */
|
||||||
|
if (w->id == snd_soc_dapm_pga && !power)
|
||||||
|
dapm_set_pga(w, power);
|
||||||
|
|
||||||
dapm_update_bits(w);
|
dapm_update_bits(w);
|
||||||
|
|
||||||
|
/* Raise PGA volume to reduce pops */
|
||||||
|
if (w->id == snd_soc_dapm_pga && power)
|
||||||
|
dapm_set_pga(w, power);
|
||||||
|
|
||||||
/* power up post event */
|
/* power up post event */
|
||||||
if (power && w->event &&
|
if (power && w->event &&
|
||||||
(w->event_flags & SND_SOC_DAPM_POST_PMU)) {
|
(w->event_flags & SND_SOC_DAPM_POST_PMU)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user