From 828d719ac1180d9d0862d3ada7f9a7afc65c1035 Mon Sep 17 00:00:00 2001 From: Steve Gotthardt Date: Fri, 13 Jul 2007 04:18:31 +0000 Subject: Changes bass setting to use adaptive bass instead of linear bass. The datasheet recommends it and it should stop clipping on bass. Steve Gotthardt. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13867 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/audio/wm8751.c | 25 +++++++++++++++++++++++++ firmware/export/config-gigabeat.h | 3 +++ 2 files changed, 28 insertions(+) diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c index 426036aab0..4a17496111 100644 --- a/firmware/drivers/audio/wm8751.c +++ b/firmware/drivers/audio/wm8751.c @@ -31,7 +31,11 @@ const struct sound_settings_info audiohw_settings[] = { [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, +#ifdef USE_ADAPTIVE_BASS + [SOUND_BASS] = {"", 0, 1, 0, 15, 0}, +#else [SOUND_BASS] = {"dB", 1, 15, -60, 90, 0}, +#endif [SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0}, [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, @@ -47,7 +51,11 @@ const struct sound_settings_info audiohw_settings[] = { #define LOUT2_BITS (LOUT2_LO2ZC) #define ROUT2_BITS (ROUT2_RO2ZC | ROUT2_RO2VU) /* We use linear bass control with 200 Hz cutoff */ +#ifdef USE_ADAPTIVE_BASE +#define BASSCTRL_BITS (BASSCTRL_BC | BASSCTRL_BB) +#else #define BASSCTRL_BITS (BASSCTRL_BC) +#endif /* We use linear treble control with 4 kHz cutoff */ #define TREBCTRL_BITS (TREBCTRL_TC) @@ -85,6 +93,18 @@ static int tone_tenthdb2hw(int value) return value; } + +#ifdef USE_ADAPTIVE_BASS +static int adaptivebass2hw(int value) +{ + /* 0 to 15 step 1 - step -1 0 = off is a 15 in the register */ + value = 15 - value; + + return value; +} +#endif + + void audiohw_reset(void); /* Reset and power up the WM8751 */ @@ -162,7 +182,12 @@ int audiohw_set_mixer_vol(int channel1, int channel2) void audiohw_set_bass(int value) { wmcodec_write(BASSCTRL, BASSCTRL_BITS | + +#ifdef USE_ADAPTIVE_BASS + BASSCTRL_BASS(adaptivebass2hw(value))); +#else BASSCTRL_BASS(tone_tenthdb2hw(value))); +#endif } void audiohw_set_treble(int value) diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 5f45bdbff0..6264ab5087 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h @@ -70,6 +70,9 @@ /* Define this if you have the WM8975 audio codec */ #define HAVE_WM8751 +/* Define this if you want to use the adaptive bass capibility of the 8751 */ +#define USE_ADAPTIVE_BASS + #define BATTERY_CAPACITY_DEFAULT 2000 /* default battery capacity */ #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | \ -- cgit v1.2.3