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

Commit e6ce631f authored by Weiyin Jiang's avatar Weiyin Jiang Committed by Gerrit - the friendly Code Review server
Browse files

hal: add AHAL hidl registration entry

Add AHAL hidl registration entry, and register AHAL extension service
from adev_open().

Change-Id: Idce42ba6da97a26fde6c88d23b7be71b886e376f
parent 14ecbad6
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -282,4 +282,7 @@ PRODUCT_PACKAGES += \
    android.hardware.audio.common@4.0-util \
    android.hardware.audio@4.0-impl \
    android.hardware.audio.effect@4.0 \
    android.hardware.audio.effect@4.0-impl
    android.hardware.audio.effect@4.0-impl \
    vendor.qti.hardware.audiohalext@1.0 \
    vendor.qti.hardware.audiohalext@1.0-impl \
    vendor.qti.hardware.audiohalext-utils
+17 −10
Original line number Diff line number Diff line
@@ -107,13 +107,13 @@ LOCAL_SRC_FILES := \

LOCAL_SRC_FILES += audio_extn/audio_extn.c \
                   audio_extn/audio_feature_manager.c \
                   audio_extn/audio_hidl.cpp \
                   audio_extn/utils.c \
                   audio_extn/source_track.c \
                   voice_extn/voice_extn.c \
                   audio_extn/fm.c \
                   voice_extn/compress_voip.c \
                   audio_extn/keep_alive.c

LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
@@ -345,7 +345,10 @@ LOCAL_SHARED_LIBRARIES := \
    libdl \
    libaudioutils \
    libexpat \
    libqti_vndfwk_detect
    libqti_vndfwk_detect \
    libhwbinder \
    libhidlbase \
    libhidltransport

LOCAL_C_INCLUDES += \
    external/tinyalsa/include \
@@ -452,8 +455,7 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_BATTERY_LISTENER)), true)
    LOCAL_CFLAGS += -DBATTERY_LISTENER_ENABLED
    LOCAL_SRC_FILES += audio_extn/battery_listener.cpp
    LOCAL_SHARED_LIBRARIES += android.hardware.health@1.0 android.hardware.health@2.0 \
                              libhidltransport libbase libhidlbase libhwbinder \
                              libutils android.hardware.power@1.2
                              libbase libutils android.hardware.power@1.2
    LOCAL_STATIC_LIBRARIES := libhealthhalutils
endif

@@ -467,6 +469,11 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FFV)), true)
    LOCAL_SRC_FILES += audio_extn/ffv.c
endif

ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AHAL_EXT)),true)
    LOCAL_CFLAGS += -DAHAL_EXT_ENABLED
    LOCAL_SHARED_LIBRARIES += vendor.qti.hardware.audiohalext@1.0
endif

LOCAL_CFLAGS += -Wall -Werror

LOCAL_COPY_HEADERS_TO   := mm-audio
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@

#include <cutils/str_parms.h>
#include "adsp_hdlr.h"
#include "audio_hidl.h"
#include "ip_hdlr_intf.h"
#include "battery_listener.h"
#include "platform_api.h"
+63 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above
 *     copyright notice, this list of conditions and the following
 *     disclaimer in the documentation and/or other materials provided
 *     with the distribution.
 *   * Neither the name of The Linux Foundation nor the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

//#define LOG_NDEBUG 0
#define LOG_TAG "audio_hw_hidl"

#include "audio_hidl.h"
#include <cutils/properties.h>
#include <log/log.h>
#include <hidl/HidlTransportSupport.h>
#include <hidl/LegacySupport.h>

#ifdef AHAL_EXT_ENABLED
#include <vendor/qti/hardware/audiohalext/1.0/IAudioHalExt.h>
using vendor::qti::hardware::audiohalext::V1_0::IAudioHalExt;
#endif

using namespace android::hardware;
using android::OK;

extern "C" {
int audio_extn_hidl_init() {

#ifdef AHAL_EXT_ENABLED
    if (!property_get_bool("vendor.audio.hal.ext.disabled", false)) {
        /* register audio HAL extension */
        bool fail = registerPassthroughServiceImplementation<IAudioHalExt>()!= OK;
        ALOGW_IF(fail, "Could not register AHAL extension");
    }
#endif

    /* to register other hidls */

    return 0;
}
}
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above
 *     copyright notice, this list of conditions and the following
 *     disclaimer in the documentation and/or other materials provided
 *     with the distribution.
 *   * Neither the name of The Linux Foundation nor the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _AUDIO_HIDL_H_
#define _AUDIO_HIDL_H_

#ifdef __cplusplus
extern "C" {
#endif
int audio_extn_hidl_init();
#ifdef __cplusplus
}
#endif

#endif /* _AUDIO_HIDL_H_ */
Loading