From patchwork Sat Mar 1 16:04:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang Xiao X-Patchwork-Id: 3747441 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37434BF13A for ; Sat, 1 Mar 2014 16:05:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D35820328 for ; Sat, 1 Mar 2014 16:05:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1C76A2015D for ; Sat, 1 Mar 2014 16:05:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 767E42654E1; Sat, 1 Mar 2014 17:05:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 53A3A261A9A; Sat, 1 Mar 2014 17:04:51 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 15023265327; Sat, 1 Mar 2014 17:04:50 +0100 (CET) Received: from mx1.mxmail.xiaomi.com (mx1.mxmail.xiaomi.com [58.68.235.87]) by alsa0.perex.cz (Postfix) with ESMTP id 5BEB3261A88 for ; Sat, 1 Mar 2014 17:04:40 +0100 (CET) Received: from mail.xiaomi.com (unknown [114.255.3.134]) by mx1.mxmail.xiaomi.com (Postfix) with ESMTP id 16F8781200; Sun, 2 Mar 2014 00:04:10 +0800 (CST) Received: from xiaoxiang-desktop.mioffice.cn (10.237.130.10) by EX-CAS2.xiaomi.net (10.237.8.100) with Microsoft SMTP Server (TLS) id 14.3.174.1; Sun, 2 Mar 2014 00:04:10 +0800 From: Xiang Xiao To: , Date: Sun, 2 Mar 2014 00:04:03 +0800 Message-ID: <1393689843-22916-2-git-send-email-xiaoxiang@xiaomi.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1393689843-22916-1-git-send-email-xiaoxiang@xiaomi.com> References: <1393689843-22916-1-git-send-email-xiaoxiang@xiaomi.com> MIME-Version: 1.0 X-Originating-IP: [10.237.130.10] X-EsetResult: clean, is OK X-EsetId: E374883E57221E38B336D9 Cc: alsa-devel@alsa-project.org, xiaoxiang@xiaomi.com Subject: [alsa-devel] [PATCH 2/2] ASoC: dapm: Reorder the bias update sequence X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Xiang Xiao --- sound/soc/soc-dapm.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 00ed0e9..0d8ba30 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1825,10 +1825,14 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event) trace_snd_soc_dapm_walk_done(card); - /* Run all the bias changes in parallel */ - list_for_each_entry(d, &card->dapm_list, list) - async_schedule_domain(dapm_pre_sequence_async, d, - &async_domain); + /* Run card bias changes at first */ + 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_domain); + } async_synchronize_full_domain(&async_domain); list_for_each_entry(w, &down_list, power_list) { @@ -1848,10 +1852,14 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event) dapm_seq_run(card, &up_list, event, true); /* Run all the bias changes in parallel */ - list_for_each_entry(d, &card->dapm_list, list) - async_schedule_domain(dapm_post_sequence_async, d, - &async_domain); + list_for_each_entry(d, &card->dapm_list, list) { + if (d != &card->dapm) + async_schedule_domain(dapm_post_sequence_async, d, + &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 */ list_for_each_entry(d, &card->dapm_list, list) { @@ -3942,11 +3950,18 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card) struct snd_soc_dapm_context *dapm; list_for_each_entry(dapm, &card->dapm_list, list) { - soc_dapm_shutdown_dapm(dapm); - if (dapm->bias_level == SND_SOC_BIAS_STANDBY) - snd_soc_dapm_set_bias_level(dapm, - SND_SOC_BIAS_OFF); + if (dapm != &card->dapm) { + soc_dapm_shutdown_dapm(dapm); + if (dapm->bias_level == SND_SOC_BIAS_STANDBY) + snd_soc_dapm_set_bias_level(dapm, + SND_SOC_BIAS_OFF); + } } + + 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 */