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

Commit 91909a1b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: Prevent superfluous device tear down on routing change"

parents 49c8dcec 25b344d5
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -1330,7 +1330,8 @@ static void check_usecases_codec_backend(struct audio_device *adev,
    bool switch_device[AUDIO_USECASE_MAX];
    snd_device_t uc_derive_snd_device;
    snd_device_t derive_snd_device[AUDIO_USECASE_MAX];
    int i, num_uc_to_switch = 0;
    snd_device_t split_snd_devices[SND_DEVICE_OUT_END];
    int i, num_uc_to_switch = 0, num_devices = 0;
    int status = 0;
    bool force_restart_session = false;
    /*
@@ -1412,9 +1413,22 @@ static void check_usecases_codec_backend(struct audio_device *adev,
        list_for_each(node, &adev->usecase_list) {
            usecase = node_to_item(node, struct audio_usecase, list);
            if (switch_device[usecase->id]) {
                /* Check if sound device to be switched can be split and if any
                   of the split devices match with derived sound device */
                platform_split_snd_device(adev->platform, usecase->out_snd_device,
                                          &num_devices, split_snd_devices);
                if (num_devices > 1) {
                    for (i = 0; i < num_devices; i++) {
                        /* Disable devices that do not match with derived sound device */
                        if (split_snd_devices[i] != derive_snd_device[usecase->id]) {
                            disable_snd_device(adev, split_snd_devices[i]);
                        }
                    }
                } else {
                    disable_snd_device(adev, usecase->out_snd_device);
                }
            }
        }

        list_for_each(node, &adev->usecase_list) {
            usecase = node_to_item(node, struct audio_usecase, list);