From patchwork Wed Feb 8 03:02:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 93602 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2491771qgi; Tue, 7 Feb 2017 19:04:50 -0800 (PST) X-Received: by 10.223.129.163 with SMTP id 32mr15823885wra.140.1486523090250; Tue, 07 Feb 2017 19:04:50 -0800 (PST) Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id o52si7452424wrb.67.2017.02.07.19.04.49; Tue, 07 Feb 2017 19:04:50 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B1980267121; Wed, 8 Feb 2017 04:04:43 +0100 (CET) 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 7662826717B; Wed, 8 Feb 2017 04:04:42 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: * X-Spam-Status: No, score=1.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HK_RANDOM_ENVFROM,HK_RANDOM_FROM autolearn=disabled version=3.4.0 Received: from mail-pg0-f52.google.com (mail-pg0-f52.google.com [74.125.83.52]) by alsa0.perex.cz (Postfix) with ESMTP id 3751B266D90 for ; Wed, 8 Feb 2017 04:04:21 +0100 (CET) Received: by mail-pg0-f52.google.com with SMTP id 204so44332012pge.0 for ; Tue, 07 Feb 2017 19:04:21 -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=xCcDmwOWyd9U8EbUcH10/Z9kYv6zbmoEG9EAXs0/1sw=; b=EBBeI6hEa++3oUPf406UjRDEMr8gWbkYU+hWMUeu2ysUMOCG8KHdE6L4FNLj/t/pDt S1VPAxq74uhi2obstkpB6EN091LWsc9dw+7EV8R46zWhonxes92XhUKbGVkOWW2XYH2L pr3lLjUQ8R3mdk9rDog9vqTeqSmwQIcZ49uHE= 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=xCcDmwOWyd9U8EbUcH10/Z9kYv6zbmoEG9EAXs0/1sw=; b=ldA1nPcYiYMGmJj7SlBdUqKFnzaUkBSK6RTTELBDz5EWv2hjfl5kB7k7z37FB0l7w6 Mf6H4OBf9bM0KXFpg0r1e6LfSD9xe2dQH6LUNOgxug4eJbQmF2H8k6fVYAShRyFz2BDU RFwe/S+dP2/DnqRfet7tuWSBYW8O9bl2N3VlbEBq4rMZU8h/fHAoxbFRk6+HzxFaaoa1 BV50IANUjQPURAj43COnwKSq+YT8rclGc8FW3PnStvyjcbhkZAz//nsFYTCw8RPXaM8d hxzSyXkKZY4/d0Zp4QX75zSiANPqSUCmH0pDTmqwVblJjXPkG6a1vXg+GxUtDj0tUO/j i4LQ== X-Gm-Message-State: AIkVDXL+eQLaOVU4K6d3+bmfmnel8wWyZR57Cy1oTP8O31x1HAvhj568W12Hv4KENczdR/93 X-Received: by 10.98.81.6 with SMTP id f6mr23476743pfb.180.1486523060917; Tue, 07 Feb 2017 19:04:20 -0800 (PST) Received: from localhost.localdomain ([45.56.152.31]) by smtp.gmail.com with ESMTPSA id j78sm14837374pfk.39.2017.02.07.19.04.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Feb 2017 19:04:20 -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 Date: Wed, 8 Feb 2017 11:02:35 +0800 Message-Id: <1486522955-14528-3-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486522955-14528-1-git-send-email-baoyou.xie@linaro.org> References: <1486522955-14528-1-git-send-email-baoyou.xie@linaro.org> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, mathieu.poirier@linaro.org, xie.baoyou@zte.com.cn, linux-kernel@vger.kernel.org, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn, shawnguo@kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v3 3/3] ASoC: zx-i2s: introduce pclk for zx2967 family 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.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 | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) -- 2.7.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/zte/zx-i2s.c b/sound/soc/zte/zx-i2s.c index ed7a56d..2d486ea 100644 --- a/sound/soc/zte/zx-i2s.c +++ b/sound/soc/zte/zx-i2s.c @@ -95,7 +95,7 @@ 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, *dai_pclk; void __iomem *reg_base; int master; resource_size_t mapbase; @@ -275,8 +275,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 +329,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 +349,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 +394,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_info(&pdev->dev, "have no pclk\n"); + zx_i2s->dai_pclk = NULL; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0);