summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfang hui <hui.fang@freescale.com>2016-03-09 09:53:10 +0800
committerfang hui <hui.fang@freescale.com>2016-03-11 15:44:29 +0800
commitcade9ba5a54f6f60d00f3d7facb40294de7dfc50 (patch)
treef7905785e288cdb6955ba0549bcedd7a6a28fdb0
parentc93964cae37b96a5a6acca8cb001ef22f1d36240 (diff)
downloadfreescale-cade9ba5a54f6f60d00f3d7facb40294de7dfc50.tar.gz
Support sgtl5000
In audio HAL, add config for sgtl5000. Change-Id: I82e9b6db009d1a810d0c9ca9d4ebddc4a616bf28 Signed-off-by: fang hui <hui.fang@freescale.com>
-rwxr-xr-xperipheral/alsa/config_sgtl5000.h118
-rwxr-xr-xperipheral/alsa/tinyalsa_hal.c6
2 files changed, 122 insertions, 2 deletions
diff --git a/peripheral/alsa/config_sgtl5000.h b/peripheral/alsa/config_sgtl5000.h
new file mode 100755
index 0000000..7d8bcdb
--- /dev/null
+++ b/peripheral/alsa/config_sgtl5000.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2016 The Android Open Source 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.
+ */
+/* Copyright (C) 2016 Freescale Semiconductor, Inc. */
+
+#ifndef ANDROID_INCLUDE_IMX_CONFIG_SGTL5000_H
+#define ANDROID_INCLUDE_IMX_CONFIG_SGTL5000_H
+
+#include "audio_hardware.h"
+
+#define PCM_PLAYBAK_VOLUME "PCM Playback Volume"
+#define HEADPHONE_PLAYBACK_VOLUME "Headphone Playback Volume"
+#define HEADPHONE_PLAYBACK_ZC_SWITCH "Headphone Playback ZC Switch"
+#define HEADPHONE_MUX "Headphone Mux"
+
+#define CAPTURE_VOLUME "Capture Volume"
+#define CAPTURE_ATNT_SWITCH "Capture Attenuate Switch (-6dB)"
+#define MIC_VOLUME "Mic Volume"
+#define CAPTURE_MUX "Capture Mux"
+
+static struct route_setting speaker_output_sgtl5000[] = {
+ {
+ .ctl_name = PCM_PLAYBAK_VOLUME,
+ .intval = 192,
+ },
+ {
+ .ctl_name = HEADPHONE_PLAYBACK_VOLUME,
+ .intval = 103,
+ },
+ {
+ .ctl_name = HEADPHONE_PLAYBACK_ZC_SWITCH,
+ .intval = 1,
+ },
+ {
+ .ctl_name = HEADPHONE_MUX,
+ .strval = "DAC",
+ },
+ {
+ .ctl_name = NULL,
+ },
+};
+
+static struct route_setting mm_main_mic_input_sgtl5000[] = {
+ {
+ .ctl_name = CAPTURE_VOLUME,
+ .intval = 10,
+ },
+ {
+ .ctl_name = CAPTURE_ATNT_SWITCH,
+ .intval = 0,
+ },
+ {
+ .ctl_name = MIC_VOLUME,
+ .intval = 2,
+ },
+ {
+ .ctl_name = CAPTURE_MUX,
+ .strval = "MIC_IN",
+ },
+
+ {
+ .ctl_name = NULL,
+ },
+};
+
+
+/* ALSA cards for IMX, these must be defined according different board / kernel config*/
+static struct audio_card sgtl5000_card = {
+ .name = "imx6ul-sgtl5000",
+ .driver_name = "imx6ul-sgtl5000",
+ .supported_out_devices = (AUDIO_DEVICE_OUT_EARPIECE |
+ AUDIO_DEVICE_OUT_SPEAKER |
+ AUDIO_DEVICE_OUT_WIRED_HEADSET |
+ AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
+ AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET |
+ AUDIO_DEVICE_OUT_ALL_SCO |
+ AUDIO_DEVICE_OUT_DEFAULT ),
+ .supported_in_devices = (
+ AUDIO_DEVICE_IN_COMMUNICATION |
+ AUDIO_DEVICE_IN_AMBIENT |
+ AUDIO_DEVICE_IN_BUILTIN_MIC |
+ AUDIO_DEVICE_IN_WIRED_HEADSET |
+ AUDIO_DEVICE_IN_BACK_MIC |
+ AUDIO_DEVICE_IN_ALL_SCO |
+ AUDIO_DEVICE_IN_DEFAULT),
+ .defaults = NULL,
+ .bt_output = NULL,
+ .speaker_output = speaker_output_sgtl5000,
+ .hs_output = NULL,
+ .earpiece_output = NULL,
+ .vx_hs_mic_input = NULL,
+ .mm_main_mic_input = mm_main_mic_input_sgtl5000,
+ .vx_main_mic_input = NULL,
+ .mm_hs_mic_input = NULL,
+ .vx_bt_mic_input = NULL,
+ .mm_bt_mic_input = NULL,
+ .card = 0,
+ .out_rate = 0,
+ .out_channels = 0,
+ .out_format = 0,
+ .in_rate = 0,
+ .in_channels = 0,
+ .in_format = 0,
+};
+
+#endif /* ANDROID_INCLUDE_IMX_CONFIG_SGTL5000_H */
diff --git a/peripheral/alsa/tinyalsa_hal.c b/peripheral/alsa/tinyalsa_hal.c
index d77fd00..b74e866 100755
--- a/peripheral/alsa/tinyalsa_hal.c
+++ b/peripheral/alsa/tinyalsa_hal.c
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/* Copyright (C) 2012-2015 Freescale Semiconductor, Inc. */
+/* Copyright (C) 2012-2016 Freescale Semiconductor, Inc. */
#define LOG_TAG "audio_hw_primary"
//#define LOG_NDEBUG 0
@@ -48,6 +48,7 @@
#include "config_cs42888.h"
#include "config_wm8960.h"
#include "config_sii902x.h"
+#include "config_sgtl5000.h"
#include "control.h"
#ifdef __BRILLO__
@@ -117,7 +118,7 @@
#define PRODUCT_NAME_PROPERTY "ro.product.name"
#define PRODUCT_DEVICE_IMX "imx"
#define PRODUCT_DEVICE_AUTO "sabreauto"
-#define SUPPORT_CARD_NUM 9
+#define SUPPORT_CARD_NUM 10
/*"null_card" must be in the end of this array*/
struct audio_card *audio_card_list[SUPPORT_CARD_NUM] = {
@@ -129,6 +130,7 @@ struct audio_card *audio_card_list[SUPPORT_CARD_NUM] = {
&cs42888_card,
&wm8960_card,
&sii902x_card,
+ &sgtl5000_card,
&null_card,
};