summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/wm8751.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/wm8751.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/wm8751.c')
-rw-r--r--firmware/drivers/audio/wm8751.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c
index 2e0eb06dbf..79c7396629 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -229,8 +229,18 @@ void audiohw_close(void)
229 wmcodec_write(PWRMGMT1, 0x0); 229 wmcodec_write(PWRMGMT1, 0x0);
230} 230}
231 231
232/* Note: Disable output before calling this function */
233void audiohw_set_frequency(int fsel) 232void audiohw_set_frequency(int fsel)
234{ 233{
235 wmcodec_write(CLOCKING, fsel); 234 static const unsigned char srctrl_table[HW_NUM_FREQ] =
235 {
236 HW_HAVE_11_([HW_FREQ_11] = CODEC_SRCTRL_11025HZ,)
237 HW_HAVE_22_([HW_FREQ_22] = CODEC_SRCTRL_22050HZ,)
238 HW_HAVE_44_([HW_FREQ_44] = CODEC_SRCTRL_44100HZ,)
239 HW_HAVE_88_([HW_FREQ_88] = CODEC_SRCTRL_88200HZ,)
240 };
241
242 if ((unsigned)fsel >= HW_NUM_FREQ)
243 fsel = HW_FREQ_DEFAULT;
244
245 wmcodec_write(CLOCKING, srctrl_table[fsel]);
236} 246}