Merge "sthal: handle concurrency usecase for headset mic"
diff --git a/sound_trigger_hw.c b/sound_trigger_hw.c
index 2cbc4a5..ce879fc 100644
--- a/sound_trigger_hw.c
+++ b/sound_trigger_hw.c
@@ -784,7 +784,7 @@
if (stdev->transit_to_adsp_on_playback)
check_sessions_transition(event_type);
- if (stdev->dedicated_sva_path) {
+ if (platform_stdev_is_dedicated_sva_path(stdev->platform)) {
/*
* When SVA has dedicated tx path, ignore capture events when concurrency
* is allowed with this capture event.
diff --git a/sound_trigger_hw.h b/sound_trigger_hw.h
index b762f34..c72f900 100644
--- a/sound_trigger_hw.h
+++ b/sound_trigger_hw.h
@@ -154,6 +154,7 @@
bool stop_transitions_thread_loop;
transit_dir_t transit_dir;
bool dedicated_sva_path;
+ bool dedicated_headset_path;
bool disable_hwmad;
st_platform_lpi_enable_t platform_lpi_enable;
diff --git a/sound_trigger_platform.c b/sound_trigger_platform.c
index 2a13d2c..6da1859 100644
--- a/sound_trigger_platform.c
+++ b/sound_trigger_platform.c
@@ -149,6 +149,7 @@
#define ST_PARAM_KEY_LPI_ENABLE "lpi_enable"
#define ST_PARAM_KEY_VAD_ENABLE "vad_enable"
#define ST_PARAM_KEY_DEDICATED_SVA_PATH "dedicated_sva_path"
+#define ST_PARAM_KEY_DEDICATED_HEADSET_PATH "dedicated_headset_path"
#define ST_PARAM_KEY_DAM_TOKEN_ID "dam_token_id"
#ifndef Q6AFE_HWDEP_NODE
@@ -716,6 +717,7 @@
stdev->conc_voice_call_supported = false;
stdev->conc_voip_call_supported = false;
stdev->dedicated_sva_path = false;
+ stdev->dedicated_headset_path = true;
stdev->disable_hwmad = false;
stdev->platform_lpi_enable = ST_PLATFORM_LPI_NONE;
@@ -1119,6 +1121,14 @@
!strncasecmp(str_value, "true", 4) ? true : false;
}
+ err = str_parms_get_str(parms, ST_PARAM_KEY_DEDICATED_HEADSET_PATH,
+ str_value, sizeof(str_value));
+ if (err >= 0) {
+ str_parms_del(parms, ST_PARAM_KEY_DEDICATED_HEADSET_PATH);
+ stdev->dedicated_headset_path =
+ !strncasecmp(str_value, "true", 4) ? true : false;
+ }
+
return 0;
}
@@ -2955,13 +2965,14 @@
strlcpy(mixer_path_xml, MIXER_PATH_FILE_NAME,
sizeof(MIXER_PATH_FILE_NAME));
}
- /* check if qrd specific mixer path file exists */
+ /* check if qrd/cdp specific mixer path file exists */
if (strstr(snd_card_name, "qrd")) {
char *tmp = NULL;
char *snd_internal_name = NULL;
char temp_path[MIXER_PATH_MAX_LENGTH];
strlcpy(temp_path, mixer_path_xml, MIXER_PATH_MAX_LENGTH);
+
char *snd_card_name_t = strdup(snd_card_name);
if (snd_card_name_t != NULL) {
snd_internal_name = strtok_r(snd_card_name_t, "-", &tmp);
@@ -2982,6 +2993,14 @@
}
free(snd_card_name_t);
}
+ } else if (strstr(snd_card_name, "cdp")) {
+ char temp_path[MIXER_PATH_MAX_LENGTH];
+
+ strlcpy(temp_path, mixer_path_xml, MIXER_PATH_MAX_LENGTH);
+ strlcat(temp_path, "_cdp", MIXER_PATH_MAX_LENGTH);
+ strlcat(temp_path, MIXER_FILE_EXT, MIXER_PATH_MAX_LENGTH);
+ if (access(temp_path, R_OK) == 0)
+ strlcat(mixer_path_xml, "_cdp", MIXER_PATH_MAX_LENGTH);
}
strlcat(mixer_path_xml, MIXER_FILE_EXT, MIXER_PATH_MAX_LENGTH);
@@ -3195,6 +3214,24 @@
st_device == ST_DEVICE_HEADSET_MIC));
}
+bool platform_stdev_is_dedicated_sva_path
+(
+ void *platform
+)
+{
+ struct platform_data *my_data = (struct platform_data *)platform;
+ sound_trigger_device_t *stdev = my_data->stdev;
+ audio_devices_t cur_device =
+ platform_stdev_get_capture_device(stdev->platform);
+
+ if (!stdev->dedicated_sva_path ||
+ (cur_device == AUDIO_DEVICE_IN_WIRED_HEADSET &&
+ !stdev->dedicated_headset_path))
+ return false;
+
+ return true;
+}
+
static int platform_stdev_get_device_sample_rate
(
struct platform_data *my_data,
@@ -4463,7 +4500,7 @@
*/
if (stdev->conc_capture_supported &&
stdev->tx_concurrency_active > 0 &&
- !stdev->dedicated_sva_path)
+ (!platform_stdev_is_dedicated_sva_path(stdev->platform)))
stdev->reset_backend = false;
else
stdev->reset_backend = true;
diff --git a/sound_trigger_platform.h b/sound_trigger_platform.h
index 68f1b4a..1520042 100644
--- a/sound_trigger_platform.h
+++ b/sound_trigger_platform.h
@@ -741,6 +741,11 @@
st_exec_mode_t exec_mode
);
+bool platform_stdev_is_dedicated_sva_path
+(
+ void *platform
+);
+
int platform_stdev_derive_mixer_ctl_from_backend
(
void *platform,
diff --git a/st_hw_session_gcs.c b/st_hw_session_gcs.c
index dbd21b8..e5a2980 100644
--- a/st_hw_session_gcs.c
+++ b/st_hw_session_gcs.c
@@ -1314,7 +1314,7 @@
* mixer value in audio route is not reset, so detections won't work
* 4. To fix this call audio reset then enable device
*/
- if (!p_ses->stdev->dedicated_sva_path &&
+ if (!platform_stdev_is_dedicated_sva_path(p_ses->stdev->platform) &&
p_ses->stdev->conc_capture_supported &&
p_ses->stdev->reset_backend &&
!is_hwmad_device) {
diff --git a/st_hw_session_lsm.c b/st_hw_session_lsm.c
index a597952..aff5cb7 100644
--- a/st_hw_session_lsm.c
+++ b/st_hw_session_lsm.c
@@ -1969,7 +1969,7 @@
* mixer value in audio route is not reset, so detections won't work
* 4. To fix this call audio reset then enable device
*/
- if (!p_ses->stdev->dedicated_sva_path &&
+ if (!platform_stdev_is_dedicated_sva_path(p_ses->stdev->platform) &&
p_ses->stdev->conc_capture_supported &&
p_ses->stdev->reset_backend &&
!is_hwmad_device) {
diff --git a/st_hw_session_pcm.c b/st_hw_session_pcm.c
index 1afbee0..8ec3e3c 100644
--- a/st_hw_session_pcm.c
+++ b/st_hw_session_pcm.c
@@ -1158,7 +1158,7 @@
* mixer value in audio route is not reset, so detections won't work
* 4. To fix this call audio reset then enable device
*/
- if (!p_ses->stdev->dedicated_sva_path &&
+ if (!platform_stdev_is_dedicated_sva_path(p_ses->stdev->platform) &&
p_ses->stdev->conc_capture_supported &&
p_ses->stdev->reset_backend &&
!is_hwmad_device) {