summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-07-26 20:12:51 -0700
committerSimon Wilson <simonwilson@google.com>2011-07-29 14:55:57 -0700
commit046e31e67ed01632e94b095982d3b133b68bb05f (patch)
treee6ace925387273599ef013954beb174d0e6b3970 /audio
parentc7c238aaa2e92673e4739ff321fd8304b7912f16 (diff)
downloaddevice_samsung_tuna-046e31e67ed01632e94b095982d3b133b68bb05f.zip
device_samsung_tuna-046e31e67ed01632e94b095982d3b133b68bb05f.tar.gz
device_samsung_tuna-046e31e67ed01632e94b095982d3b133b68bb05f.tar.bz2
audio: use per-device maximum RIL volume
The maguro and toro devices have different radios, each supporting a different maximum volume. Determine the maximum volume for the device from the ro.config.vc_call_vol_steps property and use that to calculate the volume to send to the RIL. Change-Id: I02921ed41ddbae90f8d3a149c05d37d3e87deab0
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c7
-rw-r--r--audio/ril_interface.c19
-rw-r--r--audio/ril_interface.h3
3 files changed, 21 insertions, 8 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 4eac118..b5c015f 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -1008,11 +1008,8 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
adev->voice_volume = volume;
- /* convert the float volume to something suitable for the RIL */
- if (adev->mode == AUDIO_MODE_IN_CALL) {
- int int_volume = (int)(volume * 5);
- ril_set_call_volume(&adev->ril, SOUND_TYPE_VOICE, int_volume);
- }
+ if (adev->mode == AUDIO_MODE_IN_CALL)
+ ril_set_call_volume(&adev->ril, SOUND_TYPE_VOICE, volume);
return 0;
}
diff --git a/audio/ril_interface.c b/audio/ril_interface.c
index 6bc0127..8793fae 100644
--- a/audio/ril_interface.c
+++ b/audio/ril_interface.c
@@ -18,11 +18,16 @@
/*#define LOG_NDEBUG 0*/
#include <dlfcn.h>
+#include <stdlib.h>
#include <utils/Log.h>
+#include <cutils/properties.h>
#include "ril_interface.h"
+#define VOLUME_STEPS_DEFAULT "5"
+#define VOLUME_STEPS_PROPERTY "ro.config.vc_call_vol_steps"
+
/* Function pointers */
void *(*_ril_open_client)(void);
int (*_ril_close_client)(void *);
@@ -47,6 +52,8 @@ static int ril_connect_if_required(struct ril_handle *ril)
int ril_open(struct ril_handle *ril)
{
+ char property[PROPERTY_VALUE_MAX];
+
if (!ril)
return -1;
@@ -81,6 +88,13 @@ int ril_open(struct ril_handle *ril)
return -1;
}
+ property_get(VOLUME_STEPS_PROPERTY, property, VOLUME_STEPS_DEFAULT);
+ ril->volume_steps_max = atoi(property);
+ /* this catches the case where VOLUME_STEPS_PROPERTY does not contain
+ an integer */
+ if (ril->volume_steps_max == 0)
+ ril->volume_steps_max = atoi(VOLUME_STEPS_DEFAULT);
+
return 0;
}
@@ -100,12 +114,13 @@ int ril_close(struct ril_handle *ril)
}
int ril_set_call_volume(struct ril_handle *ril, enum ril_sound_type sound_type,
- int volume)
+ float volume)
{
if (ril_connect_if_required(ril))
return 0;
- return _ril_set_call_volume(ril->client, sound_type, volume);
+ return _ril_set_call_volume(ril->client, sound_type,
+ (int)(volume * ril->volume_steps_max));
}
int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path)
diff --git a/audio/ril_interface.h b/audio/ril_interface.h
index c47484d..4a7a839 100644
--- a/audio/ril_interface.h
+++ b/audio/ril_interface.h
@@ -32,6 +32,7 @@ struct ril_handle
{
void *handle;
void *client;
+ int volume_steps_max;
};
enum ril_sound_type {
@@ -59,7 +60,7 @@ enum ril_clock_state {
int ril_open(struct ril_handle *ril);
int ril_close(struct ril_handle *ril);
int ril_set_call_volume(struct ril_handle *ril, enum ril_sound_type sound_type,
- int volume);
+ float volume);
int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path);
int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state);
#endif