From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9661BC433F5 for ; Tue, 5 Apr 2022 22:09:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391146AbiDEWEw (ORCPT ); Tue, 5 Apr 2022 18:04:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1572966AbiDEReB (ORCPT ); Tue, 5 Apr 2022 13:34:01 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BDF04F448 for ; Tue, 5 Apr 2022 10:32:00 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbn1n-0005q6-Lf; Tue, 05 Apr 2022 19:31:39 +0200 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1nbn1l-0004Ld-6t; Tue, 05 Apr 2022 19:31:37 +0200 Date: Tue, 5 Apr 2022 19:31:37 +0200 From: Sascha Hauer To: Ahmad Fatoum Cc: Nicolin Chen , Xiubo Li , Fabio Estevam , Shengjiu Wang , Liam Girdwood , Mark Brown , Viorel Suman , kernel@pengutronix.de, Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ASoC: fsl_sai: fix 1:1 bclk:mclk ratio support Message-ID: <20220405173137.GR4012@pengutronix.de> References: <20220405155731.745413-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220405155731.745413-1-a.fatoum@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 19:31:02 up 6 days, 6:00, 66 users, load average: 0.28, 0.18, 0.18 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 05, 2022 at 05:57:31PM +0200, Ahmad Fatoum wrote: > Refactoring in commit a50b7926d015 ("ASoC: fsl_sai: implement 1:1 > bclk:mclk ratio support") led to the bypass never happening > as (ratio = 1) was caught in the existing if (ratio & 1) continue; > check. The correct check sequence instead is: > > - skip all ratios lower than one and higher than 512 > - skip all odd ratios except for 1:1 > - skip 1:1 ratio if and only if !support_1_1_ratio > > And for all others, calculate the appropriate divider. Adjust the > code to facilitate this. > > Fixes: a50b7926d015 ("ASoC: fsl_sai: implement 1:1 bclk:mclk ratio support") > Signed-off-by: Ahmad Fatoum Reviewed-by: Sascha Hauer Sascha > --- > sound/soc/fsl/fsl_sai.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c > index a992d51568cc..50c377f16097 100644 > --- a/sound/soc/fsl/fsl_sai.c > +++ b/sound/soc/fsl/fsl_sai.c > @@ -372,7 +372,7 @@ static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq) > continue; > if (ratio == 1 && !support_1_1_ratio) > continue; > - else if (ratio & 1) > + if ((ratio & 1) && ratio > 1) > continue; > > diff = abs((long)clk_rate - ratio * freq); > -- > 2.30.2 > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |