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

Commit d2f10ba3 authored by Sidipotu Ashok's avatar Sidipotu Ashok Committed by Md Mansoor Ahmed
Browse files

hal: Add QAP extention

Add new source file in audio_extn folder

Change-Id: If62e948f74f5e9e933704b5b6e061471d3a62a38
parent f81da24f
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -210,12 +210,14 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_QAF)),true)
endif

# Hardware specific feature
ifeq ($(strip $(BOARD_SUPPORTS_QAHW)),true)
    LOCAL_CFLAGS += -DAUDIO_HW_EXTN_API_ENABLED
    LOCAL_SRC_FILES += audio_hw_extn_api.c
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_QAP)),true)
LOCAL_CFLAGS += -DQAP_EXTN_ENABLED -Wno-tautological-pointer-compare
LOCAL_SRC_FILES += audio_extn/qap.c
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/qap_wrapper/
LOCAL_HEADER_LIBRARIES += audio_qaf_headers
LOCAL_SHARED_LIBRARIES += libqap_wrapper liblog
endif

# Hardware specific feature
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_LISTEN)),true)
    LOCAL_CFLAGS += -DAUDIO_LISTEN_ENABLED
    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audio-listen
+2 −0
Original line number Diff line number Diff line
@@ -5141,6 +5141,8 @@ void audio_extn_set_parameters(struct audio_device *adev,
   audio_extn_passthru_set_parameters(adev, parms);
   audio_extn_ext_disp_set_parameters(adev, parms);
   audio_extn_qaf_set_parameters(adev, parms);
   if (audio_extn_qap_is_enabled())
       audio_extn_qap_set_parameters(adev, parms);
   if (adev->offload_effects_set_parameters != NULL)
       adev->offload_effects_set_parameters(parms);
   audio_extn_set_aptx_dec_bt_addr(adev, parms);
+53 −0
Original line number Diff line number Diff line
@@ -910,6 +910,59 @@ bool audio_extn_is_qaf_stream(struct stream_out *out);
#define audio_extn_is_qaf_stream(out)                                   (0)
#endif


#ifdef QAP_EXTN_ENABLED
/*
 * Helper funtion to know if HAL QAP extention is enabled or not.
 */
bool audio_extn_qap_is_enabled();
/*
 * QAP HAL extention init, called during bootup/HAL device open.
 * QAP library will be loaded in this funtion.
 */
int audio_extn_qap_init(struct audio_device *adev);
void audio_extn_qap_deinit();
/*
 * if HAL QAP is enabled and inited succesfully then all then this funtion
 * gets called for all the open_output_stream requests, in other words
 * the core audio_hw->open_output_stream is overridden by this funtion
 */
int audio_extn_qap_open_output_stream(struct audio_hw_device *dev,
                                   audio_io_handle_t handle,
                                   audio_devices_t devices,
                                   audio_output_flags_t flags,
                                   struct audio_config *config,
                                   struct audio_stream_out **stream_out,
                                   const char *address __unused);
void audio_extn_qap_close_output_stream(struct audio_hw_device *dev __unused,
                                        struct audio_stream_out *stream);
/*
 * this funtion is how HAL QAP extention gets to know the device connection/disconnection
 */
int audio_extn_qap_set_parameters(struct audio_device *adev, struct str_parms *parms);
int audio_extn_qap_out_set_param_data(struct stream_out *out,
                           audio_extn_param_id param_id,
                           audio_extn_param_payload *payload);
int audio_extn_qap_out_get_param_data(struct stream_out *out,
                             audio_extn_param_id param_id,
                             audio_extn_param_payload *payload);
/*
 * helper funtion.
 */
bool audio_extn_is_qap_stream(struct stream_out *out);
#else
#define audio_extn_qap_is_enabled()                                     (0)
#define audio_extn_qap_deinit()                                         (0)
#define audio_extn_qap_close_output_stream         adev_close_output_stream
#define audio_extn_qap_open_output_stream           adev_open_output_stream
#define audio_extn_qap_init(adev)                                       (0)
#define audio_extn_qap_set_parameters(adev, parms)                      (0)
#define audio_extn_qap_out_set_param_data(out, param_id, payload)       (0)
#define audio_extn_qap_out_get_param_data(out, param_id, payload)       (0)
#define audio_extn_is_qap_stream(out)                                   (0)
#endif


#ifdef AUDIO_EXTN_BT_HAL_ENABLED
int audio_extn_bt_hal_load(void **handle);
int audio_extn_bt_hal_open_output_stream(void *handle, int in_rate, audio_channel_mask_t channel_mask, int bit_width);

hal/audio_extn/qap.c

0 → 100644
+3137 −0

File added.

Preview size limit exceeded, changes collapsed.

+16 −0
Original line number Diff line number Diff line
@@ -8915,6 +8915,8 @@ static int adev_close(hw_device_t *device)
        audio_extn_utils_release_streams_cfg_lists(
                      &adev->streams_output_cfg_list,
                      &adev->streams_input_cfg_list);
        if (audio_extn_qap_is_enabled())
            audio_extn_qap_deinit();
        if (audio_extn_qaf_is_enabled())
            audio_extn_qaf_deinit();
        audio_route_free(adev->audio_route);
@@ -9195,6 +9197,20 @@ static int adev_open(const hw_module_t *module, const char *name,
    }

    adev->extspk = audio_extn_extspk_init(adev);
    if (audio_extn_qap_is_enabled()) {
        ret = audio_extn_qap_init(adev);
        if (ret < 0) {
            pthread_mutex_destroy(&adev->lock);
            free(adev);
            adev = NULL;
            ALOGE("%s: Failed to init platform data, aborting.", __func__);
            *device = NULL;
            pthread_mutex_unlock(&adev_init_lock);
            return ret;
        }
        adev->device.open_output_stream = audio_extn_qap_open_output_stream;
        adev->device.close_output_stream = audio_extn_qap_close_output_stream;
    }

    if (audio_extn_qaf_is_enabled()) {
        ret = audio_extn_qaf_init(adev);
Loading