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

Commit 425e154c authored by Ravi Kumar Alamanda's avatar Ravi Kumar Alamanda Committed by Jean-Michel Trivi
Browse files

hal: msm8974: Conditional device switch to swap LR channels

If the acdb tuning is different for speaker and speaker-reverse
devices, it is must to do device switch.

Bug: 24138099
Change-Id: Ic2130b9700c884a0d838f04545c8dd9406b69304
parent a1478073
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -2418,6 +2418,15 @@ int platform_swap_lr_channels(struct audio_device *adev, bool swap_channels)
            usecase = node_to_item(node, struct audio_usecase, list);
            if (usecase->type == PCM_PLAYBACK &&
                    usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER) {
                /*
                 * If acdb tuning is different for SPEAKER_REVERSE, it is must
                 * to perform device switch to disable the current backend to
                 * enable it with new acdb data.
                 */
                if (acdb_device_table[SND_DEVICE_OUT_SPEAKER] !=
                    acdb_device_table[SND_DEVICE_OUT_SPEAKER_REVERSE]) {
                    select_devices(adev, usecase->id);
                } else {
                    const char *mixer_path;
                    if (swap_channels) {
                        mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_REVERSE);
@@ -2426,6 +2435,7 @@ int platform_swap_lr_channels(struct audio_device *adev, bool swap_channels)
                        mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER);
                        audio_route_apply_and_update_path(adev->audio_route, mixer_path);
                    }
                }
                break;
            }
        }