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

Commit 4ba65882 authored by Zhou Song's avatar Zhou Song
Browse files

hal: add new case when derive sound device

This adds a new use case which handle issue below:
  1. playback1 is active on device_1 with beckend_1
  2. playback2 comes with combo device_11(related
     device) with backend_1 and device_2 with beckend_2
  3. as device_11 and device_2 are not backend matched,
     this can lead device1 + device_11 + device_2 to be
     active at the same time
  4. later, when playback1 is disabled, then disabling
     device_1 will also disable backend_1, which makes
     playback2 on device_11 breaks

To resolve it, need to return with device_11 to make
sure device_1 is disabled and then enable device_11 for
both playback1 and playback2.

Change-Id: I963318fa2872e889286e54d765d348c313695486
parent d8c2eeb2
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -1246,6 +1246,11 @@ case 7

  resolution: no need to switch

case 8
  uc->dev d1 (a1)                B1
  new_uc->dev d11 (a1), d2 (a2)  B1, B2
  resolution: compared to case 1, for this case, d1 and d11 are related
  then need to do the same as case 2 to siwtch to new uc
*/
static snd_device_t derive_playback_snd_device(void * platform,
                                               struct audio_usecase *uc,
@@ -1293,7 +1298,11 @@ static snd_device_t derive_playback_snd_device(void * platform,
        if (platform_check_backends_match(d3[0], d3[1])) {
            return d2; // case 5
        } else {
            // check if d1 and d3[1] are related
            if (d1 == d3[1])
                return d1; // case 1
            else
                return d3[1]; // case 8
        }
    } else {
        if (platform_check_backends_match(d1, d2)) {