Skip to contentSkip to conversation

dt: Add bindings documentation for the ADI AXI-I2S controller

PATCH Superseded Lars-Peter Clausen 3 participants 9 messages Nov 28, 2013 – Nov 29, 2013 1 message not in the archive

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 2/4 ASoC: Add support for the Analog Devices AXI-I2S core

In reply to Lars-Peter Clausen

This patch adds support for the AXI-I2S core. The core implements a simple bidirectional I2S transceiver and is used by Analog Devices in some of their reference designs for various FPGA platforms.

The patch also adds a simple ASoC PCM driver for the PL330 DMA controller using the generic dmaengine PCM driver. This driver is only temporary can be removed once we have all the infrastructure in place to query information like maximum transfer size directly from the dmaengine driver.

---
Has a compile time dependency on topic/dma

---
 sound/soc/Kconfig       |   1 +
 sound/soc/Makefile      |   1 +
 sound/soc/adi/Kconfig   |  13 +++
 sound/soc/adi/Makefile  |   3 +
 sound/soc/adi/axi-i2s.c | 276 ++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 294 insertions(+)
 create mode 100644 sound/soc/adi/Kconfig
 create mode 100644 sound/soc/adi/Makefile
 create mode 100644 sound/soc/adi/axi-i2s.c
sound/soc/Kconfig +1 -0
index 5138b84..866dfec 100644
@@ -31,6 +31,7 @@ config SND_SOC_GENERIC_DMAENGINE_PCM
 	select SND_DMAENGINE_PCM
 
 # All the supported SoCs
+source "sound/soc/adi/Kconfig"
 source "sound/soc/atmel/Kconfig"
 source "sound/soc/au1x/Kconfig"
 source "sound/soc/blackfin/Kconfig"
sound/soc/Makefile +1 -0
index 8b9e701..c70c7f7 100644
@@ -8,6 +8,7 @@ endif
 obj-$(CONFIG_SND_SOC)	+= snd-soc-core.o
 obj-$(CONFIG_SND_SOC)	+= codecs/
 obj-$(CONFIG_SND_SOC)	+= generic/
+obj-$(CONFIG_SND_SOC)	+= adi/
 obj-$(CONFIG_SND_SOC)	+= atmel/
 obj-$(CONFIG_SND_SOC)	+= au1x/
 obj-$(CONFIG_SND_SOC)	+= blackfin/
sound/soc/adi/Kconfig new file +13 -0
new file mode 100644
index 0000000..14bb385
@@ -0,0 +1,13 @@
+config SND_SOC_ADI
+	tristate "Audio support for Analog Devices reference designs"
+	depends on SND_SOC && (MICROBLAZE || ARCH_ZYNQ || COMPILE_TEST)
+	help
+	  Audio support for various reference designs by Analog Devices.
+
+config SND_SOC_ADI_AXI_I2S
+	tristate "AXI-I2S support"
+	depends on SND_SOC_ADI
+	select SND_SOC_GENERIC_DMAENGINE_PCM
+	select REGMAP_MMIO
+	help
+	  ASoC driver for the Analog Devices AXI-I2S softcore peripheral.
sound/soc/adi/Makefile new file +3 -0
new file mode 100644
index 0000000..d32c21a
@@ -0,0 +1,3 @@
+snd-soc-adi-axi-i2s-objs := axi-i2s.o
+
+obj-$(CONFIG_SND_SOC_ADI_AXI_I2S) += snd-soc-adi-axi-i2s.o
sound/soc/adi/axi-i2s.c new file +276 -0

276 lines not on this page · raw message

Signature · 1 line
1.8.0
#6 lore raw

PATCH 4/4 ASoC: Add support for the Analog Devices AXI-SPDIF driver

In reply to Lars-Peter Clausen

This patch adds a ASoC driver for the AXI-SPDIF core. The core implements a simple SPDIF transmitter and is used on some Analog Devices' reference designs for various FPGA platforms. For now the driver only support the PL330 as the the DMA controller.

---
Has a compile time dependency on topic/dma

---
 sound/soc/adi/Kconfig     |   8 ++
 sound/soc/adi/Makefile    |   2 +
 sound/soc/adi/axi-spdif.c | 272 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 282 insertions(+)
 create mode 100644 sound/soc/adi/axi-spdif.c
