Message ID | 20230111090222.2016499-20-Vijendar.Mukunda@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3210063wrt; Wed, 11 Jan 2023 01:07:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXswmMYYxcyBEKTv1D7DuVaGFwd7R5ZUzTAsXTg+XTN0HS4Mjyi2K6kRUenTDC1XKH0F5MEb X-Received: by 2002:a17:907:a643:b0:83c:7308:b2ed with SMTP id vu3-20020a170907a64300b0083c7308b2edmr62679903ejc.17.1673428065692; Wed, 11 Jan 2023 01:07:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673428065; cv=pass; d=google.com; s=arc-20160816; b=zOsUYqWLDu0KGW8P52fqBnwehAzi5I3Y3Pgk337DBWSFreGqQxMTyE61Dc5YDoy+Hd C0xWl7+kw5L1DyIHs+JxwV/Eq5LhVnf/8OS+5V1yi+pz1gIQ1bD2uUTwOFxrXvhRaQhd yUVLNYUv3cUZEvpXXYpJ+c780X1Gd0xIwf4SUBi29E8eG/5hC6+gZw25ofdo/PHw0+cC qG216xLbQKoqMOQTutPDnm4GEccBkRDXlmeV1NPJVLAAsjWNKyTPHo/FV0uVsdUgVgpF GSM/PUBJeMd4dNBSDeU5ZPB2bpOCNKSyExDkXmfkawPn4rubZERVKcUmyIou9o+xNrnS LIqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cZMXt8C6+nAkybTbBz/l5hTmmGkMItamXiYVLJmt7ZU=; b=fY99eLYbEJeAp6n4fbD+gnCuTJAyl88kOPT6OQdJ+6NAHslEJLxADGYXmzR3ZHRoce Z48SWivp5izXp/LbH7KWR4xPiM563807CpGrr3K7gDxclRFRaJWopUrVTNzkaE0XlQdu 2IUGXPEhexy8HVKHtRK2kT0DSpovtnyjgNe7wpVQ964MA/6hDpp7MKGIOyDHIwNfv8Go 3GLdk511FvwmOWyx6fTOdc4NBQc/AKq5oB1k9D3se7B+/IJplVgsMAh9sL7f/5HxJIOt vAFZGOpKS2IfCYseSRQkiN8mITlVnDuTylTgJGquPOOwUddNR/rbAMq++EhiUkhzkmdI gyHA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=dK04mPLo; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go12-20020a1709070d8c00b007c0abf0760fsi1180680ejc.54.2023.01.11.01.07.22; Wed, 11 Jan 2023 01:07:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=dK04mPLo; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238045AbjAKJGz (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Wed, 11 Jan 2023 04:06:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236917AbjAKJGW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 11 Jan 2023 04:06:22 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2074.outbound.protection.outlook.com [40.107.243.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0083140BB for <linux-kernel@vger.kernel.org>; Wed, 11 Jan 2023 01:04:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lx7qbffImFmxOGuBRA42/FwHTCmHg+fOkARMqyhWUFwME4Icvm9CAAr92DDCWO4Eeg7aheFeWJ7sqtggGmRoAi+72VBk1IxHEhu/vU8yA5+D6+T8m1WqLWKSls/EHdpTT3/aeteUwvKTzJccgPRw/xKGvieOzP6i7bUX03+1i+5o3ziAmMMCBt+i5lDMu0CF5X5VaJkIKXCOCnqqbL/8XfWl+1596r388enKSMmXE1Rf2GUwcFBfOMHCvXBHOJf1tk09vaPn+aAfFqLrdriDem/j1tMbgRvzCa9HSaAwm89txYv7YQ+xQJWEjfBvFq1Zr4XDqaWwZAR/Pl2Sjan4HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cZMXt8C6+nAkybTbBz/l5hTmmGkMItamXiYVLJmt7ZU=; b=Oqbfg0euoCUCnMsDxwC4UvJwIf2mP9qVgOsr6ZUYmO12MEWpcuAJBXdDhIeZ1Dx9E9NNaCBFH9zdM4hCDqXKLl6nE5b5Oi7qytIUsu8NHdGAdzFE+Pxo21qQzUQ43lyqX8qwjgbwUU1FIpfn5eOVgFKn390xjWp2EmPGblhTSz6dM+pIgjzN2WYViG2qqsPuBjHGV3QZ9g/6QuRU5pCv6+sEHlfXKPDb9WrlNHeTG3nURdZjxjHx6c8OZM31FD89O3LtIsNTgnJtLRofusLpj9Vp+lj2oRykmn4wBphWoYU+uAFUPDvEZt+39fC6IMvx3iK7i4R24KiKyibk1+IOaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cZMXt8C6+nAkybTbBz/l5hTmmGkMItamXiYVLJmt7ZU=; b=dK04mPLoNqgZW8yxmm86TmDAT8HJuR+JS51/ew64U9pF+nf6dPUZsp1U0zrrgV13F1+ugX7nlr8nOYnjSUCoYvEZ/5rJKCLnFDizqai27C0DcoAwyqosKg/aUKLPQVnVKTMubqSjlcN8/13eYlV9/99ovL6no960mW4aiZHwCYQ= Received: from BN8PR07CA0007.namprd07.prod.outlook.com (2603:10b6:408:ac::20) by DM4PR12MB6232.namprd12.prod.outlook.com (2603:10b6:8:a5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Wed, 11 Jan 2023 09:03:55 +0000 Received: from BN8NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ac:cafe::1) by BN8PR07CA0007.outlook.office365.com (2603:10b6:408:ac::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12 via Frontend Transport; Wed, 11 Jan 2023 09:03:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT023.mail.protection.outlook.com (10.13.177.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Wed, 11 Jan 2023 09:03:55 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 11 Jan 2023 03:03:50 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 11 Jan 2023 03:03:48 -0600 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 11 Jan 2023 03:03:45 -0600 From: Vijendar Mukunda <Vijendar.Mukunda@amd.com> To: <broonie@kernel.org>, <vkoul@kernel.org>, <alsa-devel@alsa-project.org> CC: <Basavaraj.Hiregoudar@amd.com>, <Sunil-kumar.Dommati@amd.com>, <Mario.Limonciello@amd.com>, <Mastan.Katragadda@amd.com>, <arungopal.kondaveeti@amd.com>, Vijendar Mukunda <Vijendar.Mukunda@amd.com>, Liam Girdwood <lgirdwood@gmail.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Syed Saba Kareem <Syed.SabaKareem@amd.com>, open list <linux-kernel@vger.kernel.org> Subject: [PATCH 19/19] ASoC: amd: ps: increase runtime suspend delay Date: Wed, 11 Jan 2023 14:32:22 +0530 Message-ID: <20230111090222.2016499-20-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230111090222.2016499-1-Vijendar.Mukunda@amd.com> References: <20230111090222.2016499-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT023:EE_|DM4PR12MB6232:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fc2d00c-73b1-47fb-0e1f-08daf3b2c49e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +JE+zrpCwIFZXQG/zlc1muZL2nPIsHrdIP3+t0PzTX+Fn53RZ7IDDYJmVkuy41xeGYb9c5NxP0unDL7GSR1q6fka42vXWzgeTVAZxpbDiC+5XO7r+rVSio/hugnSWqsWtxZblEtipQX/vBlp1N+3BiKjtvT2d2hYs6v1eN8bkvPbgAOiwo3hRBYvQdwW6ZoBAr99TqscoMa7CHWV8kkWVPsHZTg5JBYWzcw8dMucJdwXG35VHjTPYiNCuV6CjVw+id3aKGFw+R705ArrMzQX/iVCR2LdTFeked/Aud0gSfgWMECmhbTPG3/8IaERsSYcptm6J0YOcMISGJ5DXQIuK4P2zRVHgbXC7X0h8rdS/q+MDiTCHsygn5nKX/wC/AdWZK45zfYV++IIg2ih+2OZf4U6zIxg7Oc86VJWxxwBuWYi5cjTagPKwGLBmqsGU9+kXQ3quhBMSCQL7g7aj7iaxsRPHfNzcHjbtyRgUzGc55xW8rB9VH7+76FzHBYaAQ4B5dwGs1w01dgK8etnjfOcIROmk022jvS/TDz7fFDxgCMaC+4HrZieDIACrbb1acvmr5V7MlE692GmZS3AUOwdqsYZGrvMAVEQP7MZouAQQAPNbq5dIN54f4srJ4eofFKOXEpLCJc9q0tfhSBjfMGYWAWByNgy1gkRiYBQkUp80FfAlflRePYNOXoqqkvfqh0grzsx4ELYebL4gKcHwmiwhjhtW1Yb8E01eRXBiDMl1kg= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(136003)(346002)(39860400002)(376002)(396003)(451199015)(36840700001)(40470700004)(46966006)(82310400005)(2906002)(15650500001)(36756003)(4744005)(5660300002)(8936002)(70206006)(6666004)(8676002)(41300700001)(2616005)(70586007)(316002)(7696005)(4326008)(54906003)(110136005)(478600001)(40480700001)(26005)(186003)(336012)(1076003)(426003)(86362001)(47076005)(83380400001)(36860700001)(40460700003)(356005)(81166007)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2023 09:03:55.3361 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2fc2d00c-73b1-47fb-0e1f-08daf3b2c49e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6232 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754716506997932829?= X-GMAIL-MSGID: =?utf-8?q?1754716506997932829?= |
Series |
[01/19] ASoC: amd: ps: create platform devices based on acp config
|
|
Commit Message
Mukunda,Vijendar
Jan. 11, 2023, 9:02 a.m. UTC
To avoid ACP entering into D3 state during slave enumeration and
initialization on two soundwire controller instances for multiple codecs,
increase the runtime suspend delay to 3 seconds.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
---
sound/soc/amd/ps/acp63.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 1/11/23 03:02, Vijendar Mukunda wrote: > To avoid ACP entering into D3 state during slave enumeration and > initialization on two soundwire controller instances for multiple codecs, > increase the runtime suspend delay to 3 seconds. You have a parent PCI device and a set of child devices for each manager. The parent PCI device cannot suspend before all its children are also suspended, so shouldn't the delay be modified at the manager level? Not getting what this delay is and how this would deal with a lengthy enumeration/initialization process. > > Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> > --- > sound/soc/amd/ps/acp63.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/amd/ps/acp63.h b/sound/soc/amd/ps/acp63.h > index 833d0b5aa73d..6c8849f2bcec 100644 > --- a/sound/soc/amd/ps/acp63.h > +++ b/sound/soc/amd/ps/acp63.h > @@ -51,7 +51,7 @@ > #define MIN_BUFFER MAX_BUFFER > > /* time in ms for runtime suspend delay */ > -#define ACP_SUSPEND_DELAY_MS 2000 > +#define ACP_SUSPEND_DELAY_MS 3000 > > #define ACP63_DMIC_ADDR 2 > #define ACP63_PDM_MODE_DEVS 3
On 11/01/23 21:32, Pierre-Louis Bossart wrote: > On 1/11/23 03:02, Vijendar Mukunda wrote: >> To avoid ACP entering into D3 state during slave enumeration and >> initialization on two soundwire controller instances for multiple codecs, >> increase the runtime suspend delay to 3 seconds. > You have a parent PCI device and a set of child devices for each > manager. The parent PCI device cannot suspend before all its children > are also suspended, so shouldn't the delay be modified at the manager level? > > Not getting what this delay is and how this would deal with a lengthy > enumeration/initialization process. Yes agreed. Until Child devices are suspended, parent device will be in D0 state. We will rephrase the commit message. Machine driver node will be created by ACP PCI driver. We have added delay in machine driver to make sure two manager instances completes codec enumeration and peripheral initialization before registering the sound card. Without adding delay in machine driver will result early card registration before codec initialization is completed. Manager will enter in to bad state due to codec read/write failures. We are intended to keep the ACP in D0 state, till sound card is created and jack controls are initialized. To handle, at manager level increased runtime suspend delay. >> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> >> --- >> sound/soc/amd/ps/acp63.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/sound/soc/amd/ps/acp63.h b/sound/soc/amd/ps/acp63.h >> index 833d0b5aa73d..6c8849f2bcec 100644 >> --- a/sound/soc/amd/ps/acp63.h >> +++ b/sound/soc/amd/ps/acp63.h >> @@ -51,7 +51,7 @@ >> #define MIN_BUFFER MAX_BUFFER >> >> /* time in ms for runtime suspend delay */ >> -#define ACP_SUSPEND_DELAY_MS 2000 >> +#define ACP_SUSPEND_DELAY_MS 3000 >> >> #define ACP63_DMIC_ADDR 2 >> #define ACP63_PDM_MODE_DEVS 3
On 1/12/23 05:02, Mukunda,Vijendar wrote: > On 11/01/23 21:32, Pierre-Louis Bossart wrote: >> On 1/11/23 03:02, Vijendar Mukunda wrote: >>> To avoid ACP entering into D3 state during slave enumeration and >>> initialization on two soundwire controller instances for multiple codecs, >>> increase the runtime suspend delay to 3 seconds. >> You have a parent PCI device and a set of child devices for each >> manager. The parent PCI device cannot suspend before all its children >> are also suspended, so shouldn't the delay be modified at the manager level? >> >> Not getting what this delay is and how this would deal with a lengthy >> enumeration/initialization process. > Yes agreed. Until Child devices are suspended, parent device will > be in D0 state. We will rephrase the commit message. > > Machine driver node will be created by ACP PCI driver. > We have added delay in machine driver to make sure > two manager instances completes codec enumeration and > peripheral initialization before registering the sound card. > Without adding delay in machine driver will result early card > registration before codec initialization is completed. Manager > will enter in to bad state due to codec read/write failures. > We are intended to keep the ACP in D0 state, till sound card > is created and jack controls are initialized. To handle, at manager > level increased runtime suspend delay. This doesn't look too good. You should not assume any timing dependencies in the machine driver probe. I made that mistake in earlier versions and we had to revisit all this to make sure drivers could be bound/unbound at any time.
On 1/12/2023 08:54, Pierre-Louis Bossart wrote: > > > On 1/12/23 05:02, Mukunda,Vijendar wrote: >> On 11/01/23 21:32, Pierre-Louis Bossart wrote: >>> On 1/11/23 03:02, Vijendar Mukunda wrote: >>>> To avoid ACP entering into D3 state during slave enumeration and >>>> initialization on two soundwire controller instances for multiple codecs, >>>> increase the runtime suspend delay to 3 seconds. >>> You have a parent PCI device and a set of child devices for each >>> manager. The parent PCI device cannot suspend before all its children >>> are also suspended, so shouldn't the delay be modified at the manager level? >>> >>> Not getting what this delay is and how this would deal with a lengthy >>> enumeration/initialization process. >> Yes agreed. Until Child devices are suspended, parent device will >> be in D0 state. We will rephrase the commit message. >> >> Machine driver node will be created by ACP PCI driver. >> We have added delay in machine driver to make sure >> two manager instances completes codec enumeration and >> peripheral initialization before registering the sound card. >> Without adding delay in machine driver will result early card >> registration before codec initialization is completed. Manager >> will enter in to bad state due to codec read/write failures. >> We are intended to keep the ACP in D0 state, till sound card >> is created and jack controls are initialized. To handle, at manager >> level increased runtime suspend delay. > > This doesn't look too good. You should not assume any timing > dependencies in the machine driver probe. I made that mistake in earlier > versions and we had to revisit all this to make sure drivers could be > bound/unbound at any time. Rather than a timing dependency, could you perhaps prohibit runtime PM and have a codec make a callback to indicate it's fully initialized and then allow runtime PM again?
On 1/12/23 09:29, Limonciello, Mario wrote: > On 1/12/2023 08:54, Pierre-Louis Bossart wrote: >> >> >> On 1/12/23 05:02, Mukunda,Vijendar wrote: >>> On 11/01/23 21:32, Pierre-Louis Bossart wrote: >>>> On 1/11/23 03:02, Vijendar Mukunda wrote: >>>>> To avoid ACP entering into D3 state during slave enumeration and >>>>> initialization on two soundwire controller instances for multiple >>>>> codecs, >>>>> increase the runtime suspend delay to 3 seconds. >>>> You have a parent PCI device and a set of child devices for each >>>> manager. The parent PCI device cannot suspend before all its children >>>> are also suspended, so shouldn't the delay be modified at the >>>> manager level? >>>> >>>> Not getting what this delay is and how this would deal with a lengthy >>>> enumeration/initialization process. >>> Yes agreed. Until Child devices are suspended, parent device will >>> be in D0 state. We will rephrase the commit message. >>> >>> Machine driver node will be created by ACP PCI driver. >>> We have added delay in machine driver to make sure >>> two manager instances completes codec enumeration and >>> peripheral initialization before registering the sound card. >>> Without adding delay in machine driver will result early card >>> registration before codec initialization is completed. Manager >>> will enter in to bad state due to codec read/write failures. >>> We are intended to keep the ACP in D0 state, till sound card >>> is created and jack controls are initialized. To handle, at manager >>> level increased runtime suspend delay. >> >> This doesn't look too good. You should not assume any timing >> dependencies in the machine driver probe. I made that mistake in earlier >> versions and we had to revisit all this to make sure drivers could be >> bound/unbound at any time. > > Rather than a timing dependency, could you perhaps prohibit runtime PM > and have a codec make a callback to indicate it's fully initialized and > then allow runtime PM again? We already have enumeration and initialization 'struct completion' that are used by codec drivers to know if the hardware is usable. We also have pm_runtime_get_sync() is the bus layer to make sure the codec is resumed before being accessed. The explanations above confuse card registration and manager probe/initialization. These are two different things. Maybe there's indeed a missing part in the SoundWire PM assumptions, but I am not getting what the issue is.
On 12/01/23 21:35, Pierre-Louis Bossart wrote: > > On 1/12/23 09:29, Limonciello, Mario wrote: >> On 1/12/2023 08:54, Pierre-Louis Bossart wrote: >>> >>> On 1/12/23 05:02, Mukunda,Vijendar wrote: >>>> On 11/01/23 21:32, Pierre-Louis Bossart wrote: >>>>> On 1/11/23 03:02, Vijendar Mukunda wrote: >>>>>> To avoid ACP entering into D3 state during slave enumeration and >>>>>> initialization on two soundwire controller instances for multiple >>>>>> codecs, >>>>>> increase the runtime suspend delay to 3 seconds. >>>>> You have a parent PCI device and a set of child devices for each >>>>> manager. The parent PCI device cannot suspend before all its children >>>>> are also suspended, so shouldn't the delay be modified at the >>>>> manager level? >>>>> >>>>> Not getting what this delay is and how this would deal with a lengthy >>>>> enumeration/initialization process. >>>> Yes agreed. Until Child devices are suspended, parent device will >>>> be in D0 state. We will rephrase the commit message. >>>> >>>> Machine driver node will be created by ACP PCI driver. >>>> We have added delay in machine driver to make sure >>>> two manager instances completes codec enumeration and >>>> peripheral initialization before registering the sound card. >>>> Without adding delay in machine driver will result early card >>>> registration before codec initialization is completed. Manager >>>> will enter in to bad state due to codec read/write failures. >>>> We are intended to keep the ACP in D0 state, till sound card >>>> is created and jack controls are initialized. To handle, at manager >>>> level increased runtime suspend delay. >>> This doesn't look too good. You should not assume any timing >>> dependencies in the machine driver probe. I made that mistake in earlier >>> versions and we had to revisit all this to make sure drivers could be >>> bound/unbound at any time. >> Rather than a timing dependency, could you perhaps prohibit runtime PM >> and have a codec make a callback to indicate it's fully initialized and >> then allow runtime PM again? > We already have enumeration and initialization 'struct completion' that > are used by codec drivers to know if the hardware is usable. We also > have pm_runtime_get_sync() is the bus layer to make sure the codec is > resumed before being accessed. Instead of walking through codec list and checking completion status for every codec over the link, can we have some solution where once all codecs gets enumerated and initialized, a variable in bus instance will be updated to know all peripherals initialized. So that we can check this variable in machine driver. > > The explanations above confuse card registration and manager > probe/initialization. These are two different things. Maybe there's > indeed a missing part in the SoundWire PM assumptions, but I am not > getting what the issue is. We will rephrase the commit message. At manager level we want to increase the delay to 3s.
>>>>>>> increase the runtime suspend delay to 3 seconds. >>>>>> You have a parent PCI device and a set of child devices for each >>>>>> manager. The parent PCI device cannot suspend before all its children >>>>>> are also suspended, so shouldn't the delay be modified at the >>>>>> manager level? >>>>>> >>>>>> Not getting what this delay is and how this would deal with a lengthy >>>>>> enumeration/initialization process. >>>>> Yes agreed. Until Child devices are suspended, parent device will >>>>> be in D0 state. We will rephrase the commit message. >>>>> >>>>> Machine driver node will be created by ACP PCI driver. >>>>> We have added delay in machine driver to make sure >>>>> two manager instances completes codec enumeration and >>>>> peripheral initialization before registering the sound card. >>>>> Without adding delay in machine driver will result early card >>>>> registration before codec initialization is completed. Manager >>>>> will enter in to bad state due to codec read/write failures. >>>>> We are intended to keep the ACP in D0 state, till sound card >>>>> is created and jack controls are initialized. To handle, at manager >>>>> level increased runtime suspend delay. >>>> This doesn't look too good. You should not assume any timing >>>> dependencies in the machine driver probe. I made that mistake in earlier >>>> versions and we had to revisit all this to make sure drivers could be >>>> bound/unbound at any time. >>> Rather than a timing dependency, could you perhaps prohibit runtime PM >>> and have a codec make a callback to indicate it's fully initialized and >>> then allow runtime PM again? >> We already have enumeration and initialization 'struct completion' that >> are used by codec drivers to know if the hardware is usable. We also >> have pm_runtime_get_sync() is the bus layer to make sure the codec is >> resumed before being accessed. > Instead of walking through codec list and checking completion status > for every codec over the link, can we have some solution where once > all codecs gets enumerated and initialized, a variable in bus instance > will be updated to know all peripherals initialized. So that we can > check this variable in machine driver. No, because the bus cannot know for sure what codecs to expect on the platform. This comes from the design, we first create a bunch of devices based on ACPI information, which causes the drivers to probe. Then when the bus starts, codecs that are physically present on the bus will attach and be initialized in the update_status callback. It's perfectly acceptable for devices to be exposed in ACPI and not be present on a board. The bus wouldn't know what is needed. I am still not clear on what the "early card registration" issue might be. Can you clarify which codec registers are accessed in that case, are those supposed to be managed with regmap? one possibility is that we need to make sure the codec drivers are in regmap cache_only probe at the probe time, that may prevent this sort of uncontrolled register access. I had a PR on this that I haven't touched in a while, see [1] I do recall some issues with the codec jacks, where if the card registration happens too late the codec might have suspended. But we added pm_runtime_resume_and_get in the set_jack_detect callbacks, so that was solved. [1] https://github.com/thesofproject/linux/pull/3941
On Fri, Jan 13, 2023 at 11:33:09AM -0600, Pierre-Louis Bossart wrote: > I do recall some issues with the codec jacks, where if the card > registration happens too late the codec might have suspended. But we > added pm_runtime_resume_and_get in the set_jack_detect callbacks, so > that was solved. Right, I would expect that whatever needs the device to be powered on would be explicitly ensuring that this is done rather than tweaking timeouts - the timeouts should be more of a performance thing to avoid bouncing power too much, not a correctness thing.
On 14/01/23 01:27, Mark Brown wrote: > On Fri, Jan 13, 2023 at 11:33:09AM -0600, Pierre-Louis Bossart wrote: > >> I do recall some issues with the codec jacks, where if the card >> registration happens too late the codec might have suspended. But we >> added pm_runtime_resume_and_get in the set_jack_detect callbacks, so >> that was solved. > Right, I would expect that whatever needs the device to be powered on > would be explicitly ensuring that this is done rather than tweaking > timeouts - the timeouts should be more of a performance thing to avoid > bouncing power too much, not a correctness thing. Machine driver probe is executed in parallel with Manager driver probe sequence. Because of it, before completion of all peripherals enumeration across the multiple links, if card registration is completed, codec register writes will fail as Codec device numbers are not assigned. If we understood correctly, as per your suggestion, We shouldn't use any time bounds in machine driver probe sequence and before registering the sound card, need to traverses through all peripheral initialization completion status for all the managers.
On 1/16/23 02:35, Mukunda,Vijendar wrote: > On 14/01/23 01:27, Mark Brown wrote: >> On Fri, Jan 13, 2023 at 11:33:09AM -0600, Pierre-Louis Bossart wrote: >> >>> I do recall some issues with the codec jacks, where if the card >>> registration happens too late the codec might have suspended. But we >>> added pm_runtime_resume_and_get in the set_jack_detect callbacks, so >>> that was solved. >> Right, I would expect that whatever needs the device to be powered on >> would be explicitly ensuring that this is done rather than tweaking >> timeouts - the timeouts should be more of a performance thing to avoid >> bouncing power too much, not a correctness thing. > Machine driver probe is executed in parallel with Manager driver > probe sequence. Because of it, before completion of all peripherals > enumeration across the multiple links, if card registration is > completed, codec register writes will fail as Codec device numbers > are not assigned. > > If we understood correctly, as per your suggestion, We shouldn't use any > time bounds in machine driver probe sequence and before registering the > sound card, need to traverses through all peripheral initialization completion > status for all the managers. What's not clear in your reply is this: What codec registers are accessed as a result of the machine driver probe and card registration, and in what part of the card registration? Are we talking about SoundWire 'standard' registers for device/port management, about vendor specific ones that are exposed to userspace, or vendor-specific ones entirely configured by the driver/regmap. You've got to give us more data or understanding of the sequence to help. Saying there's a race condition doesn't really help if there's nothing that explains what codec registers are accessed and when.
On 16/01/23 20:32, Pierre-Louis Bossart wrote: > > On 1/16/23 02:35, Mukunda,Vijendar wrote: >> On 14/01/23 01:27, Mark Brown wrote: >>> On Fri, Jan 13, 2023 at 11:33:09AM -0600, Pierre-Louis Bossart wrote: >>> >>>> I do recall some issues with the codec jacks, where if the card >>>> registration happens too late the codec might have suspended. But we >>>> added pm_runtime_resume_and_get in the set_jack_detect callbacks, so >>>> that was solved. >>> Right, I would expect that whatever needs the device to be powered on >>> would be explicitly ensuring that this is done rather than tweaking >>> timeouts - the timeouts should be more of a performance thing to avoid >>> bouncing power too much, not a correctness thing. >> Machine driver probe is executed in parallel with Manager driver >> probe sequence. Because of it, before completion of all peripherals >> enumeration across the multiple links, if card registration is >> completed, codec register writes will fail as Codec device numbers >> are not assigned. >> >> If we understood correctly, as per your suggestion, We shouldn't use any >> time bounds in machine driver probe sequence and before registering the >> sound card, need to traverses through all peripheral initialization completion >> status for all the managers. > What's not clear in your reply is this: > > What codec registers are accessed as a result of the machine driver > probe and card registration, and in what part of the card registration? > > Are we talking about SoundWire 'standard' registers for device/port > management, about vendor specific ones that are exposed to userspace, or > vendor-specific ones entirely configured by the driver/regmap. > > You've got to give us more data or understanding of the sequence to > help. Saying there's a race condition doesn't really help if there's > nothing that explains what codec registers are accessed and when. We have come across a race condition, where sound card registration is successful before codec enumerations across all the links gets completed and our manager instance going into bad state. Please refer below link for error logs. https://pastebin.com/ZYEN928S
On 1/17/23 05:33, Mukunda,Vijendar wrote: > On 16/01/23 20:32, Pierre-Louis Bossart wrote: >> >> On 1/16/23 02:35, Mukunda,Vijendar wrote: >>> On 14/01/23 01:27, Mark Brown wrote: >>>> On Fri, Jan 13, 2023 at 11:33:09AM -0600, Pierre-Louis Bossart wrote: >>>> >>>>> I do recall some issues with the codec jacks, where if the card >>>>> registration happens too late the codec might have suspended. But we >>>>> added pm_runtime_resume_and_get in the set_jack_detect callbacks, so >>>>> that was solved. >>>> Right, I would expect that whatever needs the device to be powered on >>>> would be explicitly ensuring that this is done rather than tweaking >>>> timeouts - the timeouts should be more of a performance thing to avoid >>>> bouncing power too much, not a correctness thing. >>> Machine driver probe is executed in parallel with Manager driver >>> probe sequence. Because of it, before completion of all peripherals >>> enumeration across the multiple links, if card registration is >>> completed, codec register writes will fail as Codec device numbers >>> are not assigned. >>> >>> If we understood correctly, as per your suggestion, We shouldn't use any >>> time bounds in machine driver probe sequence and before registering the >>> sound card, need to traverses through all peripheral initialization completion >>> status for all the managers. >> What's not clear in your reply is this: >> >> What codec registers are accessed as a result of the machine driver >> probe and card registration, and in what part of the card registration? >> >> Are we talking about SoundWire 'standard' registers for device/port >> management, about vendor specific ones that are exposed to userspace, or >> vendor-specific ones entirely configured by the driver/regmap. >> >> You've got to give us more data or understanding of the sequence to >> help. Saying there's a race condition doesn't really help if there's >> nothing that explains what codec registers are accessed and when. > We have come across a race condition, where sound card registration > is successful before codec enumerations across all the links gets completed > and our manager instance going into bad state. > > Please refer below link for error logs. > https://pastebin.com/ZYEN928S You have two RT1316 register areas that are accessed while the codec is not even enumerated: [ 2.755828] rt1316-sdca sdw:0:025d:1316:01:0: ASoC: error at snd_soc_component_update_bits on sdw:0:025d:1316:01:0 for register: [0x41080100] -22 [ 2.758904] rt1316-sdca sdw:0:025d:1316:01:0: ASoC: error at snd_soc_component_update_bits on sdw:0:025d:1316:01:0 for register: [0x00003004] -110 The last one is clearly listed in the regmap list. You probably want to reverse-engineer what causes these accesses. I see this suspicious kcontrol definition that might be related: SOC_SINGLE("Left I Tag Select", 0x3004, 4, 7, 0),
On Tue, Jan 17, 2023 at 05:51:03AM -0600, Pierre-Louis Bossart wrote: > On 1/17/23 05:33, Mukunda,Vijendar wrote: > [ 2.758904] rt1316-sdca sdw:0:025d:1316:01:0: ASoC: error at > snd_soc_component_update_bits on sdw:0:025d:1316:01:0 for register: > [0x00003004] -110 > The last one is clearly listed in the regmap list. > You probably want to reverse-engineer what causes these accesses. > I see this suspicious kcontrol definition that might be related: > SOC_SINGLE("Left I Tag Select", 0x3004, 4, 7, 0), Looks like a case for putting the CODEC in cache only mode...
On 1/17/23 06:16, Mark Brown wrote: > On Tue, Jan 17, 2023 at 05:51:03AM -0600, Pierre-Louis Bossart wrote: >> On 1/17/23 05:33, Mukunda,Vijendar wrote: > >> [ 2.758904] rt1316-sdca sdw:0:025d:1316:01:0: ASoC: error at >> snd_soc_component_update_bits on sdw:0:025d:1316:01:0 for register: >> [0x00003004] -110 > >> The last one is clearly listed in the regmap list. > >> You probably want to reverse-engineer what causes these accesses. >> I see this suspicious kcontrol definition that might be related: > >> SOC_SINGLE("Left I Tag Select", 0x3004, 4, 7, 0), > > Looks like a case for putting the CODEC in cache only mode... Right, and I think we'd need to do this during the probe instead of the hardware initialization (which could happen at a later time). I started a PR to try and improve regmap handling, see https://github.com/thesofproject/linux/pull/3941 I was trying to solve the case where codecs become unattached, but apparently the problem is hardware-related. One of the suggested improvements was to move the cache_only part earlier to prevent such accesses. Unfortunately the work isn't complete so that PR is just a draft at the moment.
diff --git a/sound/soc/amd/ps/acp63.h b/sound/soc/amd/ps/acp63.h index 833d0b5aa73d..6c8849f2bcec 100644 --- a/sound/soc/amd/ps/acp63.h +++ b/sound/soc/amd/ps/acp63.h @@ -51,7 +51,7 @@ #define MIN_BUFFER MAX_BUFFER /* time in ms for runtime suspend delay */ -#define ACP_SUSPEND_DELAY_MS 2000 +#define ACP_SUSPEND_DELAY_MS 3000 #define ACP63_DMIC_ADDR 2 #define ACP63_PDM_MODE_DEVS 3