hal: Add apptype support for HFP client call
Add support to send apptype and calibration for HFP client call Change-Id: I71105baa28d98d4646620601a31a5ff373c9e9e9
This commit is contained in:
parent
f210a384d0
commit
9c83648c93
|
@ -126,6 +126,10 @@ ifeq ($(TARGET_BOARD_AUTO),true)
|
||||||
LOCAL_CFLAGS += -DPLATFORM_AUTO
|
LOCAL_CFLAGS += -DPLATFORM_AUTO
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_SUPPORTS_WEARABLES),true)
|
||||||
|
LOCAL_CFLAGS += -DENABLE_HFP_CALIBRATION
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DAEMON_SUPPORT)), true)
|
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DAEMON_SUPPORT)), true)
|
||||||
LOCAL_CFLAGS += -DDAEMON_SUPPORT_AUTO
|
LOCAL_CFLAGS += -DDAEMON_SUPPORT_AUTO
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution.
|
* Not a Contribution.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 The Android Open Source Project
|
* Copyright (C) 2014 The Android Open Source Project
|
||||||
|
@ -1669,6 +1669,9 @@ int audio_extn_utils_send_app_type_cfg(struct audio_device *adev,
|
||||||
num_devices = 1;
|
num_devices = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PCM_HFP_CALL:
|
||||||
|
rc = audio_extn_utils_send_app_type_cfg_hfp(adev,usecase);
|
||||||
|
return rc;
|
||||||
default:
|
default:
|
||||||
ALOGI("%s: not a playback/capture path, no need to cfg app type", __func__);
|
ALOGI("%s: not a playback/capture path, no need to cfg app type", __func__);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
@ -2040,7 +2043,15 @@ void audio_extn_utils_send_audio_calibration(struct audio_device *adev,
|
||||||
} else if (type == PCM_CAPTURE && usecase->stream.in != NULL) {
|
} else if (type == PCM_CAPTURE && usecase->stream.in != NULL) {
|
||||||
platform_send_audio_calibration(adev->platform, usecase,
|
platform_send_audio_calibration(adev->platform, usecase,
|
||||||
usecase->stream.in->app_type_cfg.app_type);
|
usecase->stream.in->app_type_cfg.app_type);
|
||||||
} else if ((type == PCM_HFP_CALL) || (type == PCM_CAPTURE) ||
|
} else if (type == PCM_HFP_CALL) {
|
||||||
|
/* when app type is default. the sample rate is not used to send cal */
|
||||||
|
#ifdef ENABLE_HFP_CALIBRATION
|
||||||
|
platform_send_audio_calibration_hfp(adev->platform, usecase->in_snd_device);
|
||||||
|
#else
|
||||||
|
platform_send_audio_calibration(adev->platform, usecase,
|
||||||
|
platform_get_default_app_type_v2(adev->platform, usecase->type));
|
||||||
|
#endif
|
||||||
|
} else if ((type == PCM_CAPTURE) ||
|
||||||
(type == TRANSCODE_LOOPBACK_RX && usecase->stream.inout != NULL) ||
|
(type == TRANSCODE_LOOPBACK_RX && usecase->stream.inout != NULL) ||
|
||||||
(type == ICC_CALL) || (type == SYNTH_LOOPBACK)) {
|
(type == ICC_CALL) || (type == SYNTH_LOOPBACK)) {
|
||||||
platform_send_audio_calibration(adev->platform, usecase,
|
platform_send_audio_calibration(adev->platform, usecase,
|
||||||
|
|
|
@ -5593,6 +5593,52 @@ int platform_send_audio_calibration(void *platform, struct audio_usecase *usecas
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int platform_send_audio_calibration_hfp(void *platform, snd_device_t snd_device)
|
||||||
|
{
|
||||||
|
struct platform_data *my_data = (struct platform_data *)platform;
|
||||||
|
int acdb_dev_id, acdb_dev_type;
|
||||||
|
int sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
|
||||||
|
int app_type = 0;
|
||||||
|
|
||||||
|
acdb_dev_id = platform_get_snd_device_acdb_id(snd_device);
|
||||||
|
if (acdb_dev_id < 0) {
|
||||||
|
ALOGE("%s: Could not find acdb id for device(%d)",
|
||||||
|
__func__, snd_device);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((snd_device >= SND_DEVICE_OUT_BEGIN) &&
|
||||||
|
(snd_device < SND_DEVICE_OUT_END)) {
|
||||||
|
acdb_dev_type = ACDB_DEV_TYPE_OUT;
|
||||||
|
app_type = DEFAULT_APP_TYPE_RX_PATH;
|
||||||
|
} else {
|
||||||
|
acdb_dev_type = ACDB_DEV_TYPE_IN;
|
||||||
|
app_type = DEFAULT_APP_TYPE_TX_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((my_data->acdb_send_audio_cal_v3) &&
|
||||||
|
((snd_device == SND_DEVICE_IN_VOICE_SPEAKER_MIC_HFP) ||
|
||||||
|
(snd_device == SND_DEVICE_IN_VOICE_SPEAKER_DMIC))) {
|
||||||
|
/* TX path calibration */
|
||||||
|
my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_IN,
|
||||||
|
DEFAULT_APP_TYPE_TX_PATH, sample_rate, 0);
|
||||||
|
my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_OUT,
|
||||||
|
DEFAULT_APP_TYPE_RX_PATH, sample_rate, 0);
|
||||||
|
} else if ((my_data->acdb_send_audio_cal_v3) &&
|
||||||
|
(snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_HFP)) {
|
||||||
|
/* RX path calibration */
|
||||||
|
my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_IN,
|
||||||
|
DEFAULT_APP_TYPE_TX_PATH, sample_rate,0 );
|
||||||
|
my_data->acdb_send_audio_cal_v3(acdb_dev_id, ACDB_DEV_TYPE_OUT,
|
||||||
|
DEFAULT_APP_TYPE_RX_PATH, sample_rate,0 );
|
||||||
|
} else if (my_data->acdb_send_audio_cal) {
|
||||||
|
my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type, app_type,
|
||||||
|
sample_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int platform_switch_voice_call_device_pre(void *platform)
|
int platform_switch_voice_call_device_pre(void *platform)
|
||||||
{
|
{
|
||||||
struct platform_data *my_data = (struct platform_data *)platform;
|
struct platform_data *my_data = (struct platform_data *)platform;
|
||||||
|
|
|
@ -182,6 +182,7 @@ int platform_set_native_support(int na_mode);
|
||||||
int platform_get_native_support();
|
int platform_get_native_support();
|
||||||
int platform_send_audio_calibration(void *platform, struct audio_usecase *usecase,
|
int platform_send_audio_calibration(void *platform, struct audio_usecase *usecase,
|
||||||
int app_type);
|
int app_type);
|
||||||
|
int platform_send_audio_calibration_hfp(void *platform, snd_device_t snd_device);
|
||||||
int platform_get_default_app_type(void *platform);
|
int platform_get_default_app_type(void *platform);
|
||||||
int platform_get_default_app_type_v2(void *platform, usecase_type_t type);
|
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_device_pre(void *platform);
|
||||||
|
|
Loading…
Reference in New Issue