audio: Move card specfic defines to a header

Change-Id: Iec74ee5c4c0cf93e3a7413901e128b76cf708dbb
diff --git a/audio/Android.mk b/audio/Android.mk
index cee9642..c858d78 100644
--- a/audio/Android.mk
+++ b/audio/Android.mk
@@ -36,6 +36,7 @@
 
 
 LOCAL_C_INCLUDES += \
+	$(LOCAL_PATH)/include \
 	external/tinyalsa/include \
 	external/tinycompress/include \
 	$(call include-path-for, audio-utils) \
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 3364e92..fc91929 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -39,6 +39,8 @@
 #include <cutils/sched_policy.h>
 #include <cutils/properties.h>
 
+#include <samsung_audio.h>
+
 #include <hardware/audio_effect.h>
 #include <system/thread_defs.h>
 #include <audio_effects/effect_aec.h>
@@ -64,7 +66,7 @@
         .avail_min = PLAYBACK_AVAILABLE_MIN,
     },
     .card = SOUND_CARD,
-    .id = 9,
+    .id = SOUND_PLAYBACK_DEVICE,
     .type = PCM_PLAYBACK,
     .devices = AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|
                AUDIO_DEVICE_OUT_SPEAKER,
@@ -83,7 +85,7 @@
         .avail_min = 0,
     },
     .card = SOUND_CARD,
-    .id = 0,
+    .id = SOUND_CAPTURE_DEVICE,
     .type = PCM_CAPTURE,
     .devices = AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BACK_MIC,
 };
@@ -101,11 +103,12 @@
         .avail_min = 0,
     },
     .card = SOUND_CARD,
-    .id = 0,
+    .id = SOUND_CAPTURE_DEVICE,
     .type = PCM_CAPTURE_LOW_LATENCY,
     .devices = AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BACK_MIC,
 };
 
+#ifdef SOUND_CAPTURE_LOOPBACK_AEC_DEVICE
 static struct pcm_device_profile pcm_device_capture_loopback_aec = {
     .config = {
         .channels = CAPTURE_DEFAULT_CHANNEL_COUNT,
@@ -119,10 +122,11 @@
         .avail_min = 0,
     },
     .card = SOUND_CARD,
-    .id = 1,
+    .id = SOUND_CAPTURE_LOOPBACK_AEC_DEVICE,
     .type = PCM_CAPTURE,
     .devices = SND_DEVICE_IN_LOOPBACK_AEC,
 };
+#endif
 
 static struct pcm_device_profile pcm_device_playback_sco = {
     .config = {
@@ -137,7 +141,7 @@
         .avail_min = SCO_AVAILABLE_MIN,
     },
     .card = SOUND_CARD,
-    .id = 2,
+    .id = SOUND_PLAYBACK_SCO_DEVICE,
     .type = PCM_PLAYBACK,
     .devices =
             AUDIO_DEVICE_OUT_BLUETOOTH_SCO|AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET|
@@ -157,11 +161,12 @@
         .avail_min = 0,
     },
     .card = SOUND_CARD,
-    .id = 2,
+    .id = SOUND_CAPTURE_SCO_DEVICE,
     .type = PCM_CAPTURE,
     .devices = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET,
 };
 
+#ifdef SOUND_CAPTURE_HOTWORD_DEVICE
 static struct pcm_device_profile pcm_device_hotword_streaming = {
     .config = {
         .channels = 1,
@@ -175,10 +180,11 @@
         .avail_min = 0,
     },
     .card = SOUND_CARD,
-    .id = 0,
+    .id = SOUND_CAPTURE_HOTWORD_DEVICE,
     .type = PCM_HOTWORD_STREAMING,
     .devices = AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BACK_MIC
 };
+#endif
 
 static struct pcm_device_profile * const pcm_devices[] = {
     &pcm_device_playback,
@@ -186,8 +192,12 @@
     &pcm_device_capture_low_latency,
     &pcm_device_playback_sco,
     &pcm_device_capture_sco,
+#ifdef SOUND_CAPTURE_LOOPBACK_AEC_DEVICE
     &pcm_device_capture_loopback_aec,
+#endif
+#ifdef SOUND_CAPTURE_HOTWORD_DEVICE
     &pcm_device_hotword_streaming,
+#endif
     NULL,
 };
 
diff --git a/audio/audio_hw.h b/audio/audio_hw.h
index 9252e1c..851b44d 100644
--- a/audio/audio_hw.h
+++ b/audio/audio_hw.h
@@ -120,9 +120,6 @@
 };
 
 
-#define MIXER_CARD 0
-#define SOUND_CARD 0
-
 /*
  * tinyAlsa library interprets period size as number of frames
  * one frame = channel_count * sizeof (pcm sample)
diff --git a/audio/compress_offload.c b/audio/compress_offload.c
index bdf3b0a..6a62647 100644
--- a/audio/compress_offload.c
+++ b/audio/compress_offload.c
@@ -37,8 +37,10 @@
 #include <cutils/sched_policy.h>
 
 #include <system/thread_defs.h>
-#include "audio_hw.h"
 
+#include <samsung_audio.h>
+
+#include "audio_hw.h"
 #include "sound/compress_params.h"
 
 #define MIXER_CTL_COMPRESS_PLAYBACK_VOLUME "Compress Playback Volume"
diff --git a/audio/include/samsung_audio.h b/audio/include/samsung_audio.h
new file mode 100644
index 0000000..89b3a41
--- /dev/null
+++ b/audio/include/samsung_audio.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2017 The LineageOS 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 SAMSUNG_AUDIO_H
+#define SAMSUNG_AUDIO_H
+
+/*
+ * Sound card specific defines.
+ *
+ * This is an example configuration for a WolfsonMicro WM1814 sound card.
+ * Codec: Vegas
+ *
+ * If you driver does not support one of the devices, the id should not be
+ * defined.
+ */
+
+#define MIXER_CARD 0
+#define SOUND_CARD 0
+
+/* Playback */
+#define SOUND_PLAYBACK_DEVICE 4
+#define SOUND_PLAYBACK_SCO_DEVICE 2
+
+/* Capture */
+#define SOUND_CAPTURE_DEVICE 0
+#define SOUND_CAPTURE_SCO_DEVICE 2
+
+/* Unusupported
+#define SOUND_CAPTURE_LOOPBACK_AEC_DEVICE 1
+#define SOUND_CAPTURE_HOTWORD_DEVICE 0
+*/
+
+
+#endif // SAMSUNG_AUDIO_H