Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30411399rwd; Thu, 6 Jul 2023 05:41:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlHxkmZYGR1mwAFqjh+HGlNdTephbS3xtsVBznhZCw8hpyTB6fc3y1oSuKXabSK5RS02s7wR X-Received: by 2002:a05:6a00:13a0:b0:67a:39c4:5bb5 with SMTP id t32-20020a056a0013a000b0067a39c45bb5mr1798965pfg.6.1688647279179; Thu, 06 Jul 2023 05:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688647279; cv=none; d=google.com; s=arc-20160816; b=DbvPd0hJkF7oZ8im9xL32V8r/WfCCANkhSKG8nRWvH3oDvXLZFJjaq2H+3Vr1Sy0lz T8EZADWpiRIzh71qzYUZ7I+p1++qGbH74OnlfdIEivMvu3RgrlXb32nHJdL/dQauEbRl NEED+dRjFIl46q/I2ylK4kzOJUPtowJbneCGRLJNrBJbgh9JweZquYIOKkm74iijRUID ZXvyump+FMxAyDt6hFjTxs1BAJZQJOmIdt07SdQqpQFjEr0N29qVTnZ492tEjJi+a3AQ WwwSIzMxZoh3/m7RKjA0VPLP/SW0S4ntvk/U/jvSzfG2HWK5tN+ze48mVlsq/lnwuuGN hgWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=EAKWijyEM4pQTQqwlXIIyF9nSdVIrHMnk3s6iSxufII=; fh=Wkr5jLuAEHdwUljmDJGHrtS/CnhRMebpUkHq71p6+pQ=; b=zX5DMAEq3mSLlciiTFCKAbE3rDkpG4BigPvaNN/DBzdkfjB9QednsPDrP6OP/208QS MQQzMW0lFw4+ZVMD6fLWJFWHYJmiuFCc1GV0/4F7yVcfJ07sjgOvoVnjZIBHJ5YdYR+l kQyK/5QMUTdF+mZCnWH9xXN4nwP+FUiiBBwrOILNuLARN/riyqItnI0JpBnvLO5gs+RU j5mKesTmIT/Yw0K2YASN3FzhSBUEjY93tncrQAM9os4NRxOUQtDD35WMupMFp59s0se/ l/dB5rR+/lUfi95fsENXztnwMZ6aupCEyGoZntB/2b8G6Q4QJPNXFvpyNhC9SdnBEw8s koZQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h34-20020a631222000000b0055384255b9bsi1371207pgl.24.2023.07.06.05.41.05; Thu, 06 Jul 2023 05:41:18 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231466AbjGFMeN (ORCPT + 99 others); Thu, 6 Jul 2023 08:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjGFMeK (ORCPT ); Thu, 6 Jul 2023 08:34:10 -0400 Received: from pi.fatal.se (andreasfatal-1-pt.tunnel.tserv3.fmt2.ipv6.he.net [IPv6:2001:470:1f04:f16::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 27DDC1BE3 for ; Thu, 6 Jul 2023 05:34:03 -0700 (PDT) Received: by pi.fatal.se (Postfix, from userid 1000) id E76412A8E0; Thu, 6 Jul 2023 14:34:01 +0200 (CEST) Date: Thu, 6 Jul 2023 14:34:01 +0200 From: Andreas Henriksson To: Fabio Estevam Cc: Shengjiu Wang , Shengjiu Wang , Nicolin Chen , Xiubo Li , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Linux-ALSA , linuxppc-dev , linux-kernel , Hans =?iso-8859-1?Q?S=F6derlund?= Subject: Re: [PATCH] ASoC: fsl_sai: Enable MCTL_MCLK_EN bit for master mode Message-ID: <20230706123401.kctossjho26bry7e@fatal.se> References: <1652963808-14515-1-git-send-email-shengjiu.wang@nxp.com> <20230706084706.bzwsbi3zisx5m5rl@fatal.se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 Hello Fabio, Maybe I shouldn't comment as I'm already on deep water, but... On Thu, Jul 06, 2023 at 08:32:57AM -0300, Fabio Estevam wrote: > On Thu, Jul 6, 2023 at 8:19 AM Shengjiu Wang wrote: > > > No, this is the code in probe(). > > The code with the issue is in fsl_sai_set_bclk(). > > Yes, I put it in the wrong place. > > > The clean way for fixing is to remove the code in fsl_sai_set_bclk() > > and add "fsl,sai-mclk-direction-output;" property in dts for some > > node. > > Yes, what about this? > > --- a/sound/soc/fsl/fsl_sai.c > +++ b/sound/soc/fsl/fsl_sai.c > @@ -507,7 +507,7 @@ static int fsl_sai_set_bclk(struct snd_soc_dai > *dai, bool tx, u32 freq) > savediv / 2 - 1); > } > > - if (sai->soc_data->max_register >= FSL_SAI_MCTL) { > + if (sai->soc_data->max_register >= FSL_SAI_MCTL && > sai->mclk_direction_output) { > /* 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); This is exactly the same as and thus redundant to the code already in the probe function?! If I understood it correctly, the problem Shengjiu was trying to adress was that apparently on i.MX8MM (and only imx8mm?!), even when using MCLK in *input*, you still need to enable it because otherwise BCLK will not be generated. (I personally don't know anything about this or the imx8mm variant though.) The problem could probably equally well be worked around by always setting the fsl,sai-mclk-direction-output; devicetree property on imx8mm, even when using MCLK in input..... But I'm just guessing here to be honest. This is just as I understood what purpose the initial patch that was merged had. The current state affects more devices than imx8mm though, making MCLK in input mode not possible. I think your initial review comment was spot on Fabio. There probably needs to be a(n imx8mm) specific flag that says when this workaround should be applied and gate the code in bclk function on that. Atleast that's the only thing I can think of if my interpretation of the problem for imx8mm is correct. Regards, Andreas Henriksson