Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1019585pxb; Wed, 6 Apr 2022 06:53:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyImWtFaenDIGuA3kgK0+6IdU4fJOslDjPikCfqWoqFfwQuVsTzxdFmfhwibr/fMo7tTnl6 X-Received: by 2002:a17:90a:d082:b0:1ca:be58:c692 with SMTP id k2-20020a17090ad08200b001cabe58c692mr10048616pju.238.1649253223979; Wed, 06 Apr 2022 06:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649253223; cv=none; d=google.com; s=arc-20160816; b=k0npAday950VLcSAF37cfK7FTEjXx9YQi7ZPpfsFSdHwsVrTsdGB+uWxlesm17LvQx vtH8e2uW/tt6wsTPRaN8dhrDzYvD5tUr9TLvIkYYgNn/BX7+UWwlChzzKtIzGZT1WKEj Ucp1t/6ab5HJK6AQDBMyux/84HvQOQlY6Fuj9OJHiIND4bC2mZWi+O0/hcyj6QoYOYpx JS20eaEHcQcC7xUOvhZZoWMKlwx9pVdP6VRN3uh6Q4J318I21ol49AhdoDaohRhgyaf/ yzXGfMLRJPpd9VVEM0KpXoJzdeb9SS19SZH9DJ0gE4NU0qdzgXuysNB9Bn+f0Fn/sY9m zC8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=PVaBwje3SZsUzDrdfuHSy9YuvHykVSLvvV/LMLDgTp8=; b=iCmRqMtTWOUCSUdb1Nw4WoWvs6okSpKYbdUq9dgXAnObj+DjIutFZRP7U9q93leVze MFmL+g6/Dvi76uiWY/cDuKR1ahThn0jMN+CVIz1TGfkpbRCGtTA+C296GIaK1lIDh/GQ 1M02Ea0JP9VlmfWc6x7yv4YXbEgbb3OlqdsCoWkVBv6cccAGkxVr0Q84hdLkyHu6MXt9 ucO2XTiUPVQxeCdJrqDzy42u6XU2ZTAoka+yY+7Or8T/s7sNgftd/8joyfl30c4FxcUP PcZ7r1PrARcRQghoQN+xoxKy6Z+olo9rT5WS0BJPaOBtr/gkYliC0UPM4rx2M5X5Gykn 1iJw== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 31-20020a630f5f000000b003829d4cd1c8si14981199pgp.696.2022.04.06.06.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:53:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4EE9955CD06; Wed, 6 Apr 2022 04:47:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838965AbiDFA5i (ORCPT + 99 others); Tue, 5 Apr 2022 20:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457516AbiDEQDT (ORCPT ); Tue, 5 Apr 2022 12:03:19 -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 55CACCD for ; Tue, 5 Apr 2022 08:58:30 -0700 (PDT) Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nblZT-0004nd-AF; Tue, 05 Apr 2022 17:58:19 +0200 Received: from afa by dude.hi.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nblZR-0038Jb-G8; Tue, 05 Apr 2022 17:58:17 +0200 From: Ahmad Fatoum To: Nicolin Chen , Xiubo Li , Fabio Estevam , Shengjiu Wang , Liam Girdwood , Mark Brown , Ahmad Fatoum , Viorel Suman , Sascha Hauer Cc: kernel@pengutronix.de, Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: fsl_sai: fix 1:1 bclk:mclk ratio support Date: Tue, 5 Apr 2022 17:57:31 +0200 Message-Id: <20220405155731.745413-1-a.fatoum@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: afa@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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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 --- 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