1*6eae9050Sjcs /* $OpenBSD: azalia.h,v 1.69 2019/10/14 02:04:35 jcs Exp $ */ 29cfbdd6bSbrad /* $NetBSD: azalia.h,v 1.6 2006/01/16 14:15:26 kent Exp $ */ 38272c886Sjason 48272c886Sjason /*- 58272c886Sjason * Copyright (c) 2005 The NetBSD Foundation, Inc. 68272c886Sjason * All rights reserved. 78272c886Sjason * 88272c886Sjason * This code is derived from software contributed to The NetBSD Foundation 98272c886Sjason * by TAMURA Kent 108272c886Sjason * 118272c886Sjason * Redistribution and use in source and binary forms, with or without 128272c886Sjason * modification, are permitted provided that the following conditions 138272c886Sjason * are met: 148272c886Sjason * 1. Redistributions of source code must retain the above copyright 158272c886Sjason * notice, this list of conditions and the following disclaimer. 168272c886Sjason * 2. Redistributions in binary form must reproduce the above copyright 178272c886Sjason * notice, this list of conditions and the following disclaimer in the 188272c886Sjason * documentation and/or other materials provided with the distribution. 198272c886Sjason * 208272c886Sjason * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 218272c886Sjason * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 228272c886Sjason * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 238272c886Sjason * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 248272c886Sjason * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 258272c886Sjason * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 268272c886Sjason * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 278272c886Sjason * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 288272c886Sjason * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 298272c886Sjason * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 308272c886Sjason * POSSIBILITY OF SUCH DAMAGE. 318272c886Sjason */ 328272c886Sjason 338272c886Sjason #include <sys/types.h> 348272c886Sjason #include <sys/audioio.h> 358272c886Sjason 368272c886Sjason /* ---------------------------------------------------------------- 378272c886Sjason * High Definition Audio constant values 388272c886Sjason * ---------------------------------------------------------------- */ 398272c886Sjason 408272c886Sjason /* High Definition Audio registers */ 418272c886Sjason #define HDA_GCAP 0x000 /* 2 */ 428272c886Sjason #define HDA_GCAP_OSS(x) ((x & 0xf000) >> 12) 438272c886Sjason #define HDA_GCAP_ISS(x) ((x & 0x0f00) >> 8) 448272c886Sjason #define HDA_GCAP_BSS(x) ((x & 0x00f8) >> 3) 458272c886Sjason #define HDA_GCAP_NSDO_MASK 0x0006 468272c886Sjason #define HDA_GCAP_NSDO_1 0x0000 478272c886Sjason #define HDA_GCAP_NSDO_2 0x0002 488272c886Sjason #define HDA_GCAP_NSDO_4 0x0004 498272c886Sjason #define HDA_GCAP_NSDO_RESERVED 0x0006 508272c886Sjason #define HDA_GCAP_64OK 0x0001 518272c886Sjason #define HDA_VMIN 0x002 /* 1 */ 528272c886Sjason #define HDA_VMAJ 0x003 /* 1 */ 538272c886Sjason #define HDA_OUTPAY 0x004 /* 2 */ 548272c886Sjason #define HDA_INPAY 0x006 /* 2 */ 558272c886Sjason #define HDA_GCTL 0x008 /* 4 */ 5604a4ef82Sdeanna #define HDA_GCTL_UNSOL 0x00000100 578272c886Sjason #define HDA_GCTL_FCNTRL 0x00000002 588272c886Sjason #define HDA_GCTL_CRST 0x00000001 598272c886Sjason #define HDA_WAKEEN 0x00c /* 2 */ 608272c886Sjason #define HDA_WAKEEN_SDIWEN 0x7fff 618272c886Sjason #define HDA_STATESTS 0x00e /* 2 */ 628272c886Sjason #define HDA_STATESTS_SDIWAKE 0x7fff 638272c886Sjason #define HDA_GSTS 0x010 /* 2 */ 648272c886Sjason #define HDA_GSTS_FSTS 0x0002 658272c886Sjason #define HDA_OUTSTRMPAY 0x018 /* 2 */ 668272c886Sjason #define HDA_INSTRMPAY 0x01a /* 2 */ 678272c886Sjason #define HDA_INTCTL 0x020 /* 4 */ 688272c886Sjason #define HDA_INTCTL_GIE 0x80000000 698272c886Sjason #define HDA_INTCTL_CIE 0x40000000 708272c886Sjason #define HDA_INTCTL_SIE 0x3fffffff 718272c886Sjason #define HDA_INTSTS 0x024 /* 4 */ 728272c886Sjason #define HDA_INTSTS_GIS 0x80000000 738272c886Sjason #define HDA_INTSTS_CIS 0x40000000 748272c886Sjason #define HDA_INTSTS_SIS 0x3fffffff 758272c886Sjason #define HDA_WALCLK 0x030 /* 4 */ 768272c886Sjason #define HDA_SSYNC 0x034 /* 4 */ 778272c886Sjason #define HDA_SSYNC_SSYNC 0x3fffffff 788272c886Sjason #define HDA_CORBLBASE 0x040 /* 4 */ 798272c886Sjason #define HDA_CORBUBASE 0x044 /* 4 */ 808272c886Sjason #define HDA_CORBWP 0x048 /* 2 */ 818272c886Sjason #define HDA_CORBWP_CORBWP 0x00ff 828272c886Sjason #define HDA_CORBRP 0x04a /* 2 */ 838272c886Sjason #define HDA_CORBRP_CORBRPRST 0x8000 848272c886Sjason #define HDA_CORBRP_CORBRP 0x00ff 858272c886Sjason #define HDA_CORBCTL 0x04c /* 1 */ 868272c886Sjason #define HDA_CORBCTL_CORBRUN 0x02 878272c886Sjason #define HDA_CORBCTL_CMEIE 0x01 888272c886Sjason #define HDA_CORBSTS 0x04d /* 1 */ 898272c886Sjason #define HDA_CORBSTS_CMEI 0x01 908272c886Sjason #define HDA_CORBSIZE 0x04e /* 1 */ 918272c886Sjason #define HDA_CORBSIZE_CORBSZCAP_MASK 0xf0 928272c886Sjason #define HDA_CORBSIZE_CORBSZCAP_2 0x10 938272c886Sjason #define HDA_CORBSIZE_CORBSZCAP_16 0x20 948272c886Sjason #define HDA_CORBSIZE_CORBSZCAP_256 0x40 958272c886Sjason #define HDA_CORBSIZE_CORBSIZE_MASK 0x03 968272c886Sjason #define HDA_CORBSIZE_CORBSIZE_2 0x00 978272c886Sjason #define HDA_CORBSIZE_CORBSIZE_16 0x01 988272c886Sjason #define HDA_CORBSIZE_CORBSIZE_256 0x02 998272c886Sjason #define HDA_RIRBLBASE 0x050 /* 4 */ 1008272c886Sjason #define HDA_RIRBUBASE 0x054 /* 4 */ 1018272c886Sjason #define HDA_RIRBWP 0x058 /* 2 */ 1028272c886Sjason #define HDA_RIRBWP_RIRBWPRST 0x8000 1038272c886Sjason #define HDA_RIRBWP_RIRBWP 0x00ff 1048272c886Sjason #define HDA_RINTCNT 0x05a /* 2 */ 1058272c886Sjason #define HDA_RINTCNT_RINTCNT 0x00ff 1068272c886Sjason #define HDA_RIRBCTL 0x05c /* 1 */ 1078272c886Sjason #define HDA_RIRBCTL_RIRBOIC 0x04 1088272c886Sjason #define HDA_RIRBCTL_RIRBDMAEN 0x02 1098272c886Sjason #define HDA_RIRBCTL_RINTCTL 0x01 1108272c886Sjason #define HDA_RIRBSTS 0x05d /* 1 */ 1118272c886Sjason #define HDA_RIRBSTS_RIRBOIS 0x04 1128272c886Sjason #define HDA_RIRBSTS_RINTFL 0x01 1138272c886Sjason #define HDA_RIRBSIZE 0x05e /* 1 */ 1148272c886Sjason #define HDA_RIRBSIZE_RIRBSZCAP_MASK 0xf0 1158272c886Sjason #define HDA_RIRBSIZE_RIRBSZCAP_2 0x10 1168272c886Sjason #define HDA_RIRBSIZE_RIRBSZCAP_16 0x20 1178272c886Sjason #define HDA_RIRBSIZE_RIRBSZCAP_256 0x40 1188272c886Sjason #define HDA_RIRBSIZE_RIRBSIZE_MASK 0x03 1198272c886Sjason #define HDA_RIRBSIZE_RIRBSIZE_2 0x00 1208272c886Sjason #define HDA_RIRBSIZE_RIRBSIZE_16 0x01 1218272c886Sjason #define HDA_RIRBSIZE_RIRBSIZE_256 0x02 1228272c886Sjason #define HDA_IC 0x060 /* 4 */ 1238272c886Sjason #define HDA_IR 0x064 /* 4 */ 1248272c886Sjason #define HDA_IRS 0x068 /* 2 */ 1258272c886Sjason #define HDA_IRS_IRRADD 0x00f0 1268272c886Sjason #define HDA_IRS_IRRUNSOL 0x0008 1278272c886Sjason #define HDA_IRS_IRV 0x0002 1288272c886Sjason #define HDA_IRS_ICB 0x0001 1298272c886Sjason #define HDA_DPLBASE 0x070 /* 4 */ 1308272c886Sjason #define HDA_DPLBASE_DPLBASE 0xffffff80 1318272c886Sjason #define HDA_DPLBASE_ENABLE 0x00000001 1328272c886Sjason #define HDA_DPUBASE 0x074 1338272c886Sjason 1348272c886Sjason #define HDA_SD_BASE 0x080 1358272c886Sjason #define HDA_SD_CTL 0x00 /* 2 */ 1368272c886Sjason #define HDA_SD_CTL_DEIE 0x0010 1378272c886Sjason #define HDA_SD_CTL_FEIE 0x0008 1388272c886Sjason #define HDA_SD_CTL_IOCE 0x0004 1398272c886Sjason #define HDA_SD_CTL_RUN 0x0002 1408272c886Sjason #define HDA_SD_CTL_SRST 0x0001 1418272c886Sjason #define HDA_SD_CTL2 0x02 /* 1 */ 1428272c886Sjason #define HDA_SD_CTL2_STRM 0xf0 1438272c886Sjason #define HDA_SD_CTL2_STRM_SHIFT 4 1448272c886Sjason #define HDA_SD_CTL2_DIR 0x08 1458272c886Sjason #define HDA_SD_CTL2_TP 0x04 1468272c886Sjason #define HDA_SD_CTL2_STRIPE 0x03 1478272c886Sjason #define HDA_SD_STS 0x03 /* 1 */ 1488272c886Sjason #define HDA_SD_STS_FIFORDY 0x20 1498272c886Sjason #define HDA_SD_STS_DESE 0x10 1508272c886Sjason #define HDA_SD_STS_FIFOE 0x08 1518272c886Sjason #define HDA_SD_STS_BCIS 0x04 1528272c886Sjason #define HDA_SD_LPIB 0x04 /* 4 */ 1538272c886Sjason #define HDA_SD_CBL 0x08 /* 4 */ 1548272c886Sjason #define HDA_SD_LVI 0x0c /* 2 */ 1558272c886Sjason #define HDA_SD_LVI_LVI 0x00ff 1568272c886Sjason #define HDA_SD_FIFOW 0x0e /* 2 */ 1578272c886Sjason #define HDA_SD_FIFOS 0x10 /* 2 */ 1588272c886Sjason #define HDA_SD_FMT 0x12 /* 2 */ 1598272c886Sjason #define HDA_SD_FMT_BASE 0x4000 1608272c886Sjason #define HDA_SD_FMT_BASE_48 0x0000 1618272c886Sjason #define HDA_SD_FMT_BASE_44 0x4000 1628272c886Sjason #define HDA_SD_FMT_MULT 0x3800 1638272c886Sjason #define HDA_SD_FMT_MULT_X1 0x0000 1648272c886Sjason #define HDA_SD_FMT_MULT_X2 0x0800 1658272c886Sjason #define HDA_SD_FMT_MULT_X3 0x1000 1668272c886Sjason #define HDA_SD_FMT_MULT_X4 0x1800 1678272c886Sjason #define HDA_SD_FMT_DIV 0x0700 1688272c886Sjason #define HDA_SD_FMT_DIV_BY1 0x0000 1698272c886Sjason #define HDA_SD_FMT_DIV_BY2 0x0100 1708272c886Sjason #define HDA_SD_FMT_DIV_BY3 0x0200 1718272c886Sjason #define HDA_SD_FMT_DIV_BY4 0x0300 1728272c886Sjason #define HDA_SD_FMT_DIV_BY5 0x0400 1738272c886Sjason #define HDA_SD_FMT_DIV_BY6 0x0500 1748272c886Sjason #define HDA_SD_FMT_DIV_BY7 0x0600 1758272c886Sjason #define HDA_SD_FMT_DIV_BY8 0x0700 1768272c886Sjason #define HDA_SD_FMT_BITS 0x0070 1778272c886Sjason #define HDA_SD_FMT_BITS_8_16 0x0000 1788272c886Sjason #define HDA_SD_FMT_BITS_16_16 0x0010 1798272c886Sjason #define HDA_SD_FMT_BITS_20_32 0x0020 1808272c886Sjason #define HDA_SD_FMT_BITS_24_32 0x0030 1818272c886Sjason #define HDA_SD_FMT_BITS_32_32 0x0040 1828272c886Sjason #define HDA_SD_FMT_CHAN 0x000f 1838272c886Sjason #define HDA_SD_BDPL 0x18 /* 4 */ 1848272c886Sjason #define HDA_SD_BDPU 0x1c /* 4 */ 1858272c886Sjason #define HDA_SD_SIZE 0x20 1868272c886Sjason 1878272c886Sjason /* CORB commands */ 1888272c886Sjason #define CORB_GET_PARAMETER 0xf00 1898272c886Sjason #define COP_VENDOR_ID 0x00 1908272c886Sjason #define COP_VID_VENDOR(x) (x >> 16) 1918272c886Sjason #define COP_VID_DEVICE(x) (x & 0xffff) 1928272c886Sjason #define COP_REVISION_ID 0x02 1938272c886Sjason #define COP_RID_MAJ(x) ((x >> 20) & 0x0f) 1948272c886Sjason #define COP_RID_MIN(x) ((x >> 16) & 0x0f) 1958272c886Sjason #define COP_RID_REVISION(x) ((x >> 8) & 0xff) 1968272c886Sjason #define COP_RID_STEPPING(x) (x & 0xff) 1978272c886Sjason #define COP_SUBORDINATE_NODE_COUNT 0x04 1988272c886Sjason #define COP_START_NID(x) ((x & 0x00ff0000) >> 16) 1998272c886Sjason #define COP_NSUBNODES(x) (x & 0x000000ff) 2008272c886Sjason #define COP_FUNCTION_GROUP_TYPE 0x05 2018272c886Sjason #define COP_FTYPE(x) (x & 0x000000ff) 2028272c886Sjason #define COP_FTYPE_RESERVED 0x01 2038272c886Sjason #define COP_FTYPE_AUDIO 0x01 2048272c886Sjason #define COP_FTYPE_MODEM 0x02 2058272c886Sjason #define COP_AUDIO_FUNCTION_GROUP_CAPABILITY 0x08 2068272c886Sjason #define COP_AUDIO_WIDGET_CAP 0x09 2078272c886Sjason #define COP_AWCAP_TYPE(x) ((x >> 20) & 0xf) 2088272c886Sjason #define COP_AWTYPE_AUDIO_OUTPUT 0x0 2098272c886Sjason #define COP_AWTYPE_AUDIO_INPUT 0x1 2108272c886Sjason #define COP_AWTYPE_AUDIO_MIXER 0x2 2118272c886Sjason #define COP_AWTYPE_AUDIO_SELECTOR 0x3 2128272c886Sjason #define COP_AWTYPE_PIN_COMPLEX 0x4 2138272c886Sjason #define COP_AWTYPE_POWER 0x5 2148272c886Sjason #define COP_AWTYPE_VOLUME_KNOB 0x6 2158272c886Sjason #define COP_AWTYPE_BEEP_GENERATOR 0x7 2168272c886Sjason #define COP_AWTYPE_VENDOR_DEFINED 0xf 2178272c886Sjason #define COP_AWCAP_STEREO 0x001 2188272c886Sjason #define COP_AWCAP_INAMP 0x002 2198272c886Sjason #define COP_AWCAP_OUTAMP 0x004 2208272c886Sjason #define COP_AWCAP_AMPOV 0x008 2218272c886Sjason #define COP_AWCAP_FORMATOV 0x010 2228272c886Sjason #define COP_AWCAP_STRIPE 0x020 2238272c886Sjason #define COP_AWCAP_PROC 0x040 2248272c886Sjason #define COP_AWCAP_UNSOL 0x080 2258272c886Sjason #define COP_AWCAP_CONNLIST 0x100 2268272c886Sjason #define COP_AWCAP_DIGITAL 0x200 2278272c886Sjason #define COP_AWCAP_POWER 0x400 2288272c886Sjason #define COP_AWCAP_LRSWAP 0x800 2298272c886Sjason #define COP_AWCAP_DELAY(x) ((x >> 16) & 0xf) 2308272c886Sjason #define COP_PCM 0x0a 2318272c886Sjason #define COP_PCM_B32 0x00100000 2328272c886Sjason #define COP_PCM_B24 0x00080000 2338272c886Sjason #define COP_PCM_B20 0x00040000 2348272c886Sjason #define COP_PCM_B16 0x00020000 2358272c886Sjason #define COP_PCM_B8 0x00010000 2368272c886Sjason #define COP_PCM_R3840 0x00000800 2378272c886Sjason #define COP_PCM_R1920 0x00000400 2388272c886Sjason #define COP_PCM_R1764 0x00000200 2398272c886Sjason #define COP_PCM_R960 0x00000100 2408272c886Sjason #define COP_PCM_R882 0x00000080 2418272c886Sjason #define COP_PCM_R480 0x00000040 2428272c886Sjason #define COP_PCM_R441 0x00000020 2438272c886Sjason #define COP_PCM_R320 0x00000010 2448272c886Sjason #define COP_PCM_R220 0x00000008 2458272c886Sjason #define COP_PCM_R160 0x00000004 2468272c886Sjason #define COP_PCM_R110 0x00000002 2478272c886Sjason #define COP_PCM_R80 0x00000001 2488272c886Sjason #define COP_STREAM_FORMATS 0x0b 2498272c886Sjason #define COP_STREAM_FORMAT_PCM 0x00000001 2508272c886Sjason #define COP_STREAM_FORMAT_FLOAT32 0x00000002 2518272c886Sjason #define COP_STREAM_FORMAT_AC3 0x00000003 2528272c886Sjason #define COP_PINCAP 0x0c 2538272c886Sjason #define COP_PINCAP_IMPEDANCE 0x00000001 2548272c886Sjason #define COP_PINCAP_TRIGGER 0x00000002 2558272c886Sjason #define COP_PINCAP_PRESENCE 0x00000004 2568272c886Sjason #define COP_PINCAP_HEADPHONE 0x00000008 2578272c886Sjason #define COP_PINCAP_OUTPUT 0x00000010 2588272c886Sjason #define COP_PINCAP_INPUT 0x00000020 2598272c886Sjason #define COP_PINCAP_BALANCE 0x00000040 26041856ce8Sjakemsr #define COP_PINCAP_HDMI 0x00000080 2618272c886Sjason #define COP_PINCAP_VREF(x) ((x >> 8) & 0xff) 2628272c886Sjason #define COP_PINCAP_EAPD 0x00010000 2638272c886Sjason #define COP_INPUT_AMPCAP 0x0d 2648272c886Sjason #define COP_AMPCAP_OFFSET(x) (x & 0x0000007f) 2658272c886Sjason #define COP_AMPCAP_NUMSTEPS(x) ((x >> 8) & 0x7f) 2668272c886Sjason #define COP_AMPCAP_STEPSIZE(x) ((x >> 16) & 0x7f) 267f3f7a230Sjakemsr #define COP_AMPCAP_CTLOFF(x) ((x >> 24) & 0x7f) 2688272c886Sjason #define COP_AMPCAP_MUTE 0x80000000 2698272c886Sjason #define COP_CONNECTION_LIST_LENGTH 0x0e 2708272c886Sjason #define COP_CLL_LONG 0x00000080 2718272c886Sjason #define COP_CLL_LENGTH(x) (x & 0x0000007f) 2728272c886Sjason #define COP_SUPPORTED_POWER_STATES 0x0f 2738272c886Sjason #define COP_PROCESSING_CAPABILITIES 0x10 2748272c886Sjason #define COP_GPIO_COUNT 0x11 2751b50f7e1Sdeanna #define COP_GPIO_GPIOS(x) (x & 0xff) 2761b50f7e1Sdeanna #define COP_GPIO_GPOS(x) ((x >> 8) & 0xff) 2771b50f7e1Sdeanna #define COP_GPIO_GPIS(x) ((x >> 16) & 0xff) 2781b50f7e1Sdeanna #define COP_GPIO_UNSOL 0x40000000 2791b50f7e1Sdeanna #define COP_GPIO_WAKE 0x80000000 2808272c886Sjason #define COP_OUTPUT_AMPCAP 0x12 2818272c886Sjason #define COP_VOLUME_KNOB_CAPABILITIES 0x13 2828272c886Sjason #define COP_VKCAP_DELTA 0x00000080 2838272c886Sjason #define COP_VKCAP_NUMSTEPS(x) (x & 0x7f) 2848272c886Sjason #define CORB_GET_CONNECTION_SELECT_CONTROL 0xf01 2858272c886Sjason #define CORB_CSC_INDEX(x) (x & 0xff) 2868272c886Sjason #define CORB_SET_CONNECTION_SELECT_CONTROL 0x701 2878272c886Sjason #define CORB_GET_CONNECTION_LIST_ENTRY 0xf02 2888272c886Sjason #define CORB_GET_PROCESSING_STATE 0xf03 2898272c886Sjason #define CORB_SET_PROCESSING_STATE 0x703 2908272c886Sjason #define CORB_GET_COEFFICIENT_INDEX 0xd00 2918272c886Sjason #define CORB_SET_COEFFICIENT_INDEX 0x500 2928272c886Sjason #define CORB_GET_PROCESSING_COEFFICIENT 0xc00 2938272c886Sjason #define CORB_SET_PROCESSING_COEFFICIENT 0x400 2948272c886Sjason #define CORB_GET_AMPLIFIER_GAIN_MUTE 0xb00 2958272c886Sjason #define CORB_GAGM_INPUT 0x0000 2968272c886Sjason #define CORB_GAGM_OUTPUT 0x8000 2978272c886Sjason #define CORB_GAGM_RIGHT 0x0000 2988272c886Sjason #define CORB_GAGM_LEFT 0x2000 2998272c886Sjason #define CORB_GAGM_MUTE 0x00000080 3008272c886Sjason #define CORB_GAGM_GAIN(x) (x & 0x0000007f) 3018272c886Sjason #define CORB_SET_AMPLIFIER_GAIN_MUTE 0x300 3028272c886Sjason #define CORB_AGM_GAIN_MASK 0x007f 3038272c886Sjason #define CORB_AGM_MUTE 0x0080 3048272c886Sjason #define CORB_AGM_INDEX_SHIFT 8 3058272c886Sjason #define CORB_AGM_RIGHT 0x1000 3068272c886Sjason #define CORB_AGM_LEFT 0x2000 3078272c886Sjason #define CORB_AGM_INPUT 0x4000 3088272c886Sjason #define CORB_AGM_OUTPUT 0x8000 3098272c886Sjason #define CORB_GET_CONVERTER_FORMAT 0xa00 3108272c886Sjason #define CORB_SET_CONVERTER_FORMAT 0x200 311a8d15fceSjakemsr #define CORB_GET_DIGITAL_CONTROL 0xf0d 312a8d15fceSjakemsr #define CORB_SET_DIGITAL_CONTROL_L 0x70d 313a8d15fceSjakemsr #define CORB_SET_DIGITAL_CONTROL_H 0x70e 314a8d15fceSjakemsr #define CORB_DCC_DIGEN 0x01 315a8d15fceSjakemsr #define CORB_DCC_V 0x02 316a8d15fceSjakemsr #define CORB_DCC_VCFG 0x04 317a8d15fceSjakemsr #define CORB_DCC_PRE 0x08 318a8d15fceSjakemsr #define CORB_DCC_COPY 0x10 319a8d15fceSjakemsr #define CORB_DCC_NAUDIO 0x20 320a8d15fceSjakemsr #define CORB_DCC_PRO 0x40 321a8d15fceSjakemsr #define CORB_DCC_L 0x80 322a8d15fceSjakemsr #define CORB_DCC_CC(x) ((x >> 8) & 0x7f) 3238272c886Sjason #define CORB_GET_POWER_STATE 0xf05 3248272c886Sjason #define CORB_SET_POWER_STATE 0x705 3258272c886Sjason #define CORB_PS_D0 0x0 3268272c886Sjason #define CORB_PS_D1 0x1 3278272c886Sjason #define CORB_PS_D2 0x2 3288272c886Sjason #define CORB_PS_D3 0x3 3298272c886Sjason #define CORB_GET_CONVERTER_STREAM_CHANNEL 0xf06 3308272c886Sjason #define CORB_SET_CONVERTER_STREAM_CHANNEL 0x706 3318272c886Sjason #define CORB_GET_INPUT_CONVERTER_SDI_SELECT 0xf04 3328272c886Sjason #define CORB_SET_INPUT_CONVERTER_SDI_SELECT 0x704 3338272c886Sjason #define CORB_GET_PIN_WIDGET_CONTROL 0xf07 3348272c886Sjason #define CORB_SET_PIN_WIDGET_CONTROL 0x707 3358272c886Sjason #define CORB_PWC_HEADPHONE 0x80 3368272c886Sjason #define CORB_PWC_OUTPUT 0x40 3378272c886Sjason #define CORB_PWC_INPUT 0x20 338d44429c8Sjakemsr #define CORB_PWC_VREF_MASK 0x07 3398272c886Sjason #define CORB_PWC_VREF_HIZ 0x00 3408272c886Sjason #define CORB_PWC_VREF_50 0x01 3418272c886Sjason #define CORB_PWC_VREF_GND 0x02 3428272c886Sjason #define CORB_PWC_VREF_80 0x04 3438272c886Sjason #define CORB_PWC_VREF_100 0x05 3448272c886Sjason #define CORB_GET_UNSOLICITED_RESPONSE 0xf08 3458272c886Sjason #define CORB_SET_UNSOLICITED_RESPONSE 0x708 346957d3dcfSbrad #define CORB_UNSOL_ENABLE 0x80 347957d3dcfSbrad #define CORB_UNSOL_TAG(x) (x & 0x3f) 3488272c886Sjason #define CORB_GET_PIN_SENSE 0xf09 34904a4ef82Sdeanna #define CORB_PS_PRESENCE 0x80000000 350957d3dcfSbrad #define CORB_PS_IMPEDANCE(x) (x & 0x7fffffff) 3518272c886Sjason #define CORB_EXECUTE_PIN_SENSE 0x709 352957d3dcfSbrad #define CORB_PS_RIGHT 0x1 3538272c886Sjason #define CORB_GET_EAPD_BTL_ENABLE 0xf0c 3548272c886Sjason #define CORB_SET_EAPD_BTL_ENABLE 0x70c 35501e140c5Sdeanna #define CORB_EAPD_BTL 0x01 35601e140c5Sdeanna #define CORB_EAPD_EAPD 0x02 35701e140c5Sdeanna #define CORB_EAPD_LRSWAP 0x04 3588272c886Sjason #define CORB_GET_GPI_DATA 0xf10 3598272c886Sjason #define CORB_SET_GPI_DATA 0x710 3608272c886Sjason #define CORB_GET_GPI_WAKE_ENABLE_MASK 0xf11 3618272c886Sjason #define CORB_SET_GPI_WAKE_ENABLE_MASK 0x711 3628272c886Sjason #define CORB_GET_GPI_UNSOLICITED_ENABLE_MASK 0xf12 3638272c886Sjason #define CORB_SET_GPI_UNSOLICITED_ENABLE_MASK 0x712 3648272c886Sjason #define CORB_GET_GPI_STICKY_MASK 0xf13 3658272c886Sjason #define CORB_SET_GPI_STICKY_MASK 0x713 3668272c886Sjason #define CORB_GET_GPO_DATA 0xf14 3678272c886Sjason #define CORB_SET_GPO_DATA 0x714 3688272c886Sjason #define CORB_GET_GPIO_DATA 0xf15 3698272c886Sjason #define CORB_SET_GPIO_DATA 0x715 3708272c886Sjason #define CORB_GET_GPIO_ENABLE_MASK 0xf16 3718272c886Sjason #define CORB_SET_GPIO_ENABLE_MASK 0x716 3728272c886Sjason #define CORB_GET_GPIO_DIRECTION 0xf17 3738272c886Sjason #define CORB_SET_GPIO_DIRECTION 0x717 3748272c886Sjason #define CORB_GET_GPIO_WAKE_ENABLE_MASK 0xf18 3758272c886Sjason #define CORB_SET_GPIO_WAKE_ENABLE_MASK 0x718 3768272c886Sjason #define CORB_GET_GPIO_UNSOLICITED_ENABLE_MASK 0xf19 3778272c886Sjason #define CORB_SET_GPIO_UNSOLICITED_ENABLE_MASK 0x719 3788272c886Sjason #define CORB_GET_GPIO_STICKY_MASK 0xf1a 3798272c886Sjason #define CORB_SET_GPIO_STICKY_MASK 0x71a 3803784ed07Sjakemsr #define CORB_GET_GPIO_POLARITY 0xfe7 3813784ed07Sjakemsr #define CORB_SET_GPIO_POLARITY 0x7e7 3828272c886Sjason #define CORB_GET_BEEP_GENERATION 0xf0a 3838272c886Sjason #define CORB_SET_BEEP_GENERATION 0x70a 3848272c886Sjason #define CORB_GET_VOLUME_KNOB 0xf0f 3858272c886Sjason #define CORB_SET_VOLUME_KNOB 0x70f 3868272c886Sjason #define CORB_VKNOB_DIRECT 0x80 3878272c886Sjason #define CORB_VKNOB_VOLUME(x) (x & 0x7f) 3888272c886Sjason #define CORB_GET_SUBSYSTEM_ID 0xf20 3898272c886Sjason #define CORB_SET_SUBSYSTEM_ID_1 0x720 3908272c886Sjason #define CORB_SET_SUBSYSTEM_ID_2 0x721 3918272c886Sjason #define CORB_SET_SUBSYSTEM_ID_3 0x722 3928272c886Sjason #define CORB_SET_SUBSYSTEM_ID_4 0x723 3938272c886Sjason #define CORB_GET_CONFIGURATION_DEFAULT 0xf1c 3948272c886Sjason #define CORB_SET_CONFIGURATION_DEFAULT_1 0x71c 3958272c886Sjason #define CORB_SET_CONFIGURATION_DEFAULT_2 0x71d 3968272c886Sjason #define CORB_SET_CONFIGURATION_DEFAULT_3 0x71e 3978272c886Sjason #define CORB_SET_CONFIGURATION_DEFAULT_4 0x71f 3988272c886Sjason #define CORB_CD_SEQUENCE(x) (x & 0x0000000f) 3998272c886Sjason #define CORB_CD_SEQUENCE_MAX 0x0f 4008272c886Sjason #define CORB_CD_ASSOCIATION(x) ((x >> 4) & 0xf) 4018272c886Sjason #define CORB_CD_ASSOCIATION_MAX 0x0f 4028272c886Sjason #define CORB_CD_MISC_MASK 0x00000f00 40309868b1bSjakemsr #define CORB_CD_MISC(x) ((x >> 8) & 0xf) 40409868b1bSjakemsr #define CORB_CD_PRESENCEOV 0x1 4058272c886Sjason #define CORB_CD_COLOR(x) ((x >> 12) & 0xf) 4068272c886Sjason #define CORB_CD_COLOR_UNKNOWN 0x0 4078272c886Sjason #define CORB_CD_BLACK 0x1 4088272c886Sjason #define CORB_CD_GRAY 0x2 4098272c886Sjason #define CORB_CD_BLUE 0x3 4108272c886Sjason #define CORB_CD_GREEN 0x4 4118272c886Sjason #define CORB_CD_RED 0x5 4128272c886Sjason #define CORB_CD_ORANGE 0x6 4138272c886Sjason #define CORB_CD_YELLOW 0x7 4148272c886Sjason #define CORB_CD_PURPLE 0x8 4158272c886Sjason #define CORB_CD_PINK 0x9 4168272c886Sjason #define CORB_CD_WHITE 0xe 4178272c886Sjason #define CORB_CD_COLOR_OTHER 0xf 418fcb163d6Sjakemsr #define CORB_CD_CONNECTION_OFFSET 16 419fcb163d6Sjakemsr #define CORB_CD_CONNECTION_BITS 0xf 420fcb163d6Sjakemsr #define CORB_CD_CONNECTION_MASK (CORB_CD_CONNECTION_BITS << CORB_CD_CONNECTION_OFFSET) 421fcb163d6Sjakemsr #define CORB_CD_CONNECTION(x) ((x >> CORB_CD_CONNECTION_OFFSET) & CORB_CD_CONNECTION_BITS) 4221b50f7e1Sdeanna #define CORB_CD_CONN_UNKNOWN 0x0 4231b50f7e1Sdeanna #define CORB_CD_18 0x1 4241b50f7e1Sdeanna #define CORB_CD_14 0x2 4251b50f7e1Sdeanna #define CORB_CD_ATAPI 0x3 4261b50f7e1Sdeanna #define CORB_CD_RCA 0x4 4271b50f7e1Sdeanna #define CORB_CD_OPTICAL 0x5 4281b50f7e1Sdeanna #define CORB_CD_OTHER_DIG 0x6 4291b50f7e1Sdeanna #define CORB_CD_OTHER_ANALOG 0x7 4301b50f7e1Sdeanna #define CORB_CD_DIN 0x8 4311b50f7e1Sdeanna #define CORB_CD_XLF 0x9 4321b50f7e1Sdeanna #define CORB_CD_RJ11 0xa 4331b50f7e1Sdeanna #define CORB_CD_CONN_COMB 0xb 4341b50f7e1Sdeanna #define CORB_CD_CONN_OTHER 0xf 435fcb163d6Sjakemsr #define CORB_CD_DEVICE_OFFSET 20 436fcb163d6Sjakemsr #define CORB_CD_DEVICE_BITS 0xf 437fcb163d6Sjakemsr #define CORB_CD_DEVICE_MASK (CORB_CD_DEVICE_BITS << CORB_CD_DEVICE_OFFSET) 438fcb163d6Sjakemsr #define CORB_CD_DEVICE(x) ((x >> CORB_CD_DEVICE_OFFSET) & CORB_CD_DEVICE_BITS) 4398272c886Sjason #define CORB_CD_LINEOUT 0x0 4408272c886Sjason #define CORB_CD_SPEAKER 0x1 4418272c886Sjason #define CORB_CD_HEADPHONE 0x2 4428272c886Sjason #define CORB_CD_CD 0x3 4438272c886Sjason #define CORB_CD_SPDIFOUT 0x4 4448272c886Sjason #define CORB_CD_DIGITALOUT 0x5 4458272c886Sjason #define CORB_CD_MODEMLINE 0x6 4468272c886Sjason #define CORB_CD_MODEMHANDSET 0x7 4478272c886Sjason #define CORB_CD_LINEIN 0x8 4488272c886Sjason #define CORB_CD_AUX 0x9 4498272c886Sjason #define CORB_CD_MICIN 0xa 4508272c886Sjason #define CORB_CD_TELEPHONY 0xb 4518272c886Sjason #define CORB_CD_SPDIFIN 0xc 4528272c886Sjason #define CORB_CD_DIGITALIN 0xd 453fcb163d6Sjakemsr #define CORB_CD_BEEP 0xe 4548272c886Sjason #define CORB_CD_DEVICE_OTHER 0xf 4558272c886Sjason #define CORB_CD_LOCATION_MASK 0x3f000000 4561b50f7e1Sdeanna #define CORB_CD_LOC_GEO(x) ((x >> 24) & 0xf) 4571b50f7e1Sdeanna #define CORB_CD_LOC_GEO_NA 0x0 4581b50f7e1Sdeanna #define CORB_CD_REAR 0x1 4591b50f7e1Sdeanna #define CORB_CD_FRONT 0x2 4601b50f7e1Sdeanna #define CORB_CD_LEFT 0x3 4611b50f7e1Sdeanna #define CORB_CD_RIGHT 0x4 4621b50f7e1Sdeanna #define CORB_CD_TOP 0x5 4631b50f7e1Sdeanna #define CORB_CD_BOTTOM 0x6 4641b50f7e1Sdeanna #define CORB_CD_LOC_SPEC0 0x7 4651b50f7e1Sdeanna #define CORB_CD_LOC_SPEC1 0x8 4661b50f7e1Sdeanna #define CORB_CD_LOC_SPEC2 0x9 4671b50f7e1Sdeanna #define CORB_CD_LOC_CHASS(x) ((x >> 28) & 0x3) 4681b50f7e1Sdeanna #define CORB_CD_EXTERNAL 0x0 4691b50f7e1Sdeanna #define CORB_CD_INTERNAL 0x1 4701b50f7e1Sdeanna #define CORB_CD_SEPARATE 0x2 4711b50f7e1Sdeanna #define CORB_CD_LOC_OTHER 0x3 472fcb163d6Sjakemsr #define CORB_CD_PORT_OFFSET 30 473fcb163d6Sjakemsr #define CORB_CD_PORT_BITS 0x3 474fcb163d6Sjakemsr #define CORB_CD_PORT_MASK (CORB_CD_PORT_BITS << CORB_CD_PORT_OFFSET) 475fcb163d6Sjakemsr #define CORB_CD_PORT(x) ((x >> CORB_CD_PORT_OFFSET) & CORB_CD_PORT_BITS) 4761b50f7e1Sdeanna #define CORB_CD_JACK 0x0 4771b50f7e1Sdeanna #define CORB_CD_NONE 0x1 4781b50f7e1Sdeanna #define CORB_CD_FIXED 0x2 4791b50f7e1Sdeanna #define CORB_CD_BOTH 0x3 4808272c886Sjason #define CORB_GET_STRIPE_CONTROL 0xf24 4818272c886Sjason #define CORB_SET_STRIPE_CONTROL 0x720 /* XXX typo in the spec? */ 4828272c886Sjason #define CORB_EXECUTE_FUNCTION_RESET 0x7ff 4838272c886Sjason 4848272c886Sjason #define CORB_NID_ROOT 0 4858272c886Sjason #define HDA_MAX_CHANNELS 16 486981308b3Sjakemsr #define HDA_MAX_SENSE_PINS 16 4878122f610Sjakemsr #define HDA_MAX_CODECS 15 4888272c886Sjason 489ee5ff928Sjakemsr #define AZ_MAX_VOL_SLAVES 16 490183396dbSjakemsr #define AZ_TAG_SPKR 0x01 491a7237422Sjakemsr #define AZ_TAG_PLAYVOL 0x02 492183396dbSjakemsr 4930861e2c4Sjakemsr #define AZ_CLASS_INPUT 0 4940861e2c4Sjakemsr #define AZ_CLASS_OUTPUT 1 4950861e2c4Sjakemsr #define AZ_CLASS_RECORD 2 4960861e2c4Sjakemsr 497d65207cbSjakemsr #define AZ_QRK_NONE 0x00000000 498d65207cbSjakemsr #define AZ_QRK_GPIO_MASK 0x00000fff 499d65207cbSjakemsr #define AZ_QRK_GPIO_UNMUTE_0 0x00000001 500d65207cbSjakemsr #define AZ_QRK_GPIO_UNMUTE_1 0x00000002 501d65207cbSjakemsr #define AZ_QRK_GPIO_UNMUTE_2 0x00000004 502d65207cbSjakemsr #define AZ_QRK_GPIO_UNMUTE_3 0x00000008 503d65207cbSjakemsr #define AZ_QRK_GPIO_UNMUTE_4 0x00000010 504d65207cbSjakemsr #define AZ_QRK_GPIO_UNMUTE_5 0x00000020 505d65207cbSjakemsr #define AZ_QRK_GPIO_UNMUTE_6 0x00000040 506d65207cbSjakemsr #define AZ_QRK_GPIO_UNMUTE_7 0x00000080 507d65207cbSjakemsr #define AZ_QRK_GPIO_POL_0 0x00000100 508*6eae9050Sjcs #define AZ_QRK_WID_MASK 0x00fff000 509d65207cbSjakemsr #define AZ_QRK_WID_CDIN_1C 0x00001000 510d65207cbSjakemsr #define AZ_QRK_WID_BEEP_1D 0x00002000 5110a22a875Sjakemsr #define AZ_QRK_WID_OVREF50 0x00004000 512f3f7a230Sjakemsr #define AZ_QRK_WID_AD1981_OAMP 0x00008000 513e9f309a1Smlarkin #define AZ_QRK_WID_TPDOCK1 0x00010000 514e9f309a1Smlarkin #define AZ_QRK_WID_TPDOCK2 0x00020000 515b3c5b925Sjsg #define AZ_QRK_WID_TPDOCK3 0x00040000 516*6eae9050Sjcs #define AZ_QRK_WID_CLOSE_PCBEEP 0x00080000 517054809f8Sjcs #define AZ_QRK_ROUTE_SPKR2_DAC 0x01000000 518054809f8Sjcs #define AZ_QRK_DOLBY_ATMOS 0x02000000 519d65207cbSjakemsr 5208272c886Sjason /* memory-mapped types */ 5218272c886Sjason typedef struct { 5228272c886Sjason uint32_t low; 5238272c886Sjason uint32_t high; 5248272c886Sjason uint32_t length; 5258272c886Sjason uint32_t flags; 5268272c886Sjason #define BDLIST_ENTRY_IOC 0x00000001 5278272c886Sjason } __packed bdlist_entry_t; 5288272c886Sjason #define HDA_BDL_MAX 256 5298272c886Sjason 5308272c886Sjason typedef struct { 5318272c886Sjason uint32_t position; 5328272c886Sjason uint32_t reserved; 5338272c886Sjason } __packed dmaposition_t; 5348272c886Sjason 5358272c886Sjason typedef uint32_t corb_entry_t; 5368272c886Sjason typedef struct { 5378272c886Sjason uint32_t resp; 5388272c886Sjason uint32_t resp_ex; 53904a4ef82Sdeanna #define RIRB_UNSOL_TAG(resp) ((resp) >> 26) 54004a4ef82Sdeanna #define RIRB_RESP_UNSOL (1 << 4) 54104a4ef82Sdeanna #define RIRB_RESP_CODEC(ex) ((ex) & 0xf) 5428272c886Sjason } __packed rirb_entry_t; 5438272c886Sjason 5448272c886Sjason 5458272c886Sjason /* #define AZALIA_DEBUG */ 5468272c886Sjason #ifdef AZALIA_DEBUG 5478272c886Sjason # define DPRINTF(x) do { printf x; } while (0/*CONSTCOND*/) 5488272c886Sjason #else 5498272c886Sjason # define DPRINTF(x) do {} while (0/*CONSTCOND*/) 5508272c886Sjason #endif 5518272c886Sjason #define PTR_UPPER32(x) ((uint64_t)(x) >> 32) 5528272c886Sjason 5538272c886Sjason typedef int nid_t; 5548272c886Sjason 5558272c886Sjason typedef struct { 5568272c886Sjason nid_t nid; 557de7cbcd6Sjakemsr int enable; 5588272c886Sjason uint32_t widgetcap; 5598272c886Sjason int type; /* = bit20-24 of widgetcap */ 56043590e12Sjakemsr nid_t parent; 5610861e2c4Sjakemsr int mixer_class; 5628272c886Sjason int nconnections; 5638272c886Sjason nid_t *connections; 5648272c886Sjason int selected; 5658272c886Sjason uint32_t inamp_cap; 5668272c886Sjason uint32_t outamp_cap; 5678272c886Sjason char name[MAX_AUDIO_DEV_LEN]; 5688272c886Sjason union { 5698272c886Sjason struct { /* for AUDIO_INPUT/OUTPUT */ 5708272c886Sjason uint32_t encodings; 5718272c886Sjason uint32_t bits_rates; 5728272c886Sjason } audio; 5738272c886Sjason struct { /* for PIN */ 5748272c886Sjason uint32_t cap; 5758272c886Sjason uint32_t config; 5768272c886Sjason int sequence; 5778272c886Sjason int association; 5788272c886Sjason int color; 5798272c886Sjason int device; 5808272c886Sjason } pin; 5818272c886Sjason struct { /* for VOLUME_KNOB */ 5828272c886Sjason uint32_t cap; 5838272c886Sjason } volume; 5848272c886Sjason } d; 5858272c886Sjason } widget_t; 5866f98996cSbrad #define WIDGET_CHANNELS(w) ((w)->widgetcap & COP_AWCAP_STEREO ? 2 : 1) 5878272c886Sjason 5888272c886Sjason typedef struct { 5898272c886Sjason mixer_devinfo_t devinfo; 5908272c886Sjason nid_t nid; /* target NID; 0 is invalid. */ 5918272c886Sjason int target; /* 0-15: inamp index, 0x100: outamp, ... */ 5928272c886Sjason #define IS_MI_TARGET_INAMP(x) ((x) <= 15) 5938272c886Sjason #define MI_TARGET_INAMP(x) (x) 5948272c886Sjason #define MI_TARGET_OUTAMP 0x100 5958272c886Sjason #define MI_TARGET_CONNLIST 0x101 5968272c886Sjason #define MI_TARGET_PINDIR 0x102 /* for bidirectional pin */ 5978272c886Sjason #define MI_TARGET_PINBOOST 0x103 /* for headphone pin */ 59807e60bb6Sdeanna #define MI_TARGET_DAC 0x104 59907e60bb6Sdeanna #define MI_TARGET_ADC 0x105 60007e60bb6Sdeanna #define MI_TARGET_VOLUME 0x106 601a8d15fceSjakemsr #define MI_TARGET_SPDIF 0x107 602a8d15fceSjakemsr #define MI_TARGET_SPDIF_CC 0x108 603a8d15fceSjakemsr #define MI_TARGET_EAPD 0x109 604981308b3Sjakemsr #define MI_TARGET_MUTESET 0x10a 605981308b3Sjakemsr #define MI_TARGET_PINSENSE 0x10b 606183396dbSjakemsr #define MI_TARGET_SENSESET 0x10c 6079958a60aSjakemsr #define MI_TARGET_PLAYVOL 0x10d 6089958a60aSjakemsr #define MI_TARGET_RECVOL 0x10e 6094f6e5189Sjakemsr #define MI_TARGET_MIXERSET 0x10f 610c1610933Sjakemsr union { 611c1610933Sjakemsr int ord; 612c1610933Sjakemsr int mask; 613c1610933Sjakemsr mixer_level_t value; 614c1610933Sjakemsr } saved; 6158272c886Sjason } mixer_item_t; 6168272c886Sjason 617734aa97fSbrad #define VALID_WIDGET_NID(nid, codec) (nid == (codec)->audiofunc || \ 618734aa97fSbrad (nid >= (codec)->wstart && \ 619734aa97fSbrad nid < (codec)->wend)) 620734aa97fSbrad 6218272c886Sjason typedef struct { 6228272c886Sjason int nconv; 623c7f0b0c9Sjakemsr nid_t conv[HDA_MAX_CHANNELS]; 6248272c886Sjason } convgroup_t; 6250d66ea42Sbrad typedef struct { 6260d66ea42Sbrad int cur; 6270d66ea42Sbrad int ngroups; 628c7f0b0c9Sjakemsr convgroup_t groups[2]; 6290d66ea42Sbrad } convgroupset_t; 6308272c886Sjason 631ee5ff928Sjakemsr typedef struct { 632ee5ff928Sjakemsr int master; 633ee5ff928Sjakemsr int vol_l; 634ee5ff928Sjakemsr int vol_r; 635ee5ff928Sjakemsr int mute; 636a7237422Sjakemsr int hw_step; 637a7237422Sjakemsr int hw_nsteps; 638ee5ff928Sjakemsr nid_t slaves[AZ_MAX_VOL_SLAVES]; 639ee5ff928Sjakemsr int nslaves; 640ee5ff928Sjakemsr int mask; 641ee5ff928Sjakemsr int cur; 642ee5ff928Sjakemsr } volgroup_t; 643ee5ff928Sjakemsr 64431b94d30Sjakemsr struct io_pin { 64531b94d30Sjakemsr nid_t nid; /* NID of pin */ 64631b94d30Sjakemsr nid_t conv; /* NID of default converter */ 64731b94d30Sjakemsr int prio; /* assoc/seq/dir "priority" */ 64831b94d30Sjakemsr }; 64931b94d30Sjakemsr 6508272c886Sjason typedef struct codec_t { 6518272c886Sjason struct azalia_t *az; 652bc0fbb04Sbrad uint32_t vid; /* codec vendor/device ID */ 653bc0fbb04Sbrad uint32_t subid; /* PCI subvendor/device ID */ 6548272c886Sjason const char *name; 6558272c886Sjason int address; 6568272c886Sjason int nfunctions; 6578272c886Sjason nid_t audiofunc; /* NID of an audio function node */ 6588272c886Sjason nid_t wstart; /* start NID of audio widgets */ 6598272c886Sjason nid_t wend; /* the last NID of audio widgets + 1 */ 6608272c886Sjason widget_t *w; /* widgets in the audio function. 6618272c886Sjason * w[0] to w[wstart-1] are unused. */ 6628272c886Sjason #define FOR_EACH_WIDGET(this, i) for (i = (this)->wstart; i < (this)->wend; i++) 6638272c886Sjason 66441856ce8Sjakemsr int codec_type; 66541856ce8Sjakemsr #define AZ_CODEC_TYPE_ANALOG 0 66641856ce8Sjakemsr #define AZ_CODEC_TYPE_DIGITAL 1 66741856ce8Sjakemsr #define AZ_CODEC_TYPE_HDMI 2 66841856ce8Sjakemsr 669d65207cbSjakemsr int qrks; 670d65207cbSjakemsr 6710d66ea42Sbrad convgroupset_t dacs; 6720d66ea42Sbrad convgroupset_t adcs; 673bc0fbb04Sbrad int running; 6748272c886Sjason 6758272c886Sjason int nmixers, maxmixers; 6768272c886Sjason mixer_item_t *mixers; 6778272c886Sjason 6788272c886Sjason struct audio_format *formats; 6798272c886Sjason int nformats; 68004a4ef82Sdeanna 68131b94d30Sjakemsr struct io_pin *ipins; 68231b94d30Sjakemsr int nipins; 68331b94d30Sjakemsr struct io_pin *ipins_d; 68431b94d30Sjakemsr int nipins_d; 68531b94d30Sjakemsr struct io_pin *opins; 68631b94d30Sjakemsr int nopins; 68731b94d30Sjakemsr struct io_pin *opins_d; 68831b94d30Sjakemsr int nopins_d; 68931b94d30Sjakemsr 6900994ce6cSjakemsr nid_t a_dacs[HDA_MAX_CHANNELS], a_dacs_d[HDA_MAX_CHANNELS]; 6910994ce6cSjakemsr int na_dacs, na_dacs_d; 6920994ce6cSjakemsr nid_t a_adcs[HDA_MAX_CHANNELS], a_adcs_d[HDA_MAX_CHANNELS]; 6930994ce6cSjakemsr int na_adcs, na_adcs_d; 6940994ce6cSjakemsr 6950994ce6cSjakemsr nid_t mic; /* fixed (internal) mic */ 6960994ce6cSjakemsr nid_t mic_adc; 6970994ce6cSjakemsr nid_t speaker; /* fixed (internal) speaker */ 6982e11e582Sjakemsr nid_t speaker2; /* 2nd fixed (internal) speaker */ 6992e11e582Sjakemsr nid_t spkr_dac; /* default DAC for speaker and speaker2 */ 7006fdbde60Sjakemsr nid_t input_mixer; 7014204a530Sjakemsr nid_t fhp; /* front headphone jack */ 702f68cef90Sjakemsr nid_t fhp_dac; 703f68cef90Sjakemsr int nout_jacks; /* number of default output jacks */ 7040994ce6cSjakemsr 7053918b53fSjakemsr int spkr_muted; 7068cdc9a8fSjakemsr int spkr_muters; 7071110f0e0Sjakemsr int spkr_mute_method; 7081110f0e0Sjakemsr #define AZ_SPKR_MUTE_NONE 0 7091110f0e0Sjakemsr #define AZ_SPKR_MUTE_SPKR_MUTE 1 7101110f0e0Sjakemsr #define AZ_SPKR_MUTE_SPKR_DIR 2 7111110f0e0Sjakemsr #define AZ_SPKR_MUTE_DAC_MUTE 3 7128cdc9a8fSjakemsr 713ee5ff928Sjakemsr volgroup_t playvols; 714ee5ff928Sjakemsr volgroup_t recvols; 715ee5ff928Sjakemsr 716981308b3Sjakemsr nid_t sense_pins[HDA_MAX_SENSE_PINS]; 7172f50987aSjakemsr int nsense_pins; 7188272c886Sjason } codec_t; 7198272c886Sjason 720bc0fbb04Sbrad int azalia_codec_init_vtbl(codec_t *); 7210d66ea42Sbrad int azalia_codec_construct_format(codec_t *, int, int); 7223e9cfab2Sjakemsr int azalia_widget_enabled(const codec_t *, nid_t); 723dbd33eccSjakemsr int azalia_codec_gpio_quirks(codec_t *); 724d65207cbSjakemsr int azalia_codec_widget_quirks(codec_t *, nid_t); 725ea3882e9Sjakemsr int azalia_codec_fnode(codec_t *, nid_t, int, int); 72690cdee7aSjakemsr 72790cdee7aSjakemsr int azalia_init_dacgroup(codec_t *); 72890cdee7aSjakemsr int azalia_mixer_init(codec_t *); 72990cdee7aSjakemsr int azalia_mixer_delete(codec_t *); 73090cdee7aSjakemsr int azalia_unsol_event(codec_t *, int); 73190cdee7aSjakemsr int azalia_comresp(const codec_t *, nid_t, uint32_t, uint32_t, uint32_t *); 732e7cf8650Sjakemsr int azalia_mixer_get(const codec_t *, nid_t, int, mixer_ctrl_t *); 733e7cf8650Sjakemsr int azalia_mixer_set(codec_t *, nid_t, int, const mixer_ctrl_t *); 7345ff1049bSjakemsr 735bf56ad23Sjakemsr int azalia_codec_enable_unsol(codec_t *); 7367632b479Sjcs 7377632b479Sjcs void azalia_codec_init_dolby_atmos(codec_t *); 738