From patchwork Tue Sep 16 11:46:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 4917681 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CB65DBEEA5 for ; Tue, 16 Sep 2014 12:19:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D1EE20121 for ; Tue, 16 Sep 2014 12:19:29 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DF6FD200F0 for ; Tue, 16 Sep 2014 12:19:26 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EE59C26533B; Tue, 16 Sep 2014 14:19:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 8548B261A5E; Tue, 16 Sep 2014 14:06:19 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E8372261A40; Tue, 16 Sep 2014 14:06:15 +0200 (CEST) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0118.outbound.protection.outlook.com [157.56.111.118]) by alsa0.perex.cz (Postfix) with ESMTP id B6553261A5E for ; Tue, 16 Sep 2014 13:46:58 +0200 (CEST) Received: from DM2PR03CA0029.namprd03.prod.outlook.com (10.141.96.28) by BN1PR0301MB0611.namprd03.prod.outlook.com (25.160.170.26) with Microsoft SMTP Server (TLS) id 15.0.1029.13; Tue, 16 Sep 2014 11:46:56 +0000 Received: from BN1AFFO11FD011.protection.gbl (2a01:111:f400:7c10::159) by DM2PR03CA0029.outlook.office365.com (2a01:111:e400:2428::28) with Microsoft SMTP Server (TLS) id 15.0.1024.12 via Frontend Transport; Tue, 16 Sep 2014 11:46:55 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD011.mail.protection.outlook.com (10.58.52.71) with Microsoft SMTP Server (TLS) id 15.0.1019.14 via Frontend Transport; Tue, 16 Sep 2014 11:46:55 +0000 Received: from audiosh1.ap.freescale.net (audiosh1.ap.freescale.net [10.192.241.205]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s8GBkkd9022140; Tue, 16 Sep 2014 04:46:50 -0700 From: Shengjiu Wang To: , , , , , , Date: Tue, 16 Sep 2014 19:46:34 +0800 Message-ID: <1410867994-32138-1-git-send-email-shengjiu.wang@freescale.com> X-Mailer: git-send-email 1.7.9.5 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(84676001)(48376002)(6806004)(33646002)(68736004)(93916002)(90102001)(104166001)(4396001)(87936001)(104016003)(77982003)(79102003)(19580395003)(2201001)(81342003)(64706001)(80022003)(21056001)(74502003)(74662003)(77156001)(46102003)(47776003)(81542003)(44976005)(105606002)(76482001)(50986999)(31966008)(106466001)(85852003)(20776003)(95666004)(88136002)(83322001)(85306004)(97736003)(102836001)(36756003)(26826002)(92566001)(62966002)(99396002)(107046002)(87286001)(83072002)(86362001)(19580405001)(50466002)(92726001)(50226001)(89996001)(229853001)(2101003); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR0301MB0611; H:tx30smr01.am.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 03361FCC43 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=shengjiu.wang@freescale.com; X-OriginatorOrg: freescale.com Cc: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: fsl_spdif: don't change the root clock rate of spdif in driver X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The spdif root clock may be used by other module or defined with CLK_SET_RATE_GATE, so we can't change the clock rate in driver. In this patch remove the clk_set_rate and clk_round_rate to protect the clock. Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_spdif.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 70acfe4..f2e4595 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -377,7 +377,6 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream, unsigned long csfs = 0; u32 stc, mask, rate; u8 clk, txclk_df, sysclk_df; - int ret; switch (sample_rate) { case 32000: @@ -419,21 +418,6 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream, sysclk_df = spdif_priv->sysclk_df[rate]; - /* Don't mess up the clocks from other modules */ - if (clk != STC_TXCLK_SPDIF_ROOT) - goto clk_set_bypass; - - /* - * The S/PDIF block needs a clock of 64 * fs * txclk_df. - * So request 64 * fs * (txclk_df + 1) to get rounded. - */ - ret = clk_set_rate(spdif_priv->txclk[rate], 64 * sample_rate * (txclk_df + 1)); - if (ret) { - dev_err(&pdev->dev, "failed to set tx clock rate\n"); - return ret; - } - -clk_set_bypass: dev_dbg(&pdev->dev, "expected clock rate = %d\n", (64 * sample_rate * txclk_df * sysclk_df)); dev_dbg(&pdev->dev, "actual clock rate = %ld\n", @@ -1056,7 +1040,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, { const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; bool is_sysclk = clk == spdif_priv->sysclk; - u64 rate_ideal, rate_actual, sub; + u64 rate_actual, sub; u32 sysclk_dfmin, sysclk_dfmax; u32 txclk_df, sysclk_df, arate; @@ -1066,11 +1050,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, for (sysclk_df = sysclk_dfmin; sysclk_df <= sysclk_dfmax; sysclk_df++) { for (txclk_df = 1; txclk_df <= 128; txclk_df++) { - rate_ideal = rate[index] * (txclk_df + 1) * 64; - if (round) - rate_actual = clk_round_rate(clk, rate_ideal); - else - rate_actual = clk_get_rate(clk); + rate_actual = clk_get_rate(clk); arate = rate_actual / 64; arate /= txclk_df * sysclk_df;