Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp567122rdb; Tue, 19 Sep 2023 04:09:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8X1YteMnP/RbNQYMSiukvB7zh6KON9ZQ+vdws72fApYpVmGmKcPlW2HHCHUzIZFOwu87t X-Received: by 2002:a17:90a:8043:b0:26d:2d77:da7b with SMTP id e3-20020a17090a804300b0026d2d77da7bmr10557465pjw.6.1695121743575; Tue, 19 Sep 2023 04:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695121743; cv=none; d=google.com; s=arc-20160816; b=rItJPof7K4VHMQnTNzhDv3OencRRnE23M+8CP3vQvv6MHw7SBMs9DAI9z4e495cucW zR0G2utMLoXhV3gwNapyztV8tjYdedRThvE6v/BrsNjnendjPN61slxovY1EGxFg/nRx DFS7wPlWYE24nFUBAmx3aWvnOWk7HGobH0Z0Ujo1kaEgclf9iu5Cqs/WfaAaESu4DZ8B e/rGUegjiqVkqi/bG/F7VMz8xEwcyaLI7Jb/ZFVuaZsG5azLkHz/oBTdMJip2CVgL7We e1dIzaiELOTPSEbazAPx07Co1X3peaaUcC0eOAUgmyIfWvLzJeRRQ3dLXfCvL9o/oo4Y tJCA== 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:to:from; bh=qZYKd2h1UMBoxsSbwbTK80c6Fcx+hoTkeWoQ06mWHPY=; fh=cL6g29IMbzZZPjv2PJT271AMU1SOJfv77jxaz3cjvFQ=; b=WkOt2Faskfx073juWLa7UaeB/XZpZGqae43QMCDh5KAq/DEo2j5mUaJzoiiyYjBvOT ltw1gu941X3rGgsvecQfzi8u4f75pYSttMKUei04F4SB5YLYmEkDvLxkBT8PUWvAvLr2 T3k2Y9tuzeQxLDwYZGCUslGOOEWq0ZIYS/Gb3YhexckjL5Yn5zI4f5wOsq+xLfzMshn9 b4NMGn76i/NFdWOIUbbGoMqzXkhYnrAjfhxIVIz6apmXaKQjimjy6oaRo499WGzHIy8e hEKfQykPauESGzan64UrKkRE9BlHsMjf/T163s+OwARStXjZOzT1MYEOVOybc8ARRXJX 8Vmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 1-20020a631941000000b0057764b2f3dfsi1385577pgz.198.2023.09.19.04.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 04:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id F2D5E8092CA8; Tue, 19 Sep 2023 03:19:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230287AbjISKTE (ORCPT + 99 others); Tue, 19 Sep 2023 06:19:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbjISKTE (ORCPT ); Tue, 19 Sep 2023 06:19:04 -0400 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B6EF1 for ; Tue, 19 Sep 2023 03:18:57 -0700 (PDT) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A9A191A07B0; Tue, 19 Sep 2023 12:18:55 +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 72F7A1A0313; Tue, 19 Sep 2023 12:18:55 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id E62CA1820F58; Tue, 19 Sep 2023 18:18:53 +0800 (+08) From: Shengjiu Wang To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, matuszpd@gmail.com Subject: [PATCH] ASoC: fsl_sai: Don't disable bitclock for i.MX8MP Date: Tue, 19 Sep 2023 17:42:13 +0800 Message-Id: <1695116533-23287-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 19 Sep 2023 03:19:18 -0700 (PDT) On i.MX8MP, the BCE and TERE bit are binding with mclk enablement, if BCE and TERE are cleared the MCLK also be disabled on output pin, that cause the external codec (wm8960) in wrong state. Codec (wm8960) is using the mclk to generate PLL clock, if mclk is disabled before disabling PLL, the codec (wm8960) won't generate bclk and frameclk when sysclk switch to MCLK source in next test case. The test case: $aplay -r44100 test1.wav (PLL source) $aplay -r48000 test2.wav (MCLK source) aplay: pcm_write:2127: write error: Input/output error Fixes: 269f399dc19f ("ASoC: fsl_sai: Disable bit clock with transmitter") Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_sai.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 1e4020fae05a..8a9a30dd31e2 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -710,10 +710,15 @@ static void fsl_sai_config_disable(struct fsl_sai *sai, int dir) { unsigned int ofs = sai->soc_data->reg_offset; bool tx = dir == TX; - u32 xcsr, count = 100; + u32 xcsr, count = 100, mask; + + if (sai->soc_data->mclk_with_tere && sai->mclk_direction_output) + mask = FSL_SAI_CSR_TERE; + else + mask = FSL_SAI_CSR_TERE | FSL_SAI_CSR_BCE; regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs), - FSL_SAI_CSR_TERE | FSL_SAI_CSR_BCE, 0); + mask, 0); /* TERE will remain set till the end of current frame */ do { -- 2.34.1