From patchwork Tue Feb 7 03:02:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 93500 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2006219qgi; Mon, 6 Feb 2017 19:03:28 -0800 (PST) X-Received: by 10.98.33.131 with SMTP id o3mr17067787pfj.86.1486436608707; Mon, 06 Feb 2017 19:03:28 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8si2620746plk.48.2017.02.06.19.03.28; Mon, 06 Feb 2017 19:03:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752729AbdBGDD0 (ORCPT + 25 others); Mon, 6 Feb 2017 22:03:26 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:34995 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752172AbdBGDDW (ORCPT ); Mon, 6 Feb 2017 22:03:22 -0500 Received: by mail-pf0-f178.google.com with SMTP id f144so28948199pfa.2 for ; Mon, 06 Feb 2017 19:03:22 -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=xEPYh6F54E8L79O+qL6tn6ZDUJIoB74Pb2SXSQ/sRv4=; b=Re7FXYgn12vagivSxeiS/hxtyANN1kreEX0TwjB3o0Y5vdAlqjU9YGAtVUV3UT0hji wFtkJ6smjKPet7LLj763r7/0pj/xxnNPKn6IFYLI7Dv7BOIbTsOeKEdzu9K5eZuG0s1A RYkzxYC/nQL0sALrzhaGOpO1g4WdmzYU3nLIA= 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=xEPYh6F54E8L79O+qL6tn6ZDUJIoB74Pb2SXSQ/sRv4=; b=rPnP5X5t08WJIQP94YY62NJnauYSfxQrYQEdDVQ78UhGIsWNx3BUqn1ewCwY3+yZxb 0t+ZW1Sh8M1YtigDex545pQ6Yb1+mSY7/0jzkgXFfg1eJXORyZoFNnw+DupxenHvf+0b x0ghWUs9nvUNccLSkX5rxSyuTiCVT63MeDl0UwFnBMsx3FRu0qJdcIJbplmcSti/jCGM 1D8E6XCR7xpTO0zhDVIHupdsJcZv6rrVvlwfrJFjxEVqMxkzcxmBJJ4Gd6hbwj6CJl4q BhAMmzQ9TOf3RNVGtEpEBTp0x8U//RcTT2KwYbnud8CiUM9LhosSYkG4pYFxusVQwCi2 iwig== X-Gm-Message-State: AIkVDXLKxEL7nBuZIfbZjmBz6eVlaGvTDDOb80o4L2NaYRabFlZ/BXlncPEdUhg1kSvMpyuk X-Received: by 10.84.231.140 with SMTP id g12mr22151108plk.76.1486436601831; Mon, 06 Feb 2017 19:03:21 -0800 (PST) Received: from localhost.localdomain ([45.56.152.31]) by smtp.gmail.com with ESMTPSA id k76sm5898563pfg.42.2017.02.06.19.03.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Feb 2017 19:03:21 -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, xie.baoyou@zte.com.cn, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn Subject: [PATCH v2 1/3] clk: zte: add i2s clocks for zx296718 Date: Tue, 7 Feb 2017 11:02:49 +0800 Message-Id: <1486436571-8682-1-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 diff --git a/drivers/clk/zte/clk-zx296718.c b/drivers/clk/zte/clk-zx296718.c index ad5d1df..f106d40 100644 --- a/drivers/clk/zte/clk-zx296718.c +++ b/drivers/clk/zte/clk-zx296718.c @@ -941,6 +941,10 @@ static struct zx_clk_gate audio_gate_clk[] = { GATE(AUDIO_SPDIF1_WCLK, "spdif1_wclk", "spdif1_wclk_div", AUDIO_SPDIF1_CLK, 9, CLK_SET_RATE_PARENT, 0), GATE(AUDIO_TDM_WCLK, "tdm_wclk", "tdm_wclk_div", AUDIO_TDM_CLK, 17, CLK_SET_RATE_PARENT, 0), GATE(AUDIO_TS_PCLK, "tempsensor_pclk", "clk49m5", AUDIO_TS_CLK, 1, 0, 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), }; static struct clk_hw_onecell_data audio_hw_onecell_data = { From patchwork Tue Feb 7 03:02:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 93502 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2006425qgi; Mon, 6 Feb 2017 19:04:02 -0800 (PST) X-Received: by 10.84.136.34 with SMTP id 31mr22365550plk.52.1486436642242; Mon, 06 Feb 2017 19:04:02 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a29si2602496pfh.158.2017.02.06.19.04.01; Mon, 06 Feb 2017 19:04:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752899AbdBGDEA (ORCPT + 25 others); Mon, 6 Feb 2017 22:04:00 -0500 Received: from mail-pg0-f44.google.com ([74.125.83.44]:34359 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752864AbdBGDDz (ORCPT ); Mon, 6 Feb 2017 22:03:55 -0500 Received: by mail-pg0-f44.google.com with SMTP id 14so34070204pgg.1 for ; Mon, 06 Feb 2017 19:03:49 -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=3FNjxO+bJhRO4M77bl4TnnJMWdzr2D8rV6YifrS7Ysc=; b=hyn+TiLSi7weynItpwqwRBW75EF4zflhFZ34yDotWpDs8znYWOMukNKNFJCdBgV3PL 6j8MhJwKErm5MuDctSy8Yhp2B77CqDrPBpAkfDWWaqIC6VgB2smeCCrT00GltwiRkwd+ CiYU1Om824jlXK8MD+qo7aUpaoGPeLrpa3b70= 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=3FNjxO+bJhRO4M77bl4TnnJMWdzr2D8rV6YifrS7Ysc=; b=IpltY9+PoVA36y+lPZ1nMKNOAgDrB1/lEwxv/FRFnH9nC//TE/LaWCMoJ4MlTvqYIl 4Z3pPRMJ1MZm9ao+L/p4YxbZTHWBkvafaN2OIHU9UokPGXElzvu5jsQZ99vo/SkxxKXC bv6G7rsjqXd8oYfJPUpDATCVHo52wxst4DIdO/UJgb+13cYhiPJtlBUu6LEN4f53rxk5 TZX4Q9GpGE5VQN6VtafmMcbtkrFC4G++IkF31A7rYG51rOMUpoBw+7wTldl2KwabCuqi t2Y7hmDmsvOyiedP6WL1GU85QGuOiYVQgc2vJanYxPeU3rNmufETiv4mJH380v9zY0Tl gL/A== X-Gm-Message-State: AIkVDXLnm+Qp1rLeBBlhitmlkPfjaaRcQ6yUdkNDTRtg+FHO/JHGfVTH5Zw6vy9JgFd1+0mJ X-Received: by 10.84.225.20 with SMTP id t20mr22663551plj.154.1486436629426; Mon, 06 Feb 2017 19:03:49 -0800 (PST) Received: from localhost.localdomain ([45.56.152.31]) by smtp.gmail.com with ESMTPSA id k76sm5898563pfg.42.2017.02.06.19.03.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Feb 2017 19:03:48 -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, xie.baoyou@zte.com.cn, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn Subject: [PATCH v2 3/3] ASoC: zx-i2s: support zx296718 SoC for ZTE's i2s controller driver Date: Tue, 7 Feb 2017 11:02:51 +0800 Message-Id: <1486436571-8682-3-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486436571-8682-1-git-send-email-baoyou.xie@linaro.org> References: <1486436571-8682-1-git-send-email-baoyou.xie@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds zx296718 SoC support for ZTE's i2s controller driver. Signed-off-by: Baoyou Xie --- sound/soc/zte/zx-i2s.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/sound/soc/zte/zx-i2s.c b/sound/soc/zte/zx-i2s.c index ed7a56d..2afac69 100644 --- a/sound/soc/zte/zx-i2s.c +++ b/sound/soc/zte/zx-i2s.c @@ -95,12 +95,13 @@ 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; }; + static void zx_i2s_tx_en(void __iomem *base, bool on) { unsigned long val; @@ -274,9 +275,14 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream, val |= ZX_I2S_TIMING_CHN(ch_num); 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); + if (i2s->master) { + unsigned long rate = params_rate(params) * ch_num * CLK_RAT; + + ret = clk_set_rate(i2s->dai_wclk, rate); + if (!ret && i2s->dai_pclk) + ret = clk_set_rate(i2s->dai_pclk, rate); + } + return ret; } @@ -328,8 +334,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; - return clk_prepare_enable(zx_i2s->dai_clk); + ret = clk_prepare_enable(zx_i2s->dai_pclk); + if (ret) { + clk_disable_unprepare(zx_i2s->dai_wclk); + return ret; + } + + return ret; } static void zx_i2s_shutdown(struct snd_pcm_substream *substream, @@ -337,7 +354,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 +399,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, "tx"); + 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); @@ -414,6 +438,7 @@ static int zx_i2s_probe(struct platform_device *pdev) static const struct of_device_id zx_i2s_dt_ids[] = { { .compatible = "zte,zx296702-i2s", }, + { .compatible = "zte,zx296718-i2s", }, {} }; MODULE_DEVICE_TABLE(of, zx_i2s_dt_ids);