summaryrefslogtreecommitdiff
path: root/firmware/sound.c
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-03-07 15:00:29 +0000
committerThom Johansen <thomj@rockbox.org>2007-03-07 15:00:29 +0000
commit2d7bb99c524c5da0d3360161f298503dcfbb01c7 (patch)
treeedd8a481f7b1ae3ea2f8800ce937e1b0344136a3 /firmware/sound.c
parenta844a1833766d45acee28d37ffd0acc938be0fbd (diff)
downloadrockbox-2d7bb99c524c5da0d3360161f298503dcfbb01c7.tar.gz
rockbox-2d7bb99c524c5da0d3360161f298503dcfbb01c7.zip
Hack around the lack of a hardware prescaler on a number of WM codecs. Bass and treble controls should work on DAPs using these chips now, but will be prone to distort when boosting bass. Gut out UDA1380 code(!!) and switch to high bass cutoff and low treble cutoff in WM8975 driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12673 a1c6a512-1295-4272-9138-f99709370657
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