summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/tlv320.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/tlv320.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/tlv320.c')
-rw-r--r--firmware/drivers/audio/tlv320.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/firmware/drivers/audio/tlv320.c b/firmware/drivers/audio/tlv320.c
index b2c5be8e61..c85627e683 100644
--- a/firmware/drivers/audio/tlv320.c
+++ b/firmware/drivers/audio/tlv320.c
@@ -152,21 +152,21 @@ void audiohw_postinit(void)
152 * 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default) 152 * 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default)
153 * 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2 153 * 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2
154 */ 154 */
155void audiohw_set_frequency(unsigned fsel) 155void audiohw_set_frequency(int fsel)
156{ 156{
157 /* All rates available for 11.2896MHz besides 8.021 */ 157 /* All rates available for 11.2896MHz besides 8.021 */
158 unsigned char values_src[3] = 158 static const unsigned char values_src[HW_NUM_FREQ] =
159 { 159 {
160 /* Fs: */ 160 [HW_FREQ_11] = (0x8 << 2) | SRC_CLKIN,
161 (0x8 << 2) | SRC_CLKIN, /* 11025, 22050 */ 161 [HW_FREQ_22] = (0x8 << 2) | SRC_CLKIN,
162 (0x8 << 2), /* 44100 */ 162 [HW_FREQ_44] = (0x8 << 2),
163 (0xf << 2), /* 88200 */ 163 [HW_FREQ_88] = (0xf << 2),
164 }; 164 };
165 165
166 unsigned value_dap, value_pc; 166 unsigned value_dap, value_pc;
167 167
168 if (fsel >= ARRAYLEN(values_src)) 168 if ((unsigned)fsel >= HW_NUM_FREQ)
169 fsel = 1; 169 fsel = HW_FREQ_DEFAULT;
170 170
171 /* Temporarily turn off the DAC and ADC before switching sample 171 /* Temporarily turn off the DAC and ADC before switching sample
172 rates or they don't choose their filters correctly */ 172 rates or they don't choose their filters correctly */