summaryrefslogtreecommitdiffstats
path: root/audio/ril_interface.c
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/ril_interface.c
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/ril_interface.c')
-rw-r--r--audio/ril_interface.c19
1 files changed, 17 insertions, 2 deletions
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)