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

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

Merge "hal: Fix device list initializations and comparisons"

parents b6891452 9c2fd895
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3668,7 +3668,8 @@ int audio_extn_set_device_cfg_params(struct audio_device *adev,
    backend_idx = platform_get_backend_index(snd_device);

    ALOGV("%s:: device %d sample_rate %d snd_device %d backend_idx %d",
                __func__, get_device_types(&out.device_list), out.sample_rate, snd_device, backend_idx);
                __func__, get_device_types(&out.device_list),
                out.sample_rate, snd_device, backend_idx);

    ALOGV("%s:: Device Config Params from Client samplerate %d  channels %d"
          " bit_width %d  format %d  device %d  channel_map[0] %d channel_map[1] %d"
+2 −0
Original line number Diff line number Diff line
@@ -506,6 +506,7 @@ static void *audio_extn_cirrus_calibration_thread() {
    uc_info_rx->in_snd_device = SND_DEVICE_NONE;
    uc_info_rx->stream.out = adev->primary_output;
    uc_info_rx->out_snd_device = SND_DEVICE_OUT_SPEAKER;
    list_init(&uc_info_rx->device_list);
    list_add_tail(&adev->usecase_list, &uc_info_rx->list);

    fp_enable_snd_device(adev, SND_DEVICE_OUT_SPEAKER);
@@ -846,6 +847,7 @@ int spkr_prot_start_processing(snd_device_t snd_device) {
    uc_info_tx->type = PCM_CAPTURE;
    uc_info_tx->in_snd_device = SND_DEVICE_IN_CAPTURE_VI_FEEDBACK;
    uc_info_tx->out_snd_device = SND_DEVICE_NONE;
    list_init(&uc_info_tx->device_list);
    handle.pcm_tx = NULL;

    list_add_tail(&adev->usecase_list, &uc_info_tx->list);
+3 −3
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ const char *get_usb_device_address(struct listnode *devices)
    struct audio_device_info *item = NULL;

    if (devices == NULL)
        return false;
        return "";

    list_for_each (node, devices) {
        item = node_to_item(node, struct audio_device_info, list);
@@ -397,7 +397,7 @@ bool compare_devices_for_any_match(struct listnode *d1, struct listnode *d2)
/*
 * Returns all device types from list in bitfield
 * ToDo: Use of this function is not recommended.
 * It has been introduced for compatability with legacy functions.
 * It has been introduced for compatibility with legacy functions.
 * This can be removed once audio HAL switches to device
 * list usage for all audio extensions.
 */
@@ -408,7 +408,7 @@ audio_devices_t get_device_types(struct listnode *devices)
    audio_devices_t device_type = AUDIO_DEVICE_NONE;

    if (devices == NULL)
        return false;
        return AUDIO_DEVICE_NONE;

    list_for_each (node, devices) {
        item = node_to_item(node, struct audio_device_info, list);
+12 −2
Original line number Diff line number Diff line
@@ -370,16 +370,18 @@ void audio_extn_dolby_set_endpoint(struct audio_device *adev)
{
    struct listnode *node;
    struct audio_usecase *usecase;
    struct listnode devices;
    struct mixer_ctl *ctl;
    const char *mixer_ctl_name = "DS1 DAP Endpoint";
    int endpoint = 0, ret;
    bool send = false;

    list_init(&devices);
    list_for_each(node, &adev->usecase_list) {
        usecase = node_to_item(node, struct audio_usecase, list);
        if ((usecase->type == PCM_PLAYBACK) &&
            (usecase->id != USECASE_AUDIO_PLAYBACK_LOW_LATENCY)) {
            endpoint |= is_audio_out_device_type(&usecase->device_list);
            append_devices(&devices, &usecase->device_list);
            send = true;
        }
    }
@@ -392,6 +394,9 @@ void audio_extn_dolby_set_endpoint(struct audio_device *adev)
              __func__, mixer_ctl_name);
        return;
    }
    // FIXME: It is not recommended to store more than one device on bitfields
    // This handling should be updated here and in driver code.
    endpoint = get_device_types(&devices);
    ret = mixer_ctl_set_value(ctl, 0, endpoint);
    if (ret)
        ALOGE("%s: Dolby set endpint cannot be set error:%d",__func__, ret);
@@ -524,20 +529,25 @@ int audio_extn_dap_hal_deinit() {
void audio_extn_dolby_ds2_set_endpoint(struct audio_device *adev) {
    struct listnode *node;
    struct audio_usecase *usecase;
    struct listnode devices;
    int endpoint = 0;
    bool send = false;

    list_init(&devices);
    list_for_each(node, &adev->usecase_list) {
        usecase = node_to_item(node, struct audio_usecase, list);
        if ((usecase->type == PCM_PLAYBACK) &&
            (usecase->id != USECASE_AUDIO_PLAYBACK_LOW_LATENCY)) {
            endpoint |= is_audio_out_device_type(&usecase->device_list);
            append_devices(&devices, &usecase->device_list);
            send = true;
        }
    }
    if (!send)
        return;

    // FIXME: It is not recommended to store more than one device on bitfields
    // This handling should be updated here and in driver code.
    endpoint = get_device_types(&devices);
    if (ds2extnmod.dap_hal_set_hw_info) {
        ds2extnmod.dap_hal_set_hw_info(HW_ENDPOINT, (void*)(&endpoint));
        ALOGE("%s: Dolby set endpint :0x%x",__func__, endpoint);
+1 −0
Original line number Diff line number Diff line
@@ -309,6 +309,7 @@ static int32_t start_hfp(struct audio_device *adev,
    uc_info->id = hfpmod.ucid;
    uc_info->type = PCM_HFP_CALL;
    uc_info->stream.out = adev->primary_output;
    list_init(&uc_info->device_list);
    assign_devices(&uc_info->device_list, &adev->primary_output->device_list);
    uc_info->in_snd_device = SND_DEVICE_NONE;
    uc_info->out_snd_device = SND_DEVICE_NONE;
Loading