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

Commit 29555939 authored by SathishKumar Mani's avatar SathishKumar Mani Committed by Eric Laurent
Browse files

mm-audio: Fix delay with first voice call after bootup.

- Add csd init and deinit to HAL constructor and
  destructor
- Add conditional check for voice acdb loader

Bug-id: 7612431
Change-Id: I4165e659fa300abb184e2438a5d730bb2158c094
parent 365ce897
Loading
Loading
Loading
Loading
+21 −2
Original line number Original line Diff line number Diff line
@@ -57,6 +57,8 @@ extern "C"
    static void (*acdb_deallocate)();
    static void (*acdb_deallocate)();
#endif
#endif
#ifdef QCOM_CSDCLIENT_ENABLED
#ifdef QCOM_CSDCLIENT_ENABLED
    static int (*csd_client_init)();
    static int (*csd_client_deinit)();
    static int (*csd_start_playback)();
    static int (*csd_start_playback)();
    static int (*csd_stop_playback)();
    static int (*csd_stop_playback)();
#endif
#endif
@@ -128,8 +130,16 @@ AudioHardwareALSA::AudioHardwareALSA() :
                 ALOGE("AudioHardware: DLOPEN not successful for CSD CLIENT");
                 ALOGE("AudioHardware: DLOPEN not successful for CSD CLIENT");
             } else {
             } else {
                 ALOGD("AudioHardware: DLOPEN successful for CSD CLIENT");
                 ALOGD("AudioHardware: DLOPEN successful for CSD CLIENT");
                 csd_client_init = (int (*)())::dlsym(mCsdHandle,"csd_client_init");
                 csd_client_deinit = (int (*)())::dlsym(mCsdHandle,"csd_client_deinit");
                 csd_start_playback = (int (*)())::dlsym(mCsdHandle,"csd_client_start_playback");
                 csd_start_playback = (int (*)())::dlsym(mCsdHandle,"csd_client_start_playback");
                 csd_stop_playback = (int (*)())::dlsym(mCsdHandle,"csd_client_stop_playback");
                 csd_stop_playback = (int (*)())::dlsym(mCsdHandle,"csd_client_stop_playback");

                 if (csd_client_init == NULL) {
                    ALOGE("dlsym: Error:%s Loading csd_client_init", dlerror());
                 } else {
                    csd_client_init();
                 }
             }
             }
             mALSADevice->setCsdHandle(mCsdHandle);
             mALSADevice->setCsdHandle(mCsdHandle);
#endif
#endif
@@ -179,6 +189,10 @@ AudioHardwareALSA::AudioHardwareALSA() :
#ifdef QCOM_ACDB_ENABLED
#ifdef QCOM_ACDB_ENABLED
                if (mAcdbHandle) {
                if (mAcdbHandle) {
                    mUcMgr->acdb_handle = static_cast<void*> (mAcdbHandle);
                    mUcMgr->acdb_handle = static_cast<void*> (mAcdbHandle);
                    if (mFusion3Platform)
                        mUcMgr->isFusion3Platform = true;
                    else
                        mUcMgr->isFusion3Platform = false;
                }
                }
#endif
#endif
            }
            }
@@ -221,6 +235,11 @@ AudioHardwareALSA::~AudioHardwareALSA()


#ifdef QCOM_CSDCLEINT_ENABLED
#ifdef QCOM_CSDCLEINT_ENABLED
     if (mCsdHandle) {
     if (mCsdHandle) {
         if (csd_client_deinit == NULL) {
             ALOGE("dlsym: Error:%s Loading csd_client_deinit", dlerror());
         } else {
             csd_client_deinit();
         }
         ::dlclose(mCsdHandle);
         ::dlclose(mCsdHandle);
         mCsdHandle = NULL;
         mCsdHandle = NULL;
     }
     }
+2 −2
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 */
#define LOG_TAG "alsa_ucm"
#define LOG_TAG "alsa_ucm"
#define LOG_NDDEBUG 0
//#define LOG_NDDEBUG 0


#ifdef ANDROID
#ifdef ANDROID
/* definitions for Android logging */
/* definitions for Android logging */
@@ -673,7 +673,7 @@ int use_case_index)
                    ALOGD("Voice acdb: rx id %d tx id %d",
                    ALOGD("Voice acdb: rx id %d tx id %d",
                          uc_mgr->current_rx_device,
                          uc_mgr->current_rx_device,
                          uc_mgr->current_tx_device);
                          uc_mgr->current_tx_device);
                    if (uc_mgr->acdb_handle) {
                    if (uc_mgr->acdb_handle && !uc_mgr->isFusion3Platform) {
                        acdb_send_voice_cal = dlsym(uc_mgr->acdb_handle,"acdb_loader_send_voice_cal");
                        acdb_send_voice_cal = dlsym(uc_mgr->acdb_handle,"acdb_loader_send_voice_cal");
                        if (acdb_send_voice_cal == NULL) {
                        if (acdb_send_voice_cal == NULL) {
                            ALOGE("ucm: dlsym: Error:%s Loading acdb_loader_send_voice_cal", dlerror());
                            ALOGE("ucm: dlsym: Error:%s Loading acdb_loader_send_voice_cal", dlerror());
+2 −0
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@ extern "C" {


#include "alsa_ucm.h"
#include "alsa_ucm.h"
#include "alsa_audio.h"
#include "alsa_audio.h"
#include <stdbool.h>
#include <pthread.h>
#include <pthread.h>
#define SND_UCM_END_OF_LIST "end"
#define SND_UCM_END_OF_LIST "end"


@@ -169,6 +170,7 @@ struct snd_use_case_mgr {
    card_ctxt_t *card_ctxt_ptr;
    card_ctxt_t *card_ctxt_ptr;
    pthread_t thr;
    pthread_t thr;
    void *acdb_handle;
    void *acdb_handle;
    bool isFusion3Platform;
};
};


#define MAX_NUM_CARDS (sizeof(card_list)/sizeof(char *))
#define MAX_NUM_CARDS (sizeof(card_list)/sizeof(char *))