From 90a4f28c2799e3ae5e873f1f34b1e4adb59f77cb Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 4 Sep 2020 15:55:11 -0400 Subject: jz47xx: Audio path tweaks: * Increase audio buffer size to better handle IRQ latency (256->2048) * Ensure DMA engine is idle prior to starting transfers * Set AIC to repeat last sample in case of underflows Change-Id: I9c45c20481ee072e5882b7586fb7d50bd8ef2f35 --- firmware/target/mips/ingenic_jz47xx/codec-jz4740.c | 1 + firmware/target/mips/ingenic_jz47xx/codec-jz4760.c | 1 + firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c | 2 ++ firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c | 2 ++ 4 files changed, 6 insertions(+) (limited to 'firmware/target') diff --git a/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c b/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c index 702f3bb50e..a41f047026 100644 --- a/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c @@ -267,6 +267,7 @@ void audiohw_postinit(void) void audiohw_init(void) { + __aic_play_lastsample(); /* on FIFO underflow */ i2s_codec_init(); } diff --git a/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c b/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c index bc4286fd6a..60bfecb08c 100644 --- a/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c +++ b/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c @@ -115,6 +115,7 @@ void audiohw_init(void) __cpm_start_aic(); /* Init AIC */ + __aic_play_lastsample(); /* on FIFO underflow. Versus 0.. */ __i2s_enable_sclk(); __i2s_external_codec(); __i2s_select_msbjustified(); diff --git a/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c index 00a2b22591..ef2597ae69 100644 --- a/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c @@ -137,6 +137,8 @@ void DMA_CALLBACK(DMA_AIC_TX_CHANNEL)(void) void pcm_play_dma_start(const void *addr, size_t size) { + pcm_play_dma_stop(); + dma_enable(); set_dma(addr, size); diff --git a/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c b/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c index 59b086e4f8..098c28ecf5 100644 --- a/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c +++ b/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c @@ -128,6 +128,8 @@ void DMA_CALLBACK(DMA_AIC_TX_CHANNEL)(void) void pcm_play_dma_start(const void *addr, size_t size) { + pcm_play_dma_stop(); + __dmac_channel_enable_clk(DMA_AIC_TX_CHANNEL); set_dma(addr, size); -- cgit v1.2.3