1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * Copyright 2007-2008, Haiku, Inc. All Rights Reserved. 3*c2c66affSColin Finck * Distributed under the terms of the MIT License. 4*c2c66affSColin Finck * 5*c2c66affSColin Finck * Authors: 6*c2c66affSColin Finck * Ithamar Adema, ithamar AT unet DOT nl 7*c2c66affSColin Finck * Axel Dörfler, axeld@pinc-software.de 8*c2c66affSColin Finck */ 9*c2c66affSColin Finck #ifndef HDA_CODEC_H 10*c2c66affSColin Finck #define HDA_CODEC_H 11*c2c66affSColin Finck 12*c2c66affSColin Finck enum hda_widget_type { 13*c2c66affSColin Finck WT_AUDIO_OUTPUT = 0, 14*c2c66affSColin Finck WT_AUDIO_INPUT = 1, 15*c2c66affSColin Finck WT_AUDIO_MIXER = 2, 16*c2c66affSColin Finck WT_AUDIO_SELECTOR = 3, 17*c2c66affSColin Finck WT_PIN_COMPLEX = 4, 18*c2c66affSColin Finck WT_POWER = 5, 19*c2c66affSColin Finck WT_VOLUME_KNOB = 6, 20*c2c66affSColin Finck WT_BEEP_GENERATOR = 7, 21*c2c66affSColin Finck WT_VENDOR_DEFINED = 15 22*c2c66affSColin Finck }; 23*c2c66affSColin Finck 24*c2c66affSColin Finck enum pin_connectivity_type { 25*c2c66affSColin Finck PIN_CONN_JACK, 26*c2c66affSColin Finck PIN_CONN_NONE, 27*c2c66affSColin Finck PIN_CONN_FIXED, 28*c2c66affSColin Finck PIN_CONN_BOTH 29*c2c66affSColin Finck }; 30*c2c66affSColin Finck 31*c2c66affSColin Finck enum pin_dev_type { 32*c2c66affSColin Finck PIN_DEV_LINE_OUT = 0, 33*c2c66affSColin Finck PIN_DEV_SPEAKER, 34*c2c66affSColin Finck PIN_DEV_HEAD_PHONE_OUT, 35*c2c66affSColin Finck PIN_DEV_CD, 36*c2c66affSColin Finck PIN_DEV_SPDIF_OUT, 37*c2c66affSColin Finck PIN_DEV_DIGITAL_OTHER_OUT, 38*c2c66affSColin Finck PIN_DEV_MODEM_LINE_SIDE, 39*c2c66affSColin Finck PIN_DEV_MODEM_HAND_SIDE, 40*c2c66affSColin Finck PIN_DEV_LINE_IN, 41*c2c66affSColin Finck PIN_DEV_AUX, 42*c2c66affSColin Finck PIN_DEV_MIC_IN, 43*c2c66affSColin Finck PIN_DEV_TELEPHONY, 44*c2c66affSColin Finck PIN_DEV_SPDIF_IN, 45*c2c66affSColin Finck PIN_DEV_DIGITAL_OTHER_IN, 46*c2c66affSColin Finck PIN_DEV_RESERVED, 47*c2c66affSColin Finck PIN_DEV_OTHER 48*c2c66affSColin Finck }; 49*c2c66affSColin Finck 50*c2c66affSColin Finck 51*c2c66affSColin Finck /* Verb Helper Macro */ 52*c2c66affSColin Finck #define MAKE_VERB(cad, nid, vid, payload) \ 53*c2c66affSColin Finck (((cad) << 28) | ((nid) << 20) | (vid) | (payload)) 54*c2c66affSColin Finck 55*c2c66affSColin Finck /* Verb IDs */ 56*c2c66affSColin Finck #define VID_GET_PARAMETER 0xf0000 57*c2c66affSColin Finck #define VID_GET_CONNECTION_SELECT 0xf0100 58*c2c66affSColin Finck #define VID_SET_CONNECTION_SELECT 0x70100 59*c2c66affSColin Finck #define VID_GET_CONNECTION_LIST_ENTRY 0xf0200 60*c2c66affSColin Finck #define VID_GET_PROCESSING_STATE 0xf0300 61*c2c66affSColin Finck #define VID_SET_PROCESSING_STATE 0x70300 62*c2c66affSColin Finck #define VID_GET_COEFFICIENT_INDEX 0xd0000 63*c2c66affSColin Finck #define VID_SET_COEFFICIENT_INDEX 0x50000 64*c2c66affSColin Finck #define VID_GET_PROCESSING_COEFFICIENT 0xc0000 65*c2c66affSColin Finck #define VID_SET_PROCESSING_COEFFICIENT 0x40000 66*c2c66affSColin Finck #define VID_GET_AMPLIFIER_GAIN_MUTE 0xb0000 67*c2c66affSColin Finck #define VID_SET_AMPLIFIER_GAIN_MUTE 0x30000 68*c2c66affSColin Finck #define VID_GET_CONVERTER_FORMAT 0xa0000 69*c2c66affSColin Finck #define VID_SET_CONVERTER_FORMAT 0x20000 70*c2c66affSColin Finck #define VID_GET_CONVERTER_STREAM_CHANNEL 0xf0600 71*c2c66affSColin Finck #define VID_SET_CONVERTER_STREAM_CHANNEL 0x70600 72*c2c66affSColin Finck #define VID_GET_DIGITAL_CONVERTER_CONTROL 0xf0d00 73*c2c66affSColin Finck #define VID_SET_DIGITAL_CONVERTER_CONTROL1 0x70d00 74*c2c66affSColin Finck #define VID_SET_DIGITAL_CONVERTER_CONTROL2 0x70e00 75*c2c66affSColin Finck #define VID_GET_POWER_STATE 0xf0500 76*c2c66affSColin Finck #define VID_SET_POWER_STATE 0x70500 77*c2c66affSColin Finck #define VID_GET_SDI_SELECT 0xf0400 78*c2c66affSColin Finck #define VID_SET_SDI_SELECT 0x70400 79*c2c66affSColin Finck #define VID_GET_PIN_WIDGET_CONTROL 0xf0700 80*c2c66affSColin Finck #define VID_SET_PIN_WIDGET_CONTROL 0x70700 81*c2c66affSColin Finck #define VID_GET_UNSOLRESP 0xF0800 82*c2c66affSColin Finck #define VID_SET_UNSOLRESP 0x70800 83*c2c66affSColin Finck #define VID_GET_PINSENSE 0xF0900 84*c2c66affSColin Finck #define VID_SET_PINSENSE 0x70900 85*c2c66affSColin Finck #define VID_GET_EAPDBTL_EN 0xF0C00 86*c2c66affSColin Finck #define VID_SET_EAPDBTL_EN 0x70C00 87*c2c66affSColin Finck #define VID_GET_VOLUME_KNOB_CONTROL 0xF0F00 88*c2c66affSColin Finck #define VID_SET_VOLUME_KNOB_CONTROL 0x70F00 89*c2c66affSColin Finck #define VID_GET_GPIDATA 0xF1000 90*c2c66affSColin Finck #define VID_SET_GPIDATA 0x71000 91*c2c66affSColin Finck #define VID_GET_GPIWAKE_EN 0xF1100 92*c2c66affSColin Finck #define VID_SET_GPIWAKE_EN 0x71100 93*c2c66affSColin Finck #define VID_GET_GPIUNSOL 0xF1200 94*c2c66affSColin Finck #define VID_SET_GPIUNSOL 0x71200 95*c2c66affSColin Finck #define VID_GET_GPISTICKY 0xF1300 96*c2c66affSColin Finck #define VID_SET_GPISTICKY 0x71300 97*c2c66affSColin Finck #define VID_GET_GPO_DATA 0xF1400 98*c2c66affSColin Finck #define VID_SET_GPO_DATA 0x71400 99*c2c66affSColin Finck #define VID_GET_GPIO_DATA 0xF1500 100*c2c66affSColin Finck #define VID_SET_GPIO_DATA 0x71500 101*c2c66affSColin Finck #define VID_GET_GPIO_EN 0xF1600 102*c2c66affSColin Finck #define VID_SET_GPIO_EN 0x71600 103*c2c66affSColin Finck #define VID_GET_GPIO_DIR 0xF1700 104*c2c66affSColin Finck #define VID_SET_GPIO_DIR 0x71700 105*c2c66affSColin Finck #define VID_GET_GPIOWAKE_EN 0xF1800 106*c2c66affSColin Finck #define VID_SET_GPIOWAKE_EN 0x71800 107*c2c66affSColin Finck #define VID_GET_GPIOUNSOL_EN 0xF1900 108*c2c66affSColin Finck #define VID_SET_GPIOUNSOL_EN 0x71900 109*c2c66affSColin Finck #define VID_GET_GPIOSTICKY 0xF1A00 110*c2c66affSColin Finck #define VID_SET_GPIOSTICKY 0x71A00 111*c2c66affSColin Finck #define VID_GET_BEEPGEN 0xF0A00 112*c2c66affSColin Finck #define VID_SET_BEEPGEN 0x70A00 113*c2c66affSColin Finck #define VID_GET_VOLUME_KNOB 0xf0f00 114*c2c66affSColin Finck #define VID_SET_VOLUME_KNOB 0x70f00 115*c2c66affSColin Finck #define VID_GET_SUBSYSTEMID 0xF2000 116*c2c66affSColin Finck #define VID_SET_SUBSYSTEMID1 0x72000 117*c2c66affSColin Finck #define VID_SET_SUBSYSTEMID2 0x72100 118*c2c66affSColin Finck #define VID_SET_SUBSYSTEMID3 0x72200 119*c2c66affSColin Finck #define VID_SET_SUBSYSTEMID4 0x72300 120*c2c66affSColin Finck #define VID_GET_CONFIGURATION_DEFAULT 0xf1c00 121*c2c66affSColin Finck #define VID_SET_CONFIGURATION_DEFAULT1 0x71c00 122*c2c66affSColin Finck #define VID_SET_CONFIGURATION_DEFAULT2 0x71d00 123*c2c66affSColin Finck #define VID_SET_CONFIGURATION_DEFAULT3 0x71e00 124*c2c66affSColin Finck #define VID_SET_CONFIGURATION_DEFAULT4 0x71f00 125*c2c66affSColin Finck #define VID_GET_STRIPE_CONTROL 0xf2400 126*c2c66affSColin Finck #define VID_SET_STRIPE_CONTROL 0x72000 127*c2c66affSColin Finck #define VID_FUNCTION_RESET 0x7ff00 128*c2c66affSColin Finck /* later specification updates */ 129*c2c66affSColin Finck #define VID_GET_EDID_LIKE_DATA 0xf2f00 130*c2c66affSColin Finck #define VID_GET_CONVERTER_CHANNEL_COUNT 0xf2d00 131*c2c66affSColin Finck #define VID_SET_CONVERTER_CHANNEL_COUNT 0x72d00 132*c2c66affSColin Finck #define VID_GET_DATA_ISLAND_PACKET_SIZE 0xf2e00 133*c2c66affSColin Finck #define VID_GET_DATA_ISLAND_PACKET_INDEX 0xf3000 134*c2c66affSColin Finck #define VID_SET_DATA_ISLAND_PACKET_INDEX 0x73000 135*c2c66affSColin Finck #define VID_GET_DATA_ISLAND_PACKET_DATA 0xf3100 136*c2c66affSColin Finck #define VID_SET_DATA_ISLAND_PACKET_DATA 0x73100 137*c2c66affSColin Finck #define VID_GET_DATA_ISLAND_PACKET_XMITCTRL 0xf3200 138*c2c66affSColin Finck #define VID_SET_DATA_ISLAND_PACKET_XMITCTRL 0x73200 139*c2c66affSColin Finck #define VID_GET_CONTENT_PROTECTION_CONTROL 0xf3300 140*c2c66affSColin Finck #define VID_SET_CONTENT_PROTECTION_CONTROL 0x73300 141*c2c66affSColin Finck #define VID_GET_ASP_CHANNEL_MAPPING 0xf3400 142*c2c66affSColin Finck #define VID_SET_ASP_CHANNEL_MAPPING 0x73400 143*c2c66affSColin Finck 144*c2c66affSColin Finck /* Parameter IDs */ 145*c2c66affSColin Finck #define PID_VENDOR_ID 0x00 146*c2c66affSColin Finck #define PID_REVISION_ID 0x02 147*c2c66affSColin Finck #define PID_SUB_NODE_COUNT 0x04 148*c2c66affSColin Finck #define PID_FUNCTION_GROUP_TYPE 0x05 149*c2c66affSColin Finck #define PID_AUDIO_GROUP_CAP 0x08 150*c2c66affSColin Finck #define PID_AUDIO_WIDGET_CAP 0x09 151*c2c66affSColin Finck #define PID_PCM_SUPPORT 0x0a 152*c2c66affSColin Finck #define PID_STREAM_SUPPORT 0x0b 153*c2c66affSColin Finck #define PID_PIN_CAP 0x0c 154*c2c66affSColin Finck #define PID_INPUT_AMPLIFIER_CAP 0x0d 155*c2c66affSColin Finck #define PID_CONNECTION_LIST_LENGTH 0x0e 156*c2c66affSColin Finck #define PID_POWERSTATE_SUPPORT 0x0f 157*c2c66affSColin Finck #define PID_PROCESSING_CAP 0x10 158*c2c66affSColin Finck #define PID_GPIO_COUNT 0x11 159*c2c66affSColin Finck #define PID_OUTPUT_AMPLIFIER_CAP 0x12 160*c2c66affSColin Finck #define PID_VOLUME_KNOB_CAP 0x13 161*c2c66affSColin Finck 162*c2c66affSColin Finck /* Subordinate node count */ 163*c2c66affSColin Finck #define SUB_NODE_COUNT_TOTAL_MASK 0x000000ff 164*c2c66affSColin Finck #define SUB_NODE_COUNT_TOTAL_SHIFT 0 165*c2c66affSColin Finck #define SUB_NODE_COUNT_START_MASK 0x00ff0000 166*c2c66affSColin Finck #define SUB_NODE_COUNT_START_SHIFT 16 167*c2c66affSColin Finck 168*c2c66affSColin Finck #define SUB_NODE_COUNT_TOTAL(c) ((c & SUB_NODE_COUNT_TOTAL_MASK) \ 169*c2c66affSColin Finck >> SUB_NODE_COUNT_TOTAL_SHIFT) 170*c2c66affSColin Finck #define SUB_NODE_COUNT_START(c) ((c & SUB_NODE_COUNT_START_MASK) \ 171*c2c66affSColin Finck >> SUB_NODE_COUNT_START_SHIFT) 172*c2c66affSColin Finck 173*c2c66affSColin Finck /* Function group type */ 174*c2c66affSColin Finck #define FUNCTION_GROUP_NODETYPE_MASK 0x000000ff 175*c2c66affSColin Finck #define FUNCTION_GROUP_UNSOLCAPABLE_MASK 0x00000100 176*c2c66affSColin Finck 177*c2c66affSColin Finck #define FUNCTION_GROUP_NODETYPE_AUDIO 0x00000001 178*c2c66affSColin Finck #define FUNCTION_GROUP_NODETYPE_MODEM 0x00000002 179*c2c66affSColin Finck 180*c2c66affSColin Finck /* Audio Function group capabilities */ 181*c2c66affSColin Finck #define AUDIO_GROUP_CAP_OUTPUT_DELAY_MASK 0x0000000f 182*c2c66affSColin Finck #define AUDIO_GROUP_CAP_OUTPUT_DELAY_SHIFT 0 183*c2c66affSColin Finck #define AUDIO_GROUP_CAP_INPUT_DELAY_MASK 0x00000f00 184*c2c66affSColin Finck #define AUDIO_GROUP_CAP_INPUT_DELAY_SHIFT 8 185*c2c66affSColin Finck #define AUDIO_GROUP_CAP_BEEPGEN_MASK 0x00010000 186*c2c66affSColin Finck #define AUDIO_GROUP_CAP_BEEPGEN_SHIFT 16 187*c2c66affSColin Finck 188*c2c66affSColin Finck #define AUDIO_GROUP_CAP_OUTPUT_DELAY(c) ((c & AUDIO_GROUP_CAP_OUTPUT_DELAY_MASK) \ 189*c2c66affSColin Finck >> AUDIO_GROUP_CAP_OUTPUT_DELAY_SHIFT) 190*c2c66affSColin Finck #define AUDIO_GROUP_CAP_INPUT_DELAY(c) ((c & AUDIO_GROUP_CAP_INPUT_DELAY_MASK) \ 191*c2c66affSColin Finck >> AUDIO_GROUP_CAP_INPUT_DELAY_SHIFT) 192*c2c66affSColin Finck #define AUDIO_GROUP_CAP_BEEPGEN(c) ((c & AUDIO_GROUP_CAP_BEEPGEN_MASK) \ 193*c2c66affSColin Finck >> AUDIO_GROUP_CAP_BEEPGEN_SHIFT) 194*c2c66affSColin Finck 195*c2c66affSColin Finck 196*c2c66affSColin Finck /* Audio widget capabilities */ 197*c2c66affSColin Finck #define AUDIO_CAP_CHANNEL_COUNT_MASK 0x0000e000 198*c2c66affSColin Finck #define AUDIO_CAP_CHANNEL_COUNT_SHIFT 13 199*c2c66affSColin Finck #define AUDIO_CAP_DELAY_MASK 0x000f0000 200*c2c66affSColin Finck #define AUDIO_CAP_DELAY_SHIFT 16 201*c2c66affSColin Finck #define AUDIO_CAP_TYPE_MASK 0x00f00000 202*c2c66affSColin Finck #define AUDIO_CAP_TYPE_SHIFT 20 203*c2c66affSColin Finck 204*c2c66affSColin Finck #define AUDIO_CAP_STEREO (1L << 0) 205*c2c66affSColin Finck #define AUDIO_CAP_INPUT_AMPLIFIER (1L << 1) 206*c2c66affSColin Finck #define AUDIO_CAP_OUTPUT_AMPLIFIER (1L << 2) 207*c2c66affSColin Finck #define AUDIO_CAP_AMPLIFIER_OVERRIDE (1L << 3) 208*c2c66affSColin Finck #define AUDIO_CAP_FORMAT_OVERRIDE (1L << 4) 209*c2c66affSColin Finck #define AUDIO_CAP_STRIPE (1L << 5) 210*c2c66affSColin Finck #define AUDIO_CAP_PROCESSING_CONTROLS (1L << 6) 211*c2c66affSColin Finck #define AUDIO_CAP_UNSOLICITED_RESPONSES (1L << 7) 212*c2c66affSColin Finck #define AUDIO_CAP_CONNECTION_LIST (1L << 8) 213*c2c66affSColin Finck #define AUDIO_CAP_DIGITAL (1L << 9) 214*c2c66affSColin Finck #define AUDIO_CAP_POWER_CONTROL (1L << 10) 215*c2c66affSColin Finck #define AUDIO_CAP_LEFT_RIGHT_SWAP (1L << 11) 216*c2c66affSColin Finck #define AUDIO_CAP_CP_CAPS (1L << 12) 217*c2c66affSColin Finck 218*c2c66affSColin Finck #define AUDIO_CAP_CHANNEL_COUNT(c) \ 219*c2c66affSColin Finck (((c & AUDIO_CAP_CHANNEL_COUNT_MASK) >> (AUDIO_CAP_CHANNEL_COUNT_SHIFT - 1)) \ 220*c2c66affSColin Finck | AUDIO_CAP_STEREO) 221*c2c66affSColin Finck 222*c2c66affSColin Finck /* Amplifier capabilities */ 223*c2c66affSColin Finck #define AMP_CAP_MUTE 0xf0000000 224*c2c66affSColin Finck #define AMP_CAP_STEP_SIZE_MASK 0x007f0000 225*c2c66affSColin Finck #define AMP_CAP_STEP_SIZE_SHIFT 16 226*c2c66affSColin Finck #define AMP_CAP_NUM_STEPS_MASK 0x00007f00 227*c2c66affSColin Finck #define AMP_CAP_NUM_STEPS_SHIFT 8 228*c2c66affSColin Finck #define AMP_CAP_OFFSET_MASK 0x0000007f 229*c2c66affSColin Finck 230*c2c66affSColin Finck #define AMP_CAP_STEP_SIZE(c) ((((c & AMP_CAP_STEP_SIZE_MASK) \ 231*c2c66affSColin Finck >> AMP_CAP_STEP_SIZE_SHIFT) + 1) / 4.0) 232*c2c66affSColin Finck #define AMP_CAP_NUM_STEPS(c) ((c & AMP_CAP_NUM_STEPS_MASK) \ 233*c2c66affSColin Finck >> AMP_CAP_NUM_STEPS_SHIFT) 234*c2c66affSColin Finck #define AMP_CAP_OFFSET(c) (c & AMP_CAP_OFFSET_MASK) 235*c2c66affSColin Finck 236*c2c66affSColin Finck /* Pin capabilities */ 237*c2c66affSColin Finck #define PIN_CAP_IMP_SENSE (1L << 0) 238*c2c66affSColin Finck #define PIN_CAP_TRIGGER_REQ (1L << 1) 239*c2c66affSColin Finck #define PIN_CAP_PRES_DETECT (1L << 2) 240*c2c66affSColin Finck #define PIN_CAP_HP_DRIVE (1L << 3) 241*c2c66affSColin Finck #define PIN_CAP_OUTPUT (1L << 4) 242*c2c66affSColin Finck #define PIN_CAP_INPUT (1L << 5) 243*c2c66affSColin Finck #define PIN_CAP_BALANCE (1L << 6) 244*c2c66affSColin Finck #define PIN_CAP_HDMI (1L << 7) 245*c2c66affSColin Finck #define PIN_CAP_VREF_CTRL_HIZ (1L << 8) 246*c2c66affSColin Finck #define PIN_CAP_VREF_CTRL_50 (1L << 9) 247*c2c66affSColin Finck #define PIN_CAP_VREF_CTRL_GROUND (1L << 10) 248*c2c66affSColin Finck #define PIN_CAP_VREF_CTRL_80 (1L << 12) 249*c2c66affSColin Finck #define PIN_CAP_VREF_CTRL_100 (1L << 13) 250*c2c66affSColin Finck #define PIN_CAP_EAPD_CAP (1L << 16) 251*c2c66affSColin Finck #define PIN_CAP_DP (1L << 24) 252*c2c66affSColin Finck #define PIN_CAP_HBR (1L << 27) 253*c2c66affSColin Finck 254*c2c66affSColin Finck #define PIN_CAP_IS_PRES_DETECT_CAP(c) ((c & PIN_CAP_PRES_DETECT) != 0) 255*c2c66affSColin Finck #define PIN_CAP_IS_OUTPUT(c) ((c & PIN_CAP_OUTPUT) != 0) 256*c2c66affSColin Finck #define PIN_CAP_IS_INPUT(c) ((c & PIN_CAP_INPUT) != 0) 257*c2c66affSColin Finck #define PIN_CAP_IS_BALANCE(c) ((c & PIN_CAP_BALANCE) != 0) 258*c2c66affSColin Finck #define PIN_CAP_IS_HDMI(c) ((c & PIN_CAP_HDMI) != 0) 259*c2c66affSColin Finck #define PIN_CAP_IS_VREF_CTRL_50_CAP(c) ((c & PIN_CAP_VREF_CTRL_50) != 0) 260*c2c66affSColin Finck #define PIN_CAP_IS_VREF_CTRL_80_CAP(c) ((c & PIN_CAP_VREF_CTRL_80) != 0) 261*c2c66affSColin Finck #define PIN_CAP_IS_VREF_CTRL_100_CAP(c) ((c & PIN_CAP_VREF_CTRL_100) != 0) 262*c2c66affSColin Finck #define PIN_CAP_IS_EAPD_CAP(c) ((c & PIN_CAP_EAPD_CAP) != 0) 263*c2c66affSColin Finck #define PIN_CAP_IS_DP(c) ((c & PIN_CAP_DP) != 0) 264*c2c66affSColin Finck #define PIN_CAP_IS_HBR(c) ((c & PIN_CAP_HBR) != 0) 265*c2c66affSColin Finck 266*c2c66affSColin Finck /* PCM support */ 267*c2c66affSColin Finck #define PCM_8_BIT (1L << 16) 268*c2c66affSColin Finck #define PCM_16_BIT (1L << 17) 269*c2c66affSColin Finck #define PCM_20_BIT (1L << 18) 270*c2c66affSColin Finck #define PCM_24_BIT (1L << 19) 271*c2c66affSColin Finck #define PCM_32_BIT (1L << 20) 272*c2c66affSColin Finck 273*c2c66affSColin Finck /* stream support */ 274*c2c66affSColin Finck #define STREAM_AC3 0x00000004 275*c2c66affSColin Finck #define STREAM_FLOAT 0x00000002 276*c2c66affSColin Finck #define STREAM_PCM 0x00000001 277*c2c66affSColin Finck 278*c2c66affSColin Finck /* Amplifier Gain/Mute */ 279*c2c66affSColin Finck #define AMP_GET_OUTPUT (1L << 15) 280*c2c66affSColin Finck #define AMP_GET_INPUT (0L << 15) 281*c2c66affSColin Finck #define AMP_GET_LEFT_CHANNEL (1L << 13) 282*c2c66affSColin Finck #define AMP_GET_RIGHT_CHANNEL (0L << 13) 283*c2c66affSColin Finck #define AMP_GET_INPUT_INDEX_MASK 0x0000000f 284*c2c66affSColin Finck #define AMP_GET_INPUT_INDEX_SHIFT 0 285*c2c66affSColin Finck 286*c2c66affSColin Finck #define AMP_GET_INPUT_INDEX(x) ((x << AMP_GET_INPUT_INDEX_SHIFT) & AMP_GET_INPUT_INDEX_MASK) 287*c2c66affSColin Finck 288*c2c66affSColin Finck #define AMP_SET_OUTPUT (1L << 15) 289*c2c66affSColin Finck #define AMP_SET_INPUT (1L << 14) 290*c2c66affSColin Finck #define AMP_SET_LEFT_CHANNEL (1L << 13) 291*c2c66affSColin Finck #define AMP_SET_RIGHT_CHANNEL (1L << 12) 292*c2c66affSColin Finck #define AMP_SET_INPUT_INDEX_MASK 0x00000f00 293*c2c66affSColin Finck #define AMP_SET_INPUT_INDEX_SHIFT 8 294*c2c66affSColin Finck 295*c2c66affSColin Finck #define AMP_SET_INPUT_INDEX(x) ((x << AMP_SET_INPUT_INDEX_SHIFT) & AMP_SET_INPUT_INDEX_MASK) 296*c2c66affSColin Finck 297*c2c66affSColin Finck #define AMP_GAIN_MASK 0x0000007f 298*c2c66affSColin Finck #define AMP_MUTE (1L << 7) 299*c2c66affSColin Finck 300*c2c66affSColin Finck /* Pin Widget Control */ 301*c2c66affSColin Finck #define PIN_ENABLE_HEAD_PHONE (1L << 7) 302*c2c66affSColin Finck #define PIN_ENABLE_OUTPUT (1L << 6) 303*c2c66affSColin Finck #define PIN_ENABLE_INPUT (1L << 5) 304*c2c66affSColin Finck #define PIN_ENABLE_VREF_HIZ 0 305*c2c66affSColin Finck #define PIN_ENABLE_VREF_50 1 306*c2c66affSColin Finck #define PIN_ENABLE_VREF_GROUND 2 307*c2c66affSColin Finck #define PIN_ENABLE_VREF_80 4 308*c2c66affSColin Finck #define PIN_ENABLE_VREF_100 5 309*c2c66affSColin Finck 310*c2c66affSColin Finck /* Unsolicited Response */ 311*c2c66affSColin Finck #define UNSOLRESP_ENABLE (1L << 7) 312*c2c66affSColin Finck #define UNSOLRESP_TAG_MASK 0x0000003f 313*c2c66affSColin Finck #define UNSOLRESP_TAG_SHIFT 0 314*c2c66affSColin Finck 315*c2c66affSColin Finck /* Pin sense */ 316*c2c66affSColin Finck #define PIN_SENSE_PRESENCE_DETECT (1L << 31) 317*c2c66affSColin Finck #define PIN_SENSE_ELD_VALID (1L << 30) 318*c2c66affSColin Finck #define PIN_SENSE_IMPEDANCE_MASK 0x7fffffff 319*c2c66affSColin Finck #define PIN_SENSE_IMPEDANCE_SHIFT 0 320*c2c66affSColin Finck 321*c2c66affSColin Finck #define PIN_SENSE_IMPEDANCE_INVALID 0x7fffffff 322*c2c66affSColin Finck #define PIN_SENSE_SET_CHANNEL_LEFT 0 323*c2c66affSColin Finck #define PIN_SENSE_SET_CHANNEL_RIGHT 1 324*c2c66affSColin Finck 325*c2c66affSColin Finck /* Supported power states */ 326*c2c66affSColin Finck #define POWER_STATE_D0 (1L << 0) 327*c2c66affSColin Finck #define POWER_STATE_D1 (1L << 1) 328*c2c66affSColin Finck #define POWER_STATE_D2 (1L << 2) 329*c2c66affSColin Finck #define POWER_STATE_D3 (1L << 3) 330*c2c66affSColin Finck #define POWER_STATE_D3COLD (1L << 4) 331*c2c66affSColin Finck #define POWER_STATE_S3D3COLD (1L << 29) 332*c2c66affSColin Finck #define POWER_STATE_CLKSTOP (1L << 30) 333*c2c66affSColin Finck #define POWER_STATE_EPSS (1L << 31) 334*c2c66affSColin Finck 335*c2c66affSColin Finck /* Configuration default */ 336*c2c66affSColin Finck #define CONF_DEFAULT_SEQUENCE_MASK 0x0000000f 337*c2c66affSColin Finck #define CONF_DEFAULT_SEQUENCE_SHIFT 0 338*c2c66affSColin Finck #define CONF_DEFAULT_ASSOCIATION_MASK 0x000000f0 339*c2c66affSColin Finck #define CONF_DEFAULT_ASSOCIATION_SHIFT 4 340*c2c66affSColin Finck #define CONF_DEFAULT_MISC_MASK 0x00000f00 341*c2c66affSColin Finck #define CONF_DEFAULT_MISC_SHIFT 8 342*c2c66affSColin Finck #define CONF_DEFAULT_COLOR_MASK 0x0000f000 343*c2c66affSColin Finck #define CONF_DEFAULT_COLOR_SHIFT 12 344*c2c66affSColin Finck #define CONF_DEFAULT_CONNTYPE_MASK 0x000f0000 345*c2c66affSColin Finck #define CONF_DEFAULT_CONNTYPE_SHIFT 16 346*c2c66affSColin Finck #define CONF_DEFAULT_DEVICE_MASK 0x00f00000 347*c2c66affSColin Finck #define CONF_DEFAULT_DEVICE_SHIFT 20 348*c2c66affSColin Finck #define CONF_DEFAULT_LOCATION_MASK 0x3f000000 349*c2c66affSColin Finck #define CONF_DEFAULT_LOCATION_SHIFT 24 350*c2c66affSColin Finck #define CONF_DEFAULT_CONNECTIVITY_MASK 0xc0000000 351*c2c66affSColin Finck #define CONF_DEFAULT_CONNECTIVITY_SHIFT 30 352*c2c66affSColin Finck 353*c2c66affSColin Finck #define CONF_DEFAULT_SEQUENCE(c) ((c & CONF_DEFAULT_SEQUENCE_MASK) >> CONF_DEFAULT_SEQUENCE_SHIFT) 354*c2c66affSColin Finck #define CONF_DEFAULT_ASSOCIATION(c) ((c & CONF_DEFAULT_ASSOCIATION_MASK) >> CONF_DEFAULT_ASSOCIATION_SHIFT) 355*c2c66affSColin Finck #define CONF_DEFAULT_MISC(c) ((c & CONF_DEFAULT_MISC_MASK) >> CONF_DEFAULT_MISC_SHIFT) 356*c2c66affSColin Finck #define CONF_DEFAULT_COLOR(c) ((c & CONF_DEFAULT_COLOR_MASK) >> CONF_DEFAULT_COLOR_SHIFT) 357*c2c66affSColin Finck #define CONF_DEFAULT_CONNTYPE(c) ((c & CONF_DEFAULT_CONNTYPE_MASK) >> CONF_DEFAULT_CONNTYPE_SHIFT) 358*c2c66affSColin Finck #define CONF_DEFAULT_DEVICE(c) ((c & CONF_DEFAULT_DEVICE_MASK) >> CONF_DEFAULT_DEVICE_SHIFT) 359*c2c66affSColin Finck #define CONF_DEFAULT_LOCATION(c) ((c & CONF_DEFAULT_LOCATION_MASK) >> CONF_DEFAULT_LOCATION_SHIFT) 360*c2c66affSColin Finck #define CONF_DEFAULT_CONNECTIVITY(c) ((c & CONF_DEFAULT_CONNECTIVITY_MASK) >> CONF_DEFAULT_CONNECTIVITY_SHIFT) 361*c2c66affSColin Finck 362*c2c66affSColin Finck /* EAPD/BTL enable */ 363*c2c66affSColin Finck #define EAPDBTL_ENABLE_BTL 0x1 364*c2c66affSColin Finck #define EAPDBTL_ENABLE_EAPD 0x2 365*c2c66affSColin Finck #define EAPDBTL_ENABLE_LRSWAP 0x4 366*c2c66affSColin Finck 367*c2c66affSColin Finck /* GP I/O count */ 368*c2c66affSColin Finck #define GPIO_COUNT_NUM_GPIO_MASK 0x000000ff 369*c2c66affSColin Finck #define GPIO_COUNT_NUM_GPIO_SHIFT 0 370*c2c66affSColin Finck #define GPIO_COUNT_NUM_GPO_MASK 0x0000ff00 371*c2c66affSColin Finck #define GPIO_COUNT_NUM_GPO_SHIFT 8 372*c2c66affSColin Finck #define GPIO_COUNT_NUM_GPI_MASK 0x00ff0000 373*c2c66affSColin Finck #define GPIO_COUNT_NUM_GPI_SHIFT 16 374*c2c66affSColin Finck #define GPIO_COUNT_GPIUNSOL_MASK 0x40000000 375*c2c66affSColin Finck #define GPIO_COUNT_GPIUNSOL_SHIFT 30 376*c2c66affSColin Finck #define GPIO_COUNT_GPIWAKE_MASK 0x80000000 377*c2c66affSColin Finck #define GPIO_COUNT_GPIWAKE_SHIFT 31 378*c2c66affSColin Finck 379*c2c66affSColin Finck #define GPIO_COUNT_NUM_GPIO(c) ((c & GPIO_COUNT_NUM_GPIO_MASK) >> GPIO_COUNT_NUM_GPIO_SHIFT) 380*c2c66affSColin Finck #define GPIO_COUNT_NUM_GPO(c) ((c & GPIO_COUNT_NUM_GPO_MASK) >> GPIO_COUNT_NUM_GPO_SHIFT) 381*c2c66affSColin Finck #define GPIO_COUNT_NUM_GPI(c) ((c & GPIO_COUNT_NUM_GPI_MASK) >> GPIO_COUNT_NUM_GPI_SHIFT) 382*c2c66affSColin Finck #define GPIO_COUNT_GPIUNSOL(c) ((c & GPIO_COUNT_GPIUNSOL_MASK) >> GPIO_COUNT_GPIUNSOL_SHIFT) 383*c2c66affSColin Finck #define GPIO_COUNT_GPIWAKE(c) ((c & GPIO_COUNT_GPIWAKE_MASK) >> GPIO_COUNT_GPIWAKE_SHIFT) 384*c2c66affSColin Finck 385*c2c66affSColin Finck 386*c2c66affSColin Finck #endif /* HDA_CODEC_H */ 387