diff options
-rw-r--r-- | firmware/drivers/wm8758.c | 6 | ||||
-rw-r--r-- | firmware/sound.c | 22 |
2 files changed, 12 insertions, 16 deletions
diff --git a/firmware/drivers/wm8758.c b/firmware/drivers/wm8758.c index ea670230b9..aec6f3b598 100644 --- a/firmware/drivers/wm8758.c +++ b/firmware/drivers/wm8758.c | |||
@@ -147,12 +147,6 @@ void wmcodec_enable_output(bool enable) | |||
147 | 147 | ||
148 | int wmcodec_set_master_vol(int vol_l, int vol_r) | 148 | int wmcodec_set_master_vol(int vol_l, int vol_r) |
149 | { | 149 | { |
150 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ | ||
151 | /* 1111111 == +6dB */ | ||
152 | /* 1111001 == 0dB */ | ||
153 | /* 0110000 == -73dB */ | ||
154 | /* 0101111 == mute (0x2f) */ | ||
155 | |||
156 | /* OUT1 */ | 150 | /* OUT1 */ |
157 | wm8758_write(LOUT1VOL, vol_l); | 151 | wm8758_write(LOUT1VOL, vol_l); |
158 | wm8758_write(ROUT1VOL, 0x100 | vol_r); | 152 | wm8758_write(ROUT1VOL, 0x100 | vol_r); |
diff --git a/firmware/sound.c b/firmware/sound.c index f1c9ff79e7..501e01e2d4 100644 --- a/firmware/sound.c +++ b/firmware/sound.c | |||
@@ -76,7 +76,7 @@ static const struct sound_settings_info sound_settings_table[] = { | |||
76 | [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, | 76 | [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, |
77 | [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, | 77 | [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, |
78 | #elif defined(HAVE_WM8758) | 78 | #elif defined(HAVE_WM8758) |
79 | [SOUND_VOLUME] = {"dB", 0, 1, -57, 6, -25, sound_set_volume}, | 79 | [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25, sound_set_volume}, |
80 | [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, | 80 | [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, |
81 | [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, | 81 | [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, |
82 | #elif defined(HAVE_WM8731) | 82 | #elif defined(HAVE_WM8731) |
@@ -324,20 +324,22 @@ static int tenthdb2mixer(int db) | |||
324 | 324 | ||
325 | #elif defined(HAVE_WM8758) | 325 | #elif defined(HAVE_WM8758) |
326 | /* volume/balance/treble/bass interdependency */ | 326 | /* volume/balance/treble/bass interdependency */ |
327 | #define VOLUME_MIN -730 | 327 | #define VOLUME_MIN -570 |
328 | #define VOLUME_MAX 60 | 328 | #define VOLUME_MAX 60 |
329 | 329 | ||
330 | /* convert tenth of dB volume (-730..60) to master volume register value */ | 330 | /* convert tenth of dB volume (-57..6) to master volume register value */ |
331 | static int tenthdb2master(int db) | 331 | static int tenthdb2master(int db) |
332 | { | 332 | { |
333 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ | 333 | /* +6 to -57dB in 1dB steps == 64 levels = 6 bits */ |
334 | /* 1111111 == +6dB (0x7f) */ | 334 | /* 0111111 == +6dB (0x3f) = 63) */ |
335 | /* 1111001 == 0dB (0x79) */ | 335 | /* 0111001 == 0dB (0x39) = 57) */ |
336 | /* 0110000 == -73dB (0x30 */ | 336 | /* 0000001 == -56dB (0x01) = */ |
337 | /* 0101111 == mute (0x2f) */ | 337 | /* 0000000 == -57dB (0x00) */ |
338 | 338 | ||
339 | if (db <= -570) { | 339 | /* 1000000 == Mute (0x40) */ |
340 | return 0x0; | 340 | |
341 | if (db < -570) { | ||
342 | return 0x40; | ||
341 | } else { | 343 | } else { |
342 | return((db/10)+57); | 344 | return((db/10)+57); |
343 | } | 345 | } |