From 0c0a474ced7b497f24da1c4df2cf4925958ca7f1 Mon Sep 17 00:00:00 2001
From: Erfan Abdi <erfangplus@gmail.com>
Date: Thu, 14 Jun 2018 15:25:02 +0430
Subject: [PATCH] payton: add audio configs

* rename configs folder to nfc
* add thermal-engine-payton.conf

Signed-off-by: Erfan Abdi <erfangplus@gmail.com>
---
 audio/audio_effects.xml              |  23 ++++
 audio/audio_platform_info.xml        |  73 ++++++++++
 audio/audio_policy_configuration.xml | 190 +++++++++++++++++++++++++++
 device.mk                            |   7 +-
 {configs => nfc}/libnfc-brcm.conf    |   0
 {configs => nfc}/libnfc-nxp.conf     |   0
 proprietary-files.txt                |   3 +
 7 files changed, 294 insertions(+), 2 deletions(-)
 create mode 100644 audio/audio_effects.xml
 create mode 100644 audio/audio_platform_info.xml
 create mode 100644 audio/audio_policy_configuration.xml
 rename {configs => nfc}/libnfc-brcm.conf (100%)
 rename {configs => nfc}/libnfc-nxp.conf (100%)

diff --git a/audio/audio_effects.xml b/audio/audio_effects.xml
new file mode 100644
index 0000000..5cc0651
--- /dev/null
+++ b/audio/audio_effects.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<audio_effects_conf version="2.0" xmlns="http://schemas.android.com/audio/audio_effects_conf/v2_0">
+    <libraries>
+        <library name="bundle" path="libbundlewrapper.so"/>
+        <library name="reverb" path="libreverbwrapper.so"/>
+        <library name="visualizer" path="libvisualizer.so"/>
+        <library name="downmix" path="libdownmix.so"/>
+        <library name="loudness_enhancer" path="libldnhncr.so"/>
+    </libraries>
+    <effects>
+        <effect name="bassboost" library="bundle" uuid="8631f300-72e2-11df-b57e-0002a5d5c51b"/>
+        <effect name="virtualizer" library="bundle" uuid="1d4033c0-8557-11df-9f2d-0002a5d5c51b"/>
+        <effect name="equalizer" library="bundle" uuid="ce772f20-847d-11df-bb17-0002a5d5c51b"/>
+        <effect name="volume" library="bundle" uuid="119341a0-8469-11df-81f9-0002a5d5c51b"/>
+        <effect name="reverb_env_aux" library="reverb" uuid="4a387fc0-8ab3-11df-8bad-0002a5d5c51b"/>
+        <effect name="reverb_env_ins" library="reverb" uuid="c7a511a0-a3bb-11df-860e-0002a5d5c51b"/>
+        <effect name="reverb_pre_aux" library="reverb" uuid="f29a1400-a3bb-11df-8ddc-0002a5d5c51b"/>
+        <effect name="reverb_pre_ins" library="reverb" uuid="172cdf00-a3bc-11df-a72f-0002a5d5c51b"/>
+        <effect name="visualizer" library="visualizer" uuid="d069d9e0-8329-11df-9168-0002a5d5c51b"/>
+        <effect name="downmix" library="downmix" uuid="93f04452-e4fe-41cc-91f9-e475b6d1d69f"/>
+        <effect name="loudness_enhancer" library="loudness_enhancer" uuid="fa415329-2034-4bea-b5dc-5b381c8d1e2c"/>
+    </effects>
+</audio_effects_conf>
diff --git a/audio/audio_platform_info.xml b/audio/audio_platform_info.xml
new file mode 100644
index 0000000..d577f27
--- /dev/null
+++ b/audio/audio_platform_info.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<audio_platform_info>
+
+<acdb_ids>
+	<!-- Output devices -->
+	<device name="SND_DEVICE_OUT_VOICE_HANDSET" acdb_id="7" />
+	<device name="SND_DEVICE_OUT_VOICE_HANDSET_TMUS" acdb_id="7" />
+	<device name="SND_DEVICE_OUT_HEADPHONES" acdb_id="9" />
+	<device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES" acdb_id="9" />
+	<device name="SND_DEVICE_OUT_SPEAKER_SAFE_AND_HEADPHONES" acdb_id="9" />
+	<device name="SND_DEVICE_OUT_SPEAKER" acdb_id="14" />
+	<device name="SND_DEVICE_OUT_SPEAKER_PROTECTED" acdb_id="14" />
+	<device name="SND_DEVICE_OUT_SPEAKER_REVERSE" acdb_id="14" />
+	<device name="SND_DEVICE_OUT_SPEAKER_SAFE" acdb_id="14" />
+	<device name="SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED" acdb_id="15" />
+	<device name="SND_DEVICE_OUT_SPEAKER_AND_HDMI" acdb_id="18" />
+	<device name="SND_DEVICE_OUT_VOICE_LINE" acdb_id="78" />
+	<device name="SND_DEVICE_OUT_VOLTE_NB_ANC_HANDSET" acdb_id="200" />
+	<device name="SND_DEVICE_OUT_VOLTE_NB_HANDSET_TMUS" acdb_id="200" />
+	<device name="SND_DEVICE_OUT_VOLTE_NB_TX" acdb_id="245" />
+
+	<!-- Input devices -->
+	<device name="SND_DEVICE_IN_CAPTURE_VI_FEEDBACK" acdb_id="0" />
+	<device name="SND_DEVICE_IN_HANDSET_MIC_AEC" acdb_id="4" />
+	<device name="SND_DEVICE_IN_HANDSET_MIC_AEC_NS" acdb_id="4" />
+	<device name="SND_DEVICE_IN_HANDSET_MIC_NS" acdb_id="4" />
+	<device name="SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC" acdb_id="4" />
+	<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC" acdb_id="11" />
+	<device name="SND_DEVICE_IN_SPEAKER_MIC_AEC_NS" acdb_id="11" />
+	<device name="SND_DEVICE_IN_SPEAKER_MIC_NS" acdb_id="11" />
+	<device name="SND_DEVICE_IN_UNPROCESSED_MIC" acdb_id="11" />
+	<device name="SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE" acdb_id="35" />
+	<device name="SND_DEVICE_IN_VOICE_DMIC_TMUS" acdb_id="41" />
+	<device name="SND_DEVICE_IN_UNPROCESSED_STEREO_MIC" acdb_id="43" />
+	<device name="SND_DEVICE_IN_HEADSET_MIC_AEC" acdb_id="47" />
+	<device name="SND_DEVICE_IN_VOICE_REC_MIC_AEC" acdb_id="62" />
+	<device name="SND_DEVICE_IN_VOICE_REC_MIC_NS" acdb_id="62" />
+	<device name="SND_DEVICE_IN_HANDSET_DMIC_AEC" acdb_id="111" />
+	<device name="SND_DEVICE_IN_HANDSET_DMIC_NS" acdb_id="111" />
+	<device name="SND_DEVICE_IN_SPEAKER_DMIC_AEC" acdb_id="117" />
+	<device name="SND_DEVICE_IN_SPEAKER_DMIC_NS" acdb_id="117" />
+	<device name="SND_DEVICE_IN_THREE_MIC" acdb_id="125" />
+</acdb_ids>
+
+<pcm_ids>
+	<usecase name="USECASE_AUDIO_PLAYBACK_LOW_LATENCY" type="out" id="13" />
+	<usecase name="USECASE_AUDIO_RECORD_LOW_LATENCY" type="in" id="13" />
+	<usecase name="USECASE_VOICEMMODE1_CALL" type="in" id="2" />
+	<usecase name="USECASE_VOICEMMODE1_CALL" type="out" id="2" />
+	<usecase name="USECASE_AUDIO_PLAYBACK_AFE_PROXY" type="out" id="6" />
+	<usecase name="USECASE_AUDIO_RECORD_AFE_PROXY" type="in" id="7" />
+	<usecase name="USECASE_VOICEMMODE2_CALL" type="in" id="19" />
+	<usecase name="USECASE_VOICEMMODE2_CALL" type="out" id="19" />
+	<usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD" type="out" id="8" />
+	<usecase name="USECASE_AUDIO_DSM_FEEDBACK" type="in" id="57" />
+	<usecase name="USECASE_AUDIO_ECHO_REF" type="in" id="-1" />
+	<usecase name="USECASE_MOTVR_COMMAND" type="in" id="41" />
+	<usecase name="USECASE_MOTVR_TRACE" type="in" id="42" />
+	<usecase name="USECASE_ADSPD_DSP1_TEXT" type="in" id="45" />
+	<usecase name="USECASE_ADSPD_DSP2_TEXT" type="in" id="43" />
+	<usecase name="USECASE_ADSPD_DSP3_TEXT" type="in" id="44" />
+</pcm_ids>
+
+<backend_names>
+	<device name="SND_DEVICE_OUT_HEADPHONES" backend="headphones"/>
+	<device name="SND_DEVICE_OUT_LINE" backend="headphones"/>
+</backend_names>
+
+<config_params>
+	<param key="input_mic_max_count" value="3"/>
+</config_params>
+
+</audio_platform_info>
diff --git a/audio/audio_policy_configuration.xml b/audio/audio_policy_configuration.xml
new file mode 100644
index 0000000..2f6bd56
--- /dev/null
+++ b/audio/audio_policy_configuration.xml
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
+    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->
+    <!-- Modules section:
+        There is one section per audio HW module present on the platform.
+        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.
+        The module names are the same as in current .conf file:
+                “primary”, “A2DP”, “remote_submix”, “USB”
+        Each module will contain the following sections:
+        “devicePorts”: a list of device descriptors for all input and output devices accessible via this
+        module.
+        This contains both permanently attached devices and removable devices.
+        “mixPorts”: listing all output and input streams exposed by the audio HAL
+        “routes”: list of possible connections between input and output devices or between stream and
+        devices.
+            "route": is defined by an attribute:
+                -"type": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)
+                -"sink": the sink involved in this route
+                -"sources": all the sources than can be connected to the sink via vis route
+        “attachedDevices”: permanently attached devices.
+        The attachedDevices section is a list of devices names. The names correspond to device names
+        defined in <devicePorts> section.
+        “defaultOutputDevice”: device to be used by default when no policy rule applies
+    -->
+    <modules>
+        <!-- Primary Audio HAL -->
+        <module name="primary" halVersion="3.0">
+            <attachedDevices>
+                <item>Earpiece</item>
+                <item>Speaker</item>
+                <item>Telephony Tx</item>
+                <item>Built-In Mic</item>
+                <item>Built-In Back Mic</item>
+                <item>Telephony Rx</item>
+                <item>FM tuner</item>
+            </attachedDevices>
+            <defaultOutputDevice>Speaker</defaultOutputDevice>
+            <mixPorts>
+                <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="41000,48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                </mixPort>
+                <mixPort name="deep_buffer" role="source"
+                        flags="AUDIO_OUTPUT_FLAG_DEEP_BUFFER">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                </mixPort>
+                <mixPort name="compressed_offload" role="source"
+                         flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
+                    <profile name="" format="AUDIO_FORMAT_MP3"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
+                    <profile name="" format="AUDIO_FORMAT_AAC_LC"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
+                    <profile name="" format="AUDIO_FORMAT_AAC_HE_V1"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
+                    <profile name="" format="AUDIO_FORMAT_AAC_HE_V2"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
+                    <profile name="" format="AUDIO_FORMAT_FLAC"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,88200,96000,176400,192000"
+                             channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
+                </mixPort>
+                <mixPort name="voice_tx" role="source">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
+                </mixPort>
+                <mixPort name="primary input" role="sink">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3"/>
+                    <profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3"/>
+                </mixPort>
+                <mixPort name="voice_rx" role="sink">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
+                </mixPort>
+            </mixPorts>
+            <devicePorts>
+                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->
+                <devicePort tagName="Earpiece" type="AUDIO_DEVICE_OUT_EARPIECE" role="sink">
+                </devicePort>
+                <devicePort tagName="Speaker" type="AUDIO_DEVICE_OUT_SPEAKER" role="sink">
+                </devicePort>
+                <devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
+                </devicePort>
+                <devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
+                </devicePort>
+                <devicePort tagName="Line Out" type="AUDIO_DEVICE_OUT_LINE" role="sink">
+                </devicePort>
+                <devicePort tagName="Dock Headset" type="AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET" role="sink">
+                </devicePort>
+                <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_ALL_SCO" role="sink">
+                </devicePort>
+                <devicePort tagName="HDMI Out" type="AUDIO_DEVICE_OUT_HDMI" role="sink">
+                </devicePort>
+                <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
+                </devicePort>
+
+                <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
+                </devicePort>
+                <devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
+                </devicePort>
+                <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
+                </devicePort>
+                <devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
+                </devicePort>
+                <devicePort tagName="Telephony Rx" type="AUDIO_DEVICE_IN_TELEPHONY_RX" role="source">
+                </devicePort>
+                <devicePort tagName="FM tuner" type="AUDIO_DEVICE_IN_FM_TUNER" role="source">
+                </devicePort>
+            </devicePorts>
+            <!-- route declaration, i.e. list all available sources for a given sink -->
+            <routes>
+                <route type="mix" sink="Earpiece"
+                       sources="primary output,deep_buffer,compressed_offload"/>
+                <route type="mix" sink="Speaker"
+                       sources="primary output,deep_buffer,compressed_offload"/>
+                <route type="mix" sink="Wired Headset"
+                       sources="primary output,deep_buffer,compressed_offload"/>
+                <route type="mix" sink="Wired Headphones"
+                       sources="primary output,deep_buffer,compressed_offload"/>
+                <route type="mix" sink="Line Out"
+                       sources="primary output,deep_buffer,compressed_offload"/>
+                <route type="mix" sink="Dock Headset"
+                       sources="primary output,deep_buffer"/>
+                <route type="mix" sink="BT SCO"
+                       sources="primary output,deep_buffer,compressed_offload"/>
+                <route type="mix" sink="HDMI Out"
+                       sources="primary output,deep_buffer,compressed_offload"/>
+                <route type="mix" sink="Telephony Tx"
+                       sources="voice_tx"/>
+                <route type="mix" sink="primary input"
+                       sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM tuner"/>
+                <route type="mix" sink="voice_rx"
+                       sources="Telephony Rx"/>
+            </routes>
+        </module>
+
+        <module name="motvr" halVersion="3.0">
+            <mixPorts>
+                <mixPort name="primary input" role="sink" flags="AUDIO_INPUT_FLAG_HW_HOTWORD">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="16000"
+                             channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+                </mixPort>
+                <mixPort name="trigger" role="sink" flags="AUDIO_INPUT_FLAG_HW_HOTWORD|AUDIO_INPUT_FLAG_CAPTURE_TRIGGER_AUDIO">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="16000"
+                             channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+                </mixPort>
+            </mixPorts>
+            <devicePorts>
+                <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
+                </devicePort>
+                <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
+                </devicePort>
+            </devicePorts>
+            <routes>
+                <route type="mix" sink="primary input"
+                       sources="Built-In Mic,Wired Headset Mic"/>
+                <route type="mix" sink="trigger"
+                       sources="Built-In Mic,Wired Headset Mic"/>
+            </routes>
+        </module>
+
+        <!-- A2dp Audio HAL -->
+        <xi:include href="a2dp_audio_policy_configuration.xml"/>
+
+        <!-- Usb Audio HAL -->
+        <xi:include href="usb_audio_policy_configuration.xml"/>
+
+        <!-- Remote Submix Audio HAL -->
+        <xi:include href="r_submix_audio_policy_configuration.xml"/>
+
+    </modules>
+    <!-- End of Modules section -->
+
+    <!-- Volume section -->
+
+    <xi:include href="audio_policy_volumes.xml"/>
+    <xi:include href="default_volume_tables.xml"/>
+
+    <!-- End of Volume section -->
+
+</audioPolicyConfiguration>
diff --git a/device.mk b/device.mk
index 32b3878..e5097c3 100644
--- a/device.mk
+++ b/device.mk
@@ -30,6 +30,9 @@ PRODUCT_AAPT_PREBUILT_DPI := xxxhdpi xxhdpi xhdpi hdpi
 
 # Audio
 PRODUCT_COPY_FILES += \
