From patchwork Thu Feb 9 03:12:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 93663 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp56752qgi; Wed, 8 Feb 2017 19:13:57 -0800 (PST) X-Received: by 10.84.225.148 with SMTP id u20mr1192494plj.93.1486610037698; Wed, 08 Feb 2017 19:13:57 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v124si8815610pfb.230.2017.02.08.19.13.57; Wed, 08 Feb 2017 19:13:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751601AbdBIDNz (ORCPT + 7 others); Wed, 8 Feb 2017 22:13:55 -0500 Received: from mail-pf0-f174.google.com ([209.85.192.174]:36195 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbdBIDNx (ORCPT ); Wed, 8 Feb 2017 22:13:53 -0500 Received: by mail-pf0-f174.google.com with SMTP id 189so46416714pfu.3 for ; Wed, 08 Feb 2017 19:13:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3kykv4ZJ0eTmGj31OAndn2ptFgeQ0jsTLvYkb6C68Fo=; b=SSRvYL9mugj2dbcV3bWkCbWjx+2OSgMRCZIW6fUvmwVjr7XBezEShBdGhYdlgnBSWd klqG6c//Q1QWYZwjxXjl14UmKHgAmHfYMKFCTmIcjTXU6tIflpYvOswVGVWgKItPL1Fb uCHGdPs8FbVKMhr2njWY8pWE+sC/yf1JCsGx0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3kykv4ZJ0eTmGj31OAndn2ptFgeQ0jsTLvYkb6C68Fo=; b=ND0fVuVsNab3FP4XudOKbGN/OO3XH1aByTPM/Rxr99IQIYoaPJSteCms5bPg1b9PYc Az6ho3vxEyIboIyAsrBoXnvyXk3yM4YFcl7PzhfQmC6mXfhp3/1e2AN31YBtmd2/xchD s78lzVNO5UtxoBhntVWi4EVkmxlFsGnRpBFPfMYa6EJ72SSk53fR6dv35Ud6tKsUYJ7y 3R/SRBqzHXDE8rJqGLAiL6aGsy/z6s2abu8elgD/VJsPIMd4A5q49VkKnw/6Y35L7kZT 401I5zCwaiGRSt67uDywgtxlZAd78rM4UM1f8PiaMR2NXSGViiI5YCOyRU3zo2N4zWfu TaAQ== X-Gm-Message-State: AMke39nais0ZqkHNpNcfyrs0G2P6AfNuKzC+9KCrXb01JjtzMaVigbwgOt9mIxLtGz5yEkZV X-Received: by 10.98.34.82 with SMTP id i79mr1115954pfi.120.1486610032913; Wed, 08 Feb 2017 19:13:52 -0800 (PST) Received: from localhost.localdomain ([104.237.91.118]) by smtp.gmail.com with ESMTPSA id c74sm23767201pfc.1.2017.02.08.19.13.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Feb 2017 19:13:52 -0800 (PST) From: Baoyou Xie To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, jun.nie@linaro.org, baoyou.xie@linaro.org, mturquette@baylibre.com, sboyd@codeaurora.org, perex@perex.cz, tiwai@suse.com, shawn.guo@linaro.org, vinod.koul@intel.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, shawnguo@kernel.org, mathieu.poirier@linaro.org, xie.baoyou@zte.com.cn, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn Subject: [PATCH v4 3/3] ASoC: zx-i2s: introduce pclk for zx2967 family Date: Thu, 9 Feb 2017 11:12:58 +0800 Message-Id: <1486609978-18482-3-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486609978-18482-1-git-send-email-baoyou.xie@linaro.org> References: <1486609978-18482-1-git-send-email-baoyou.xie@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The pclk is necessary for zx2967 I2S controller. the driver currently doesn't handle it. This is something we need to fix. In turn, the driver supports zx296718's I2S controller. By the way, this patch also change the clock name from tx to wclk to make it clear. Signed-off-by: Baoyou Xie --- sound/soc/zte/zx-i2s.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/sound/soc/zte/zx-i2s.c b/sound/soc/zte/zx-i2s.c index ed7a56d..a865f37 100644 --- a/sound/soc/zte/zx-i2s.c +++ b/sound/soc/zte/zx-i2s.c @@ -95,7 +95,8 @@ struct zx_i2s_info { struct snd_dmaengine_dai_dma_data dma_playback; struct snd_dmaengine_dai_dma_data dma_capture; - struct clk *dai_clk; + struct clk *dai_wclk; + struct clk *dai_pclk; void __iomem *reg_base; int master; resource_size_t mapbase; @@ -275,8 +276,9 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream, writel_relaxed(val, i2s->reg_base + ZX_I2S_TIMING_CTRL); if (i2s->master) - ret = clk_set_rate(i2s->dai_clk, - params_rate(params) * ch_num * CLK_RAT); + ret = clk_set_rate(i2s->dai_wclk, + params_rate(params) * ch_num * CLK_RAT); + return ret; } @@ -328,8 +330,19 @@ static int zx_i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev); + int ret; + + ret = clk_prepare_enable(zx_i2s->dai_wclk); + if (ret) + return ret; + + ret = clk_prepare_enable(zx_i2s->dai_pclk); + if (ret) { + clk_disable_unprepare(zx_i2s->dai_wclk); + return ret; + } - return clk_prepare_enable(zx_i2s->dai_clk); + return ret; } static void zx_i2s_shutdown(struct snd_pcm_substream *substream, @@ -337,7 +350,8 @@ static void zx_i2s_shutdown(struct snd_pcm_substream *substream, { struct zx_i2s_info *zx_i2s = dev_get_drvdata(dai->dev); - clk_disable_unprepare(zx_i2s->dai_clk); + clk_disable_unprepare(zx_i2s->dai_wclk); + clk_disable_unprepare(zx_i2s->dai_pclk); } static struct snd_soc_dai_ops zx_i2s_dai_ops = { @@ -381,10 +395,16 @@ static int zx_i2s_probe(struct platform_device *pdev) if (!zx_i2s) return -ENOMEM; - zx_i2s->dai_clk = devm_clk_get(&pdev->dev, "tx"); - if (IS_ERR(zx_i2s->dai_clk)) { - dev_err(&pdev->dev, "Fail to get clk\n"); - return PTR_ERR(zx_i2s->dai_clk); + zx_i2s->dai_wclk = devm_clk_get(&pdev->dev, "wclk"); + if (IS_ERR(zx_i2s->dai_wclk)) { + dev_err(&pdev->dev, "Fail to get wclk\n"); + return PTR_ERR(zx_i2s->dai_wclk); + } + + zx_i2s->dai_pclk = devm_clk_get(&pdev->dev, "pclk"); + if (IS_ERR(zx_i2s->dai_pclk)) { + dev_err(&pdev->dev, "Fail to get pclk\n"); + return PTR_ERR(zx_i2s->dai_pclk); } res = platform_get_resource(pdev, IORESOURCE_MEM, 0);