summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2013-01-09 21:44:23 +0100
committerCástor Muñoz <cmvidal@gmail.com>2013-01-09 22:08:28 +0100
commit758a3ae4bb2f9bd02b99f11a9828f172ee2a0328 (patch)
treecfb67d6b842d9e7d6e72f34de198f53ba023cb06
parent17e57e329184d7ef32151a68d2b3481efaa6089c (diff)
downloadrockbox-758a3ae4bb2f9bd02b99f11a9828f172ee2a0328.tar.gz
rockbox-758a3ae4bb2f9bd02b99f11a9828f172ee2a0328.zip
iPod Classic/6G: PCM support for all CS42L55 rates
pcm_dma_apply_settings(): sets the configured PCM frequency, all native CS42L55 sample rates are available. Change-Id: I2fcd5581457a669c3044516804cb64fb972218d0
-rw-r--r--firmware/export/s5l8702.h2
-rw-r--r--firmware/target/arm/s5l8702/pcm-s5l8702.c18
2 files changed, 14 insertions, 6 deletions
diff --git a/firmware/export/s5l8702.h b/firmware/export/s5l8702.h
index 278bd1b0e8..b7da971b49 100644
--- a/firmware/export/s5l8702.h
+++ b/firmware/export/s5l8702.h
@@ -807,7 +807,7 @@ struct dma_lli
807#define I2SRXCOM (*((volatile uint32_t*)(0x3CA00034))) 807#define I2SRXCOM (*((volatile uint32_t*)(0x3CA00034)))
808#define I2SRXDB (*((volatile uint32_t*)(0x3CA00038))) 808#define I2SRXDB (*((volatile uint32_t*)(0x3CA00038)))
809#define I2SSTATUS (*((volatile uint32_t*)(0x3CA0003C))) 809#define I2SSTATUS (*((volatile uint32_t*)(0x3CA0003C)))
810#define I2S40 (*((volatile uint32_t*)(0x3CA00040))) 810#define I2SCLKDIV (*((volatile uint32_t*)(0x3CA00040)))
811 811
812 812
813/////CLOCK GATES///// 813/////CLOCK GATES/////
diff --git a/firmware/target/arm/s5l8702/pcm-s5l8702.c b/firmware/target/arm/s5l8702/pcm-s5l8702.c
index 1974c47d51..cbfe6ea007 100644
--- a/firmware/target/arm/s5l8702/pcm-s5l8702.c
+++ b/firmware/target/arm/s5l8702/pcm-s5l8702.c
@@ -139,16 +139,28 @@ void pcm_play_dma_pause(bool pause)
139 else I2STXCOM &= ~1; 139 else I2STXCOM &= ~1;
140} 140}
141 141
142/* MCLK = 12MHz (MCLKDIV2=1), [CS42L55 DS, s4.8] */
143#define MCLK_FREQ 12000000
144
145/* set the configured PCM frequency */
146void pcm_dma_apply_settings(void)
147{
148 /* configure I2S clock ratio */
149 I2SCLKDIV = MCLK_FREQ / hw_freq_sampr[pcm_fsel];
150 /* select CS42L55 sample rate */
151 audiohw_set_frequency(pcm_fsel);
152}
153
142void pcm_play_dma_init(void) 154void pcm_play_dma_init(void)
143{ 155{
144 PWRCON(0) &= ~(1 << 4); 156 PWRCON(0) &= ~(1 << 4);
145 PWRCON(1) &= ~(1 << 7); 157 PWRCON(1) &= ~(1 << 7);
146 I2S40 = 0x110;
147 I2STXCON = 0xb100019; 158 I2STXCON = 0xb100019;
148 I2SCLKCON = 1; 159 I2SCLKCON = 1;
149 VIC0INTENABLE = 1 << IRQ_DMAC0; 160 VIC0INTENABLE = 1 << IRQ_DMAC0;
150 161
151 audiohw_preinit(); 162 audiohw_preinit();
163 pcm_dma_apply_settings();
152} 164}
153 165
154void pcm_play_dma_postinit(void) 166void pcm_play_dma_postinit(void)
@@ -156,10 +168,6 @@ void pcm_play_dma_postinit(void)
156 audiohw_postinit(); 168 audiohw_postinit();
157} 169}
158 170
159void pcm_dma_apply_settings(void)
160{
161}
162
163size_t pcm_get_bytes_waiting(void) 171size_t pcm_get_bytes_waiting(void)
164{ 172{
165 int bytes = pcm_remaining; 173 int bytes = pcm_remaining;