summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Mertz <scott@cyngn.com>2015-01-28 18:06:26 -0800
committerScott Mertz <scott@cyngn.com>2015-01-29 13:04:06 -0800
commit0072fbf675480fd8def86beea212eb05805f282d (patch)
tree4665d8669a76edd46586ae5301d5d6a0b05d22ff
parent5f8e88092dfc751b1f0b1b12d9a6d37cac8ff335 (diff)
downloadandroid_hardware_qcom_audio-0072fbf675480fd8def86beea212eb05805f282d.tar.gz
android_hardware_qcom_audio-0072fbf675480fd8def86beea212eb05805f282d.tar.bz2
android_hardware_qcom_audio-0072fbf675480fd8def86beea212eb05805f282d.zip
audio: implement additional platform info xml tags
Change-Id: Idc3e77017f54167001e497c7e1a2ea86f8f6233f
-rw-r--r--hal/msm8916/platform.c64
1 files changed, 36 insertions, 28 deletions
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index c9e4ba54..6076b0d3 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -989,26 +989,7 @@ done:
int platform_get_snd_device_index(char *snd_device_index_name)
{
- int ret = 0;
- int i;
-
- if (snd_device_index_name == NULL) {
- ALOGE("%s: snd_device_index_name is NULL", __func__);
- ret = -ENODEV;
- goto done;
- }
-
- for (i=0; i < SND_DEVICE_MAX; i++) {
- if(strcmp(snd_device_name_index[i].name, snd_device_index_name) == 0) {
- ret = snd_device_name_index[i].index;
- goto done;
- }
- }
- ALOGE("%s: Could not find index for snd_device_index_name = %s",
- __func__, snd_device_index_name);
- ret = -ENODEV;
-done:
- return ret;
+ return find_index(snd_device_name_index, SND_DEVICE_MAX, snd_device_index_name);
}
int platform_set_fluence_type(void *platform, char *value)
@@ -2399,21 +2380,48 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info)
return fragment_size;
}
-int platform_get_usecase_index(const char * usecase __unused)
+int platform_get_usecase_index(const char * usecase)
{
- return -ENOSYS;
+ return find_index(usecase_name_index, AUDIO_USECASE_MAX, usecase);
}
-int platform_set_usecase_pcm_id(audio_usecase_t usecase __unused, int32_t type __unused,
- int32_t pcm_id __unused)
+int platform_set_usecase_pcm_id(audio_usecase_t usecase, int32_t type,
+ int32_t pcm_id)
{
- return -ENOSYS;
+ int ret = 0;
+ if ((usecase <= USECASE_INVALID) || (usecase >= AUDIO_USECASE_MAX)) {
+ ALOGE("%s: invalid usecase case idx %d", __func__, usecase);
+ ret = -EINVAL;
+ goto done;
+ }
+
+ if ((type != 0) && (type != 1)) {
+ ALOGE("%s: invalid usecase type", __func__);
+ ret = -EINVAL;
+ }
+ pcm_device_table[usecase][type] = pcm_id;
+done:
+ return ret;
}
-int platform_set_snd_device_backend(snd_device_t snd_device __unused,
- const char * backend __unused)
+int platform_set_snd_device_backend(snd_device_t device,
+ const char * backend)
{
- return -ENOSYS;
+ int ret = 0;
+
+ if ((device < SND_DEVICE_MIN) || (device >= SND_DEVICE_MAX)) {
+ ALOGE("%s: Invalid snd_device = %d",
+ __func__, device);
+ ret = -EINVAL;
+ goto done;
+ }
+
+ if (backend_table[device]) {
+ free(backend_table[device]);
+ }
+ backend_table[device] = strdup(backend);
+done:
+ return ret;
}
static unsigned int get_best_backend_sample_rate(unsigned int sample_rate) {