summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/pcm-as3525.c
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2009-11-03 08:14:28 +0000
committerRafaël Carré <rafael.carre@gmail.com>2009-11-03 08:14:28 +0000
commit9b46960baf2e19290f0761020609f78b82457263 (patch)
tree265cd99981495b7956386767b0556094159b6d06 /firmware/target/arm/as3525/pcm-as3525.c
parent00997714ef51f9ac046428041769e32a023635fd (diff)
Sansa AMS PCM : cleanup
Init CGU_AUDIO with correct clock source (for play & rec) Do not disable recording clocks when starting playback, they are already disabled Move clock enable/disable code from dma callback to init git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23493 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/pcm-as3525.c')
-rw-r--r--firmware/target/arm/as3525/pcm-as3525.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/firmware/target/arm/as3525/pcm-as3525.c b/firmware/target/arm/as3525/pcm-as3525.c
index 26e018c82f..2de047b8f0 100644
--- a/firmware/target/arm/as3525/pcm-as3525.c
+++ b/firmware/target/arm/as3525/pcm-as3525.c
@@ -64,13 +64,6 @@ static void play_start_pcm(void)
dma_size -= size;
dma_start_addr += size;
- CGU_PERI |= CGU_I2SOUT_APB_CLOCK_ENABLE;
- CGU_AUDIO |= (1<<11);
-#ifdef HAVE_RECORDING
- CGU_PERI &= ~CGU_I2SIN_APB_CLOCK_ENABLE;
- CGU_AUDIO &= ~(1<<23);
-#endif
-
clean_dcache_range((void*)addr, size); /* force write back */
dma_enable_channel(1, (void*)addr, (void*)I2SOUT_DATA, DMA_PERI_I2SOUT,
DMAC_FLOWCTRL_DMAC_MEM_TO_PERI, true, false, size >> 2, DMA_S1,
@@ -102,6 +95,11 @@ void pcm_play_dma_start(const void *addr, size_t size)
dma_retain();
+ I2SOUT_CONTROL |= 1<<6; /* dma */
+
+ CGU_PERI |= CGU_I2SOUT_APB_CLOCK_ENABLE;
+ CGU_AUDIO |= (1<<11);
+
play_start_pcm();
}
@@ -128,10 +126,9 @@ void pcm_play_dma_init(void)
{
CGU_PERI |= CGU_I2SOUT_APB_CLOCK_ENABLE;
- /* clock source PLLA, minimal frequency */
- CGU_AUDIO |= (511<<2) | (1<<0);
+ CGU_AUDIO = (CGU_AUDIO & ~(3<<0)) | (1<<0); /* clock source PLLA */
- I2SOUT_CONTROL = (1<<6)|(1<<3) /* enable dma, stereo */;
+ I2SOUT_CONTROL = (1<<3) /* stereo */;
audiohw_preinit();
}
@@ -290,6 +287,7 @@ void pcm_rec_dma_close(void)
void pcm_rec_dma_init(void)
{
+ CGU_AUDIO = (CGU_AUDIO & ~(3<<12)) | (1<<12); /* clock source = PLLA */
pcm_dma_apply_settings();
}