Merge "hal: Fix app type mismatch for Tx path"
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index a8c2ccc..312be97 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -475,9 +475,15 @@
pcm_close(handle.pcm_tx);
handle.pcm_tx = NULL;
/* Clear TX calibration to handset mic */
- platform_send_audio_calibration(adev->platform,
- SND_DEVICE_IN_HANDSET_MIC,
- platform_get_default_app_type(adev->platform), 8000);
+ if (disable_tx) {
+ uc_info_tx->id = USECASE_AUDIO_RECORD;
+ uc_info_tx->type = PCM_CAPTURE;
+ uc_info_tx->in_snd_device = SND_DEVICE_IN_HANDSET_MIC;
+ uc_info_tx->out_snd_device = SND_DEVICE_NONE;
+ platform_send_audio_calibration(adev->platform,
+ uc_info_tx,
+ platform_get_default_app_type(adev->platform), 8000);
+ }
if (!status.status) {
protCfg.mode = MSM_SPKR_PROT_CALIBRATED;
protCfg.r0[SP_V2_SPKR_1] = status.r0[SP_V2_SPKR_1];
@@ -810,6 +816,7 @@
struct audio_usecase *uc_info_tx;
struct audio_device *adev = handle.adev_handle;
int32_t pcm_dev_tx_id = -1, ret = 0;
+ bool disable_tx = false;
ALOGV("%s: Entry", __func__);
/* cancel speaker calibration */
@@ -836,6 +843,7 @@
uc_info_tx->out_snd_device = SND_DEVICE_NONE;
handle.pcm_tx = NULL;
list_add_tail(&adev->usecase_list, &uc_info_tx->list);
+ disable_tx = true;
enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK);
enable_audio_route(adev, uc_info_tx);
@@ -862,14 +870,24 @@
exit:
/* Clear VI feedback cal and replace with handset MIC */
- platform_send_audio_calibration(adev->platform,
- SND_DEVICE_IN_HANDSET_MIC,
- platform_get_default_app_type(adev->platform), 8000);
- if (ret) {
+ if (disable_tx) {
+ uc_info_tx->id = USECASE_AUDIO_RECORD;
+ uc_info_tx->type = PCM_CAPTURE;
+ uc_info_tx->in_snd_device = SND_DEVICE_IN_HANDSET_MIC;
+ uc_info_tx->out_snd_device = SND_DEVICE_NONE;
+ platform_send_audio_calibration(adev->platform,
+ uc_info_tx,
+ platform_get_default_app_type(adev->platform), 8000);
+ }
+ if (ret) {
if (handle.pcm_tx)
pcm_close(handle.pcm_tx);
handle.pcm_tx = NULL;
list_remove(&uc_info_tx->list);
+ uc_info_tx->id = USECASE_AUDIO_SPKR_CALIB_TX;
+ uc_info_tx->type = PCM_CAPTURE;
+ uc_info_tx->in_snd_device = SND_DEVICE_IN_CAPTURE_VI_FEEDBACK;
+ uc_info_tx->out_snd_device = SND_DEVICE_NONE;
disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK);
disable_audio_route(adev, uc_info_tx);
free(uc_info_tx);
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 4f69bd5..dc6d29e 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2938,7 +2938,7 @@
}
out->compr_config.fragments = COMPRESS_OFFLOAD_NUM_FRAGMENTS;
out->compr_config.codec->sample_rate =
- compress_get_alsa_rate(config->offload_info.sample_rate);
+ config->offload_info.sample_rate;
out->compr_config.codec->bit_rate =
config->offload_info.bit_rate;
out->compr_config.codec->ch_in =
diff --git a/hal/msm8916/platform.h b/hal/msm8916/platform.h
index 03a02bf..6d5b4a0 100644
--- a/hal/msm8916/platform.h
+++ b/hal/msm8916/platform.h
@@ -217,7 +217,7 @@
#define INCALL_MUSIC_UPLINK_PCM_DEVICE 1
#define INCALL_MUSIC_UPLINK2_PCM_DEVICE 16
#define SPKR_PROT_CALIB_RX_PCM_DEVICE 5
-#define SPKR_PROT_CALIB_TX_PCM_DEVICE 22
+#define SPKR_PROT_CALIB_TX_PCM_DEVICE 26
#define PLAYBACK_OFFLOAD_DEVICE 9
#ifdef MULTIPLE_OFFLOAD_ENABLED