diff options
author | LuK1337 <priv.luk@gmail.com> | 2020-01-07 22:29:16 +0100 |
---|---|---|
committer | LuK1337 <priv.luk@gmail.com> | 2020-01-07 22:29:19 +0100 |
commit | d6528fb5fdc705b193a62872d1d0524f0a657170 (patch) | |
tree | 4f523b17ff0bb05cf34c9ce734bf9d898e322afc /hal | |
parent | 118d408852b4a075bc7358271768225ac3af21c5 (diff) | |
parent | f921c92a67276f74c535a0267e8e199c9b6357c4 (diff) | |
download | android_hardware_qcom_audio-d6528fb5fdc705b193a62872d1d0524f0a657170.tar.gz android_hardware_qcom_audio-d6528fb5fdc705b193a62872d1d0524f0a657170.tar.bz2 android_hardware_qcom_audio-d6528fb5fdc705b193a62872d1d0524f0a657170.zip |
Merge tag 'LA.UM.8.4.r1-04700-8x98.0' of https://source.codeaurora.org/quic/la/platform/hardware/qcom/audio into HEAD
"LA.UM.8.4.r1-04700-8x98.0"
Change-Id: I1672c7646d150f0eabf7337e2a8bdc02c91ea7bc
Diffstat (limited to 'hal')
-rw-r--r-- | hal/acdb.h | 3 | ||||
-rw-r--r-- | hal/audio_extn/a2dp.c | 13 | ||||
-rw-r--r-- | hal/audio_hw.c | 23 | ||||
-rw-r--r-- | hal/msm8916/platform.c | 53 | ||||
-rw-r--r-- | hal/msm8974/platform.c | 78 |
5 files changed, 102 insertions, 68 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project @@ -50,6 +50,7 @@ typedef int (*acdb_init_v3_t)(const char *, char *, struct listnode *); typedef int (*acdb_init_v4_t)(void *, int); typedef void (*acdb_send_audio_cal_t)(int, int, int , int); typedef void (*acdb_send_audio_cal_v3_t)(int, int, int, int, int); +typedef void (*acdb_send_audio_cal_v4_t)(int, int, int, int, int, int); typedef void (*acdb_send_voice_cal_t)(int, int); typedef int (*acdb_reload_vocvoltable_t)(int); typedef int (*acdb_get_default_app_type_t)(void); diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c index 534abb36..14bf29c4 100644 --- a/hal/audio_extn/a2dp.c +++ b/hal/audio_extn/a2dp.c @@ -209,6 +209,7 @@ typedef enum { APTX_AD_SR_UNCHANGED = 0x0, APTX_AD_48 = 0x1, // 48 KHz default APTX_AD_44_1 = 0x2, // 44.1kHz + APTX_AD_96 = 0x3, // 96KHz } enc_aptx_ad_s_rate; typedef void (*bt_audio_pre_init_t)(void); @@ -1708,7 +1709,7 @@ static int update_aptx_ad_dsp_config(struct aptx_ad_enc_cfg_t *aptx_dsp_cfg, a2dp.enc_channels = CH_MONO; aptx_dsp_cfg->custom_cfg.num_channels = CH_MONO; aptx_dsp_cfg->custom_cfg.channel_mapping[0] = PCM_CHANNEL_C; - break; + break; } switch(aptx_dsp_cfg->aptx_ad_cfg.sampling_freq) { case APTX_AD_SR_UNCHANGED: @@ -1720,7 +1721,7 @@ static int update_aptx_ad_dsp_config(struct aptx_ad_enc_cfg_t *aptx_dsp_cfg, case APTX_AD_44_1: a2dp.enc_sampling_rate = SAMPLING_RATE_441K; aptx_dsp_cfg->custom_cfg.sample_rate = SAMPLING_RATE_441K; - break; + break; } ALOGV("Successfully updated APTX AD enc format with \ samplingrate: %d channels:%d", @@ -1781,7 +1782,7 @@ static int update_aptx_ad_dsp_config_r2(struct aptx_ad_enc_cfg_r2_t *aptx_dsp_cf a2dp.enc_channels = CH_MONO; aptx_dsp_cfg->custom_cfg.num_channels = CH_MONO; aptx_dsp_cfg->custom_cfg.channel_mapping[0] = PCM_CHANNEL_C; - break; + break; } switch(aptx_dsp_cfg->aptx_ad_cfg.sampling_freq) { case APTX_AD_SR_UNCHANGED: @@ -1793,7 +1794,11 @@ static int update_aptx_ad_dsp_config_r2(struct aptx_ad_enc_cfg_r2_t *aptx_dsp_cf case APTX_AD_44_1: a2dp.enc_sampling_rate = SAMPLING_RATE_441K; aptx_dsp_cfg->custom_cfg.sample_rate = SAMPLING_RATE_441K; - break; + break; + case APTX_AD_96: + a2dp.enc_sampling_rate = SAMPLING_RATE_96K; + aptx_dsp_cfg->custom_cfg.sample_rate = SAMPLING_RATE_96K; + break; } ALOGV("Successfully updated APTX AD enc format with \ samplingrate: %d channels:%d", diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 45d374e5..6a1a67e1 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -493,6 +493,8 @@ static const struct string_to_enum out_sample_rates_name_to_enum_table[] = { STRING_TO_ENUM(96000), STRING_TO_ENUM(176400), STRING_TO_ENUM(192000), + STRING_TO_ENUM(352800), + STRING_TO_ENUM(384000), }; struct in_effect_list { @@ -1791,13 +1793,13 @@ static void check_usecases_capture_codec_backend(struct audio_device *adev, if (usecase->type != PCM_PLAYBACK && usecase != uc_info && (usecase->in_snd_device != snd_device || force_routing) && - ((uc_info->devices & backend_check_cond) && + (((uc_info->devices & backend_check_cond) && (((usecase->devices & ~AUDIO_DEVICE_BIT_IN) & AUDIO_DEVICE_IN_ALL_CODEC_BACKEND) || - (usecase->type == VOIP_CALL))) && + (usecase->type == VOIP_CALL))) || ((uc_info->type == VOICE_CALL && usecase->devices == AUDIO_DEVICE_IN_VOICE_CALL) || platform_check_backends_match(snd_device,\ - usecase->in_snd_device)) && + usecase->in_snd_device))) && (usecase->id != USECASE_AUDIO_SPKR_CALIB_TX)) { ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..", __func__, use_case_table[usecase->id], @@ -8366,21 +8368,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) adev->allow_afe_proxy_usage = true; } } - if (audio_is_a2dp_out_device(device)) { - struct audio_usecase *usecase; - struct listnode *node; - list_for_each(node, &adev->usecase_list) { - usecase = node_to_item(node, struct audio_usecase, list); - if (PCM_PLAYBACK == usecase->type && usecase->stream.out && - (usecase->stream.out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) && - usecase->stream.out->a2dp_compress_mute) { - struct stream_out *out = usecase->stream.out; - ALOGD("Unmuting the stream when Bt-A2dp disconnected and stream is mute"); - out->a2dp_compress_mute = false; - out_set_compr_volume(&out->stream, out->volume_l, out->volume_r); - } - } - } } audio_extn_hfp_set_parameters(adev, parms); diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c index 58492897..0946f7c3 100644 --- a/hal/msm8916/platform.c +++ b/hal/msm8916/platform.c @@ -6116,7 +6116,8 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev, if (rate_str == NULL) { switch (sample_rate) { case 32000: - if (passthrough_enabled || (backend_idx == HDMI_TX_BACKEND )) { + if (passthrough_enabled || (backend_idx == HDMI_TX_BACKEND) || + (backend_idx == DISP_PORT_RX_BACKEND)) { rate_str = "KHZ_32"; break; } @@ -7570,37 +7571,47 @@ int platform_set_edid_channels_configuration(void *platform, int channels, int b struct platform_data *my_data = (struct platform_data *)platform; struct audio_device *adev = my_data->adev; edid_audio_info *info = NULL; - int channel_count = 2; - int i, ret; + int ret; char default_channelMap[MAX_CHANNELS_SUPPORTED] = {0}; struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params; + int channel_alloc = 0; + int max_supported_channels = 0; ret = platform_get_edid_info(platform); info = (edid_audio_info *)my_data->edid_info; adev_device_cfg_ptr += HDMI_RX_BACKEND; if(ret == 0 && info != NULL) { - if (channels > 2) { - + if ((channels > 2) && (channels <= MAX_HDMI_CHANNEL_CNT)) { ALOGV("%s:able to get HDMI sink capabilities multi channel playback", __func__); - for (i = 0; i < info->audio_blocks && i < MAX_EDID_BLOCKS; i++) { - if (info->audio_blocks_array[i].format_id == LPCM && - info->audio_blocks_array[i].channels > channel_count && - info->audio_blocks_array[i].channels <= MAX_HDMI_CHANNEL_CNT) { - channel_count = info->audio_blocks_array[i].channels; - } + max_supported_channels = platform_edid_get_max_channels(my_data); + if (channels > max_supported_channels) + channels = max_supported_channels; + // refer to HDMI spec CEA-861-E: Table 28 Audio InfoFrame Data Byte 4 + switch (channels) { + case 3: + channel_alloc = 0x02; break; + case 4: + channel_alloc = 0x06; break; + case 5: + channel_alloc = 0x0A; break; + case 6: + channel_alloc = 0x0B; break; + case 7: + channel_alloc = 0x12; break; + case 8: + channel_alloc = 0x13; break; + default: + ALOGE("%s: invalid channel %d", __func__, channels); + return -EINVAL; } - ALOGV("%s:channel_count:%d", __func__, channel_count); - /* - * Channel map is set for supported hdmi max channel count even - * though the input channel count set on adm is less than or equal to - * max supported channel count - */ + ALOGVV("%s:channels:%d", __func__, channels); + if (adev_device_cfg_ptr->use_client_dev_cfg) { platform_set_channel_map(platform, adev_device_cfg_ptr->dev_cfg_params.channels, (char *)adev_device_cfg_ptr->dev_cfg_params.channel_map, -1, -1); } else { - platform_set_channel_map(platform, channel_count, info->channel_map, -1, -1); + platform_set_channel_map(platform, channels, info->channel_map, -1, -1); } if (adev_device_cfg_ptr->use_client_dev_cfg) { @@ -7609,8 +7620,8 @@ int platform_set_edid_channels_configuration(void *platform, int channels, int b platform_set_channel_allocation(platform, adev_device_cfg_ptr->dev_cfg_params.channel_allocation); } else { - platform_set_channel_allocation(platform, info->channel_allocation); - } + platform_set_channel_allocation(platform, channel_alloc); + } } else { if (adev_device_cfg_ptr->use_client_dev_cfg) { default_channelMap[0] = adev_device_cfg_ptr->dev_cfg_params.channel_map[0]; @@ -7620,7 +7631,7 @@ int platform_set_edid_channels_configuration(void *platform, int channels, int b default_channelMap[1] = PCM_CHANNEL_FR; } platform_set_channel_map(platform, 2, default_channelMap, -1, -1); - platform_set_channel_allocation(platform,0); + platform_set_channel_allocation(platform, 0); } } diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index c938e365..f23875c8 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -318,6 +318,7 @@ struct platform_data { acdb_deallocate_t acdb_deallocate; acdb_send_audio_cal_t acdb_send_audio_cal; acdb_send_audio_cal_v3_t acdb_send_audio_cal_v3; + acdb_send_audio_cal_v4_t acdb_send_audio_cal_v4; acdb_set_audio_cal_t acdb_set_audio_cal; acdb_get_audio_cal_t acdb_get_audio_cal; acdb_send_voice_cal_t acdb_send_voice_cal; @@ -3281,6 +3282,12 @@ void *platform_init(struct audio_device *adev) ALOGE("%s: Could not find the symbol acdb_send_audio_cal_v3 from %s", __func__, LIB_ACDB_LOADER); + my_data->acdb_send_audio_cal_v4 = (acdb_send_audio_cal_v4_t)dlsym(my_data->acdb_handle, + "acdb_loader_send_audio_cal_v4"); + if (!my_data->acdb_send_audio_cal_v4) + ALOGE("%s: Could not find the symbol acdb_send_audio_cal_v4 from %s", + __func__, LIB_ACDB_LOADER); + my_data->acdb_set_audio_cal = (acdb_set_audio_cal_t)dlsym(my_data->acdb_handle, "acdb_loader_set_audio_cal_v2"); if (!my_data->acdb_set_audio_cal) @@ -4966,6 +4973,7 @@ int platform_send_audio_calibration(void *platform, struct audio_usecase *usecas bool is_incall_rec_usecase = false; snd_device_t incall_rec_device; int sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE; + struct audio_backend_cfg backend_cfg = {0}; if (voice_is_in_call(my_data->adev)) is_incall_rec_usecase = voice_is_in_call_rec_stream(usecase->stream.in); @@ -5004,11 +5012,13 @@ int platform_send_audio_calibration(void *platform, struct audio_usecase *usecas acdb_dev_id = acdb_device_table[platform_get_spkr_prot_snd_device(new_snd_device[i])]; sample_rate = audio_extn_utils_get_app_sample_rate_for_device(my_data->adev, usecase, new_snd_device[i]); + platform_get_codec_backend_cfg(my_data->adev, new_snd_device[i], &backend_cfg); } else { // Use in_call_rec snd_device to extract the ACDB device ID instead of split snd devices acdb_dev_id = acdb_device_table[platform_get_spkr_prot_snd_device(snd_device)]; sample_rate = audio_extn_utils_get_app_sample_rate_for_device(my_data->adev, usecase, snd_device); + platform_get_codec_backend_cfg(my_data->adev, snd_device, &backend_cfg); } // Do not use Rx path default app type for TX path @@ -5017,6 +5027,12 @@ int platform_send_audio_calibration(void *platform, struct audio_usecase *usecas app_type = DEFAULT_APP_TYPE_TX_PATH; } + /* Override backend cfg sample rate in calibration for vi feedback usecase */ + if (usecase->id == USECASE_AUDIO_SPKR_CALIB_TX) { + ALOGV("Reset backend cfg sample rate to 8KHz for spkr calib Tx use case"); + backend_cfg.sample_rate = sample_rate; + } + if (acdb_dev_id < 0) { ALOGE("%s: Could not find acdb id for device(%d)", __func__, new_snd_device[i]); @@ -5041,7 +5057,11 @@ int platform_send_audio_calibration(void *platform, struct audio_usecase *usecas else acdb_dev_type = ACDB_DEV_TYPE_IN; - if (my_data->acdb_send_audio_cal_v3) { + if (my_data->acdb_send_audio_cal_v4) { + my_data->acdb_send_audio_cal_v4(acdb_dev_id, acdb_dev_type, + app_type, sample_rate, i, + backend_cfg.sample_rate); + } else if (my_data->acdb_send_audio_cal_v3) { my_data->acdb_send_audio_cal_v3(acdb_dev_id, acdb_dev_type, app_type, sample_rate, i); } else if (my_data->acdb_send_audio_cal) { @@ -6027,8 +6047,6 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o } else if (audio_extn_is_hifi_filter_enabled(adev, out, snd_device, my_data->codec_variant, channel_count, 1)) { snd_device = SND_DEVICE_OUT_HEADPHONES_HIFI_FILTER; - } else if (devices & SND_DEVICE_OUT_HEADPHONES_HIFI_FILTER) { - snd_device = SND_DEVICE_OUT_HEADPHONES_HIFI_FILTER; } else if (devices & AUDIO_DEVICE_OUT_LINE) { snd_device = SND_DEVICE_OUT_LINE; } else @@ -8279,9 +8297,10 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev, if (rate_str == NULL) { switch (sample_rate) { case 32000: - if (passthrough_enabled || (backend_idx == SPDIF_TX_BACKEND ) || - (backend_idx == HDMI_TX_BACKEND ) || - (backend_idx == HDMI_ARC_TX_BACKEND )) { + if (passthrough_enabled || (backend_idx == SPDIF_TX_BACKEND) || + (backend_idx == HDMI_TX_BACKEND) || + (backend_idx == HDMI_ARC_TX_BACKEND) || + (backend_idx == DISP_PORT_RX_BACKEND)) { rate_str = "KHZ_32"; break; } @@ -9997,11 +10016,12 @@ int platform_set_edid_channels_configuration(void *platform, int channels, int b struct platform_data *my_data = (struct platform_data *)platform; struct audio_device *adev = my_data->adev; edid_audio_info *info = NULL; - int channel_count = 2; - int i, ret; + int ret; char default_channelMap[MAX_CHANNELS_SUPPORTED] = {0}; struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params; int be_idx = -1; + int channel_alloc = 0; + int max_supported_channels = 0; if ((backend_idx != HDMI_RX_BACKEND) && (backend_idx != DISP_PORT_RX_BACKEND)) { @@ -10014,27 +10034,37 @@ int platform_set_edid_channels_configuration(void *platform, int channels, int b info = (edid_audio_info *)my_data->edid_info; adev_device_cfg_ptr += backend_idx; if(ret == 0 && info != NULL) { - if (channels > 2) { + if ((channels > 2) && (channels <= MAX_HDMI_CHANNEL_CNT)) { ALOGV("%s:able to get HDMI/DP sink capabilities multi channel playback", __func__); - for (i = 0; i < info->audio_blocks && i < MAX_EDID_BLOCKS; i++) { - if (info->audio_blocks_array[i].format_id == LPCM && - info->audio_blocks_array[i].channels > channel_count && - info->audio_blocks_array[i].channels <= MAX_HDMI_CHANNEL_CNT) { - channel_count = info->audio_blocks_array[i].channels; - } + max_supported_channels = platform_edid_get_max_channels(my_data); + if (channels > max_supported_channels) + channels = max_supported_channels; + // refer to HDMI spec CEA-861-E: Table 28 Audio InfoFrame Data Byte 4 + switch (channels) { + case 3: + channel_alloc = 0x02; break; + case 4: + channel_alloc = 0x06; break; + case 5: + channel_alloc = 0x0A; break; + case 6: + channel_alloc = 0x0B; break; + case 7: + channel_alloc = 0x12; break; + case 8: + channel_alloc = 0x13; break; + default: + ALOGE("%s: invalid channel %d", __func__, channels); + return -EINVAL; } - ALOGVV("%s:channel_count:%d", __func__, channel_count); - /* - * Channel map is set for supported hdmi max channel count even - * though the input channel count set on adm is less than or equal to - * max supported channel count - */ + ALOGVV("%s:channels:%d", __func__, channels); + if (adev_device_cfg_ptr->use_client_dev_cfg) { platform_set_channel_map(platform, adev_device_cfg_ptr->dev_cfg_params.channels, (char *)adev_device_cfg_ptr->dev_cfg_params.channel_map, -1, be_idx); } else { - platform_set_channel_map(platform, channel_count, info->channel_map, -1, be_idx); + platform_set_channel_map(platform, channels, info->channel_map, -1, be_idx); } if (adev_device_cfg_ptr->use_client_dev_cfg) { @@ -10043,8 +10073,8 @@ int platform_set_edid_channels_configuration(void *platform, int channels, int b platform_set_channel_allocation(platform, adev_device_cfg_ptr->dev_cfg_params.channel_allocation); } else { - platform_set_channel_allocation(platform, info->channel_allocation); - } + platform_set_channel_allocation(platform, channel_alloc); + } } else { if (adev_device_cfg_ptr->use_client_dev_cfg) { default_channelMap[0] = adev_device_cfg_ptr->dev_cfg_params.channel_map[0]; |