diff options
Diffstat (limited to 'firmware/drivers/audio/uda1380.c')
-rw-r--r-- | firmware/drivers/audio/uda1380.c | 35 |
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 | */ |
223 | void audiohw_set_frequency(unsigned fsel) | 223 | void 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 | ||