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

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

Merge "hal: update QCHAT pcm device ID for external codec hardware"

parents 226fa947 ed408a10
Loading
Loading
Loading
Loading
+48 −5
Original line number Diff line number Diff line
@@ -210,6 +210,14 @@ struct platform_data {
    bool edid_valid;
};

static bool is_external_codec = false;
static const int pcm_device_table_of_ext_codec[AUDIO_USECASE_MAX][2] = {
   [USECASE_QCHAT_CALL] = {QCHAT_CALL_PCM_DEVICE_OF_EXT_CODEC, QCHAT_CALL_PCM_DEVICE_OF_EXT_CODEC}
};

/* List of use cases that has different PCM device ID's for internal and external codecs */
static const int misc_usecase[AUDIO_USECASE_MAX] = { USECASE_QCHAT_CALL };

int pcm_device_table[AUDIO_USECASE_MAX][2] = {
    [USECASE_AUDIO_PLAYBACK_DEEP_BUFFER] = {DEEP_BUFFER_PCM_DEVICE,
                                            DEEP_BUFFER_PCM_DEVICE},
@@ -677,6 +685,32 @@ static int msm_device_to_be_id_external_codec [][NO_COLS] = {
#define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL)
#define LOW_LATENCY_PLATFORM_DELAY (13*1000LL)

static bool is_misc_usecase(audio_usecase_t usecase) {
     bool ret = false;
     int i;

     for (i = 0; i < AUDIO_USECASE_MAX; i++) {
          if(usecase == misc_usecase[i]) {
             ret = true;
             break;
          }
     }
     return ret;
}


static void update_codec_type(const char *snd_card_name) {

     if (!strncmp(snd_card_name, "msm8939-tapan-snd-card",
                  sizeof("msm8939-tapan-snd-card")) ||
         !strncmp(snd_card_name, "msm8939-tapan9302-snd-card",
                  sizeof("msm8939-tapan9302-snd-card"))||
         !strncmp(snd_card_name, "msm8939-tomtom9330-snd-card",
                  sizeof("msm8939-tomtom9330-snd-card"))) {
         ALOGI("%s: snd_card_name: %s",__func__,snd_card_name);
         is_external_codec = true;
     }
}
static void query_platform(const char *snd_card_name,
                                      char *mixer_xml_path)
{
@@ -1201,6 +1235,7 @@ void *platform_init(struct audio_device *adev)
                return NULL;
            }
            adev->snd_card = snd_card_num;
            update_codec_type(snd_card_name);
            ALOGD("%s: Opened sound card:%d", __func__, snd_card_num);
            break;
        }
@@ -1465,11 +1500,19 @@ void platform_add_backend_name(char *mixer_path, snd_device_t snd_device)

int platform_get_pcm_device_id(audio_usecase_t usecase, int device_type)
{
    int device_id;
    int device_id = -1;

    if (is_external_codec && is_misc_usecase(usecase)) {
        if (device_type == PCM_PLAYBACK)
            device_id = pcm_device_table_of_ext_codec[usecase][0];
        else
            device_id = pcm_device_table_of_ext_codec[usecase][1];
    } else {
        if (device_type == PCM_PLAYBACK)
            device_id = pcm_device_table[usecase][0];
        else
            device_id = pcm_device_table[usecase][1];
    }
    return device_id;
}

+1 −0
Original line number Diff line number Diff line
@@ -244,6 +244,7 @@ enum {
#define VOICE2_CALL_PCM_DEVICE 13
#define VOLTE_CALL_PCM_DEVICE 15
#define QCHAT_CALL_PCM_DEVICE 26
#define QCHAT_CALL_PCM_DEVICE_OF_EXT_CODEC 28
#define VOWLAN_CALL_PCM_DEVICE 16

#define AFE_PROXY_PLAYBACK_PCM_DEVICE 7