sound/soc/adi/Kconfig +8 -0
index 14bb385..82438de 100644
@@ -11,3 +11,11 @@ config SND_SOC_ADI_AXI_I2S
 	select REGMAP_MMIO
 	help
 	  ASoC driver for the Analog Devices AXI-I2S softcore peripheral.
+
+config SND_SOC_ADI_AXI_SPDIF
+	tristate "AXI-SPDIF support"
+	depends on SND_SOC_ADI
+	select SND_SOC_GENERIC_DMAENGINE_PCM
+	select REGMAP_MMIO
+	help
+	  ASoC driver for the Analog Devices AXI-SPDIF softcore peripheral.
sound/soc/adi/Makefile +2 -0
index d32c21a..64456c1 100644
@@ -1,3 +1,5 @@
 snd-soc-adi-axi-i2s-objs := axi-i2s.o
+snd-soc-adi-axi-spdif-objs := axi-spdif.o
 
 obj-$(CONFIG_SND_SOC_ADI_AXI_I2S) += snd-soc-adi-axi-i2s.o
+obj-$(CONFIG_SND_SOC_ADI_AXI_SPDIF) += snd-soc-adi-axi-spdif.o
sound/soc/adi/axi-spdif.c new file +272 -0

272 lines not on this page · raw message

Signature · 1 line
1.8.0
#0 lore raw

PATCH 1/4 dt: Add bindings documentation for the ADI AXI-I2S controller

This patch adds the devicetree documentation for the ADI AXI-SPDIF audio controller. The controller has:
* One set of memory mapped register
* Two clocks, one for the memory mapped register interface, one used as the audio reference clock
* One DMA interface each for the transmit and receive data

Cc Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Ian Campbell <[email protected]>
---
 .../devicetree/bindings/sound/adi,axi-i2s.txt      | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/adi,axi-i2s.txt
Documentation/devicetree/bindings/sound/adi,axi-i2s.txt new file +29 -0
new file mode 100644
index 0000000..d9c0e53
@@ -0,0 +1,29 @@
+ADI AXI-I2S controller
+
+Required properties:
+ - compatible : Must be "adi,axi-i2s-1.00.a"
+ - reg : Must contain I2S registers location and length
+ - clocks : Clock specifier providing a handle to the controller's clocks. The
+   controller expects two clocks, the clock used for the AXI interface and the
+   clock used as thei sampling rate reference clock sample.
+ - clock-names : "axi" for the clock to the AXI interface, "ref" for the sample
+   rate reference clock.
+ - dma : Specifiers for the DMA channels that are used by the core.
+ - dma-names : "tx" for the transmit channel, "rx" for the receive channel.
+
+For more details on the 'dma', 'dma-names', 'clock' and 'clock-names' properties
+please check:
+	* resource-names.txt
+	* clock/clock-bindings.txt
+	* dma/dma.txt
+
+Example:
+
+	i2s: i2s@0x77600000 {
+		compatible = "adi,axi-i2s-1.00.a";
+		reg = <0x77600000 0x1000>;
+		clocks = <&clk 15 &audio_clock>;
+		clock-names = "axi", "ref";
+		dmas = <&ps7_dma 0 &ps7_dma 1>;
+		dma-names = "tx", "rx";
+	};
Signature · 6 lines
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

PATCH 3/4 dt: Add bindings documentation for the ADI AXI-SPDIF audio controller

In reply to a message not in the archive

This patch adds the devicetree documentation for the ADI AXI-SPDIF audio controller. The controller has:
* One set of memory mapped register
* Two clocks, one for the memory mapped register interface, one used as the audio reference clock
* A DMA interface for the transmit data

Cc Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Ian Campbell <[email protected]>
---
 .../devicetree/bindings/sound/adi,axi-spdif-tx.txt | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt
