|
|
218e99 |
From 05205ba1d42e1381c4b0ecee32dd34535a68dace Mon Sep 17 00:00:00 2001
|
|
|
218e99 |
From: Bandan Das <bsd@redhat.com>
|
|
|
218e99 |
Date: Tue, 15 Oct 2013 17:10:58 +0200
|
|
|
218e99 |
Subject: [PATCH 21/25] hda-codec: refactor common definitions into a header file
|
|
|
218e99 |
|
|
|
218e99 |
RH-Author: Bandan Das <bsd@redhat.com>
|
|
|
218e99 |
Message-id: <1381857067-9399-2-git-send-email-bsd@redhat.com>
|
|
|
218e99 |
Patchwork-id: 54949
|
|
|
218e99 |
O-Subject: [PATCH RHEL-7 qemu-kvm v3 1/5] hda-codec: refactor common definitions into a header file
|
|
|
218e99 |
Bugzilla: 954195
|
|
|
218e99 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
218e99 |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
218e99 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
218e99 |
|
|
|
218e99 |
Move common defines and structs to a header file.
|
|
|
218e99 |
The next commit will include it twice, once for a device with a
|
|
|
218e99 |
mixer, and once for device without a mixer.
|
|
|
218e99 |
|
|
|
218e99 |
Signed-off-by: Bandan Das <bsd@redhat.com>
|
|
|
218e99 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
218e99 |
(cherry picked from commit 7953793c033343dbea97836645edbe4e61754b11)
|
|
|
218e99 |
---
|
|
|
218e99 |
hw/audio/hda-codec-common.h | 449 ++++++++++++++++++++++++++++++++++++++++++++
|
|
|
218e99 |
hw/audio/hda-codec.c | 424 +----------------------------------------
|
|
|
218e99 |
2 files changed, 450 insertions(+), 423 deletions(-)
|
|
|
218e99 |
create mode 100644 hw/audio/hda-codec-common.h
|
|
|
218e99 |
|
|
|
218e99 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
218e99 |
---
|
|
|
218e99 |
hw/audio/hda-codec-common.h | 449 +++++++++++++++++++++++++++++++++++++++++++
|
|
|
218e99 |
hw/audio/hda-codec.c | 424 +----------------------------------------
|
|
|
218e99 |
2 files changed, 450 insertions(+), 423 deletions(-)
|
|
|
218e99 |
create mode 100644 hw/audio/hda-codec-common.h
|
|
|
218e99 |
|
|
|
218e99 |
diff --git a/hw/audio/hda-codec-common.h b/hw/audio/hda-codec-common.h
|
|
|
218e99 |
new file mode 100644
|
|
|
218e99 |
index 0000000..2f7e95f
|
|
|
218e99 |
--- /dev/null
|
|
|
218e99 |
+++ b/hw/audio/hda-codec-common.h
|
|
|
218e99 |
@@ -0,0 +1,449 @@
|
|
|
218e99 |
+/*
|
|
|
218e99 |
+ * Common code to disable/enable mixer emulation at run time
|
|
|
218e99 |
+ *
|
|
|
218e99 |
+ * Copyright (C) 2013 Red Hat, Inc.
|
|
|
218e99 |
+ *
|
|
|
218e99 |
+ * Written by Bandan Das <bsd@redhat.com>
|
|
|
218e99 |
+ * with important bits picked up from hda-codec.c
|
|
|
218e99 |
+ *
|
|
|
218e99 |
+ * This program is free software; you can redistribute it and/or
|
|
|
218e99 |
+ * modify it under the terms of the GNU General Public License as
|
|
|
218e99 |
+ * published by the Free Software Foundation; either version 2 or
|
|
|
218e99 |
+ * (at your option) version 3 of the License.
|
|
|
218e99 |
+ *
|
|
|
218e99 |
+ * This program is distributed in the hope that it will be useful,
|
|
|
218e99 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
218e99 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
218e99 |
+ * GNU General Public License for more details.
|
|
|
218e99 |
+ *
|
|
|
218e99 |
+ * You should have received a copy of the GNU General Public License
|
|
|
218e99 |
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
218e99 |
+ */
|
|
|
218e99 |
+
|
|
|
218e99 |
+/*
|
|
|
218e99 |
+ * HDA codec descriptions
|
|
|
218e99 |
+ */
|
|
|
218e99 |
+
|
|
|
218e99 |
+#ifdef CONFIG_MIXEMU
|
|
|
218e99 |
+#define QEMU_HDA_ID_OUTPUT ((QEMU_HDA_ID_VENDOR << 16) | 0x12)
|
|
|
218e99 |
+#define QEMU_HDA_ID_DUPLEX ((QEMU_HDA_ID_VENDOR << 16) | 0x22)
|
|
|
218e99 |
+#define QEMU_HDA_ID_MICRO ((QEMU_HDA_ID_VENDOR << 16) | 0x32)
|
|
|
218e99 |
+#define QEMU_HDA_AMP_CAPS \
|
|
|
218e99 |
+ (AC_AMPCAP_MUTE | \
|
|
|
218e99 |
+ (QEMU_HDA_AMP_STEPS << AC_AMPCAP_OFFSET_SHIFT) | \
|
|
|
218e99 |
+ (QEMU_HDA_AMP_STEPS << AC_AMPCAP_NUM_STEPS_SHIFT) | \
|
|
|
218e99 |
+ (3 << AC_AMPCAP_STEP_SIZE_SHIFT))
|
|
|
218e99 |
+#else
|
|
|
218e99 |
+#define QEMU_HDA_ID_OUTPUT ((QEMU_HDA_ID_VENDOR << 16) | 0x11)
|
|
|
218e99 |
+#define QEMU_HDA_ID_DUPLEX ((QEMU_HDA_ID_VENDOR << 16) | 0x21)
|
|
|
218e99 |
+#define QEMU_HDA_ID_MICRO ((QEMU_HDA_ID_VENDOR << 16) | 0x31)
|
|
|
218e99 |
+#define QEMU_HDA_AMP_CAPS QEMU_HDA_AMP_NONE
|
|
|
218e99 |
+#endif
|
|
|
218e99 |
+
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* common: audio output widget */
|
|
|
218e99 |
+static const desc_param common_params_audio_dac[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_AUDIO_WIDGET_CAP,
|
|
|
218e99 |
+ .val = ((AC_WID_AUD_OUT << AC_WCAP_TYPE_SHIFT) |
|
|
|
218e99 |
+ AC_WCAP_FORMAT_OVRD |
|
|
|
218e99 |
+ AC_WCAP_AMP_OVRD |
|
|
|
218e99 |
+ AC_WCAP_OUT_AMP |
|
|
|
218e99 |
+ AC_WCAP_STEREO),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_PCM,
|
|
|
218e99 |
+ .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_STREAM,
|
|
|
218e99 |
+ .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_CAPS,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* common: audio input widget */
|
|
|
218e99 |
+static const desc_param common_params_audio_adc[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_AUDIO_WIDGET_CAP,
|
|
|
218e99 |
+ .val = ((AC_WID_AUD_IN << AC_WCAP_TYPE_SHIFT) |
|
|
|
218e99 |
+ AC_WCAP_CONN_LIST |
|
|
|
218e99 |
+ AC_WCAP_FORMAT_OVRD |
|
|
|
218e99 |
+ AC_WCAP_AMP_OVRD |
|
|
|
218e99 |
+ AC_WCAP_IN_AMP |
|
|
|
218e99 |
+ AC_WCAP_STEREO),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_CONNLIST_LEN,
|
|
|
218e99 |
+ .val = 1,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_PCM,
|
|
|
218e99 |
+ .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_STREAM,
|
|
|
218e99 |
+ .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_CAPS,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* common: pin widget (line-out) */
|
|
|
218e99 |
+static const desc_param common_params_audio_lineout[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_AUDIO_WIDGET_CAP,
|
|
|
218e99 |
+ .val = ((AC_WID_PIN << AC_WCAP_TYPE_SHIFT) |
|
|
|
218e99 |
+ AC_WCAP_CONN_LIST |
|
|
|
218e99 |
+ AC_WCAP_STEREO),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_PIN_CAP,
|
|
|
218e99 |
+ .val = AC_PINCAP_OUT,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_CONNLIST_LEN,
|
|
|
218e99 |
+ .val = 1,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* common: pin widget (line-in) */
|
|
|
218e99 |
+static const desc_param common_params_audio_linein[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_AUDIO_WIDGET_CAP,
|
|
|
218e99 |
+ .val = ((AC_WID_PIN << AC_WCAP_TYPE_SHIFT) |
|
|
|
218e99 |
+ AC_WCAP_STEREO),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_PIN_CAP,
|
|
|
218e99 |
+ .val = AC_PINCAP_IN,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* output: root node */
|
|
|
218e99 |
+static const desc_param output_params_root[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_VENDOR_ID,
|
|
|
218e99 |
+ .val = QEMU_HDA_ID_OUTPUT,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
+ .val = QEMU_HDA_ID_OUTPUT,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_REV_ID,
|
|
|
218e99 |
+ .val = 0x00100101,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
+ .val = 0x00010001,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* output: audio function */
|
|
|
218e99 |
+static const desc_param output_params_audio_func[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_FUNCTION_TYPE,
|
|
|
218e99 |
+ .val = AC_GRP_AUDIO_FUNCTION,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
+ .val = QEMU_HDA_ID_OUTPUT,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
+ .val = 0x00020002,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_PCM,
|
|
|
218e99 |
+ .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_STREAM,
|
|
|
218e99 |
+ .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_GPIO_CAP,
|
|
|
218e99 |
+ .val = 0,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AUDIO_FG_CAP,
|
|
|
218e99 |
+ .val = 0x00000808,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_POWER_STATE,
|
|
|
218e99 |
+ .val = 0,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* output: nodes */
|
|
|
218e99 |
+static const desc_node output_nodes[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .nid = AC_NODE_ROOT,
|
|
|
218e99 |
+ .name = "root",
|
|
|
218e99 |
+ .params = output_params_root,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(output_params_root),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 1,
|
|
|
218e99 |
+ .name = "func",
|
|
|
218e99 |
+ .params = output_params_audio_func,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(output_params_audio_func),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 2,
|
|
|
218e99 |
+ .name = "dac",
|
|
|
218e99 |
+ .params = common_params_audio_dac,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_dac),
|
|
|
218e99 |
+ .stindex = 0,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 3,
|
|
|
218e99 |
+ .name = "out",
|
|
|
218e99 |
+ .params = common_params_audio_lineout,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_lineout),
|
|
|
218e99 |
+ .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_LINE_OUT << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_COLOR_GREEN << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
+ 0x10),
|
|
|
218e99 |
+ .pinctl = AC_PINCTL_OUT_EN,
|
|
|
218e99 |
+ .conn = (uint32_t[]) { 2 },
|
|
|
218e99 |
+ }
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* output: codec */
|
|
|
218e99 |
+static const desc_codec output = {
|
|
|
218e99 |
+ .name = "output",
|
|
|
218e99 |
+ .iid = QEMU_HDA_ID_OUTPUT,
|
|
|
218e99 |
+ .nodes = output_nodes,
|
|
|
218e99 |
+ .nnodes = ARRAY_SIZE(output_nodes),
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* duplex: root node */
|
|
|
218e99 |
+static const desc_param duplex_params_root[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_VENDOR_ID,
|
|
|
218e99 |
+ .val = QEMU_HDA_ID_DUPLEX,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
+ .val = QEMU_HDA_ID_DUPLEX,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_REV_ID,
|
|
|
218e99 |
+ .val = 0x00100101,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
+ .val = 0x00010001,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* duplex: audio function */
|
|
|
218e99 |
+static const desc_param duplex_params_audio_func[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_FUNCTION_TYPE,
|
|
|
218e99 |
+ .val = AC_GRP_AUDIO_FUNCTION,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
+ .val = QEMU_HDA_ID_DUPLEX,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
+ .val = 0x00020004,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_PCM,
|
|
|
218e99 |
+ .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_STREAM,
|
|
|
218e99 |
+ .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_GPIO_CAP,
|
|
|
218e99 |
+ .val = 0,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AUDIO_FG_CAP,
|
|
|
218e99 |
+ .val = 0x00000808,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_POWER_STATE,
|
|
|
218e99 |
+ .val = 0,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* duplex: nodes */
|
|
|
218e99 |
+static const desc_node duplex_nodes[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .nid = AC_NODE_ROOT,
|
|
|
218e99 |
+ .name = "root",
|
|
|
218e99 |
+ .params = duplex_params_root,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(duplex_params_root),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 1,
|
|
|
218e99 |
+ .name = "func",
|
|
|
218e99 |
+ .params = duplex_params_audio_func,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(duplex_params_audio_func),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 2,
|
|
|
218e99 |
+ .name = "dac",
|
|
|
218e99 |
+ .params = common_params_audio_dac,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_dac),
|
|
|
218e99 |
+ .stindex = 0,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 3,
|
|
|
218e99 |
+ .name = "out",
|
|
|
218e99 |
+ .params = common_params_audio_lineout,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_lineout),
|
|
|
218e99 |
+ .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_LINE_OUT << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_COLOR_GREEN << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
+ 0x10),
|
|
|
218e99 |
+ .pinctl = AC_PINCTL_OUT_EN,
|
|
|
218e99 |
+ .conn = (uint32_t[]) { 2 },
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 4,
|
|
|
218e99 |
+ .name = "adc",
|
|
|
218e99 |
+ .params = common_params_audio_adc,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_adc),
|
|
|
218e99 |
+ .stindex = 1,
|
|
|
218e99 |
+ .conn = (uint32_t[]) { 5 },
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 5,
|
|
|
218e99 |
+ .name = "in",
|
|
|
218e99 |
+ .params = common_params_audio_linein,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_linein),
|
|
|
218e99 |
+ .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_LINE_IN << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_COLOR_RED << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
+ 0x20),
|
|
|
218e99 |
+ .pinctl = AC_PINCTL_IN_EN,
|
|
|
218e99 |
+ }
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* duplex: codec */
|
|
|
218e99 |
+static const desc_codec duplex = {
|
|
|
218e99 |
+ .name = "duplex",
|
|
|
218e99 |
+ .iid = QEMU_HDA_ID_DUPLEX,
|
|
|
218e99 |
+ .nodes = duplex_nodes,
|
|
|
218e99 |
+ .nnodes = ARRAY_SIZE(duplex_nodes),
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* micro: root node */
|
|
|
218e99 |
+static const desc_param micro_params_root[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_VENDOR_ID,
|
|
|
218e99 |
+ .val = QEMU_HDA_ID_MICRO,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
+ .val = QEMU_HDA_ID_MICRO,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_REV_ID,
|
|
|
218e99 |
+ .val = 0x00100101,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
+ .val = 0x00010001,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* micro: audio function */
|
|
|
218e99 |
+static const desc_param micro_params_audio_func[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .id = AC_PAR_FUNCTION_TYPE,
|
|
|
218e99 |
+ .val = AC_GRP_AUDIO_FUNCTION,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
+ .val = QEMU_HDA_ID_MICRO,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
+ .val = 0x00020004,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_PCM,
|
|
|
218e99 |
+ .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_STREAM,
|
|
|
218e99 |
+ .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
+ .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_GPIO_CAP,
|
|
|
218e99 |
+ .val = 0,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_AUDIO_FG_CAP,
|
|
|
218e99 |
+ .val = 0x00000808,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .id = AC_PAR_POWER_STATE,
|
|
|
218e99 |
+ .val = 0,
|
|
|
218e99 |
+ },
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* micro: nodes */
|
|
|
218e99 |
+static const desc_node micro_nodes[] = {
|
|
|
218e99 |
+ {
|
|
|
218e99 |
+ .nid = AC_NODE_ROOT,
|
|
|
218e99 |
+ .name = "root",
|
|
|
218e99 |
+ .params = micro_params_root,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(micro_params_root),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 1,
|
|
|
218e99 |
+ .name = "func",
|
|
|
218e99 |
+ .params = micro_params_audio_func,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(micro_params_audio_func),
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 2,
|
|
|
218e99 |
+ .name = "dac",
|
|
|
218e99 |
+ .params = common_params_audio_dac,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_dac),
|
|
|
218e99 |
+ .stindex = 0,
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 3,
|
|
|
218e99 |
+ .name = "out",
|
|
|
218e99 |
+ .params = common_params_audio_lineout,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_lineout),
|
|
|
218e99 |
+ .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_SPEAKER << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_COLOR_GREEN << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
+ 0x10),
|
|
|
218e99 |
+ .pinctl = AC_PINCTL_OUT_EN,
|
|
|
218e99 |
+ .conn = (uint32_t[]) { 2 },
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 4,
|
|
|
218e99 |
+ .name = "adc",
|
|
|
218e99 |
+ .params = common_params_audio_adc,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_adc),
|
|
|
218e99 |
+ .stindex = 1,
|
|
|
218e99 |
+ .conn = (uint32_t[]) { 5 },
|
|
|
218e99 |
+ },{
|
|
|
218e99 |
+ .nid = 5,
|
|
|
218e99 |
+ .name = "in",
|
|
|
218e99 |
+ .params = common_params_audio_linein,
|
|
|
218e99 |
+ .nparams = ARRAY_SIZE(common_params_audio_linein),
|
|
|
218e99 |
+ .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
+ (AC_JACK_COLOR_RED << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
+ 0x20),
|
|
|
218e99 |
+ .pinctl = AC_PINCTL_IN_EN,
|
|
|
218e99 |
+ }
|
|
|
218e99 |
+};
|
|
|
218e99 |
+
|
|
|
218e99 |
+/* micro: codec */
|
|
|
218e99 |
+static const desc_codec micro = {
|
|
|
218e99 |
+ .name = "micro",
|
|
|
218e99 |
+ .iid = QEMU_HDA_ID_MICRO,
|
|
|
218e99 |
+ .nodes = micro_nodes,
|
|
|
218e99 |
+ .nnodes = ARRAY_SIZE(micro_nodes),
|
|
|
218e99 |
+};
|
|
|
218e99 |
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
|
|
|
218e99 |
index 362d8c0..cb498fc 100644
|
|
|
218e99 |
--- a/hw/audio/hda-codec.c
|
|
|
218e99 |
+++ b/hw/audio/hda-codec.c
|
|
|
218e99 |
@@ -118,429 +118,7 @@ static void hda_codec_parse_fmt(uint32_t format, struct audsettings *as)
|
|
|
218e99 |
#define QEMU_HDA_AMP_NONE (0)
|
|
|
218e99 |
#define QEMU_HDA_AMP_STEPS 0x4a
|
|
|
218e99 |
|
|
|
218e99 |
-#ifdef CONFIG_MIXEMU
|
|
|
218e99 |
-# define QEMU_HDA_ID_OUTPUT ((QEMU_HDA_ID_VENDOR << 16) | 0x12)
|
|
|
218e99 |
-# define QEMU_HDA_ID_DUPLEX ((QEMU_HDA_ID_VENDOR << 16) | 0x22)
|
|
|
218e99 |
-# define QEMU_HDA_ID_MICRO ((QEMU_HDA_ID_VENDOR << 16) | 0x32)
|
|
|
218e99 |
-# define QEMU_HDA_AMP_CAPS \
|
|
|
218e99 |
- (AC_AMPCAP_MUTE | \
|
|
|
218e99 |
- (QEMU_HDA_AMP_STEPS << AC_AMPCAP_OFFSET_SHIFT) | \
|
|
|
218e99 |
- (QEMU_HDA_AMP_STEPS << AC_AMPCAP_NUM_STEPS_SHIFT) | \
|
|
|
218e99 |
- (3 << AC_AMPCAP_STEP_SIZE_SHIFT))
|
|
|
218e99 |
-#else
|
|
|
218e99 |
-# define QEMU_HDA_ID_OUTPUT ((QEMU_HDA_ID_VENDOR << 16) | 0x11)
|
|
|
218e99 |
-# define QEMU_HDA_ID_DUPLEX ((QEMU_HDA_ID_VENDOR << 16) | 0x21)
|
|
|
218e99 |
-# define QEMU_HDA_ID_MICRO ((QEMU_HDA_ID_VENDOR << 16) | 0x31)
|
|
|
218e99 |
-# define QEMU_HDA_AMP_CAPS QEMU_HDA_AMP_NONE
|
|
|
218e99 |
-#endif
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* common: audio output widget */
|
|
|
218e99 |
-static const desc_param common_params_audio_dac[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_AUDIO_WIDGET_CAP,
|
|
|
218e99 |
- .val = ((AC_WID_AUD_OUT << AC_WCAP_TYPE_SHIFT) |
|
|
|
218e99 |
- AC_WCAP_FORMAT_OVRD |
|
|
|
218e99 |
- AC_WCAP_AMP_OVRD |
|
|
|
218e99 |
- AC_WCAP_OUT_AMP |
|
|
|
218e99 |
- AC_WCAP_STEREO),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_PCM,
|
|
|
218e99 |
- .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_STREAM,
|
|
|
218e99 |
- .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_CAPS,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* common: audio input widget */
|
|
|
218e99 |
-static const desc_param common_params_audio_adc[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_AUDIO_WIDGET_CAP,
|
|
|
218e99 |
- .val = ((AC_WID_AUD_IN << AC_WCAP_TYPE_SHIFT) |
|
|
|
218e99 |
- AC_WCAP_CONN_LIST |
|
|
|
218e99 |
- AC_WCAP_FORMAT_OVRD |
|
|
|
218e99 |
- AC_WCAP_AMP_OVRD |
|
|
|
218e99 |
- AC_WCAP_IN_AMP |
|
|
|
218e99 |
- AC_WCAP_STEREO),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_CONNLIST_LEN,
|
|
|
218e99 |
- .val = 1,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_PCM,
|
|
|
218e99 |
- .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_STREAM,
|
|
|
218e99 |
- .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_CAPS,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* common: pin widget (line-out) */
|
|
|
218e99 |
-static const desc_param common_params_audio_lineout[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_AUDIO_WIDGET_CAP,
|
|
|
218e99 |
- .val = ((AC_WID_PIN << AC_WCAP_TYPE_SHIFT) |
|
|
|
218e99 |
- AC_WCAP_CONN_LIST |
|
|
|
218e99 |
- AC_WCAP_STEREO),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_PIN_CAP,
|
|
|
218e99 |
- .val = AC_PINCAP_OUT,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_CONNLIST_LEN,
|
|
|
218e99 |
- .val = 1,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* common: pin widget (line-in) */
|
|
|
218e99 |
-static const desc_param common_params_audio_linein[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_AUDIO_WIDGET_CAP,
|
|
|
218e99 |
- .val = ((AC_WID_PIN << AC_WCAP_TYPE_SHIFT) |
|
|
|
218e99 |
- AC_WCAP_STEREO),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_PIN_CAP,
|
|
|
218e99 |
- .val = AC_PINCAP_IN,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* output: root node */
|
|
|
218e99 |
-static const desc_param output_params_root[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_VENDOR_ID,
|
|
|
218e99 |
- .val = QEMU_HDA_ID_OUTPUT,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
- .val = QEMU_HDA_ID_OUTPUT,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_REV_ID,
|
|
|
218e99 |
- .val = 0x00100101,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
- .val = 0x00010001,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* output: audio function */
|
|
|
218e99 |
-static const desc_param output_params_audio_func[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_FUNCTION_TYPE,
|
|
|
218e99 |
- .val = AC_GRP_AUDIO_FUNCTION,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
- .val = QEMU_HDA_ID_OUTPUT,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
- .val = 0x00020002,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_PCM,
|
|
|
218e99 |
- .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_STREAM,
|
|
|
218e99 |
- .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_GPIO_CAP,
|
|
|
218e99 |
- .val = 0,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AUDIO_FG_CAP,
|
|
|
218e99 |
- .val = 0x00000808,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_POWER_STATE,
|
|
|
218e99 |
- .val = 0,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* output: nodes */
|
|
|
218e99 |
-static const desc_node output_nodes[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .nid = AC_NODE_ROOT,
|
|
|
218e99 |
- .name = "root",
|
|
|
218e99 |
- .params = output_params_root,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(output_params_root),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 1,
|
|
|
218e99 |
- .name = "func",
|
|
|
218e99 |
- .params = output_params_audio_func,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(output_params_audio_func),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 2,
|
|
|
218e99 |
- .name = "dac",
|
|
|
218e99 |
- .params = common_params_audio_dac,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_dac),
|
|
|
218e99 |
- .stindex = 0,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 3,
|
|
|
218e99 |
- .name = "out",
|
|
|
218e99 |
- .params = common_params_audio_lineout,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_lineout),
|
|
|
218e99 |
- .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_LINE_OUT << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_COLOR_GREEN << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
- 0x10),
|
|
|
218e99 |
- .pinctl = AC_PINCTL_OUT_EN,
|
|
|
218e99 |
- .conn = (uint32_t[]) { 2 },
|
|
|
218e99 |
- }
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* output: codec */
|
|
|
218e99 |
-static const desc_codec output = {
|
|
|
218e99 |
- .name = "output",
|
|
|
218e99 |
- .iid = QEMU_HDA_ID_OUTPUT,
|
|
|
218e99 |
- .nodes = output_nodes,
|
|
|
218e99 |
- .nnodes = ARRAY_SIZE(output_nodes),
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* duplex: root node */
|
|
|
218e99 |
-static const desc_param duplex_params_root[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_VENDOR_ID,
|
|
|
218e99 |
- .val = QEMU_HDA_ID_DUPLEX,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
- .val = QEMU_HDA_ID_DUPLEX,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_REV_ID,
|
|
|
218e99 |
- .val = 0x00100101,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
- .val = 0x00010001,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* duplex: audio function */
|
|
|
218e99 |
-static const desc_param duplex_params_audio_func[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_FUNCTION_TYPE,
|
|
|
218e99 |
- .val = AC_GRP_AUDIO_FUNCTION,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
- .val = QEMU_HDA_ID_DUPLEX,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
- .val = 0x00020004,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_PCM,
|
|
|
218e99 |
- .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_STREAM,
|
|
|
218e99 |
- .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_GPIO_CAP,
|
|
|
218e99 |
- .val = 0,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AUDIO_FG_CAP,
|
|
|
218e99 |
- .val = 0x00000808,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_POWER_STATE,
|
|
|
218e99 |
- .val = 0,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* duplex: nodes */
|
|
|
218e99 |
-static const desc_node duplex_nodes[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .nid = AC_NODE_ROOT,
|
|
|
218e99 |
- .name = "root",
|
|
|
218e99 |
- .params = duplex_params_root,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(duplex_params_root),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 1,
|
|
|
218e99 |
- .name = "func",
|
|
|
218e99 |
- .params = duplex_params_audio_func,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(duplex_params_audio_func),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 2,
|
|
|
218e99 |
- .name = "dac",
|
|
|
218e99 |
- .params = common_params_audio_dac,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_dac),
|
|
|
218e99 |
- .stindex = 0,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 3,
|
|
|
218e99 |
- .name = "out",
|
|
|
218e99 |
- .params = common_params_audio_lineout,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_lineout),
|
|
|
218e99 |
- .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_LINE_OUT << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_COLOR_GREEN << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
- 0x10),
|
|
|
218e99 |
- .pinctl = AC_PINCTL_OUT_EN,
|
|
|
218e99 |
- .conn = (uint32_t[]) { 2 },
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 4,
|
|
|
218e99 |
- .name = "adc",
|
|
|
218e99 |
- .params = common_params_audio_adc,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_adc),
|
|
|
218e99 |
- .stindex = 1,
|
|
|
218e99 |
- .conn = (uint32_t[]) { 5 },
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 5,
|
|
|
218e99 |
- .name = "in",
|
|
|
218e99 |
- .params = common_params_audio_linein,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_linein),
|
|
|
218e99 |
- .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_LINE_IN << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_COLOR_RED << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
- 0x20),
|
|
|
218e99 |
- .pinctl = AC_PINCTL_IN_EN,
|
|
|
218e99 |
- }
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* duplex: codec */
|
|
|
218e99 |
-static const desc_codec duplex = {
|
|
|
218e99 |
- .name = "duplex",
|
|
|
218e99 |
- .iid = QEMU_HDA_ID_DUPLEX,
|
|
|
218e99 |
- .nodes = duplex_nodes,
|
|
|
218e99 |
- .nnodes = ARRAY_SIZE(duplex_nodes),
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* micro: root node */
|
|
|
218e99 |
-static const desc_param micro_params_root[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_VENDOR_ID,
|
|
|
218e99 |
- .val = QEMU_HDA_ID_MICRO,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
- .val = QEMU_HDA_ID_MICRO,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_REV_ID,
|
|
|
218e99 |
- .val = 0x00100101,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
- .val = 0x00010001,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* micro: audio function */
|
|
|
218e99 |
-static const desc_param micro_params_audio_func[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .id = AC_PAR_FUNCTION_TYPE,
|
|
|
218e99 |
- .val = AC_GRP_AUDIO_FUNCTION,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_SUBSYSTEM_ID,
|
|
|
218e99 |
- .val = QEMU_HDA_ID_MICRO,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_NODE_COUNT,
|
|
|
218e99 |
- .val = 0x00020004,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_PCM,
|
|
|
218e99 |
- .val = QEMU_HDA_PCM_FORMATS,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_STREAM,
|
|
|
218e99 |
- .val = AC_SUPFMT_PCM,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_IN_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AMP_OUT_CAP,
|
|
|
218e99 |
- .val = QEMU_HDA_AMP_NONE,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_GPIO_CAP,
|
|
|
218e99 |
- .val = 0,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_AUDIO_FG_CAP,
|
|
|
218e99 |
- .val = 0x00000808,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .id = AC_PAR_POWER_STATE,
|
|
|
218e99 |
- .val = 0,
|
|
|
218e99 |
- },
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* micro: nodes */
|
|
|
218e99 |
-static const desc_node micro_nodes[] = {
|
|
|
218e99 |
- {
|
|
|
218e99 |
- .nid = AC_NODE_ROOT,
|
|
|
218e99 |
- .name = "root",
|
|
|
218e99 |
- .params = micro_params_root,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(micro_params_root),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 1,
|
|
|
218e99 |
- .name = "func",
|
|
|
218e99 |
- .params = micro_params_audio_func,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(micro_params_audio_func),
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 2,
|
|
|
218e99 |
- .name = "dac",
|
|
|
218e99 |
- .params = common_params_audio_dac,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_dac),
|
|
|
218e99 |
- .stindex = 0,
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 3,
|
|
|
218e99 |
- .name = "out",
|
|
|
218e99 |
- .params = common_params_audio_lineout,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_lineout),
|
|
|
218e99 |
- .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_SPEAKER << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_COLOR_GREEN << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
- 0x10),
|
|
|
218e99 |
- .pinctl = AC_PINCTL_OUT_EN,
|
|
|
218e99 |
- .conn = (uint32_t[]) { 2 },
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 4,
|
|
|
218e99 |
- .name = "adc",
|
|
|
218e99 |
- .params = common_params_audio_adc,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_adc),
|
|
|
218e99 |
- .stindex = 1,
|
|
|
218e99 |
- .conn = (uint32_t[]) { 5 },
|
|
|
218e99 |
- },{
|
|
|
218e99 |
- .nid = 5,
|
|
|
218e99 |
- .name = "in",
|
|
|
218e99 |
- .params = common_params_audio_linein,
|
|
|
218e99 |
- .nparams = ARRAY_SIZE(common_params_audio_linein),
|
|
|
218e99 |
- .config = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
|
|
|
218e99 |
- (AC_JACK_COLOR_RED << AC_DEFCFG_COLOR_SHIFT) |
|
|
|
218e99 |
- 0x20),
|
|
|
218e99 |
- .pinctl = AC_PINCTL_IN_EN,
|
|
|
218e99 |
- }
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
-/* micro: codec */
|
|
|
218e99 |
-static const desc_codec micro = {
|
|
|
218e99 |
- .name = "micro",
|
|
|
218e99 |
- .iid = QEMU_HDA_ID_MICRO,
|
|
|
218e99 |
- .nodes = micro_nodes,
|
|
|
218e99 |
- .nnodes = ARRAY_SIZE(micro_nodes),
|
|
|
218e99 |
-};
|
|
|
218e99 |
-
|
|
|
218e99 |
+#include "hda-codec-common.h"
|
|
|
218e99 |
/* -------------------------------------------------------------------------- */
|
|
|
218e99 |
|
|
|
218e99 |
static const char *fmt2name[] = {
|
|
|
218e99 |
--
|
|
|
218e99 |
1.7.1
|
|
|
218e99 |
|