From aa711b0ec02b45bd182af8639b23f5959b2897fe Mon Sep 17 00:00:00 2001 From: Simon Wilson Date: Fri, 2 Sep 2011 14:46:34 -0700 Subject: audio: specify analog volumes in dB This change applies conversions so that analog codec volumes can be specified in dB. It also restores the DL2 ABE gain to 0dB now that the ABE kernel code has been patched to prevent speaker distortion. The headset and speaker volumes are adjusted to take this change into account. Change-Id: I5cfe465e30e0c6a2424bd05e4a412eae8d878eba --- audio/audio_hw.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'audio') diff --git a/audio/audio_hw.c b/audio/audio_hw.c index aef1130..c859491 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -105,6 +105,9 @@ #define DB_TO_ABE_GAIN(x) ((x) + MIXER_ABE_GAIN_0DB) #define DB_TO_CAPTURE_PREAMPLIFIER_VOLUME(x) (((x) + 6) / 6) #define DB_TO_CAPTURE_VOLUME(x) (((x) - 6) / 6) +#define DB_TO_HEADSET_VOLUME(x) (((x) + 30) / 2) +#define DB_TO_SPEAKER_VOLUME(x) (((x) + 52) / 2) +#define DB_TO_EARPIECE_VOLUME(x) (((x) + 24) / 2) /* use-case specific volumes, all in dB */ #define CAPTURE_MAIN_MIC_VOLUME 13 @@ -172,7 +175,7 @@ struct route_setting defaults[] = { }, { .ctl_name = MIXER_DL2_MEDIA_PLAYBACK_VOLUME, - .intval = MIXER_ABE_GAIN_0DB - 9, + .intval = MIXER_ABE_GAIN_0DB, }, { .ctl_name = MIXER_DL1_VOICE_PLAYBACK_VOLUME, @@ -180,7 +183,7 @@ struct route_setting defaults[] = { }, { .ctl_name = MIXER_DL2_VOICE_PLAYBACK_VOLUME, - .intval = MIXER_ABE_GAIN_0DB - 9, + .intval = MIXER_ABE_GAIN_0DB, }, { .ctl_name = MIXER_SDT_DL_VOLUME, @@ -188,15 +191,15 @@ struct route_setting defaults[] = { }, { .ctl_name = MIXER_HEADSET_PLAYBACK_VOLUME, - .intval = 9, + .intval = DB_TO_HEADSET_VOLUME(-6), }, { .ctl_name = MIXER_EARPHONE_PLAYBACK_VOLUME, - .intval = 15, + .intval = DB_TO_EARPIECE_VOLUME(6), }, { .ctl_name = MIXER_HANDSFREE_PLAYBACK_VOLUME, - .intval = 29, + .intval = DB_TO_SPEAKER_VOLUME(0), }, { .ctl_name = MIXER_AUDUL_VOICE_UL_VOLUME, -- cgit v1.1