Documentation/devicetree/bindings/sound/adi,axi-spdif-tx.txt new file +29 -0
new file mode 100644
index 0000000..489ba9be
@@ -0,0 +1,29 @@
+ADI AXI-SPDIF controller
+
+Required properties:
+ - compatible : Must be "adi,axi-spdif-1.00.a"
+ - reg : Must contain SPDIF registers location and length
+ - clocks : Clock specifier providing a handle to the controller's clocks. The
+   controller expects two clocks, the clock used for the AXI interface and the
+   clock used as the sample rate reference clock.
+ - clock-names: "axi" for the clock to the AXI interface, "ref" for the sample
+   rate reference clock.
+ - dma : Phandle to the dma channels for the transmit DMA.
+ - dma-names : Must be "tx"
+
+For more details on the 'dma', 'dma-names', 'clock' and 'clock-names' properties
+please check:
+	* resource-names.txt
+	* clock/clock-bindings.txt
+	* dma/dma.txt
+
+Example:
+
+	spdif: spdif@0x77400000 {
+		compatible = "adi,axi-spdif-tx-1.00.a";
+		reg = <0x77600000 0x1000>;
+		clocks = <&clk 15 &audio_clock>;
+		clock-names = "axi", "ref";
+		dmas = <&ps7_dma 0>;
+		dma-names = "tx";
+	};
Signature · 6 lines
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#2 lore raw

Re: [PATCH 2/4] ASoC: Add support for the Analog Devices AXI-I2S core

In reply to Lars-Peter Clausen

On Thu, Nov 28, 2013 at 08:02:50PM +0100, Lars-Peter Clausen wrote:

A few really minor things below.

Quoted 4 lines

The patch also adds a simple ASoC PCM driver for the PL330 DMA controller using the generic dmaengine PCM driver. This driver is only temporary can be removed once we have all the infrastructure in place to query information like maximum transfer size directly from the dmaengine driver.

It's not really a driver as such, it's just specifying some extra parameters - I'd expect you're going to need to keep the addresses at least. It's probably more accurate to say that at the minute there's some assumptions in the driver about the DMA controller configuration that will be required which should be removable in future?

sound/soc/adi/Kconfig line 6

Quoted 6 lines
sound/soc/adi/Kconfig new file +6 -0
+config SND_SOC_ADI
+	tristate "Audio support for Analog Devices reference designs"
+	depends on SND_SOC && (MICROBLAZE || ARCH_ZYNQ || COMPILE_TEST)
+	help
+	  Audio support for various reference designs by Analog Devices.
+

Given that this is a FPGA IP I'd also expect it to be available on SOCFPGA and probably other things. For the Designware I2S controller we just don't have any platform dependency at all.

There's no need for the SND_SOC dependency, all the subdirectory Kconfigs are only included in an if SND_SOC block.

sound/soc/adi/axi-i2s.c line 94

Quoted 1 line
sound/soc/adi/axi-i2s.c new file +1 -0
+	frame_size = AXI_I2S_BITS_PER_FRAME / 2 - 1;

This isn't obvious - usually the frame size is the number of bits per frame. Looking at the code I guess the hardware is more flexible than the driver allows at the minute?

sound/soc/adi/axi-i2s.c line 98

Quoted 2 lines
sound/soc/adi/axi-i2s.c new file +2 -0
+	regmap_write(i2s->regmap, AXI_I2S_REG_CLK_CTRL, (frame_size << 16) |
+		bclk_div);

update_bits() would be more obvious, though for a memory mapped device it really makes no difference.

maintainer
#7 lore raw

Re: [PATCH 4/4] ASoC: Add support for the Analog Devices AXI-SPDIF driver

In reply to Lars-Peter Clausen
Quoted 4 lines · Lars-Peter Clausen

This patch adds a ASoC driver for the AXI-SPDIF core. The core implements a simple SPDIF transmitter and is used on some Analog Devices' reference designs for various FPGA platforms. For now the driver only support the PL330 as the the DMA controller.

Similar comments to the I2S driver here. I'd probably apply them but I'm holding off in case there is review of the DT bindings.

maintainer
#4 lore raw

Re: [PATCH 2/4] ASoC: Add support for the Analog Devices AXI-I2S core

In reply to Lars-Peter Clausen
Quoted 6 lines · Lars-Peter Clausen

We only use it on ZYNQ and Microblaze though. And people have complained in the past about symbols that are viable on their platform, but are not relevant for their platform. And to use the core on a different FPGA platform will most likely require changes to the core, unless the other FPGA also has a PL330 DMA interface. So I'd prefer to only make it avaiable on ZYNQ and Microblaze right now.

Is it really restricted to PL330 at the hardware level? I don't recall anything too fancy in the datasheet there.

