1 /* 2 * Copyright 2007-2008, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ithamar Adema, ithamar AT unet DOT nl 7 * Axel Dörfler, axeld@pinc-software.de 8 */ 9 #ifndef HDA_CODEC_H 10 #define HDA_CODEC_H 11 12 enum hda_widget_type { 13 WT_AUDIO_OUTPUT = 0, 14 WT_AUDIO_INPUT = 1, 15 WT_AUDIO_MIXER = 2, 16 WT_AUDIO_SELECTOR = 3, 17 WT_PIN_COMPLEX = 4, 18 WT_POWER = 5, 19 WT_VOLUME_KNOB = 6, 20 WT_BEEP_GENERATOR = 7, 21 WT_VENDOR_DEFINED = 15 22 }; 23 24 25 enum pin_dev_type { 26 PIN_DEV_LINE_OUT = 0, 27 PIN_DEV_SPEAKER, 28 PIN_DEV_HEAD_PHONE_OUT, 29 PIN_DEV_CD, 30 PIN_DEV_SPDIF_OUT, 31 PIN_DEV_DIGITAL_OTHER_OUT, 32 PIN_DEV_MODEM_LINE_SIDE, 33 PIN_DEV_MODEM_HAND_SIDE, 34 PIN_DEV_LINE_IN, 35 PIN_DEV_AUX, 36 PIN_DEV_MIC_IN, 37 PIN_DEV_TELEPHONY, 38 PIN_DEV_SPDIF_IN, 39 PIN_DEV_DIGITAL_OTHER_IN, 40 PIN_DEV_RESERVED, 41 PIN_DEV_OTHER 42 }; 43 44 45 /* Verb Helper Macro */ 46 #define MAKE_VERB(cad, nid, vid, payload) \ 47 (((cad) << 28) | ((nid) << 20) | (vid) | (payload)) 48 49 /* Verb IDs */ 50 #define VID_GET_PARAMETER 0xf0000 51 #define VID_GET_CONNECTION_SELECT 0xf0100 52 #define VID_SET_CONNECTION_SELECT 0x70100 53 #define VID_GET_CONNECTION_LIST_ENTRY 0xf0200 54 #define VID_GET_PROCESSING_STATE 0xf0300 55 #define VID_SET_PROCESSING_STATE 0x70300 56 #define VID_GET_COEFFICIENT_INDEX 0xd0000 57 #define VID_SET_COEFFICIENT_INDEX 0x50000 58 #define VID_GET_PROCESSING_COEFFICIENT 0xc0000 59 #define VID_SET_PROCESSING_COEFFICIENT 0x40000 60 #define VID_GET_AMPLIFIER_GAIN_MUTE 0xb0000 61 #define VID_SET_AMPLIFIER_GAIN_MUTE 0x30000 62 #define VID_GET_CONVERTER_FORMAT 0xa0000 63 #define VID_SET_CONVERTER_FORMAT 0x20000 64 #define VID_GET_CONVERTER_STREAM_CHANNEL 0xf0600 65 #define VID_SET_CONVERTER_STREAM_CHANNEL 0x70600 66 #define VID_GET_DIGITAL_CONVERTER_CONTROL 0xf0d00 67 #define VID_SET_DIGITAL_CONVERTER_CONTROL1 0x70d00 68 #define VID_SET_DIGITAL_CONVERTER_CONTROL2 0x70e00 69 #define VID_GET_POWER_STATE 0xf0500 70 #define VID_SET_POWER_STATE 0x70500 71 #define VID_GET_SDI_SELECT 0xf0400 72 #define VID_SET_SDI_SELECT 0x70400 73 #define VID_GET_PIN_WIDGET_CONTROL 0xf0700 74 #define VID_SET_PIN_WIDGET_CONTROL 0x70700 75 #define VID_GET_UNSOLRESP 0xF0800 76 #define VID_SET_UNSOLRESP 0x70800 77 #define VID_GET_PINSENSE 0xF0900 78 #define VID_SET_PINSENSE 0x70900 79 #define VID_GET_EAPDBTL_EN 0xF0C00 80 #define VID_SET_EAPDBTL_EN 0x70C00 81 #define VID_GET_GPIDATA 0xF1000 82 #define VID_SET_GPIDATA 0x71000 83 #define VID_GET_GPIWAKE_EN 0xF1100 84 #define VID_SET_GPIWAKE_EN 0x71100 85 #define VID_GET_GPIUNSOL 0xF1200 86 #define VID_SET_GPIUNSOL 0x71200 87 #define VID_GET_GPISTICKY 0xF1300 88 #define VID_SET_GPISTICKY 0x71300 89 #define VID_GET_GPODATA 0xF1400 90 #define VID_SET_GPODATA 0x71400 91 #define VID_GET_GPIODATA 0xF1500 92 #define VID_SET_GPIODATA 0x71500 93 #define VID_GET_GPIO_EN 0xF1600 94 #define VID_SET_GPIO_EN 0x71600 95 #define VID_GET_GPIO_DIR 0xF1700 96 #define VID_SET_GPIO_DIR 0x71700 97 #define VID_GET_GPIOWAKE_EN 0xF1800 98 #define VID_SET_GPIOWAKE_EN 0x71800 99 #define VID_GET_GPIOUNSOL_EN 0xF1900 100 #define VID_SET_GPIOUNSOL_EN 0x71900 101 #define VID_GET_GPIOSTICKY 0xF1A00 102 #define VID_SET_GPIOSTICKY 0x71A00 103 #define VID_GET_BEEPGEN 0xF0A00 104 #define VID_SET_BEEPGEN 0x70A00 105 #define VID_GET_VOLUME_KNOB 0xf0f00 106 #define VID_SET_VOLUME_KNOB 0x70f00 107 #define VID_GET_SUBSYSTEMID 0xF2000 108 #define VID_SET_SUBSYSTEMID1 0x72000 109 #define VID_SET_SUBSYSTEMID2 0x72100 110 #define VID_SET_SUBSYSTEMID3 0x72200 111 #define VID_SET_SUBSYSTEMID4 0x72300 112 #define VID_GET_CONFIGURATION_DEFAULT 0xf1c00 113 #define VID_SET_CONFIGURATION_DEFAULT1 0x71c00 114 #define VID_SET_CONFIGURATION_DEFAULT2 0x71d00 115 #define VID_SET_CONFIGURATION_DEFAULT3 0x71e00 116 #define VID_SET_CONFIGURATION_DEFAULT4 0x71f00 117 #define VID_GET_STRIPE_CONTROL 0xf2400 118 #define VID_SET_STRIPE_CONTROL 0x72000 119 #define VID_FUNCTION_RESET 0x7ff00 120 121 /* Parameter IDs */ 122 #define PID_VENDOR_ID 0x00 123 #define PID_REVISION_ID 0x02 124 #define PID_SUB_NODE_COUNT 0x04 125 #define PID_FUNCTION_GROUP_TYPE 0x05 126 #define PID_AUDIO_GROUP_CAP 0x08 127 #define PID_AUDIO_WIDGET_CAP 0x09 128 #define PID_PCM_SUPPORT 0x0a 129 #define PID_STREAM_SUPPORT 0x0b 130 #define PID_PIN_CAP 0x0c 131 #define PID_INPUT_AMPLIFIER_CAP 0x0d 132 #define PID_CONNECTION_LIST_LENGTH 0x0e 133 #define PID_POWERSTATE_SUPPORT 0x0f 134 #define PID_PROCESSING_CAP 0x10 135 #define PID_GPIO_COUNT 0x11 136 #define PID_OUTPUT_AMPLIFIER_CAP 0x12 137 #define PID_VOLUME_KNOB_CAP 0x13 138 139 /* Audio widget capabilities */ 140 #define AUDIO_CAP_DELAY_MASK 0x000f0000 141 #define AUDIO_CAP_DELAY_SHIFT 16 142 #define AUDIO_CAP_TYPE_MASK 0x00f00000 143 #define AUDIO_CAP_TYPE_SHIFT 20 144 145 #define AUDIO_CAP_STEREO (1L << 0) 146 #define AUDIO_CAP_INPUT_AMPLIFIER (1L << 1) 147 #define AUDIO_CAP_OUTPUT_AMPLIFIER (1L << 2) 148 #define AUDIO_CAP_AMPLIFIER_OVERRIDE (1L << 3) 149 #define AUDIO_CAP_FORMAT_OVERRIDE (1L << 4) 150 #define AUDIO_CAP_STRIPE (1L << 5) 151 #define AUDIO_CAP_PROCESSING_CONTROLS (1L << 6) 152 #define AUDIO_CAP_UNSOLICITED_RESPONSES (1L << 7) 153 #define AUDIO_CAP_CONNECTION_LIST (1L << 8) 154 #define AUDIO_CAP_DIGITAL (1L << 9) 155 #define AUDIO_CAP_POWER_CONTROL (1L << 10) 156 #define AUDIO_CAP_LEFT_RIGHT_SWAP (1L << 11) 157 158 /* Amplifier capabilities */ 159 #define AMP_CAP_MUTE 0xf0000000 160 #define AMP_CAP_STEP_SIZE_MASK 0x007f0000 161 #define AMP_CAP_STEP_SIZE_SHIFT 16 162 #define AMP_CAP_NUM_STEPS_MASK 0x00007f00 163 #define AMP_CAP_NUM_STEPS_SHIFT 8 164 #define AMP_CAP_OFFSET_MASK 0x0000007f 165 166 /* PCM support */ 167 #define PCM_8_BIT (1L << 16) 168 #define PCM_16_BIT (1L << 17) 169 #define PCM_20_BIT (1L << 18) 170 #define PCM_24_BIT (1L << 19) 171 #define PCM_32_BIT (1L << 20) 172 173 /* stream support */ 174 #define STREAM_AC3 0x00000004 175 #define STREAM_FLOAT 0x00000002 176 #define STREAM_PCM 0x00000001 177 178 /* Amplifier Gain/Mute */ 179 #define AMP_GET_OUTPUT (1L << 15) 180 #define AMP_GET_INPUT (0L << 15) 181 #define AMP_GET_LEFT_CHANNEL (1L << 13) 182 #define AMP_GET_RIGHT_CHANNEL (0L << 13) 183 #define AMP_GET_INPUT_INDEX_MASK 0x0000000f 184 #define AMP_GET_INPUT_INDEX_SHIFT 0 185 186 #define AMP_SET_OUTPUT (1L << 15) 187 #define AMP_SET_INPUT (1L << 14) 188 #define AMP_SET_LEFT_CHANNEL (1L << 13) 189 #define AMP_SET_RIGHT_CHANNEL (1L << 12) 190 #define AMP_SET_INPUT_INDEX_MASK 0x00000f00 191 #define AMP_SET_INPUT_INDEX_SHIFT 8 192 193 #define AMP_GAIN_MASK 0x0000007f 194 #define AMP_MUTE (1L << 8) 195 196 /* Pin Widget Control */ 197 #define PIN_ENABLE_HEAD_PHONE (1L << 7) 198 #define PIN_ENABLE_OUTPUT (1L << 6) 199 #define PIN_ENABLE_INPUT (1L << 5) 200 #define PIN_ENABLE_VOLTAGE_REF_MASK 0x3 201 202 #endif /* HDA_CODEC_H */ 203