Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp610206rwe; Thu, 25 Aug 2022 06:20:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Vkh8B6uWq6PpjPINPNq8LpEKM8U8nzIkowlGn6550SPUPx47lnvladybK1am9NE2U34A6 X-Received: by 2002:a17:902:c40e:b0:172:de75:ed0 with SMTP id k14-20020a170902c40e00b00172de750ed0mr3910446plk.70.1661433622621; Thu, 25 Aug 2022 06:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661433622; cv=none; d=google.com; s=arc-20160816; b=g6y93eNQ3IHi/V1tFXw84NSiqry8aOjnh1fsFhrXlV9MRYkt2lO8ilxvsTKQ2iGXMy kxvDGXnUx0xq2zExWZcU6foGFRuzChJcyI3EBJb0n/VJHuaX3ZcD+UiGzKfpFdDwiffk V0UtEEZO92uJxjIV3VvhK4maghfHxor8ZUErQl1XBi2txLDaFHC7A+IAHOTlwVAJf80p GdGs1QXQLpbkCnpz1QNp7PmsM8sI7pxbSlNjIPLVA8zMl8OiYoSxEtniQh/v5xygmXaR y1A6D1IEtW/sUdCCbLhy/o5EwEJ+LBvncgI8AsKcH2Xdgv6DMPnzHjeZsEtW1LmvaUGV IDwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=fOFEaqdNJ9VzlB+Cy4w2Lbfh9PHWNvxYpX2xVZn5NHc=; b=p6qWggPh2g0m0uMkl76MUeEW4St0Sz8nI/WJh04kG1JefCP6A7zkaltfZ1peUMKADc 7+OF3DiKGXFqEIPYUG6EeFzRclI2/p+MeenfmXbhRtBiXF4S6TN1TMbqEngmahTRAPzu aVma0fNy7234fUC+DbvhvF0zH1tJVkYdJk3xfSpIhluU8lf1EiBQUPGG7JgMzT/7DaeW sdJKwps2nvhUreVZ6J+O+WJfVwL+Y/kS2GhlKkiIoggoI8AFg6PkY/IiEhjbI8ME8CHm kzReM3/e6nfI/ienRTKAoqOqFQ2Pd2LZl/NizKeruen5B7i9pAisoX/LRdTIbqtZ7e5L 1H/w== ARC-Authentication-Results: i=1; mx.google.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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br5-20020a056a00440500b0053712acc6e0si5770439pfb.246.2022.08.25.06.20.11; Thu, 25 Aug 2022 06:20:22 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240367AbiHYMrT (ORCPT + 99 others); Thu, 25 Aug 2022 08:47:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242015AbiHYMpO (ORCPT ); Thu, 25 Aug 2022 08:45:14 -0400 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E795237C9 for ; Thu, 25 Aug 2022 05:45:11 -0700 (PDT) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E98AB1A182F; Thu, 25 Aug 2022 14:45:09 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B36191A181F; Thu, 25 Aug 2022 14:45:09 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 43AF7180222C; Thu, 25 Aug 2022 20:45:08 +0800 (+08) From: Shengjiu Wang To: nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, shengjiu.wang@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ASoC: fsl_aud2htx: register platform component before registering cpu dai Date: Thu, 25 Aug 2022 20:27:39 +0800 Message-Id: <1661430460-5234-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org There is no defer probe when adding platform component to snd_soc_pcm_runtime(rtd), the code is in snd_soc_add_pcm_runtime() snd_soc_register_card() -> snd_soc_bind_card() -> snd_soc_add_pcm_runtime() -> adding cpu dai -> adding codec dai -> adding platform component. So if the platform component is not ready at that time, then the sound card still registered successfully, but platform component is empty, the sound card can't be used. As there is defer probe checking for cpu dai component, then register platform component before cpu dai to avoid such issue. And the behavior of imx_pcm_dma_init() is same as common devm_snd_dmaengine_pcm_register(), so use devm_snd_dmaengine_pcm_register() instead Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_aud2htx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_aud2htx.c b/sound/soc/fsl/fsl_aud2htx.c index 873295f59ad7..bc1b9c6df95c 100644 --- a/sound/soc/fsl/fsl_aud2htx.c +++ b/sound/soc/fsl/fsl_aud2htx.c @@ -234,6 +234,16 @@ static int fsl_aud2htx_probe(struct platform_device *pdev) regcache_cache_only(aud2htx->regmap, true); + /* + * Register platform component before registering cpu dai for there + * is not defer probe for platform component in snd_soc_add_pcm_runtime(). + */ + ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); + if (ret) { + dev_err(&pdev->dev, "failed to pcm register\n"); + return ret; + } + ret = devm_snd_soc_register_component(&pdev->dev, &fsl_aud2htx_component, &fsl_aud2htx_dai, 1); @@ -242,10 +252,6 @@ static int fsl_aud2htx_probe(struct platform_device *pdev) return ret; } - ret = imx_pcm_dma_init(pdev); - if (ret) - dev_err(&pdev->dev, "failed to init imx pcm dma: %d\n", ret); - return ret; } -- 2.34.1