From patchwork Wed Nov 14 09:06:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 10682305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75CD214D6 for ; Wed, 14 Nov 2018 10:02:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67C122B1F1 for ; Wed, 14 Nov 2018 10:02:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C0622B1EC; Wed, 14 Nov 2018 10:02:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F007B2B19F for ; Wed, 14 Nov 2018 10:02:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D9EB7267A61; Wed, 14 Nov 2018 10:06:41 +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 8FA94267AB9; Wed, 14 Nov 2018 10:06:39 +0100 (CET) Received: from mail-io1-f73.google.com (mail-io1-f73.google.com [209.85.166.73]) by alsa0.perex.cz (Postfix) with ESMTP id 9D45F267839 for ; Wed, 14 Nov 2018 10:06:36 +0100 (CET) Received: by mail-io1-f73.google.com with SMTP id z17-v6so15264889iol.20 for ; Wed, 14 Nov 2018 01:06:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=gN7fXLy9hMBo/UinYBMWtFY651ozqU+Rh9Hv5OTO80c=; b=gM5wGOdNZpJWm3iB/ow2/1yYHhAYOtPbfddCVpvQHFsDP2Daliyvu2iBCkDR9poj6A qc26q2q+AMmogFdExVbWsnuKYr3BTmzuEYlQmK2ml2JNCNXp5MtWtTUZ5VRiNlP+z4Jt FKEamK49RBHaPRXL8Dc3hfF15+76GJtPT/ZcBCr38fXRlwJMSRWwpcgso9FTrqLqA5Cu BD3kVgtvqvuOqKXAGfsLupSwEHq8Eumyd16a/i+qNjKNLGsbRaKOEUeHQknV206C1rwR ltKLXJAgJf7qcwY4LILkVHOtdntqeeVe50anOPVtfg3n8YUqcW7PCKcsF+AlJitHXDvB Ewuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=gN7fXLy9hMBo/UinYBMWtFY651ozqU+Rh9Hv5OTO80c=; b=i30tXfbBXOaQQ8dyKx0WHLcHPK0dpV+B+cXH9B3NWRvimBZEhU6OH/7AEYh4H2MqoX eCLKUKUIaymnFE1P6vA7i/LjKDwfj9nCgI0Tubyb1J7veNRSa/e1d6VIAZTqoanYTbh+ /XVcKbXrfI2ydbNdxrpICgQZBfm7xxJ4zgYhxrhw/4CiuFZ9H1+c+flvo9XJ++AEQdKM 2VdAzzFYirc8LcZRYyJmpOOHhpo21NF1JSrsaV3Z1UggyQaKrn9dRR02G3Vqu765O/vU WiniAKBBJjLJRMPiwme3t9x/OKhMG1qylI6GKEeeIIrI9D6XPbPbYlwYa86Ka+xZRPIT kYzw== X-Gm-Message-State: AGRZ1gLkeJPE9JATvmSti5iPNXjrcTTMaI8x0O42mXJamGwm996JJqVX pXLqVFzewyQlnR+S09qf5u7pp4njFUep X-Google-Smtp-Source: AFSGD/UcRsRmmwkHXbmZW65ZU8Iu7VVZZ7n+9F/KAwAIOmds4kwPkVaq275cu7xAZPGleXHSk1EMdcexLkbq X-Received: by 2002:a24:10ca:: with SMTP id 193-v6mr945754ity.14.1542186394874; Wed, 14 Nov 2018 01:06:34 -0800 (PST) Date: Wed, 14 Nov 2018 17:06:13 +0800 Message-Id: <20181114090613.140247-1-tzungbi@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog From: Tzung-Bi Shih To: broonie@kernel.org, lgirdwood@gmail.com, alsa-devel@alsa-project.org Cc: tzungbi@google.com, lars@metafoo.de, dgreid@google.com, cychiang@google.com Subject: [alsa-devel] [PATCH] ASoC: dapm: Recalculate audio map forcely when card instantiated 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 Audio map are possible in wrong state before card->instantiated has been set to true. Imaging the following examples: time 1: at the beginning in:-1 in:-1 in:-1 in:-1 out:-1 out:-1 out:-1 out:-1 SIGGEN A B Spk time 2: after someone called snd_soc_dapm_new_widgets() (e.g. create_fill_widget_route_map() in sound/soc/codecs/hdac_hdmi.c) in:1 in:0 in:0 in:0 out:0 out:0 out:0 out:1 SIGGEN A B Spk time 3: routes added in:1 in:0 in:0 in:0 out:0 out:0 out:0 out:1 SIGGEN -----> A -----> B ---> Spk In the end, the path should be powered on but it did not. At time 3, "in" of SIGGEN and "out" of Spk did not propagate to their neighbors because snd_soc_dapm_add_path() will not invalidate the paths if the card has not instantiated (i.e. card->instantiated is false). To correct the state of audio map, recalculate the whole map forcely. Signed-off-by: Tzung-Bi Shih --- sound/soc/soc-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6ddcf12bc030..b29d0f65611e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2131,6 +2131,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) } card->instantiated = 1; + dapm_mark_endpoints_dirty(card); snd_soc_dapm_sync(&card->dapm); mutex_unlock(&card->mutex); mutex_unlock(&client_mutex);