Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1230911rdb; Wed, 20 Sep 2023 03:35:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGOCGy17f+l5G1Ayumqs9cF/DNneynj7z5V/P7qtZ/PnYeXpj/6am8OKBotbDueNVAlE69z X-Received: by 2002:a17:902:db09:b0:1c4:4a4d:cc6 with SMTP id m9-20020a170902db0900b001c44a4d0cc6mr7359954plx.19.1695206133908; Wed, 20 Sep 2023 03:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695206133; cv=none; d=google.com; s=arc-20160816; b=da2+oxLjJ5LoIhixaE3bKBjH1HU7GyP7IZrXjCAK2PODxZw7P4AsvgS76mcxAy09W2 TfH7Q+WFp29ZhX1VOmwpfpRMxCztwMEqHZojH4biP1Rn7xJcUQlM+k2GQzAK6ihlmrHI g9B4xPaRbamqz8y/959O73npHBJ7pPbso8s2YoJdd1DAStd4ewUv9CF8/zMtgBnXA6vB mJamey9QFYtwqXGHEP6V3Z+f38ipAhPDB54DqUQgGQEAaMRlRbl/IrnWlqAfg/5/xAbJ HNl74rsDKbBQXmfuorNAZQ6dm8n/UhaupzoUs6tbkoG42sAgnpv97U4M/XJxu0WPMARc s5/A== 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=8RHwmLPYI1amW4OwHgo6td0pR8ibwBmJ6MtmvkqBZzQ=; fh=ej+ES4Dwh1V08gn2d72DvDWSU19D6ZzjsW9Imw8Zke8=; b=BRw5/SINe2cPyWkrxBCW0Vtf/MWW2Ag51Ymcqx5qpEC8R1xfc6UqXH9JNiDaPvjyAj fpc+bHvjjAdPkW46OAjwqvIt6iR7QSFshlAZ69o2cgv0b5+PvgdGx64TO85Jk0G4B52q 3zB7IiU5ChLW2vC57+Gw6VDpHjSgL4FUItu38nipl+tN2QwXkPJ8XTfItyj5kUkrBNbb /ND2zC7iOqDWt30cXg9UtXzRgTmlGK4I4bjI2+SRE0cTDuTAFRo4/RSnv87u7NDCLY8D PjMtAs0Z9kG4pnh8uUrf0+wgUNRxSk5PfkgivXPAlIuYezDtI4Ad8WdKSy5WrhpLSYV+ 6+eQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id m16-20020a63fd50000000b00563fac86c55si8957131pgj.134.2023.09.20.03.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 03:35:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 1E1EA82696F1; Wed, 20 Sep 2023 03:20:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234216AbjITKUJ (ORCPT + 99 others); Wed, 20 Sep 2023 06:20:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233950AbjITKUG (ORCPT ); Wed, 20 Sep 2023 06:20:06 -0400 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A673AC for ; Wed, 20 Sep 2023 03:20:00 -0700 (PDT) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A38AD200B1D; Wed, 20 Sep 2023 12:19:58 +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 6AF6E200B27; Wed, 20 Sep 2023 12:19:58 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id E88891802200; Wed, 20 Sep 2023 18:19:56 +0800 (+08) From: Shengjiu Wang To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: fsl-asoc-card: use integer type for fll_id and pll_id Date: Wed, 20 Sep 2023 17:43:12 +0800 Message-Id: <1695202992-24864-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 20 Sep 2023 03:20:13 -0700 (PDT) As the pll_id and pll_id can be zero (WM8960_SYSCLK_AUTO) with the commit 2bbc2df46e67 ("ASoC: wm8960: Make automatic the default clocking mode") Then the machine driver will skip to call set_sysclk() and set_pll() for codec, when the sysclk rate is different with what wm8960 read at probe, the output sound frequency is wrong. So change the fll_id and pll_id initial value, still keep machine driver's behavior same as before. Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl-asoc-card.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 76b5bfc288fd..bab7d34cf585 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -52,8 +52,8 @@ struct codec_priv { unsigned long mclk_freq; unsigned long free_freq; u32 mclk_id; - u32 fll_id; - u32 pll_id; + int fll_id; + int pll_id; }; /** @@ -206,7 +206,7 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream, } /* Specific configuration for PLL */ - if (codec_priv->pll_id && codec_priv->fll_id) { + if (codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE) pll_out = priv->sample_rate * 384; else @@ -248,7 +248,7 @@ static int fsl_asoc_card_hw_free(struct snd_pcm_substream *substream) priv->streams &= ~BIT(substream->stream); - if (!priv->streams && codec_priv->pll_id && codec_priv->fll_id) { + if (!priv->streams && codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { /* Force freq to be free_freq to avoid error message in codec */ ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0), codec_priv->mclk_id, @@ -621,6 +621,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->card.dapm_routes = audio_map; priv->card.num_dapm_routes = ARRAY_SIZE(audio_map); priv->card.driver_name = DRIVER_NAME; + + priv->codec_priv.fll_id = -1; + priv->codec_priv.pll_id = -1; + /* Diversify the card configurations */ if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) { codec_dai_name = "cs42888"; -- 2.34.1