audio: Add get param support and resolve compile errors

- Add get param support in AHAL for Direction of Arrival and Channel
  index from STHAL.
- Correct feature flag enable syntax and resolve compile errors.
- Remove codec loopback and add afe loopback mixer controls in mixer xml.
- Update sound_trigger_platform xml file.

CRs-Fixed: 2225936
Change-Id: I2e477013977a03a599d6bb4a52c66b897e967219
This commit is contained in:
Dhanalakshmi Siddani 2018-04-23 12:52:02 +05:30
parent 4f8b709fa3
commit 57b014ee37
8 changed files with 80 additions and 82 deletions

View File

@ -40,11 +40,6 @@
<device name="AUDIO_DEVICE_IN_BUILTIN_MIC" interface="TERT_MI2S" codec_type="internal"/>
<device name="AUDIO_DEVICE_IN_BACK_MIC" interface="TERT_MI2S" codec_type="internal"/>
</interface_names>
<config_params>
<param key="input_mic_max_count" value="6"/>
<param key="ffv_split_ec_ref_data" value="false"/>
<param key="ffv_ec_ref_channel_count" value="1"/>
</config_params>
<pcm_ids>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD2" type="out" id="24"/>
<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD3" type="out" id="29"/>
@ -61,14 +56,16 @@
<usecase name="USECASE_AUDIO_SPKR_CALIB_TX" type="in" id="37"/>
<usecase name="USECASE_QCHAT_CALL" type="in" id="42"/>
<usecase name="USECASE_QCHAT_CALL" type="out" id="42"/>
<usecase name="USECASE_AUDIO_EC_REF_LOOPBACK" type="in" id="12"/>
<usecase name="USECASE_AUDIO_PLAYBACK_SILENCE" type="out" id="12"/>
<usecase name="USECASE_AUDIO_EC_REF_LOOPBACK" type="in" id="14"/>
<usecase name="USECASE_AUDIO_PLAYBACK_SILENCE" type="out" id="14"/>
</pcm_ids>
<config_params>
<param key="spkr_1_tz_name" value="wsatz.11"/>
<param key="spkr_2_tz_name" value="wsatz.12"/>
<param key="native_audio_mode" value="src"/>
<param key="input_mic_max_count" value="4"/>
<param key="input_mic_max_count" value="6"/>
<param key="ffv_split_ec_ref_data" value="false"/>
<param key="ffv_ec_ref_channel_count" value="1"/>
</config_params>
<backend_names>
<device name="SND_DEVICE_OUT_HEADPHONES" backend="headphones" interface="SLIMBUS_6_RX"/>

View File