Quoted 8 lines
Quoted 5 lines

sound/soc/adi/axi-i2s.c line 94

Quoted 1 line
sound/soc/adi/axi-i2s.c new file +1 -0
+	frame_size = AXI_I2S_BITS_PER_FRAME / 2 - 1;

This isn't obvious - usually the frame size is the number of bits per frame. Looking at the code I guess the hardware is more flexible than the driver allows at the minute?

that feature at the moment. But I'll add a comment explaining this. And maybe rename the variable from framesize to wordsize.

It definitely needs to be changed to word size.

#5 lore raw

Re: [PATCH 2/4] ASoC: Add support for the Analog Devices AXI-I2S core

Quoted 11 lines · Mark Brown
Quoted 6 lines · Lars-Peter Clausen

We only use it on ZYNQ and Microblaze though. And people have complained in the past about symbols that are viable on their platform, but are not relevant for their platform. And to use the core on a different FPGA platform will most likely require changes to the core, unless the other FPGA also has a PL330 DMA interface. So I'd prefer to only make it avaiable on ZYNQ and Microblaze right now.

Is it really restricted to PL330 at the hardware level? I don't recall anything too fancy in the datasheet there.

Yes, it is using the PL330 peripheral request interface. See
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0424a/index.html
and
https://github.com/analogdevicesinc/fpgahdl_xilinx/blob/master/cf_lib/edk/pcores/adi_common_v1_00_a/hdl/vhdl/pl330_dma_fifo.vhd

- Lars

#3 lore raw

Re: [PATCH 2/4] ASoC: Add support for the Analog Devices AXI-I2S core

In reply to Mark Brown
Quoted 9 lines · Mark Brown

On Thu, Nov 28, 2013 at 08:02:50PM +0100, Lars-Peter Clausen wrote:

A few really minor things below.

Quoted 4 lines

The patch also adds a simple ASoC PCM driver for the PL330 DMA controller using the generic dmaengine PCM driver. This driver is only temporary can be removed once we have all the infrastructure in place to query information like maximum transfer size directly from the dmaengine driver.

Quoted 5 lines

It's not really a driver as such, it's just specifying some extra parameters - I'd expect you're going to need to keep the addresses at least. It's probably more accurate to say that at the minute there's some assumptions in the driver about the DMA controller configuration that will be required which should be removable in future?

Sorry, I forgot to update that paragraph there used to be a separate PCM driver, but it's now all handled by generic PCM driver since it is now able to query the constraints from the DMA driver.

Quoted 11 lines

sound/soc/adi/Kconfig line 6

Quoted 7 lines
sound/soc/adi/Kconfig new file +6 -0
+config SND_SOC_ADI
+	tristate "Audio support for Analog Devices reference designs"
+	depends on SND_SOC && (MICROBLAZE || ARCH_ZYNQ || COMPILE_TEST)
+	help
+	  Audio support for various reference designs by Analog Devices.
+

Given that this is a FPGA IP I'd also expect it to be available on SOCFPGA and probably other things. For the Designware I2S controller we just don't have any platform dependency at all.

We only use it on ZYNQ and Microblaze though. And people have complained in the past about symbols that are viable on their platform, but are not relevant for their platform. And to use the core on a different FPGA platform will most likely require changes to the core, unless the other FPGA also has a PL330 DMA interface. So I'd prefer to only make it avaiable on ZYNQ and Microblaze right now.

Quoted 9 lines

There's no need for the SND_SOC dependency, all the subdirectory Kconfigs are only included in an if SND_SOC block.

sound/soc/adi/axi-i2s.c line 94

Quoted 1 line
sound/soc/adi/axi-i2s.c new file +1 -0
+	frame_size = AXI_I2S_BITS_PER_FRAME / 2 - 1;

This isn't obvious - usually the frame size is the number of bits per frame. Looking at the code I guess the hardware is more flexible than the driver allows at the minute?

The core allows to configure the bitclock cycles per word. Right now the frame size is just hardcoded to 64. It's probably something that could be made configurable by snd_soc_dai_set_bclk_ratio(). But we really don't need that feature at the moment. But I'll add a comment explaining this. And maybe rename the variable from framesize to wordsize.

Thanks for the quick review.

I'll wait for comments on the DT bindings and send out a v2 probably at the end of next week.

- Lars