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

Commit 810a80d4 authored by Weiyin Jiang's avatar Weiyin Jiang
Browse files

hal: set stream channel when configuring HDMI devices

Speaker allocation doesn't represent the channel capability of HDMI
devices as the sink device can internally down mixing channels. From
host side, we need to set stream channel instead of device channel
deriving from speaker allocation when configuring HDMI devices.

CRs-Fixed: 2854942
Change-Id: Iac14f27eecf9ca5dc18a9c7b9581e3ca966d58ba
parent 1c15ca03
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -4070,7 +4070,7 @@ int start_output_stream(struct stream_out *out)

        if (out->realtime)
            platform_set_stream_channel_map(adev->platform, out->channel_mask,
                   out->pcm_device_id, &out->channel_map_param.channel_map[0]);
                   out->pcm_device_id, -1, &out->channel_map_param.channel_map[0]);

        out->pcm = pcm_open_prepare_helper(adev->snd_card, out->pcm_device_id,
                                       flags, pcm_open_retry_count,
@@ -4096,7 +4096,7 @@ int start_output_stream(struct stream_out *out)

        if (!out->realtime)
            platform_set_stream_channel_map(adev->platform, out->channel_mask,
                   out->pcm_device_id, &out->channel_map_param.channel_map[0]);
                   out->pcm_device_id, -1, &out->channel_map_param.channel_map[0]);

        // apply volume for voip playback after path is set up
        if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP)
@@ -4117,7 +4117,7 @@ int start_output_stream(struct stream_out *out)
         */
        if (popcount(out->channel_mask) > 2 || out->channel_map_param.channel_map[0])
            platform_set_stream_channel_map(adev->platform, out->channel_mask,
                       out->pcm_device_id, &out->channel_map_param.channel_map[0]);
                       out->pcm_device_id, -1, &out->channel_map_param.channel_map[0]);
        audio_enable_asm_bit_width_enforce_mode(adev->mixer,
                                                adev->dsp_bit_width_enforce_mode,
                                                true);
+7 −5
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -7263,14 +7263,14 @@ end:
}

int platform_set_stream_channel_map(void *platform, audio_channel_mask_t channel_mask,
                                               int snd_id, uint8_t *input_channel_map)
                                    int snd_id, int be_idx, uint8_t *input_channel_map)
{
    int ret = 0, i = 0;
    int channels = audio_channel_count_from_out_mask(channel_mask);

    char channel_map[AUDIO_CHANNEL_COUNT_MAX];
    memset(channel_map, 0, sizeof(channel_map));
    if (*input_channel_map) {
    if ((input_channel_map != NULL) && *input_channel_map) {
        for (i = 0; i < channels; i++) {
             ALOGV("%s:: Channel Map channel_map[%d] - %d", __func__, i, *input_channel_map);
             channel_map[i] = *input_channel_map;
@@ -7357,7 +7357,7 @@ int platform_set_stream_channel_map(void *platform, audio_channel_mask_t channel
                return -1;
        }
    }
    ret = platform_set_channel_map(platform, channels, channel_map, snd_id, -1);
    ret = platform_set_channel_map(platform, channels, channel_map, snd_id, be_idx);
    return ret;
}

@@ -7704,7 +7704,9 @@ int platform_set_edid_channels_configuration(void *platform, int channels, int b
                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, channels, info->channel_map, -1, -1);
                platform_set_stream_channel_map(platform,
                        audio_channel_out_mask_from_count(channels),
                        -1, -1, NULL);
            }

            if (adev_device_cfg_ptr->use_client_dev_cfg) {
+5 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2019, 2021 The Linux Foundation. All rights reserved.
 * Not a contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -1202,14 +1202,16 @@ int platform_get_edid_info(void *platform __unused)
}

int platform_set_channel_map(void *platform __unused, int ch_count __unused,
                             char *ch_map __unused, int snd_id __unused)
                             char *ch_map __unused, int snd_id __unused,
                             int be_idx __unused)
{
    return -ENOSYS;
}

int platform_set_stream_channel_map(void *platform __unused,
                                    audio_channel_mask_t channel_mask __unused,
                                    int snd_id __unused
                                    int snd_id __unused,
                                    int be_idx __unused,
                                    uint8_t *input_channel_map __unused)
{
    return -ENOSYS;
+6 −4
Original line number Diff line number Diff line
@@ -10802,14 +10802,14 @@ end:
}
int platform_set_stream_channel_map(void *platform, audio_channel_mask_t channel_mask,
                                               int snd_id, uint8_t *input_channel_map)
                                    int snd_id, int be_idx, uint8_t *input_channel_map)
{
    int ret = 0, i = 0;
    int channels = audio_channel_count_from_out_mask(channel_mask);
    char channel_map[AUDIO_CHANNEL_COUNT_MAX];
    memset(channel_map, 0, sizeof(channel_map));
    if (*input_channel_map) {
    if ((input_channel_map != NULL) && *input_channel_map) {
        for (i = 0; i < channels; i++) {
             ALOGV("%s:: Channel Map channel_map[%d] - %d", __func__, i, *input_channel_map);
             channel_map[i] = *input_channel_map;
@@ -10935,7 +10935,7 @@ int platform_set_stream_channel_map(void *platform, audio_channel_mask_t channel
                return -1;
        }
    }
    ret = platform_set_channel_map(platform, channels, channel_map, snd_id, -1);
    ret = platform_set_channel_map(platform, channels, channel_map, snd_id, be_idx);
    return ret;
}
@@ -11486,7 +11486,9 @@ int platform_set_edid_channels_configuration_v2(void *platform, int channels,
                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, channels, info->channel_map, -1, be_idx);
                platform_set_stream_channel_map(platform,
                        audio_channel_out_mask_from_count(channels),
                        -1, be_idx, NULL);
            }
            if (adev_device_cfg_ptr->use_client_dev_cfg) {
+2 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
 * Not a contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -283,7 +283,7 @@ int platform_get_supported_copp_sampling_rate(uint32_t stream_sr);
int platform_set_channel_map(void *platform, int ch_count, char *ch_map,
                             int snd_id, int be_idx);
int platform_set_stream_channel_map(void *platform, audio_channel_mask_t channel_mask,
                                   int snd_id, uint8_t *input_channel_map);
                                   int snd_id, int be_idx, uint8_t *input_channel_map);
int platform_set_stream_pan_scale_params(void *platform,
                                         int snd_id,
                                         struct mix_matrix_params mm_params);