hal: update apptype configuration logic for recording usecase
General recording apptype is used for capture usecases
Change-Id: Ia90a3f05764be3acee21a3de55e94997bbe93b08
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index a114b30..5b18e37 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -579,11 +579,12 @@
if ((usecase->type == PCM_PLAYBACK) && (usecase->stream.out == NULL)) {
sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
- app_type_cfg[len++] = platform_get_default_app_type(adev->platform);
+ app_type_cfg[len++] = platform_get_default_app_type_v2(adev->platform, usecase->type);
app_type_cfg[len++] = acdb_dev_id;
app_type_cfg[len++] = sample_rate;
ALOGI("%s PLAYBACK app_type %d, acdb_dev_id %d, sample_rate %d",
- __func__, platform_get_default_app_type(adev->platform), acdb_dev_id, sample_rate);
+ __func__, platform_get_default_app_type_v2(adev->platform, usecase->type),
+ acdb_dev_id, sample_rate);
} else if (usecase->type == PCM_PLAYBACK) {
if ((24 == usecase->stream.out->bit_width) &&
(usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER)) {
@@ -609,11 +610,12 @@
ALOGI("%s PLAYBACK app_type %d, acdb_dev_id %d, sample_rate %d",
__func__, usecase->stream.out->app_type_cfg.app_type, acdb_dev_id, sample_rate);
} else if (usecase->type == PCM_CAPTURE) {
- app_type_cfg[len++] = platform_get_default_app_type(adev->platform);
+ app_type_cfg[len++] = platform_get_default_app_type_v2(adev->platform, usecase->type);
app_type_cfg[len++] = acdb_dev_id;
app_type_cfg[len++] = sample_rate;
ALOGI("%s CAPTURE app_type %d, acdb_dev_id %d, sample_rate %d",
- __func__, platform_get_default_app_type(adev->platform), acdb_dev_id, sample_rate);
+ __func__, platform_get_default_app_type_v2(adev->platform, usecase->type),
+ acdb_dev_id, sample_rate);
}
mixer_ctl_set_array(ctl, app_type_cfg, len);
rc = 0;
@@ -638,8 +640,8 @@
if ((type == PCM_HFP_CALL) || (type == PCM_CAPTURE)) {
/* when app type is default. the sample rate is not used to send cal */
platform_send_audio_calibration(adev->platform, usecase,
- platform_get_default_app_type(adev->platform),
- 48000);
+ platform_get_default_app_type_v2(adev->platform, usecase->type),
+ 48000);
}
}
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 44ee73a..54ac5f6 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1928,6 +1928,14 @@
return DEFAULT_APP_TYPE;
}
+int platform_get_default_app_type_v2(void *platform, usecase_type_t type)
+{
+ if(type == PCM_CAPTURE)
+ return DEFAULT_APP_TYPE_TX_PATH;
+ else
+ return DEFAULT_APP_TYPE_RX_PATH;
+}
+
int platform_get_snd_device_acdb_id(snd_device_t snd_device)
{
if ((snd_device < SND_DEVICE_MIN) || (snd_device >= SND_DEVICE_MAX)) {
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 0af5a08..59aae10 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -99,7 +99,8 @@
#define EDID_FORMAT_LPCM 1
/* fallback app type if the default app type from acdb loader fails */
-#define DEFAULT_APP_TYPE 0x11130
+#define DEFAULT_APP_TYPE_RX_PATH 0x11130
+#define DEFAULT_APP_TYPE_TX_PATH 0x11132
/* Retry for delay in FW loading*/
#define RETRY_NUMBER 10
@@ -1822,7 +1823,15 @@
if (my_data->acdb_get_default_app_type)
return my_data->acdb_get_default_app_type();
else
- return DEFAULT_APP_TYPE;
+ return DEFAULT_APP_TYPE_RX_PATH;
+}
+
+int platform_get_default_app_type_v2(void *platform, usecase_type_t type)
+{
+ if(type == PCM_CAPTURE)
+ return DEFAULT_APP_TYPE_TX_PATH;
+ else
+ return DEFAULT_APP_TYPE_RX_PATH;
}
int platform_get_snd_device_acdb_id(snd_device_t snd_device)
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 3ab5191..a89c267 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -46,6 +46,7 @@
int platform_send_audio_calibration(void *platform, struct audio_usecase *usecase,
int app_type, int sample_rate);
int platform_get_default_app_type(void *platform);
+int platform_get_default_app_type_v2(void *platform, usecase_type_t type);
int platform_switch_voice_call_device_pre(void *platform);
int platform_switch_voice_call_enable_device_config(void *platform,
snd_device_t out_snd_device,