Add I2S audio support for ARC AXS10x boards
Subsystems (4)
v8 cover Add I2S audio support for ARC AXS10x boards
ARC AXS10x platforms consist of a mainboard with several peripherals. One of those peripherals is an HDMI output port controlled by the ADV7511 transmitter.
This patch set adds I2S audio for the AXS10x platform.
NOTE:
Although the mainline I2S driver uses ALSA DMA engine, this controller can be built without DMA support so it was necessary to add this custom platform driver so that HDMI audio works in AXS boards.
Changes v7 -> v8:
* Build PIO PCM as module
* Always unmask interrupts even when in DMA mode
* Fallback to PIO mode only if ALSA DMA engine probe fails
Changes v6 -> v7:
* Discard the use of memcpy
* Report IRQ_HANDLED only when there is an IRQ
* Use interrupts to check if PIO mode is in use
* Unmask interrupts only when in PIO mode
* Remove empty functions
Changes v5 -> v6:
* Use SNDRV_DMA_TYPE_CONTINUOUS
Changes v4 -> v5:
* Resolve undefined references when compiling as module
* Dropped adv7511 audio patches
* Use DMA properties in I2S to check which mode to use: PIO or DMA (as suggested by Lars-Peter Clausen)
Changes v3 -> v4:
* Reintroduced custom PCM driver (see note below)
* Use DT boolean to switch between ALSA DMA engine PCM or custom PCM
* Use fifo depth to program I2S FCR
* Update I2S documentation
Changes v2 -> v3:
* Removed pll_config functions (as suggested by Alexey Brodkin)
* Removed HDMI start at adv7511_core (as suggested by Archit Taneja)
* Use NOP functions for adv7511_audio (as suggested by Archit Taneja)
* Added adv7511_audio_exit() function (as suggested by Archit Taneja)
* Moved adv7511 to its own folder (as suggested by Archit Taneja)
* Separated file rename of adv7511_core (as suggested by Emil Velikov)
* Compile adv7511 as module if ALSA SoC is compiled as module
* Load adv7511 audio only if declared in device tree (as suggested by Laurent Pinchart)
* Dropped custom platform driver, using now ALSA DMA engine
* Dropped IRQ handler for I2S
Changes v1 -> v2:
* DT bindings moved to separate patch (as suggested by Alexey Brodkin)
* Removed defconfigs entries (as suggested by Alexey Brodkin)
Jose Abreu (2):
ASoC: dwc: Add PIO PCM extension
ASoC: dwc: Add irq parameter to DOCUMENTATION
.../devicetree/bindings/sound/designware-i2s.txt | 4 + sound/soc/dwc/Kconfig | 9 + sound/soc/dwc/Makefile | 1 + sound/soc/dwc/designware_i2s.c | 152 ++++++-------- sound/soc/dwc/designware_pcm.c | 222 +++++++++++++++++++++ sound/soc/dwc/local.h | 122 +++++++++++ 6 files changed, 422 insertions(+), 88 deletions(-) create mode 100644 sound/soc/dwc/designware_pcm.c create mode 100644 sound/soc/dwc/local.h
Signature · 1 line
1.9.1
PATCH v8 1/2 ASoC: dwc: Add PIO PCM extension
A PCM extension was added to I2S driver so that audio samples are transferred using PIO mode.
The PCM supports two channels @ 16 or 32 bits with rates 32k, 44.1k and 48k.
Although the mainline I2S driver uses ALSA DMA engine the I2S controller can be built without DMA support, therefore this is the reason why this extension was added.
---
Changes v7 -> v8:
* Build PIO PCM as module
* Always unmask interrupts even when in DMA mode
* Fallback to PIO mode only if ALSA DMA engine probe fails
Changes v6 -> v7:
* Discard the use of memcpy
* Report IRQ_HANDLED only when there is an IRQ
* Use interrupts to check if PIO mode is in use
* Unmask interrupts only when in PIO mode
* Remove empty functions
Changes v5 -> v6:
* Use SNDRV_DMA_TYPE_CONTINUOUS
Changes v4 -> v5:
* Resolve undefined references when compiling as module
* Use DMA properties in I2S to check which mode to use: PIO or DMA (as suggested by Lars-Peter Clausen)
Changes v3 -> v4:
* Reintroduced custom PCM driver
* Use DT boolean to switch between ALSA DMA engine PCM or custom PCM
Changes v2 -> v3:
* Removed pll_config functions (as suggested by Alexey Brodkin)
* Dropped custom platform driver, using now ALSA DMA engine
* Dropped IRQ handler for I2S
No changes v1 -> v2.
sound/soc/dwc/Kconfig | 9 ++ sound/soc/dwc/Makefile | 1 + sound/soc/dwc/designware_i2s.c | 152 ++++++++++++---------------- sound/soc/dwc/designware_pcm.c | 222 +++++++++++++++++++++++++++++++++++++++++ sound/soc/dwc/local.h | 122 ++++++++++++++++++++++ 5 files changed, 418 insertions(+), 88 deletions(-) create mode 100644 sound/soc/dwc/designware_pcm.c create mode 100644 sound/soc/dwc/local.h
sound/soc/dwc/Kconfig +9 -0
@@ -7,4 +7,13 @@ config SND_DESIGNWARE_I2S Synopsys desigwnware I2S device. The device supports upto maximum of 8 channels each for play and record. +config SND_DESIGNWARE_PCM + tristate "PCM PIO extension for I2S driver" + depends on SND_DESIGNWARE_I2S + help + Say Y, M or N if you want to add a custom ALSA extension that registers + a PCM and uses PIO to transfer data. + + This functionality is specially suited for I2S devices that don't have + DMA support.
sound/soc/dwc/Makefile +1 -0
@@ -1,3 +1,4 @@ # SYNOPSYS Platform Support obj-$(CONFIG_SND_DESIGNWARE_I2S) += designware_i2s.o +obj-$(CONFIG_SND_DESIGNWARE_PCM) += designware_pcm.o
sound/soc/dwc/designware_i2s.c +64 -88
185 lines not on this page · raw message
sound/soc/dwc/designware_pcm.c new file +222 -0
222 lines not on this page · raw message
sound/soc/dwc/local.h new file +122 -0
122 lines not on this page · raw message
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH 1/2 v8] ASoC: dwc: Add PIO PCM extension
On Mon, May 30, 2016 at 10:53:15AM +0100, Jose Abreu wrote:
A few small things but this looks basically fine.
sound/soc/dwc/designware_i2s.c static inline void i2s_enable_irqs(struct dw_i2s_dev *dev, u32 stream, · line 116
Quoted 2 lines
sound/soc/dwc/designware_i2s.c +2
-0+if (isr[i] &0x33 ) + irq_valid = true;
This checks for a mask of 0x33 but...
sound/soc/dwc/designware_i2s.c static inline void i2s_enable_irqs(struct dw_i2s_dev *dev, u32 stream, · line 129
Quoted 13 lines
sound/soc/dwc/designware_i2s.c +13
-0+ +/* +* Check if TX fifo is empty. If empty fill FIFO with samples +* NOTE: Only two channels supported +*/ +if ((isr[i] &0x10 ) && (i ==0 ) && dev->use_pio) +dw_pcm_push_tx (dev); + +/* Error Handling */ +if (isr[i] &0x20 ) +dev_err (dev->dev,"TX overrun (ch_id=%d)\n" , i); +if (isr[i] &0x02 ) +dev_err (dev->dev,"RX overrun (ch_id=%d)\n" , i);
...only 0x32 seem to actually be handled, and then only sometimes. It's going to be clearer and more robust to just set the handled flag to true when handling, that way we don't have to match up different numerical masks. Some defines would help legibility too.
sound/soc/dwc/designware_pcm.c line 145
Quoted 3 lines
sound/soc/dwc/designware_pcm.c new file +3
-0+ ret =snd_pcm_lib_malloc_pages (substream, +params_buffer_bytes (hw_params)); +return (ret <0 ) ? ret :0 ;
Write normal if statements please, it helps legibility.
PATCH v8 2/2 ASoC: dwc: Add irq parameter to DOCUMENTATION
In reply to Jose AbreuA parameter description for the interruptions of the I2S controller was added.
---
No changes v7 -> v8.
Changes v6 -> v7:
* interrupts is now optional property
No changes v5 -> v6.
Changes v4 -> v5:
* interrupts is now required property
* Drop 'snps-use-dmaengine' property
This patch was only introduced in v4.
Documentation/devicetree/bindings/sound/designware-i2s.txt | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/sound/designware-i2s.txt +4 -0
@@ -12,6 +12,10 @@ Required properties: one for receive. - dma-names : "tx" for the transmit channel, "rx" for the receive channel. +Optional properties: + - interrupts: The interrupt line number for the I2S controller. Add this + parameter if the I2S controller that you are using does not support DMA. + For more details on the 'dma', 'dma-names', 'clock' and 'clock-names' properties please check: * resource-names.txt
Signature · 1 line
1.9.1