From patchwork Thu Feb 9 03:12:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 93661 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp56659qgi; Wed, 8 Feb 2017 19:13:36 -0800 (PST) X-Received: by 10.98.50.66 with SMTP id y63mr1108410pfy.21.1486610016407; Wed, 08 Feb 2017 19:13:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si8800394pga.393.2017.02.08.19.13.36; Wed, 08 Feb 2017 19:13:36 -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 S1750968AbdBIDNe (ORCPT + 7 others); Wed, 8 Feb 2017 22:13:34 -0500 Received: from mail-pg0-f42.google.com ([74.125.83.42]:34864 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751025AbdBIDNd (ORCPT ); Wed, 8 Feb 2017 22:13:33 -0500 Received: by mail-pg0-f42.google.com with SMTP id 194so53500593pgd.2 for ; Wed, 08 Feb 2017 19:13:32 -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; bh=NYPBap0Pb5hBccxoAoQ2KJvjNRZ5UscbzJlGOG5pi8E=; b=C1BM67AqZJPYKT/aKr4hUlIwN2LKMLgPAvYJlhaVs03IBEUJDFgBjWAVGvNBixKSGw QnaGiDvT3PKybDXCSck50CvPdz61Rtx6fRvXTO1UMJVwC/3YhqYdAYL0oeA0zdoFMAvL aw7/t4+OO0VuwLj81Nm74PrHS3tPUVYJbxW0w= 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; bh=NYPBap0Pb5hBccxoAoQ2KJvjNRZ5UscbzJlGOG5pi8E=; b=ctJz03q+3cCkrCCTfJyFB0V3QLigXzsjm3b9aAVT8eeMXwn0OmUV8YuNAX/dLaxPfU qK9Wgge2pEtvKMXGeH1sNO8l8Iu+EwQoQpfsvZq9H8qFyu7ex3S+q0cVz43Vw4d0lvFi K9l+4OZCS+Gaj8MHeOP9gKhrNimt3Jy86LKRlJ8NiZinNyU1NQu9PC6p545m6ofTI1vz GFQRsX4M/w7BsIh97tc6GNkZvC8S1UtKRlvrOi9aBIL4uehtIlysBs2KOJXQJBcYIWvm CPMmXOkhTKS1mo3PkZ7lpSAbL6GKloPhAh52EzocNL1Bq+uN96EC37onlIy2xrFPNqAu 8MzQ== X-Gm-Message-State: AMke39nJ7ZBgKix0oyeCjhKUEDVc5bGf4nzXDRzQ9oHgu2/SIpIBC3+qwaKdtZsLIFlnlWsV X-Received: by 10.84.197.3 with SMTP id m3mr1182805pld.89.1486610012281; Wed, 08 Feb 2017 19:13:32 -0800 (PST) Received: from localhost.localdomain ([104.237.91.118]) by smtp.gmail.com with ESMTPSA id c74sm23767201pfc.1.2017.02.08.19.13.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Feb 2017 19:13:31 -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 1/3] clk: zte: add i2s clocks for zx296718 Date: Thu, 9 Feb 2017 11:12:56 +0800 Message-Id: <1486609978-18482-1-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The i2s related clock support is missing from the existing zx296718 clock driver. This patch adds it, so that the upstream ZX I2S driver can work out. Signed-off-by: Baoyou Xie --- drivers/clk/zte/clk-zx296718.c | 4 ++++ 1 file changed, 4 insertions(+) -- 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/drivers/clk/zte/clk-zx296718.c b/drivers/clk/zte/clk-zx296718.c index ad5d1df..2f7c668 100644 --- a/drivers/clk/zte/clk-zx296718.c +++ b/drivers/clk/zte/clk-zx296718.c @@ -936,6 +936,10 @@ static struct zx_clk_gate audio_gate_clk[] = { GATE(AUDIO_I2S1_WCLK, "i2s1_wclk", "i2s1_wclk_div", AUDIO_I2S1_CLK, 9, CLK_SET_RATE_PARENT, 0), GATE(AUDIO_I2S2_WCLK, "i2s2_wclk", "i2s2_wclk_div", AUDIO_I2S2_CLK, 9, CLK_SET_RATE_PARENT, 0), GATE(AUDIO_I2S3_WCLK, "i2s3_wclk", "i2s3_wclk_div", AUDIO_I2S3_CLK, 9, CLK_SET_RATE_PARENT, 0), + GATE(AUDIO_I2S0_PCLK, "i2s0_pclk", "clk49m5", AUDIO_I2S0_CLK, 8, 0, 0), + GATE(AUDIO_I2S1_PCLK, "i2s1_pclk", "clk49m5", AUDIO_I2S1_CLK, 8, 0, 0), + GATE(AUDIO_I2S2_PCLK, "i2s2_pclk", "clk49m5", AUDIO_I2S2_CLK, 8, 0, 0), + GATE(AUDIO_I2S3_PCLK, "i2s3_pclk", "clk49m5", AUDIO_I2S3_CLK, 8, 0, 0), GATE(AUDIO_I2C0_WCLK, "i2c0_wclk", "i2c0_wclk_mux", AUDIO_I2C0_CLK, 9, CLK_SET_RATE_PARENT, 0), GATE(AUDIO_SPDIF0_WCLK, "spdif0_wclk", "spdif0_wclk_div", AUDIO_SPDIF0_CLK, 9, CLK_SET_RATE_PARENT, 0), GATE(AUDIO_SPDIF1_WCLK, "spdif1_wclk", "spdif1_wclk_div", AUDIO_SPDIF1_CLK, 9, CLK_SET_RATE_PARENT, 0), 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);