summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/uda1380.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-12 11:01:07 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-12 11:01:07 +0000
commite69d567d9ebf7d236ff9663b11ac396cc71dcd75 (patch)
tree093b9d1bc979d79be1fcd0daac1d8daf8ac55503 /firmware/drivers/audio/uda1380.c
parent0ad97d13fc52b28de566dc0ddaf7245583eec2cc (diff)
downloadrockbox-e69d567d9ebf7d236ff9663b11ac396cc71dcd75.tar.gz
rockbox-e69d567d9ebf7d236ff9663b11ac396cc71dcd75.zip
Bring consistency to pcm implementation and samplerate handling. Less low-level duplication. A small test_sampr fix so it works on coldfire again.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19400 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/audio/uda1380.c')
-rw-r--r--firmware/drivers/audio/uda1380.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c
index a0e7ef56d8..efe02caca8 100644
--- a/firmware/drivers/audio/uda1380.c
+++ b/firmware/drivers/audio/uda1380.c
@@ -218,23 +218,38 @@ static void reset(void)
218 * 11025: 0 = 6.25 to 12.5 MCLK/2 SCLK, LRCK: Audio Clk / 16 218 * 11025: 0 = 6.25 to 12.5 MCLK/2 SCLK, LRCK: Audio Clk / 16
219 * 22050: 1 = 12.5 to 25 MCLK/2 SCLK, LRCK: Audio Clk / 8 219 * 22050: 1 = 12.5 to 25 MCLK/2 SCLK, LRCK: Audio Clk / 8
220 * 44100: 2 = 25 to 50 MCLK SCLK, LRCK: Audio Clk / 4 (default) 220 * 44100: 2 = 25 to 50 MCLK SCLK, LRCK: Audio Clk / 4 (default)
221 * 88200: 3 = 50 to 100 MCLK SCLK, LRCK: Audio Clk / 2 <= TODO: Needs WSPLL 221 * 88200: 3 = 50 to 100 MCLK SCLK, LRCK: Audio Clk / 2
222 */ 222 */
223void audiohw_set_frequency(unsigned fsel) 223void audiohw_set_frequency(int fsel)
224{ 224{
225 static const unsigned short values_reg[4][2] = 225 static const unsigned short values_reg[HW_NUM_FREQ][2] =
226 { 226 {
227 /* Fs: */ 227 [HW_FREQ_11] = /* Fs: */
228 { 0, WSPLL_625_125 | SYSCLK_512FS }, /* 11025 */ 228 {
229 { 0, WSPLL_125_25 | SYSCLK_256FS }, /* 22050 */ 229 0,
230 { MIX_CTL_SEL_NS, WSPLL_25_50 | SYSCLK_256FS }, /* 44100 */ 230 WSPLL_625_125 | SYSCLK_512FS
231 { MIX_CTL_SEL_NS, WSPLL_50_100 | SYSCLK_256FS }, /* 88200 */ 231 },
232 [HW_FREQ_22] =
233 {
234 0,
235 WSPLL_125_25 | SYSCLK_256FS
236 },
237 [HW_FREQ_44] =
238 {
239 MIX_CTL_SEL_NS,
240 WSPLL_25_50 | SYSCLK_256FS
241 },
242 [HW_FREQ_88] =
243 {
244 MIX_CTL_SEL_NS,
245 WSPLL_50_100 | SYSCLK_256FS
246 },
232 }; 247 };
233 248
234 const unsigned short *ent; 249 const unsigned short *ent;
235 250
236 if (fsel >= ARRAYLEN(values_reg)) 251 if ((unsigned)fsel >= HW_NUM_FREQ)
237 fsel = 2; 252 fsel = HW_FREQ_DEFAULT;
238 253
239 ent = values_reg[fsel]; 254 ent = values_reg[fsel];
240 255