Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1005765pxb; Thu, 4 Mar 2021 00:15:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzW5VhANCN5xX32F/VM+ECTBEgnZd+nB/GuxwjNfKKELea+/z1Qe+kDuqRS22h1f8FSz7nH X-Received: by 2002:a17:906:38da:: with SMTP id r26mr2979158ejd.251.1614845743390; Thu, 04 Mar 2021 00:15:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614845743; cv=none; d=google.com; s=arc-20160816; b=D4FwbzeTrazxLvxKrtluC6bqXuLBCr6NVUn5nabfnXJYB3U9gMjZLyL+H/mTDmlgd+ 47fviyp3Eb1s6D4+LWSzj5+ro0VHnRLm+ZwatrCp+xmX9NXuOVOCT1dbRwBzAumBKJkV x1E5kGLsp0CIsZkfxHJ4zuyH8AYGPC2gA6KfOle1CzwAjNmws/ypeutARCE6MKeg76Px r093pAZBocg0N10dUqk8rTNCNwHSNAvzQCTvdfTNPATkawduoEdm86HK44qdLMK1bzyl rwZhIeUQwZl7OBxVRFomVDupCDHEwyV8/zqkEo1k8k/fD/mS9Jt/0aq5FzD9q4Lvz6rJ Uo2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from; bh=6irakKRG+7r84UvEwJjmfoFT/k2dthxL4mVikzYgBa0=; b=RGzlIJVv/6iG6KCM2todfpjLzkXsGp4Ai/V5/tuINzu/6wbE+PqdGD8MYtlYShdA1u lVRDPDOlcWrf2+InPv0H+yT6f8scyhsMFXN4fbamEp/IOBwENdnMWec7grggj1gx1aUU 5dXc6J2jzprBX1oZ2g1Sv9yrdG4QXjeTR7U6XZQllOiSMMZ/nOs6BMQ99FqWkg26LilE GoF3PUfougpz/pWKqRZkv0rc1X/vrcpm7jaJRpmyXNHh3YG6N/IPVvkl6xcZc0DZmBaI J/AyTD1sk6gNqbc2Dj2C/CA/wBY2Kh1nuqu0DaqpvoM1xd3/nTNVJBlV9+dntWjRm3ib UxTw== 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 l26si12747629ejc.536.2021.03.04.00.15.20; Thu, 04 Mar 2021 00:15:43 -0800 (PST) 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 S1357924AbhCCLhQ (ORCPT + 99 others); Wed, 3 Mar 2021 06:37:16 -0500 Received: from inva021.nxp.com ([92.121.34.21]:39720 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349853AbhCCDV4 (ORCPT ); Tue, 2 Mar 2021 22:21:56 -0500 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E8BA6200024; Wed, 3 Mar 2021 04:20:20 +0100 (CET) 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 D8323200154; Wed, 3 Mar 2021 04:20:13 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 7B7EE402C1; Wed, 3 Mar 2021 04:20:05 +0100 (CET) From: Shengjiu Wang To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, shengjiu.wang@nxp.com, ckeepax@opensource.cirrus.com, kuninori.morimoto.gx@renesas.com, peter.ujfalusi@ti.com, gustavoars@kernel.org, pierre-louis.bossart@linux.intel.com, daniel.baluta@nxp.com, patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk Date: Wed, 3 Mar 2021 11:07:42 +0800 Message-Id: <1614740862-30196-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The call sequence in wm8960_configure_clocking is ret = wm8960_configure_sysclk(); if (ret >= 0) goto configure_clock; .... ret = wm8960_configure_pll(); configure_clock: ... wm8960_configure_sysclk is called before wm8960_configure_pll, as there is bitclk relax on both functions, so wm8960_configure_sysclk always return success, then wm8960_configure_pll() never be called. With this case: aplay -Dhw:0,0 -d 5 -r 48000 -f S24_LE -c 2 audio48k24b2c.wav the required bitclk is 48000 * 24 * 2 = 2304000, bitclk got from wm8960_configure_sysclk is 3072000, but if go to wm8960_configure_pll. it can get correct bitclk 2304000. So bitclk relax condition should be removed in wm8960_configure_sysclk, then wm8960_configure_pll can be called, and there is also bitclk relax function in wm8960_configure_pll. Fixes: 3c01b9ee2ab9 ("ASoC: codec: wm8960: Relax bit clock computation") Signed-off-by: Shengjiu Wang Signed-off-by: Daniel Baluta --- changes in v2: - Find the real reason for the case, just patially remove bitclk relax sound/soc/codecs/wm8960.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index df351519a3a6..847ca16b9841 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -608,10 +608,6 @@ static const int bclk_divs[] = { * - lrclk = sysclk / dac_divs * - 10 * bclk = sysclk / bclk_divs * - * If we cannot find an exact match for (sysclk, lrclk, bclk) - * triplet, we relax the bclk such that bclk is chosen as the - * closest available frequency greater than expected bclk. - * * @wm8960: codec private data * @mclk: MCLK used to derive sysclk * @sysclk_idx: sysclk_divs index for found sysclk @@ -629,7 +625,7 @@ int wm8960_configure_sysclk(struct wm8960_priv *wm8960, int mclk, { int sysclk, bclk, lrclk; int i, j, k; - int diff, closest = mclk; + int diff; /* marker for no match */ *bclk_idx = -1; @@ -653,12 +649,6 @@ int wm8960_configure_sysclk(struct wm8960_priv *wm8960, int mclk, *bclk_idx = k; break; } - if (diff > 0 && closest > diff) { - *sysclk_idx = i; - *dac_idx = j; - *bclk_idx = k; - closest = diff; - } } if (k != ARRAY_SIZE(bclk_divs)) break; -- 2.27.0