summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/wm8751.c
diff options
context:
space:
mode:
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}