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

Commit 8005dc82 authored by Avinash Vaish's avatar Avinash Vaish Committed by Gerrit - the friendly Code Review server
Browse files

hal: Send voice cal data before routing voice usecases

-The sound intensity is drastically reduced in a DSDA call when
a particular device is re-selected after a device switch.
It is observed that for the active sub, acdb data tables are
registered to ADSP even before the right acdb tables are
sent to the acdb driver. Therefore, the tables which are infact
registered to the ADSP correspond to the previous device.
- Load the acdb files into the kernel memory before routing
voice usecases to prevent any incorrect tables being sent.

CRs-Fixed: 694397
Change-Id: Id2f2a43c887d9b9e74cd98858013d1ef655a93e3
parent 939b6054
Loading
Loading
Loading
Loading
+27 −3
Original line number Diff line number Diff line
@@ -219,6 +219,26 @@ static int get_snd_codec_id(audio_format_t format)
    return id;
}

static int enable_audio_route_for_voice_usecases(struct audio_device *adev,
                                                 struct audio_usecase *uc_info)
{
    struct listnode *node;
    struct audio_usecase *usecase;

    if (uc_info == NULL)
        return -EINVAL;

    /* Re-route all voice usecases on the shared backend other than the
       specified usecase to new snd devices */
    list_for_each(node, &adev->usecase_list) {
        usecase = node_to_item(node, struct audio_usecase, list);
        if ((usecase->type == VOICE_CALL || usecase->type == VOIP_CALL) &&
             (usecase != uc_info))
            enable_audio_route(adev, usecase);
    }
    return 0;
}

int enable_audio_route(struct audio_device *adev,
                       struct audio_usecase *usecase)
{
@@ -432,6 +452,7 @@ static void check_usecases_codec_backend(struct audio_device *adev,
            /* Update the out_snd_device only before enabling the audio route */
            if (switch_device[usecase->id] ) {
                usecase->out_snd_device = snd_device;
                if (usecase->type != VOICE_CALL && usecase->type != VOIP_CALL)
                    enable_audio_route(adev, usecase);
            }
        }
@@ -498,6 +519,7 @@ static void check_and_route_capture_usecases(struct audio_device *adev,
            /* Update the in_snd_device only before enabling the audio route */
            if (switch_device[usecase->id] ) {
                usecase->in_snd_device = snd_device;
                if (usecase->type != VOICE_CALL && usecase->type != VOIP_CALL)
                    enable_audio_route(adev, usecase);
            }
        }
@@ -692,10 +714,12 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
        enable_snd_device(adev, in_snd_device);
    }

    if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL)
    if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL) {
        status = platform_switch_voice_call_device_post(adev->platform,
                                                        out_snd_device,
                                                        in_snd_device);
        enable_audio_route_for_voice_usecases(adev, usecase);
    }

    usecase->in_snd_device = in_snd_device;
    usecase->out_snd_device = out_snd_device;