Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4ca343f authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: fix DP-CTS failures"

parents 12ec1cad 03b2cb22
Loading
Loading
Loading
Loading
+32 −21
Original line number Diff line number Diff line
@@ -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,7 +7619,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) {
+33 −21
Original line number Diff line number Diff line
@@ -8284,7 +8284,8 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
                case 32000:
                    if (passthrough_enabled || (backend_idx == SPDIF_TX_BACKEND) ||
                        (backend_idx == HDMI_TX_BACKEND) ||
                        (backend_idx == HDMI_ARC_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,7 +10058,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) {