summaryrefslogtreecommitdiff
path: root/firmware/sound.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/sound.c')
-rw-r--r--firmware/sound.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/firmware/sound.c b/firmware/sound.c
index 01d76a0a39..6182e6b567 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -312,9 +312,14 @@ int current_bass = 0; /* -150..+150 0..+240 */
312 312
313static void set_prescaled_volume(void) 313static void set_prescaled_volume(void)
314{ 314{
315 int prescale; 315 int prescale = 0;
316 int l, r; 316 int l, r;
317 317
318/* The WM codecs listed don't have suitable prescaler functionality, so we let
319 * the prescaler stay at 0 for these unless SW tone controls are in use */
320#if defined(HAVE_SW_TONE_CONTROLS) || !(defined(HAVE_WM8975) \
321 || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751))
322
318 prescale = MAX(current_bass, current_treble); 323 prescale = MAX(current_bass, current_treble);
319 if (prescale < 0) 324 if (prescale < 0)
320 prescale = 0; /* no need to prescale if we don't boost 325 prescale = 0; /* no need to prescale if we don't boost
@@ -325,13 +330,13 @@ static void set_prescaled_volume(void)
325 * instead (might cause clipping). */ 330 * instead (might cause clipping). */
326 if (current_volume + prescale > VOLUME_MAX) 331 if (current_volume + prescale > VOLUME_MAX)
327 prescale = VOLUME_MAX - current_volume; 332 prescale = VOLUME_MAX - current_volume;
328 333#endif
334
329#if defined(HAVE_SW_TONE_CONTROLS) 335#if defined(HAVE_SW_TONE_CONTROLS)
330 dsp_callback(DSP_CALLBACK_SET_PRESCALE, prescale); 336 dsp_callback(DSP_CALLBACK_SET_PRESCALE, prescale);
331#elif CONFIG_CODEC == MAS3507D 337#elif CONFIG_CODEC == MAS3507D
332 mas_writereg(MAS_REG_KPRESCALE, prescale_table[prescale/10]); 338 mas_writereg(MAS_REG_KPRESCALE, prescale_table[prescale/10]);
333#elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \ 339#elif defined(HAVE_UDA1380) || defined(HAVE_WM8758)
334 || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751)
335 audiohw_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale)); 340 audiohw_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale));
336#endif 341#endif
337 342