diff options
author | Dave Chapman <dave@dchapman.com> | 2006-02-28 00:58:19 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2006-02-28 00:58:19 +0000 |
commit | 71ee68e97873978f1bb1f3fd63511f7c9396b965 (patch) | |
tree | 10e333dbe5118bb8eb10c73229afd089278798b4 | |
parent | 9b1c9db66e1c9c0fc55164ca6e7cf1b95399a7ca (diff) |
iPod 5G: Correctly implement mute when setting volume
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8863 a1c6a512-1295-4272-9138-f99709370657
-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) int wmcodec_set_master_vol(int vol_l, int vol_r) { - /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ - /* 1111111 == +6dB */ - /* 1111001 == 0dB */ - /* 0110000 == -73dB */ - /* 0101111 == mute (0x2f) */ - /* OUT1 */ wm8758_write(LOUT1VOL, vol_l); 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[] = { [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, #elif defined(HAVE_WM8758) - [SOUND_VOLUME] = {"dB", 0, 1, -57, 6, -25, sound_set_volume}, + [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25, sound_set_volume}, [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass}, [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, #elif defined(HAVE_WM8731) @@ -324,20 +324,22 @@ static int tenthdb2mixer(int db) #elif defined(HAVE_WM8758) /* volume/balance/treble/bass interdependency */ -#define VOLUME_MIN -730 +#define VOLUME_MIN -570 #define VOLUME_MAX 60 -/* convert tenth of dB volume (-730..60) to master volume register value */ +/* convert tenth of dB volume (-57..6) to master volume register value */ static int tenthdb2master(int db) { - /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ - /* 1111111 == +6dB (0x7f) */ - /* 1111001 == 0dB (0x79) */ - /* 0110000 == -73dB (0x30 */ - /* 0101111 == mute (0x2f) */ + /* +6 to -57dB in 1dB steps == 64 levels = 6 bits */ + /* 0111111 == +6dB (0x3f) = 63) */ + /* 0111001 == 0dB (0x39) = 57) */ + /* 0000001 == -56dB (0x01) = */ + /* 0000000 == -57dB (0x00) */ - if (db <= -570) { - return 0x0; + /* 1000000 == Mute (0x40) */ + + if (db < -570) { + return 0x40; } else { return((db/10)+57); } |