diff options
author | Eric Laurent <elaurent@google.com> | 2011-09-28 19:10:01 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-09-29 15:03:27 -0700 |
commit | a100f7d1fa1a6ce3ac1b1488528810cb8c12759e (patch) | |
tree | 7bc8241c5c8601c59cda3202415ad15b0305cf0a /audio | |
parent | f1da645470e57cf11e8cbb4fb6142db908ff6fc0 (diff) | |
download | device_samsung_tuna-a100f7d1fa1a6ce3ac1b1488528810cb8c12759e.zip device_samsung_tuna-a100f7d1fa1a6ce3ac1b1488528810cb8c12759e.tar.gz device_samsung_tuna-a100f7d1fa1a6ce3ac1b1488528810cb8c12759e.tar.bz2 |
audio HAL: different heaphone volume for Europe
Added the possibility to set difference headphones volume
to comply to European regulation.
Set conservative gains for headphones and headset.
Change-Id: I77af0325baca8d5d5a8ebbec2431918cf2bff3a0
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio_hw.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 98f7cac..9aded02 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -154,12 +154,16 @@ #define NORMAL_SPEAKER_VOLUME 0 #define VOICE_CALL_SPEAKER_VOLUME 6 -#define HEADSET_VOLUME -6 -#define HEADPHONE_VOLUME 0 /* allow louder output for headphones */ +#define HEADSET_VOLUME_DEFAULT -6 +#define HEADSET_VOLUME_EUROPE -11 +#define HEADPHONE_VOLUME_DEFAULT -4 /* allow louder output for headphones */ +#define HEADPHONE_VOLUME_EUROPE -11 /* product-specific defines */ #define PRODUCT_DEVICE_PROPERTY "ro.product.device" +#define PRODUCT_NAME_PROPERTY "ro.product.name" #define PRODUCT_DEVICE_TORO "toro" +#define PRODUCT_NAME_YAKJU "yakju" enum tty_modes { TTY_MODE_OFF, @@ -439,6 +443,8 @@ struct tuna_audio_device { int sidetone_capture; struct echo_reference_itfe *echo_reference; bool bluetooth_nrec; + bool headphone_volume_europe; + /* RIL */ struct ril_handle ril; }; @@ -512,6 +518,15 @@ static int is_device_toro(void) return strcmp(property, PRODUCT_DEVICE_TORO) == 0; } +static int is_product_yakju(void) +{ + char property[PROPERTY_VALUE_MAX]; + + property_get(PRODUCT_NAME_PROPERTY, property, PRODUCT_NAME_YAKJU); + + return strcmp(property, PRODUCT_NAME_YAKJU) == 0; +} + /* The enable flag when 0 makes the assumption that enums are disabled by * "Off" and integers/booleans by 0 */ @@ -690,8 +705,12 @@ static void set_output_volumes(struct tuna_audio_device *adev) speaker_volume = adev->mode == AUDIO_MODE_IN_CALL ? VOICE_CALL_SPEAKER_VOLUME : NORMAL_SPEAKER_VOLUME; headset_volume = adev->devices & AUDIO_DEVICE_OUT_WIRED_HEADSET ? - HEADSET_VOLUME : - HEADPHONE_VOLUME; + (adev->headphone_volume_europe ? + HEADSET_VOLUME_EUROPE : + HEADSET_VOLUME_DEFAULT) : + (adev->headphone_volume_europe ? + HEADPHONE_VOLUME_EUROPE : + HEADPHONE_VOLUME_DEFAULT); for (channel = 0; channel < 2; channel++) { mixer_ctl_set_value(adev->mixer_ctls.speaker_volume, channel, @@ -2377,6 +2396,7 @@ static int adev_open(const hw_module_t* module, const char* name, adev->voice_volume = 1.0f; adev->tty_mode = TTY_MODE_OFF; adev->sidetone_capture = is_device_toro(); + adev->headphone_volume_europe = is_product_yakju(); adev->bluetooth_nrec = true; /* RIL */ |