Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A69ECC4332F for ; Wed, 9 Nov 2022 12:55:58 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0073A822; Wed, 9 Nov 2022 13:55:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0073A822 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1667998556; bh=uWzX1BXuxng/Tru2HX1P8/7DV2EM1E7fd6emjv2DXGw=; h=Date:Subject:To:References:From:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=vmt2gl5EUHsDjmruGT7ttwv57/MC1vlDGJgHPJqYbH7y/DUW9z9kPA1/tXowsz+BA DlvjuZwP4W/OIR7fk6Kgsbo9ahNCi45o6Hu4x+O3EoYQ/rS69xaWvk1/OZYueP0EuA /UHR/u8DnerivrCkQTZJvorqSpxwLT/VSRGx33cE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 912B6F80114; Wed, 9 Nov 2022 13:55:05 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 50A4EF80217; Wed, 9 Nov 2022 13:55:04 +0100 (CET) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A34CEF80114 for ; Wed, 9 Nov 2022 13:55:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A34CEF80114 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.b="FhwdS55f" Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id BCD2284FE8; Wed, 9 Nov 2022 13:54:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1667998500; bh=ntvJuaH/z37Of6KcTp5JrJWfzFxrW8j05Lt4rDfmM54=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=FhwdS55f5JqM+AOCzTfnP1CAB/F0yR3uHGNGU5KnjpPBlXN5o8Zaly8bYjRLcI+oD dtvVys65xdVGSpzp6eVfICm5AAviwpggyC//X/dr+p1W00ib+x8dwgxyd4ZeymdEU7 STm6hDZnwF7RSp2zYwOB5fVG+TGUTDfDLSX5wvtBvysX0TdyH2iht658ZextPhfllX jBV0F3nJGMj5IsTbIx5JedEbOXltFvWAKNLKL1ZsBxqvXaMGLFtR50DCpBfJZsJwNC 1pro3yfed0fRQascQOVLKpgwMZazAaF2Png8EajfrQscaOoq2BIYD7jwbPDc0Kjj7k 1is2xrMbN7ktA== Message-ID: <654da7a3-20fa-e84d-9050-5c6fcb7d6f3b@denx.de> Date: Wed, 9 Nov 2022 13:54:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH] ASoC: fsl_sai: Enable transmitter when generating MCLK Content-Language: en-US To: Shengjiu Wang References: <20221107215201.434212-1-marex@denx.de> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Cc: alsa-devel@alsa-project.org, Xiubo Li , Takashi Iwai , Liam Girdwood , Nicolin Chen , Mark Brown , Fabio Estevam X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On 11/9/22 10:30, Shengjiu Wang wrote: [...] >> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c >> index 1c9be8a5dcb13..98c62027e5799 100644 >> --- a/sound/soc/fsl/fsl_sai.c >> +++ b/sound/soc/fsl/fsl_sai.c >> @@ -503,6 +503,10 @@ static int fsl_sai_set_bclk(struct snd_soc_dai *dai, >> bool tx, u32 freq) >> /* SAI is in master mode at this point, so enable MCLK */ >> regmap_update_bits(sai->regmap, FSL_SAI_MCTL, >> FSL_SAI_MCTL_MCLK_EN, >> FSL_SAI_MCTL_MCLK_EN); >> + >> + /* Transmitter must be enabled to generate MCLK on pad */ >> + regmap_update_bits(sai->regmap, FSL_SAI_xCSR(1, ofs), >> + FSL_SAI_CSR_TERE, FSL_SAI_CSR_TERE); >> > > No need to fix the transmitter, FSL_SAI_xCSR(tx, ofs) should work also. That's probably not a good idea, since this could also enable the RE(receiver) part . We always need to enable the TE(transmitter) to generate MCLK. >> } >> >> return 0; >> @@ -1445,6 +1449,11 @@ static int fsl_sai_probe(struct platform_device >> *pdev) >> sai->soc_data->max_register >= FSL_SAI_MCTL) { >> regmap_update_bits(sai->regmap, FSL_SAI_MCTL, >> FSL_SAI_MCTL_MCLK_EN, >> FSL_SAI_MCTL_MCLK_EN); >> + >> + /* Transmitter must be enabled to generate MCLK on pad */ >> + regmap_update_bits(sai->regmap, >> + FSL_SAI_xCSR(1, >> sai->soc_data->reg_offset), >> + FSL_SAI_CSR_TERE, FSL_SAI_CSR_TERE); >> > > After one time playback or recording, the TERE is disabled, so this changes > in probe() only for the first time. There is the same issue for the second > time. So what would you suggest to keep the MCLK clock generated always ? I was almost tempted to turn the SAI into a clock provider, so that the codec could become its clock consumer and enable the MCLK on demand, but that seems to be a rather invasive change.