Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp293641pxk; Wed, 2 Sep 2020 23:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHLcLMZSVzoqHgNnp9B5S7BLCXeUVIjbinvwNvAsics0uFSe0YWgEDopxNIireQIGXN82m X-Received: by 2002:a17:906:18a9:: with SMTP id c9mr512444ejf.294.1599112932275; Wed, 02 Sep 2020 23:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599112932; cv=none; d=google.com; s=arc-20160816; b=Wt4c0dNCfxoVvCCejWrB6Bk/CxqXUfB6FwJqRHaD6tN20kNz/aFqYv2tO5YtLOxKUT mkNasACGKhdQyTs3ahQRU6mYu5tOpXPtD2RoIwjsQIPOCssLuewKabx5zMtRjt0QGPnF BgMA58zvMHRcARrNLpUmOzxly0NkI99bICW4HoJRKquj4SUlkfWJavj89RTpOHGNz8ki 5HivccIDVRbK789eIti+vj7I/p9SelSyHz4YpxXIej5O+d7pztKUUCghEzGhFSmpm7tx ilplI9PGPR7DZSi4sCoOt8lEf0fwLeJ16POG548OQmY0L0oBM+RTyYRDNKjKthRBEh8B WBHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=r+IoOs69d9zUz4873VIz+8QZ8YdFJbmJfM7DFEOE7xo=; b=ZVFM/7w+t+WTEo3tuztS3NF/LRf5lTJ83rTSlzwQt/FS60aVrRK+YLPob4Y6vN3Mvv IBcY3B8kdo2NrLIAVK+WKOOd6A8d3EQWchVOWXzeWZ68pwmkfLCevO3TZXqzbm0mwSaP NefW+iJpS2Z3KZDNOSInfACZ7xZ/dg8j/Rxbpy7J2loH3VwCX2tc6BRzeW+7/8ZXScG1 gR2idB25xXatLAUe0HgTzo8NE5J0NNifrThE/6u5h8/kTtfrK75XjOJQ7eAJmsHr+h6F 4llKX4KrO3lPwV2QtJGtK1HTfaY4CFBbHG6V2y2p8uIa/k9djq1ADKtpCRVQyW3NlVwD Z5qQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx10si1000044edb.383.2020.09.02.23.01.48; Wed, 02 Sep 2020 23:02:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726047AbgICGAK (ORCPT + 99 others); Thu, 3 Sep 2020 02:00:10 -0400 Received: from inva021.nxp.com ([92.121.34.21]:38298 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbgICGAJ (ORCPT ); Thu, 3 Sep 2020 02:00:09 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 410A3201134; Thu, 3 Sep 2020 08:00:07 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C8C9D201149; Thu, 3 Sep 2020 08:00:02 +0200 (CEST) Received: from 10.192.242.69 (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 0B22C402AE; Thu, 3 Sep 2020 07:59:56 +0200 (CEST) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, lgirdwood@gmail.com Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ASoC: fsl_sai: Set SAI Channel Mode to Output Mode Date: Thu, 3 Sep 2020 13:53:47 +0800 Message-Id: <1599112427-22038-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Transmit data pins will output zero when slots are masked or channels are disabled. In CHMOD TDM mode, transmit data pins are tri-stated when slots are masked or channels are disabled. When data pins are tri-stated, there is noise on some channels when FS clock value is high and data is read while fsclk is transitioning from high to low. Signed-off-by: Cosmin-Gabriel Samoila Signed-off-by: Shengjiu Wang Acked-by: Nicolin Chen --- changes in v2 - update note - add acked-by Nicolin sound/soc/fsl/fsl_sai.c | 10 ++++++++-- sound/soc/fsl/fsl_sai.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 38c7bcbb361d..b2d65e53dbc4 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -489,6 +489,10 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, val_cr4 |= FSL_SAI_CR4_FRSZ(slots); + /* Set to output mode to avoid tri-stated data pins */ + if (tx) + val_cr4 |= FSL_SAI_CR4_CHMOD; + /* * For SAI master mode, when Tx(Rx) sync with Rx(Tx) clock, Rx(Tx) will * generate bclk and frame clock for Tx(Rx), we should set RCR4(TCR4), @@ -497,7 +501,8 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, if (!sai->is_slave_mode && fsl_sai_dir_is_synced(sai, adir)) { regmap_update_bits(sai->regmap, FSL_SAI_xCR4(!tx, ofs), - FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK, + FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK | + FSL_SAI_CR4_CHMOD_MASK, val_cr4); regmap_update_bits(sai->regmap, FSL_SAI_xCR5(!tx, ofs), FSL_SAI_CR5_WNW_MASK | FSL_SAI_CR5_W0W_MASK | @@ -508,7 +513,8 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, FSL_SAI_CR3_TRCE_MASK, FSL_SAI_CR3_TRCE((1 << pins) - 1)); regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx, ofs), - FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK, + FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK | + FSL_SAI_CR4_CHMOD_MASK, val_cr4); regmap_update_bits(sai->regmap, FSL_SAI_xCR5(tx, ofs), FSL_SAI_CR5_WNW_MASK | FSL_SAI_CR5_W0W_MASK | diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h index 5f630be74853..736a437450c8 100644 --- a/sound/soc/fsl/fsl_sai.h +++ b/sound/soc/fsl/fsl_sai.h @@ -119,6 +119,8 @@ #define FSL_SAI_CR4_FRSZ_MASK (0x1f << 16) #define FSL_SAI_CR4_SYWD(x) (((x) - 1) << 8) #define FSL_SAI_CR4_SYWD_MASK (0x1f << 8) +#define FSL_SAI_CR4_CHMOD BIT(5) +#define FSL_SAI_CR4_CHMOD_MASK BIT(5) #define FSL_SAI_CR4_MF BIT(4) #define FSL_SAI_CR4_FSE BIT(3) #define FSL_SAI_CR4_FSP BIT(1) -- 2.27.0