diff options
author | Simon Wilson <simonwilson@google.com> | 2011-09-02 14:46:34 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-09-06 10:14:54 -0700 |
commit | aa711b0ec02b45bd182af8639b23f5959b2897fe (patch) | |
tree | 93f30ce7e51343db9010e1342f8fca9e03a8d43f /audio/audio_hw.c | |
parent | af63d95dedcd2bd7af42eea1b4262474c662a4c2 (diff) | |
download | device_samsung_tuna-aa711b0ec02b45bd182af8639b23f5959b2897fe.zip device_samsung_tuna-aa711b0ec02b45bd182af8639b23f5959b2897fe.tar.gz device_samsung_tuna-aa711b0ec02b45bd182af8639b23f5959b2897fe.tar.bz2 |
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
Diffstat (limited to 'audio/audio_hw.c')
-rw-r--r-- | audio/audio_hw.c | 13 |
1 files changed, 8 insertions, 5 deletions
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, |