summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2020-03-08 00:22:34 +0200
committerMichael Bestas <mkbestas@lineageos.org>2020-03-08 00:22:34 +0200
commit102e042c83163f65033a8d45fa43fe617a218165 (patch)
treec9bec47b5d26064308da319456582e2dca0ba39e
parente33f7766230b220a05f01f86c7791c456ec144eb (diff)
parent301bcd5826691453ace890687bc3db0b4059af94 (diff)
downloadandroid_hardware_qcom_audio-lineage-17.1-caf-msm8996.tar.gz
android_hardware_qcom_audio-lineage-17.1-caf-msm8996.tar.bz2
android_hardware_qcom_audio-lineage-17.1-caf-msm8996.zip
Merge tag 'LA.UM.8.6.r1-04000-89xx.0' of https://source.codeaurora.org/quic/la/platform/hardware/qcom/audio into lineage-17.1-caf-msm8996lineage-17.1-caf-msm8996
"LA.UM.8.6.r1-04000-89xx.0" Change-Id: Iecaceca787c94035d721317f3ed592e0ef5f9dc1
-rw-r--r--hal/msm8916/platform.c61
-rw-r--r--hal/msm8974/platform.c50
2 files changed, 70 insertions, 41 deletions
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 5305250b..5ab79799 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -20,6 +20,12 @@
#define LOG_TAG "msm8916_platform"
/*#define LOG_NDEBUG 0*/
#define LOG_NDDEBUG 0
+/*#define VERY_VERY_VERBOSE_LOGGING*/
+#ifdef VERY_VERY_VERBOSE_LOGGING
+#define ALOGVV ALOGV
+#else
+#define ALOGVV(a...) do { } while(0)
+#endif
#include <stdlib.h>
#include <dlfcn.h>
@@ -5966,7 +5972,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;
}
@@ -7404,37 +7411,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) {
@@ -7443,8 +7460,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];
@@ -7454,7 +7471,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 fe40a167..98a9ce4d 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -6142,7 +6142,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;
}
@@ -7626,11 +7627,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)) {
@@ -7643,27 +7645,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) {
@@ -7672,7 +7684,7 @@ 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) {