Permalink
Browse files

mc1n2: Opensource audio HAL from Replicant

Thanks to Paul Kocialkowski of the Replicant project for this work.

Original sources:
https://gitorious.org/replicant/hardware_tinyalsa-audio

http://git.paulk.fr/gitweb/?p=yamaha-mc1n2-audio.git;a=summary

Change-Id: Ia3d89c67d64decb56e3d6518c5f382d38e5a1fa9
  • Loading branch information...
1 parent fd9472c commit cdc1a96ac05f2eb3e2fea69aa90a18ae3d5696cd @Entropy512 Entropy512 committed with codeworkx Nov 10, 2012
View
@@ -90,10 +90,8 @@ BOARD_USE_METADATABUFFERTYPE := true
BOARD_USES_MFC_FPS := true
# Audio
-BOARD_USE_YAMAHAPLAYER := true
-BOARD_USE_SAMSUNG_SEPARATEDSTREAM := true
-BOARD_HAS_SAMSUNG_VOLUME_BUG := true
-COMMON_GLOBAL_CFLAGS += -DICS_AUDIO_BLOB
+BOARD_USE_TINYALSA_AUDIO := true
+BOARD_USE_YAMAHA_MC1N2_AUDIO := true
# RIL
BOARD_MOBILEDATA_INTERFACE_NAME := "pdp0"
View
@@ -24,7 +24,8 @@ PRODUCT_COPY_FILES := \
# Audio
PRODUCT_COPY_FILES += \
- device/samsung/galaxys2-common/configs/asound.conf:system/etc/asound.conf
+ device/samsung/galaxys2-common/configs/tinyalsa-audio.xml:system/etc/tinyalsa-audio.xml \
+ device/samsung/galaxys2-common/configs/audio_policy.conf:system/etc/audio_policy.conf
# Vold and Storage
PRODUCT_COPY_FILES += \
@@ -52,17 +53,22 @@ PRODUCT_COPY_FILES += \
# Packages
PRODUCT_PACKAGES := \
- audio.a2dp.default \
- libaudiohw_legacy \
- camera.exynos4 \
libsurfaceflinger_client \
com.android.future.usb.accessory \
SamsungServiceMode \
Torch \
TvOut
+# Audio Packages
+PRODUCT_PACKAGES += \
+ audio.primary.exynos4 \
+ audio.a2dp.default \
+ audio.usb.default \
+ libaudiohw_legacy
+
# HAL
PRODUCT_PACKAGES += \
+ camera.exynos4 \
gralloc.exynos4 \
hwcomposer.exynos4 \
libnetcmdiface \
View
@@ -0,0 +1,82 @@
+# Global configuration section: lists input and output devices always present on the device
+# as well as the output device selected by default.
+# Devices are designated by a string that corresponds to the enum in audio.h
+
+global_configuration {
+ attached_output_devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER
+ default_output_device AUDIO_DEVICE_OUT_SPEAKER
+ attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC
+}
+
+# audio hardware module section: contains descriptors for all audio hw modules present on the
+# device. Each hw module node is named after the corresponding hw module library base name.
+# For instance, "primary" corresponds to audio.primary.<device>.so.
+# The "primary" module is mandatory and must include at least one output with
+# AUDIO_OUTPUT_FLAG_PRIMARY flag.
+# Each module descriptor contains one or more output profile descriptors and zero or more
+# input profile descriptors. Each profile lists all the parameters supported by a given output
+# or input stream category.
+# The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding
+# to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n".
+
+audio_hw_modules {
+ primary {
+ outputs {
+ primary {
+ sampling_rates 44100
+ channel_masks AUDIO_CHANNEL_OUT_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL|AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET
+ flags AUDIO_OUTPUT_FLAG_PRIMARY
+ }
+# deep_buffer {
+# sampling_rates 44100
+# channel_masks AUDIO_CHANNEL_OUT_STEREO
+# formats AUDIO_FORMAT_PCM_16_BIT
+# devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE
+# flags AUDIO_OUTPUT_FLAG_DEEP_BUFFER
+# }
+# hdmi {
+# sampling_rates 44100|48000
+# channel_masks dynamic
+# formats AUDIO_FORMAT_PCM_16_BIT
+# devices AUDIO_DEVICE_OUT_AUX_DIGITAL
+# flags AUDIO_OUTPUT_FLAG_DIRECT
+# }
+ }
+ inputs {
+ primary {
+ sampling_rates 8000|11025|16000|22050|24000|32000|44100|48000
+ channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_WIRED_HEADSET
+ }
+ }
+ }
+ a2dp {
+ outputs {
+ a2dp {
+ sampling_rates 44100
+ channel_masks AUDIO_CHANNEL_OUT_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_OUT_ALL_A2DP
+ }
+ }
+ }
+ usb {
+ outputs {
+ usb_accessory {
+ sampling_rates 44100
+ channel_masks AUDIO_CHANNEL_OUT_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_OUT_USB_ACCESSORY
+ }
+ usb_device {
+ sampling_rates 44100
+ channel_masks AUDIO_CHANNEL_OUT_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_OUT_USB_DEVICE
+ }
+ }
+ }
+}
View
@@ -0,0 +1,170 @@
+<tinyalsa-audio device="Galaxy S2">
+ <output card="0" device="0"
+ rate="44100" channels="2" format="PCM_16"
+ period_size="1024" period_count="4">
+
+ <device type="default">
+ <path type="enable">
+ <ctrl name="AD Digital Volume" value="75" />
+ <ctrl name="AD Digital Switch" value="on" />
+ <ctrl name="AENG6 Volume" value="75" />
+ <ctrl name="AENG6 Switch" value="on" />
+ <ctrl name="DIR#0 Volume" value="75" />
+ <ctrl name="DIR#0 Switch" value="on" />
+ <ctrl name="DIR#1 Volume" value="75" />
+ <ctrl name="DIR#1 Switch" value="on" />
+ <ctrl name="DIR#2 Volume" value="75" />
+ <ctrl name="DIR#2 Switch" value="on" />
+ <ctrl name="DIR#0 ATT Volume" value="75" />
+ <ctrl name="DIR#0 ATT Switch" value="on" />
+ <ctrl name="DIR#1 ATT Volume" value="75" />
+ <ctrl name="DIR#1 ATT Switch" value="on" />
+ <ctrl name="DIR#2 ATT Volume" value="75" />
+ <ctrl name="DIR#2 ATT Switch" value="on" />
+ <ctrl name="Master Playback Volume" value="75" />
+ <ctrl name="Master Playback Switch" value="on" />
+ <ctrl name="DAC Playback Volume" value="75" />
+ <ctrl name="DAC Playback Switch" value="on" />
+ <ctrl name="DIT#0 Capture Volume" value="75" />
+ <ctrl name="DIT#0 Capture Switch" value="on" />
+ <ctrl name="DIT#1 Capture Volume" value="75" />
+ <ctrl name="DIT#1 Capture Switch" value="on" />
+ <ctrl name="DIT#2 Capture Volume" value="75" />
+ <ctrl name="DIT#2 Capture Switch" value="on" />
+ <ctrl name="AD Analog Volume" value="19" />
+ <ctrl name="AD Analog Switch" value="on" />
+ </path>
+ </device>
+ <device type="earpiece">
+ <path type="enable">
+ <ctrl name="Receiver Playback Volume" value="31" />
+ <ctrl name="Receiver Playback Switch" value="on" />
+ </path>
+ <path type="disable">
+ <ctrl name="Receiver Playback Volume" value="0" />
+ <ctrl name="Receiver Playback Switch" value="off" />
+ </path>
+ </device>
+ <device type="speaker">
+ <path type="enable">
+ <ctrl name="Speaker Playback Volume" value="26" />
+ <ctrl name="Speaker Playback Switch" value="on" />
+ </path>
+ <path type="disable">
+ <ctrl name="Speaker Playback Volume" value="0" />
+ <ctrl name="Speaker Playback Switch" value="off" />
+ </path>
+ </device>
+ <device type="wired-headphone">
+ <path type="enable">
+ <ctrl name="Headphone Playback Volume" value="15" />
+ <ctrl name="Headphone Playback Switch" value="on" />
+ </path>
+ <path type="disable">
+ <ctrl name="Headphone Playback Volume" value="0" />
+ <ctrl name="Headphone Playback Switch" value="off" />
+ </path>
+ </device>
+ <device type="wired-headset">
+ <path type="enable">
+ <ctrl name="Headphone Playback Volume" value="15" />
+ <ctrl name="Headphone Playback Switch" value="on" />
+ </path>
+ <path type="disable">
+ <ctrl name="Headphone Playback Volume" value="0" />
+ <ctrl name="Headphone Playback Switch" value="off" />
+ </path>
+ </device>
+ </output>
+
+ <input card="0" device="0"
+ rate="44100" channels="2" format="PCM_16"
+ period_size="1024" period_count="4">
+
+ <device type="builtin-mic">
+ <path type="enable">
+ <ctrl name="AD Analog Volume" value="26" />
+ <ctrl name="Mic 1 Gain Volume" value="2" />
+ </path>
+ <path type="disable">
+ <ctrl name="AD Analog Volume" value="19" />
+ <ctrl name="Mic 1 Gain Volume" value="0" />
+ </path>
+ </device>
+ <device type="wired-headset">
+ <path type="enable">
+ <ctrl name="AD Analog Volume" value="26" />
+ <ctrl name="Mic 2 Gain Volume" value="2" />
+ </path>
+ <path type="disable">
+ <ctrl name="AD Analog Volume" value="19" />
+ <ctrl name="Mic 2 Gain Volume" value="0" />
+ </path>
+ </device>
+ </input>
+
+ <modem card="0" device="0">
+ <device type="earpiece">
+ <path type="enable">
+ <ctrl name="AD Digital Volume" value="84" />
+ <ctrl name="DIR#1 Volume" value="80" />
+ <ctrl name="Master Playback Volume" value="76" />
+ <ctrl name="AD Analog Volume" value="22" />
+ </path>
+ <path type="disable">
+ <ctrl name="AD Digital Volume" value="75" />
+ <ctrl name="DIR#1 Volume" value="75" />
+ <ctrl name="Master Playback Volume" value="75" />
+ <ctrl name="AD Analog Volume" value="19" />
+ </path>
+ </device>
+ <device type="speaker">
+ <path type="enable">
+ <ctrl name="AD Digital Volume" value="80" />
+ <ctrl name="Speaker Playback Volume" value="31" />
+ <!-- <ctrl name="Mic 3 Gain Volume" value="3" /> -->
+ </path>
+ <path type="disable">
+ <ctrl name="AD Digital Volume" value="75" />
+ <ctrl name="Speaker Playback Volume" value="26" />
+ <!-- <ctrl name="Mic 3 Gain Volume" value="0" /> -->
+ </path>
+ </device>
+ <device type="wired-headphone">
+ <path type="enable">
+ <ctrl name="AD Digital Volume" value="84" />
+ <ctrl name="Master Playback Volume" value="69" />
+ <ctrl name="AD Analog Volume" value="22" />
+ <ctrl name="Headphone Playback Volume" value="31" />
+ </path>
+ <path type="disable">
+ <ctrl name="AD Digital Volume" value="75" />
+ <ctrl name="Master Playback Volume" value="75" />
+ <ctrl name="AD Analog Volume" value="19" />
+ <ctrl name="Headphone Playback Volume" value="15" />
+ </path>
+ </device>
+ <device type="wired-headset">
+ <path type="enable">
+ <ctrl name="Master Playback Volume" value="69" />
+ <ctrl name="AD Analog Volume" value="26" />
+ <ctrl name="Headphone Playback Volume" value="31" />
+ <ctrl name="Mic 2 Gain Volume" value="2" />
+ </path>
+ <path type="disable">
+ <ctrl name="Master Playback Volume" value="75" />
+ <ctrl name="AD Analog Volume" value="19" />
+ <ctrl name="Headphone Playback Volume" value="15" />
+ <ctrl name="Mic 2 Gain Volume" value="0" />
+ </path>
+ </device>
+ <device type="bt-sco-headset">
+ <path type="enable">
+ <ctrl name="DIR#2 Volume" value="81" />
+ </path>
+ <path type="disable">
+ <ctrl name="DIR#2 Volume" value="75" />
+ </path>
+ </device>
+ </modem>
+</tinyalsa-audio>
@@ -166,9 +166,6 @@
<!-- Workaround for devices with broken keyboards -->
<bool name="config_forceDisableHardwareKeyboard">true</bool>
- <!-- If true, adds support for no delay A2DP in Samsung devices -->
- <bool name="config_noDelayInATwoDP">true</bool>
-
<!-- Boolean to enable stk functionality on Samsung phones -->
<bool name="config_samsung_stk">true</bool>
</resources>
View
@@ -0,0 +1,73 @@
+# Copyright (C) 2012 Paul Kocialkowski <contact@paulk.fr>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+LOCAL_PATH := $(call my-dir)
+
+ifeq ($(strip $(BOARD_USE_TINYALSA_AUDIO)),true)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ audio_hw.c \
+ audio_out.c \
+ audio_in.c \
+ audio_ril_interface.c \
+ mixer.c
+
+LOCAL_C_INCLUDES += \
+ external/tinyalsa/include \
+ external/expat/lib \
+ system/media/audio_utils/include \
+ system/media/audio_effects/include \
+ hardware/tinyalsa-audio/include
+
+LOCAL_SHARED_LIBRARIES := \
+ libc \
+ libcutils \
+ libutils \
+ libexpat \
+ libtinyalsa \
+ libaudioutils \
+ libdl
+
+ifeq ($(strip $(BOARD_USE_YAMAHA_MC1N2_AUDIO)),true)
+ LOCAL_CFLAGS += -DYAMAHA_MC1N2_AUDIO
+ LOCAL_C_INCLUDES += $(LOCAL_PATH)/../yamaha-mc1n2-audio/include
+ LOCAL_SHARED_LIBRARIES += libyamaha-mc1n2-audio
+
+#this really needs to get cleaned up to properly inherit from -common
+ ifeq ($(TARGET_DEVICE),n7000)
+ LOCAL_CFLAGS += -DYAMAHA_MC1N2_AUDIO_DEVICE=\"galaxys2\"
+ endif
+
+ ifeq ($(TARGET_DEVICE),i9100)
+ LOCAL_CFLAGS += -DYAMAHA_MC1N2_AUDIO_DEVICE=\"galaxys2\"
+ endif
+
+ ifeq ($(TARGET_DEVICE),i777)
+ LOCAL_CFLAGS += -DYAMAHA_MC1N2_AUDIO_DEVICE=\"galaxys2\"
+ endif
+
+endif
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif
Oops, something went wrong.

0 comments on commit cdc1a96

Please sign in to comment.