Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for SigmaTel STAC92xx |
| 5 | * |
| 6 | * Copyright (c) 2005 Embedded Alley Solutions, Inc. |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 7 | * Matt Porter <mporter@embeddedalley.com> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 8 | * |
| 9 | * Based on patch_cmedia.c and patch_realtek.c |
| 10 | * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de> |
| 11 | * |
| 12 | * This driver is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This driver is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | */ |
| 26 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 27 | #include <linux/init.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/slab.h> |
| 30 | #include <linux/pci.h> |
| 31 | #include <sound/core.h> |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 32 | #include <sound/asoundef.h> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 33 | #include "hda_codec.h" |
| 34 | #include "hda_local.h" |
Harvey Harrison | 3c9a320 | 2008-02-29 11:59:26 +0100 | [diff] [blame] | 35 | #include "hda_patch.h" |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 36 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 37 | #define NUM_CONTROL_ALLOC 32 |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 38 | #define STAC_PWR_EVENT 0x20 |
| 39 | #define STAC_HP_EVENT 0x30 |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 40 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 41 | enum { |
| 42 | STAC_REF, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 43 | STAC_9200_OQO, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 44 | STAC_9200_DELL_D21, |
| 45 | STAC_9200_DELL_D22, |
| 46 | STAC_9200_DELL_D23, |
| 47 | STAC_9200_DELL_M21, |
| 48 | STAC_9200_DELL_M22, |
| 49 | STAC_9200_DELL_M23, |
| 50 | STAC_9200_DELL_M24, |
| 51 | STAC_9200_DELL_M25, |
| 52 | STAC_9200_DELL_M26, |
| 53 | STAC_9200_DELL_M27, |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 54 | STAC_9200_GATEWAY, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 55 | STAC_9200_PANASONIC, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 56 | STAC_9200_MODELS |
| 57 | }; |
| 58 | |
| 59 | enum { |
| 60 | STAC_9205_REF, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 61 | STAC_9205_DELL_M42, |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 62 | STAC_9205_DELL_M43, |
| 63 | STAC_9205_DELL_M44, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 64 | STAC_9205_MODELS |
| 65 | }; |
| 66 | |
| 67 | enum { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 68 | STAC_92HD73XX_REF, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 69 | STAC_DELL_M6, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 70 | STAC_92HD73XX_MODELS |
| 71 | }; |
| 72 | |
| 73 | enum { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 74 | STAC_92HD71BXX_REF, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 75 | STAC_DELL_M4_1, |
| 76 | STAC_DELL_M4_2, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 77 | STAC_92HD71BXX_MODELS |
| 78 | }; |
| 79 | |
| 80 | enum { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 81 | STAC_925x_REF, |
| 82 | STAC_M2_2, |
| 83 | STAC_MA6, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 84 | STAC_PA6, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 85 | STAC_925x_MODELS |
| 86 | }; |
| 87 | |
| 88 | enum { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 89 | STAC_D945_REF, |
| 90 | STAC_D945GTP3, |
| 91 | STAC_D945GTP5, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 92 | STAC_INTEL_MAC_V1, |
| 93 | STAC_INTEL_MAC_V2, |
| 94 | STAC_INTEL_MAC_V3, |
| 95 | STAC_INTEL_MAC_V4, |
| 96 | STAC_INTEL_MAC_V5, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 97 | STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter |
| 98 | * is given, one of the above models will be |
| 99 | * chosen according to the subsystem id. */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 100 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 101 | STAC_MACMINI, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 102 | STAC_MACBOOK, |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 103 | STAC_MACBOOK_PRO_V1, |
| 104 | STAC_MACBOOK_PRO_V2, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 105 | STAC_IMAC_INTEL, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 106 | STAC_IMAC_INTEL_20, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 107 | STAC_922X_DELL_D81, |
| 108 | STAC_922X_DELL_D82, |
| 109 | STAC_922X_DELL_M81, |
| 110 | STAC_922X_DELL_M82, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 111 | STAC_922X_MODELS |
| 112 | }; |
| 113 | |
| 114 | enum { |
| 115 | STAC_D965_REF, |
| 116 | STAC_D965_3ST, |
| 117 | STAC_D965_5ST, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 118 | STAC_DELL_3ST, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 119 | STAC_DELL_BIOS, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 120 | STAC_927X_MODELS |
| 121 | }; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 122 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 123 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 124 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 125 | unsigned int num_mixers; |
| 126 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 127 | int board_config; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 128 | unsigned int surr_switch: 1; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 129 | unsigned int line_switch: 1; |
| 130 | unsigned int mic_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 131 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 132 | unsigned int hp_detect: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 133 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 134 | /* gpio lines */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 135 | unsigned int eapd_mask; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 136 | unsigned int gpio_mask; |
| 137 | unsigned int gpio_dir; |
| 138 | unsigned int gpio_data; |
| 139 | unsigned int gpio_mute; |
| 140 | |
| 141 | /* analog loopback */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 142 | unsigned char aloopback_mask; |
| 143 | unsigned char aloopback_shift; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 144 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 145 | /* power management */ |
| 146 | unsigned int num_pwrs; |
| 147 | hda_nid_t *pwr_nids; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 148 | hda_nid_t *dac_list; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 149 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 150 | /* playback */ |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 151 | struct hda_input_mux *mono_mux; |
| 152 | unsigned int cur_mmux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 153 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 154 | hda_nid_t dac_nids[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 155 | |
| 156 | /* capture */ |
| 157 | hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 158 | unsigned int num_adcs; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 159 | hda_nid_t *mux_nids; |
| 160 | unsigned int num_muxes; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 161 | hda_nid_t *dmic_nids; |
| 162 | unsigned int num_dmics; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 163 | hda_nid_t *dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 164 | unsigned int num_dmuxes; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 165 | hda_nid_t dig_in_nid; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 166 | hda_nid_t mono_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 167 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 168 | /* pin widgets */ |
| 169 | hda_nid_t *pin_nids; |
| 170 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 171 | unsigned int *pin_configs; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 172 | unsigned int *bios_pin_configs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 173 | |
| 174 | /* codec specific stuff */ |
| 175 | struct hda_verb *init; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 176 | struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 177 | |
| 178 | /* capture source */ |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 179 | struct hda_input_mux *dinput_mux; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 180 | unsigned int cur_dmux[2]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 181 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 182 | unsigned int cur_mux[3]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 183 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 184 | /* i/o switches */ |
| 185 | unsigned int io_switch[2]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 186 | unsigned int clfe_swap; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 187 | unsigned int hp_switch; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 188 | unsigned int aloopback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 189 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 190 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 191 | |
| 192 | /* dynamic controls and input_mux */ |
| 193 | struct auto_pin_cfg autocfg; |
| 194 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 195 | struct snd_kcontrol_new *kctl_alloc; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 196 | struct hda_input_mux private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 197 | struct hda_input_mux private_imux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 198 | struct hda_input_mux private_mono_mux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 199 | }; |
| 200 | |
| 201 | static hda_nid_t stac9200_adc_nids[1] = { |
| 202 | 0x03, |
| 203 | }; |
| 204 | |
| 205 | static hda_nid_t stac9200_mux_nids[1] = { |
| 206 | 0x0c, |
| 207 | }; |
| 208 | |
| 209 | static hda_nid_t stac9200_dac_nids[1] = { |
| 210 | 0x02, |
| 211 | }; |
| 212 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 213 | static hda_nid_t stac92hd73xx_pwr_nids[8] = { |
| 214 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
| 215 | 0x0f, 0x10, 0x11 |
| 216 | }; |
| 217 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 218 | static hda_nid_t stac92hd73xx_adc_nids[2] = { |
| 219 | 0x1a, 0x1b |
| 220 | }; |
| 221 | |
| 222 | #define STAC92HD73XX_NUM_DMICS 2 |
| 223 | static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { |
| 224 | 0x13, 0x14, 0 |
| 225 | }; |
| 226 | |
| 227 | #define STAC92HD73_DAC_COUNT 5 |
| 228 | static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = { |
| 229 | 0x15, 0x16, 0x17, 0x18, 0x19, |
| 230 | }; |
| 231 | |
| 232 | static hda_nid_t stac92hd73xx_mux_nids[4] = { |
| 233 | 0x28, 0x29, 0x2a, 0x2b, |
| 234 | }; |
| 235 | |
| 236 | static hda_nid_t stac92hd73xx_dmux_nids[2] = { |
| 237 | 0x20, 0x21, |
| 238 | }; |
| 239 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 240 | static hda_nid_t stac92hd71bxx_pwr_nids[3] = { |
| 241 | 0x0a, 0x0d, 0x0f |
| 242 | }; |
| 243 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 244 | static hda_nid_t stac92hd71bxx_adc_nids[2] = { |
| 245 | 0x12, 0x13, |
| 246 | }; |
| 247 | |
| 248 | static hda_nid_t stac92hd71bxx_mux_nids[2] = { |
| 249 | 0x1a, 0x1b |
| 250 | }; |
| 251 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 252 | static hda_nid_t stac92hd71bxx_dmux_nids[1] = { |
| 253 | 0x1c, |
| 254 | }; |
| 255 | |
Takashi Iwai | aea7bb0 | 2008-02-25 18:26:41 +0100 | [diff] [blame] | 256 | static hda_nid_t stac92hd71bxx_dac_nids[1] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 257 | 0x10, /*0x11, */ |
| 258 | }; |
| 259 | |
| 260 | #define STAC92HD71BXX_NUM_DMICS 2 |
| 261 | static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = { |
| 262 | 0x18, 0x19, 0 |
| 263 | }; |
| 264 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 265 | static hda_nid_t stac925x_adc_nids[1] = { |
| 266 | 0x03, |
| 267 | }; |
| 268 | |
| 269 | static hda_nid_t stac925x_mux_nids[1] = { |
| 270 | 0x0f, |
| 271 | }; |
| 272 | |
| 273 | static hda_nid_t stac925x_dac_nids[1] = { |
| 274 | 0x02, |
| 275 | }; |
| 276 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 277 | #define STAC925X_NUM_DMICS 1 |
| 278 | static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = { |
| 279 | 0x15, 0 |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 280 | }; |
| 281 | |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 282 | static hda_nid_t stac925x_dmux_nids[1] = { |
| 283 | 0x14, |
| 284 | }; |
| 285 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 286 | static hda_nid_t stac922x_adc_nids[2] = { |
| 287 | 0x06, 0x07, |
| 288 | }; |
| 289 | |
| 290 | static hda_nid_t stac922x_mux_nids[2] = { |
| 291 | 0x12, 0x13, |
| 292 | }; |
| 293 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 294 | static hda_nid_t stac927x_adc_nids[3] = { |
| 295 | 0x07, 0x08, 0x09 |
| 296 | }; |
| 297 | |
| 298 | static hda_nid_t stac927x_mux_nids[3] = { |
| 299 | 0x15, 0x16, 0x17 |
| 300 | }; |
| 301 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 302 | static hda_nid_t stac927x_dac_nids[6] = { |
| 303 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 |
| 304 | }; |
| 305 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 306 | static hda_nid_t stac927x_dmux_nids[1] = { |
| 307 | 0x1b, |
| 308 | }; |
| 309 | |
Matthew Ranostay | 7f16859 | 2007-10-18 17:38:17 +0200 | [diff] [blame] | 310 | #define STAC927X_NUM_DMICS 2 |
| 311 | static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { |
| 312 | 0x13, 0x14, 0 |
| 313 | }; |
| 314 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 315 | static hda_nid_t stac9205_adc_nids[2] = { |
| 316 | 0x12, 0x13 |
| 317 | }; |
| 318 | |
| 319 | static hda_nid_t stac9205_mux_nids[2] = { |
| 320 | 0x19, 0x1a |
| 321 | }; |
| 322 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 323 | static hda_nid_t stac9205_dmux_nids[1] = { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 324 | 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 325 | }; |
| 326 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 327 | #define STAC9205_NUM_DMICS 2 |
| 328 | static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { |
| 329 | 0x17, 0x18, 0 |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 330 | }; |
| 331 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 332 | static hda_nid_t stac9200_pin_nids[8] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 333 | 0x08, 0x09, 0x0d, 0x0e, |
| 334 | 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 335 | }; |
| 336 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 337 | static hda_nid_t stac925x_pin_nids[8] = { |
| 338 | 0x07, 0x08, 0x0a, 0x0b, |
| 339 | 0x0c, 0x0d, 0x10, 0x11, |
| 340 | }; |
| 341 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 342 | static hda_nid_t stac922x_pin_nids[10] = { |
| 343 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 344 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 345 | }; |
| 346 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 347 | static hda_nid_t stac92hd73xx_pin_nids[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 348 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 349 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 350 | 0x14, 0x1e, 0x22 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 351 | }; |
| 352 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 353 | static hda_nid_t stac92hd71bxx_pin_nids[10] = { |
| 354 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 355 | 0x0f, 0x14, 0x18, 0x19, 0x1e, |
| 356 | }; |
| 357 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 358 | static hda_nid_t stac927x_pin_nids[14] = { |
| 359 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 360 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 361 | 0x14, 0x21, 0x22, 0x23, |
| 362 | }; |
| 363 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 364 | static hda_nid_t stac9205_pin_nids[12] = { |
| 365 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 366 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 367 | 0x21, 0x22, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 368 | }; |
| 369 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 370 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
| 371 | struct snd_ctl_elem_info *uinfo) |
| 372 | { |
| 373 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 374 | struct sigmatel_spec *spec = codec->spec; |
| 375 | return snd_hda_input_mux_info(spec->dinput_mux, uinfo); |
| 376 | } |
| 377 | |
| 378 | static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, |
| 379 | struct snd_ctl_elem_value *ucontrol) |
| 380 | { |
| 381 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 382 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 383 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 384 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 385 | ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 386 | return 0; |
| 387 | } |
| 388 | |
| 389 | static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, |
| 390 | struct snd_ctl_elem_value *ucontrol) |
| 391 | { |
| 392 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 393 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 394 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 395 | |
| 396 | return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 397 | spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 398 | } |
| 399 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 400 | static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 401 | { |
| 402 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 403 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 404 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 405 | } |
| 406 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 407 | static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 408 | { |
| 409 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 410 | struct sigmatel_spec *spec = codec->spec; |
| 411 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 412 | |
| 413 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 414 | return 0; |
| 415 | } |
| 416 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 417 | static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 418 | { |
| 419 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 420 | struct sigmatel_spec *spec = codec->spec; |
| 421 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 422 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 423 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 424 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); |
| 425 | } |
| 426 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 427 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 428 | struct snd_ctl_elem_info *uinfo) |
| 429 | { |
| 430 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 431 | struct sigmatel_spec *spec = codec->spec; |
| 432 | return snd_hda_input_mux_info(spec->mono_mux, uinfo); |
| 433 | } |
| 434 | |
| 435 | static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 436 | struct snd_ctl_elem_value *ucontrol) |
| 437 | { |
| 438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 439 | struct sigmatel_spec *spec = codec->spec; |
| 440 | |
| 441 | ucontrol->value.enumerated.item[0] = spec->cur_mmux; |
| 442 | return 0; |
| 443 | } |
| 444 | |
| 445 | static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 446 | struct snd_ctl_elem_value *ucontrol) |
| 447 | { |
| 448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 449 | struct sigmatel_spec *spec = codec->spec; |
| 450 | |
| 451 | return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol, |
| 452 | spec->mono_nid, &spec->cur_mmux); |
| 453 | } |
| 454 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 455 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
| 456 | |
| 457 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
| 458 | struct snd_ctl_elem_value *ucontrol) |
| 459 | { |
| 460 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 461 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 462 | struct sigmatel_spec *spec = codec->spec; |
| 463 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 464 | ucontrol->value.integer.value[0] = !!(spec->aloopback & |
| 465 | (spec->aloopback_mask << idx)); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 466 | return 0; |
| 467 | } |
| 468 | |
| 469 | static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, |
| 470 | struct snd_ctl_elem_value *ucontrol) |
| 471 | { |
| 472 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 473 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 474 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 475 | unsigned int dac_mode; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 476 | unsigned int val, idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 477 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 478 | idx_val = spec->aloopback_mask << idx; |
| 479 | if (ucontrol->value.integer.value[0]) |
| 480 | val = spec->aloopback | idx_val; |
| 481 | else |
| 482 | val = spec->aloopback & ~idx_val; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 483 | if (spec->aloopback == val) |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 484 | return 0; |
| 485 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 486 | spec->aloopback = val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 487 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 488 | /* Only return the bits defined by the shift value of the |
| 489 | * first two bytes of the mask |
| 490 | */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 491 | dac_mode = snd_hda_codec_read(codec, codec->afg, 0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 492 | kcontrol->private_value & 0xFFFF, 0x0); |
| 493 | dac_mode >>= spec->aloopback_shift; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 494 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 495 | if (spec->aloopback & idx_val) { |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 496 | snd_hda_power_up(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 497 | dac_mode |= idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 498 | } else { |
| 499 | snd_hda_power_down(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 500 | dac_mode &= ~idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 504 | kcontrol->private_value >> 16, dac_mode); |
| 505 | |
| 506 | return 1; |
| 507 | } |
| 508 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 509 | static struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 510 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 511 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 512 | {} |
| 513 | }; |
| 514 | |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 515 | static struct hda_verb stac9200_eapd_init[] = { |
| 516 | /* set dac0mux for dac converter */ |
| 517 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 518 | {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 519 | {} |
| 520 | }; |
| 521 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 522 | static struct hda_verb stac92hd73xx_6ch_core_init[] = { |
| 523 | /* set master volume and direct control */ |
| 524 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 525 | /* setup audio connections */ |
| 526 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 527 | { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 528 | { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 529 | /* setup adcs to point to mixer */ |
| 530 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 531 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 532 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 533 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 534 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 535 | /* setup import muxs */ |
| 536 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 537 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 538 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 539 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 540 | {} |
| 541 | }; |
| 542 | |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 543 | static struct hda_verb dell_eq_core_init[] = { |
| 544 | /* set master volume to max value without distortion |
| 545 | * and direct control */ |
| 546 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, |
| 547 | /* setup audio connections */ |
| 548 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 549 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 550 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 551 | /* setup adcs to point to mixer */ |
| 552 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 553 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 554 | /* setup import muxs */ |
| 555 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 556 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 557 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 558 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 559 | {} |
| 560 | }; |
| 561 | |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 562 | static struct hda_verb dell_m6_core_init[] = { |
| 563 | /* set master volume and direct control */ |
| 564 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 565 | /* setup audio connections */ |
Matthew Ranostay | 7747ecc | 2008-03-10 11:30:04 +0100 | [diff] [blame] | 566 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 567 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 568 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 569 | /* setup adcs to point to mixer */ |
| 570 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 571 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 572 | /* setup import muxs */ |
| 573 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 574 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 575 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 576 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 577 | {} |
| 578 | }; |
| 579 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 580 | static struct hda_verb stac92hd73xx_8ch_core_init[] = { |
| 581 | /* set master volume and direct control */ |
| 582 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 583 | /* setup audio connections */ |
| 584 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 585 | { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 586 | { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 587 | /* connect hp ports to dac3 */ |
| 588 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 589 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 590 | /* setup adcs to point to mixer */ |
| 591 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 592 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 593 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 594 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 595 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 596 | /* setup import muxs */ |
| 597 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 598 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 599 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 600 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 601 | {} |
| 602 | }; |
| 603 | |
| 604 | static struct hda_verb stac92hd73xx_10ch_core_init[] = { |
| 605 | /* set master volume and direct control */ |
| 606 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 607 | /* setup audio connections */ |
| 608 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 609 | { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 610 | { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 611 | /* dac3 is connected to import3 mux */ |
| 612 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f}, |
| 613 | /* connect hp ports to dac4 */ |
| 614 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 615 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 616 | /* setup adcs to point to mixer */ |
| 617 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 618 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 619 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 620 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 621 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 622 | /* setup import muxs */ |
| 623 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 624 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 625 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 626 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 627 | {} |
| 628 | }; |
| 629 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 630 | static struct hda_verb stac92hd71bxx_core_init[] = { |
| 631 | /* set master volume and direct control */ |
| 632 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 633 | /* connect headphone jack to dac1 */ |
| 634 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 635 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */ |
| 636 | /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ |
| 637 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 638 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 639 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 640 | }; |
| 641 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 642 | #define HD_DISABLE_PORTF 3 |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 643 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 644 | /* start of config #1 */ |
| 645 | |
| 646 | /* connect port 0f to audio mixer */ |
| 647 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, |
| 648 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */ |
| 649 | /* unmute right and left channels for node 0x0f */ |
| 650 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 651 | /* start of config #2 */ |
| 652 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 653 | /* set master volume and direct control */ |
| 654 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 655 | /* connect headphone jack to dac1 */ |
| 656 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 657 | /* connect port 0d to audio mixer */ |
Matthew Ranostay | 9b35947 | 2007-11-07 13:03:12 +0100 | [diff] [blame] | 658 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2}, |
Matthew Ranostay | 9b35947 | 2007-11-07 13:03:12 +0100 | [diff] [blame] | 659 | /* unmute dac0 input in audio mixer */ |
| 660 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 661 | /* unmute right and left channels for nodes 0x0a, 0xd */ |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 662 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 663 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 664 | {} |
| 665 | }; |
| 666 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 667 | static struct hda_verb stac925x_core_init[] = { |
| 668 | /* set dac0mux for dac converter */ |
| 669 | { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 670 | {} |
| 671 | }; |
| 672 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 673 | static struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 674 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 675 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 676 | {} |
| 677 | }; |
| 678 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 679 | static struct hda_verb d965_core_init[] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 680 | /* set master volume and direct control */ |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 681 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 682 | /* unmute node 0x1b */ |
| 683 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 684 | /* select node 0x03 as DAC */ |
| 685 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 686 | {} |
| 687 | }; |
| 688 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 689 | static struct hda_verb stac927x_core_init[] = { |
| 690 | /* set master volume and direct control */ |
| 691 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 692 | {} |
| 693 | }; |
| 694 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 695 | static struct hda_verb stac9205_core_init[] = { |
| 696 | /* set master volume and direct control */ |
| 697 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 698 | {} |
| 699 | }; |
| 700 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 701 | #define STAC_MONO_MUX \ |
| 702 | { \ |
| 703 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 704 | .name = "Mono Mux", \ |
| 705 | .count = 1, \ |
| 706 | .info = stac92xx_mono_mux_enum_info, \ |
| 707 | .get = stac92xx_mono_mux_enum_get, \ |
| 708 | .put = stac92xx_mono_mux_enum_put, \ |
| 709 | } |
| 710 | |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 711 | #define STAC_INPUT_SOURCE(cnt) \ |
Maxim Levitsky | ca7c5a8 | 2007-08-31 12:52:19 +0200 | [diff] [blame] | 712 | { \ |
| 713 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 714 | .name = "Input Source", \ |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 715 | .count = cnt, \ |
Maxim Levitsky | ca7c5a8 | 2007-08-31 12:52:19 +0200 | [diff] [blame] | 716 | .info = stac92xx_mux_enum_info, \ |
| 717 | .get = stac92xx_mux_enum_get, \ |
| 718 | .put = stac92xx_mux_enum_put, \ |
| 719 | } |
| 720 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 721 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 722 | { \ |
| 723 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 724 | .name = "Analog Loopback", \ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 725 | .count = cnt, \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 726 | .info = stac92xx_aloopback_info, \ |
| 727 | .get = stac92xx_aloopback_get, \ |
| 728 | .put = stac92xx_aloopback_put, \ |
| 729 | .private_value = verb_read | (verb_write << 16), \ |
| 730 | } |
| 731 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 732 | static struct snd_kcontrol_new stac9200_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 733 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 734 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 735 | STAC_INPUT_SOURCE(1), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 736 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 737 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 738 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 739 | { } /* end */ |
| 740 | }; |
| 741 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 742 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 743 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
| 744 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 745 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 746 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 747 | |
| 748 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 749 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 750 | |
| 751 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 752 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 753 | |
| 754 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 755 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 756 | |
| 757 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 758 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 759 | |
| 760 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 761 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 762 | |
| 763 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 764 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 765 | { } /* end */ |
| 766 | }; |
| 767 | |
| 768 | static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 769 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), |
| 770 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 771 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 772 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 773 | |
| 774 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 775 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 776 | |
| 777 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 778 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 779 | |
| 780 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 781 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 782 | |
| 783 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 784 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 785 | |
| 786 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 787 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 788 | |
| 789 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 790 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 791 | { } /* end */ |
| 792 | }; |
| 793 | |
| 794 | static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 795 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), |
| 796 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 797 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 798 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 799 | |
| 800 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 801 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 802 | |
| 803 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 804 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 805 | |
| 806 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 807 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 808 | |
| 809 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 810 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 811 | |
| 812 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 813 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 814 | |
| 815 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 816 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 817 | { } /* end */ |
| 818 | }; |
| 819 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 820 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 821 | STAC_INPUT_SOURCE(2), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 822 | |
Matthew Ranostay | 9b35947 | 2007-11-07 13:03:12 +0100 | [diff] [blame] | 823 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
| 824 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
| 825 | HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT), |
| 826 | |
| 827 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
| 828 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
| 829 | HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT), |
| 830 | |
Matthew Ranostay | f7c5dda | 2008-07-10 17:49:11 +0200 | [diff] [blame] | 831 | HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT), |
| 832 | HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), |
| 833 | |
Matthew Ranostay | 9b35947 | 2007-11-07 13:03:12 +0100 | [diff] [blame] | 834 | HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT), |
| 835 | HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 836 | { } /* end */ |
| 837 | }; |
| 838 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 839 | static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 840 | STAC_INPUT_SOURCE(2), |
| 841 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), |
| 842 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 843 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
| 844 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
| 845 | HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT), |
| 846 | |
| 847 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
| 848 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
| 849 | HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT), |
| 850 | { } /* end */ |
| 851 | }; |
| 852 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 853 | static struct snd_kcontrol_new stac925x_mixer[] = { |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 854 | STAC_INPUT_SOURCE(1), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 855 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), |
Mauro Carvalho Chehab | 587755f | 2008-05-25 18:20:06 +0200 | [diff] [blame] | 856 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 857 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT), |
| 858 | { } /* end */ |
| 859 | }; |
| 860 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 861 | static struct snd_kcontrol_new stac9205_mixer[] = { |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 862 | STAC_INPUT_SOURCE(2), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 863 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 864 | |
| 865 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), |
| 866 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), |
| 867 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT), |
| 868 | |
| 869 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), |
| 870 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT), |
| 871 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT), |
| 872 | |
| 873 | { } /* end */ |
| 874 | }; |
| 875 | |
| 876 | /* This needs to be generated dynamically based on sequence */ |
| 877 | static struct snd_kcontrol_new stac922x_mixer[] = { |
| 878 | STAC_INPUT_SOURCE(2), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 879 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), |
| 880 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), |
| 881 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT), |
| 882 | |
| 883 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), |
| 884 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT), |
| 885 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT), |
| 886 | { } /* end */ |
| 887 | }; |
| 888 | |
| 889 | |
| 890 | static struct snd_kcontrol_new stac927x_mixer[] = { |
| 891 | STAC_INPUT_SOURCE(3), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 892 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 893 | |
| 894 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), |
| 895 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), |
| 896 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT), |
| 897 | |
| 898 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT), |
| 899 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT), |
| 900 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT), |
| 901 | |
| 902 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT), |
| 903 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT), |
| 904 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 905 | { } /* end */ |
| 906 | }; |
| 907 | |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 908 | static struct snd_kcontrol_new stac_dmux_mixer = { |
| 909 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 910 | .name = "Digital Input Source", |
| 911 | /* count set later */ |
| 912 | .info = stac92xx_dmux_enum_info, |
| 913 | .get = stac92xx_dmux_enum_get, |
| 914 | .put = stac92xx_dmux_enum_put, |
| 915 | }; |
| 916 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 917 | static const char *slave_vols[] = { |
| 918 | "Front Playback Volume", |
| 919 | "Surround Playback Volume", |
| 920 | "Center Playback Volume", |
| 921 | "LFE Playback Volume", |
| 922 | "Side Playback Volume", |
| 923 | "Headphone Playback Volume", |
| 924 | "Headphone Playback Volume", |
| 925 | "Speaker Playback Volume", |
| 926 | "External Speaker Playback Volume", |
| 927 | "Speaker2 Playback Volume", |
| 928 | NULL |
| 929 | }; |
| 930 | |
| 931 | static const char *slave_sws[] = { |
| 932 | "Front Playback Switch", |
| 933 | "Surround Playback Switch", |
| 934 | "Center Playback Switch", |
| 935 | "LFE Playback Switch", |
| 936 | "Side Playback Switch", |
| 937 | "Headphone Playback Switch", |
| 938 | "Headphone Playback Switch", |
| 939 | "Speaker Playback Switch", |
| 940 | "External Speaker Playback Switch", |
| 941 | "Speaker2 Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 942 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 943 | NULL |
| 944 | }; |
| 945 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 946 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 947 | { |
| 948 | struct sigmatel_spec *spec = codec->spec; |
| 949 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 950 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 951 | |
| 952 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 953 | if (err < 0) |
| 954 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 955 | |
| 956 | for (i = 0; i < spec->num_mixers; i++) { |
| 957 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 958 | if (err < 0) |
| 959 | return err; |
| 960 | } |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 961 | if (spec->num_dmuxes > 0) { |
| 962 | stac_dmux_mixer.count = spec->num_dmuxes; |
| 963 | err = snd_ctl_add(codec->bus->card, |
| 964 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
| 965 | if (err < 0) |
| 966 | return err; |
| 967 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 968 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 969 | if (spec->multiout.dig_out_nid) { |
| 970 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
| 971 | if (err < 0) |
| 972 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 973 | err = snd_hda_create_spdif_share_sw(codec, |
| 974 | &spec->multiout); |
| 975 | if (err < 0) |
| 976 | return err; |
| 977 | spec->multiout.share_spdif = 1; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 978 | } |
| 979 | if (spec->dig_in_nid) { |
| 980 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 981 | if (err < 0) |
| 982 | return err; |
| 983 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 984 | |
| 985 | /* if we have no master control, let's create it */ |
| 986 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 987 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 988 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 989 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 990 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 991 | vmaster_tlv, slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 992 | if (err < 0) |
| 993 | return err; |
| 994 | } |
| 995 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 996 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 997 | NULL, slave_sws); |
| 998 | if (err < 0) |
| 999 | return err; |
| 1000 | } |
| 1001 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1002 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1003 | } |
| 1004 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1005 | static unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1006 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1007 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 1008 | }; |
| 1009 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1010 | /* |
| 1011 | STAC 9200 pin configs for |
| 1012 | 102801A8 |
| 1013 | 102801DE |
| 1014 | 102801E8 |
| 1015 | */ |
| 1016 | static unsigned int dell9200_d21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1017 | 0x400001f0, 0x400001f1, 0x02214030, 0x01014010, |
| 1018 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1019 | }; |
| 1020 | |
| 1021 | /* |
| 1022 | STAC 9200 pin configs for |
| 1023 | 102801C0 |
| 1024 | 102801C1 |
| 1025 | */ |
| 1026 | static unsigned int dell9200_d22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1027 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1028 | 0x01813020, 0x02a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1029 | }; |
| 1030 | |
| 1031 | /* |
| 1032 | STAC 9200 pin configs for |
| 1033 | 102801C4 (Dell Dimension E310) |
| 1034 | 102801C5 |
| 1035 | 102801C7 |
| 1036 | 102801D9 |
| 1037 | 102801DA |
| 1038 | 102801E3 |
| 1039 | */ |
| 1040 | static unsigned int dell9200_d23_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1041 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1042 | 0x01813020, 0x01a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1043 | }; |
| 1044 | |
| 1045 | |
| 1046 | /* |
| 1047 | STAC 9200-32 pin configs for |
| 1048 | 102801B5 (Dell Inspiron 630m) |
| 1049 | 102801D8 (Dell Inspiron 640m) |
| 1050 | */ |
| 1051 | static unsigned int dell9200_m21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1052 | 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, |
| 1053 | 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1054 | }; |
| 1055 | |
| 1056 | /* |
| 1057 | STAC 9200-32 pin configs for |
| 1058 | 102801C2 (Dell Latitude D620) |
| 1059 | 102801C8 |
| 1060 | 102801CC (Dell Latitude D820) |
| 1061 | 102801D4 |
| 1062 | 102801D6 |
| 1063 | */ |
| 1064 | static unsigned int dell9200_m22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1065 | 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310, |
| 1066 | 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1067 | }; |
| 1068 | |
| 1069 | /* |
| 1070 | STAC 9200-32 pin configs for |
| 1071 | 102801CE (Dell XPS M1710) |
| 1072 | 102801CF (Dell Precision M90) |
| 1073 | */ |
| 1074 | static unsigned int dell9200_m23_pin_configs[8] = { |
| 1075 | 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310, |
| 1076 | 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc, |
| 1077 | }; |
| 1078 | |
| 1079 | /* |
| 1080 | STAC 9200-32 pin configs for |
| 1081 | 102801C9 |
| 1082 | 102801CA |
| 1083 | 102801CB (Dell Latitude 120L) |
| 1084 | 102801D3 |
| 1085 | */ |
| 1086 | static unsigned int dell9200_m24_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1087 | 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, |
| 1088 | 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1089 | }; |
| 1090 | |
| 1091 | /* |
| 1092 | STAC 9200-32 pin configs for |
| 1093 | 102801BD (Dell Inspiron E1505n) |
| 1094 | 102801EE |
| 1095 | 102801EF |
| 1096 | */ |
| 1097 | static unsigned int dell9200_m25_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1098 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1099 | 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1100 | }; |
| 1101 | |
| 1102 | /* |
| 1103 | STAC 9200-32 pin configs for |
| 1104 | 102801F5 (Dell Inspiron 1501) |
| 1105 | 102801F6 |
| 1106 | */ |
| 1107 | static unsigned int dell9200_m26_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1108 | 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, |
| 1109 | 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1110 | }; |
| 1111 | |
| 1112 | /* |
| 1113 | STAC 9200-32 |
| 1114 | 102801CD (Dell Inspiron E1705/9400) |
| 1115 | */ |
| 1116 | static unsigned int dell9200_m27_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1117 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1118 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1119 | }; |
| 1120 | |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1121 | static unsigned int oqo9200_pin_configs[8] = { |
| 1122 | 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210, |
| 1123 | 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3, |
| 1124 | }; |
| 1125 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1126 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1127 | static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
| 1128 | [STAC_REF] = ref9200_pin_configs, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1129 | [STAC_9200_OQO] = oqo9200_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1130 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, |
| 1131 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, |
| 1132 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, |
| 1133 | [STAC_9200_DELL_M21] = dell9200_m21_pin_configs, |
| 1134 | [STAC_9200_DELL_M22] = dell9200_m22_pin_configs, |
| 1135 | [STAC_9200_DELL_M23] = dell9200_m23_pin_configs, |
| 1136 | [STAC_9200_DELL_M24] = dell9200_m24_pin_configs, |
| 1137 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
| 1138 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
| 1139 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1140 | [STAC_9200_PANASONIC] = ref9200_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1141 | }; |
| 1142 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1143 | static const char *stac9200_models[STAC_9200_MODELS] = { |
| 1144 | [STAC_REF] = "ref", |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1145 | [STAC_9200_OQO] = "oqo", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1146 | [STAC_9200_DELL_D21] = "dell-d21", |
| 1147 | [STAC_9200_DELL_D22] = "dell-d22", |
| 1148 | [STAC_9200_DELL_D23] = "dell-d23", |
| 1149 | [STAC_9200_DELL_M21] = "dell-m21", |
| 1150 | [STAC_9200_DELL_M22] = "dell-m22", |
| 1151 | [STAC_9200_DELL_M23] = "dell-m23", |
| 1152 | [STAC_9200_DELL_M24] = "dell-m24", |
| 1153 | [STAC_9200_DELL_M25] = "dell-m25", |
| 1154 | [STAC_9200_DELL_M26] = "dell-m26", |
| 1155 | [STAC_9200_DELL_M27] = "dell-m27", |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 1156 | [STAC_9200_GATEWAY] = "gateway", |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1157 | [STAC_9200_PANASONIC] = "panasonic", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1158 | }; |
| 1159 | |
| 1160 | static struct snd_pci_quirk stac9200_cfg_tbl[] = { |
| 1161 | /* SigmaTel reference board */ |
| 1162 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1163 | "DFI LanParty", STAC_REF), |
Matt Porter | e737707 | 2006-11-06 11:20:38 +0100 | [diff] [blame] | 1164 | /* Dell laptops have BIOS problem */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1165 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, |
| 1166 | "unknown Dell", STAC_9200_DELL_D21), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1167 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1168 | "Dell Inspiron 630m", STAC_9200_DELL_M21), |
| 1169 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd, |
| 1170 | "Dell Inspiron E1505n", STAC_9200_DELL_M25), |
| 1171 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0, |
| 1172 | "unknown Dell", STAC_9200_DELL_D22), |
| 1173 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1, |
| 1174 | "unknown Dell", STAC_9200_DELL_D22), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1175 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1176 | "Dell Latitude D620", STAC_9200_DELL_M22), |
| 1177 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5, |
| 1178 | "unknown Dell", STAC_9200_DELL_D23), |
| 1179 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7, |
| 1180 | "unknown Dell", STAC_9200_DELL_D23), |
| 1181 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8, |
| 1182 | "unknown Dell", STAC_9200_DELL_M22), |
| 1183 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9, |
| 1184 | "unknown Dell", STAC_9200_DELL_M24), |
| 1185 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca, |
| 1186 | "unknown Dell", STAC_9200_DELL_M24), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1187 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1188 | "Dell Latitude 120L", STAC_9200_DELL_M24), |
Cory T. Tusar | 877b866 | 2007-01-30 17:30:55 +0100 | [diff] [blame] | 1189 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1190 | "Dell Latitude D820", STAC_9200_DELL_M22), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1191 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1192 | "Dell Inspiron E1705/9400", STAC_9200_DELL_M27), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1193 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1194 | "Dell XPS M1710", STAC_9200_DELL_M23), |
Takashi Iwai | f0f9674 | 2007-02-14 00:59:17 +0100 | [diff] [blame] | 1195 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1196 | "Dell Precision M90", STAC_9200_DELL_M23), |
| 1197 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3, |
| 1198 | "unknown Dell", STAC_9200_DELL_M22), |
| 1199 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4, |
| 1200 | "unknown Dell", STAC_9200_DELL_M22), |
Daniel T Chen | 8286c53 | 2007-05-15 11:46:23 +0200 | [diff] [blame] | 1201 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1202 | "unknown Dell", STAC_9200_DELL_M22), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1203 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1204 | "Dell Inspiron 640m", STAC_9200_DELL_M21), |
| 1205 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9, |
| 1206 | "unknown Dell", STAC_9200_DELL_D23), |
| 1207 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da, |
| 1208 | "unknown Dell", STAC_9200_DELL_D23), |
| 1209 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de, |
| 1210 | "unknown Dell", STAC_9200_DELL_D21), |
| 1211 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3, |
| 1212 | "unknown Dell", STAC_9200_DELL_D23), |
| 1213 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8, |
| 1214 | "unknown Dell", STAC_9200_DELL_D21), |
| 1215 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee, |
| 1216 | "unknown Dell", STAC_9200_DELL_M25), |
| 1217 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef, |
| 1218 | "unknown Dell", STAC_9200_DELL_M25), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1219 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1220 | "Dell Inspiron 1501", STAC_9200_DELL_M26), |
| 1221 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, |
| 1222 | "unknown Dell", STAC_9200_DELL_M26), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1223 | /* Panasonic */ |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1224 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 1225 | /* Gateway machines needs EAPD to be set on resume */ |
| 1226 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), |
| 1227 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", |
| 1228 | STAC_9200_GATEWAY), |
| 1229 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", |
| 1230 | STAC_9200_GATEWAY), |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1231 | /* OQO Mobile */ |
| 1232 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1233 | {} /* terminator */ |
| 1234 | }; |
| 1235 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1236 | static unsigned int ref925x_pin_configs[8] = { |
| 1237 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 1238 | 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1239 | }; |
| 1240 | |
| 1241 | static unsigned int stac925x_MA6_pin_configs[8] = { |
| 1242 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
| 1243 | 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, |
| 1244 | }; |
| 1245 | |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1246 | static unsigned int stac925x_PA6_pin_configs[8] = { |
| 1247 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
| 1248 | 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, |
| 1249 | }; |
| 1250 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1251 | static unsigned int stac925xM2_2_pin_configs[8] = { |
Steve Longerbeam | 7353e14 | 2007-05-29 14:36:17 +0200 | [diff] [blame] | 1252 | 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, |
| 1253 | 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1254 | }; |
| 1255 | |
| 1256 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
| 1257 | [STAC_REF] = ref925x_pin_configs, |
| 1258 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
| 1259 | [STAC_MA6] = stac925x_MA6_pin_configs, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1260 | [STAC_PA6] = stac925x_PA6_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1261 | }; |
| 1262 | |
| 1263 | static const char *stac925x_models[STAC_925x_MODELS] = { |
| 1264 | [STAC_REF] = "ref", |
| 1265 | [STAC_M2_2] = "m2-2", |
| 1266 | [STAC_MA6] = "m6", |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1267 | [STAC_PA6] = "pa6", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1268 | }; |
| 1269 | |
| 1270 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
| 1271 | /* SigmaTel reference board */ |
| 1272 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1273 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1274 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), |
| 1275 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), |
| 1276 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1277 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1278 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), |
| 1279 | {} /* terminator */ |
| 1280 | }; |
| 1281 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1282 | static unsigned int ref92hd73xx_pin_configs[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1283 | 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, |
| 1284 | 0x0181302e, 0x01014010, 0x01014020, 0x01014030, |
| 1285 | 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1286 | 0x01452050, |
| 1287 | }; |
| 1288 | |
| 1289 | static unsigned int dell_m6_pin_configs[13] = { |
| 1290 | 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 1291 | 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1292 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, |
| 1293 | 0x4f0000f0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1294 | }; |
| 1295 | |
| 1296 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1297 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
| 1298 | [STAC_DELL_M6] = dell_m6_pin_configs, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1299 | }; |
| 1300 | |
| 1301 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
| 1302 | [STAC_92HD73XX_REF] = "ref", |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1303 | [STAC_DELL_M6] = "dell-m6", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1304 | }; |
| 1305 | |
| 1306 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
| 1307 | /* SigmaTel reference board */ |
| 1308 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1309 | "DFI LanParty", STAC_92HD73XX_REF), |
| 1310 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
| 1311 | "unknown Dell", STAC_DELL_M6), |
| 1312 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
| 1313 | "unknown Dell", STAC_DELL_M6), |
| 1314 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, |
| 1315 | "unknown Dell", STAC_DELL_M6), |
| 1316 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, |
| 1317 | "unknown Dell", STAC_DELL_M6), |
| 1318 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, |
| 1319 | "unknown Dell", STAC_DELL_M6), |
| 1320 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, |
| 1321 | "unknown Dell", STAC_DELL_M6), |
| 1322 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, |
| 1323 | "unknown Dell", STAC_DELL_M6), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1324 | {} /* terminator */ |
| 1325 | }; |
| 1326 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1327 | static unsigned int ref92hd71bxx_pin_configs[10] = { |
| 1328 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 1329 | 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1330 | 0x90a000f0, 0x01452050, |
| 1331 | }; |
| 1332 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 1333 | static unsigned int dell_m4_1_pin_configs[10] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1334 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
Matthew Ranostay | 07bcb31 | 2008-03-20 12:10:57 +0100 | [diff] [blame] | 1335 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1336 | 0x40f000f0, 0x4f0000f0, |
| 1337 | }; |
| 1338 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 1339 | static unsigned int dell_m4_2_pin_configs[10] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1340 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1341 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
| 1342 | 0x40f000f0, 0x044413b0, |
| 1343 | }; |
| 1344 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1345 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
| 1346 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1347 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
| 1348 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1349 | }; |
| 1350 | |
| 1351 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
| 1352 | [STAC_92HD71BXX_REF] = "ref", |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1353 | [STAC_DELL_M4_1] = "dell-m4-1", |
| 1354 | [STAC_DELL_M4_2] = "dell-m4-2", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1355 | }; |
| 1356 | |
| 1357 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
| 1358 | /* SigmaTel reference board */ |
| 1359 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1360 | "DFI LanParty", STAC_92HD71BXX_REF), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1361 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
| 1362 | "unknown Dell", STAC_DELL_M4_1), |
| 1363 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
| 1364 | "unknown Dell", STAC_DELL_M4_1), |
| 1365 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250, |
| 1366 | "unknown Dell", STAC_DELL_M4_1), |
| 1367 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f, |
| 1368 | "unknown Dell", STAC_DELL_M4_1), |
| 1369 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d, |
| 1370 | "unknown Dell", STAC_DELL_M4_1), |
| 1371 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251, |
| 1372 | "unknown Dell", STAC_DELL_M4_1), |
| 1373 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277, |
| 1374 | "unknown Dell", STAC_DELL_M4_1), |
| 1375 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263, |
| 1376 | "unknown Dell", STAC_DELL_M4_2), |
| 1377 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265, |
| 1378 | "unknown Dell", STAC_DELL_M4_2), |
| 1379 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262, |
| 1380 | "unknown Dell", STAC_DELL_M4_2), |
| 1381 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, |
| 1382 | "unknown Dell", STAC_DELL_M4_2), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1383 | {} /* terminator */ |
| 1384 | }; |
| 1385 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1386 | static unsigned int ref922x_pin_configs[10] = { |
| 1387 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 1388 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1389 | 0x40000100, 0x40000100, |
| 1390 | }; |
| 1391 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1392 | /* |
| 1393 | STAC 922X pin configs for |
| 1394 | 102801A7 |
| 1395 | 102801AB |
| 1396 | 102801A9 |
| 1397 | 102801D1 |
| 1398 | 102801D2 |
| 1399 | */ |
| 1400 | static unsigned int dell_922x_d81_pin_configs[10] = { |
| 1401 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1402 | 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, |
| 1403 | 0x01813122, 0x400001f2, |
| 1404 | }; |
| 1405 | |
| 1406 | /* |
| 1407 | STAC 922X pin configs for |
| 1408 | 102801AC |
| 1409 | 102801D0 |
| 1410 | */ |
| 1411 | static unsigned int dell_922x_d82_pin_configs[10] = { |
| 1412 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1413 | 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, |
| 1414 | 0x01813122, 0x400001f1, |
| 1415 | }; |
| 1416 | |
| 1417 | /* |
| 1418 | STAC 922X pin configs for |
| 1419 | 102801BF |
| 1420 | */ |
| 1421 | static unsigned int dell_922x_m81_pin_configs[10] = { |
| 1422 | 0x0321101f, 0x01112024, 0x01111222, 0x91174220, |
| 1423 | 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, |
| 1424 | 0x40C003f1, 0x405003f0, |
| 1425 | }; |
| 1426 | |
| 1427 | /* |
| 1428 | STAC 9221 A1 pin configs for |
| 1429 | 102801D7 (Dell XPS M1210) |
| 1430 | */ |
| 1431 | static unsigned int dell_922x_m82_pin_configs[10] = { |
Jiang Zhe | 7f9310c | 2007-11-12 12:43:37 +0100 | [diff] [blame] | 1432 | 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, |
| 1433 | 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1434 | 0x508003f3, 0x405003f4, |
| 1435 | }; |
| 1436 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1437 | static unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1438 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1439 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 1440 | 0x02a19120, 0x40000100, |
| 1441 | }; |
| 1442 | |
| 1443 | static unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1444 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 1445 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1446 | 0x02a19320, 0x40000100, |
| 1447 | }; |
| 1448 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1449 | static unsigned int intel_mac_v1_pin_configs[10] = { |
| 1450 | 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, |
| 1451 | 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1452 | 0x400000fc, 0x400000fb, |
| 1453 | }; |
| 1454 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1455 | static unsigned int intel_mac_v2_pin_configs[10] = { |
| 1456 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1457 | 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1458 | 0x400000fc, 0x400000fb, |
| 1459 | }; |
| 1460 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1461 | static unsigned int intel_mac_v3_pin_configs[10] = { |
| 1462 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1463 | 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, |
| 1464 | 0x400000fc, 0x400000fb, |
| 1465 | }; |
| 1466 | |
| 1467 | static unsigned int intel_mac_v4_pin_configs[10] = { |
| 1468 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1469 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1470 | 0x400000fc, 0x400000fb, |
| 1471 | }; |
| 1472 | |
| 1473 | static unsigned int intel_mac_v5_pin_configs[10] = { |
| 1474 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1475 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1476 | 0x400000fc, 0x400000fb, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1477 | }; |
| 1478 | |
Takashi Iwai | 76c0882 | 2007-06-19 12:17:42 +0200 | [diff] [blame] | 1479 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1480 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1481 | [STAC_D945_REF] = ref922x_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1482 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 1483 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1484 | [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs, |
| 1485 | [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs, |
| 1486 | [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, |
| 1487 | [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, |
| 1488 | [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1489 | [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1490 | /* for backward compatibility */ |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1491 | [STAC_MACMINI] = intel_mac_v3_pin_configs, |
| 1492 | [STAC_MACBOOK] = intel_mac_v5_pin_configs, |
| 1493 | [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs, |
| 1494 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
| 1495 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
| 1496 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1497 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
| 1498 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
| 1499 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
| 1500 | [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1501 | }; |
| 1502 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1503 | static const char *stac922x_models[STAC_922X_MODELS] = { |
| 1504 | [STAC_D945_REF] = "ref", |
| 1505 | [STAC_D945GTP5] = "5stack", |
| 1506 | [STAC_D945GTP3] = "3stack", |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1507 | [STAC_INTEL_MAC_V1] = "intel-mac-v1", |
| 1508 | [STAC_INTEL_MAC_V2] = "intel-mac-v2", |
| 1509 | [STAC_INTEL_MAC_V3] = "intel-mac-v3", |
| 1510 | [STAC_INTEL_MAC_V4] = "intel-mac-v4", |
| 1511 | [STAC_INTEL_MAC_V5] = "intel-mac-v5", |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1512 | [STAC_INTEL_MAC_AUTO] = "intel-mac-auto", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1513 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1514 | [STAC_MACMINI] = "macmini", |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1515 | [STAC_MACBOOK] = "macbook", |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 1516 | [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", |
| 1517 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1518 | [STAC_IMAC_INTEL] = "imac-intel", |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1519 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1520 | [STAC_922X_DELL_D81] = "dell-d81", |
| 1521 | [STAC_922X_DELL_D82] = "dell-d82", |
| 1522 | [STAC_922X_DELL_M81] = "dell-m81", |
| 1523 | [STAC_922X_DELL_M82] = "dell-m82", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1524 | }; |
| 1525 | |
| 1526 | static struct snd_pci_quirk stac922x_cfg_tbl[] = { |
| 1527 | /* SigmaTel reference board */ |
| 1528 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1529 | "DFI LanParty", STAC_D945_REF), |
| 1530 | /* Intel 945G based systems */ |
| 1531 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
| 1532 | "Intel D945G", STAC_D945GTP3), |
| 1533 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, |
| 1534 | "Intel D945G", STAC_D945GTP3), |
| 1535 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, |
| 1536 | "Intel D945G", STAC_D945GTP3), |
| 1537 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, |
| 1538 | "Intel D945G", STAC_D945GTP3), |
| 1539 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, |
| 1540 | "Intel D945G", STAC_D945GTP3), |
| 1541 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, |
| 1542 | "Intel D945G", STAC_D945GTP3), |
| 1543 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, |
| 1544 | "Intel D945G", STAC_D945GTP3), |
| 1545 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, |
| 1546 | "Intel D945G", STAC_D945GTP3), |
| 1547 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, |
| 1548 | "Intel D945G", STAC_D945GTP3), |
| 1549 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, |
| 1550 | "Intel D945G", STAC_D945GTP3), |
| 1551 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, |
| 1552 | "Intel D945G", STAC_D945GTP3), |
| 1553 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, |
| 1554 | "Intel D945G", STAC_D945GTP3), |
| 1555 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, |
| 1556 | "Intel D945G", STAC_D945GTP3), |
| 1557 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, |
| 1558 | "Intel D945G", STAC_D945GTP3), |
| 1559 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, |
| 1560 | "Intel D945G", STAC_D945GTP3), |
| 1561 | /* Intel D945G 5-stack systems */ |
| 1562 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, |
| 1563 | "Intel D945G", STAC_D945GTP5), |
| 1564 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, |
| 1565 | "Intel D945G", STAC_D945GTP5), |
| 1566 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, |
| 1567 | "Intel D945G", STAC_D945GTP5), |
| 1568 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, |
| 1569 | "Intel D945G", STAC_D945GTP5), |
| 1570 | /* Intel 945P based systems */ |
| 1571 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, |
| 1572 | "Intel D945P", STAC_D945GTP3), |
| 1573 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, |
| 1574 | "Intel D945P", STAC_D945GTP3), |
| 1575 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, |
| 1576 | "Intel D945P", STAC_D945GTP3), |
| 1577 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, |
| 1578 | "Intel D945P", STAC_D945GTP3), |
| 1579 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, |
| 1580 | "Intel D945P", STAC_D945GTP3), |
| 1581 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
| 1582 | "Intel D945P", STAC_D945GTP5), |
| 1583 | /* other systems */ |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1584 | /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1585 | SND_PCI_QUIRK(0x8384, 0x7680, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1586 | "Mac", STAC_INTEL_MAC_AUTO), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1587 | /* Dell systems */ |
| 1588 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, |
| 1589 | "unknown Dell", STAC_922X_DELL_D81), |
| 1590 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9, |
| 1591 | "unknown Dell", STAC_922X_DELL_D81), |
| 1592 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab, |
| 1593 | "unknown Dell", STAC_922X_DELL_D81), |
| 1594 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac, |
| 1595 | "unknown Dell", STAC_922X_DELL_D82), |
| 1596 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf, |
| 1597 | "unknown Dell", STAC_922X_DELL_M81), |
| 1598 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0, |
| 1599 | "unknown Dell", STAC_922X_DELL_D82), |
| 1600 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1, |
| 1601 | "unknown Dell", STAC_922X_DELL_D81), |
| 1602 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2, |
| 1603 | "unknown Dell", STAC_922X_DELL_D81), |
| 1604 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
| 1605 | "Dell XPS M1210", STAC_922X_DELL_M82), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1606 | {} /* terminator */ |
| 1607 | }; |
| 1608 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1609 | static unsigned int ref927x_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1610 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 1611 | 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, |
| 1612 | 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, |
| 1613 | 0x01c42190, 0x40000100, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1614 | }; |
| 1615 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1616 | static unsigned int d965_3st_pin_configs[14] = { |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 1617 | 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, |
| 1618 | 0x01a19021, 0x01813024, 0x40000100, 0x40000100, |
| 1619 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 1620 | 0x40000100, 0x40000100 |
| 1621 | }; |
| 1622 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1623 | static unsigned int d965_5st_pin_configs[14] = { |
| 1624 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 1625 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 1626 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 1627 | 0x40000100, 0x40000100 |
| 1628 | }; |
| 1629 | |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 1630 | static unsigned int dell_3st_pin_configs[14] = { |
| 1631 | 0x02211230, 0x02a11220, 0x01a19040, 0x01114210, |
| 1632 | 0x01111212, 0x01116211, 0x01813050, 0x01112214, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 1633 | 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 1634 | 0x40c003fc, 0x40000100 |
| 1635 | }; |
| 1636 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1637 | static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 1638 | [STAC_D965_REF] = ref927x_pin_configs, |
| 1639 | [STAC_D965_3ST] = d965_3st_pin_configs, |
| 1640 | [STAC_D965_5ST] = d965_5st_pin_configs, |
| 1641 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
| 1642 | [STAC_DELL_BIOS] = NULL, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1643 | }; |
| 1644 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1645 | static const char *stac927x_models[STAC_927X_MODELS] = { |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 1646 | [STAC_D965_REF] = "ref", |
| 1647 | [STAC_D965_3ST] = "3stack", |
| 1648 | [STAC_D965_5ST] = "5stack", |
| 1649 | [STAC_DELL_3ST] = "dell-3stack", |
| 1650 | [STAC_DELL_BIOS] = "dell-bios", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1651 | }; |
| 1652 | |
| 1653 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { |
| 1654 | /* SigmaTel reference board */ |
| 1655 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1656 | "DFI LanParty", STAC_D965_REF), |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 1657 | /* Intel 946 based systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1658 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
| 1659 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST), |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1660 | /* 965 based 3 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1661 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST), |
| 1662 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST), |
| 1663 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST), |
| 1664 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST), |
| 1665 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST), |
| 1666 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST), |
| 1667 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST), |
| 1668 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST), |
| 1669 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST), |
| 1670 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST), |
| 1671 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST), |
| 1672 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST), |
| 1673 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST), |
| 1674 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST), |
| 1675 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST), |
| 1676 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST), |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 1677 | /* Dell 3 stack systems */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 1678 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1679 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST), |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 1680 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), |
| 1681 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 1682 | /* Dell 3 stack systems with verb table in BIOS */ |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 1683 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), |
| 1684 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 1685 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell ", STAC_DELL_BIOS), |
| 1686 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), |
| 1687 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), |
| 1688 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), |
| 1689 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
| 1690 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS), |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1691 | /* 965 based 5 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1692 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST), |
| 1693 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST), |
| 1694 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST), |
| 1695 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST), |
| 1696 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST), |
| 1697 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST), |
| 1698 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST), |
| 1699 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST), |
| 1700 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST), |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1701 | {} /* terminator */ |
| 1702 | }; |
| 1703 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1704 | static unsigned int ref9205_pin_configs[12] = { |
| 1705 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 1706 | 0x01813122, 0x01a19021, 0x01019020, 0x40000100, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1707 | 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1708 | }; |
| 1709 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1710 | /* |
| 1711 | STAC 9205 pin configs for |
| 1712 | 102801F1 |
| 1713 | 102801F2 |
| 1714 | 102801FC |
| 1715 | 102801FD |
| 1716 | 10280204 |
| 1717 | 1028021F |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 1718 | 10280228 (Dell Vostro 1500) |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1719 | */ |
| 1720 | static unsigned int dell_9205_m42_pin_configs[12] = { |
| 1721 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
| 1722 | 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9, |
| 1723 | 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE, |
| 1724 | }; |
| 1725 | |
| 1726 | /* |
| 1727 | STAC 9205 pin configs for |
| 1728 | 102801F9 |
| 1729 | 102801FA |
| 1730 | 102801FE |
| 1731 | 102801FF (Dell Precision M4300) |
| 1732 | 10280206 |
| 1733 | 10280200 |
| 1734 | 10280201 |
| 1735 | */ |
| 1736 | static unsigned int dell_9205_m43_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1737 | 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310, |
| 1738 | 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9, |
| 1739 | 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8, |
| 1740 | }; |
| 1741 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1742 | static unsigned int dell_9205_m44_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1743 | 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310, |
| 1744 | 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9, |
| 1745 | 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe, |
| 1746 | }; |
| 1747 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1748 | static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1749 | [STAC_9205_REF] = ref9205_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1750 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, |
| 1751 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, |
| 1752 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1753 | }; |
| 1754 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1755 | static const char *stac9205_models[STAC_9205_MODELS] = { |
| 1756 | [STAC_9205_REF] = "ref", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1757 | [STAC_9205_DELL_M42] = "dell-m42", |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1758 | [STAC_9205_DELL_M43] = "dell-m43", |
| 1759 | [STAC_9205_DELL_M44] = "dell-m44", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1760 | }; |
| 1761 | |
| 1762 | static struct snd_pci_quirk stac9205_cfg_tbl[] = { |
| 1763 | /* SigmaTel reference board */ |
| 1764 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1765 | "DFI LanParty", STAC_9205_REF), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1766 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
| 1767 | "unknown Dell", STAC_9205_DELL_M42), |
| 1768 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
| 1769 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1770 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8, |
Matthew Ranostay | b44ef2f | 2007-09-18 00:52:38 +0200 | [diff] [blame] | 1771 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1772 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9, |
| 1773 | "Dell Precision", STAC_9205_DELL_M43), |
| 1774 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa, |
| 1775 | "Dell Precision", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1776 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, |
| 1777 | "unknown Dell", STAC_9205_DELL_M42), |
| 1778 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, |
| 1779 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1780 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe, |
| 1781 | "Dell Precision", STAC_9205_DELL_M43), |
| 1782 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1783 | "Dell Precision M4300", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1784 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, |
| 1785 | "unknown Dell", STAC_9205_DELL_M42), |
Takashi Iwai | 4549915 | 2008-06-12 16:27:24 +0200 | [diff] [blame] | 1786 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206, |
| 1787 | "Dell Precision", STAC_9205_DELL_M43), |
| 1788 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b, |
| 1789 | "Dell Precision", STAC_9205_DELL_M43), |
| 1790 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c, |
| 1791 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1792 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f, |
| 1793 | "Dell Inspiron", STAC_9205_DELL_M44), |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 1794 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
| 1795 | "Dell Vostro 1500", STAC_9205_DELL_M42), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1796 | {} /* terminator */ |
| 1797 | }; |
| 1798 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1799 | static int stac92xx_save_bios_config_regs(struct hda_codec *codec) |
| 1800 | { |
| 1801 | int i; |
| 1802 | struct sigmatel_spec *spec = codec->spec; |
| 1803 | |
| 1804 | if (! spec->bios_pin_configs) { |
| 1805 | spec->bios_pin_configs = kcalloc(spec->num_pins, |
| 1806 | sizeof(*spec->bios_pin_configs), GFP_KERNEL); |
| 1807 | if (! spec->bios_pin_configs) |
| 1808 | return -ENOMEM; |
| 1809 | } |
| 1810 | |
| 1811 | for (i = 0; i < spec->num_pins; i++) { |
| 1812 | hda_nid_t nid = spec->pin_nids[i]; |
| 1813 | unsigned int pin_cfg; |
| 1814 | |
| 1815 | pin_cfg = snd_hda_codec_read(codec, nid, 0, |
| 1816 | AC_VERB_GET_CONFIG_DEFAULT, 0x00); |
| 1817 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", |
| 1818 | nid, pin_cfg); |
| 1819 | spec->bios_pin_configs[i] = pin_cfg; |
| 1820 | } |
| 1821 | |
| 1822 | return 0; |
| 1823 | } |
| 1824 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1825 | static void stac92xx_set_config_reg(struct hda_codec *codec, |
| 1826 | hda_nid_t pin_nid, unsigned int pin_config) |
| 1827 | { |
| 1828 | int i; |
| 1829 | snd_hda_codec_write(codec, pin_nid, 0, |
| 1830 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 1831 | pin_config & 0x000000ff); |
| 1832 | snd_hda_codec_write(codec, pin_nid, 0, |
| 1833 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 1834 | (pin_config & 0x0000ff00) >> 8); |
| 1835 | snd_hda_codec_write(codec, pin_nid, 0, |
| 1836 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 1837 | (pin_config & 0x00ff0000) >> 16); |
| 1838 | snd_hda_codec_write(codec, pin_nid, 0, |
| 1839 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 1840 | pin_config >> 24); |
| 1841 | i = snd_hda_codec_read(codec, pin_nid, 0, |
| 1842 | AC_VERB_GET_CONFIG_DEFAULT, |
| 1843 | 0x00); |
| 1844 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", |
| 1845 | pin_nid, i); |
| 1846 | } |
| 1847 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1848 | static void stac92xx_set_config_regs(struct hda_codec *codec) |
| 1849 | { |
| 1850 | int i; |
| 1851 | struct sigmatel_spec *spec = codec->spec; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1852 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1853 | if (!spec->pin_configs) |
| 1854 | return; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1855 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1856 | for (i = 0; i < spec->num_pins; i++) |
| 1857 | stac92xx_set_config_reg(codec, spec->pin_nids[i], |
| 1858 | spec->pin_configs[i]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1859 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1860 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1861 | /* |
| 1862 | * Analog playback callbacks |
| 1863 | */ |
| 1864 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 1865 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1866 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1867 | { |
| 1868 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1869 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 1870 | hinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1871 | } |
| 1872 | |
| 1873 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1874 | struct hda_codec *codec, |
| 1875 | unsigned int stream_tag, |
| 1876 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1877 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1878 | { |
| 1879 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1880 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1881 | } |
| 1882 | |
| 1883 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 1884 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1885 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1886 | { |
| 1887 | struct sigmatel_spec *spec = codec->spec; |
| 1888 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 1889 | } |
| 1890 | |
| 1891 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1892 | * Digital playback callbacks |
| 1893 | */ |
| 1894 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 1895 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1896 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1897 | { |
| 1898 | struct sigmatel_spec *spec = codec->spec; |
| 1899 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 1900 | } |
| 1901 | |
| 1902 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 1903 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1904 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1905 | { |
| 1906 | struct sigmatel_spec *spec = codec->spec; |
| 1907 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 1908 | } |
| 1909 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 1910 | static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1911 | struct hda_codec *codec, |
| 1912 | unsigned int stream_tag, |
| 1913 | unsigned int format, |
| 1914 | struct snd_pcm_substream *substream) |
| 1915 | { |
| 1916 | struct sigmatel_spec *spec = codec->spec; |
| 1917 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 1918 | stream_tag, format, substream); |
| 1919 | } |
| 1920 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1921 | |
| 1922 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1923 | * Analog capture callbacks |
| 1924 | */ |
| 1925 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1926 | struct hda_codec *codec, |
| 1927 | unsigned int stream_tag, |
| 1928 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1929 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1930 | { |
| 1931 | struct sigmatel_spec *spec = codec->spec; |
| 1932 | |
| 1933 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 1934 | stream_tag, 0, format); |
| 1935 | return 0; |
| 1936 | } |
| 1937 | |
| 1938 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 1939 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1940 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1941 | { |
| 1942 | struct sigmatel_spec *spec = codec->spec; |
| 1943 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 1944 | snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1945 | return 0; |
| 1946 | } |
| 1947 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1948 | static struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
| 1949 | .substreams = 1, |
| 1950 | .channels_min = 2, |
| 1951 | .channels_max = 2, |
| 1952 | /* NID is set in stac92xx_build_pcms */ |
| 1953 | .ops = { |
| 1954 | .open = stac92xx_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 1955 | .close = stac92xx_dig_playback_pcm_close, |
| 1956 | .prepare = stac92xx_dig_playback_pcm_prepare |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1957 | }, |
| 1958 | }; |
| 1959 | |
| 1960 | static struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
| 1961 | .substreams = 1, |
| 1962 | .channels_min = 2, |
| 1963 | .channels_max = 2, |
| 1964 | /* NID is set in stac92xx_build_pcms */ |
| 1965 | }; |
| 1966 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1967 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
| 1968 | .substreams = 1, |
| 1969 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1970 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1971 | .nid = 0x02, /* NID to query formats and rates */ |
| 1972 | .ops = { |
| 1973 | .open = stac92xx_playback_pcm_open, |
| 1974 | .prepare = stac92xx_playback_pcm_prepare, |
| 1975 | .cleanup = stac92xx_playback_pcm_cleanup |
| 1976 | }, |
| 1977 | }; |
| 1978 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1979 | static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
| 1980 | .substreams = 1, |
| 1981 | .channels_min = 2, |
| 1982 | .channels_max = 2, |
| 1983 | .nid = 0x06, /* NID to query formats and rates */ |
| 1984 | .ops = { |
| 1985 | .open = stac92xx_playback_pcm_open, |
| 1986 | .prepare = stac92xx_playback_pcm_prepare, |
| 1987 | .cleanup = stac92xx_playback_pcm_cleanup |
| 1988 | }, |
| 1989 | }; |
| 1990 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1991 | static struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1992 | .channels_min = 2, |
| 1993 | .channels_max = 2, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1994 | /* NID + .substreams is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1995 | .ops = { |
| 1996 | .prepare = stac92xx_capture_pcm_prepare, |
| 1997 | .cleanup = stac92xx_capture_pcm_cleanup |
| 1998 | }, |
| 1999 | }; |
| 2000 | |
| 2001 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 2002 | { |
| 2003 | struct sigmatel_spec *spec = codec->spec; |
| 2004 | struct hda_pcm *info = spec->pcm_rec; |
| 2005 | |
| 2006 | codec->num_pcms = 1; |
| 2007 | codec->pcm_info = info; |
| 2008 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2009 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2010 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2011 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2012 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2013 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2014 | |
| 2015 | if (spec->alt_switch) { |
| 2016 | codec->num_pcms++; |
| 2017 | info++; |
| 2018 | info->name = "STAC92xx Analog Alt"; |
| 2019 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 2020 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2021 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2022 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 2023 | codec->num_pcms++; |
| 2024 | info++; |
| 2025 | info->name = "STAC92xx Digital"; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2026 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2027 | if (spec->multiout.dig_out_nid) { |
| 2028 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 2029 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2030 | } |
| 2031 | if (spec->dig_in_nid) { |
| 2032 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 2033 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2034 | } |
| 2035 | } |
| 2036 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2037 | return 0; |
| 2038 | } |
| 2039 | |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2040 | static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) |
| 2041 | { |
| 2042 | unsigned int pincap = snd_hda_param_read(codec, nid, |
| 2043 | AC_PAR_PIN_CAP); |
| 2044 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 2045 | if (pincap & AC_PINCAP_VREF_100) |
| 2046 | return AC_PINCTL_VREF_100; |
| 2047 | if (pincap & AC_PINCAP_VREF_80) |
| 2048 | return AC_PINCTL_VREF_80; |
| 2049 | if (pincap & AC_PINCAP_VREF_50) |
| 2050 | return AC_PINCTL_VREF_50; |
| 2051 | if (pincap & AC_PINCAP_VREF_GRD) |
| 2052 | return AC_PINCTL_VREF_GRD; |
| 2053 | return 0; |
| 2054 | } |
| 2055 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2056 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 2057 | |
| 2058 | { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2059 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2060 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2061 | } |
| 2062 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2063 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info |
| 2064 | |
| 2065 | static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, |
| 2066 | struct snd_ctl_elem_value *ucontrol) |
| 2067 | { |
| 2068 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2069 | struct sigmatel_spec *spec = codec->spec; |
| 2070 | |
| 2071 | ucontrol->value.integer.value[0] = spec->hp_switch; |
| 2072 | return 0; |
| 2073 | } |
| 2074 | |
| 2075 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, |
| 2076 | struct snd_ctl_elem_value *ucontrol) |
| 2077 | { |
| 2078 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2079 | struct sigmatel_spec *spec = codec->spec; |
| 2080 | |
| 2081 | spec->hp_switch = ucontrol->value.integer.value[0]; |
| 2082 | |
| 2083 | /* check to be sure that the ports are upto date with |
| 2084 | * switch changes |
| 2085 | */ |
| 2086 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
| 2087 | |
| 2088 | return 1; |
| 2089 | } |
| 2090 | |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 2091 | #define stac92xx_io_switch_info snd_ctl_boolean_mono_info |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2092 | |
| 2093 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2094 | { |
| 2095 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2096 | struct sigmatel_spec *spec = codec->spec; |
| 2097 | int io_idx = kcontrol-> private_value & 0xff; |
| 2098 | |
| 2099 | ucontrol->value.integer.value[0] = spec->io_switch[io_idx]; |
| 2100 | return 0; |
| 2101 | } |
| 2102 | |
| 2103 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2104 | { |
| 2105 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2106 | struct sigmatel_spec *spec = codec->spec; |
| 2107 | hda_nid_t nid = kcontrol->private_value >> 8; |
| 2108 | int io_idx = kcontrol-> private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2109 | unsigned short val = !!ucontrol->value.integer.value[0]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2110 | |
| 2111 | spec->io_switch[io_idx] = val; |
| 2112 | |
| 2113 | if (val) |
| 2114 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2115 | else { |
| 2116 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 2117 | if (io_idx) /* set VREF for mic */ |
| 2118 | pinctl |= stac92xx_get_vref(codec, nid); |
| 2119 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 2120 | } |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2121 | |
| 2122 | /* check the auto-mute again: we need to mute/unmute the speaker |
| 2123 | * appropriately according to the pin direction |
| 2124 | */ |
| 2125 | if (spec->hp_detect) |
| 2126 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
| 2127 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2128 | return 1; |
| 2129 | } |
| 2130 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2131 | #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info |
| 2132 | |
| 2133 | static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol, |
| 2134 | struct snd_ctl_elem_value *ucontrol) |
| 2135 | { |
| 2136 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2137 | struct sigmatel_spec *spec = codec->spec; |
| 2138 | |
| 2139 | ucontrol->value.integer.value[0] = spec->clfe_swap; |
| 2140 | return 0; |
| 2141 | } |
| 2142 | |
| 2143 | static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol, |
| 2144 | struct snd_ctl_elem_value *ucontrol) |
| 2145 | { |
| 2146 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2147 | struct sigmatel_spec *spec = codec->spec; |
| 2148 | hda_nid_t nid = kcontrol->private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2149 | unsigned int val = !!ucontrol->value.integer.value[0]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2150 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2151 | if (spec->clfe_swap == val) |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2152 | return 0; |
| 2153 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2154 | spec->clfe_swap = val; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2155 | |
| 2156 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 2157 | spec->clfe_swap ? 0x4 : 0x0); |
| 2158 | |
| 2159 | return 1; |
| 2160 | } |
| 2161 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2162 | #define STAC_CODEC_HP_SWITCH(xname) \ |
| 2163 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2164 | .name = xname, \ |
| 2165 | .index = 0, \ |
| 2166 | .info = stac92xx_hp_switch_info, \ |
| 2167 | .get = stac92xx_hp_switch_get, \ |
| 2168 | .put = stac92xx_hp_switch_put, \ |
| 2169 | } |
| 2170 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2171 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 2172 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2173 | .name = xname, \ |
| 2174 | .index = 0, \ |
| 2175 | .info = stac92xx_io_switch_info, \ |
| 2176 | .get = stac92xx_io_switch_get, \ |
| 2177 | .put = stac92xx_io_switch_put, \ |
| 2178 | .private_value = xpval, \ |
| 2179 | } |
| 2180 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2181 | #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \ |
| 2182 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2183 | .name = xname, \ |
| 2184 | .index = 0, \ |
| 2185 | .info = stac92xx_clfe_switch_info, \ |
| 2186 | .get = stac92xx_clfe_switch_get, \ |
| 2187 | .put = stac92xx_clfe_switch_put, \ |
| 2188 | .private_value = xpval, \ |
| 2189 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2190 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2191 | enum { |
| 2192 | STAC_CTL_WIDGET_VOL, |
| 2193 | STAC_CTL_WIDGET_MUTE, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2194 | STAC_CTL_WIDGET_MONO_MUX, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2195 | STAC_CTL_WIDGET_HP_SWITCH, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2196 | STAC_CTL_WIDGET_IO_SWITCH, |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2197 | STAC_CTL_WIDGET_CLFE_SWITCH |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2198 | }; |
| 2199 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2200 | static struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2201 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2202 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2203 | STAC_MONO_MUX, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2204 | STAC_CODEC_HP_SWITCH(NULL), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2205 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2206 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2207 | }; |
| 2208 | |
| 2209 | /* add dynamic controls */ |
| 2210 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val) |
| 2211 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2212 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2213 | |
| 2214 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 2215 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 2216 | |
| 2217 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ |
| 2218 | if (! knew) |
| 2219 | return -ENOMEM; |
| 2220 | if (spec->kctl_alloc) { |
| 2221 | memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); |
| 2222 | kfree(spec->kctl_alloc); |
| 2223 | } |
| 2224 | spec->kctl_alloc = knew; |
| 2225 | spec->num_kctl_alloc = num; |
| 2226 | } |
| 2227 | |
| 2228 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 2229 | *knew = stac92xx_control_templates[type]; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 2230 | knew->name = kstrdup(name, GFP_KERNEL); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2231 | if (! knew->name) |
| 2232 | return -ENOMEM; |
| 2233 | knew->private_value = val; |
| 2234 | spec->num_kctl_used++; |
| 2235 | return 0; |
| 2236 | } |
| 2237 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2238 | /* flag inputs as additional dynamic lineouts */ |
| 2239 | static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) |
| 2240 | { |
| 2241 | struct sigmatel_spec *spec = codec->spec; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2242 | unsigned int wcaps, wtype; |
| 2243 | int i, num_dacs = 0; |
| 2244 | |
| 2245 | /* use the wcaps cache to count all DACs available for line-outs */ |
| 2246 | for (i = 0; i < codec->num_nodes; i++) { |
| 2247 | wcaps = codec->wcaps[i]; |
| 2248 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2249 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2250 | if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL)) |
| 2251 | num_dacs++; |
| 2252 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2253 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2254 | snd_printdd("%s: total dac count=%d\n", __func__, num_dacs); |
| 2255 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2256 | switch (cfg->line_outs) { |
| 2257 | case 3: |
| 2258 | /* add line-in as side */ |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2259 | if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2260 | cfg->line_out_pins[cfg->line_outs] = |
| 2261 | cfg->input_pins[AUTO_PIN_LINE]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2262 | spec->line_switch = 1; |
| 2263 | cfg->line_outs++; |
| 2264 | } |
| 2265 | break; |
| 2266 | case 2: |
| 2267 | /* add line-in as clfe and mic as side */ |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2268 | if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2269 | cfg->line_out_pins[cfg->line_outs] = |
| 2270 | cfg->input_pins[AUTO_PIN_LINE]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2271 | spec->line_switch = 1; |
| 2272 | cfg->line_outs++; |
| 2273 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2274 | if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2275 | cfg->line_out_pins[cfg->line_outs] = |
| 2276 | cfg->input_pins[AUTO_PIN_MIC]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2277 | spec->mic_switch = 1; |
| 2278 | cfg->line_outs++; |
| 2279 | } |
| 2280 | break; |
| 2281 | case 1: |
| 2282 | /* add line-in as surr and mic as clfe */ |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2283 | if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2284 | cfg->line_out_pins[cfg->line_outs] = |
| 2285 | cfg->input_pins[AUTO_PIN_LINE]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2286 | spec->line_switch = 1; |
| 2287 | cfg->line_outs++; |
| 2288 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2289 | if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2290 | cfg->line_out_pins[cfg->line_outs] = |
| 2291 | cfg->input_pins[AUTO_PIN_MIC]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2292 | spec->mic_switch = 1; |
| 2293 | cfg->line_outs++; |
| 2294 | } |
| 2295 | break; |
| 2296 | } |
| 2297 | |
| 2298 | return 0; |
| 2299 | } |
| 2300 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2301 | |
| 2302 | static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2303 | { |
| 2304 | int i; |
| 2305 | |
| 2306 | for (i = 0; i < spec->multiout.num_dacs; i++) { |
| 2307 | if (spec->multiout.dac_nids[i] == nid) |
| 2308 | return 1; |
| 2309 | } |
| 2310 | |
| 2311 | return 0; |
| 2312 | } |
| 2313 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2314 | /* |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2315 | * Fill in the dac_nids table from the parsed pin configuration |
| 2316 | * This function only works when every pin in line_out_pins[] |
| 2317 | * contains atleast one DAC in its connection list. Some 92xx |
| 2318 | * codecs are not connected directly to a DAC, such as the 9200 |
| 2319 | * and 9202/925x. For those, dac_nids[] must be hard-coded. |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2320 | */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2321 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 2322 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2323 | { |
| 2324 | struct sigmatel_spec *spec = codec->spec; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2325 | int i, j, conn_len = 0; |
| 2326 | hda_nid_t nid, conn[HDA_MAX_CONNECTIONS]; |
| 2327 | unsigned int wcaps, wtype; |
| 2328 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2329 | for (i = 0; i < cfg->line_outs; i++) { |
| 2330 | nid = cfg->line_out_pins[i]; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2331 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 2332 | HDA_MAX_CONNECTIONS); |
| 2333 | for (j = 0; j < conn_len; j++) { |
| 2334 | wcaps = snd_hda_param_read(codec, conn[j], |
| 2335 | AC_PAR_AUDIO_WIDGET_CAP); |
| 2336 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2337 | if (wtype != AC_WID_AUD_OUT || |
| 2338 | (wcaps & AC_WCAP_DIGITAL)) |
| 2339 | continue; |
| 2340 | /* conn[j] is a DAC routed to this line-out */ |
| 2341 | if (!is_in_dac_nids(spec, conn[j])) |
| 2342 | break; |
| 2343 | } |
| 2344 | |
| 2345 | if (j == conn_len) { |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 2346 | if (spec->multiout.num_dacs > 0) { |
| 2347 | /* we have already working output pins, |
| 2348 | * so let's drop the broken ones again |
| 2349 | */ |
| 2350 | cfg->line_outs = spec->multiout.num_dacs; |
| 2351 | break; |
| 2352 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2353 | /* error out, no available DAC found */ |
| 2354 | snd_printk(KERN_ERR |
| 2355 | "%s: No available DAC for pin 0x%x\n", |
| 2356 | __func__, nid); |
| 2357 | return -ENODEV; |
| 2358 | } |
| 2359 | |
| 2360 | spec->multiout.dac_nids[i] = conn[j]; |
| 2361 | spec->multiout.num_dacs++; |
| 2362 | if (conn_len > 1) { |
| 2363 | /* select this DAC in the pin's input mux */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2364 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2365 | AC_VERB_SET_CONNECT_SEL, j); |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2366 | |
| 2367 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2368 | } |
| 2369 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2370 | snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", |
| 2371 | spec->multiout.num_dacs, |
| 2372 | spec->multiout.dac_nids[0], |
| 2373 | spec->multiout.dac_nids[1], |
| 2374 | spec->multiout.dac_nids[2], |
| 2375 | spec->multiout.dac_nids[3], |
| 2376 | spec->multiout.dac_nids[4]); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2377 | return 0; |
| 2378 | } |
| 2379 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2380 | /* create volume control/switch for the given prefx type */ |
| 2381 | static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs) |
| 2382 | { |
| 2383 | char name[32]; |
| 2384 | int err; |
| 2385 | |
| 2386 | sprintf(name, "%s Playback Volume", pfx); |
| 2387 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, |
| 2388 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 2389 | if (err < 0) |
| 2390 | return err; |
| 2391 | sprintf(name, "%s Playback Switch", pfx); |
| 2392 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, |
| 2393 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 2394 | if (err < 0) |
| 2395 | return err; |
| 2396 | return 0; |
| 2397 | } |
| 2398 | |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 2399 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2400 | { |
| 2401 | if (!spec->multiout.hp_nid) |
| 2402 | spec->multiout.hp_nid = nid; |
| 2403 | else if (spec->multiout.num_dacs > 4) { |
| 2404 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); |
| 2405 | return 1; |
| 2406 | } else { |
| 2407 | spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; |
| 2408 | spec->multiout.num_dacs++; |
| 2409 | } |
| 2410 | return 0; |
| 2411 | } |
| 2412 | |
| 2413 | static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2414 | { |
| 2415 | if (is_in_dac_nids(spec, nid)) |
| 2416 | return 1; |
| 2417 | if (spec->multiout.hp_nid == nid) |
| 2418 | return 1; |
| 2419 | return 0; |
| 2420 | } |
| 2421 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2422 | /* add playback controls from the parsed DAC table */ |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2423 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2424 | const struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2425 | { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2426 | static const char *chname[4] = { |
| 2427 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 2428 | }; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2429 | hda_nid_t nid; |
| 2430 | int i, err; |
| 2431 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2432 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 2433 | unsigned int wid_caps, pincap; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2434 | |
| 2435 | |
Takashi Iwai | 40ac8c4 | 2008-02-29 14:16:17 +0100 | [diff] [blame] | 2436 | for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2437 | if (!spec->multiout.dac_nids[i]) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2438 | continue; |
| 2439 | |
| 2440 | nid = spec->multiout.dac_nids[i]; |
| 2441 | |
| 2442 | if (i == 2) { |
| 2443 | /* Center/LFE */ |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2444 | err = create_controls(spec, "Center", nid, 1); |
| 2445 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2446 | return err; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2447 | err = create_controls(spec, "LFE", nid, 2); |
| 2448 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2449 | return err; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2450 | |
| 2451 | wid_caps = get_wcaps(codec, nid); |
| 2452 | |
| 2453 | if (wid_caps & AC_WCAP_LR_SWAP) { |
| 2454 | err = stac92xx_add_control(spec, |
| 2455 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 2456 | "Swap Center/LFE Playback Switch", nid); |
| 2457 | |
| 2458 | if (err < 0) |
| 2459 | return err; |
| 2460 | } |
| 2461 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2462 | } else { |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2463 | err = create_controls(spec, chname[i], nid, 3); |
| 2464 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2465 | return err; |
| 2466 | } |
| 2467 | } |
| 2468 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2469 | if (cfg->hp_outs > 1) { |
| 2470 | err = stac92xx_add_control(spec, |
| 2471 | STAC_CTL_WIDGET_HP_SWITCH, |
| 2472 | "Headphone as Line Out Switch", 0); |
| 2473 | if (err < 0) |
| 2474 | return err; |
| 2475 | } |
| 2476 | |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 2477 | if (spec->line_switch) { |
| 2478 | nid = cfg->input_pins[AUTO_PIN_LINE]; |
| 2479 | pincap = snd_hda_param_read(codec, nid, |
| 2480 | AC_PAR_PIN_CAP); |
| 2481 | if (pincap & AC_PINCAP_OUT) { |
| 2482 | err = stac92xx_add_control(spec, |
| 2483 | STAC_CTL_WIDGET_IO_SWITCH, |
| 2484 | "Line In as Output Switch", nid << 8); |
| 2485 | if (err < 0) |
| 2486 | return err; |
| 2487 | } |
| 2488 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2489 | |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 2490 | if (spec->mic_switch) { |
Matthew Ranostay | cace16f | 2008-01-30 14:58:38 +0100 | [diff] [blame] | 2491 | unsigned int def_conf; |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 2492 | unsigned int mic_pin = AUTO_PIN_MIC; |
| 2493 | again: |
| 2494 | nid = cfg->input_pins[mic_pin]; |
Matthew Ranostay | cace16f | 2008-01-30 14:58:38 +0100 | [diff] [blame] | 2495 | def_conf = snd_hda_codec_read(codec, nid, 0, |
| 2496 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
Matthew Ranostay | cace16f | 2008-01-30 14:58:38 +0100 | [diff] [blame] | 2497 | /* some laptops have an internal analog microphone |
| 2498 | * which can't be used as a output */ |
| 2499 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { |
| 2500 | pincap = snd_hda_param_read(codec, nid, |
| 2501 | AC_PAR_PIN_CAP); |
| 2502 | if (pincap & AC_PINCAP_OUT) { |
| 2503 | err = stac92xx_add_control(spec, |
| 2504 | STAC_CTL_WIDGET_IO_SWITCH, |
| 2505 | "Mic as Output Switch", (nid << 8) | 1); |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 2506 | nid = snd_hda_codec_read(codec, nid, 0, |
| 2507 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 2508 | if (!check_in_dac_nids(spec, nid)) |
| 2509 | add_spec_dacs(spec, nid); |
Matthew Ranostay | cace16f | 2008-01-30 14:58:38 +0100 | [diff] [blame] | 2510 | if (err < 0) |
| 2511 | return err; |
| 2512 | } |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 2513 | } else if (mic_pin == AUTO_PIN_MIC) { |
| 2514 | mic_pin = AUTO_PIN_FRONT_MIC; |
| 2515 | goto again; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 2516 | } |
| 2517 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2518 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2519 | return 0; |
| 2520 | } |
| 2521 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2522 | /* add playback controls for Speaker and HP outputs */ |
| 2523 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
| 2524 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2525 | { |
| 2526 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2527 | hda_nid_t nid; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2528 | int i, old_num_dacs, err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2529 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2530 | old_num_dacs = spec->multiout.num_dacs; |
| 2531 | for (i = 0; i < cfg->hp_outs; i++) { |
| 2532 | unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); |
| 2533 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
| 2534 | spec->hp_detect = 1; |
| 2535 | nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, |
| 2536 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 2537 | if (check_in_dac_nids(spec, nid)) |
| 2538 | nid = 0; |
| 2539 | if (! nid) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2540 | continue; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2541 | add_spec_dacs(spec, nid); |
| 2542 | } |
| 2543 | for (i = 0; i < cfg->speaker_outs; i++) { |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2544 | nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0, |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2545 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 2546 | if (check_in_dac_nids(spec, nid)) |
| 2547 | nid = 0; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2548 | if (! nid) |
| 2549 | continue; |
| 2550 | add_spec_dacs(spec, nid); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2551 | } |
Matthew Ranostay | 1b290a5 | 2007-07-12 15:17:34 +0200 | [diff] [blame] | 2552 | for (i = 0; i < cfg->line_outs; i++) { |
| 2553 | nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0, |
| 2554 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 2555 | if (check_in_dac_nids(spec, nid)) |
| 2556 | nid = 0; |
| 2557 | if (! nid) |
| 2558 | continue; |
| 2559 | add_spec_dacs(spec, nid); |
| 2560 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2561 | for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) { |
| 2562 | static const char *pfxs[] = { |
| 2563 | "Speaker", "External Speaker", "Speaker2", |
| 2564 | }; |
| 2565 | err = create_controls(spec, pfxs[i - old_num_dacs], |
| 2566 | spec->multiout.dac_nids[i], 3); |
| 2567 | if (err < 0) |
| 2568 | return err; |
| 2569 | } |
| 2570 | if (spec->multiout.hp_nid) { |
Takashi Iwai | 2626a26 | 2008-03-14 09:18:32 +0100 | [diff] [blame] | 2571 | err = create_controls(spec, "Headphone", |
| 2572 | spec->multiout.hp_nid, 3); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2573 | if (err < 0) |
| 2574 | return err; |
| 2575 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2576 | |
| 2577 | return 0; |
| 2578 | } |
| 2579 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 2580 | /* labels for mono mux outputs */ |
| 2581 | static const char *stac92xx_mono_labels[3] = { |
| 2582 | "DAC0", "DAC1", "Mixer" |
| 2583 | }; |
| 2584 | |
| 2585 | /* create mono mux for mono out on capable codecs */ |
| 2586 | static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) |
| 2587 | { |
| 2588 | struct sigmatel_spec *spec = codec->spec; |
| 2589 | struct hda_input_mux *mono_mux = &spec->private_mono_mux; |
| 2590 | int i, num_cons; |
| 2591 | hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)]; |
| 2592 | |
| 2593 | num_cons = snd_hda_get_connections(codec, |
| 2594 | spec->mono_nid, |
| 2595 | con_lst, |
| 2596 | HDA_MAX_NUM_INPUTS); |
| 2597 | if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) |
| 2598 | return -EINVAL; |
| 2599 | |
| 2600 | for (i = 0; i < num_cons; i++) { |
| 2601 | mono_mux->items[mono_mux->num_items].label = |
| 2602 | stac92xx_mono_labels[i]; |
| 2603 | mono_mux->items[mono_mux->num_items].index = i; |
| 2604 | mono_mux->num_items++; |
| 2605 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2606 | |
| 2607 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX, |
| 2608 | "Mono Mux", spec->mono_nid); |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 2609 | } |
| 2610 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2611 | /* labels for dmic mux inputs */ |
Adrian Bunk | ddc2cec | 2006-11-20 12:03:44 +0100 | [diff] [blame] | 2612 | static const char *stac92xx_dmic_labels[5] = { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2613 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
| 2614 | "Digital Mic 3", "Digital Mic 4" |
| 2615 | }; |
| 2616 | |
| 2617 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| 2618 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
| 2619 | const struct auto_pin_cfg *cfg) |
| 2620 | { |
| 2621 | struct sigmatel_spec *spec = codec->spec; |
| 2622 | struct hda_input_mux *dimux = &spec->private_dimux; |
| 2623 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 2624 | int err, i, j; |
| 2625 | char name[32]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2626 | |
| 2627 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; |
| 2628 | dimux->items[dimux->num_items].index = 0; |
| 2629 | dimux->num_items++; |
| 2630 | |
| 2631 | for (i = 0; i < spec->num_dmics; i++) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 2632 | hda_nid_t nid; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2633 | int index; |
| 2634 | int num_cons; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 2635 | unsigned int wcaps; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2636 | unsigned int def_conf; |
| 2637 | |
| 2638 | def_conf = snd_hda_codec_read(codec, |
| 2639 | spec->dmic_nids[i], |
| 2640 | 0, |
| 2641 | AC_VERB_GET_CONFIG_DEFAULT, |
| 2642 | 0); |
| 2643 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
| 2644 | continue; |
| 2645 | |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 2646 | nid = spec->dmic_nids[i]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2647 | num_cons = snd_hda_get_connections(codec, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 2648 | spec->dmux_nids[0], |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2649 | con_lst, |
| 2650 | HDA_MAX_NUM_INPUTS); |
| 2651 | for (j = 0; j < num_cons; j++) |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 2652 | if (con_lst[j] == nid) { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2653 | index = j; |
| 2654 | goto found; |
| 2655 | } |
| 2656 | continue; |
| 2657 | found: |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 2658 | wcaps = get_wcaps(codec, nid); |
| 2659 | |
| 2660 | if (wcaps & AC_WCAP_OUT_AMP) { |
| 2661 | sprintf(name, "%s Capture Volume", |
| 2662 | stac92xx_dmic_labels[dimux->num_items]); |
| 2663 | |
| 2664 | err = stac92xx_add_control(spec, |
| 2665 | STAC_CTL_WIDGET_VOL, |
| 2666 | name, |
| 2667 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 2668 | if (err < 0) |
| 2669 | return err; |
| 2670 | } |
| 2671 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2672 | dimux->items[dimux->num_items].label = |
| 2673 | stac92xx_dmic_labels[dimux->num_items]; |
| 2674 | dimux->items[dimux->num_items].index = index; |
| 2675 | dimux->num_items++; |
| 2676 | } |
| 2677 | |
| 2678 | return 0; |
| 2679 | } |
| 2680 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2681 | /* create playback/capture controls for input pins */ |
| 2682 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 2683 | { |
| 2684 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2685 | struct hda_input_mux *imux = &spec->private_imux; |
| 2686 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 2687 | int i, j, k; |
| 2688 | |
| 2689 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2690 | int index; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2691 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2692 | if (!cfg->input_pins[i]) |
| 2693 | continue; |
| 2694 | index = -1; |
| 2695 | for (j = 0; j < spec->num_muxes; j++) { |
| 2696 | int num_cons; |
| 2697 | num_cons = snd_hda_get_connections(codec, |
| 2698 | spec->mux_nids[j], |
| 2699 | con_lst, |
| 2700 | HDA_MAX_NUM_INPUTS); |
| 2701 | for (k = 0; k < num_cons; k++) |
| 2702 | if (con_lst[k] == cfg->input_pins[i]) { |
| 2703 | index = k; |
| 2704 | goto found; |
| 2705 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2706 | } |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2707 | continue; |
| 2708 | found: |
| 2709 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 2710 | imux->items[imux->num_items].index = index; |
| 2711 | imux->num_items++; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2712 | } |
| 2713 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2714 | if (imux->num_items) { |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 2715 | /* |
| 2716 | * Set the current input for the muxes. |
| 2717 | * The STAC9221 has two input muxes with identical source |
| 2718 | * NID lists. Hopefully this won't get confused. |
| 2719 | */ |
| 2720 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2721 | snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0, |
| 2722 | AC_VERB_SET_CONNECT_SEL, |
| 2723 | imux->items[0].index); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 2724 | } |
| 2725 | } |
| 2726 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2727 | return 0; |
| 2728 | } |
| 2729 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2730 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 2731 | { |
| 2732 | struct sigmatel_spec *spec = codec->spec; |
| 2733 | int i; |
| 2734 | |
| 2735 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 2736 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 2737 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 2738 | } |
| 2739 | } |
| 2740 | |
| 2741 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 2742 | { |
| 2743 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2744 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2745 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2746 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 2747 | hda_nid_t pin; |
| 2748 | pin = spec->autocfg.hp_pins[i]; |
| 2749 | if (pin) /* connect to front */ |
| 2750 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 2751 | } |
| 2752 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 2753 | hda_nid_t pin; |
| 2754 | pin = spec->autocfg.speaker_pins[i]; |
| 2755 | if (pin) /* connect to front */ |
| 2756 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); |
| 2757 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2758 | } |
| 2759 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2760 | static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2761 | { |
| 2762 | struct sigmatel_spec *spec = codec->spec; |
| 2763 | int err; |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 2764 | int hp_speaker_swap = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2765 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2766 | if ((err = snd_hda_parse_pin_def_config(codec, |
| 2767 | &spec->autocfg, |
| 2768 | spec->dmic_nids)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2769 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2770 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 2771 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2772 | |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 2773 | /* If we have no real line-out pin and multiple hp-outs, HPs should |
| 2774 | * be set up as multi-channel outputs. |
| 2775 | */ |
| 2776 | if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT && |
| 2777 | spec->autocfg.hp_outs > 1) { |
| 2778 | /* Copy hp_outs to line_outs, backup line_outs in |
| 2779 | * speaker_outs so that the following routines can handle |
| 2780 | * HP pins as primary outputs. |
| 2781 | */ |
| 2782 | memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins, |
| 2783 | sizeof(spec->autocfg.line_out_pins)); |
| 2784 | spec->autocfg.speaker_outs = spec->autocfg.line_outs; |
| 2785 | memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins, |
| 2786 | sizeof(spec->autocfg.hp_pins)); |
| 2787 | spec->autocfg.line_outs = spec->autocfg.hp_outs; |
| 2788 | hp_speaker_swap = 1; |
| 2789 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2790 | if (spec->autocfg.mono_out_pin) { |
| 2791 | int dir = (get_wcaps(codec, spec->autocfg.mono_out_pin) |
| 2792 | & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; |
| 2793 | u32 caps = query_amp_caps(codec, |
| 2794 | spec->autocfg.mono_out_pin, dir); |
| 2795 | hda_nid_t conn_list[1]; |
| 2796 | |
| 2797 | /* get the mixer node and then the mono mux if it exists */ |
| 2798 | if (snd_hda_get_connections(codec, |
| 2799 | spec->autocfg.mono_out_pin, conn_list, 1) && |
| 2800 | snd_hda_get_connections(codec, conn_list[0], |
| 2801 | conn_list, 1)) { |
| 2802 | |
| 2803 | int wcaps = get_wcaps(codec, conn_list[0]); |
| 2804 | int wid_type = (wcaps & AC_WCAP_TYPE) |
| 2805 | >> AC_WCAP_TYPE_SHIFT; |
| 2806 | /* LR swap check, some stac925x have a mux that |
| 2807 | * changes the DACs output path instead of the |
| 2808 | * mono-mux path. |
| 2809 | */ |
| 2810 | if (wid_type == AC_WID_AUD_SEL && |
| 2811 | !(wcaps & AC_WCAP_LR_SWAP)) |
| 2812 | spec->mono_nid = conn_list[0]; |
| 2813 | } |
| 2814 | /* all mono outs have a least a mute/unmute switch */ |
| 2815 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 2816 | "Mono Playback Switch", |
| 2817 | HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin, |
| 2818 | 1, 0, dir)); |
| 2819 | if (err < 0) |
| 2820 | return err; |
| 2821 | /* check to see if there is volume support for the amp */ |
| 2822 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 2823 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, |
| 2824 | "Mono Playback Volume", |
| 2825 | HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin, |
| 2826 | 1, 0, dir)); |
| 2827 | if (err < 0) |
| 2828 | return err; |
| 2829 | } |
| 2830 | |
| 2831 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, |
| 2832 | AC_PINCTL_OUT_EN); |
| 2833 | } |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 2834 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2835 | if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) |
| 2836 | return err; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2837 | if (spec->multiout.num_dacs == 0) |
| 2838 | if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) |
| 2839 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2840 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2841 | err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg); |
| 2842 | |
| 2843 | if (err < 0) |
| 2844 | return err; |
| 2845 | |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 2846 | if (hp_speaker_swap == 1) { |
| 2847 | /* Restore the hp_outs and line_outs */ |
| 2848 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, |
| 2849 | sizeof(spec->autocfg.line_out_pins)); |
| 2850 | spec->autocfg.hp_outs = spec->autocfg.line_outs; |
| 2851 | memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins, |
| 2852 | sizeof(spec->autocfg.speaker_pins)); |
| 2853 | spec->autocfg.line_outs = spec->autocfg.speaker_outs; |
| 2854 | memset(spec->autocfg.speaker_pins, 0, |
| 2855 | sizeof(spec->autocfg.speaker_pins)); |
| 2856 | spec->autocfg.speaker_outs = 0; |
| 2857 | } |
| 2858 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2859 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); |
| 2860 | |
| 2861 | if (err < 0) |
| 2862 | return err; |
| 2863 | |
| 2864 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); |
| 2865 | |
| 2866 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2867 | return err; |
| 2868 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 2869 | if (spec->mono_nid > 0) { |
| 2870 | err = stac92xx_auto_create_mono_output_ctls(codec); |
| 2871 | if (err < 0) |
| 2872 | return err; |
| 2873 | } |
| 2874 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2875 | if (spec->num_dmics > 0) |
| 2876 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
| 2877 | &spec->autocfg)) < 0) |
| 2878 | return err; |
| 2879 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2880 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2881 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2882 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2883 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2884 | if (spec->autocfg.dig_out_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2885 | spec->multiout.dig_out_nid = dig_out; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2886 | if (spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2887 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2888 | |
| 2889 | if (spec->kctl_alloc) |
| 2890 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 2891 | |
| 2892 | spec->input_mux = &spec->private_imux; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 2893 | if (!spec->dinput_mux) |
| 2894 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 2895 | spec->mono_mux = &spec->private_mono_mux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2896 | |
| 2897 | return 1; |
| 2898 | } |
| 2899 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2900 | /* add playback controls for HP output */ |
| 2901 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 2902 | struct auto_pin_cfg *cfg) |
| 2903 | { |
| 2904 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2905 | hda_nid_t pin = cfg->hp_pins[0]; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2906 | unsigned int wid_caps; |
| 2907 | |
| 2908 | if (! pin) |
| 2909 | return 0; |
| 2910 | |
| 2911 | wid_caps = get_wcaps(codec, pin); |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 2912 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2913 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2914 | |
| 2915 | return 0; |
| 2916 | } |
| 2917 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 2918 | /* add playback controls for LFE output */ |
| 2919 | static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, |
| 2920 | struct auto_pin_cfg *cfg) |
| 2921 | { |
| 2922 | struct sigmatel_spec *spec = codec->spec; |
| 2923 | int err; |
| 2924 | hda_nid_t lfe_pin = 0x0; |
| 2925 | int i; |
| 2926 | |
| 2927 | /* |
| 2928 | * search speaker outs and line outs for a mono speaker pin |
| 2929 | * with an amp. If one is found, add LFE controls |
| 2930 | * for it. |
| 2931 | */ |
| 2932 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
| 2933 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 2934 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 2935 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 2936 | if (wcaps == AC_WCAP_OUT_AMP) |
| 2937 | /* found a mono speaker with an amp, must be lfe */ |
| 2938 | lfe_pin = pin; |
| 2939 | } |
| 2940 | |
| 2941 | /* if speaker_outs is 0, then speakers may be in line_outs */ |
| 2942 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
| 2943 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
| 2944 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 2945 | unsigned int defcfg; |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 2946 | defcfg = snd_hda_codec_read(codec, pin, 0, |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 2947 | AC_VERB_GET_CONFIG_DEFAULT, |
| 2948 | 0x00); |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 2949 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 2950 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 2951 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 2952 | if (wcaps == AC_WCAP_OUT_AMP) |
| 2953 | /* found a mono speaker with an amp, |
| 2954 | must be lfe */ |
| 2955 | lfe_pin = pin; |
| 2956 | } |
| 2957 | } |
| 2958 | } |
| 2959 | |
| 2960 | if (lfe_pin) { |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2961 | err = create_controls(spec, "LFE", lfe_pin, 1); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 2962 | if (err < 0) |
| 2963 | return err; |
| 2964 | } |
| 2965 | |
| 2966 | return 0; |
| 2967 | } |
| 2968 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2969 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 2970 | { |
| 2971 | struct sigmatel_spec *spec = codec->spec; |
| 2972 | int err; |
| 2973 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2974 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2975 | return err; |
| 2976 | |
| 2977 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 2978 | return err; |
| 2979 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2980 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 2981 | return err; |
| 2982 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 2983 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
| 2984 | return err; |
| 2985 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2986 | if (spec->autocfg.dig_out_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2987 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2988 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2989 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2990 | |
| 2991 | if (spec->kctl_alloc) |
| 2992 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 2993 | |
| 2994 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2995 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2996 | |
| 2997 | return 1; |
| 2998 | } |
| 2999 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3000 | /* |
| 3001 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 3002 | * funky external mute control using GPIO pins. |
| 3003 | */ |
| 3004 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3005 | static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3006 | unsigned int dir_mask, unsigned int data) |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3007 | { |
| 3008 | unsigned int gpiostate, gpiomask, gpiodir; |
| 3009 | |
| 3010 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 3011 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3012 | gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3013 | |
| 3014 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 3015 | AC_VERB_GET_GPIO_MASK, 0); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3016 | gpiomask |= mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3017 | |
| 3018 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 3019 | AC_VERB_GET_GPIO_DIRECTION, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3020 | gpiodir |= dir_mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3021 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3022 | /* Configure GPIOx as CMOS */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3023 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 3024 | |
| 3025 | snd_hda_codec_write(codec, codec->afg, 0, |
| 3026 | AC_VERB_SET_GPIO_MASK, gpiomask); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3027 | snd_hda_codec_read(codec, codec->afg, 0, |
| 3028 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3029 | |
| 3030 | msleep(1); |
| 3031 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3032 | snd_hda_codec_read(codec, codec->afg, 0, |
| 3033 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3034 | } |
| 3035 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3036 | static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, |
| 3037 | unsigned int event) |
| 3038 | { |
| 3039 | if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 3040 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3041 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 3042 | (AC_USRSP_EN | event)); |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3043 | } |
| 3044 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3045 | static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) |
| 3046 | { |
| 3047 | int i; |
| 3048 | for (i = 0; i < cfg->hp_outs; i++) |
| 3049 | if (cfg->hp_pins[i] == nid) |
| 3050 | return 1; /* nid is a HP-Out */ |
| 3051 | |
| 3052 | return 0; /* nid is not a HP-Out */ |
| 3053 | }; |
| 3054 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 3055 | static void stac92xx_power_down(struct hda_codec *codec) |
| 3056 | { |
| 3057 | struct sigmatel_spec *spec = codec->spec; |
| 3058 | |
| 3059 | /* power down inactive DACs */ |
| 3060 | hda_nid_t *dac; |
| 3061 | for (dac = spec->dac_list; *dac; dac++) |
Matthew Ranostay | 4451089 | 2008-02-21 07:49:31 +0100 | [diff] [blame] | 3062 | if (!is_in_dac_nids(spec, *dac) && |
| 3063 | spec->multiout.hp_nid != *dac) |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 3064 | snd_hda_codec_write_cache(codec, *dac, 0, |
| 3065 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
| 3066 | } |
| 3067 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3068 | static int stac92xx_init(struct hda_codec *codec) |
| 3069 | { |
| 3070 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3071 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 3072 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3073 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3074 | snd_hda_sequence_write(codec, spec->init); |
| 3075 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3076 | /* set up pins */ |
| 3077 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 3078 | /* Enable unsolicited responses on the HP widget */ |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3079 | for (i = 0; i < cfg->hp_outs; i++) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3080 | enable_pin_detect(codec, cfg->hp_pins[i], |
| 3081 | STAC_HP_EVENT); |
Takashi Iwai | 0a07acaf | 2007-03-13 10:40:23 +0100 | [diff] [blame] | 3082 | /* force to enable the first line-out; the others are set up |
| 3083 | * in unsol_event |
| 3084 | */ |
| 3085 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
| 3086 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb995a8 | 2006-09-21 14:28:21 +0200 | [diff] [blame] | 3087 | stac92xx_auto_init_hp_out(codec); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3088 | /* fake event to set up pins */ |
| 3089 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
| 3090 | } else { |
| 3091 | stac92xx_auto_init_multi_out(codec); |
| 3092 | stac92xx_auto_init_hp_out(codec); |
| 3093 | } |
| 3094 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 3095 | hda_nid_t nid = cfg->input_pins[i]; |
| 3096 | if (nid) { |
| 3097 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 3098 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) |
| 3099 | pinctl |= stac92xx_get_vref(codec, nid); |
| 3100 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 3101 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3102 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3103 | for (i = 0; i < spec->num_dmics; i++) |
| 3104 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
| 3105 | AC_PINCTL_IN_EN); |
| 3106 | for (i = 0; i < spec->num_pwrs; i++) { |
| 3107 | int event = is_nid_hp_pin(cfg, spec->pwr_nids[i]) |
| 3108 | ? STAC_HP_EVENT : STAC_PWR_EVENT; |
| 3109 | int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], |
| 3110 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Matthew Ranostay | bce6c2b | 2008-02-29 12:07:43 +0100 | [diff] [blame] | 3111 | int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i], |
| 3112 | 0, AC_VERB_GET_CONFIG_DEFAULT, 0); |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 3113 | def_conf = get_defcfg_connect(def_conf); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3114 | /* outputs are only ports capable of power management |
| 3115 | * any attempts on powering down a input port cause the |
| 3116 | * referenced VREF to act quirky. |
| 3117 | */ |
| 3118 | if (pinctl & AC_PINCTL_IN_EN) |
| 3119 | continue; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 3120 | /* skip any ports that don't have jacks since presence |
| 3121 | * detection is useless */ |
| 3122 | if (def_conf && def_conf != AC_JACK_PORT_FIXED) |
Matthew Ranostay | bce6c2b | 2008-02-29 12:07:43 +0100 | [diff] [blame] | 3123 | continue; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3124 | enable_pin_detect(codec, spec->pwr_nids[i], event | i); |
| 3125 | codec->patch_ops.unsol_event(codec, (event | i) << 26); |
| 3126 | } |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 3127 | if (spec->dac_list) |
| 3128 | stac92xx_power_down(codec); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3129 | if (cfg->dig_out_pin) |
| 3130 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, |
| 3131 | AC_PINCTL_OUT_EN); |
| 3132 | if (cfg->dig_in_pin) |
| 3133 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 3134 | AC_PINCTL_IN_EN); |
| 3135 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3136 | stac_gpio_set(codec, spec->gpio_mask, |
| 3137 | spec->gpio_dir, spec->gpio_data); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3138 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3139 | return 0; |
| 3140 | } |
| 3141 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3142 | static void stac92xx_free(struct hda_codec *codec) |
| 3143 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3144 | struct sigmatel_spec *spec = codec->spec; |
| 3145 | int i; |
| 3146 | |
| 3147 | if (! spec) |
| 3148 | return; |
| 3149 | |
| 3150 | if (spec->kctl_alloc) { |
| 3151 | for (i = 0; i < spec->num_kctl_used; i++) |
| 3152 | kfree(spec->kctl_alloc[i].name); |
| 3153 | kfree(spec->kctl_alloc); |
| 3154 | } |
| 3155 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3156 | if (spec->bios_pin_configs) |
| 3157 | kfree(spec->bios_pin_configs); |
| 3158 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3159 | kfree(spec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3160 | } |
| 3161 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3162 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 3163 | unsigned int flag) |
| 3164 | { |
| 3165 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 3166 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3167 | |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 3168 | if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3169 | /* |
| 3170 | * we need to check the current set-up direction of |
| 3171 | * shared input pins since they can be switched via |
| 3172 | * "xxx as Output" mixer switch |
| 3173 | */ |
| 3174 | struct sigmatel_spec *spec = codec->spec; |
| 3175 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 3176 | if ((nid == cfg->input_pins[AUTO_PIN_LINE] && |
| 3177 | spec->line_switch) || |
| 3178 | (nid == cfg->input_pins[AUTO_PIN_MIC] && |
| 3179 | spec->mic_switch)) |
| 3180 | return; |
| 3181 | } |
| 3182 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3183 | /* if setting pin direction bits, clear the current |
| 3184 | direction bits first */ |
| 3185 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
| 3186 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 3187 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3188 | snd_hda_codec_write_cache(codec, nid, 0, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3189 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3190 | pin_ctl | flag); |
| 3191 | } |
| 3192 | |
| 3193 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 3194 | unsigned int flag) |
| 3195 | { |
| 3196 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 3197 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3198 | snd_hda_codec_write_cache(codec, nid, 0, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3199 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3200 | pin_ctl & ~flag); |
| 3201 | } |
| 3202 | |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 3203 | static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3204 | { |
| 3205 | if (!nid) |
| 3206 | return 0; |
| 3207 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 3208 | & (1 << 31)) { |
| 3209 | unsigned int pinctl; |
| 3210 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 3211 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3212 | if (pinctl & AC_PINCTL_IN_EN) |
| 3213 | return 0; /* mic- or line-input */ |
| 3214 | else |
| 3215 | return 1; /* HP-output */ |
| 3216 | } |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3217 | return 0; |
| 3218 | } |
| 3219 | |
| 3220 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3221 | { |
| 3222 | struct sigmatel_spec *spec = codec->spec; |
| 3223 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3224 | int nid = cfg->hp_pins[cfg->hp_outs - 1]; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3225 | int i, presence; |
| 3226 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3227 | presence = 0; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3228 | if (spec->gpio_mute) |
| 3229 | presence = !(snd_hda_codec_read(codec, codec->afg, 0, |
| 3230 | AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute); |
| 3231 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3232 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3233 | if (presence) |
| 3234 | break; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3235 | if (spec->hp_switch && cfg->hp_pins[i] == nid) |
| 3236 | break; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3237 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3238 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3239 | |
| 3240 | if (presence) { |
| 3241 | /* disable lineouts, enable hp */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3242 | if (spec->hp_switch) |
| 3243 | stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3244 | for (i = 0; i < cfg->line_outs; i++) |
| 3245 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 3246 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3247 | for (i = 0; i < cfg->speaker_outs; i++) |
| 3248 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
| 3249 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 3250 | if (spec->eapd_mask) |
| 3251 | stac_gpio_set(codec, spec->gpio_mask, |
| 3252 | spec->gpio_dir, spec->gpio_data & |
| 3253 | ~spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3254 | } else { |
| 3255 | /* enable lineouts, disable hp */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3256 | if (spec->hp_switch) |
| 3257 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3258 | for (i = 0; i < cfg->line_outs; i++) |
| 3259 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 3260 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3261 | for (i = 0; i < cfg->speaker_outs; i++) |
| 3262 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
| 3263 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 3264 | if (spec->eapd_mask) |
| 3265 | stac_gpio_set(codec, spec->gpio_mask, |
| 3266 | spec->gpio_dir, spec->gpio_data | |
| 3267 | spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3268 | } |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3269 | if (!spec->hp_switch && cfg->hp_outs > 1 && presence) |
| 3270 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3271 | } |
| 3272 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3273 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) |
| 3274 | { |
| 3275 | struct sigmatel_spec *spec = codec->spec; |
| 3276 | hda_nid_t nid = spec->pwr_nids[idx]; |
| 3277 | int presence, val; |
| 3278 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) |
| 3279 | & 0x000000ff; |
| 3280 | presence = get_hp_pin_presence(codec, nid); |
| 3281 | idx = 1 << idx; |
| 3282 | |
| 3283 | if (presence) |
| 3284 | val &= ~idx; |
| 3285 | else |
| 3286 | val |= idx; |
| 3287 | |
| 3288 | /* power down unused output ports */ |
| 3289 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); |
| 3290 | }; |
| 3291 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3292 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3293 | { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3294 | struct sigmatel_spec *spec = codec->spec; |
| 3295 | int idx = res >> 26 & 0x0f; |
| 3296 | |
| 3297 | switch ((res >> 26) & 0x30) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3298 | case STAC_HP_EVENT: |
| 3299 | stac92xx_hp_detect(codec, res); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3300 | /* fallthru */ |
| 3301 | case STAC_PWR_EVENT: |
| 3302 | if (spec->num_pwrs > 0) |
| 3303 | stac92xx_pin_sense(codec, idx); |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3304 | } |
| 3305 | } |
| 3306 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3307 | #ifdef SND_HDA_NEEDS_RESUME |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 3308 | static int stac92xx_resume(struct hda_codec *codec) |
| 3309 | { |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 3310 | struct sigmatel_spec *spec = codec->spec; |
| 3311 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3312 | stac92xx_set_config_regs(codec); |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 3313 | snd_hda_sequence_write(codec, spec->init); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3314 | stac_gpio_set(codec, spec->gpio_mask, |
| 3315 | spec->gpio_dir, spec->gpio_data); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3316 | snd_hda_codec_resume_amp(codec); |
| 3317 | snd_hda_codec_resume_cache(codec); |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 3318 | /* power down inactive DACs */ |
| 3319 | if (spec->dac_list) |
| 3320 | stac92xx_power_down(codec); |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 3321 | /* invoke unsolicited event to reset the HP state */ |
| 3322 | if (spec->hp_detect) |
| 3323 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 3324 | return 0; |
| 3325 | } |
| 3326 | #endif |
| 3327 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3328 | static struct hda_codec_ops stac92xx_patch_ops = { |
| 3329 | .build_controls = stac92xx_build_controls, |
| 3330 | .build_pcms = stac92xx_build_pcms, |
| 3331 | .init = stac92xx_init, |
| 3332 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 3333 | .unsol_event = stac92xx_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3334 | #ifdef SND_HDA_NEEDS_RESUME |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 3335 | .resume = stac92xx_resume, |
| 3336 | #endif |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3337 | }; |
| 3338 | |
| 3339 | static int patch_stac9200(struct hda_codec *codec) |
| 3340 | { |
| 3341 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3342 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3343 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3344 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3345 | if (spec == NULL) |
| 3346 | return -ENOMEM; |
| 3347 | |
| 3348 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 3349 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3350 | spec->pin_nids = stac9200_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3351 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
| 3352 | stac9200_models, |
| 3353 | stac9200_cfg_tbl); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3354 | if (spec->board_config < 0) { |
| 3355 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); |
| 3356 | err = stac92xx_save_bios_config_regs(codec); |
| 3357 | if (err < 0) { |
| 3358 | stac92xx_free(codec); |
| 3359 | return err; |
| 3360 | } |
| 3361 | spec->pin_configs = spec->bios_pin_configs; |
| 3362 | } else { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3363 | spec->pin_configs = stac9200_brd_tbl[spec->board_config]; |
| 3364 | stac92xx_set_config_regs(codec); |
| 3365 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3366 | |
| 3367 | spec->multiout.max_channels = 2; |
| 3368 | spec->multiout.num_dacs = 1; |
| 3369 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 3370 | spec->adc_nids = stac9200_adc_nids; |
| 3371 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 3372 | spec->num_muxes = 1; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3373 | spec->num_dmics = 0; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 3374 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3375 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3376 | |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 3377 | if (spec->board_config == STAC_9200_GATEWAY || |
| 3378 | spec->board_config == STAC_9200_OQO) |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 3379 | spec->init = stac9200_eapd_init; |
| 3380 | else |
| 3381 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3382 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3383 | |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 3384 | if (spec->board_config == STAC_9200_PANASONIC) { |
| 3385 | spec->gpio_mask = spec->gpio_dir = 0x09; |
| 3386 | spec->gpio_data = 0x00; |
| 3387 | } |
| 3388 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3389 | err = stac9200_parse_auto_config(codec); |
| 3390 | if (err < 0) { |
| 3391 | stac92xx_free(codec); |
| 3392 | return err; |
| 3393 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3394 | |
| 3395 | codec->patch_ops = stac92xx_patch_ops; |
| 3396 | |
| 3397 | return 0; |
| 3398 | } |
| 3399 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 3400 | static int patch_stac925x(struct hda_codec *codec) |
| 3401 | { |
| 3402 | struct sigmatel_spec *spec; |
| 3403 | int err; |
| 3404 | |
| 3405 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 3406 | if (spec == NULL) |
| 3407 | return -ENOMEM; |
| 3408 | |
| 3409 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 3410 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 3411 | spec->pin_nids = stac925x_pin_nids; |
| 3412 | spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, |
| 3413 | stac925x_models, |
| 3414 | stac925x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 3415 | again: |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 3416 | if (spec->board_config < 0) { |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 3417 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," |
| 3418 | "using BIOS defaults\n"); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 3419 | err = stac92xx_save_bios_config_regs(codec); |
| 3420 | if (err < 0) { |
| 3421 | stac92xx_free(codec); |
| 3422 | return err; |
| 3423 | } |
| 3424 | spec->pin_configs = spec->bios_pin_configs; |
| 3425 | } else if (stac925x_brd_tbl[spec->board_config] != NULL){ |
| 3426 | spec->pin_configs = stac925x_brd_tbl[spec->board_config]; |
| 3427 | stac92xx_set_config_regs(codec); |
| 3428 | } |
| 3429 | |
| 3430 | spec->multiout.max_channels = 2; |
| 3431 | spec->multiout.num_dacs = 1; |
| 3432 | spec->multiout.dac_nids = stac925x_dac_nids; |
| 3433 | spec->adc_nids = stac925x_adc_nids; |
| 3434 | spec->mux_nids = stac925x_mux_nids; |
| 3435 | spec->num_muxes = 1; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 3436 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3437 | spec->num_pwrs = 0; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 3438 | switch (codec->vendor_id) { |
| 3439 | case 0x83847632: /* STAC9202 */ |
| 3440 | case 0x83847633: /* STAC9202D */ |
| 3441 | case 0x83847636: /* STAC9251 */ |
| 3442 | case 0x83847637: /* STAC9251D */ |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 3443 | spec->num_dmics = STAC925X_NUM_DMICS; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 3444 | spec->dmic_nids = stac925x_dmic_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 3445 | spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids); |
| 3446 | spec->dmux_nids = stac925x_dmux_nids; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 3447 | break; |
| 3448 | default: |
| 3449 | spec->num_dmics = 0; |
| 3450 | break; |
| 3451 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 3452 | |
| 3453 | spec->init = stac925x_core_init; |
| 3454 | spec->mixer = stac925x_mixer; |
| 3455 | |
| 3456 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 3457 | if (!err) { |
| 3458 | if (spec->board_config < 0) { |
| 3459 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 3460 | "available, default to model=ref\n"); |
| 3461 | spec->board_config = STAC_925x_REF; |
| 3462 | goto again; |
| 3463 | } |
| 3464 | err = -EINVAL; |
| 3465 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 3466 | if (err < 0) { |
| 3467 | stac92xx_free(codec); |
| 3468 | return err; |
| 3469 | } |
| 3470 | |
| 3471 | codec->patch_ops = stac92xx_patch_ops; |
| 3472 | |
| 3473 | return 0; |
| 3474 | } |
| 3475 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3476 | static struct hda_input_mux stac92hd73xx_dmux = { |
| 3477 | .num_items = 4, |
| 3478 | .items = { |
| 3479 | { "Analog Inputs", 0x0b }, |
| 3480 | { "CD", 0x08 }, |
| 3481 | { "Digital Mic 1", 0x09 }, |
| 3482 | { "Digital Mic 2", 0x0a }, |
| 3483 | } |
| 3484 | }; |
| 3485 | |
| 3486 | static int patch_stac92hd73xx(struct hda_codec *codec) |
| 3487 | { |
| 3488 | struct sigmatel_spec *spec; |
| 3489 | hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; |
| 3490 | int err = 0; |
| 3491 | |
| 3492 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 3493 | if (spec == NULL) |
| 3494 | return -ENOMEM; |
| 3495 | |
| 3496 | codec->spec = spec; |
| 3497 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
| 3498 | spec->pin_nids = stac92hd73xx_pin_nids; |
| 3499 | spec->board_config = snd_hda_check_board_config(codec, |
| 3500 | STAC_92HD73XX_MODELS, |
| 3501 | stac92hd73xx_models, |
| 3502 | stac92hd73xx_cfg_tbl); |
| 3503 | again: |
| 3504 | if (spec->board_config < 0) { |
| 3505 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 3506 | " STAC92HD73XX, using BIOS defaults\n"); |
| 3507 | err = stac92xx_save_bios_config_regs(codec); |
| 3508 | if (err < 0) { |
| 3509 | stac92xx_free(codec); |
| 3510 | return err; |
| 3511 | } |
| 3512 | spec->pin_configs = spec->bios_pin_configs; |
| 3513 | } else { |
| 3514 | spec->pin_configs = stac92hd73xx_brd_tbl[spec->board_config]; |
| 3515 | stac92xx_set_config_regs(codec); |
| 3516 | } |
| 3517 | |
| 3518 | spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a, |
| 3519 | conn, STAC92HD73_DAC_COUNT + 2) - 1; |
| 3520 | |
| 3521 | if (spec->multiout.num_dacs < 0) { |
| 3522 | printk(KERN_WARNING "hda_codec: Could not determine " |
| 3523 | "number of channels defaulting to DAC count\n"); |
| 3524 | spec->multiout.num_dacs = STAC92HD73_DAC_COUNT; |
| 3525 | } |
| 3526 | |
| 3527 | switch (spec->multiout.num_dacs) { |
| 3528 | case 0x3: /* 6 Channel */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3529 | spec->multiout.hp_nid = 0x17; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3530 | spec->mixer = stac92hd73xx_6ch_mixer; |
| 3531 | spec->init = stac92hd73xx_6ch_core_init; |
| 3532 | break; |
| 3533 | case 0x4: /* 8 Channel */ |
| 3534 | spec->multiout.hp_nid = 0x18; |
| 3535 | spec->mixer = stac92hd73xx_8ch_mixer; |
| 3536 | spec->init = stac92hd73xx_8ch_core_init; |
| 3537 | break; |
| 3538 | case 0x5: /* 10 Channel */ |
| 3539 | spec->multiout.hp_nid = 0x19; |
| 3540 | spec->mixer = stac92hd73xx_10ch_mixer; |
| 3541 | spec->init = stac92hd73xx_10ch_core_init; |
| 3542 | }; |
| 3543 | |
| 3544 | spec->multiout.dac_nids = stac92hd73xx_dac_nids; |
| 3545 | spec->aloopback_mask = 0x01; |
| 3546 | spec->aloopback_shift = 8; |
| 3547 | |
| 3548 | spec->mux_nids = stac92hd73xx_mux_nids; |
| 3549 | spec->adc_nids = stac92hd73xx_adc_nids; |
| 3550 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
| 3551 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
| 3552 | |
| 3553 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
| 3554 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 3555 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3556 | spec->dinput_mux = &stac92hd73xx_dmux; |
| 3557 | /* GPIO0 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 3558 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3559 | spec->gpio_data = 0x01; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3560 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 3561 | switch (spec->board_config) { |
| 3562 | case STAC_DELL_M6: |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 3563 | spec->init = dell_eq_core_init; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 3564 | switch (codec->subsystem_id) { |
| 3565 | case 0x1028025e: /* Analog Mics */ |
| 3566 | case 0x1028025f: |
| 3567 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
| 3568 | spec->num_dmics = 0; |
| 3569 | break; |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 3570 | case 0x10280271: /* Digital Mics */ |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 3571 | case 0x10280272: |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 3572 | spec->init = dell_m6_core_init; |
| 3573 | /* fall-through */ |
| 3574 | case 0x10280254: |
| 3575 | case 0x10280255: |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 3576 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
| 3577 | spec->num_dmics = 1; |
| 3578 | break; |
| 3579 | case 0x10280256: /* Both */ |
| 3580 | case 0x10280057: |
| 3581 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
| 3582 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
| 3583 | spec->num_dmics = 1; |
| 3584 | break; |
| 3585 | } |
| 3586 | break; |
| 3587 | default: |
| 3588 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
| 3589 | } |
| 3590 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3591 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
| 3592 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
| 3593 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3594 | err = stac92xx_parse_auto_config(codec, 0x22, 0x24); |
| 3595 | |
| 3596 | if (!err) { |
| 3597 | if (spec->board_config < 0) { |
| 3598 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 3599 | "available, default to model=ref\n"); |
| 3600 | spec->board_config = STAC_92HD73XX_REF; |
| 3601 | goto again; |
| 3602 | } |
| 3603 | err = -EINVAL; |
| 3604 | } |
| 3605 | |
| 3606 | if (err < 0) { |
| 3607 | stac92xx_free(codec); |
| 3608 | return err; |
| 3609 | } |
| 3610 | |
| 3611 | codec->patch_ops = stac92xx_patch_ops; |
| 3612 | |
| 3613 | return 0; |
| 3614 | } |
| 3615 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 3616 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
| 3617 | { |
| 3618 | struct sigmatel_spec *spec; |
| 3619 | int err = 0; |
| 3620 | |
| 3621 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 3622 | if (spec == NULL) |
| 3623 | return -ENOMEM; |
| 3624 | |
| 3625 | codec->spec = spec; |
| 3626 | spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 3627 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 3628 | spec->pin_nids = stac92hd71bxx_pin_nids; |
| 3629 | spec->board_config = snd_hda_check_board_config(codec, |
| 3630 | STAC_92HD71BXX_MODELS, |
| 3631 | stac92hd71bxx_models, |
| 3632 | stac92hd71bxx_cfg_tbl); |
| 3633 | again: |
| 3634 | if (spec->board_config < 0) { |
| 3635 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 3636 | " STAC92HD71BXX, using BIOS defaults\n"); |
| 3637 | err = stac92xx_save_bios_config_regs(codec); |
| 3638 | if (err < 0) { |
| 3639 | stac92xx_free(codec); |
| 3640 | return err; |
| 3641 | } |
| 3642 | spec->pin_configs = spec->bios_pin_configs; |
| 3643 | } else { |
| 3644 | spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config]; |
| 3645 | stac92xx_set_config_regs(codec); |
| 3646 | } |
| 3647 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 3648 | switch (codec->vendor_id) { |
| 3649 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
| 3650 | case 0x111d76b7: |
| 3651 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
| 3652 | case 0x111d76b5: |
| 3653 | spec->mixer = stac92hd71bxx_mixer; |
| 3654 | spec->init = stac92hd71bxx_core_init; |
| 3655 | break; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 3656 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
| 3657 | /* no output amps */ |
| 3658 | spec->num_pwrs = 0; |
| 3659 | spec->mixer = stac92hd71bxx_analog_mixer; |
| 3660 | |
| 3661 | /* disable VSW */ |
| 3662 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; |
| 3663 | stac92xx_set_config_reg(codec, 0xf, 0x40f000f0); |
| 3664 | break; |
| 3665 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
| 3666 | /* no output amps */ |
| 3667 | spec->num_pwrs = 0; |
| 3668 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 3669 | default: |
| 3670 | spec->mixer = stac92hd71bxx_analog_mixer; |
| 3671 | spec->init = stac92hd71bxx_analog_core_init; |
| 3672 | } |
| 3673 | |
| 3674 | spec->aloopback_mask = 0x20; |
| 3675 | spec->aloopback_shift = 0; |
| 3676 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3677 | /* GPIO0 High = EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 3678 | spec->gpio_mask = 0x01; |
| 3679 | spec->gpio_dir = 0x01; |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 3680 | spec->gpio_data = 0x01; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 3681 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 3682 | spec->mux_nids = stac92hd71bxx_mux_nids; |
| 3683 | spec->adc_nids = stac92hd71bxx_adc_nids; |
| 3684 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3685 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 3686 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 3687 | |
| 3688 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
| 3689 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
| 3690 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 3691 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 3692 | |
Takashi Iwai | aea7bb0 | 2008-02-25 18:26:41 +0100 | [diff] [blame] | 3693 | spec->multiout.num_dacs = 1; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 3694 | spec->multiout.hp_nid = 0x11; |
| 3695 | spec->multiout.dac_nids = stac92hd71bxx_dac_nids; |
| 3696 | |
| 3697 | err = stac92xx_parse_auto_config(codec, 0x21, 0x23); |
| 3698 | if (!err) { |
| 3699 | if (spec->board_config < 0) { |
| 3700 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 3701 | "available, default to model=ref\n"); |
| 3702 | spec->board_config = STAC_92HD71BXX_REF; |
| 3703 | goto again; |
| 3704 | } |
| 3705 | err = -EINVAL; |
| 3706 | } |
| 3707 | |
| 3708 | if (err < 0) { |
| 3709 | stac92xx_free(codec); |
| 3710 | return err; |
| 3711 | } |
| 3712 | |
| 3713 | codec->patch_ops = stac92xx_patch_ops; |
| 3714 | |
| 3715 | return 0; |
| 3716 | }; |
| 3717 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3718 | static int patch_stac922x(struct hda_codec *codec) |
| 3719 | { |
| 3720 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3721 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3722 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3723 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3724 | if (spec == NULL) |
| 3725 | return -ENOMEM; |
| 3726 | |
| 3727 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 3728 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3729 | spec->pin_nids = stac922x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3730 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
| 3731 | stac922x_models, |
| 3732 | stac922x_cfg_tbl); |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 3733 | if (spec->board_config == STAC_INTEL_MAC_AUTO) { |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3734 | spec->gpio_mask = spec->gpio_dir = 0x03; |
| 3735 | spec->gpio_data = 0x03; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 3736 | /* Intel Macs have all same PCI SSID, so we need to check |
| 3737 | * codec SSID to distinguish the exact models |
| 3738 | */ |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 3739 | printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id); |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 3740 | switch (codec->subsystem_id) { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 3741 | |
| 3742 | case 0x106b0800: |
| 3743 | spec->board_config = STAC_INTEL_MAC_V1; |
Abhijit Bhopatkar | c45e20e | 2007-04-17 11:57:16 +0200 | [diff] [blame] | 3744 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 3745 | case 0x106b0600: |
| 3746 | case 0x106b0700: |
| 3747 | spec->board_config = STAC_INTEL_MAC_V2; |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 3748 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 3749 | case 0x106b0e00: |
| 3750 | case 0x106b0f00: |
| 3751 | case 0x106b1600: |
| 3752 | case 0x106b1700: |
| 3753 | case 0x106b0200: |
| 3754 | case 0x106b1e00: |
| 3755 | spec->board_config = STAC_INTEL_MAC_V3; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 3756 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 3757 | case 0x106b1a00: |
| 3758 | case 0x00000100: |
| 3759 | spec->board_config = STAC_INTEL_MAC_V4; |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 3760 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 3761 | case 0x106b0a00: |
| 3762 | case 0x106b2200: |
| 3763 | spec->board_config = STAC_INTEL_MAC_V5; |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 3764 | break; |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 3765 | default: |
| 3766 | spec->board_config = STAC_INTEL_MAC_V3; |
| 3767 | break; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 3768 | } |
| 3769 | } |
| 3770 | |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 3771 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3772 | if (spec->board_config < 0) { |
| 3773 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " |
| 3774 | "using BIOS defaults\n"); |
| 3775 | err = stac92xx_save_bios_config_regs(codec); |
| 3776 | if (err < 0) { |
| 3777 | stac92xx_free(codec); |
| 3778 | return err; |
| 3779 | } |
| 3780 | spec->pin_configs = spec->bios_pin_configs; |
| 3781 | } else if (stac922x_brd_tbl[spec->board_config] != NULL) { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3782 | spec->pin_configs = stac922x_brd_tbl[spec->board_config]; |
| 3783 | stac92xx_set_config_regs(codec); |
| 3784 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3785 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3786 | spec->adc_nids = stac922x_adc_nids; |
| 3787 | spec->mux_nids = stac922x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 3788 | spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 3789 | spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3790 | spec->num_dmics = 0; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3791 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3792 | |
| 3793 | spec->init = stac922x_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3794 | spec->mixer = stac922x_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3795 | |
| 3796 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3797 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3798 | err = stac92xx_parse_auto_config(codec, 0x08, 0x09); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 3799 | if (!err) { |
| 3800 | if (spec->board_config < 0) { |
| 3801 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 3802 | "available, default to model=ref\n"); |
| 3803 | spec->board_config = STAC_D945_REF; |
| 3804 | goto again; |
| 3805 | } |
| 3806 | err = -EINVAL; |
| 3807 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3808 | if (err < 0) { |
| 3809 | stac92xx_free(codec); |
| 3810 | return err; |
| 3811 | } |
| 3812 | |
| 3813 | codec->patch_ops = stac92xx_patch_ops; |
| 3814 | |
Takashi Iwai | 807a4636 | 2007-05-29 19:01:37 +0200 | [diff] [blame] | 3815 | /* Fix Mux capture level; max to 2 */ |
| 3816 | snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT, |
| 3817 | (0 << AC_AMPCAP_OFFSET_SHIFT) | |
| 3818 | (2 << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 3819 | (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 3820 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 3821 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3822 | return 0; |
| 3823 | } |
| 3824 | |
| 3825 | static int patch_stac927x(struct hda_codec *codec) |
| 3826 | { |
| 3827 | struct sigmatel_spec *spec; |
| 3828 | int err; |
| 3829 | |
| 3830 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 3831 | if (spec == NULL) |
| 3832 | return -ENOMEM; |
| 3833 | |
| 3834 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 3835 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3836 | spec->pin_nids = stac927x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3837 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
| 3838 | stac927x_models, |
| 3839 | stac927x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 3840 | again: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3841 | if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) { |
| 3842 | if (spec->board_config < 0) |
| 3843 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 3844 | "STAC927x, using BIOS defaults\n"); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3845 | err = stac92xx_save_bios_config_regs(codec); |
| 3846 | if (err < 0) { |
| 3847 | stac92xx_free(codec); |
| 3848 | return err; |
| 3849 | } |
| 3850 | spec->pin_configs = spec->bios_pin_configs; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3851 | } else { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3852 | spec->pin_configs = stac927x_brd_tbl[spec->board_config]; |
| 3853 | stac92xx_set_config_regs(codec); |
| 3854 | } |
| 3855 | |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3856 | spec->adc_nids = stac927x_adc_nids; |
| 3857 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
| 3858 | spec->mux_nids = stac927x_mux_nids; |
| 3859 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 3860 | spec->dac_list = stac927x_dac_nids; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3861 | spec->multiout.dac_nids = spec->dac_nids; |
| 3862 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 3863 | switch (spec->board_config) { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 3864 | case STAC_D965_3ST: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3865 | case STAC_D965_5ST: |
| 3866 | /* GPIO0 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 3867 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3868 | spec->gpio_data = 0x01; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3869 | spec->num_dmics = 0; |
| 3870 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 3871 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 3872 | spec->mixer = stac927x_mixer; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 3873 | break; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3874 | case STAC_DELL_BIOS: |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 3875 | switch (codec->subsystem_id) { |
| 3876 | case 0x10280209: |
| 3877 | case 0x1028022e: |
| 3878 | /* correct the device field to SPDIF out */ |
| 3879 | stac92xx_set_config_reg(codec, 0x21, 0x01442070); |
| 3880 | break; |
| 3881 | }; |
Matthew Ranostay | 03d7ca1 | 2008-02-21 07:51:46 +0100 | [diff] [blame] | 3882 | /* configure the analog microphone on some laptops */ |
| 3883 | stac92xx_set_config_reg(codec, 0x0c, 0x90a79130); |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 3884 | /* correct the front output jack as a hp out */ |
Matthew Ranostay | 7989fba | 2008-02-21 07:50:12 +0100 | [diff] [blame] | 3885 | stac92xx_set_config_reg(codec, 0x0f, 0x0227011f); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 3886 | /* correct the front input jack as a mic */ |
| 3887 | stac92xx_set_config_reg(codec, 0x0e, 0x02a79130); |
| 3888 | /* fallthru */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3889 | case STAC_DELL_3ST: |
| 3890 | /* GPIO2 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 3891 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3892 | spec->gpio_data = 0x04; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3893 | spec->dmic_nids = stac927x_dmic_nids; |
| 3894 | spec->num_dmics = STAC927X_NUM_DMICS; |
| 3895 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 3896 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 3897 | spec->mixer = stac927x_mixer; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3898 | spec->dmux_nids = stac927x_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 3899 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 3900 | break; |
| 3901 | default: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3902 | /* GPIO0 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 3903 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3904 | spec->gpio_data = 0x01; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3905 | spec->num_dmics = 0; |
| 3906 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 3907 | spec->init = stac927x_core_init; |
| 3908 | spec->mixer = stac927x_mixer; |
| 3909 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3910 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3911 | spec->num_pwrs = 0; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3912 | spec->aloopback_mask = 0x40; |
| 3913 | spec->aloopback_shift = 0; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 3914 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3915 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 3916 | if (!err) { |
| 3917 | if (spec->board_config < 0) { |
| 3918 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 3919 | "available, default to model=ref\n"); |
| 3920 | spec->board_config = STAC_D965_REF; |
| 3921 | goto again; |
| 3922 | } |
| 3923 | err = -EINVAL; |
| 3924 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3925 | if (err < 0) { |
| 3926 | stac92xx_free(codec); |
| 3927 | return err; |
| 3928 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3929 | |
| 3930 | codec->patch_ops = stac92xx_patch_ops; |
| 3931 | |
Takashi Iwai | 5298765 | 2008-01-16 16:09:47 +0100 | [diff] [blame] | 3932 | /* |
| 3933 | * !!FIXME!! |
| 3934 | * The STAC927x seem to require fairly long delays for certain |
| 3935 | * command sequences. With too short delays (even if the answer |
| 3936 | * is set to RIRB properly), it results in the silence output |
| 3937 | * on some hardwares like Dell. |
| 3938 | * |
| 3939 | * The below flag enables the longer delay (see get_response |
| 3940 | * in hda_intel.c). |
| 3941 | */ |
| 3942 | codec->bus->needs_damn_long_delay = 1; |
| 3943 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3944 | return 0; |
| 3945 | } |
| 3946 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 3947 | static int patch_stac9205(struct hda_codec *codec) |
| 3948 | { |
| 3949 | struct sigmatel_spec *spec; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 3950 | int err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 3951 | |
| 3952 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 3953 | if (spec == NULL) |
| 3954 | return -ENOMEM; |
| 3955 | |
| 3956 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 3957 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3958 | spec->pin_nids = stac9205_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3959 | spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, |
| 3960 | stac9205_models, |
| 3961 | stac9205_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 3962 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 3963 | if (spec->board_config < 0) { |
| 3964 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); |
| 3965 | err = stac92xx_save_bios_config_regs(codec); |
| 3966 | if (err < 0) { |
| 3967 | stac92xx_free(codec); |
| 3968 | return err; |
| 3969 | } |
| 3970 | spec->pin_configs = spec->bios_pin_configs; |
| 3971 | } else { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 3972 | spec->pin_configs = stac9205_brd_tbl[spec->board_config]; |
| 3973 | stac92xx_set_config_regs(codec); |
| 3974 | } |
| 3975 | |
| 3976 | spec->adc_nids = stac9205_adc_nids; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 3977 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 3978 | spec->mux_nids = stac9205_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 3979 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3980 | spec->dmic_nids = stac9205_dmic_nids; |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 3981 | spec->num_dmics = STAC9205_NUM_DMICS; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3982 | spec->dmux_nids = stac9205_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 3983 | spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3984 | spec->num_pwrs = 0; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 3985 | |
| 3986 | spec->init = stac9205_core_init; |
| 3987 | spec->mixer = stac9205_mixer; |
| 3988 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3989 | spec->aloopback_mask = 0x40; |
| 3990 | spec->aloopback_shift = 0; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 3991 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 3992 | |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 3993 | switch (spec->board_config){ |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 3994 | case STAC_9205_DELL_M43: |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 3995 | /* Enable SPDIF in/out */ |
| 3996 | stac92xx_set_config_reg(codec, 0x1f, 0x01441030); |
| 3997 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); |
Matt Porter | 3338240 | 2006-12-18 13:17:28 +0100 | [diff] [blame] | 3998 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3999 | /* Enable unsol response for GPIO4/Dock HP connection */ |
| 4000 | snd_hda_codec_write(codec, codec->afg, 0, |
| 4001 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
| 4002 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 4003 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 4004 | (AC_USRSP_EN | STAC_HP_EVENT)); |
| 4005 | |
| 4006 | spec->gpio_dir = 0x0b; |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4007 | spec->eapd_mask = 0x01; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4008 | spec->gpio_mask = 0x1b; |
| 4009 | spec->gpio_mute = 0x10; |
Matthew Ranostay | e2e7d62 | 2008-01-24 15:32:15 +0100 | [diff] [blame] | 4010 | /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4011 | * GPIO3 Low = DRM |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 4012 | */ |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4013 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 4014 | break; |
| 4015 | default: |
| 4016 | /* GPIO0 High = EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4017 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4018 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 4019 | break; |
| 4020 | } |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 4021 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 4022 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 4023 | if (!err) { |
| 4024 | if (spec->board_config < 0) { |
| 4025 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4026 | "available, default to model=ref\n"); |
| 4027 | spec->board_config = STAC_9205_REF; |
| 4028 | goto again; |
| 4029 | } |
| 4030 | err = -EINVAL; |
| 4031 | } |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 4032 | if (err < 0) { |
| 4033 | stac92xx_free(codec); |
| 4034 | return err; |
| 4035 | } |
| 4036 | |
| 4037 | codec->patch_ops = stac92xx_patch_ops; |
| 4038 | |
| 4039 | return 0; |
| 4040 | } |
| 4041 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4042 | /* |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4043 | * STAC9872 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4044 | */ |
| 4045 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 4046 | /* static config for Sony VAIO FE550G and Sony VAIO AR */ |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4047 | static hda_nid_t vaio_dacs[] = { 0x2 }; |
| 4048 | #define VAIO_HP_DAC 0x5 |
| 4049 | static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ }; |
| 4050 | static hda_nid_t vaio_mux_nids[] = { 0x15 }; |
| 4051 | |
| 4052 | static struct hda_input_mux vaio_mux = { |
Takashi Iwai | a3a2f42 | 2007-10-11 11:21:21 +0200 | [diff] [blame] | 4053 | .num_items = 3, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4054 | .items = { |
Takashi Iwai | d773781 | 2006-04-25 13:05:43 +0200 | [diff] [blame] | 4055 | /* { "HP", 0x0 }, */ |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 4056 | { "Mic Jack", 0x1 }, |
| 4057 | { "Internal Mic", 0x2 }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4058 | { "PCM", 0x3 }, |
| 4059 | } |
| 4060 | }; |
| 4061 | |
| 4062 | static struct hda_verb vaio_init[] = { |
| 4063 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 4064 | {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT}, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4065 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
| 4066 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
| 4067 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
| 4068 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 4069 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4070 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ |
| 4071 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ |
| 4072 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ |
| 4073 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ |
| 4074 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 4075 | {} |
| 4076 | }; |
| 4077 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4078 | static struct hda_verb vaio_ar_init[] = { |
| 4079 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
| 4080 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
| 4081 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
| 4082 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
| 4083 | /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */ |
| 4084 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 4085 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4086 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ |
| 4087 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ |
| 4088 | /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */ |
| 4089 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ |
| 4090 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ |
| 4091 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 4092 | {} |
| 4093 | }; |
| 4094 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4095 | /* bind volumes of both NID 0x02 and 0x05 */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 4096 | static struct hda_bind_ctls vaio_bind_master_vol = { |
| 4097 | .ops = &snd_hda_bind_vol, |
| 4098 | .values = { |
| 4099 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 4100 | HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), |
| 4101 | 0 |
| 4102 | }, |
| 4103 | }; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4104 | |
| 4105 | /* bind volumes of both NID 0x02 and 0x05 */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 4106 | static struct hda_bind_ctls vaio_bind_master_sw = { |
| 4107 | .ops = &snd_hda_bind_sw, |
| 4108 | .values = { |
| 4109 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 4110 | HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), |
| 4111 | 0, |
| 4112 | }, |
| 4113 | }; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4114 | |
| 4115 | static struct snd_kcontrol_new vaio_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 4116 | HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), |
| 4117 | HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4118 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
| 4119 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 4120 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
| 4121 | { |
| 4122 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4123 | .name = "Capture Source", |
| 4124 | .count = 1, |
| 4125 | .info = stac92xx_mux_enum_info, |
| 4126 | .get = stac92xx_mux_enum_get, |
| 4127 | .put = stac92xx_mux_enum_put, |
| 4128 | }, |
| 4129 | {} |
| 4130 | }; |
| 4131 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4132 | static struct snd_kcontrol_new vaio_ar_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 4133 | HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), |
| 4134 | HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4135 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
| 4136 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 4137 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
| 4138 | /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT), |
| 4139 | HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/ |
| 4140 | { |
| 4141 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4142 | .name = "Capture Source", |
| 4143 | .count = 1, |
| 4144 | .info = stac92xx_mux_enum_info, |
| 4145 | .get = stac92xx_mux_enum_get, |
| 4146 | .put = stac92xx_mux_enum_put, |
| 4147 | }, |
| 4148 | {} |
| 4149 | }; |
| 4150 | |
| 4151 | static struct hda_codec_ops stac9872_patch_ops = { |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4152 | .build_controls = stac92xx_build_controls, |
| 4153 | .build_pcms = stac92xx_build_pcms, |
| 4154 | .init = stac92xx_init, |
| 4155 | .free = stac92xx_free, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4156 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4157 | .resume = stac92xx_resume, |
| 4158 | #endif |
| 4159 | }; |
| 4160 | |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 4161 | static int stac9872_vaio_init(struct hda_codec *codec) |
| 4162 | { |
| 4163 | int err; |
| 4164 | |
| 4165 | err = stac92xx_init(codec); |
| 4166 | if (err < 0) |
| 4167 | return err; |
| 4168 | if (codec->patch_ops.unsol_event) |
| 4169 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
| 4170 | return 0; |
| 4171 | } |
| 4172 | |
| 4173 | static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res) |
| 4174 | { |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 4175 | if (get_hp_pin_presence(codec, 0x0a)) { |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 4176 | stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); |
| 4177 | stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); |
| 4178 | } else { |
| 4179 | stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); |
| 4180 | stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); |
| 4181 | } |
| 4182 | } |
| 4183 | |
| 4184 | static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4185 | { |
| 4186 | switch (res >> 26) { |
| 4187 | case STAC_HP_EVENT: |
| 4188 | stac9872_vaio_hp_detect(codec, res); |
| 4189 | break; |
| 4190 | } |
| 4191 | } |
| 4192 | |
| 4193 | static struct hda_codec_ops stac9872_vaio_patch_ops = { |
| 4194 | .build_controls = stac92xx_build_controls, |
| 4195 | .build_pcms = stac92xx_build_pcms, |
| 4196 | .init = stac9872_vaio_init, |
| 4197 | .free = stac92xx_free, |
| 4198 | .unsol_event = stac9872_vaio_unsol_event, |
| 4199 | #ifdef CONFIG_PM |
| 4200 | .resume = stac92xx_resume, |
| 4201 | #endif |
| 4202 | }; |
| 4203 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4204 | enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ |
| 4205 | CXD9872RD_VAIO, |
| 4206 | /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ |
| 4207 | STAC9872AK_VAIO, |
| 4208 | /* Unknown. id=0x83847661 and subsys=0x104D1200. */ |
| 4209 | STAC9872K_VAIO, |
| 4210 | /* AR Series. id=0x83847664 and subsys=104D1300 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4211 | CXD9872AKD_VAIO, |
| 4212 | STAC_9872_MODELS, |
| 4213 | }; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4214 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4215 | static const char *stac9872_models[STAC_9872_MODELS] = { |
| 4216 | [CXD9872RD_VAIO] = "vaio", |
| 4217 | [CXD9872AKD_VAIO] = "vaio-ar", |
| 4218 | }; |
| 4219 | |
| 4220 | static struct snd_pci_quirk stac9872_cfg_tbl[] = { |
| 4221 | SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO), |
| 4222 | SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO), |
| 4223 | SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO), |
Tobin Davis | 68e2254 | 2007-03-12 11:36:39 +0100 | [diff] [blame] | 4224 | SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO), |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4225 | {} |
| 4226 | }; |
| 4227 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4228 | static int patch_stac9872(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4229 | { |
| 4230 | struct sigmatel_spec *spec; |
| 4231 | int board_config; |
| 4232 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4233 | board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, |
| 4234 | stac9872_models, |
| 4235 | stac9872_cfg_tbl); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4236 | if (board_config < 0) |
| 4237 | /* unknown config, let generic-parser do its job... */ |
| 4238 | return snd_hda_parse_generic_codec(codec); |
| 4239 | |
| 4240 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4241 | if (spec == NULL) |
| 4242 | return -ENOMEM; |
| 4243 | |
| 4244 | codec->spec = spec; |
| 4245 | switch (board_config) { |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4246 | case CXD9872RD_VAIO: |
| 4247 | case STAC9872AK_VAIO: |
| 4248 | case STAC9872K_VAIO: |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4249 | spec->mixer = vaio_mixer; |
| 4250 | spec->init = vaio_init; |
| 4251 | spec->multiout.max_channels = 2; |
| 4252 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); |
| 4253 | spec->multiout.dac_nids = vaio_dacs; |
| 4254 | spec->multiout.hp_nid = VAIO_HP_DAC; |
| 4255 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); |
| 4256 | spec->adc_nids = vaio_adcs; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4257 | spec->num_pwrs = 0; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4258 | spec->input_mux = &vaio_mux; |
| 4259 | spec->mux_nids = vaio_mux_nids; |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 4260 | codec->patch_ops = stac9872_vaio_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4261 | break; |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4262 | |
| 4263 | case CXD9872AKD_VAIO: |
| 4264 | spec->mixer = vaio_ar_mixer; |
| 4265 | spec->init = vaio_ar_init; |
| 4266 | spec->multiout.max_channels = 2; |
| 4267 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); |
| 4268 | spec->multiout.dac_nids = vaio_dacs; |
| 4269 | spec->multiout.hp_nid = VAIO_HP_DAC; |
| 4270 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4271 | spec->num_pwrs = 0; |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4272 | spec->adc_nids = vaio_adcs; |
| 4273 | spec->input_mux = &vaio_mux; |
| 4274 | spec->mux_nids = vaio_mux_nids; |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 4275 | codec->patch_ops = stac9872_patch_ops; |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4276 | break; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4277 | } |
| 4278 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 4279 | return 0; |
| 4280 | } |
| 4281 | |
| 4282 | |
| 4283 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4284 | * patch entries |
| 4285 | */ |
| 4286 | struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
| 4287 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 4288 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 4289 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 4290 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 4291 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 4292 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 4293 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 4294 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 4295 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 4296 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 4297 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 4298 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 4299 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 4300 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 4301 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 4302 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 4303 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 4304 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 4305 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 4306 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 4307 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 4308 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 4309 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4310 | { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, |
| 4311 | { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, |
| 4312 | { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x }, |
| 4313 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
| 4314 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
| 4315 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
Takashi Iwai | 7bd3c0f | 2008-05-02 12:28:02 +0200 | [diff] [blame] | 4316 | { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x }, |
| 4317 | { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x }, |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 4318 | /* The following does not take into account .id=0x83847661 when subsys = |
| 4319 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
| 4320 | * currently not fully supported. |
| 4321 | */ |
| 4322 | { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, |
| 4323 | { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, |
| 4324 | { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 4325 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 4326 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 4327 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 4328 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 4329 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 4330 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 4331 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 4332 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 4333 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, |
| 4334 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 4335 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, |
| 4336 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4337 | { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 4338 | { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 4339 | { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 4340 | { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 4341 | { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 4342 | { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 4343 | { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 4344 | { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
| 4345 | { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4346 | {} /* terminator */ |
| 4347 | }; |