summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2014-11-18 03:08:31 +0100
committerCástor Muñoz <cmvidal@gmail.com>2014-11-18 06:22:32 +0100
commit794169a18f644eea32de20b26646381137545e2d (patch)
tree2fadf3085b8ce698f6cd1c8b80ea181e0e20d314 /firmware/target/arm
parent61206ce4689458f4031fa27a89f35d52b5554371 (diff)
downloadrockbox-794169a18f644eea32de20b26646381137545e2d.tar.gz
rockbox-794169a18f644eea32de20b26646381137545e2d.zip
iPod Classic: fix HW_FREQ_32
Change-Id: I1e1b4e6ceb92eb793affaefc61ab082d5da735b4
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/s5l8702/pcm-s5l8702.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/firmware/target/arm/s5l8702/pcm-s5l8702.c b/firmware/target/arm/s5l8702/pcm-s5l8702.c
index cbfe6ea007..1048354ec5 100644
--- a/firmware/target/arm/s5l8702/pcm-s5l8702.c
+++ b/firmware/target/arm/s5l8702/pcm-s5l8702.c
@@ -145,10 +145,39 @@ void pcm_play_dma_pause(bool pause)
145/* set the configured PCM frequency */ 145/* set the configured PCM frequency */
146void pcm_dma_apply_settings(void) 146void pcm_dma_apply_settings(void)
147{ 147{
148 static uint16_t last_clkcon3l = 0;
149 uint16_t clkcon3l;
150 int fsel;
151
152 /* For unknown reasons, s5l8702 I2S controller does not synchronize
153 * with CS42L55 at 32000 Hz. To fix it, the CODEC is configured with
154 * a sample rate of 48000 Hz and MCLK is decreased 1/3 to 8 Mhz,
155 * obtaining 32 KHz in LRCK controller input and 8 MHz in SCLK input.
156 * OF uses this trick.
157 */
158 if (pcm_fsel == HW_FREQ_32) {
159 fsel = HW_FREQ_48;
160 clkcon3l = 0x3028; /* PLL2 / 3 / 9 -> 8 MHz */
161 }
162 else {
163 fsel = pcm_fsel;
164 clkcon3l = 0; /* OSC0 -> 12 MHz */
165 }
166
167 /* configure MCLK */
168 /* TODO: maybe all CLKCON management should be moved to
169 cscodec-ipod6g.c and system-s5l8702.c */
170 if (last_clkcon3l != clkcon3l) {
171 CLKCON3 = (CLKCON3 & ~0xffff) | 0x8000 | clkcon3l;
172 udelay(100);
173 CLKCON3 &= ~0x8000; /* CLKCON3L on */
174 last_clkcon3l = clkcon3l;
175 }
176
148 /* configure I2S clock ratio */ 177 /* configure I2S clock ratio */
149 I2SCLKDIV = MCLK_FREQ / hw_freq_sampr[pcm_fsel]; 178 I2SCLKDIV = MCLK_FREQ / hw_freq_sampr[fsel];
150 /* select CS42L55 sample rate */ 179 /* select CS42L55 sample rate */
151 audiohw_set_frequency(pcm_fsel); 180 audiohw_set_frequency(fsel);
152} 181}
153 182
154void pcm_play_dma_init(void) 183void pcm_play_dma_init(void)