@ -563,14 +563,17 @@
<ctl name="SLIMBUS_DL_HL Switch" value="0" />
<ctl name="SLIMBUS6_DL_HL Switch" value="0" />
<!-- ADSP testfwk end-->
<ctl name="MultiMedia5 Mixer SLIM_2_TX" value="0" />
<ctl name="PCM_Dev 12 Topology Capture" value="DTS" />
<!-- These are audio route (FE to BE) specific mixer settings -->
<path name="deep-buffer-playback">
<ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia1" value="1" />
</path>
<path name="silence-playback">
<ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia9" value="1" />
<ctl name="AUDIO_REF_EC_UL1 MUX" value="SLIM_RX" />
</path>
<path name="deep-buffer-playback speaker-protected">
<path name="deep-buffer-playback" />
</path>
@ -2485,10 +2488,9 @@
<path name="speaker-and-headphones" />
</path>
<path name="ec-ref-audio-capture">
<ctl name="PCM_Dev 12 Topology Capture" value="LEGACY" />
<ctl name="MultiMedia5 Mixer SLIM_2_TX" value="1" />
<ctl name="MultiMedia9 Mixer AFE_LOOPBACK_TX" value="1" />
<ctl name="AUDIO_REF_EC_UL1 MUX" value="SLIM_RX" />
</path>
<path name="handset-6mic">
@ -2567,37 +2569,15 @@
</path>
<path name="ec-ref-loopback-mono">
<ctl name="SLIM_2_TX Channels" value="One" />
<ctl name="AIF4_CAP Mixer SLIM TX7" value ="1"/>
<ctl name="SLIM TX7 MUX" value="RX_MIX_TX7"/>
<ctl name="RX MIX TX7 MUX" value="RX_MIX7"/>
</path>
<path name="ec-ref-loopback-stereo">
<ctl name="SLIM_2_TX Channels" value="Two" />
<ctl name="AIF4_CAP Mixer SLIM TX7" value ="1"/>
<ctl name="SLIM TX7 MUX" value="RX_MIX_TX7"/>
<ctl name="RX MIX TX7 MUX" value="RX_MIX7"/>
<ctl name="AIF4_CAP Mixer SLIM TX8" value ="1"/>
<ctl name="SLIM TX8 MUX" value="RX_MIX_TX8"/>
<ctl name="RX MIX TX8 MUX" value="RX_MIX8"/>
</path>
<path name="ec-ref-loopback-mono lineout">
<ctl name="SLIM_2_TX Channels" value="One" />
<ctl name="AIF4_CAP Mixer SLIM TX7" value ="1"/>
<ctl name="SLIM TX7 MUX" value="RX_MIX_TX7"/>
<ctl name="RX MIX TX7 MUX" value="RX_MIX5"/>
</path>
<path name="ec-ref-loopback-stereo lineout">
<ctl name="SLIM_2_TX Channels" value="Two" />
<ctl name="AIF4_CAP Mixer SLIM TX7" value ="1"/>
<ctl name="SLIM TX7 MUX" value="RX_MIX_TX7"/>
<ctl name="RX MIX TX7 MUX" value="RX_MIX5"/>
<ctl name="AIF4_CAP Mixer SLIM TX8" value ="1"/>
<ctl name="SLIM TX8 MUX" value="RX_MIX_TX8"/>
<ctl name="RX MIX TX8 MUX" value="RX_MIX6"/>
</path>
</mixer>

View File

@ -34,10 +34,10 @@ endif
USE_XML_AUDIO_POLICY_CONF := 1
BOARD_SUPPORTS_SOUND_TRIGGER := true
BOARD_SUPPORTS_SOUND_TRIGGER_ARM: = true
AUDIO_FEATURE_ENABLED_FFV: = true
AUDIO_FEATURE_ENABLED_KEEP_ALIVE_ARM_FFV: = true
AUDIO_FEATURE_ENABLED_KEEP_ALIVE: = true
BOARD_SUPPORTS_SOUND_TRIGGER_ARM := true
AUDIO_FEATURE_ENABLED_FFV := true
AUDIO_FEATURE_ENABLED_KEEP_ALIVE_ARM_FFV := true
AUDIO_FEATURE_ENABLED_KEEP_ALIVE := true
AUDIO_USE_LL_AS_PRIMARY_OUTPUT := true
AUDIO_FEATURE_ENABLED_HIFI_AUDIO := true
AUDIO_FEATURE_ENABLED_VBAT_MONITOR := true

View File

