aboutsummaryrefslogtreecommitdiffstats
path: root/audio/audio_hw.h
diff options
context:
space:
mode:
authorZiyan <jaraidaniel@gmail.com>2015-08-20 16:44:45 +0200
committerAndreas Blaesius <skate4life@gmx.de>2015-08-29 01:52:46 -0700
commit78912aa06300fe430d7fd643ddb7c3dbd8e4a11c (patch)
tree33381aa38c94fbbfe874dfedc68e19498aa14101 /audio/audio_hw.h
parent1ff4d0a074ae7a50fa40862e0a0a8bcdde7cb2d5 (diff)
downloaddevice_samsung_espressowifi-78912aa06300fe430d7fd643ddb7c3dbd8e4a11c.zip
device_samsung_espressowifi-78912aa06300fe430d7fd643ddb7c3dbd8e4a11c.tar.gz
device_samsung_espressowifi-78912aa06300fe430d7fd643ddb7c3dbd8e4a11c.tar.bz2
espresso-common: add back audio HAL (1/5)
The only difference between the P3100 and P5100 audio HAL is the default incall device (handset vs speaker). This will be accounted in a followup commit. Change-Id: I9160280dc8d123fe4469ac0b82a6d9be70868709
Diffstat (limited to 'audio/audio_hw.h')
-rw-r--r--audio/audio_hw.h228
1 files changed, 228 insertions, 0 deletions
diff --git a/audio/audio_hw.h b/audio/audio_hw.h
new file mode 100644
index 0000000..d2b2e0e
--- /dev/null
+++ b/audio/audio_hw.h
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2012 Wolfson Microelectronics plc
+ * Copyright (C) 2012 The CyanogenMod Project
+ * Daniel Hillenbrand <codeworkx@cyanogenmod.com>
+ * Guillaume "XpLoDWilD" Lesniak <xplodgui@gmail.com>
+ *
+ * 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.
+ */
+
+/* ALSA cards for WM1811 */
+#define CARD_DEFAULT 0
+
+#define PORT_PLAYBACK 0
+#define PORT_CAPTURE 0
+#define PORT_MODEM 1
+#define PORT_BT 2
+
+#define PCM_WRITE pcm_write
+
+#define PLAYBACK_PERIOD_SIZE 880
+#define PLAYBACK_PERIOD_COUNT 8
+#define PLAYBACK_SHORT_PERIOD_COUNT 2
+
+#define CAPTURE_PERIOD_SIZE 1056
+#define CAPTURE_PERIOD_COUNT 2
+
+#define SHORT_PERIOD_SIZE 192
+
+//
+// deep buffer
+//
+/* screen on */
+#define DEEP_BUFFER_SHORT_PERIOD_SIZE 1056
+#define PLAYBACK_DEEP_BUFFER_SHORT_PERIOD_COUNT 4
+/* screen off */
+#define DEEP_BUFFER_LONG_PERIOD_SIZE 880
+#define PLAYBACK_DEEP_BUFFER_LONG_PERIOD_COUNT 8
+
+
+/* minimum sleep time in out_write() when write threshold is not reached */
+#define MIN_WRITE_SLEEP_US 5000
+
+#define RESAMPLER_BUFFER_FRAMES (PLAYBACK_PERIOD_SIZE * 2)
+#define RESAMPLER_BUFFER_SIZE (4 * RESAMPLER_BUFFER_FRAMES)
+
+#define DEFAULT_OUT_SAMPLING_RATE 44100
+#define MM_LOW_POWER_SAMPLING_RATE 44100
+#define MM_FULL_POWER_SAMPLING_RATE 44100
+#define DEFAULT_IN_SAMPLING_RATE 44100
+
+/* sampling rate when using VX port for narrow band */
+#define VX_NB_SAMPLING_RATE 8000
+/* sampling rate when using VX port for wide band */
+#define VX_WB_SAMPLING_RATE 16000
+
+/* product-specific defines */
+#define PRODUCT_DEVICE_PROPERTY "ro.product.device"
+#define PRODUCT_NAME_PROPERTY "ro.product.name"
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+#define STRING_TO_ENUM(string) { #string, string }
+
+struct string_to_enum {
+ const char *name;
+ uint32_t value;
+};
+
+const struct string_to_enum out_channels_name_to_enum_table[] = {
+ STRING_TO_ENUM(AUDIO_CHANNEL_OUT_STEREO),
+ STRING_TO_ENUM(AUDIO_CHANNEL_OUT_5POINT1),
+ STRING_TO_ENUM(AUDIO_CHANNEL_OUT_7POINT1),
+};
+
+enum pcm_type {
+ PCM_NORMAL = 0,
+ PCM_SPDIF,
+ PCM_HDMI,
+ PCM_TOTAL,
+};
+
+enum output_type {
+ OUTPUT_DEEP_BUF, // deep PCM buffers output stream
+ OUTPUT_LOW_LATENCY, // low latency output stream
+ OUTPUT_HDMI,
+ OUTPUT_TOTAL
+};
+
+enum tty_modes {
+ TTY_MODE_OFF,
+ TTY_MODE_VCO,
+ TTY_MODE_HCO,
+ TTY_MODE_FULL
+};
+
+struct route_setting
+{
+ char *ctl_name;
+ int intval;
+ char *strval;
+};
+
+struct route_setting voicecall_default[] = {
+ { .ctl_name = "HP Output Mode", .intval = 0, },
+ { .ctl_name = "AIF2 Mode", .intval = 0, },
+ { .ctl_name = "AIF2DACL Source", .intval = 0, },
+ { .ctl_name = "AIF2DACR Source", .intval = 0, },
+ { .ctl_name = "DAC1L Mixer AIF1.1 Switch", .intval = 1, },
+ { .ctl_name = "DAC1R Mixer AIF1.1 Switch", .intval = 1, },
+ { .ctl_name = "DAC1L Mixer AIF2 Switch", .intval = 1, },
+ { .ctl_name = "DAC1R Mixer AIF2 Switch", .intval = 1, },
+ { .ctl_name = "AIF2DAC Mux", .strval = "AIF2DACDAT", },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting voicecall_default_disable[] = {
+ { .ctl_name = "AIF2 Mode", .intval = 0, },
+ { .ctl_name = "AIF2DACL Source", .intval = 0, },
+ { .ctl_name = "AIF2DACR Source", .intval = 1, },
+ { .ctl_name = "DAC1L Mixer AIF2 Switch", .intval = 0, },
+ { .ctl_name = "DAC1R Mixer AIF2 Switch", .intval = 0, },
+ { .ctl_name = "AIF2DAC Mux", .strval = "AIF2DACDAT", },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting default_input[] = {
+ { .ctl_name = "Main Mic Switch", .intval = 1, },
+ { .ctl_name = "IN1L Volume", .intval = 30, },
+ { .ctl_name = "MIXINL IN1L Switch", .intval = 1, },
+ { .ctl_name = "MIXINL IN1L Volume", .intval = 0, },
+ { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 1, },
+ { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 1, },
+ { .ctl_name = "AIF2DAC2L Mixer Left Sidetone Switch", .intval = 1, },
+ { .ctl_name = "AIF2DAC2L Mixer Right Sidetone Switch", .intval = 0, },
+ { .ctl_name = "AIF2DAC2R Mixer Left Sidetone Switch", .intval = 1, },
+ { .ctl_name = "AIF2DAC2R Mixer Right Sidetone Switch", .intval = 0, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting default_input_disable[] = {
+ { .ctl_name = "Main Mic Switch", .intval = 0, },
+ { .ctl_name = "MIXINL IN1L Switch", .intval = 0, },
+ { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, },
+ { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting noise_suppression[] = {
+ { .ctl_name = "Sub Mic Switch", .intval = 1, },
+ { .ctl_name = "AIF1ADCR Source", .intval = 1, },
+ { .ctl_name = "MIXINR IN2R Switch", .intval = 1, },
+ { .ctl_name = "IN2R Volume", .intval = 25, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting noise_suppression_disable[] = {
+ { .ctl_name = "Sub Mic Switch", .intval = 0, },
+ { .ctl_name = "AIF1ADCR Source", .intval = 0, },
+ { .ctl_name = "MIXINR IN2R Switch", .intval = 0, },
+ { .ctl_name = "IN2R Volume", .intval = 11, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting headset_input[] = {
+ { .ctl_name = "Headset Mic Switch", .intval = 1, },
+ { .ctl_name = "MIXINR IN1R Switch", .intval = 1, },
+ { .ctl_name = "AIF2DAC2L Mixer Left Sidetone Switch", .intval = 0, },
+ { .ctl_name = "AIF2DAC2L Mixer Right Sidetone Switch", .intval = 1, },
+ { .ctl_name = "AIF2DAC2R Mixer Left Sidetone Switch", .intval = 0, },
+ { .ctl_name = "AIF2DAC2R Mixer Right Sidetone Switch", .intval = 1, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting headset_input_disable[] = {
+ { .ctl_name = "Headset Mic Switch", .intval = 0, },
+ { .ctl_name = "MIXINR IN1R Switch", .intval = 0, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting bt_output[] = {
+ { .ctl_name = "AIF2DAC2L Mixer AIF2 Switch", .intval = 1, },
+ { .ctl_name = "AIF2DAC2R Mixer AIF2 Switch", .intval = 1, },
+ { .ctl_name = "AIF2DAC Volume", .intval = 96, },
+ { .ctl_name = "DAC2 Volume", .intval = 96, },
+ { .ctl_name = "AIF2ADC Volume", .intval = 96, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting bt_output_disable[] = {
+ { .ctl_name = "AIF2DAC2L Mixer AIF2 Switch", .intval = 0, },
+ { .ctl_name = "AIF2DAC2R Mixer AIF2 Switch", .intval = 0, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting bt_input[] = {
+ { .ctl_name = "AIF2ADC Mux", .intval = 1, },
+ { .ctl_name = "AIF2DACR Source", .intval = 1, },
+ { .ctl_name = "HP Switch", .intval = 0, },
+ { .ctl_name = "DAC1L Mixer AIF2 Switch", .intval = 1, },
+ { .ctl_name = "DAC1R Mixer AIF2 Switch", .intval = 1, },
+ { .ctl_name = "AIF1ADC1R Mixer AIF2 Switch", .intval = 0, },
+ { .ctl_name = "AIF1ADC1L Mixer AIF2 Switch", .intval = 0, },
+ { .ctl_name = "AIF2DAC2L Mixer Left Sidetone Switch", .intval = 1, },
+ { .ctl_name = "AIF2DAC2L Mixer Right Sidetone Switch", .intval = 0, },
+ { .ctl_name = "AIF2DAC2R Mixer Left Sidetone Switch", .intval = 0, },
+ { .ctl_name = "AIF2DAC2R Mixer Right Sidetone Switch", .intval = 1, },
+ { .ctl_name = "AIF1ADC1R Mixer AIF2 Switch", .intval = 0, },
+ { .ctl_name = "AIF1ADC1L Mixer AIF2 Switch", .intval = 0, },
+ { .ctl_name = "MIXINL IN1L Switch", .intval = 0, },
+ { .ctl_name = NULL, },
+};
+
+struct route_setting bt_input_disable[] = {
+ { .ctl_name = "AIF2ADC Mux", .intval = 0, },
+ { .ctl_name = "HP Switch", .intval = 1, },
+ { .ctl_name = NULL, },
+};