HiKey i2s bindings, driver and dts changes
Subsystems (4)
v4 cover HiKey i2s bindings, driver and dts changes
This patchset provides i2s audio driver and dts changes in order to enable HDMI audio on the HiKey board.
Its been a few months since I last sent this out, but I wanted to try to get some thoughts after trying to integrate some of the feedback I've gotten since then.
Overally, the current i2s driver is somewhat limited, as the SoC supports three different i2s routes. However, without documentation this driver was originally developed by Andy Green with only an old 3.10 era vendor driver for reference, so the driver only supports one i2s route (S2) which goes to the HDMI bridge on HiKey.
Quoted 1 line
From previous feedback, I have reworked the DTS binding a tiny
bit, to allow multi dais to be specified, which will allow other i2s routes/dai links (such as is available on the LS connector) to be used once we manage to figure out how to enable them properly.
Further feedback would be greatly appreciated! Though audio is not an area of my expertise, so the more specific the better :)
thanks
-john
Andy Green (1):
ASoC: hisilicon: Add hi6210 i2s audio driver
John Stultz (2):
ASoC: add hi6210-i2s DT bindings
arm64: dts: hi6220: Add k3-dma and i2s/hdmi audio support
.../bindings/sound/hisilicon,hi6210-i2s.txt | 34 ++ arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 16 + arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 26 + sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/hisilicon/Kconfig | 5 + sound/soc/hisilicon/Makefile | 1 + sound/soc/hisilicon/hi6210-i2s.c | 628 +++++++++++++++++++++ sound/soc/hisilicon/hi6210-i2s.h | 276 +++++++++ 9 files changed, 988 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/hisilicon,hi6210-i2s.txt create mode 100644 sound/soc/hisilicon/Kconfig create mode 100644 sound/soc/hisilicon/Makefile create mode 100644 sound/soc/hisilicon/hi6210-i2s.c create mode 100644 sound/soc/hisilicon/hi6210-i2s.h
Signature · 1 line
2.7.4
PATCH v4 1/3 ASoC: add hi6210-i2s DT bindings
Adds DT bindings documentation for the hi6210-i2s driver.
---
v3:
* Simplified and reworked dt binding
v4:
* Add #sound-dai-cells entry to make it clear multiple dais are possible
--- .../bindings/sound/hisilicon,hi6210-i2s.txt | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/hisilicon,hi6210-i2s.txt
Documentation/devicetree/bindings/sound/hisilicon,hi6210-i2s.txt new file +34 -0
@@ -0,0 +1,34 @@ +* Hisilicon 6210 i2s controller + +Required properties: + +- compatible: should be one of the following: + - "hisilicon,hi6210-i2s" +- reg: physical base address of the i2s controller unit and length of + memory mapped region. +- interrupts: should contain the i2s interrupt. +- clocks: a list of phandle + clock-specifier pairs, one for each entry + in clock-names. +- clock-names: should contain following: + - "dacodec" + - "i2s-base" +- dmas: DMA specifiers for tx dma. See the DMA client binding, + Documentation/devicetree/bindings/dma/dma.txt +- dma-names: should be "tx" and "rx" +- hisilicon,sysctrl-syscon: phandle to sysctrl syscon +- #sound-dai-cells: Should be set to 1 (for multi-dai) + +Example for the hi6210 i2s controller: + +i2s0: i2s@f7118000{ + compatible = "hisilicon,hi6210-i2s"; + reg = <0x0 0xf7118000 0x0 0x8000>; /* i2s unit */ + interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>; /* 155 "DigACodec_intr"-32 */ + clocks = <&sys_ctrl HI6220_DACODEC_PCLK>, + <&sys_ctrl HI6220_BBPPLL0_DIV>; + clock-names = "dacodec", "i2s-base"; + dmas = <&dma0 15 &dma0 14>; + dma-names = "rx", "tx"; + hisilicon,sysctrl-syscon = <&sys_ctrl>; + #sound-dai-cells = <1>; +};
Signature · 1 line
2.7.4
Mark Brown
maintainerRe: [PATCH 1/3 v4] ASoC: add hi6210-i2s DT bindings
Quoted 1 line · John Stultz
+- #sound-dai-cells: Should be set to 1 (for multi-dai)
Please submit a followup patch documenting what these mean, at least for what's in the code.
Re: [PATCH 1/3 v4] ASoC: add hi6210-i2s DT bindings
Quoted 6 lines · Mark Brown
Quoted 1 line · John Stultz
+- #sound-dai-cells: Should be set to 1 (for multi-dai)
Please submit a followup patch documenting what these mean, at least for what's in the code.
So just to make sure I understand, you want documentation on what the sound-dia-cells index maps to? (ie 0 to S2, as that's the only one supported right now?) Or something else?
thanks
-john
Mark Brown
maintainerRe: [PATCH 1/3 v4] ASoC: add hi6210-i2s DT bindings
Quoted 10 lines · John Stultz
Quoted 6 lines · Mark Brown
Quoted 1 line · John Stultz
+- #sound-dai-cells: Should be set to 1 (for multi-dai)
Please submit a followup patch documenting what these mean, at least for what's in the code.
So just to make sure I understand, you want documentation on what the sound-dia-cells index maps to? (ie 0 to S2, as that's the only one
*dai*
Quoted 1 line
supported right now?) Or something else?
Yes, that. People need to be able to tell what the binding means.
PATCH v4 2/3 ASoC: hisilicon: Add hi6210 i2s audio driver
In reply to John StultzFrom: Andy Green <[email protected]>
Add driver for hi6210 i2s controller found on hi6220 boards.
[jstultz: Forward ported to mainline, fairly major rework
based on suggestions from Mark Brown]
---
v2:
* Folded in fixes from kbuildbot
* Split i2s and hdmi-card drivers up
* Major rework from MarkB's suggestions
v3:
* Folded in fixes from Guodong
* Simplified and reworked devicetree bindings
* Integrated review feedback from Mark Brown v4:
* Minor tweak to ensure dai entry is named properly when using non-single-link dias
--- sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/hisilicon/Kconfig | 5 + sound/soc/hisilicon/Makefile | 1 + sound/soc/hisilicon/hi6210-i2s.c | 628 +++++++++++++++++++++++++++++++++++++++ sound/soc/hisilicon/hi6210-i2s.h | 276 +++++++++++++++++ 6 files changed, 912 insertions(+) create mode 100644 sound/soc/hisilicon/Kconfig create mode 100644 sound/soc/hisilicon/Makefile create mode 100644 sound/soc/hisilicon/hi6210-i2s.c create mode 100644 sound/soc/hisilicon/hi6210-i2s.h
sound/soc/Kconfig +1 -0
@@ -47,6 +47,7 @@ source "sound/soc/cirrus/Kconfig" source "sound/soc/davinci/Kconfig" source "sound/soc/dwc/Kconfig" source "sound/soc/fsl/Kconfig" +source "sound/soc/hisilicon/Kconfig" source "sound/soc/jz4740/Kconfig" source "sound/soc/nuc900/Kconfig" source "sound/soc/omap/Kconfig"
sound/soc/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_SND_SOC) += cirrus/ obj-$(CONFIG_SND_SOC) += davinci/ obj-$(CONFIG_SND_SOC) += dwc/ obj-$(CONFIG_SND_SOC) += fsl/ +obj-$(CONFIG_SND_SOC) += hisilicon/ obj-$(CONFIG_SND_SOC) += jz4740/ obj-$(CONFIG_SND_SOC) += img/ obj-$(CONFIG_SND_SOC) += intel/
sound/soc/hisilicon/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +config SND_I2S_HI6210_I2S + tristate "Hisilicon I2S controller" + select SND_SOC_GENERIC_DMAENGINE_PCM + help + Hisilicon I2S
sound/soc/hisilicon/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_SND_I2S_HI6210_I2S) += hi6210-i2s.o
sound/soc/hisilicon/hi6210-i2s.c new file +628 -0
628 lines not on this page · raw message
sound/soc/hisilicon/hi6210-i2s.h new file +276 -0
276 lines not on this page · raw message
Signature · 1 line
2.7.4
Mark Brown
maintainerRe: [PATCH 2/3 v4] ASoC: hisilicon: Add hi6210 i2s audio driver
On Fri, Mar 31, 2017 at 03:06:00PM -0700, John Stultz wrote:
Looks mostly good, a few more minor issues, please send incremental fixes for these:
sound/soc/hisilicon/hi6210-i2s.c line 398
Quoted 6 lines
sound/soc/hisilicon/hi6210-i2s.c new file +5
-0+ +switch (i2s->format &SND_SOC_DAIFMT_MASTER_MASK ) { +default : +WARN_ONCE (1 ,"Invalid i2s->fmt MASTER_MASK. This shouldn't happen\n" ); + }
It should still return an error just in case.
sound/soc/hisilicon/hi6210-i2s.c line 412
Quoted 5 lines
sound/soc/hisilicon/hi6210-i2s.c new file +4
-0+switch (i2s->format &SND_SOC_DAIFMT_FORMAT_MASK ) { +default : +WARN_ONCE (1 ,"Invalid i2s->fmt FORMAT_MASK. This shouldn't happen\n" ); + }
Similarly.
sound/soc/hisilicon/hi6210-i2s.c line 443
Quoted 5 lines
sound/soc/hisilicon/hi6210-i2s.c new file +5
-0+default : + val =hi6210_read_reg (i2s,HII2S_I2S_CFG ); + val &= ~HII2S_I2S_CFG__S2_FRAME_MODE ; +hi6210_write_reg (i2s,HII2S_I2S_CFG , val); + }
Missing break.
sound/soc/hisilicon/hi6210-i2s.c line 595
Quoted 6 lines
sound/soc/hisilicon/hi6210-i2s.c new file +6
-0+ ret =snd_soc_register_component (&pdev->dev, &hi6210_i2s_i2s_comp, + &i2s->dai,1 ); +if (ret) { +dev_err (&pdev->dev,"Failed to register dai\n" ); +return ret; + }
devm_snd_soc_register_component()
sound/soc/hisilicon/hi6210-i2s.c line 603
Quoted 4 lines
sound/soc/hisilicon/hi6210-i2s.c new file +4
-0+static int hi6210_i2s_remove (struct platform_device *pdev) +{ +snd_soc_unregister_component (&pdev->dev); +dev_set_drvdata (&pdev->dev,NULL );
The core will set the driver data to NULL, though it shouldn't be needed.
PATCH v4 3/3 arm64: dts: hi6220: Add k3-dma and i2s/hdmi audio support
In reply to John StultzAdd entry for k3-dma driver and i2s/hdmi audio devices.
This enables HDMI audio output.
v2:
* Split core i2s entry into dtsi and hdmi specific bits into hikey dts
v4:
* Rework simple-card to use many-dai-links method, as there may be other links in the future
--- arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 16 ++++++++++++++++ arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 26 ++++++++++++++++++++++++++ 2 files changed, 42 insertions(+)
arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts +16 -0
@@ -406,6 +406,21 @@ }; }; }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "hikey-hdmi"; + + simple-audio-card,dai-link@0 { /* I2S - HDMI */ + format = "i2s"; + cpu { + sound-dai = <&i2s0 0>; + }; + codec { + sound-dai = <&adv7533>; + }; + }; + }; }; &uart2 {
@@ -446,6 +461,7 @@ interrupts = <1 2>; pd-gpio = <&gpio0 4 0>; adi,dsi-lanes = <4>; + #sound-dai-cells = <0>; port { adv7533_in: endpoint {
arch/arm64/boot/dts/hisilicon/hi6220.dtsi +26 -0
@@ -332,6 +332,19 @@ status = "disabled"; }; + dma0: dma@f7370000 { + compatible = "hisilicon,k3-dma-1.0"; + reg = <0x0 0xf7370000 0x0 0x1000>; + #dma-cells = <1>; + dma-channels = <15>; + dma-requests = <32>; + interrupts = <0 84 4>; + clocks = <&sys_ctrl HI6220_EDMAC_ACLK>; + dma-no-cci; + dma-type = "hi6220_dma"; + status = "ok"; + }; + dual_timer0: timer@f8008000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x0 0xf8008000 0x0 0x1000>;
@@ -831,6 +844,19 @@ #thermal-sensor-cells = <1>; }; + i2s0: i2s@f7118000{ + compatible = "hisilicon,hi6210-i2s"; + reg = <0x0 0xf7118000 0x0 0x8000>; /* i2s unit */ + interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>; /* 155 "DigACodec_intr"-32 */ + clocks = <&sys_ctrl HI6220_DACODEC_PCLK>, + <&sys_ctrl HI6220_BBPPLL0_DIV>; + clock-names = "dacodec", "i2s-base"; + dmas = <&dma0 15 &dma0 14>; + dma-names = "rx", "tx"; + hisilicon,sysctrl-syscon = <&sys_ctrl>; + #sound-dai-cells = <1>; + }; + thermal-zones { cls0: cls0 {
Signature · 1 line
2.7.4