diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c index 26123456b6..831f16ab17 100644 --- a/firmware/drivers/audio/wm8751.c +++ b/firmware/drivers/audio/wm8751.c @@ -79,7 +79,7 @@ static int tone_tenthdb2hw(int value) /* -6.0db..+0db..+9.0db step 1.5db - translate -60..+0..+90 step 15 to 10..6..0 step -1. */ - value = (10 - (value + 60) / 15) / 10; + value = 10 - (value + 60) / 15; if (value == 6) value = 0xf; /* 0db -> off */ diff --git a/firmware/sound.c b/firmware/sound.c index 325c42639a..97d4bc268c 100644 --- a/firmware/sound.c +++ b/firmware/sound.c @@ -35,6 +35,10 @@ #endif #endif +/* TODO + * find a nice way to handle 1.5db steps -> see wm8751 ifdef in sound_set_bass/treble +*/ + #if !defined(VOLUME_MIN) && !defined(VOLUME_MAX) #warning define for VOLUME_MIN and VOLUME_MAX is missing #define VOLUME_MIN -400 @@ -370,7 +374,11 @@ void sound_set_bass(int value) #endif #if (CONFIG_CODEC != MAS3587F) && (CONFIG_CODEC != MAS3539F) - current_bass = value * 10; +#if defined(HAVE_WM8751) + current_bass = value; +#else + current_bass = value * 10; +#endif set_prescaled_volume(); #endif } @@ -387,7 +395,11 @@ void sound_set_treble(int value) #endif #if (CONFIG_CODEC != MAS3587F) && (CONFIG_CODEC != MAS3539F) - current_treble = value * 10; +#if defined(HAVE_WM8751) + current_treble = value; +#else + current_treble = value * 10; +#endif set_prescaled_volume(); #endif }