Skip to content

Commit

Permalink
audio/msm7x30: Fix build in CM
Browse files Browse the repository at this point in the history
* Build without qcom audio calibration
* Hack for prebuilt libraries we don't have access to
* Little cleanup of makefile
  • Loading branch information
mikeNG committed Sep 26, 2014
1 parent d8bee3a commit f6341a0
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 41 deletions.
34 changes: 18 additions & 16 deletions legacy/msm7x30/Android.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
ifneq ($(BUILD_TINY_ANDROID),true)

#AUDIO_POLICY_TEST := true
#ENABLE_AUDIO_DUMP := true

Expand All @@ -10,23 +8,29 @@ LOCAL_SRC_FILES := \
AudioHardware.cpp \
audio_hw_hal.cpp

ifeq ($(BOARD_HAVE_BLUETOOTH),true)
LOCAL_CFLAGS += -DWITH_A2DP
endif

ifeq ($(BOARD_HAVE_QCOM_FM),true)
LOCAL_CFLAGS += -DWITH_QCOM_FM
LOCAL_CFLAGS += -DWITH_QCOM_FM
endif

LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libmedia \
libaudioalsa \
libaudcal
libaudioalsa

$(shell mkdir -p $(OUT)/obj/SHARED_LIBRARIES/libaudioalsa_intermediates/)
$(shell touch $(OUT)/obj/SHARED_LIBRARIES/libaudioalsa_intermediates/export_includes)

ifeq ($(BOARD_USES_QCOM_AUDIO_CALIBRATION),true)
LOCAL_SHARED_LIBRARIES += libaudcal
LOCAL_CFLAGS += -DWITH_QCOM_CALIBRATION

$(shell mkdir -p $(OUT)/obj/SHARED_LIBRARIES/libaudcal_intermediates/)
$(shell touch $(OUT)/obj/SHARED_LIBRARIES/libaudcal_intermediates/export_includes)
endif

ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SHARED_LIBRARIES += libdl
LOCAL_SHARED_LIBRARIES += libdl
endif

LOCAL_STATIC_LIBRARIES := \
Expand All @@ -41,7 +45,9 @@ LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS += -fno-short-enums

LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/mm-audio/audio-alsa
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audcal
ifeq ($(BOARD_USES_QCOM_AUDIO_CALIBRATION),true)
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audcal
endif
LOCAL_C_INCLUDES += hardware/libhardware/include
LOCAL_C_INCLUDES += hardware/libhardware_legacy/include
LOCAL_C_INCLUDES += frameworks/base/include
Expand Down Expand Up @@ -75,16 +81,12 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional

ifeq ($(BOARD_HAVE_BLUETOOTH),true)
LOCAL_CFLAGS += -DWITH_A2DP
LOCAL_CFLAGS += -DWITH_A2DP
endif

LOCAL_C_INCLUDES := hardware/libhardware_legacy/audio

LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr


include $(BUILD_SHARED_LIBRARY)


endif # not BUILD_TINY_ANDROID
32 changes: 7 additions & 25 deletions legacy/msm7x30/AudioHardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,13 @@
#include <fcntl.h>
#include <media/AudioSystem.h>

// ToDo: Remove this definition
#define QC_PROP
#if defined(QC_PROP)
#include "control.h"
extern "C" {
#ifdef WITH_QCOM_CALIBRATION
#include "initialize_audcal7x30.h"
}
#else
#define msm_mixer_count() (-EPERM)
#define msm_mixer_open(name, card) (-EPERM)
#define msm_mixer_close() (-EPERM)
#define msm_get_device(name) (-EPERM)
#define msm_en_device(dev_id, set) (-EPERM)
#define msm_route_stream(dir, dec_id, dev_id, set) (-EPERM)
#define msm_route_voice(tx, rx, set) (-EPERM)
#define msm_set_volume(dec_id, vol) (-EPERM)
#define msm_get_device_class(device_id) (-EPERM)
#define msm_get_device_capability(device_id) (-EPERM)
#define msm_get_device_list() (-EPERM)
#define msm_get_device_count() (-EPERM)
#define msm_start_voice() (-EPERM)
#define msm_end_voice() (-EPERM)
#define msm_set_voice_tx_mute(mute) (-EPERM)
#define msm_set_voice_rx_vol(volume) (-EPERM)
#define msm_set_device_volume(dev_id,volume) (-EPERM)
#define msm_reset_all_device() (-EPERM)
#define audcal_initialize() (-EPERM)
#define audcal_deinitialize() (-EPERM)
#endif
}

// hardware specific functions

#include "AudioHardware.h"
Expand Down Expand Up @@ -586,7 +564,9 @@ AudioHardware::AudioHardware() :
device_list[index].capability = msm_get_device_capability(device_list[index].dev_id);
ALOGV("class ID = %d,capablity = %d for device %d",device_list[index].class_id,device_list[index].capability,device_list[index].dev_id);
}
#ifdef WITH_QCOM_CALIBRATION
audcal_initialize();
#endif
mInit = true;

CurrentComboDeviceData.DeviceId = INVALID_DEVICE;
Expand All @@ -605,7 +585,9 @@ AudioHardware::~AudioHardware()
acoustic = 0;
}
msm_mixer_close();
#ifdef WITH_QCOM_CALIBRATION
audcal_deinitialize();
#endif
freeMemory();
fclose(fp);
mInit = false;
Expand Down
48 changes: 48 additions & 0 deletions legacy/msm7x30/control.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2009, The Android Open-Source Project
* Copyright (c) 2009-2010, The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2013, The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef __MSM_AUDIO_ALSA_CONTROL
#define __MSM_AUDIO_ALSA_CONTROL

#include <sys/cdefs.h>

__BEGIN_DECLS

extern const char **msm_get_device_list(void);
extern int msm_mixer_count(void);
extern int msm_mixer_open(const char *name, int id);
extern void msm_mixer_close(void);
extern int msm_get_device(const char *name);
extern int msm_en_device(int device, short enable);
extern int msm_route_stream(int dir, int dec_id, int dev_id, int set);
extern int msm_route_voice(int tx, int rx, int set);
extern int msm_set_volume(int dec_id, float vol);
extern int msm_get_device_class(int dev_id);
extern int msm_get_device_capability(int dev_id);
extern int msm_get_device_count(void);
extern void msm_start_voice(void);
extern int msm_end_voice(void);
extern int msm_set_voice_tx_mute(int mute);
extern int msm_set_voice_rx_vol(int volume);
extern void msm_set_device_volume(int dev_id, int volume);
extern void msm_device_mute(int dev_id, int mute);
extern int msm_reset_all_device(void);

__END_DECLS

#endif
31 changes: 31 additions & 0 deletions legacy/msm7x30/initialize_audcal7x30.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2009, The Android Open-Source Project
* Copyright (c) 2009-2010, The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2013, The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef __MSM_AUDIO_CALIBRATION
#define __MSM_AUDIO_CALIBRATION

#include <sys/cdefs.h>

__BEGIN_DECLS

extern void audcal_initialize(void);
extern void audcal_deinitialize(void);

__END_DECLS

#endif

0 comments on commit f6341a0

Please sign in to comment.