Message ID | 20230222113945.3390672-4-chancel.liu@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp530838wrd; Wed, 22 Feb 2023 03:55:00 -0800 (PST) X-Google-Smtp-Source: AK7set+ETe1sW6JsaEUZy8NmWoEBdONOWpaz7YhC8FtZ3bCNpW5VYtRbLiVTQ51tsDQR7/1AKkyy X-Received: by 2002:a05:6a20:7fa0:b0:bf:5e5:9d85 with SMTP id d32-20020a056a207fa000b000bf05e59d85mr20331856pzj.40.1677066900126; Wed, 22 Feb 2023 03:55:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677066900; cv=pass; d=google.com; s=arc-20160816; b=BAHD1ik/TGDtwX+kgBds2Ejx9mpg/BX1+9X3hvl+KGLn5+sp8TaNyQ5XZyeiRfwkk5 eUUNdT80cqq8Lq/K3zyKA4CKS/FO8Y1uPw+qOS3hpiKiIIuuGjrQV2Vqxd9KbepvCkZn y4YxkggGvYJNdVRDlb7jQWyF93ufse+4pYW6bfn8n5fumNR056pPXH8dRyyw8KPDeyix D+KvwUq1sDhuGeVO8gUajs+yze1C3fs9S1gCdeMZXbT2vbYlNN8xZMsusz84OcqeNz60 Cns8YKzf75lmYu/fUl8uMW2ctKBIozb5pt0+bxLDgCEgEGMWtHSDJkdGkuLPqDaWtNw3 l+mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=H492h3zy+zQgFK4gbKLUlUZchyTJd7Y7VmAgomkPmho=; b=Ort3kLoFm5cJTMeWiVLaF+MkHarKKW4UViaEDZp1Uy0y0tHq7ufF0EGpeYdgzEpLC4 cfbPDDVkCFEV74/FUAgrZektuyNFCSGQs4TRgMrdIBzZX3SxTm++Gng6MJ5LR5n1+anx 7EQNrdvxZEn6nJZFeHUhwLZPajzK/g0341zl6HS39f1CHK570K3h6ABTnSMWS0+W+4U9 1H2ZcV9qJI9IcwwMuh5FssElXji2iQ1h0I8QGOOyw/HPoUdzlh6PFr419oE25wVmJiL9 rvCBzZyBn1sxTSAejfHL7xkmB3hu+W6cqhuqlWTLoNx7t3xer+vmzPYjQQ4dpmU56kHR 2ghQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jMzIg925; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a63e843000000b004ff73120afbsi12207789pgk.103.2023.02.22.03.54.46; Wed, 22 Feb 2023 03:55:00 -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=@nxp.com header.s=selector2 header.b=jMzIg925; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231536AbjBVLkw (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Wed, 22 Feb 2023 06:40:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231842AbjBVLke (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Feb 2023 06:40:34 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2086.outbound.protection.outlook.com [40.107.20.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D47839BB6; Wed, 22 Feb 2023 03:40:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b5LdaaEr4tKFLLvgfDNi2bHGslgUfZum87olRM6wOfGw05GjPCbriIsm722ZCMJUCU7TG6BrRa0TLO8dLhK72BQwWIihC8ea7C9O57FTpI+oDPzcufUJeTBCIsL0wkDChX6H/21n3rbHzzUwrE2h0JmIwAsdKg2BH417jPAZsv/z28oeHUqHVweUKH9bt41pR/Pdemhvbq9JfvIZsbabbzUUnjF+V4r1iC5BW/vyP0gyXfPZFQtmqDXbApX6iYUODzQ3+CC6uLdyPpr0WA9+Zo6zEMyWZqN7rGkyXd5kfTHIrLEbeOC3+BRFWtzM4b+MTnNg7Vm1NzzbNWMxi+pYIw== 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=H492h3zy+zQgFK4gbKLUlUZchyTJd7Y7VmAgomkPmho=; b=cTCwY72yTXWPrJLi+E2j/aAsSXa3+mZ7f9HNSBUvSIoDpXN4H5JysgkSf51FerAd8nOGlb1IcLBaP8X97Zc8jIo8P/V+g6UlFFtOiNhGddhoY5ZT1zSJLt6WCWEic3ILXzarvL7GzLXFe1LKLNWrsGRhyXGJjqbiWUp1timwrsjDx0Q3+LcfeBZGXn4QGCUXqQXfdXkyENLNT55wsAT/P64eCObOCH4d8mhvT1DlUQW1LR6QA7o7iZ9JpQsFLQzZDJxu1TKuJB4yypA9UBOARkoyDB+oPIOQRAr+pKDzBMqdIa5gQBvNivfwJRZipt0mmpBaTsvcrjrDeqs9BNMNxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H492h3zy+zQgFK4gbKLUlUZchyTJd7Y7VmAgomkPmho=; b=jMzIg9259ks2Gl5wDTU89K4UhrUYXmMqHghs3JWk2aWXc6COK9t5Pfykl67o0RO8xPA1xwXFFzDa81lUddVkDg2lrLgijotBbDKn3pY1ax+T4QV/RotVVrZtsNYwxUDGHujLINyQ1R8q1nc/uSq6NGlzMGQ35nQN8vCnD9eoEgI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4222.eurprd04.prod.outlook.com (2603:10a6:803:46::19) by PAXPR04MB8653.eurprd04.prod.outlook.com (2603:10a6:102:21c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.18; Wed, 22 Feb 2023 11:40:17 +0000 Received: from VI1PR04MB4222.eurprd04.prod.outlook.com ([fe80::8562:affc:e0c:c610]) by VI1PR04MB4222.eurprd04.prod.outlook.com ([fe80::8562:affc:e0c:c610%7]) with mapi id 15.20.6134.019; Wed, 22 Feb 2023 11:40:17 +0000 From: Chancel Liu <chancel.liu@nxp.com> To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, perex@perex.cz, tiwai@suse.com, ckeepax@opensource.cirrus.com, patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Chancel Liu <chancel.liu@nxp.com> Subject: [PATCH 4/4] ASoC: wm8524: Delay some time to follow power up sequency Date: Wed, 22 Feb 2023 19:39:45 +0800 Message-Id: <20230222113945.3390672-4-chancel.liu@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230222113945.3390672-1-chancel.liu@nxp.com> References: <20230222113945.3390672-1-chancel.liu@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0033.apcprd01.prod.exchangelabs.com (2603:1096:4:192::23) To VI1PR04MB4222.eurprd04.prod.outlook.com (2603:10a6:803:46::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4222:EE_|PAXPR04MB8653:EE_ X-MS-Office365-Filtering-Correlation-Id: f3413fb6-69d0-416d-95a1-08db14c9921f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JYGOqS/TqkefrFnIgjIQq35lgPYF8yP3QtnP/6tV5jraXljyqCyVh/TYm+rVpC1/79kg2DB41NDObYR9UCyZDr9lKvw6iht0ED5WTi5UmA2Rm8p6jpknVjfgqQSA2amFuC0tUh+8f5Sd4hj4UaAmjP4wOApCrQP3Cvk2SqbqXUy9MhJSQK+KddQROsuoQ7xKlagHqAbldx6VnaldECw3cj2HZsUWgWpEQ2dU0eCWKcdCs1RhCFfQv3LM9MBU3GOdlyRWkkZPo9PIIug9dBUCpl8daDGszLtREOwt0ZvwpCxXmPq2uj6DIddgzfy0wL1CCeETTkNwGiGpe9yyj0Ao+0qSE1VHAYaLFt4IRuYh+ITcNnYwzuJd7vSZ2Gk8VNmhfpnnvDVPmIsVLKS/S/ve8OKMEeOtMgS6iEyBMsF+x1OhmPOJn4znScRtOXcUEyFK9Lmum8W//eyQgzCXhJnFs8HDJZt4BKBLMajPuqEfhfIw457EH3uvR2giMR2WDF8fcn9+9xGz1qarymm/O2HUxfvP8dGz51FpdE/0krISAjIJMiKAKxQ+qkf4zNy2hQ86rDV/wBiLWKrrUpmkMo6gC4R4Sst9PlQPcModPSRQ0S1zLVLSDZ97BWCsPysKqJLbkG0VhHJwQjmZhem8VwKJvnMMmNNHx7cE6qbGToSJYQG+P8tEcyVE3MYDoI3+eLn0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB4222.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(346002)(396003)(39860400002)(366004)(376002)(451199018)(478600001)(86362001)(38100700002)(38350700002)(2906002)(44832011)(921005)(316002)(41300700001)(36756003)(7416002)(5660300002)(8936002)(83380400001)(4326008)(66476007)(66946007)(8676002)(66556008)(966005)(186003)(26005)(6486002)(1076003)(6506007)(6512007)(2616005)(6666004)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2Ia/wQRpp6kWkccXPVI4IWDRGP+WGzaEqWmP7GcRvQ1Iz6UFMC0bATYZfXsj1QXJs14WFpGwklHtlPZ6AtRV3cDuJ4WqjFR6dEufUY8rghRm4sYZ3nBskGBq7wDZFuq2M0zrslEWNzcnCCpwAMbgND26oJ+aHopIx85PIUJiQrKHtfAa8Q/cORDllR7m68e2jYOv8+Vh7Gx/ywgWlvKkW5v7XX/ctextwhrF8ssL8MWVPJqAjhaJoYmzhPLFWnnVQi4sU3h4gwu69Xewht5CkpccZcb7P3RSZ9e1sT8oCqQNkre7wt4uJYWYg4zX7Zu5Wg1wXxGbH47Y56U+76trq5TgWh+QGFwKwAz9qeW9JYZStGVlBKmnJhi2v1/e/Nf2LJUHGGdtVfWSScJp6j8olVnR778zQrYu5GtFd+E7Ybhq2nE84daWW5EdpWMVBE9Bbveg+skb/7wkZdEkSdPRC5MjZcYMgaClc4HL7qflx4OiQjMWQVgpIyjixqb1KX5PM6ZlzQfm4N57phLFIRIG/QBnG6toxHKB8vGANYfUXP4iOMER9MLxP1+PHBicp4iXvkpiHXgwFrvUfDTj4Agx4aPwAZVYD2iVlnOHzWZ+j885N0QVTzStNsvNhKZ3LeDTDb9OPgPiRHzBJZ8tm/mPvdsqrpLbAdRSHWCYdwwBNBGbSIZguKufiHdZYPbc3zN3YQpI2al/YDLZUuvESOZudEkuMJTjMp+jm+iZN3g6nlprbBnF6GsxKI/1qViVdcIAG5nuUNF8Zoq64rGkQ55AA06iAS34g1dNEu/Vubk0wQJUvk2imOwOZ5Y/Pa7pdmW283268RajjE1OrfvxTWr5LJQtVZtnSrJuS8WP9holnERcVJh6ABP569cbqnYUTX1No2uESwp9/cJOuAaqSMEBb9iKgX5KukCEuyyUNYZtyLa8F5s7Aka2dO2xAMMpwMiYRH48hr6GB92Iggg/YgLQHBLrsBYQyeKYkONIS000AXZxkX9a7LwIoxx0wliKu9zqVrwrmyWpQg69rRllC7EDN2ZPn53zNMfcGS4gpY1KxPDa9Qr3D4WxwMMHl2COlH19Ye3CeYGzLlECwV952WbJPjqaBhK/glAfjCoeHv7jqlEM8CvPZnrvpEPA7BpNI1E5v9Hk8FV8fsghdigawP7SiyDKWHL45tS64GFkcPGqATLVnyAK25ZSHSlX6RwA/61PXzHbmKgKUl4Gz2RbX1pRHOkcATrILbwtMHFiZ28xbmreK3wfy3ybnoUOpjd+DayfhfftNPnnHWOuTM0kZ8rmfoOvMAWiplyhcUs2yBdSVbUYaBgHpkCOOjVThaf0UPXm6y/xyk2/050ZjkRz7Y7/eXPOI8ftsIJyHN7HAlbFhY36YccURA7za3vHY/d5L+Au5w62AJyiOyhNxZ6QNhYr689mWp/uwx/VzZLtlnaUHcxHmUVMt9sbjJRZnjDYqhHWJblIREx7uSXkK9PchtmWDZM4rKGS2XKBjJVq88L1pdvOFHg9ZDQBVinZk0Yn3KurRTG3on2Fi65YzawAAblAzCrAnbXQl2byvgHPmGr2uX/nwnGNXJFI29fZTpNQxXHp X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3413fb6-69d0-416d-95a1-08db14c9921f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4222.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2023 11:40:17.7613 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NuMNIp2xjQKVdZZjxMHBB9bvggRyh8cO0/S9oyQ197VQ23wpz/5hArDdJG0sAmjNtysW6HpI+m32r9ycmDSWYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8653 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?1758532102206578659?= X-GMAIL-MSGID: =?utf-8?q?1758532102206578659?= |
Series |
[1/4] ASoC: dt-bindings: wlf,wm8524: Convert to json-schema
|
|
Commit Message
Chancel Liu
Feb. 22, 2023, 11:39 a.m. UTC
The recommended power sequence needs to be followed to ensure the best
performance. After MCLK, BCLK and MUTE=1 are ready, this device has to
wait some time before ready to output audio. Otherwise the beginning
data may be lost. For more details about the timing constraints, please
refer to WTN0302 on https://www.cirrus.com/products/wm8524/
Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
sound/soc/codecs/wm8524.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
Comments
On Wed, Feb 22, 2023 at 07:39:45PM +0800, Chancel Liu wrote: > + switch (cmd) { > + case SNDRV_PCM_TRIGGER_START: > + case SNDRV_PCM_TRIGGER_RESUME: > + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: > + mdelay(wm8524->power_up_delay); > + break; Doing a 100ms busy wait in atomic context does not seem like a great idea, never mind a 1.5s one. This shouldn't be done in trigger, it needs to be done later - digital_mute() might be a better time to hook in, though longer delays like this are really quite bad.
> On Wed, Feb 22, 2023 at 07:39:45PM +0800, Chancel Liu wrote: > > > + switch (cmd) { > > + case SNDRV_PCM_TRIGGER_START: > > + case SNDRV_PCM_TRIGGER_RESUME: > > + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: > > + mdelay(wm8524->power_up_delay); > > + break; > > Doing a 100ms busy wait in atomic context does not seem like a great > idea, never mind a 1.5s one. This shouldn't be done in trigger, it > needs to be done later - digital_mute() might be a better time to hook > in, though longer delays like this are really quite bad. Yes, such long time delay in driver is very bad. But this device requires waiting some time before able to output audio. We have to wait otherwise the beginning data may be lost. The power up to audio out timing occurs after MCLK, BCLK and MUTE=1 are ready. I added the delay in trigger() because some CPU DAI drivers enable BCLK in trigger(). You suggested moving the delay to digital_mute(). It seems digital_mute() is called before cpu_dai->trigger. Please correct me if I'm wrong. Regards, Chancel Liu
On Fri, Feb 24, 2023 at 10:54:59AM +0000, Chancel Liu wrote: > > On Wed, Feb 22, 2023 at 07:39:45PM +0800, Chancel Liu wrote: > > Doing a 100ms busy wait in atomic context does not seem like a great > > idea, never mind a 1.5s one. This shouldn't be done in trigger, it > > needs to be done later - digital_mute() might be a better time to hook > > in, though longer delays like this are really quite bad. > Yes, such long time delay in driver is very bad. But this device requires > waiting some time before able to output audio. We have to wait otherwise the > beginning data may be lost. It's not just that it's doing this in the driver, it's doing it in the trigger() function which runs in atomic context. That's unreasonable. > The power up to audio out timing occurs after MCLK, BCLK and MUTE=1 are ready. > I added the delay in trigger() because some CPU DAI drivers enable BCLK in > trigger(). You suggested moving the delay to digital_mute(). It seems > digital_mute() is called before cpu_dai->trigger. Please correct me if I'm > wrong. Hrm, right - in any case, it needs to be somewhere that isn't atomic context.
> > > On Wed, Feb 22, 2023 at 07:39:45PM +0800, Chancel Liu wrote: > > > Doing a 100ms busy wait in atomic context does not seem like a great > > > idea, never mind a 1.5s one. This shouldn't be done in trigger, it > > > needs to be done later - digital_mute() might be a better time to hook > > > in, though longer delays like this are really quite bad. > > > Yes, such long time delay in driver is very bad. But this device requires > > waiting some time before able to output audio. We have to wait otherwise > > the beginning data may be lost. > > It's not just that it's doing this in the driver, it's doing it in the > trigger() function which runs in atomic context. That's unreasonable. > > > The power up to audio out timing occurs after MCLK, BCLK and MUTE=1 are > > ready. I added the delay in trigger() because some CPU DAI drivers enable BCLK in > > trigger(). You suggested moving the delay to digital_mute(). It seems > > digital_mute() is called before cpu_dai->trigger. Please correct me if I'm > > wrong. > > Hrm, right - in any case, it needs to be somewhere that isn't atomic > context. OK. I will keep PATCH 1 and PATCH 3. For PATCH 2 and PATCH 4, I have to find a better way in which long time delay can be avoided in atomic context. Thank you very much for your comments. Regards, Chancel Liu
diff --git a/sound/soc/codecs/wm8524.c b/sound/soc/codecs/wm8524.c index 8f2130e05b32..f61967b66c3b 100644 --- a/sound/soc/codecs/wm8524.c +++ b/sound/soc/codecs/wm8524.c @@ -21,6 +21,7 @@ #include <sound/soc.h> #include <sound/initval.h> +#define WM8524_POWER_UP_DELAY_MS 100 #define WM8524_NUM_RATES 7 /* codec private data */ @@ -29,6 +30,7 @@ struct wm8524_priv { unsigned int sysclk; unsigned int rate_constraint_list[WM8524_NUM_RATES]; struct snd_pcm_hw_constraint_list rate_constraint; + unsigned int power_up_delay; }; @@ -157,6 +159,28 @@ static int wm8524_mute_stream(struct snd_soc_dai *dai, int mute, int stream) return 0; } +static int wm8524_trigger(struct snd_pcm_substream *substream, int cmd, + struct snd_soc_dai *dai) +{ + struct wm8524_priv *wm8524 = snd_soc_dai_get_drvdata(dai); + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + mdelay(wm8524->power_up_delay); + break; + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + break; + default: + return -EINVAL; + } + + return 0; +}; + #define WM8524_RATES SNDRV_PCM_RATE_8000_192000 #define WM8524_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ @@ -169,6 +193,7 @@ static const struct snd_soc_dai_ops wm8524_dai_ops = { .set_sysclk = wm8524_set_dai_sysclk, .set_fmt = wm8524_set_fmt, .mute_stream = wm8524_mute_stream, + .trigger = wm8524_trigger, }; static struct snd_soc_dai_driver wm8524_dai = { @@ -213,6 +238,7 @@ MODULE_DEVICE_TABLE(of, wm8524_of_match); static int wm8524_codec_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; struct wm8524_priv *wm8524; int ret; @@ -230,6 +256,9 @@ static int wm8524_codec_probe(struct platform_device *pdev) return ret; } + wm8524->power_up_delay = WM8524_POWER_UP_DELAY_MS; + of_property_read_u32(np, "wlf,power-up-delay-ms", &wm8524->power_up_delay); + ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8524, &wm8524_dai, 1); if (ret < 0)