Armada 38x and 370 audio
Subsystems (3)
cover Armada 38x and 370 audio
Hi,
I send a series of patches adding I2S - S/PDIF support for Marvell Armada 38x SoC. It is same controller as in Armada 370, however two quirks had to be taken into consideration:
* new PLL frequency setting
* exceptive pinout of I2S and S/PDIF formats
Kirkwood-i2s driver was enhanced with obtaining mem resources by name. Sound interface was enabled for Armada 385 DB board, using simple-card DT binding for both I2S and S/PDIF. In addition to that minor fix was applied for Armada 370 audio DT description (stable-CC'ed).
Any comments and remarks are welcome.
Best regards,
Marcin
Marcin Wojtas (4):
ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms
ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
ARM: mvebu: add audio support to Armada 385 DB
ARM: mvebu: fix routing for analog audio input of Armada 370 DB
platform
.../devicetree/bindings/sound/mvebu-audio.txt | 14 ++- arch/arm/boot/dts/armada-370-db.dts | 2 +- arch/arm/boot/dts/armada-388-db.dts | 69 +++++++++++ arch/arm/boot/dts/armada-38x.dtsi | 17 +++ sound/soc/kirkwood/kirkwood-i2s.c | 132 ++++++++++++++++++++- sound/soc/kirkwood/kirkwood.h | 2 + 6 files changed, 232 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/4 ASoC: kirkwood: enable Kirkwood driver for Armada 38x platforms
The audio unit of Marvell Armada38x SoC is similar to the ones comprised by other Marvell SoCs (Kirkwood, Dove and Armada 370). Therefore Kirkwood audio driver can be used to support it and this commit adds new compatible string to identify Armada 38x variant.
Two new memory regions are added: first one for PLL configuration and the second one for choosing one of audio I/O modes (I2S or S/PDIF). For the latter purpose a new optional DT property is added ('spdif-mode').
kirkwood-i2s driver is extended by adding a new init function for Armada 38x flavor and also a routine that enables PLL output (i.e. MCLK) configuration.
--- .../devicetree/bindings/sound/mvebu-audio.txt | 14 ++- sound/soc/kirkwood/kirkwood-i2s.c | 132 ++++++++++++++++++++- sound/soc/kirkwood/kirkwood.h | 2 + 3 files changed, 145 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/sound/mvebu-audio.txt +13 -1
@@ -6,9 +6,14 @@ Required properties: "marvell,kirkwood-audio" for Kirkwood platforms "marvell,dove-audio" for Dove platforms "marvell,armada370-audio" for Armada 370 platforms + "marvell,armada-380-audio" for Armada 38x platforms - reg: physical base address of the controller and length of memory mapped - region. + region (named "i2s_regs"). + With "marvell,armada-380-audio" two other regions are required: + first of those is dedicated for Audio PLL Configuration registers + (named "pll_regs") and the second one ("soc_ctrl") - for register + where one of exceptive I/O types (I2S or S/PDIF) is set. - interrupts: with "marvell,kirkwood-audio", the audio interrupt
@@ -23,6 +28,13 @@ Required properties: "internal" for the internal clock "extclk" for the external clock +Optional properties: + +- spdif-mode: + Enable S/PDIF mode on Armada 38x SoC. Using this property + disables standard I2S I/O. Valid only with "marvell,armada-380-audio" + compatible string. + Example: i2s1: audio-controller@b4000 {
sound/soc/kirkwood/kirkwood-i2s.c +130 -2
162 lines not on this page · raw message
sound/soc/kirkwood/kirkwood.h +2 -0
@@ -133,6 +133,8 @@struct kirkwood_dma_data {void __iomem *io; +void __iomem *pll_config; +void __iomem *soc_control;struct clk *clk;struct clk *extclk;uint32_t ctl_play;
Signature · 1 line
1.8.3.1
PATCH 2/4 ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
In reply to Marcin WojtasThis commit adds the description of the I2S controller to the Marvell Armada 38x SoC's Device Tree, as well as its pin configuration.
--- arch/arm/boot/dts/armada-38x.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm/boot/dts/armada-38x.dtsi +17 -0
@@ -314,6 +314,12 @@ marvell,pins = "mpp44"; marvell,function = "sata3"; }; + + i2s_pins: i2s_pins { + marvell,pins = "mpp48", "mpp49", "mpp50", + "mpp51", "mpp52", "mpp53"; + marvell,function = "audio"; + }; }; gpio0: gpio@18100 {
@@ -555,6 +561,17 @@ status = "disabled"; }; + audio_controller: audio-controller@e8000 { + #sound-dai-cells = <1>; + compatible = "marvell,armada-380-audio"; + reg = <0xe8000 0x4000>, <0x18410 0xc>, <0x18204 0x4>; + reg-names = "i2s_regs", "pll_regs", "soc_ctrl"; + interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gateclk 0>; + clock-names = "internal"; + status = "disabled"; + }; + usb3@f0000 { compatible = "marvell,armada-380-xhci"; reg = <0xf0000 0x4000>,<0xf4000 0x4000>;
Signature · 1 line
1.8.3.1
Re: [PATCH 2/4] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
Quoted 12 lines · Marcin Wojtas
This commit adds the description of the I2S controller to the Marvell Armada 38x SoC's Device Tree, as well as its pin configuration.
Signed-off-by Marcin Wojtas <[email protected]>--- arch/arm/boot/dts/armada-38x.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)arch/arm/boot/dts/armada-38x.dtsi +0
-0
[...]
arch/arm/boot/dts/armada-38x.dtsi line 568
Quoted 9 lines
arch/arm/boot/dts/armada-38x.dtsi +5
-0@@ -555,6 +561,17 @@ status = "disabled"; }; + audio_controller: audio-controller at e8000 { + #sound-dai-cells = <1>; + compatible = "marvell,armada-380-audio"; + reg = <0xe8000 0x4000>, <0x18410 0xc>, <0x18204 0x4>; + reg-names = "i2s_regs", "pll_regs", "soc_ctrl";
Marcin,
sorry but NACK. The PLL and SoC ctrl are not even close to the audio controller registers.
arch/arm/boot/dts/armada-38x.dtsi line 571
Quoted 3 lines
arch/arm/boot/dts/armada-38x.dtsi +3
-0+ interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gateclk 0>; + clock-names = "internal";
How about providing access to audio PLL by a clock driver and amend the binding to allow for a second more precise PLL clock, e.g.
clocks = <&gateclk CLK_AUDIO>, <&pll PLL_AUDIO>; clock-names = "internal", "pll";
we already check for an "extclk" on Dove for the same reason but the name might be misleading here.
Also, i2c/spdif muxing option could be handled by 38x's pinctrl driver, we have the same for Dove's internal i2c mux.
If you want to use i2s you just add the option to the default pinctrl hog:
pinctrl-0 = <&i2s_pins &audio_mux_i2s>; pinctrl-names = "default";
Sebastian
Quoted 7 lines
arch/arm/boot/dts/armada-38x.dtsi +3
-0+ status = "disabled"; + }; + usb3 at f0000 { compatible = "marvell,armada-380-xhci"; reg = <0xf0000 0x4000>,<0xf4000 0x4000>;
Re: [PATCH 2/4] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
Hi Sebastian,
Thanks for your input.
2015-02-25 23:21 GMT+01:00 Sebastian Hesselbarth
<[email protected]>:
Quoted 42 lines · Marcin Wojtas
Quoted 14 lines
This commit adds the description of the I2S controller to the Marvell Armada 38x SoC's Device Tree, as well as its pin configuration.
Signed-off-by Marcin Wojtas <[email protected]>--- arch/arm/boot/dts/armada-38x.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)arch/arm/boot/dts/armada-38x.dtsi +0
-0[...]
arch/arm/boot/dts/armada-38x.dtsi line 570
Quoted 12 lines
arch/arm/boot/dts/armada-38x.dtsi +5
-0@@ -555,6 +561,17 @@ status = "disabled"; }; + audio_controller: audio-controller@e8000 { + #sound-dai-cells = <1>; + compatible = "marvell,armada-380-audio"; + reg = <0xe8000 0x4000>, <0x18410 0xc>, <0x18204 0x4>; + reg-names = "i2s_regs", "pll_regs", "soc_ctrl";Marcin,
sorry but NACK. The PLL and SoC ctrl are not even close to the audio controller registers.
arch/arm/boot/dts/armada-38x.dtsi line 571
Quoted 4 lines
arch/arm/boot/dts/armada-38x.dtsi +3
-0+ interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gateclk 0>; + clock-names = "internal";
Quoted 6 lines
How about providing access to audio PLL by a clock driver and amend the binding to allow for a second more precise PLL clock, e.g.
clocks = <&gateclk CLK_AUDIO>, <&pll PLL_AUDIO>; clock-names = "internal", "pll";
Good idea. Would you suggest some name for the new driver? How about clk-audio.c under drivers/clk/mvebu?
Quoted 12 lines
we already check for an "extclk" on Dove for the same reason but the name might be misleading here.
Also, i2c/spdif muxing option could be handled by 38x's pinctrl driver, we have the same for Dove's internal i2c mux.
If you want to use i2s you just add the option to the default pinctrl hog:
pinctrl-0 = <&i2s_pins &audio_mux_i2s>; pinctrl-names = "default";
Ok, I'll try to extend pinctrl-armada-38x then.
Marcin
Re: [PATCH 2/4] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
Quoted 3 lines · Marcin Wojtas
2015-02-25 23:21 GMT+01:00 Sebastian Hesselbarth
<[email protected]>:Quoted 1 line · Marcin Wojtas
[...]
Quoted 12 lines
Quoted 12 lines
sorry but NACK. The PLL and SoC ctrl are not even close to the audio controller registers.
arch/arm/boot/dts/armada-38x.dtsi line 571
Quoted 4 lines
+ interrupts = <
GIC_SPI75IRQ_TYPE_LEVEL_HIGH>;arch/arm/boot/dts/armada-38x.dtsi +2
-0+ clocks = <&gateclk 0>; + clock-names = "internal";How about providing access to audio PLL by a clock driver and amend the binding to allow for a second more precise PLL clock, e.g.
Quoted 6 lines
Quoted 3 lines
clocks = <&gateclk CLK_AUDIO>, <&pll PLL_AUDIO>; clock-names = "internal", "pll";Good idea. Would you suggest some name for the new driver? How about
clk-audio.cunderdrivers/clk/mvebu?
Depends on how much you know about the surrounding registers.
If there is more clock related stuff than the audio pll, I'd suggest to have a single driver for everything that isn't core clk or clk gates which are already dealt with in the existing driver.
Given that this PLL layout is most likely 38x specific, I'd just put it into drivers/clk/mvebu/armada-38x.c.
Quoted 6 lines
Quoted 6 lines
we already check for an "extclk" on Dove for the same reason but the name might be misleading here.
Also, i2c/spdif muxing option could be handled by 38x's pinctrl driver, we have the same for Dove's internal i2c mux.
Quoted 8 lines
Quoted 6 lines
If you want to use i2s you just add the option to the default pinctrl hog:
pinctrl-0 = <&i2s_pins &audio_mux_i2s>; pinctrl-names = "default";Ok, I'll try to extend pinctrl-armada-38x then.
IMHO, adding a "syscon" compatible to the system-controller node should do the trick. You can reference the regmap from 38x's pinctrl driver and have a specific callback for the i2s/spdif muxing. The reg property range of the system-controller should be extended but that definitely depends on what the you or the Free Electron guys know about the register set.
Sebastian
Re: [PATCH 2/4] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
2015-02-26 1:30 GMT+01:00 Sebastian Hesselbarth
<[email protected]>:
Quoted 30 lines · Marcin Wojtas
Quoted 5 lines
2015-02-25 23:21 GMT+01:00 Sebastian Hesselbarth
<[email protected]>:Quoted 2 lines · Marcin Wojtas
[...]
Quoted 14 lines
Quoted 14 lines
sorry but NACK. The PLL and SoC ctrl are not even close to the audio controller registers.
arch/arm/boot/dts/armada-38x.dtsi line 571
Quoted 4 lines
+ interrupts = <
GIC_SPI75IRQ_TYPE_LEVEL_HIGH>;arch/arm/boot/dts/armada-38x.dtsi +2
-0+ clocks = <&gateclk 0>; + clock-names = "internal";How about providing access to audio PLL by a clock driver and amend the binding to allow for a second more precise PLL clock, e.g.
Quoted 6 lines
Quoted 3 lines
clocks = <&gateclk CLK_AUDIO>, <&pll PLL_AUDIO>; clock-names = "internal", "pll";Good idea. Would you suggest some name for the new driver? How about
clk-audio.cunderdrivers/clk/mvebu?
Quoted 9 lines
Depends on how much you know about the surrounding registers.
If there is more clock related stuff than the audio pll, I'd suggest to have a single driver for everything that isn't core clk or clk gates which are already dealt with in the existing driver.
Given that this PLL layout is most likely 38x specific, I'd just put it into
drivers/clk/mvebu/armada-38x.c.
Audio PLL setting consist of 3 independent registers. Adjacent to them there are same regs for setting TDM PLL, however I doubt telephony is going to be supported in foreseeable future (if ever). I also have strong suspicion that it looks the same in a39x - Thomas, can you take a look into spec and confirm?
Quoted 16 lines
Quoted 6 lines
Quoted 6 lines
we already check for an "extclk" on Dove for the same reason but the name might be misleading here.
Also, i2c/spdif muxing option could be handled by 38x's pinctrl driver, we have the same for Dove's internal i2c mux.
Quoted 8 lines
Quoted 6 lines
If you want to use i2s you just add the option to the default pinctrl hog:
pinctrl-0 = <&i2s_pins &audio_mux_i2s>; pinctrl-names = "default";Ok, I'll try to extend pinctrl-armada-38x then.
Quoted 7 lines
IMHO, adding a "syscon" compatible to the system-controller node should do the trick. You can reference the regmap from 38x's pinctrl driver and have a specific callback for the i2s/spdif muxing. The reg property range of the system-controller should be extended but that definitely depends on what the you or the Free Electron guys know about the register set.
For muxing i2s/spdif (exactly the same pins, they have to be either way set to "audio" by pinctrl driver) changing single bit in "system control 1" register is needed. However currently unused, it is already a part of system-controller at 18200 regmap. Anyway the will of using either i2s or spdif has to be explicitly represented in DT.
Marcin
Re: [PATCH 2/4] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
Dear Marcin Wojtas,
Quoted 6 lines · Marcin Wojtas
Quoted 2 lines
Given that this PLL layout is most likely 38x specific, I'd just put it into
drivers/clk/mvebu/armada-38x.c.Audio PLL setting consist of 3 independent registers. Adjacent to them there are same regs for setting TDM PLL, however I doubt telephony is going to be supported in foreseeable future (if ever).
We might be supporting TDM in the future. However, I see that the TDM PLL registers are nicely grouped together, and so are the audio PLL registers. So maybe we can simply have a driver to handle the audio PLL registers for now, and if needed in the future, add another driver for the TDM PLL.
Quoted 2 lines
I also have strong suspicion that it looks the same in a39x - Thomas, can you take a look into spec and confirm?
As far as I can see there is no audio support and no TDM support in Armada 39x, and there those TDM PLL and audio PLL registers do not exist.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Re: [PATCH 2/4] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
Dear Thomas,
2015-02-27 15:03 GMT+01:00 Thomas Petazzoni
<[email protected]>:
Quoted 11 lines
Dear Marcin Wojtas,
Quoted 6 lines · Marcin Wojtas
Quoted 2 lines
Given that this PLL layout is most likely 38x specific, I'd just put it into
drivers/clk/mvebu/armada-38x.c.Audio PLL setting consist of 3 independent registers. Adjacent to them there are same regs for setting TDM PLL, however I doubt telephony is going to be supported in foreseeable future (if ever).
Quoted 5 lines
We might be supporting TDM in the future. However, I see that the TDM PLL registers are nicely grouped together, and so are the audio PLL registers. So maybe we can simply have a driver to handle the audio PLL registers for now, and if needed in the future, add another driver for the TDM PLL.
I've got very fresh experience of adding TDM support for A38x, it definitely would require longer discussion.
Quoted 8 lines
Quoted 3 lines
I also have strong suspicion that it looks the same in a39x - Thomas, can you take a look into spec and confirm?
As far as I can see there is no audio support and no TDM support in Armada 39x, and there those TDM PLL and audio PLL registers do not exist.
Given all the facts, do you think that drivers/clk/mvebu/armada-38x.c is a right place for adding this PLL setting support?
Best regards,
Marcin
Re: [PATCH 2/4] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
Dear Marcin Wojtas,
Quoted 2 lines · Marcin Wojtas
Given all the facts, do you think that
drivers/clk/mvebu/armada-38x.cis a right place for adding this PLL setting support?
Yes, sounds right to me. I was thinking that maybe it should be in a separate file armada-38x-pll.c, but that's probably a bit too much for something that is causing to be a simple driver.
Have you sorted out how to handle the pin-muxing part of the problem?
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Re: [PATCH 2/4] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
Hello Thomas,
2015-02-28 10:58 GMT+01:00 Thomas Petazzoni
<[email protected]>:
Quoted 11 lines
Dear Marcin Wojtas,
Quoted 2 lines · Marcin Wojtas
Given all the facts, do you think that
drivers/clk/mvebu/armada-38x.cis a right place for adding this PLL setting support?Yes, sounds right to me. I was thinking that maybe it should be in a separate file
armada-38x-pll.c, but that's probably a bit too much for something that is causing to be a simple driver.
I've got an update from Marvell - TDM and Audio are available in A39x and it has the same set of PLL registers like A38x. Shouldn't we place PLL configuration code in a separate file like clk-pll.c, or whatever name you suggest?
Quoted 2 lines
Have you sorted out how to handle the pin-muxing part of the problem?
I'll come back with this issue after implementing poc.
Best regards,
Marcin
Re: [PATCH 2/4] ARM: mvebu: add audio I2S controller to Armada 38x Device Tree
Dear Marcin Wojtas,
Quoted 4 lines · Marcin Wojtas
I've got an update from Marvell - TDM and Audio are available in A39x and it has the same set of PLL registers like A38x. Shouldn't we place PLL configuration code in a separate file like
clk-pll.c, or whatever name you suggest?
Yes, seems OK to me.
Quoted 3 lines
Quoted 1 line
Have you sorted out how to handle the pin-muxing part of the problem?
I'll come back with this issue after implementing poc.
Ok, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 3/4 ARM: mvebu: add audio support to Armada 385 DB
In reply to Marcin WojtasThis commit adds the necessary Device Tree information to enable audio support on the Armada 385 DB platform. In details it:
* Instantiates the CS42L51 audio codec on the I2C0 bus
* Adds simple-card DT binding for audio on Armada 385 DB
* Adds description for both analog I2S and S/PDIF I/O
--- arch/arm/boot/dts/armada-388-db.dts | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
arch/arm/boot/dts/armada-388-db.dts +69 -0
@@ -82,6 +82,11 @@ i2c@11000 { status = "okay"; clock-frequency = <100000>; + audio_codec: audio-codec@4a { + #sound-dai-cells = <0>; + compatible = "cirrus,cs42l51"; + reg = <0x4a>; + }; }; i2c@11100 {
@@ -158,6 +163,12 @@ no-1-8-v; }; + audio-controller@e8000 { + pinctrl-0 = <&i2s_pins>; + pinctrl-names = "default"; + status = "okay"; + }; + usb3@f0000 { status = "okay"; };
@@ -183,4 +194,62 @@ }; }; }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "Armada 385 DB Audio"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Headphone", "Out Jack", + "Line", "In Jack"; + simple-audio-card,routing = + "Out Jack", "HPL", + "Out Jack", "HPR", + "AIN1L", "In Jack", + "AIN1R", "In Jack"; + status = "okay"; + + simple-audio-card,dai-link@0 { + format = "i2s"; + cpu { + sound-dai = <&audio_controller 0>; + }; + + codec { + sound-dai = <&audio_codec>; + }; + }; + + simple-audio-card,dai-link@1 { + format = "i2s"; + cpu { + sound-dai = <&audio_controller 1>; + }; + + codec { + sound-dai = <&spdif_out>; + }; + }; + + simple-audio-card,dai-link@2 { + format = "i2s"; + cpu { + sound-dai = <&audio_controller 1>; + }; + + codec { + sound-dai = <&spdif_in>; + }; + }; + }; + + spdif_out: spdif-out { + #sound-dai-cells = <0>; + compatible = "linux,spdif-dit"; + }; + + spdif_in: spdif-in { + #sound-dai-cells = <0>; + compatible = "linux,spdif-dir"; + }; };
Signature · 1 line
1.8.3.1
PATCH 4/4 ARM: mvebu: fix routing for analog audio input of Armada 370 DB platform
In reply to Marcin WojtasArmada 370 DB sound complex comprise routing for audio card with a description for analog input line with two left channels instead of a pair left-right. This commit introduces routing for the right channel.
--- arch/arm/boot/dts/armada-370-db.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/armada-370-db.dts +1 -1
@@ -190,7 +190,7 @@ "Out Jack", "HPL", "Out Jack", "HPR", "AIN1L", "In Jack", - "AIN1L", "In Jack"; + "AIN1R", "In Jack"; status = "okay"; simple-audio-card,dai-link@0 {
Signature · 1 line
1.8.3.1