[alsa-devel] [PATCH v4 1/3] clk: zte: add i2s clocks for zx296718
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 baoyou.xie@linaro.org --- drivers/clk/zte/clk-zx296718.c | 4 ++++ 1 file changed, 4 insertions(+)
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),
ZTE's zx2967 I2S controller driver introduces pclk, this patch documents this fact.
Signed-off-by: Baoyou Xie baoyou.xie@linaro.org --- Documentation/devicetree/bindings/sound/zte,zx-i2s.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt b/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt index 7e5aa6f..292ad50 100644 --- a/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt +++ b/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt @@ -1,10 +1,12 @@ ZTE ZX296702 I2S controller
Required properties: - - compatible : Must be "zte,zx296702-i2s" + - compatible : Must be one of: + "zte,zx296718-i2s", "zte,zx296702-i2s" + "zte,zx296702-i2s" - reg : Must contain I2S core's registers location and length - clocks : Pairs of phandle and specifier referencing the controller's clocks. - - clock-names: "tx" for the clock to the I2S interface. + - clock-names: "wclk" for the wclk, "pclk" for the pclk to the I2S interface. - dmas: Pairs of phandle and specifier for the DMA channel that is used by the core. The core expects two dma channels for transmit. - dma-names : Must be "tx" and "rx" @@ -16,12 +18,12 @@ please check: * dma/dma.txt
Example: - i2s0: i2s0@0b005000 { + i2s0: i2s@b005000 { #sound-dai-cells = <0>; - compatible = "zte,zx296702-i2s"; + compatible = "zte,zx296718-i2s", "zte,zx296702-i2s"; reg = <0x0b005000 0x1000>; - clocks = <&lsp0clk ZX296702_I2S0_DIV>; - clock-names = "tx"; + clocks = <&audiocrm AUDIO_I2S0_WCLK>, <&audiocrm AUDIO_I2S0_PCLK>; + clock-names = "wclk", "pclk"; interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; dmas = <&dma 5>, <&dma 6>; dma-names = "tx", "rx";
On Thu, Feb 09, 2017 at 11:12:57AM +0800, Baoyou Xie wrote:
- compatible : Must be "zte,zx296702-i2s"
- compatible : Must be one of:
- "zte,zx296718-i2s", "zte,zx296702-i2s"
- "zte,zx296702-i2s"
You've added the new compatible twice here?
On Thu, Feb 09, 2017 at 04:46:45PM +0000, Mark Brown wrote:
On Thu, Feb 09, 2017 at 11:12:57AM +0800, Baoyou Xie wrote:
- compatible : Must be "zte,zx296702-i2s"
- compatible : Must be one of:
- "zte,zx296718-i2s", "zte,zx296702-i2s"
- "zte,zx296702-i2s"
You've added the new compatible twice here?
It's indeed a bit confusing. Might be better if we add a couple of bullet like below.
- compatible : Must be one of: - "zte,zx296718-i2s", "zte,zx296702-i2s"; - "zte,zx296702-i2s";
In this case, it's more easier for readers to understand that the first one is for I2S device on SoC ZX296718, while it's compatible with the I2S on ZX296702.
Shawn
The patch
ASoC: zx-i2s: Add the info of pclk to the binding document for zx2967 family
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From b5f18ba89391da7a92605dc76822580d13e2ef74 Mon Sep 17 00:00:00 2001
From: Baoyou Xie baoyou.xie@linaro.org Date: Thu, 9 Feb 2017 11:12:57 +0800 Subject: [PATCH] ASoC: zx-i2s: Add the info of pclk to the binding document for zx2967 family
ZTE's zx2967 I2S controller driver introduces pclk, this patch documents this fact.
Signed-off-by: Baoyou Xie baoyou.xie@linaro.org Signed-off-by: Mark Brown broonie@kernel.org --- Documentation/devicetree/bindings/sound/zte,zx-i2s.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt b/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt index 7e5aa6f6b5a1..292ad5083704 100644 --- a/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt +++ b/Documentation/devicetree/bindings/sound/zte,zx-i2s.txt @@ -1,10 +1,12 @@ ZTE ZX296702 I2S controller
Required properties: - - compatible : Must be "zte,zx296702-i2s" + - compatible : Must be one of: + "zte,zx296718-i2s", "zte,zx296702-i2s" + "zte,zx296702-i2s" - reg : Must contain I2S core's registers location and length - clocks : Pairs of phandle and specifier referencing the controller's clocks. - - clock-names: "tx" for the clock to the I2S interface. + - clock-names: "wclk" for the wclk, "pclk" for the pclk to the I2S interface. - dmas: Pairs of phandle and specifier for the DMA channel that is used by the core. The core expects two dma channels for transmit. - dma-names : Must be "tx" and "rx" @@ -16,12 +18,12 @@ please check: * dma/dma.txt
Example: - i2s0: i2s0@0b005000 { + i2s0: i2s@b005000 { #sound-dai-cells = <0>; - compatible = "zte,zx296702-i2s"; + compatible = "zte,zx296718-i2s", "zte,zx296702-i2s"; reg = <0x0b005000 0x1000>; - clocks = <&lsp0clk ZX296702_I2S0_DIV>; - clock-names = "tx"; + clocks = <&audiocrm AUDIO_I2S0_WCLK>, <&audiocrm AUDIO_I2S0_PCLK>; + clock-names = "wclk", "pclk"; interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; dmas = <&dma 5>, <&dma 6>; dma-names = "tx", "rx";
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 baoyou.xie@linaro.org --- sound/soc/zte/zx-i2s.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-)
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);
On Thu, Feb 09, 2017 at 11:12:58AM +0800, Baoyou Xie wrote:
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 baoyou.xie@linaro.org
Reviewed-by: Shawn Guo shawnguo@kernel.org
On 2017年02月09日 11:12, Baoyou Xie wrote:
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 baoyou.xie@linaro.org
Reviewed-by: Jun Nie jun.nie@linaro.org
The patch
ASoC: zx-i2s: introduce pclk for zx2967 family
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 66ead502af7de65d1e555189cdca8f47eddac400 Mon Sep 17 00:00:00 2001
From: Baoyou Xie baoyou.xie@linaro.org Date: Thu, 9 Feb 2017 11:12:58 +0800 Subject: [PATCH] ASoC: zx-i2s: introduce pclk for zx2967 family
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 baoyou.xie@linaro.org Reviewed-by: Shawn Guo shawnguo@kernel.org Reviewed-by: Jun Nie jun.nie@linaro.org Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/zte/zx-i2s.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-)
diff --git a/sound/soc/zte/zx-i2s.c b/sound/soc/zte/zx-i2s.c index ed7a56d1ef54..a865f37c2a56 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);
On Thu, Feb 09, 2017 at 11:12:56AM +0800, Baoyou Xie wrote:
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 baoyou.xie@linaro.org
Acked-by: Shawn Guo shawnguo@kernel.org
There is no compile-time dependency between this clk patch and I2S driver one, so it can just go via clk tree, I think.
Shawn
On 02/09, Baoyou Xie wrote:
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 baoyou.xie@linaro.org
Applied to clk-next
participants (5)
-
Baoyou Xie
-
Jun Nie
-
Mark Brown
-
Shawn Guo
-
Stephen Boyd