ASoC: davinci-mcasp: Add overrun/underrun event handling
Subsystems (3)
PATCH v3 1/1 ASoC: davinci-mcasp: Add overrun/underrun event handling
From: Misael Lopez Cruz <[email protected]>
An underrun (playback) event occurs when the serializer transfer data from the XRBUF buffer to the XRSR shift register, but the XRBUF hasn't been filled. Similarly, the overrun (capture) event occurs when data from the XRSR shift register is transferred to the XRBUF but it hasn't been read yet.
These events are handled as XRUN events that cause the pcm to stop. The stream has to be explicitly restarted by the userspace which ensures that after stopping/starting McASP the data transfer is aligned with DMA. The other possibility was to internally stop and start McASP without DMA even knowing about it.
---
Hi,
Chanhes since v2:
- From interrupt handler return IRQ_HANDLED or IRQ_NONE depending on if we have handled event or not.
Changes since v1:
- only ack handled interrupt (over/underflow at the moment)
- Use variable to keep track of requested irq sources for future use
- print warning in case of not handled interrupt.
Regards,
Peter
.../bindings/sound/davinci-mcasp-audio.txt | 2 +- sound/soc/davinci/davinci-mcasp.c | 124 +++++++++++++++++++++ sound/soc/davinci/davinci-mcasp.h | 11 ++ 3 files changed, 136 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +1 -1
@@ -32,7 +32,7 @@ Optional properties: - rx-num-evt : FIFO levels. - sram-size-playback : size of sram to be allocated during playback - sram-size-capture : size of sram to be allocated during capture -- interrupts : Interrupt numbers for McASP, currently not used by the driver +- interrupts : Interrupt numbers for McASP - interrupt-names : Known interrupt names are "tx" and "rx" - pinctrl-0: Should specify pin control group used for this controller. - pinctrl-names: Should contain only one value - "default", for more details
sound/soc/davinci/davinci-mcasp.c +124 -0
190 lines not on this page · raw message
sound/soc/davinci/davinci-mcasp.h +11 -0
@@ -256,6 +256,7 @@* DAVINCI_MCASP_TXSTAT_REG - Transmitter Status Register Bits * DAVINCI_MCASP_RXSTAT_REG - Receiver Status Register Bits */ +#define XRERR BIT(8)/* Transmit/Receive error */ #define XRDATA BIT(5)/* Transmit/Receive data ready */ /*
@@ -285,6 +286,16 @@#define TXDATADMADIS BIT(0)/* +* DAVINCI_MCASP_EVTCTLR_REG - Receiver Interrupt Control Register Bits +*/ +#define ROVRN BIT(0) + +/* +* DAVINCI_MCASP_EVTCTLX_REG - Transmitter Interrupt Control Register Bits +*/ +#define XUNDRN BIT(0) + +/* * DAVINCI_MCASP_W[R]FIFOCTL - Write/Read FIFO Control Register bits */ #define FIFO_ENABLE BIT(16)
Signature · 1 line
2.1.3
Quoted 4 lines · Peter Ujfalusi
From: Misael Lopez Cruz <[email protected]>
An underrun (playback) event occurs when the serializer transfer data from the XRBUF buffer to the XRSR shift register, but the
Applied, thanks.