davinci: tfa98xx: Cleanup audio_amplifier

* Drop unnecessary shared libraries and c includes
* Replace libhardware c include with libhardware_headers
* Drop unused includes and commented code
* Refactor is_speaker to a bool
* Alphabetize share libraries and speaker devices
* Replace hard-coded sm6150 with $(TARGET_BOARD_PLATFORM)
* Drop unnecessary optional tag

Change-Id: I067e0dae75021cd677892d3b83fbe922fef245f5
This commit is contained in:
Arian 2020-10-04 16:06:03 +02:00
parent fdf5278aba
commit d55ed606b2
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9
2 changed files with 19 additions and 40 deletions

View File

@ -18,37 +18,27 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES := \
libbase \
liblog \
libcutils \
libtinyalsa \
libtinycompress \
audio.primary.$(TARGET_BOARD_PLATFORM) \
libaudioroute \
libdl \
libaudioutils \
libhwbinder \
libhidlbase \
libprocessgroup \
libutils \
audio.primary.sm6150
libcutils \
liblog \
libtinyalsa \
libtinycompress
LOCAL_C_INCLUDES += \
external/tinyalsa/include \
external/tinycompress/include \
hardware/libhardware/include \
system/media/audio_utils/include \
$(call include-path-for, audio-effects) \
$(call include-path-for, audio-route) \
$(call include-path-for,audio-route) \
$(call project-path-for,qcom-audio)/hal \
$(call project-path-for,qcom-audio)/hal/msm8974 \
$(call project-path-for,qcom-audio)/hal/audio_extn \
$(call project-path-for,qcom-audio)/hal/voice_extn
LOCAL_HEADER_LIBRARIES := generated_kernel_headers
LOCAL_HEADER_LIBRARIES := \
generated_kernel_headers \
libhardware_headers
LOCAL_SRC_FILES := tfa98xx_feedback.c
LOCAL_MODULE := audio_amplifier.sm6150
LOCAL_MODULE := audio_amplifier.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
LOCAL_VENDOR_MODULE := true
include $(BUILD_SHARED_LIBRARY)

View File

@ -16,21 +16,12 @@
*/
#define LOG_TAG "audio_amplifier_tfa98xx"
//#define LOG_NDEBUG 0
#include <cutils/str_parms.h>
#include <hardware/audio_amplifier.h>
#include <hardware/hardware.h>
#include <log/log.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
/* clang-format off */
#include "audio_hw.h"
#include "platform.h"
#include "platform_api.h"
/* clang-format on */
#define UNUSED __attribute__((unused))
@ -43,22 +34,20 @@ typedef struct amp_device {
static tfa_t* tfa_dev = NULL;
static int is_speaker(uint32_t snd_device) {
int speaker = 0;
static bool is_speaker(uint32_t snd_device) {
switch (snd_device) {
case SND_DEVICE_OUT_SPEAKER:
case SND_DEVICE_OUT_SPEAKER_REVERSE:
case SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES:
case SND_DEVICE_OUT_VOICE_SPEAKER:
case SND_DEVICE_OUT_VOICE_SPEAKER_2:
case SND_DEVICE_OUT_SPEAKER_REVERSE:
case SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET:
case SND_DEVICE_OUT_SPEAKER_AND_HDMI:
case SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET:
case SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET:
speaker = 1;
break;
case SND_DEVICE_OUT_VOICE_SPEAKER:
case SND_DEVICE_OUT_VOICE_SPEAKER_2:
return true;
default:
return false;
}
return speaker;
}
int tfa98xx_start_feedback(void* adev, uint32_t snd_device) {