@ -96,9 +96,11 @@
<ctl name="AIF1_CAP Mixer SLIM TX8" value="0" />
<ctl name="AIF4_CAP Mixer SLIM TX8" value="0" />
<ctl name="AIF4_CAP Mixer SLIM TX7" value="0" />
<ctl name="MultiMedia9 Mixer AFE_LOOPBACK_TX" value="0" />
<ctl name="MultiMedia2 Mixer SLIM_0_TX" value="0" />
<ctl name="MultiMedia9 Mixer SLIM_2_TX" value="0" />
<ctl name="AUDIO_REF_EC_UL1 MUX" value="None"/>
<path name="listen-voice-wakeup-1">
<ctl name="SLIMBUS_5_TX LSM Function" value="AUDIO" />
@ -195,7 +197,8 @@
</path>
<path name="ec-ref-audio-capture">
<ctl name="MultiMedia9 Mixer SLIM_2_TX" value="1" />
<ctl name="MultiMedia9 Mixer AFE_LOOPBACK_TX" value="1" />
<ctl name="AUDIO_REF_EC_UL1 MUX" value="SLIM_RX" />
</path>
<path name="listen-cpe-handset-mic">
@ -361,37 +364,15 @@
</path>
<path name="ec-ref-loopback-mono">
<ctl name="SLIM_2_TX Channels" value="One" />
<ctl name="AIF4_CAP Mixer SLIM TX7" value ="1"/>
<ctl name="SLIM TX7 MUX" value="RX_MIX_TX7"/>
<ctl name="RX MIX TX7 MUX" value="RX_MIX7"/>
</path>
<path name="ec-ref-loopback-stereo">
<ctl name="SLIM_2_TX Channels" value="Two" />
<ctl name="AIF4_CAP Mixer SLIM TX7" value ="1"/>
<ctl name="SLIM TX7 MUX" value="RX_MIX_TX7"/>
<ctl name="RX MIX TX7 MUX" value="RX_MIX7"/>
<ctl name="AIF4_CAP Mixer SLIM TX8" value ="1"/>
<ctl name="SLIM TX8 MUX" value="RX_MIX_TX8"/>
<ctl name="RX MIX TX8 MUX" value="RX_MIX8"/>
</path>
<path name="ec-ref-loopback-mono lineout">
<ctl name="SLIM_2_TX Channels" value="One" />
<ctl name="AIF4_CAP Mixer SLIM TX7" value ="1"/>
<ctl name="SLIM TX7 MUX" value="RX_MIX_TX7"/>
<ctl name="RX MIX TX7 MUX" value="RX_MIX5"/>
</path>
<path name="ec-ref-loopback-stereo lineout">
<ctl name="SLIM_2_TX Channels" value="Two" />
<ctl name="AIF4_CAP Mixer SLIM TX7" value ="1"/>
<ctl name="SLIM TX7 MUX" value="RX_MIX_TX7"/>
<ctl name="RX MIX TX7 MUX" value="RX_MIX5"/>
<ctl name="AIF4_CAP Mixer SLIM TX8" value ="1"/>
<ctl name="SLIM TX8 MUX" value="RX_MIX_TX8"/>
<ctl name="RX MIX TX8 MUX" value="RX_MIX6"/>
</path>
<path name="echo-reference">

View File

@ -41,6 +41,14 @@
<param backend_dai_name="TERT_MI2S_TX" /-->
<param backend_port_name="SLIM_0_TX" />
<param backend_dai_name="SLIMBUS_0_TX" />
<param sw_mad="false"/>
<!-- Enable concurrent VA & audio capture excluding voip/voice call -->
<!-- using concurrent_capture param. -->
<!-- Enable VA & voip/voice call concurrency using concurrent_capture -->
<!-- param along with concurrent_voip_call/concurrent_voice_call params -->
<param concurrent_capture="false" />
<param concurrent_voip_call="false" />
<param concurrent_voice_call="false" />
</common_config>
<acdb_ids>
@ -69,15 +77,7 @@
<param max_cpe_users="3" />
<param max_ape_phrases="10" />
<param max_ape_users="10" />
<param sample_rate="16000" />
<param bit_width="16" />
<param channel_count="1"/>
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="NONE" />
<!-- fluence_type: "FLUENCE", "FLUENCE_DMIC", "FLUENCE_TMIC", -->
<!-- "FLUENCE_QMIC". param value is valid when adm_cfg_profile="FLUENCE"-->
<param fluence_type="NONE" />
<param event_timestamp_mode="false" />
<!-- Module and param ids with which the algorithm is integrated in firmware -->
<lsm_usecase>
@ -93,6 +93,17 @@
<!-- kw_duration is in milli seconds. It is valid only for FTRT transfer mode -->
<param capture_keyword="PCM_packet, RT, 2000" />
<param client_capture_read_delay="2000" />
<!-- Profile specific data which the algorithm can support -->
<param sample_rate="16000" />
<param bit_width="16" />
<param channel_count="1"/>
<!-- adm_cfg_profile should match with the one defined under adm_config -->
<!-- Set it to NONE if LSM directly connects to AFE -->
<param adm_cfg_profile="NONE" />
<!-- fluence_type: "FLUENCE", FLUENCE_DMIC", FLUENCE_QMIC" -->
<!-- param value is valid when profile type is fluence -->
<param fluence_type="FLUENCE_QMIC" />
</sound_model_config>
<!-- ARM based SVA sound_model_config -->