+    $(LOCAL_PATH)/audio/audio_effects.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.xml \
+    $(LOCAL_PATH)/audio/audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
+    $(LOCAL_PATH)/audio/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
     $(LOCAL_PATH)/audio/audio_ext_spkr.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_ext_spkr.conf \
     $(LOCAL_PATH)/audio/mixer_paths.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths.xml
 
@@ -39,8 +42,8 @@ TARGET_SCREEN_WIDTH := 1080
 
 # NFC
 PRODUCT_COPY_FILES += \
-    $(LOCAL_PATH)/configs/libnfc-brcm.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-brcm.conf \
-    $(LOCAL_PATH)/configs/libnfc-nxp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nxp.conf
+    $(LOCAL_PATH)/nfc/libnfc-brcm.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-brcm.conf \
+    $(LOCAL_PATH)/nfc/libnfc-nxp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nxp.conf
 
 # Verity
 PRODUCT_SYSTEM_VERITY_PARTITION := /dev/block/platform/soc/c0c4000.sdhci/by-name/system
diff --git a/configs/libnfc-brcm.conf b/nfc/libnfc-brcm.conf
similarity index 100%
rename from configs/libnfc-brcm.conf
rename to nfc/libnfc-brcm.conf
diff --git a/configs/libnfc-nxp.conf b/nfc/libnfc-nxp.conf
similarity index 100%
rename from configs/libnfc-nxp.conf
rename to nfc/libnfc-nxp.conf
diff --git a/proprietary-files.txt b/proprietary-files.txt
index 57ad94d..e36b188 100644
--- a/proprietary-files.txt
+++ b/proprietary-files.txt
@@ -437,3 +437,6 @@ vendor/firmware/cpp_firmware_v1_5_1.fw
 vendor/firmware/cpp_firmware_v1_5_2.fw
 vendor/firmware/cpp_firmware_v1_6_0.fw
 vendor/firmware/cpp_firmware_v1_8_0.fw
+
+# Thermal
+etc/thermal-engine-payton.conf:vendor/etc/thermal-engine.conf
-- 
GitLab