xref: /openbmc/qemu/hw/audio/hda-codec-common.h (revision d7f0efcb229bc1c3e458c6968efe4a6644f24740)
17953793cSBandan Das /*
27953793cSBandan Das  * Common code to disable/enable mixer emulation at run time
37953793cSBandan Das  *
47953793cSBandan Das  * Copyright (C) 2013 Red Hat, Inc.
57953793cSBandan Das  *
67953793cSBandan Das  * Written by Bandan Das <bsd@redhat.com>
77953793cSBandan Das  * with important bits picked up from hda-codec.c
87953793cSBandan Das  *
97953793cSBandan Das  * This program is free software; you can redistribute it and/or
107953793cSBandan Das  * modify it under the terms of the GNU General Public License as
117953793cSBandan Das  * published by the Free Software Foundation; either version 2 or
127953793cSBandan Das  * (at your option) version 3 of the License.
137953793cSBandan Das  *
147953793cSBandan Das  * This program is distributed in the hope that it will be useful,
157953793cSBandan Das  * but WITHOUT ANY WARRANTY; without even the implied warranty of
167953793cSBandan Das  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
177953793cSBandan Das  * GNU General Public License for more details.
187953793cSBandan Das  *
197953793cSBandan Das  * You should have received a copy of the GNU General Public License
207953793cSBandan Das  * along with this program; if not, see <http://www.gnu.org/licenses/>.
217953793cSBandan Das  */
227953793cSBandan Das 
237953793cSBandan Das /*
247953793cSBandan Das  * HDA codec descriptions
257953793cSBandan Das  */
267953793cSBandan Das 
27*2690e61eSBandan Das #ifdef HDA_MIXER
287953793cSBandan Das #define QEMU_HDA_ID_OUTPUT  ((QEMU_HDA_ID_VENDOR << 16) | 0x12)
297953793cSBandan Das #define QEMU_HDA_ID_DUPLEX  ((QEMU_HDA_ID_VENDOR << 16) | 0x22)
307953793cSBandan Das #define QEMU_HDA_ID_MICRO   ((QEMU_HDA_ID_VENDOR << 16) | 0x32)
317953793cSBandan Das #define QEMU_HDA_AMP_CAPS                                               \
327953793cSBandan Das     (AC_AMPCAP_MUTE |                                                   \
337953793cSBandan Das      (QEMU_HDA_AMP_STEPS << AC_AMPCAP_OFFSET_SHIFT)    |                \
347953793cSBandan Das      (QEMU_HDA_AMP_STEPS << AC_AMPCAP_NUM_STEPS_SHIFT) |                \
357953793cSBandan Das      (3                  << AC_AMPCAP_STEP_SIZE_SHIFT))
367953793cSBandan Das #else
377953793cSBandan Das #define QEMU_HDA_ID_OUTPUT  ((QEMU_HDA_ID_VENDOR << 16) | 0x11)
387953793cSBandan Das #define QEMU_HDA_ID_DUPLEX  ((QEMU_HDA_ID_VENDOR << 16) | 0x21)
397953793cSBandan Das #define QEMU_HDA_ID_MICRO   ((QEMU_HDA_ID_VENDOR << 16) | 0x31)
407953793cSBandan Das #define QEMU_HDA_AMP_CAPS   QEMU_HDA_AMP_NONE
417953793cSBandan Das #endif
427953793cSBandan Das 
437953793cSBandan Das 
447953793cSBandan Das /* common: audio output widget */
45*2690e61eSBandan Das static const desc_param glue(common_params_audio_dac_, PARAM)[] = {
467953793cSBandan Das     {
477953793cSBandan Das         .id  = AC_PAR_AUDIO_WIDGET_CAP,
487953793cSBandan Das         .val = ((AC_WID_AUD_OUT << AC_WCAP_TYPE_SHIFT) |
497953793cSBandan Das                 AC_WCAP_FORMAT_OVRD |
507953793cSBandan Das                 AC_WCAP_AMP_OVRD |
517953793cSBandan Das                 AC_WCAP_OUT_AMP |
527953793cSBandan Das                 AC_WCAP_STEREO),
537953793cSBandan Das     },{
547953793cSBandan Das         .id  = AC_PAR_PCM,
557953793cSBandan Das         .val = QEMU_HDA_PCM_FORMATS,
567953793cSBandan Das     },{
577953793cSBandan Das         .id  = AC_PAR_STREAM,
587953793cSBandan Das         .val = AC_SUPFMT_PCM,
597953793cSBandan Das     },{
607953793cSBandan Das         .id  = AC_PAR_AMP_IN_CAP,
617953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
627953793cSBandan Das     },{
637953793cSBandan Das         .id  = AC_PAR_AMP_OUT_CAP,
647953793cSBandan Das         .val = QEMU_HDA_AMP_CAPS,
657953793cSBandan Das     },
667953793cSBandan Das };
677953793cSBandan Das 
687953793cSBandan Das /* common: audio input widget */
69*2690e61eSBandan Das static const desc_param glue(common_params_audio_adc_, PARAM)[] = {
707953793cSBandan Das     {
717953793cSBandan Das         .id  = AC_PAR_AUDIO_WIDGET_CAP,
727953793cSBandan Das         .val = ((AC_WID_AUD_IN << AC_WCAP_TYPE_SHIFT) |
737953793cSBandan Das                 AC_WCAP_CONN_LIST |
747953793cSBandan Das                 AC_WCAP_FORMAT_OVRD |
757953793cSBandan Das                 AC_WCAP_AMP_OVRD |
767953793cSBandan Das                 AC_WCAP_IN_AMP |
777953793cSBandan Das                 AC_WCAP_STEREO),
787953793cSBandan Das     },{
797953793cSBandan Das         .id  = AC_PAR_CONNLIST_LEN,
807953793cSBandan Das         .val = 1,
817953793cSBandan Das     },{
827953793cSBandan Das         .id  = AC_PAR_PCM,
837953793cSBandan Das         .val = QEMU_HDA_PCM_FORMATS,
847953793cSBandan Das     },{
857953793cSBandan Das         .id  = AC_PAR_STREAM,
867953793cSBandan Das         .val = AC_SUPFMT_PCM,
877953793cSBandan Das     },{
887953793cSBandan Das         .id  = AC_PAR_AMP_IN_CAP,
897953793cSBandan Das         .val = QEMU_HDA_AMP_CAPS,
907953793cSBandan Das     },{
917953793cSBandan Das         .id  = AC_PAR_AMP_OUT_CAP,
927953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
937953793cSBandan Das     },
947953793cSBandan Das };
957953793cSBandan Das 
967953793cSBandan Das /* common: pin widget (line-out) */
97*2690e61eSBandan Das static const desc_param glue(common_params_audio_lineout_, PARAM)[] = {
987953793cSBandan Das     {
997953793cSBandan Das         .id  = AC_PAR_AUDIO_WIDGET_CAP,
1007953793cSBandan Das         .val = ((AC_WID_PIN << AC_WCAP_TYPE_SHIFT) |
1017953793cSBandan Das                 AC_WCAP_CONN_LIST |
1027953793cSBandan Das                 AC_WCAP_STEREO),
1037953793cSBandan Das     },{
1047953793cSBandan Das         .id  = AC_PAR_PIN_CAP,
1057953793cSBandan Das         .val = AC_PINCAP_OUT,
1067953793cSBandan Das     },{
1077953793cSBandan Das         .id  = AC_PAR_CONNLIST_LEN,
1087953793cSBandan Das         .val = 1,
1097953793cSBandan Das     },{
1107953793cSBandan Das         .id  = AC_PAR_AMP_IN_CAP,
1117953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
1127953793cSBandan Das     },{
1137953793cSBandan Das         .id  = AC_PAR_AMP_OUT_CAP,
1147953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
1157953793cSBandan Das     },
1167953793cSBandan Das };
1177953793cSBandan Das 
1187953793cSBandan Das /* common: pin widget (line-in) */
119*2690e61eSBandan Das static const desc_param glue(common_params_audio_linein_, PARAM)[] = {
1207953793cSBandan Das     {
1217953793cSBandan Das         .id  = AC_PAR_AUDIO_WIDGET_CAP,
1227953793cSBandan Das         .val = ((AC_WID_PIN << AC_WCAP_TYPE_SHIFT) |
1237953793cSBandan Das                 AC_WCAP_STEREO),
1247953793cSBandan Das     },{
1257953793cSBandan Das         .id  = AC_PAR_PIN_CAP,
1267953793cSBandan Das         .val = AC_PINCAP_IN,
1277953793cSBandan Das     },{
1287953793cSBandan Das         .id  = AC_PAR_AMP_IN_CAP,
1297953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
1307953793cSBandan Das     },{
1317953793cSBandan Das         .id  = AC_PAR_AMP_OUT_CAP,
1327953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
1337953793cSBandan Das     },
1347953793cSBandan Das };
1357953793cSBandan Das 
1367953793cSBandan Das /* output: root node */
137*2690e61eSBandan Das static const desc_param glue(output_params_root_, PARAM)[] = {
1387953793cSBandan Das     {
1397953793cSBandan Das         .id  = AC_PAR_VENDOR_ID,
1407953793cSBandan Das         .val = QEMU_HDA_ID_OUTPUT,
1417953793cSBandan Das     },{
1427953793cSBandan Das         .id  = AC_PAR_SUBSYSTEM_ID,
1437953793cSBandan Das         .val = QEMU_HDA_ID_OUTPUT,
1447953793cSBandan Das     },{
1457953793cSBandan Das         .id  = AC_PAR_REV_ID,
1467953793cSBandan Das         .val = 0x00100101,
1477953793cSBandan Das     },{
1487953793cSBandan Das         .id  = AC_PAR_NODE_COUNT,
1497953793cSBandan Das         .val = 0x00010001,
1507953793cSBandan Das     },
1517953793cSBandan Das };
1527953793cSBandan Das 
1537953793cSBandan Das /* output: audio function */
154*2690e61eSBandan Das static const desc_param glue(output_params_audio_func_, PARAM)[] = {
1557953793cSBandan Das     {
1567953793cSBandan Das         .id  = AC_PAR_FUNCTION_TYPE,
1577953793cSBandan Das         .val = AC_GRP_AUDIO_FUNCTION,
1587953793cSBandan Das     },{
1597953793cSBandan Das         .id  = AC_PAR_SUBSYSTEM_ID,
1607953793cSBandan Das         .val = QEMU_HDA_ID_OUTPUT,
1617953793cSBandan Das     },{
1627953793cSBandan Das         .id  = AC_PAR_NODE_COUNT,
1637953793cSBandan Das         .val = 0x00020002,
1647953793cSBandan Das     },{
1657953793cSBandan Das         .id  = AC_PAR_PCM,
1667953793cSBandan Das         .val = QEMU_HDA_PCM_FORMATS,
1677953793cSBandan Das     },{
1687953793cSBandan Das         .id  = AC_PAR_STREAM,
1697953793cSBandan Das         .val = AC_SUPFMT_PCM,
1707953793cSBandan Das     },{
1717953793cSBandan Das         .id  = AC_PAR_AMP_IN_CAP,
1727953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
1737953793cSBandan Das     },{
1747953793cSBandan Das         .id  = AC_PAR_AMP_OUT_CAP,
1757953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
1767953793cSBandan Das     },{
1777953793cSBandan Das         .id  = AC_PAR_GPIO_CAP,
1787953793cSBandan Das         .val = 0,
1797953793cSBandan Das     },{
1807953793cSBandan Das         .id  = AC_PAR_AUDIO_FG_CAP,
1817953793cSBandan Das         .val = 0x00000808,
1827953793cSBandan Das     },{
1837953793cSBandan Das         .id  = AC_PAR_POWER_STATE,
1847953793cSBandan Das         .val = 0,
1857953793cSBandan Das     },
1867953793cSBandan Das };
1877953793cSBandan Das 
1887953793cSBandan Das /* output: nodes */
189*2690e61eSBandan Das static const desc_node glue(output_nodes_, PARAM)[] = {
1907953793cSBandan Das     {
1917953793cSBandan Das         .nid     = AC_NODE_ROOT,
1927953793cSBandan Das         .name    = "root",
193*2690e61eSBandan Das         .params  = glue(output_params_root_, PARAM),
194*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(output_params_root_, PARAM)),
1957953793cSBandan Das     },{
1967953793cSBandan Das         .nid     = 1,
1977953793cSBandan Das         .name    = "func",
198*2690e61eSBandan Das         .params  = glue(output_params_audio_func_, PARAM),
199*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(output_params_audio_func_, PARAM)),
2007953793cSBandan Das     },{
2017953793cSBandan Das         .nid     = 2,
2027953793cSBandan Das         .name    = "dac",
203*2690e61eSBandan Das         .params  = glue(common_params_audio_dac_, PARAM),
204*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_dac_, PARAM)),
2057953793cSBandan Das         .stindex = 0,
2067953793cSBandan Das     },{
2077953793cSBandan Das         .nid     = 3,
2087953793cSBandan Das         .name    = "out",
209*2690e61eSBandan Das         .params  = glue(common_params_audio_lineout_, PARAM),
210*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_lineout_, PARAM)),
2117953793cSBandan Das         .config  = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
2127953793cSBandan Das                     (AC_JACK_LINE_OUT     << AC_DEFCFG_DEVICE_SHIFT)    |
2137953793cSBandan Das                     (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
2147953793cSBandan Das                     (AC_JACK_COLOR_GREEN  << AC_DEFCFG_COLOR_SHIFT)     |
2157953793cSBandan Das                     0x10),
2167953793cSBandan Das         .pinctl  = AC_PINCTL_OUT_EN,
2177953793cSBandan Das         .conn    = (uint32_t[]) { 2 },
2187953793cSBandan Das     }
2197953793cSBandan Das };
2207953793cSBandan Das 
2217953793cSBandan Das /* output: codec */
222*2690e61eSBandan Das static const desc_codec glue(output_, PARAM) = {
2237953793cSBandan Das     .name   = "output",
2247953793cSBandan Das     .iid    = QEMU_HDA_ID_OUTPUT,
225*2690e61eSBandan Das     .nodes  = glue(output_nodes_, PARAM),
226*2690e61eSBandan Das     .nnodes = ARRAY_SIZE(glue(output_nodes_, PARAM)),
2277953793cSBandan Das };
2287953793cSBandan Das 
2297953793cSBandan Das /* duplex: root node */
230*2690e61eSBandan Das static const desc_param glue(duplex_params_root_, PARAM)[] = {
2317953793cSBandan Das     {
2327953793cSBandan Das         .id  = AC_PAR_VENDOR_ID,
2337953793cSBandan Das         .val = QEMU_HDA_ID_DUPLEX,
2347953793cSBandan Das     },{
2357953793cSBandan Das         .id  = AC_PAR_SUBSYSTEM_ID,
2367953793cSBandan Das         .val = QEMU_HDA_ID_DUPLEX,
2377953793cSBandan Das     },{
2387953793cSBandan Das         .id  = AC_PAR_REV_ID,
2397953793cSBandan Das         .val = 0x00100101,
2407953793cSBandan Das     },{
2417953793cSBandan Das         .id  = AC_PAR_NODE_COUNT,
2427953793cSBandan Das         .val = 0x00010001,
2437953793cSBandan Das     },
2447953793cSBandan Das };
2457953793cSBandan Das 
2467953793cSBandan Das /* duplex: audio function */
247*2690e61eSBandan Das static const desc_param glue(duplex_params_audio_func_, PARAM)[] = {
2487953793cSBandan Das     {
2497953793cSBandan Das         .id  = AC_PAR_FUNCTION_TYPE,
2507953793cSBandan Das         .val = AC_GRP_AUDIO_FUNCTION,
2517953793cSBandan Das     },{
2527953793cSBandan Das         .id  = AC_PAR_SUBSYSTEM_ID,
2537953793cSBandan Das         .val = QEMU_HDA_ID_DUPLEX,
2547953793cSBandan Das     },{
2557953793cSBandan Das         .id  = AC_PAR_NODE_COUNT,
2567953793cSBandan Das         .val = 0x00020004,
2577953793cSBandan Das     },{
2587953793cSBandan Das         .id  = AC_PAR_PCM,
2597953793cSBandan Das         .val = QEMU_HDA_PCM_FORMATS,
2607953793cSBandan Das     },{
2617953793cSBandan Das         .id  = AC_PAR_STREAM,
2627953793cSBandan Das         .val = AC_SUPFMT_PCM,
2637953793cSBandan Das     },{
2647953793cSBandan Das         .id  = AC_PAR_AMP_IN_CAP,
2657953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
2667953793cSBandan Das     },{
2677953793cSBandan Das         .id  = AC_PAR_AMP_OUT_CAP,
2687953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
2697953793cSBandan Das     },{
2707953793cSBandan Das         .id  = AC_PAR_GPIO_CAP,
2717953793cSBandan Das         .val = 0,
2727953793cSBandan Das     },{
2737953793cSBandan Das         .id  = AC_PAR_AUDIO_FG_CAP,
2747953793cSBandan Das         .val = 0x00000808,
2757953793cSBandan Das     },{
2767953793cSBandan Das         .id  = AC_PAR_POWER_STATE,
2777953793cSBandan Das         .val = 0,
2787953793cSBandan Das     },
2797953793cSBandan Das };
2807953793cSBandan Das 
2817953793cSBandan Das /* duplex: nodes */
282*2690e61eSBandan Das static const desc_node glue(duplex_nodes_, PARAM)[] = {
2837953793cSBandan Das     {
2847953793cSBandan Das         .nid     = AC_NODE_ROOT,
2857953793cSBandan Das         .name    = "root",
286*2690e61eSBandan Das         .params  = glue(duplex_params_root_, PARAM),
287*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(duplex_params_root_, PARAM)),
2887953793cSBandan Das     },{
2897953793cSBandan Das         .nid     = 1,
2907953793cSBandan Das         .name    = "func",
291*2690e61eSBandan Das         .params  = glue(duplex_params_audio_func_, PARAM),
292*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(duplex_params_audio_func_, PARAM)),
2937953793cSBandan Das     },{
2947953793cSBandan Das         .nid     = 2,
2957953793cSBandan Das         .name    = "dac",
296*2690e61eSBandan Das         .params  = glue(common_params_audio_dac_, PARAM),
297*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_dac_, PARAM)),
2987953793cSBandan Das         .stindex = 0,
2997953793cSBandan Das     },{
3007953793cSBandan Das         .nid     = 3,
3017953793cSBandan Das         .name    = "out",
302*2690e61eSBandan Das         .params  = glue(common_params_audio_lineout_, PARAM),
303*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_lineout_, PARAM)),
3047953793cSBandan Das         .config  = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
3057953793cSBandan Das                     (AC_JACK_LINE_OUT     << AC_DEFCFG_DEVICE_SHIFT)    |
3067953793cSBandan Das                     (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
3077953793cSBandan Das                     (AC_JACK_COLOR_GREEN  << AC_DEFCFG_COLOR_SHIFT)     |
3087953793cSBandan Das                     0x10),
3097953793cSBandan Das         .pinctl  = AC_PINCTL_OUT_EN,
3107953793cSBandan Das         .conn    = (uint32_t[]) { 2 },
3117953793cSBandan Das     },{
3127953793cSBandan Das         .nid     = 4,
3137953793cSBandan Das         .name    = "adc",
314*2690e61eSBandan Das         .params  = glue(common_params_audio_adc_, PARAM),
315*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_adc_, PARAM)),
3167953793cSBandan Das         .stindex = 1,
3177953793cSBandan Das         .conn    = (uint32_t[]) { 5 },
3187953793cSBandan Das     },{
3197953793cSBandan Das         .nid     = 5,
3207953793cSBandan Das         .name    = "in",
321*2690e61eSBandan Das         .params  = glue(common_params_audio_linein_, PARAM),
322*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_linein_, PARAM)),
3237953793cSBandan Das         .config  = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
3247953793cSBandan Das                     (AC_JACK_LINE_IN      << AC_DEFCFG_DEVICE_SHIFT)    |
3257953793cSBandan Das                     (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
3267953793cSBandan Das                     (AC_JACK_COLOR_RED    << AC_DEFCFG_COLOR_SHIFT)     |
3277953793cSBandan Das                     0x20),
3287953793cSBandan Das         .pinctl  = AC_PINCTL_IN_EN,
3297953793cSBandan Das     }
3307953793cSBandan Das };
3317953793cSBandan Das 
3327953793cSBandan Das /* duplex: codec */
333*2690e61eSBandan Das static const desc_codec glue(duplex_, PARAM) = {
3347953793cSBandan Das     .name   = "duplex",
3357953793cSBandan Das     .iid    = QEMU_HDA_ID_DUPLEX,
336*2690e61eSBandan Das     .nodes  = glue(duplex_nodes_, PARAM),
337*2690e61eSBandan Das     .nnodes = ARRAY_SIZE(glue(duplex_nodes_, PARAM)),
3387953793cSBandan Das };
3397953793cSBandan Das 
3407953793cSBandan Das /* micro: root node */
341*2690e61eSBandan Das static const desc_param glue(micro_params_root_, PARAM)[] = {
3427953793cSBandan Das     {
3437953793cSBandan Das         .id  = AC_PAR_VENDOR_ID,
3447953793cSBandan Das         .val = QEMU_HDA_ID_MICRO,
3457953793cSBandan Das     },{
3467953793cSBandan Das         .id  = AC_PAR_SUBSYSTEM_ID,
3477953793cSBandan Das         .val = QEMU_HDA_ID_MICRO,
3487953793cSBandan Das     },{
3497953793cSBandan Das         .id  = AC_PAR_REV_ID,
3507953793cSBandan Das         .val = 0x00100101,
3517953793cSBandan Das     },{
3527953793cSBandan Das         .id  = AC_PAR_NODE_COUNT,
3537953793cSBandan Das         .val = 0x00010001,
3547953793cSBandan Das     },
3557953793cSBandan Das };
3567953793cSBandan Das 
3577953793cSBandan Das /* micro: audio function */
358*2690e61eSBandan Das static const desc_param glue(micro_params_audio_func_, PARAM)[] = {
3597953793cSBandan Das     {
3607953793cSBandan Das         .id  = AC_PAR_FUNCTION_TYPE,
3617953793cSBandan Das         .val = AC_GRP_AUDIO_FUNCTION,
3627953793cSBandan Das     },{
3637953793cSBandan Das         .id  = AC_PAR_SUBSYSTEM_ID,
3647953793cSBandan Das         .val = QEMU_HDA_ID_MICRO,
3657953793cSBandan Das     },{
3667953793cSBandan Das         .id  = AC_PAR_NODE_COUNT,
3677953793cSBandan Das         .val = 0x00020004,
3687953793cSBandan Das     },{
3697953793cSBandan Das         .id  = AC_PAR_PCM,
3707953793cSBandan Das         .val = QEMU_HDA_PCM_FORMATS,
3717953793cSBandan Das     },{
3727953793cSBandan Das         .id  = AC_PAR_STREAM,
3737953793cSBandan Das         .val = AC_SUPFMT_PCM,
3747953793cSBandan Das     },{
3757953793cSBandan Das         .id  = AC_PAR_AMP_IN_CAP,
3767953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
3777953793cSBandan Das     },{
3787953793cSBandan Das         .id  = AC_PAR_AMP_OUT_CAP,
3797953793cSBandan Das         .val = QEMU_HDA_AMP_NONE,
3807953793cSBandan Das     },{
3817953793cSBandan Das         .id  = AC_PAR_GPIO_CAP,
3827953793cSBandan Das         .val = 0,
3837953793cSBandan Das     },{
3847953793cSBandan Das         .id  = AC_PAR_AUDIO_FG_CAP,
3857953793cSBandan Das         .val = 0x00000808,
3867953793cSBandan Das     },{
3877953793cSBandan Das         .id  = AC_PAR_POWER_STATE,
3887953793cSBandan Das         .val = 0,
3897953793cSBandan Das     },
3907953793cSBandan Das };
3917953793cSBandan Das 
3927953793cSBandan Das /* micro: nodes */
393*2690e61eSBandan Das static const desc_node glue(micro_nodes_, PARAM)[] = {
3947953793cSBandan Das     {
3957953793cSBandan Das         .nid     = AC_NODE_ROOT,
3967953793cSBandan Das         .name    = "root",
397*2690e61eSBandan Das         .params  = glue(micro_params_root_, PARAM),
398*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(micro_params_root_, PARAM)),
3997953793cSBandan Das     },{
4007953793cSBandan Das         .nid     = 1,
4017953793cSBandan Das         .name    = "func",
402*2690e61eSBandan Das         .params  = glue(micro_params_audio_func_, PARAM),
403*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(micro_params_audio_func_, PARAM)),
4047953793cSBandan Das     },{
4057953793cSBandan Das         .nid     = 2,
4067953793cSBandan Das         .name    = "dac",
407*2690e61eSBandan Das         .params  = glue(common_params_audio_dac_, PARAM),
408*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_dac_, PARAM)),
4097953793cSBandan Das         .stindex = 0,
4107953793cSBandan Das     },{
4117953793cSBandan Das         .nid     = 3,
4127953793cSBandan Das         .name    = "out",
413*2690e61eSBandan Das         .params  = glue(common_params_audio_lineout_, PARAM),
414*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_lineout_, PARAM)),
4157953793cSBandan Das         .config  = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
4167953793cSBandan Das                     (AC_JACK_SPEAKER      << AC_DEFCFG_DEVICE_SHIFT)    |
4177953793cSBandan Das                     (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
4187953793cSBandan Das                     (AC_JACK_COLOR_GREEN  << AC_DEFCFG_COLOR_SHIFT)     |
4197953793cSBandan Das                     0x10),
4207953793cSBandan Das         .pinctl  = AC_PINCTL_OUT_EN,
4217953793cSBandan Das         .conn    = (uint32_t[]) { 2 },
4227953793cSBandan Das     },{
4237953793cSBandan Das         .nid     = 4,
4247953793cSBandan Das         .name    = "adc",
425*2690e61eSBandan Das         .params  = glue(common_params_audio_adc_, PARAM),
426*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_adc_, PARAM)),
4277953793cSBandan Das         .stindex = 1,
4287953793cSBandan Das         .conn    = (uint32_t[]) { 5 },
4297953793cSBandan Das     },{
4307953793cSBandan Das         .nid     = 5,
4317953793cSBandan Das         .name    = "in",
432*2690e61eSBandan Das         .params  = glue(common_params_audio_linein_, PARAM),
433*2690e61eSBandan Das         .nparams = ARRAY_SIZE(glue(common_params_audio_linein_, PARAM)),
4347953793cSBandan Das         .config  = ((AC_JACK_PORT_COMPLEX << AC_DEFCFG_PORT_CONN_SHIFT) |
4357953793cSBandan Das                     (AC_JACK_MIC_IN       << AC_DEFCFG_DEVICE_SHIFT)    |
4367953793cSBandan Das                     (AC_JACK_CONN_UNKNOWN << AC_DEFCFG_CONN_TYPE_SHIFT) |
4377953793cSBandan Das                     (AC_JACK_COLOR_RED    << AC_DEFCFG_COLOR_SHIFT)     |
4387953793cSBandan Das                     0x20),
4397953793cSBandan Das         .pinctl  = AC_PINCTL_IN_EN,
4407953793cSBandan Das     }
4417953793cSBandan Das };
4427953793cSBandan Das 
4437953793cSBandan Das /* micro: codec */
444*2690e61eSBandan Das static const desc_codec glue(micro_, PARAM) = {
4457953793cSBandan Das     .name   = "micro",
4467953793cSBandan Das     .iid    = QEMU_HDA_ID_MICRO,
447*2690e61eSBandan Das     .nodes  = glue(micro_nodes_, PARAM),
448*2690e61eSBandan Das     .nnodes = ARRAY_SIZE(glue(micro_nodes_, PARAM)),
4497953793cSBandan Das };
450*2690e61eSBandan Das 
451*2690e61eSBandan Das #undef PARAM
452*2690e61eSBandan Das #undef HDA_MIXER
453*2690e61eSBandan Das #undef QEMU_HDA_ID_OUTPUT
454*2690e61eSBandan Das #undef QEMU_HDA_ID_DUPLEX
455*2690e61eSBandan Das #undef QEMU_HDA_ID_MICRO
456*2690e61eSBandan Das #undef QEMU_HDA_AMP_CAPS
457