Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3133349pxb; Tue, 12 Oct 2021 22:46:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziVbfMNDgbLBPBRUVdKFbln1iuahFycpx+Ez8PLZsuo4xRqr6BIcpTZRuSo6kaozyoGOkW X-Received: by 2002:a05:6402:2684:: with SMTP id w4mr6627249edd.108.1634103974407; Tue, 12 Oct 2021 22:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634103974; cv=none; d=google.com; s=arc-20160816; b=O/nRfcMMhwiwBIvkQ5IWNEdzk/FFkUcf+UL4WE67uQPwRVo7QtKtl6Tu+HSHAG5OYo PwhEPOA3et08XSn8EDvTv073zYGRVDIoHBRMQTH9JlGYdDgnOC/SKNHXbRfl9PEHKxQ+ OHBSn5OkhlGFmCzG2LJU1G1GjfwC34E6qNeYqXwoLYlhTis7t4EsYVxwOlT5Fd6KkZgh 74CE5qC7H5lSXD+ZbXq71J2bpAcYYyz3B04k+U7iNd7nJuJTxIFOgj2qCzQyxBslv4p6 BoxgfRE7lWMHWc5NaiMcXax5yTdLg40Q/BWw6Jd4l3TEugY9Qr+1LkD+bx1hUoTuR0DG CrJQ== 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=TDW4OcLGxzMMVeWfYMobM2j1l23b1knTFgb2JnlqsUs=; b=N54kKca9biisa1SKtdTGiCMF5Ozzl7WXprjiRoEVanRvjbKuANokCRXJcDfJorugQK up2HxdbckR2fqneb1keyt3UY2qtLC+wVfCkIAk22of/fFAz3clj6dM3Xts5BM4y9wNqa qyPc5E0kuKX3vg7t6yXXGqRxIU7f9EcxjjF5UOpXMDUhSpdhLmnFNabV+9YlGOFCV1/o FVpW4K1FNSN2j3Dt6zu/S9TWXosWiP+LQpfZN1bWb4ats0j214litNqarWYvcaLzc7eA 7CBuOHoO2ZbKAc87iJZh9Lq91PPpgJPpHRV4uhozQE6KYMp3gFiB2A0dxBc+AMtt+4pE UV1A== 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 8si22695971ejn.389.2021.10.12.22.45.49; Tue, 12 Oct 2021 22:46:14 -0700 (PDT) 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 S237566AbhJMFoH (ORCPT + 99 others); Wed, 13 Oct 2021 01:44:07 -0400 Received: from inva021.nxp.com ([92.121.34.21]:47818 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbhJMFoG (ORCPT ); Wed, 13 Oct 2021 01:44:06 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 63B2A201FB5; Wed, 13 Oct 2021 07:42:02 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id DD68F202737; Wed, 13 Oct 2021 07:42:01 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id AE35B183ACDD; Wed, 13 Oct 2021 13:42:00 +0800 (+08) From: Shengjiu Wang To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, ckeepax@opensource.cirrus.com, kuninori.morimoto.gx@renesas.com, patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ASoC: wm8960: Fix clock configuration on slave mode Date: Wed, 13 Oct 2021 13:17:04 +0800 Message-Id: <1634102224-3922-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 There is a noise issue for 8kHz sample rate on slave mode. Compared with master mode, the difference is the DACDIV setting, after correcting the DACDIV, the noise is gone. There is no noise issue for 48kHz sample rate, because the default value of DACDIV is correct for 48kHz. So wm8960_configure_clocking() should be functional for ADC and DAC function even if it is slave mode. In order to be compatible for old use case, just add condition for checking that sysclk is zero with slave mode. Fixes: 0e50b51aa22f ("ASoC: wm8960: Let wm8960 driver configure its bit clock and frame clock") Signed-off-by: Shengjiu Wang --- changes in v2: - change error message to warning - add more comments sound/soc/codecs/wm8960.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 9e621a254392..499604f1e178 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -742,9 +742,16 @@ static int wm8960_configure_clocking(struct snd_soc_component *component) int i, j, k; int ret; - if (!(iface1 & (1<<6))) { - dev_dbg(component->dev, - "Codec is slave mode, no need to configure clock\n"); + /* + * For Slave mode clocking should still be configured, + * so this if statement should be removed, but some platform + * may not work if the sysclk is not configured, to avoid such + * compatible issue, just add '!wm8960->sysclk' condition in + * this if statement. + */ + if (!(iface1 & (1 << 6)) && !wm8960->sysclk) { + dev_warn(component->dev, + "slave mode, but proceeding with no clock configuration\n"); return 0; } -- 2.17.1