View File

@ -395,12 +395,13 @@ ifeq ($(strip $($AUDIO_FEATURE_ENABLED_DYNAMIC_ECNS)),true)
LOCAL_CFLAGS += -DDYNAMIC_ECNS_ENABLED
endif
ifeq ($(strip $($AUDIO_FEATURE_ENABLED_KEEP_ALIVE_ARM_FFV)), true)
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_KEEP_ALIVE_ARM_FFV)), true)
LOCAL_CFLAGS += -DRUN_KEEP_ALIVE_IN_ARM_FFV
endif
ifeq ($(strip $($AUDIO_FEATURE_ENABLED_FFV_FFV)), true)
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FFV)), true)
LOCAL_CFLAGS += -DFFV_ENABLED
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio-noship/include/ffv
LOCAL_SRC_FILES += audio_extn/ffv.c
endif

View File

@ -81,6 +81,7 @@
#define FFV_CHANNEL_MODE_MONO 1
#define FFV_CHANNEL_MODE_STEREO 2
#define FFV_CHANNEL_MODE_QUAD 6
#define FFV_CHANNEL_MODE_HEX 6
#define FFV_CHANNEL_MODE_OCT 8
@ -407,7 +408,7 @@ void audio_extn_ffv_update_pcm_config(struct pcm_config *config)
config->period_size = ffvmod.capture_config.period_size;
}
int32_t audio_extn_ffv_init(struct audio_device *adev)
int32_t audio_extn_ffv_init(struct audio_device *adev __unused)
{
int ret = 0;
@ -487,7 +488,7 @@ int32_t audio_extn_ffv_stream_init(struct stream_in *in, int key, char* lic)
__func__, num_ec_ref_ch, num_tx_in_ch, num_out_ch, frame_len, sample_rate);
ALOGD("%s: config file path %s", __func__, config_file_path);
status_type = ffv_init_fn(&ffvmod.handle, num_tx_in_ch, num_out_ch, num_ec_ref_ch,
frame_len, sample_rate, config_file_path, sm_buffer, 0,
frame_len, sample_rate, config_file_path, (char *)sm_buffer, 0,
&total_mem_size, key, lic);
if (status_type) {
ALOGE("%s: ERROR. ffv_init returned %d", __func__, status_type);
@ -580,6 +581,8 @@ snd_device_t audio_extn_ffv_get_capture_snd_device()
return SND_DEVICE_IN_HANDSET_8MIC;
} else if (ffvmod.capture_config.channels == FFV_CHANNEL_MODE_HEX) {
return SND_DEVICE_IN_HANDSET_6MIC;
} else if (ffvmod.capture_config.channels == FFV_CHANNEL_MODE_QUAD) {
return SND_DEVICE_IN_HANDSET_QMIC;
} else {
ALOGE("%s: Invalid channels configured for capture", __func__);
return SND_DEVICE_NONE;
@ -587,7 +590,7 @@ snd_device_t audio_extn_ffv_get_capture_snd_device()
}
int audio_extn_ffv_init_ec_ref_loopback(struct audio_device *adev,
snd_device_t snd_device)
snd_device_t snd_device __unused)
{
struct audio_usecase *uc_info_tx = NULL;
snd_device_t in_snd_device;
@ -679,7 +682,7 @@ void audio_extn_ffv_append_ec_ref_dev_name(char *device_name)
}
int audio_extn_ffv_deinit_ec_ref_loopback(struct audio_device *adev,
snd_device_t snd_device)
snd_device_t snd_device __unused)
{
struct audio_usecase *uc_info_tx = NULL;
snd_device_t in_snd_device;
@ -709,7 +712,7 @@ int audio_extn_ffv_deinit_ec_ref_loopback(struct audio_device *adev,
return ret;
}
int32_t audio_extn_ffv_read(struct audio_stream_in *stream,
int32_t audio_extn_ffv_read(struct audio_stream_in *stream __unused,
void *buffer, size_t bytes)
{
int status = 0;
@ -717,7 +720,7 @@ int32_t audio_extn_ffv_read(struct audio_stream_in *stream,
int16_t *process_ec_ref_ptr = NULL;
size_t in_buf_size, out_buf_size, bytes_to_copy;
int retry_num = 0;
int i, j, ch;
int i, ch;
int total_in_ch, in_ch, ec_ref_ch;
if (!ffvmod.ffv_lib_handle) {
@ -805,7 +808,7 @@ int32_t audio_extn_ffv_read(struct audio_stream_in *stream,
total_in_ch = ffvmod.capture_config.channels;
ec_ref_ch = ffvmod.ec_ref_config.channels;
in_ch = total_in_ch - ec_ref_ch;
for (i = 0; i < ffvmod.capture_config.period_size; i++) {
for (i = 0; i < (int)ffvmod.capture_config.period_size; i++) {
for (ch = 0; ch < in_ch; ch++) {
process_in_ptr[i*in_ch+ch] =
in_ptr[i*total_in_ch+ch];
@ -846,7 +849,6 @@ exit:
void audio_extn_ffv_set_parameters(struct audio_device *adev __unused,
struct str_parms *parms)
{
int err;
int val;
int ret = 0;
char value[128];

View File

@ -79,6 +79,7 @@ typedef enum {
AUDIO_EVENT_SVA_EXEC_MODE_STATUS,
AUDIO_EVENT_CAPTURE_STREAM_INACTIVE,
AUDIO_EVENT_CAPTURE_STREAM_ACTIVE,
AUDIO_EVENT_GET_PARAM
} audio_event_type_t;
typedef enum {
@ -121,6 +122,12 @@ struct sound_trigger_device_info {
int device;
};
struct sound_trigger_get_param_data {
char *param;
int sm_handle;
struct str_parms *reply;
};
struct audio_event_info {
union {
ssr_event_status_t status;
@ -129,6 +136,7 @@ struct audio_event_info {
struct audio_read_samples_info aud_info;
char str_value[ST_EVENT_CONFIG_MAX_STR_VALUE];
struct audio_hal_usecase usecase;
struct sound_trigger_get_param_data st_get_param_data;
} u;
struct sound_trigger_device_info device_info;
};
@ -165,6 +173,8 @@ do {\
#define SOUND_TRIGGER_LIBRARY_PATH "/vendor/lib/hw/sound_trigger.primary.%s.so"
#endif
#define SVA_PARAM_DIRECTION_OF_ARRIVAL "st_direction_of_arrival"
#define SVA_PARAM_CHANNEL_INDEX "st_channel_index"
/*
* Current proprietary API version used by AHAL. Queried by STHAL
* for compatibility check with AHAL
@ -597,7 +607,7 @@ void audio_extn_sound_trigger_get_parameters(const struct audio_device *adev __u
struct str_parms *query, struct str_parms *reply)
{
audio_event_info_t event;
int ret;
int ret, val;
char value[32];
ret = str_parms_get_str(query, "SVA_EXEC_MODE_STATUS", value,
@ -606,6 +616,22 @@ void audio_extn_sound_trigger_get_parameters(const struct audio_device *adev __u
st_dev->st_callback(AUDIO_EVENT_SVA_EXEC_MODE_STATUS, &event);
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;
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;
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);
}
}
int audio_extn_sound_trigger_init(struct audio_device *adev)