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

Commit b88bda11 authored by Haynes Mathew George's avatar Haynes Mathew George Committed by android-build-merger
Browse files

audio: Fix to avoid co-existance of usb and voice-usb

am: 39c55dcd

Change-Id: I6f894567187e8d8565110e20143f89e6b1543583
parents cf03d7fe 39c55dcd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -866,7 +866,8 @@ static void check_and_route_playback_usecases(struct audio_device *adev,

        if (force_routing ||
            (usecase->out_snd_device != snd_device &&
             usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND &&
             (usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND ||
              usecase->devices & (AUDIO_DEVICE_OUT_USB_DEVICE|AUDIO_DEVICE_OUT_USB_HEADSET)) &&
             platform_check_backends_match(snd_device, usecase->out_snd_device))) {
            ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..",
                  __func__, use_case_table[usecase->id],
+5 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@
/* fallback app type if the default app type from acdb loader fails */
#define DEFAULT_APP_TYPE_RX_PATH  0x11130
#define DEFAULT_APP_TYPE_TX_PATH  0x11132
#define DEFAULT_RX_BACKEND "SLIMBUS_0_RX"

/* Retry for delay in FW loading*/
#define RETRY_NUMBER 20
@@ -1174,6 +1175,10 @@ bool platform_check_backends_match(snd_device_t snd_device1, snd_device_t snd_de
    if (NULL != be_itf1 && NULL != be_itf2) {
        if ((NULL == strstr(be_itf2, be_itf1)) && (NULL == strstr(be_itf1, be_itf2)))
            result = false;
    } else if (NULL != be_itf2 && (NULL == strstr(be_itf2, DEFAULT_RX_BACKEND))) {
        result = false;
    } else if (NULL != be_itf1 && (NULL == strstr(be_itf1, DEFAULT_RX_BACKEND))) {
        result = false;
    }

    ALOGV("%s: be_itf1 = %s, be_itf2 = %s, match %d", __func__, be_itf1, be_itf2, result);
+16 −9
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@

#define DEFAULT_APP_TYPE_RX_PATH  69936
#define DEFAULT_APP_TYPE_TX_PATH  69938
#define DEFAULT_RX_BACKEND "SLIMBUS_0_RX"

#define TOSTRING_(x) #x
#define TOSTRING(x) TOSTRING_(x)
@@ -1642,8 +1643,6 @@ void platform_add_backend_name(void *platform, char *mixer_path,

bool platform_check_backends_match(snd_device_t snd_device1, snd_device_t snd_device2)
{
    bool result = true;

    ALOGV("%s: snd_device1 = %s, snd_device2 = %s", __func__,
                platform_get_snd_device_name(snd_device1),
                platform_get_snd_device_name(snd_device2));
@@ -1658,16 +1657,24 @@ bool platform_check_backends_match(snd_device_t snd_device1, snd_device_t snd_de
                platform_get_snd_device_name(snd_device2));
        return false;
    }

    const char * be_itf1 = hw_interface_table[snd_device1];
    const char * be_itf2 = hw_interface_table[snd_device2];

    if (NULL != be_itf1 && NULL != be_itf2) {
        if ((NULL == strstr(be_itf2, be_itf1)) && (NULL == strstr(be_itf1, be_itf2)))
            result = false;
    /*
      hw_interface_table has overrides for a snd_device.
      if there is no entry for a device, assume DEFAULT_RX_BACKEND
    */
    if (be_itf1 == NULL) {
        be_itf1 = DEFAULT_RX_BACKEND;
    }

    ALOGV("%s: be_itf1 = %s, be_itf2 = %s, match %d", __func__, be_itf1, be_itf2, result);
    return result;
    if (be_itf2 == NULL) {
        be_itf2 = DEFAULT_RX_BACKEND;
    }
    ALOGV("%s: be_itf1 = %s, be_itf2 = %s", __func__, be_itf1, be_itf2);
    /*
      this takes care of finding a device within a combo device pair as well
     */
    return strstr(be_itf1, be_itf2) != NULL || strstr(be_itf2, be_itf1) != NULL;
}

int platform_get_pcm_device_id(audio_usecase_t usecase, int device_type)