Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1162491pxa; Thu, 6 Aug 2020 00:47:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaCA0e4iovJPpz1dvRnLTDehQ1ShMHCWC7wM33Qlww/BfeLLYdu6vWWs8QlAfESl9d2nNV X-Received: by 2002:a17:907:42cd:: with SMTP id nz21mr3119552ejb.395.1596700046301; Thu, 06 Aug 2020 00:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596700046; cv=none; d=google.com; s=arc-20160816; b=B4pX2YjVCo7KUqCbpgbByuqx+CYMHl6bZkkzLAdTI9k7hWdxQSz45QghHKQwA/V9bY N6c6UjDVT6qNYawdCWDyJenChByUcCJ/mzzL07gnhD/g226zW2IUH8TC3THxpIxJcFyf wePe8b+s/MeUVpT13wgNW5bZvCdtahtjn9JsS4K0tndw9tts9HjTI0M9I2Kb6y7f41UE Oq5DCOpfW9WFZ4GgdHwRACn/5Y0hV/41/RMxu7b0a5kjgkfmEspwrB2ZH6toPeGRXb7N CMMPmAVWJYsLfTIvsLSNUNxX0nS8E6JWv0aQLCevQNy47iJ1tqO6n9Bmgu3Lc7T9sCcm Wljw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=Q1yDtDF2s5uI7t0T8kygcThHsH0cG3qJGTaPsgI7qxE=; b=EgUylCtSKRsL17hMui7mmBoR68uKTeKgdx2mQZVdZT0I1ROXCofP8w97xvzlaNFybN OAzT5AlZeCbQX+6t1O14t7VnG2v+AlJk4oKK53GiF6DavhQ+kIlQGyrFqKa9uR0Un/0S fZ1NPNCpGujrS0nnDkOJZMwiB4wpeODYBmQFUljX6fpqf0t8j7aKFNCFqPFncU+CbTBr C2pHk8BfQVh4H2KJO9awVsGgdf9oy1qDFavrIRayx1JnbOjQvjeAVY0E+QxjvugYStP6 LAv35G2J9iTwe1T5JeifdV/AeazqVpN3AYhFJ52KMPlslB51ixtPaForHAXVd8PQu2Wm IK/w== 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 8si2987565ejx.645.2020.08.06.00.47.03; Thu, 06 Aug 2020 00:47:26 -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 S1728428AbgHFHob (ORCPT + 99 others); Thu, 6 Aug 2020 03:44:31 -0400 Received: from inva020.nxp.com ([92.121.34.13]:36600 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726799AbgHFHob (ORCPT ); Thu, 6 Aug 2020 03:44:31 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7FCC41A08EB; Thu, 6 Aug 2020 09:44:29 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id CB7F81A0901; Thu, 6 Aug 2020 09:44:24 +0200 (CEST) Received: from 10.192.242.69 (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id D574D402D0; Thu, 6 Aug 2020 09:44:18 +0200 (CEST) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@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: Get "extal" clock rate by clk_get_rate Date: Thu, 6 Aug 2020 15:39:45 +0800 Message-Id: <1596699585-27429-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On some platform(.e.g. i.MX8QM MEK), the "extal" clock is different with the mclk of codec, then the clock rate is also different. So it is better to get clock rate of "extal" rate by clk_get_rate, don't reuse the clock rate of mclk. Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl-asoc-card.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 52adedc03245..2c92a5efad61 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -696,6 +696,13 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) goto asrc_fail; } } else if (of_node_name_eq(cpu_np, "esai")) { + struct clk *esai_clk = clk_get(&cpu_pdev->dev, "extal"); + + if (!IS_ERR(esai_clk)) { + priv->cpu_priv.sysclk_freq[TX] = clk_get_rate(esai_clk); + priv->cpu_priv.sysclk_freq[RX] = clk_get_rate(esai_clk); + clk_put(esai_clk); + } priv->cpu_priv.sysclk_id[1] = ESAI_HCKT_EXTAL; priv->cpu_priv.sysclk_id[0] = ESAI_HCKR_EXTAL; } else if (of_node_name_eq(cpu_np, "sai")) { -- 2.27.0