diff options
author | Weiyin Jiang <wjiang@codeaurora.org> | 2019-09-04 16:45:45 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-11-18 13:23:31 -0800 |
commit | 03b2cb224b7ed0bb7072d2a44b6564eb577be164 (patch) | |
tree | c508f45077e66f6c0d266dc2d9df937c9d53db11 /hal | |
parent | e3c11a322d065bab6bd52d27cd2d01aeff331ca7 (diff) | |
download | android_hardware_qcom_audio-03b2cb224b7ed0bb7072d2a44b6564eb577be164.tar.gz android_hardware_qcom_audio-03b2cb224b7ed0bb7072d2a44b6564eb577be164.tar.bz2 android_hardware_qcom_audio-03b2cb224b7ed0bb7072d2a44b6564eb577be164.zip |
hal: fix DP-CTS failures
- DP driver supports 32KHz, so update HAL to allow 32KHz samplerate
- Derive channel map and channel allocation based on input channel count
CRs-Fixed: 2519839, 2519881
Change-Id: I321bea7096ba158bb5b6bb4968b938a1eb2b4cae
Diffstat (limited to 'hal')
-rw-r--r-- | hal/msm8916/platform.c | 53 | ||||
-rw-r--r-- | hal/msm8974/platform.c | 54 |
2 files changed, 65 insertions, 42 deletions
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c index 64e93835..6e16e169 100644 --- a/hal/msm8916/platform.c +++ b/hal/msm8916/platform.c @@ -6115,7 +6115,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; } @@ -7569,37 +7570,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) { @@ -7608,8 +7619,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]; @@ -7619,7 +7630,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 976d1c70..f955babe 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -8282,9 +8282,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; } @@ -10000,11 +10001,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)) { @@ -10017,27 +10019,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) { @@ -10046,8 +10058,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]; |