From patchwork Tue May 6 08:32:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 4119901 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 27414BFF02 for ; Tue, 6 May 2014 08:32:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 657822020E for ; Tue, 6 May 2014 08:32:47 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1DDB1201FB for ; Tue, 6 May 2014 08:32:46 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4E0D2261AE9; Tue, 6 May 2014 10:32:44 +0200 (CEST) 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 4B85F260816; Tue, 6 May 2014 10:32:33 +0200 (CEST) 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 E09E72608D4; Tue, 6 May 2014 10:32:32 +0200 (CEST) Received: from smtp-out-167.synserver.de (smtp-out-016.synserver.de [212.40.185.16]) by alsa0.perex.cz (Postfix) with ESMTP id CC2C226072A for ; Tue, 6 May 2014 10:32:24 +0200 (CEST) Received: (qmail 31372 invoked by uid 0); 6 May 2014 08:32:22 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 31228 Received: from p4fe61b58.dip0.t-ipconnect.de (HELO lars-adi-laptop.analog.com) [79.230.27.88] by 217.119.54.96 with SMTP; 6 May 2014 08:32:20 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Tue, 6 May 2014 10:32:15 +0200 Message-Id: <1399365135-26877-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.8.0 Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen Subject: [alsa-devel] [PATCH v2] ASoC: dapm: Fix SUSPEND -> OFF bias 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Currently when the DAPM context bias level is SUSPEND and the target bias level is OFF dapm_pre_sequence_async() will first transition to PREPARE and dapm_post_sequence_async() will then transition back from PREPARE to STANDBY and then to OFF. This patch makes sure that dapm_pre_sequence_async() only transitions to PREPARE when either going to ON or away from ON. This avoids the extra unnecessary transitions. Signed-off-by: Lars-Peter Clausen --- Given that SUSPEND -> OFF transitions are rather rare and the code will still work correctly (but inefficent) without this patch, the patch probably does not need to go into stable. Changes since v1: * Change indention --- sound/soc/soc-dapm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 5d54dfc..bfc46a9 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1549,8 +1549,11 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie) "ASoC: Failed to turn on bias: %d\n", ret); } - /* Prepare for a STADDBY->ON or ON->STANDBY transition */ - if (d->bias_level != d->target_bias_level) { + /* Prepare for a transition to ON or away from ON */ + if ((d->target_bias_level == SND_SOC_BIAS_ON && + d->bias_level != SND_SOC_BIAS_ON) || + (d->target_bias_level != SND_SOC_BIAS_ON && + d->bias_level == SND_SOC_BIAS_ON)) { ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_PREPARE); if (ret != 0) dev_err(d->dev,