hal: add support for FFV get params
-Audio HAL to support FFV get_paramters via sound trigger
callback.
-FFV needs clients to pass down the SM handle info to get a few
paramerters with respect to the given SM handle but standard
get_parameters doesn't support kvpairs for input keys, it does
support for return of kvpairs, add support for a new delimiter
which will be used while sending keys in get_parameter.
-Enable Keep alive for Red Dragon
-Adjust volume gains based on the systems team tuned values
Change-Id: I96c7214b4a084568862e3550eaabbb9d51e253d9
diff --git a/configs/sdm710/sdm710.mk b/configs/sdm710/sdm710.mk
index 6db48b6..04aac8a 100644
--- a/configs/sdm710/sdm710.mk
+++ b/configs/sdm710/sdm710.mk
@@ -268,6 +268,10 @@
PRODUCT_PROPERTY_OVERRIDES += \
ro.af.client_heap_size_kbyte=7168
+#keep alive is needed by default for ffv
+PRODUCT_PROPERTY_OVERRIDES += \
+vendor.audio.keep_alive.disabled=false
+
# for HIDL related packages
PRODUCT_PACKAGES += \
android.hardware.audio@2.0-service \
diff --git a/configs/sdm710/sound_trigger_mixer_paths_wcd9340.xml b/configs/sdm710/sound_trigger_mixer_paths_wcd9340.xml
index 4d1bb31..df61226 100644
--- a/configs/sdm710/sound_trigger_mixer_paths_wcd9340.xml
+++ b/configs/sdm710/sound_trigger_mixer_paths_wcd9340.xml
@@ -342,15 +342,19 @@
<ctl name="CDC_IF TX5 MUX" value="DEC5" />
<ctl name="ADC MUX5" value="DMIC" />
<ctl name="DMIC MUX5" value="DMIC1" />
+ <ctl name="DEC5 Volume" value="96" />
<ctl name="CDC_IF TX6 MUX" value="DEC6" />
<ctl name="ADC MUX6" value="DMIC" />
<ctl name="DMIC MUX6" value="DMIC5" />
+ <ctl name="DEC6 Volume" value="96" />
<ctl name="CDC_IF TX7 MUX" value="DEC7" />
<ctl name="ADC MUX7" value="DMIC" />
<ctl name="DMIC MUX7" value="DMIC2" />
+ <ctl name="DEC7 Volume" value="96" />
<ctl name="CDC_IF TX8 MUX" value="DEC8" />
<ctl name="ADC MUX8" value="DMIC" />
<ctl name="DMIC MUX8" value="DMIC0" />
+ <ctl name="DEC8 Volume" value="96" />
</path>
<path name="audio-capture">
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index 95907f3..aa1f7c0 100644
--- a/hal/audio_extn/soundtrigger.c
+++ b/hal/audio_extn/soundtrigger.c
@@ -176,6 +176,8 @@
#define SVA_PARAM_DIRECTION_OF_ARRIVAL "st_direction_of_arrival"
#define SVA_PARAM_CHANNEL_INDEX "st_channel_index"
+#define MAX_STR_LENGTH_FFV_PARAMS 30
+#define MAX_FFV_SESSION_ID 100
/*
* Current proprietary API version used by AHAL. Queried by STHAL
* for compatibility check with AHAL
@@ -620,12 +622,46 @@
}
}
+static int extract_sm_handle(const char *keys, char *paramstr) {
+ char *tmpstr, *token;
+ char *inputstr = NULL;
+ int value = -EINVAL;
+
+ if (keys == NULL || paramstr == NULL)
+ goto exit;
+
+ inputstr = strdup(keys);
+ token =strtok_r(inputstr,":", &tmpstr);
+
+ if (token == NULL)
+ goto exit;
+
+ ALOGD("%s input string <%s> param string <%s>", __func__, keys,token);
+ strlcpy(paramstr, token, MAX_STR_LENGTH_FFV_PARAMS);
+ token =strtok_r(NULL,":=",&tmpstr);
+
+ if (token == NULL)
+ goto exit;
+
+ value = atoi(token);
+ if (value > 0 && value < MAX_FFV_SESSION_ID)
+ ALOGD(" %s SVA sm handle<=%d>",__func__, value);
+
+exit:
+ if (inputstr != NULL)
+ free(inputstr);
+
+ return value;
+}
void audio_extn_sound_trigger_get_parameters(const struct audio_device *adev __unused,
- struct str_parms *query, struct str_parms *reply)
+ struct str_parms *query,
+ struct str_parms *reply)
{
audio_event_info_t event;
- int ret, val;
- char value[32];
+ int ret;
+ char value[32], paramstr[MAX_STR_LENGTH_FFV_PARAMS];
+
+ ALOGD("%s input string<%s>", __func__, str_parms_to_str(query));
ret = str_parms_get_str(query, "SVA_EXEC_MODE_STATUS", value,
sizeof(value));
@@ -634,17 +670,17 @@
str_parms_add_int(reply, "SVA_EXEC_MODE_STATUS", event.u.value);
}
- ret = str_parms_get_int(query, SVA_PARAM_DIRECTION_OF_ARRIVAL, &val);
- if (ret >= 0) {
- event.u.st_get_param_data.sm_handle = val;
+ ret = extract_sm_handle(str_parms_to_str(query), paramstr);
+
+ if ((ret >= 0) && !strncmp(paramstr, SVA_PARAM_DIRECTION_OF_ARRIVAL,
+ MAX_STR_LENGTH_FFV_PARAMS)) {
+ event.u.st_get_param_data.sm_handle = ret;
event.u.st_get_param_data.param = SVA_PARAM_DIRECTION_OF_ARRIVAL;
event.u.st_get_param_data.reply = reply;
st_dev->st_callback(AUDIO_EVENT_GET_PARAM, &event);
- }
-
- ret = str_parms_get_int(query, SVA_PARAM_CHANNEL_INDEX, &val);
- if (ret >= 0) {
- event.u.st_get_param_data.sm_handle = val;
+ } else if ((ret >=0) && !strncmp(paramstr, SVA_PARAM_CHANNEL_INDEX,
+ MAX_STR_LENGTH_FFV_PARAMS)) {
+ event.u.st_get_param_data.sm_handle = ret;
event.u.st_get_param_data.param = SVA_PARAM_CHANNEL_INDEX;
event.u.st_get_param_data.reply = reply;
st_dev->st_callback(AUDIO_EVENT_GET_PARAM, &event);
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 7f41763..2f0ed58 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -6893,6 +6893,8 @@
static char* adev_get_parameters(const struct audio_hw_device *dev,
const char *keys)
{
+ ALOGD("%s:%s", __func__, keys);
+
struct audio_device *adev = (struct audio_device *)dev;
struct str_parms *reply = str_parms_create();
struct str_parms *query = str_parms_create_str(keys);
@@ -6947,7 +6949,7 @@
str_parms_destroy(query);
str_parms_destroy(reply);
- ALOGV("%s: exit: returns - %s", __func__, str);
+ ALOGD("%s: exit: returns - %s", __func__, str);
return str;
}