Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17282ba4 authored by Xiang Xiao's avatar Xiang Xiao Committed by Mark Brown
Browse files

ASoC: dapm: Reorder the bias update sequence



The new sequence ensure that dapm_pre_sequence_async work on
the card before all codecs and dapm_post_sequence_async work
on the card after all codecs.
So the machine driver could utilize the determinate sequence
to do the gloabl setup and teardown in the right place.

Signed-off-by: default avatarXiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 57996358
Loading
Loading
Loading
Loading
+26 −11
Original line number Original line Diff line number Diff line
@@ -1898,10 +1898,14 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)


	trace_snd_soc_dapm_walk_done(card);
	trace_snd_soc_dapm_walk_done(card);


	/* Run all the bias changes in parallel */
	/* Run card bias changes at first */
	list_for_each_entry(d, &card->dapm_list, list)
	dapm_pre_sequence_async(&card->dapm, 0);
	/* Run other bias changes in parallel */
	list_for_each_entry(d, &card->dapm_list, list) {
		if (d != &card->dapm)
			async_schedule_domain(dapm_pre_sequence_async, d,
			async_schedule_domain(dapm_pre_sequence_async, d,
						&async_domain);
						&async_domain);
	}
	async_synchronize_full_domain(&async_domain);
	async_synchronize_full_domain(&async_domain);


	list_for_each_entry(w, &down_list, power_list) {
	list_for_each_entry(w, &down_list, power_list) {
@@ -1921,10 +1925,14 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
	dapm_seq_run(card, &up_list, event, true);
	dapm_seq_run(card, &up_list, event, true);


	/* Run all the bias changes in parallel */
	/* Run all the bias changes in parallel */
	list_for_each_entry(d, &card->dapm_list, list)
	list_for_each_entry(d, &card->dapm_list, list) {
		if (d != &card->dapm)
			async_schedule_domain(dapm_post_sequence_async, d,
			async_schedule_domain(dapm_post_sequence_async, d,
						&async_domain);
						&async_domain);
	}
	async_synchronize_full_domain(&async_domain);
	async_synchronize_full_domain(&async_domain);
	/* Run card bias changes at last */
	dapm_post_sequence_async(&card->dapm, 0);


	/* do we need to notify any clients that DAPM event is complete */
	/* do we need to notify any clients that DAPM event is complete */
	list_for_each_entry(d, &card->dapm_list, list) {
	list_for_each_entry(d, &card->dapm_list, list) {
@@ -4159,6 +4167,7 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card)
	struct snd_soc_dapm_context *dapm;
	struct snd_soc_dapm_context *dapm;


	list_for_each_entry(dapm, &card->dapm_list, list) {
	list_for_each_entry(dapm, &card->dapm_list, list) {
		if (dapm != &card->dapm) {
			soc_dapm_shutdown_dapm(dapm);
			soc_dapm_shutdown_dapm(dapm);
			if (dapm->bias_level == SND_SOC_BIAS_STANDBY)
			if (dapm->bias_level == SND_SOC_BIAS_STANDBY)
				snd_soc_dapm_set_bias_level(dapm,
				snd_soc_dapm_set_bias_level(dapm,
@@ -4166,6 +4175,12 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card)
		}
		}
	}
	}


	soc_dapm_shutdown_dapm(&card->dapm);
	if (card->dapm.bias_level == SND_SOC_BIAS_STANDBY)
		snd_soc_dapm_set_bias_level(&card->dapm,
					    SND_SOC_BIAS_OFF);
}

/* Module information */
/* Module information */
MODULE_AUTHOR("Liam Girdwood, lrg@slimlogic.co.uk");
MODULE_AUTHOR("Liam Girdwood, lrg@slimlogic.co.uk");
MODULE_DESCRIPTION("Dynamic Audio Power Management core for ALSA SoC");
MODULE_DESCRIPTION("Dynamic Audio Power Management core for ALSA SoC");