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 | |
| 27 | #include <sound/driver.h> |
| 28 | #include <linux/init.h> |
| 29 | #include <linux/delay.h> |
| 30 | #include <linux/slab.h> |
| 31 | #include <linux/pci.h> |
| 32 | #include <sound/core.h> |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 33 | #include <sound/asoundef.h> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 34 | #include "hda_codec.h" |
| 35 | #include "hda_local.h" |
| 36 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 37 | #define NUM_CONTROL_ALLOC 32 |
| 38 | #define STAC_HP_EVENT 0x37 |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 39 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 40 | enum { |
| 41 | STAC_REF, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 42 | STAC_9200_DELL_D21, |
| 43 | STAC_9200_DELL_D22, |
| 44 | STAC_9200_DELL_D23, |
| 45 | STAC_9200_DELL_M21, |
| 46 | STAC_9200_DELL_M22, |
| 47 | STAC_9200_DELL_M23, |
| 48 | STAC_9200_DELL_M24, |
| 49 | STAC_9200_DELL_M25, |
| 50 | STAC_9200_DELL_M26, |
| 51 | STAC_9200_DELL_M27, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 52 | STAC_9200_MODELS |
| 53 | }; |
| 54 | |
| 55 | enum { |
| 56 | STAC_9205_REF, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 57 | STAC_9205_DELL_M42, |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 58 | STAC_9205_DELL_M43, |
| 59 | STAC_9205_DELL_M44, |
| 60 | STAC_9205_M43xx, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 61 | STAC_9205_MODELS |
| 62 | }; |
| 63 | |
| 64 | enum { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 65 | STAC_925x_REF, |
| 66 | STAC_M2_2, |
| 67 | STAC_MA6, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 68 | STAC_PA6, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 69 | STAC_925x_MODELS |
| 70 | }; |
| 71 | |
| 72 | enum { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 73 | STAC_D945_REF, |
| 74 | STAC_D945GTP3, |
| 75 | STAC_D945GTP5, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 76 | STAC_INTEL_MAC_V1, |
| 77 | STAC_INTEL_MAC_V2, |
| 78 | STAC_INTEL_MAC_V3, |
| 79 | STAC_INTEL_MAC_V4, |
| 80 | STAC_INTEL_MAC_V5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 81 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 82 | STAC_MACMINI, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 83 | STAC_MACBOOK, |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 84 | STAC_MACBOOK_PRO_V1, |
| 85 | STAC_MACBOOK_PRO_V2, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 86 | STAC_IMAC_INTEL, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 87 | STAC_IMAC_INTEL_20, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 88 | STAC_922X_DELL_D81, |
| 89 | STAC_922X_DELL_D82, |
| 90 | STAC_922X_DELL_M81, |
| 91 | STAC_922X_DELL_M82, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 92 | STAC_922X_MODELS |
| 93 | }; |
| 94 | |
| 95 | enum { |
| 96 | STAC_D965_REF, |
| 97 | STAC_D965_3ST, |
| 98 | STAC_D965_5ST, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 99 | STAC_DELL_3ST, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 100 | STAC_927X_MODELS |
| 101 | }; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 102 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 103 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 104 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 105 | unsigned int num_mixers; |
| 106 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 107 | int board_config; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 108 | unsigned int surr_switch: 1; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 109 | unsigned int line_switch: 1; |
| 110 | unsigned int mic_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 111 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 112 | unsigned int hp_detect: 1; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 113 | unsigned int gpio_mute: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 114 | |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 115 | unsigned int gpio_mask, gpio_data; |
| 116 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 117 | /* playback */ |
| 118 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 119 | hda_nid_t dac_nids[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 120 | |
| 121 | /* capture */ |
| 122 | hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 123 | unsigned int num_adcs; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 124 | hda_nid_t *mux_nids; |
| 125 | unsigned int num_muxes; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 126 | hda_nid_t *dmic_nids; |
| 127 | unsigned int num_dmics; |
| 128 | hda_nid_t dmux_nid; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 129 | hda_nid_t dig_in_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 130 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 131 | /* pin widgets */ |
| 132 | hda_nid_t *pin_nids; |
| 133 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 134 | unsigned int *pin_configs; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 135 | unsigned int *bios_pin_configs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 136 | |
| 137 | /* codec specific stuff */ |
| 138 | struct hda_verb *init; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 139 | struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 140 | |
| 141 | /* capture source */ |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 142 | struct hda_input_mux *dinput_mux; |
| 143 | unsigned int cur_dmux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 144 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 145 | unsigned int cur_mux[3]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 146 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 147 | /* i/o switches */ |
| 148 | unsigned int io_switch[2]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 149 | unsigned int clfe_swap; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 150 | unsigned int aloopback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 151 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 152 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 153 | |
| 154 | /* dynamic controls and input_mux */ |
| 155 | struct auto_pin_cfg autocfg; |
| 156 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 157 | struct snd_kcontrol_new *kctl_alloc; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 158 | struct hda_input_mux private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 159 | struct hda_input_mux private_imux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 160 | }; |
| 161 | |
| 162 | static hda_nid_t stac9200_adc_nids[1] = { |
| 163 | 0x03, |
| 164 | }; |
| 165 | |
| 166 | static hda_nid_t stac9200_mux_nids[1] = { |
| 167 | 0x0c, |
| 168 | }; |
| 169 | |
| 170 | static hda_nid_t stac9200_dac_nids[1] = { |
| 171 | 0x02, |
| 172 | }; |
| 173 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 174 | static hda_nid_t stac925x_adc_nids[1] = { |
| 175 | 0x03, |
| 176 | }; |
| 177 | |
| 178 | static hda_nid_t stac925x_mux_nids[1] = { |
| 179 | 0x0f, |
| 180 | }; |
| 181 | |
| 182 | static hda_nid_t stac925x_dac_nids[1] = { |
| 183 | 0x02, |
| 184 | }; |
| 185 | |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 186 | static hda_nid_t stac925x_dmic_nids[1] = { |
| 187 | 0x15, |
| 188 | }; |
| 189 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 190 | static hda_nid_t stac922x_adc_nids[2] = { |
| 191 | 0x06, 0x07, |
| 192 | }; |
| 193 | |
| 194 | static hda_nid_t stac922x_mux_nids[2] = { |
| 195 | 0x12, 0x13, |
| 196 | }; |
| 197 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 198 | static hda_nid_t stac927x_adc_nids[3] = { |
| 199 | 0x07, 0x08, 0x09 |
| 200 | }; |
| 201 | |
| 202 | static hda_nid_t stac927x_mux_nids[3] = { |
| 203 | 0x15, 0x16, 0x17 |
| 204 | }; |
| 205 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 206 | static hda_nid_t stac9205_adc_nids[2] = { |
| 207 | 0x12, 0x13 |
| 208 | }; |
| 209 | |
| 210 | static hda_nid_t stac9205_mux_nids[2] = { |
| 211 | 0x19, 0x1a |
| 212 | }; |
| 213 | |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 214 | static hda_nid_t stac9205_dmic_nids[2] = { |
| 215 | 0x17, 0x18, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 216 | }; |
| 217 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 218 | static hda_nid_t stac9200_pin_nids[8] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 219 | 0x08, 0x09, 0x0d, 0x0e, |
| 220 | 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 221 | }; |
| 222 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 223 | static hda_nid_t stac925x_pin_nids[8] = { |
| 224 | 0x07, 0x08, 0x0a, 0x0b, |
| 225 | 0x0c, 0x0d, 0x10, 0x11, |
| 226 | }; |
| 227 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 228 | static hda_nid_t stac922x_pin_nids[10] = { |
| 229 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 230 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 231 | }; |
| 232 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 233 | static hda_nid_t stac927x_pin_nids[14] = { |
| 234 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 235 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 236 | 0x14, 0x21, 0x22, 0x23, |
| 237 | }; |
| 238 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 239 | static hda_nid_t stac9205_pin_nids[12] = { |
| 240 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 241 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 242 | 0x21, 0x22, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 243 | }; |
| 244 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 245 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
| 246 | struct snd_ctl_elem_info *uinfo) |
| 247 | { |
| 248 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 249 | struct sigmatel_spec *spec = codec->spec; |
| 250 | return snd_hda_input_mux_info(spec->dinput_mux, uinfo); |
| 251 | } |
| 252 | |
| 253 | static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, |
| 254 | struct snd_ctl_elem_value *ucontrol) |
| 255 | { |
| 256 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 257 | struct sigmatel_spec *spec = codec->spec; |
| 258 | |
| 259 | ucontrol->value.enumerated.item[0] = spec->cur_dmux; |
| 260 | return 0; |
| 261 | } |
| 262 | |
| 263 | static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, |
| 264 | struct snd_ctl_elem_value *ucontrol) |
| 265 | { |
| 266 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 267 | struct sigmatel_spec *spec = codec->spec; |
| 268 | |
| 269 | return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, |
| 270 | spec->dmux_nid, &spec->cur_dmux); |
| 271 | } |
| 272 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 273 | 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] | 274 | { |
| 275 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 276 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 277 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 278 | } |
| 279 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 280 | 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] | 281 | { |
| 282 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 283 | struct sigmatel_spec *spec = codec->spec; |
| 284 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 285 | |
| 286 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 287 | return 0; |
| 288 | } |
| 289 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 290 | 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] | 291 | { |
| 292 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 293 | struct sigmatel_spec *spec = codec->spec; |
| 294 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 295 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 296 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 297 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); |
| 298 | } |
| 299 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 300 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
| 301 | |
| 302 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
| 303 | struct snd_ctl_elem_value *ucontrol) |
| 304 | { |
| 305 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 306 | struct sigmatel_spec *spec = codec->spec; |
| 307 | |
| 308 | ucontrol->value.integer.value[0] = spec->aloopback; |
| 309 | return 0; |
| 310 | } |
| 311 | |
| 312 | static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, |
| 313 | struct snd_ctl_elem_value *ucontrol) |
| 314 | { |
| 315 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 316 | struct sigmatel_spec *spec = codec->spec; |
| 317 | unsigned int dac_mode; |
| 318 | |
| 319 | if (spec->aloopback == ucontrol->value.integer.value[0]) |
| 320 | return 0; |
| 321 | |
| 322 | spec->aloopback = ucontrol->value.integer.value[0]; |
| 323 | |
| 324 | |
| 325 | dac_mode = snd_hda_codec_read(codec, codec->afg, 0, |
| 326 | kcontrol->private_value & 0xFFFF, 0x0); |
| 327 | |
| 328 | if (spec->aloopback) { |
| 329 | snd_hda_power_up(codec); |
| 330 | dac_mode |= 0x40; |
| 331 | } else { |
| 332 | snd_hda_power_down(codec); |
| 333 | dac_mode &= ~0x40; |
| 334 | } |
| 335 | |
| 336 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 337 | kcontrol->private_value >> 16, dac_mode); |
| 338 | |
| 339 | return 1; |
| 340 | } |
| 341 | |
Maxim Levitsky | 6e6b88f | 2007-09-03 15:30:26 +0200 | [diff] [blame] | 342 | static int stac92xx_volknob_info(struct snd_kcontrol *kcontrol, |
| 343 | struct snd_ctl_elem_info *uinfo) |
| 344 | { |
| 345 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
| 346 | uinfo->count = 1; |
| 347 | uinfo->value.integer.min = 0; |
| 348 | uinfo->value.integer.max = 127; |
| 349 | return 0; |
| 350 | } |
| 351 | |
| 352 | static int stac92xx_volknob_get(struct snd_kcontrol *kcontrol, |
| 353 | struct snd_ctl_elem_value *ucontrol) |
| 354 | { |
| 355 | ucontrol->value.integer.value[0] = kcontrol->private_value; |
| 356 | return 0; |
| 357 | } |
| 358 | |
| 359 | static int stac92xx_volknob_put(struct snd_kcontrol *kcontrol, |
| 360 | struct snd_ctl_elem_value *ucontrol) |
| 361 | { |
| 362 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 363 | |
| 364 | if (kcontrol->private_value == ucontrol->value.integer.value[0]) |
| 365 | return 0; |
| 366 | |
| 367 | kcontrol->private_value = ucontrol->value.integer.value[0]; |
| 368 | |
| 369 | snd_hda_codec_write_cache(codec, 0x24, 0, |
| 370 | AC_VERB_SET_VOLUME_KNOB_CONTROL, |
| 371 | kcontrol->private_value | 0x80); |
| 372 | return 1; |
| 373 | } |
| 374 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 375 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 376 | static struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 377 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 378 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 379 | {} |
| 380 | }; |
| 381 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 382 | static struct hda_verb stac925x_core_init[] = { |
| 383 | /* set dac0mux for dac converter */ |
| 384 | { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 385 | {} |
| 386 | }; |
| 387 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 388 | static struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 389 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 390 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 391 | {} |
| 392 | }; |
| 393 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 394 | static struct hda_verb d965_core_init[] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 395 | /* set master volume and direct control */ |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 396 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 397 | /* unmute node 0x1b */ |
| 398 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 399 | /* select node 0x03 as DAC */ |
| 400 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 401 | {} |
| 402 | }; |
| 403 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 404 | static struct hda_verb stac927x_core_init[] = { |
| 405 | /* set master volume and direct control */ |
| 406 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 407 | {} |
| 408 | }; |
| 409 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 410 | static struct hda_verb stac9205_core_init[] = { |
| 411 | /* set master volume and direct control */ |
| 412 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 413 | {} |
| 414 | }; |
| 415 | |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 416 | #define STAC_INPUT_SOURCE(cnt) \ |
Maxim Levitsky | ca7c5a8 | 2007-08-31 12:52:19 +0200 | [diff] [blame] | 417 | { \ |
| 418 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 419 | .name = "Input Source", \ |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 420 | .count = cnt, \ |
Maxim Levitsky | ca7c5a8 | 2007-08-31 12:52:19 +0200 | [diff] [blame] | 421 | .info = stac92xx_mux_enum_info, \ |
| 422 | .get = stac92xx_mux_enum_get, \ |
| 423 | .put = stac92xx_mux_enum_put, \ |
| 424 | } |
| 425 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 426 | #define STAC_ANALOG_LOOPBACK(verb_read,verb_write) \ |
| 427 | { \ |
| 428 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 429 | .name = "Analog Loopback", \ |
| 430 | .count = 1, \ |
| 431 | .info = stac92xx_aloopback_info, \ |
| 432 | .get = stac92xx_aloopback_get, \ |
| 433 | .put = stac92xx_aloopback_put, \ |
| 434 | .private_value = verb_read | (verb_write << 16), \ |
| 435 | } |
| 436 | |
Maxim Levitsky | 6e6b88f | 2007-09-03 15:30:26 +0200 | [diff] [blame] | 437 | #define STAC_VOLKNOB \ |
| 438 | { \ |
| 439 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 440 | .name = "Master Playback Volume", \ |
| 441 | .count = 1, \ |
| 442 | .info = stac92xx_volknob_info, \ |
| 443 | .get = stac92xx_volknob_get, \ |
| 444 | .put = stac92xx_volknob_put, \ |
| 445 | .private_value = 127, \ |
| 446 | } |
| 447 | |
Maxim Levitsky | ca7c5a8 | 2007-08-31 12:52:19 +0200 | [diff] [blame] | 448 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 449 | static struct snd_kcontrol_new stac9200_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 450 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 451 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 452 | STAC_INPUT_SOURCE(1), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 453 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 454 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 455 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 456 | { } /* end */ |
| 457 | }; |
| 458 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 459 | static struct snd_kcontrol_new stac925x_mixer[] = { |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 460 | STAC_INPUT_SOURCE(1), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 461 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), |
| 462 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT), |
| 463 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT), |
| 464 | { } /* end */ |
| 465 | }; |
| 466 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 467 | static struct snd_kcontrol_new stac9205_mixer[] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 468 | { |
| 469 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 470 | .name = "Digital Input Source", |
| 471 | .count = 1, |
| 472 | .info = stac92xx_dmux_enum_info, |
| 473 | .get = stac92xx_dmux_enum_get, |
| 474 | .put = stac92xx_dmux_enum_put, |
| 475 | }, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 476 | STAC_INPUT_SOURCE(2), |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 477 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0), |
Maxim Levitsky | 6e6b88f | 2007-09-03 15:30:26 +0200 | [diff] [blame] | 478 | STAC_VOLKNOB, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 479 | |
| 480 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), |
| 481 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), |
| 482 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT), |
| 483 | |
| 484 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), |
| 485 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT), |
| 486 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT), |
| 487 | |
| 488 | { } /* end */ |
| 489 | }; |
| 490 | |
| 491 | /* This needs to be generated dynamically based on sequence */ |
| 492 | static struct snd_kcontrol_new stac922x_mixer[] = { |
| 493 | STAC_INPUT_SOURCE(2), |
| 494 | STAC_VOLKNOB, |
| 495 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), |
| 496 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), |
| 497 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT), |
| 498 | |
| 499 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), |
| 500 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT), |
| 501 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT), |
| 502 | { } /* end */ |
| 503 | }; |
| 504 | |
| 505 | |
| 506 | static struct snd_kcontrol_new stac927x_mixer[] = { |
| 507 | STAC_INPUT_SOURCE(3), |
| 508 | STAC_VOLKNOB, |
| 509 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), |
| 510 | |
| 511 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), |
| 512 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), |
| 513 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT), |
| 514 | |
| 515 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT), |
| 516 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT), |
| 517 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT), |
| 518 | |
| 519 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT), |
| 520 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT), |
| 521 | HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 522 | { } /* end */ |
| 523 | }; |
| 524 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 525 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 526 | { |
| 527 | struct sigmatel_spec *spec = codec->spec; |
| 528 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 529 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 530 | |
| 531 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 532 | if (err < 0) |
| 533 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 534 | |
| 535 | for (i = 0; i < spec->num_mixers; i++) { |
| 536 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 537 | if (err < 0) |
| 538 | return err; |
| 539 | } |
| 540 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 541 | if (spec->multiout.dig_out_nid) { |
| 542 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
| 543 | if (err < 0) |
| 544 | return err; |
| 545 | } |
| 546 | if (spec->dig_in_nid) { |
| 547 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 548 | if (err < 0) |
| 549 | return err; |
| 550 | } |
| 551 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 552 | } |
| 553 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 554 | static unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 555 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 556 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 557 | }; |
| 558 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 559 | /* |
| 560 | STAC 9200 pin configs for |
| 561 | 102801A8 |
| 562 | 102801DE |
| 563 | 102801E8 |
| 564 | */ |
| 565 | static unsigned int dell9200_d21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 566 | 0x400001f0, 0x400001f1, 0x02214030, 0x01014010, |
| 567 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 568 | }; |
| 569 | |
| 570 | /* |
| 571 | STAC 9200 pin configs for |
| 572 | 102801C0 |
| 573 | 102801C1 |
| 574 | */ |
| 575 | static unsigned int dell9200_d22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 576 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 577 | 0x01813020, 0x02a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 578 | }; |
| 579 | |
| 580 | /* |
| 581 | STAC 9200 pin configs for |
| 582 | 102801C4 (Dell Dimension E310) |
| 583 | 102801C5 |
| 584 | 102801C7 |
| 585 | 102801D9 |
| 586 | 102801DA |
| 587 | 102801E3 |
| 588 | */ |
| 589 | static unsigned int dell9200_d23_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 590 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 591 | 0x01813020, 0x01a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 592 | }; |
| 593 | |
| 594 | |
| 595 | /* |
| 596 | STAC 9200-32 pin configs for |
| 597 | 102801B5 (Dell Inspiron 630m) |
| 598 | 102801D8 (Dell Inspiron 640m) |
| 599 | */ |
| 600 | static unsigned int dell9200_m21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 601 | 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, |
| 602 | 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 603 | }; |
| 604 | |
| 605 | /* |
| 606 | STAC 9200-32 pin configs for |
| 607 | 102801C2 (Dell Latitude D620) |
| 608 | 102801C8 |
| 609 | 102801CC (Dell Latitude D820) |
| 610 | 102801D4 |
| 611 | 102801D6 |
| 612 | */ |
| 613 | static unsigned int dell9200_m22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 614 | 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310, |
| 615 | 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 616 | }; |
| 617 | |
| 618 | /* |
| 619 | STAC 9200-32 pin configs for |
| 620 | 102801CE (Dell XPS M1710) |
| 621 | 102801CF (Dell Precision M90) |
| 622 | */ |
| 623 | static unsigned int dell9200_m23_pin_configs[8] = { |
| 624 | 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310, |
| 625 | 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc, |
| 626 | }; |
| 627 | |
| 628 | /* |
| 629 | STAC 9200-32 pin configs for |
| 630 | 102801C9 |
| 631 | 102801CA |
| 632 | 102801CB (Dell Latitude 120L) |
| 633 | 102801D3 |
| 634 | */ |
| 635 | static unsigned int dell9200_m24_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 636 | 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, |
| 637 | 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 638 | }; |
| 639 | |
| 640 | /* |
| 641 | STAC 9200-32 pin configs for |
| 642 | 102801BD (Dell Inspiron E1505n) |
| 643 | 102801EE |
| 644 | 102801EF |
| 645 | */ |
| 646 | static unsigned int dell9200_m25_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 647 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 648 | 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 649 | }; |
| 650 | |
| 651 | /* |
| 652 | STAC 9200-32 pin configs for |
| 653 | 102801F5 (Dell Inspiron 1501) |
| 654 | 102801F6 |
| 655 | */ |
| 656 | static unsigned int dell9200_m26_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 657 | 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, |
| 658 | 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 659 | }; |
| 660 | |
| 661 | /* |
| 662 | STAC 9200-32 |
| 663 | 102801CD (Dell Inspiron E1705/9400) |
| 664 | */ |
| 665 | static unsigned int dell9200_m27_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 666 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 667 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 668 | }; |
| 669 | |
| 670 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 671 | static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
| 672 | [STAC_REF] = ref9200_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 673 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, |
| 674 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, |
| 675 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, |
| 676 | [STAC_9200_DELL_M21] = dell9200_m21_pin_configs, |
| 677 | [STAC_9200_DELL_M22] = dell9200_m22_pin_configs, |
| 678 | [STAC_9200_DELL_M23] = dell9200_m23_pin_configs, |
| 679 | [STAC_9200_DELL_M24] = dell9200_m24_pin_configs, |
| 680 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
| 681 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
| 682 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 683 | }; |
| 684 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 685 | static const char *stac9200_models[STAC_9200_MODELS] = { |
| 686 | [STAC_REF] = "ref", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 687 | [STAC_9200_DELL_D21] = "dell-d21", |
| 688 | [STAC_9200_DELL_D22] = "dell-d22", |
| 689 | [STAC_9200_DELL_D23] = "dell-d23", |
| 690 | [STAC_9200_DELL_M21] = "dell-m21", |
| 691 | [STAC_9200_DELL_M22] = "dell-m22", |
| 692 | [STAC_9200_DELL_M23] = "dell-m23", |
| 693 | [STAC_9200_DELL_M24] = "dell-m24", |
| 694 | [STAC_9200_DELL_M25] = "dell-m25", |
| 695 | [STAC_9200_DELL_M26] = "dell-m26", |
| 696 | [STAC_9200_DELL_M27] = "dell-m27", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 697 | }; |
| 698 | |
| 699 | static struct snd_pci_quirk stac9200_cfg_tbl[] = { |
| 700 | /* SigmaTel reference board */ |
| 701 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 702 | "DFI LanParty", STAC_REF), |
Matt Porter | e737707 | 2006-11-06 11:20:38 +0100 | [diff] [blame] | 703 | /* Dell laptops have BIOS problem */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 704 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, |
| 705 | "unknown Dell", STAC_9200_DELL_D21), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 706 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 707 | "Dell Inspiron 630m", STAC_9200_DELL_M21), |
| 708 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd, |
| 709 | "Dell Inspiron E1505n", STAC_9200_DELL_M25), |
| 710 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0, |
| 711 | "unknown Dell", STAC_9200_DELL_D22), |
| 712 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1, |
| 713 | "unknown Dell", STAC_9200_DELL_D22), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 714 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 715 | "Dell Latitude D620", STAC_9200_DELL_M22), |
| 716 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5, |
| 717 | "unknown Dell", STAC_9200_DELL_D23), |
| 718 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7, |
| 719 | "unknown Dell", STAC_9200_DELL_D23), |
| 720 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8, |
| 721 | "unknown Dell", STAC_9200_DELL_M22), |
| 722 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9, |
| 723 | "unknown Dell", STAC_9200_DELL_M24), |
| 724 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca, |
| 725 | "unknown Dell", STAC_9200_DELL_M24), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 726 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 727 | "Dell Latitude 120L", STAC_9200_DELL_M24), |
Cory T. Tusar | 877b866 | 2007-01-30 17:30:55 +0100 | [diff] [blame] | 728 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 729 | "Dell Latitude D820", STAC_9200_DELL_M22), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 730 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 731 | "Dell Inspiron E1705/9400", STAC_9200_DELL_M27), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 732 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 733 | "Dell XPS M1710", STAC_9200_DELL_M23), |
Takashi Iwai | f0f9674 | 2007-02-14 00:59:17 +0100 | [diff] [blame] | 734 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 735 | "Dell Precision M90", STAC_9200_DELL_M23), |
| 736 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3, |
| 737 | "unknown Dell", STAC_9200_DELL_M22), |
| 738 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4, |
| 739 | "unknown Dell", STAC_9200_DELL_M22), |
Daniel T Chen | 8286c53 | 2007-05-15 11:46:23 +0200 | [diff] [blame] | 740 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 741 | "unknown Dell", STAC_9200_DELL_M22), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 742 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 743 | "Dell Inspiron 640m", STAC_9200_DELL_M21), |
| 744 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9, |
| 745 | "unknown Dell", STAC_9200_DELL_D23), |
| 746 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da, |
| 747 | "unknown Dell", STAC_9200_DELL_D23), |
| 748 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de, |
| 749 | "unknown Dell", STAC_9200_DELL_D21), |
| 750 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3, |
| 751 | "unknown Dell", STAC_9200_DELL_D23), |
| 752 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8, |
| 753 | "unknown Dell", STAC_9200_DELL_D21), |
| 754 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee, |
| 755 | "unknown Dell", STAC_9200_DELL_M25), |
| 756 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef, |
| 757 | "unknown Dell", STAC_9200_DELL_M25), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 758 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 759 | "Dell Inspiron 1501", STAC_9200_DELL_M26), |
| 760 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, |
| 761 | "unknown Dell", STAC_9200_DELL_M26), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 762 | /* Panasonic */ |
| 763 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF), |
| 764 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 765 | {} /* terminator */ |
| 766 | }; |
| 767 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 768 | static unsigned int ref925x_pin_configs[8] = { |
| 769 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
| 770 | 0x90a70320, 0x02214210, 0x400003f1, 0x9033032e, |
| 771 | }; |
| 772 | |
| 773 | static unsigned int stac925x_MA6_pin_configs[8] = { |
| 774 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
| 775 | 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, |
| 776 | }; |
| 777 | |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 778 | static unsigned int stac925x_PA6_pin_configs[8] = { |
| 779 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
| 780 | 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, |
| 781 | }; |
| 782 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 783 | static unsigned int stac925xM2_2_pin_configs[8] = { |
Steve Longerbeam | 7353e14 | 2007-05-29 14:36:17 +0200 | [diff] [blame] | 784 | 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, |
| 785 | 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 786 | }; |
| 787 | |
| 788 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
| 789 | [STAC_REF] = ref925x_pin_configs, |
| 790 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
| 791 | [STAC_MA6] = stac925x_MA6_pin_configs, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 792 | [STAC_PA6] = stac925x_PA6_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 793 | }; |
| 794 | |
| 795 | static const char *stac925x_models[STAC_925x_MODELS] = { |
| 796 | [STAC_REF] = "ref", |
| 797 | [STAC_M2_2] = "m2-2", |
| 798 | [STAC_MA6] = "m6", |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 799 | [STAC_PA6] = "pa6", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 800 | }; |
| 801 | |
| 802 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
| 803 | /* SigmaTel reference board */ |
| 804 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 805 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 806 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), |
| 807 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), |
| 808 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 809 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 810 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), |
| 811 | {} /* terminator */ |
| 812 | }; |
| 813 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 814 | static unsigned int ref922x_pin_configs[10] = { |
| 815 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 816 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 817 | 0x40000100, 0x40000100, |
| 818 | }; |
| 819 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 820 | /* |
| 821 | STAC 922X pin configs for |
| 822 | 102801A7 |
| 823 | 102801AB |
| 824 | 102801A9 |
| 825 | 102801D1 |
| 826 | 102801D2 |
| 827 | */ |
| 828 | static unsigned int dell_922x_d81_pin_configs[10] = { |
| 829 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 830 | 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, |
| 831 | 0x01813122, 0x400001f2, |
| 832 | }; |
| 833 | |
| 834 | /* |
| 835 | STAC 922X pin configs for |
| 836 | 102801AC |
| 837 | 102801D0 |
| 838 | */ |
| 839 | static unsigned int dell_922x_d82_pin_configs[10] = { |
| 840 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 841 | 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, |
| 842 | 0x01813122, 0x400001f1, |
| 843 | }; |
| 844 | |
| 845 | /* |
| 846 | STAC 922X pin configs for |
| 847 | 102801BF |
| 848 | */ |
| 849 | static unsigned int dell_922x_m81_pin_configs[10] = { |
| 850 | 0x0321101f, 0x01112024, 0x01111222, 0x91174220, |
| 851 | 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, |
| 852 | 0x40C003f1, 0x405003f0, |
| 853 | }; |
| 854 | |
| 855 | /* |
| 856 | STAC 9221 A1 pin configs for |
| 857 | 102801D7 (Dell XPS M1210) |
| 858 | */ |
| 859 | static unsigned int dell_922x_m82_pin_configs[10] = { |
| 860 | 0x0221121f, 0x408103ff, 0x02111212, 0x90100310, |
| 861 | 0x408003f1, 0x02111211, 0x03451340, 0x40c003f2, |
| 862 | 0x508003f3, 0x405003f4, |
| 863 | }; |
| 864 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 865 | static unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 866 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 867 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 868 | 0x02a19120, 0x40000100, |
| 869 | }; |
| 870 | |
| 871 | static unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 872 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 873 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 874 | 0x02a19320, 0x40000100, |
| 875 | }; |
| 876 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 877 | static unsigned int intel_mac_v1_pin_configs[10] = { |
| 878 | 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, |
| 879 | 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 880 | 0x400000fc, 0x400000fb, |
| 881 | }; |
| 882 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 883 | static unsigned int intel_mac_v2_pin_configs[10] = { |
| 884 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 885 | 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 886 | 0x400000fc, 0x400000fb, |
| 887 | }; |
| 888 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 889 | static unsigned int intel_mac_v3_pin_configs[10] = { |
| 890 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 891 | 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, |
| 892 | 0x400000fc, 0x400000fb, |
| 893 | }; |
| 894 | |
| 895 | static unsigned int intel_mac_v4_pin_configs[10] = { |
| 896 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 897 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 898 | 0x400000fc, 0x400000fb, |
| 899 | }; |
| 900 | |
| 901 | static unsigned int intel_mac_v5_pin_configs[10] = { |
| 902 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 903 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 904 | 0x400000fc, 0x400000fb, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 905 | }; |
| 906 | |
Takashi Iwai | 76c0882 | 2007-06-19 12:17:42 +0200 | [diff] [blame] | 907 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 908 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 909 | [STAC_D945_REF] = ref922x_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 910 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 911 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 912 | [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs, |
| 913 | [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs, |
| 914 | [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, |
| 915 | [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, |
| 916 | [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 917 | /* for backward compatibility */ |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 918 | [STAC_MACMINI] = intel_mac_v3_pin_configs, |
| 919 | [STAC_MACBOOK] = intel_mac_v5_pin_configs, |
| 920 | [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs, |
| 921 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
| 922 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
| 923 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 924 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
| 925 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
| 926 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
| 927 | [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 928 | }; |
| 929 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 930 | static const char *stac922x_models[STAC_922X_MODELS] = { |
| 931 | [STAC_D945_REF] = "ref", |
| 932 | [STAC_D945GTP5] = "5stack", |
| 933 | [STAC_D945GTP3] = "3stack", |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 934 | [STAC_INTEL_MAC_V1] = "intel-mac-v1", |
| 935 | [STAC_INTEL_MAC_V2] = "intel-mac-v2", |
| 936 | [STAC_INTEL_MAC_V3] = "intel-mac-v3", |
| 937 | [STAC_INTEL_MAC_V4] = "intel-mac-v4", |
| 938 | [STAC_INTEL_MAC_V5] = "intel-mac-v5", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 939 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 940 | [STAC_MACMINI] = "macmini", |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 941 | [STAC_MACBOOK] = "macbook", |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 942 | [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", |
| 943 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 944 | [STAC_IMAC_INTEL] = "imac-intel", |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 945 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 946 | [STAC_922X_DELL_D81] = "dell-d81", |
| 947 | [STAC_922X_DELL_D82] = "dell-d82", |
| 948 | [STAC_922X_DELL_M81] = "dell-m81", |
| 949 | [STAC_922X_DELL_M82] = "dell-m82", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 950 | }; |
| 951 | |
| 952 | static struct snd_pci_quirk stac922x_cfg_tbl[] = { |
| 953 | /* SigmaTel reference board */ |
| 954 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 955 | "DFI LanParty", STAC_D945_REF), |
| 956 | /* Intel 945G based systems */ |
| 957 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
| 958 | "Intel D945G", STAC_D945GTP3), |
| 959 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, |
| 960 | "Intel D945G", STAC_D945GTP3), |
| 961 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, |
| 962 | "Intel D945G", STAC_D945GTP3), |
| 963 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, |
| 964 | "Intel D945G", STAC_D945GTP3), |
| 965 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, |
| 966 | "Intel D945G", STAC_D945GTP3), |
| 967 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, |
| 968 | "Intel D945G", STAC_D945GTP3), |
| 969 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, |
| 970 | "Intel D945G", STAC_D945GTP3), |
| 971 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, |
| 972 | "Intel D945G", STAC_D945GTP3), |
| 973 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, |
| 974 | "Intel D945G", STAC_D945GTP3), |
| 975 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, |
| 976 | "Intel D945G", STAC_D945GTP3), |
| 977 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, |
| 978 | "Intel D945G", STAC_D945GTP3), |
| 979 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, |
| 980 | "Intel D945G", STAC_D945GTP3), |
| 981 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, |
| 982 | "Intel D945G", STAC_D945GTP3), |
| 983 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, |
| 984 | "Intel D945G", STAC_D945GTP3), |
| 985 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, |
| 986 | "Intel D945G", STAC_D945GTP3), |
| 987 | /* Intel D945G 5-stack systems */ |
| 988 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, |
| 989 | "Intel D945G", STAC_D945GTP5), |
| 990 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, |
| 991 | "Intel D945G", STAC_D945GTP5), |
| 992 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, |
| 993 | "Intel D945G", STAC_D945GTP5), |
| 994 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, |
| 995 | "Intel D945G", STAC_D945GTP5), |
| 996 | /* Intel 945P based systems */ |
| 997 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, |
| 998 | "Intel D945P", STAC_D945GTP3), |
| 999 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, |
| 1000 | "Intel D945P", STAC_D945GTP3), |
| 1001 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, |
| 1002 | "Intel D945P", STAC_D945GTP3), |
| 1003 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, |
| 1004 | "Intel D945P", STAC_D945GTP3), |
| 1005 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, |
| 1006 | "Intel D945P", STAC_D945GTP3), |
| 1007 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
| 1008 | "Intel D945P", STAC_D945GTP5), |
| 1009 | /* other systems */ |
| 1010 | /* Apple Mac Mini (early 2006) */ |
| 1011 | SND_PCI_QUIRK(0x8384, 0x7680, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1012 | "Mac Mini", STAC_INTEL_MAC_V3), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1013 | /* Dell systems */ |
| 1014 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, |
| 1015 | "unknown Dell", STAC_922X_DELL_D81), |
| 1016 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9, |
| 1017 | "unknown Dell", STAC_922X_DELL_D81), |
| 1018 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab, |
| 1019 | "unknown Dell", STAC_922X_DELL_D81), |
| 1020 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac, |
| 1021 | "unknown Dell", STAC_922X_DELL_D82), |
| 1022 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf, |
| 1023 | "unknown Dell", STAC_922X_DELL_M81), |
| 1024 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0, |
| 1025 | "unknown Dell", STAC_922X_DELL_D82), |
| 1026 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1, |
| 1027 | "unknown Dell", STAC_922X_DELL_D81), |
| 1028 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2, |
| 1029 | "unknown Dell", STAC_922X_DELL_D81), |
| 1030 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
| 1031 | "Dell XPS M1210", STAC_922X_DELL_M82), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1032 | {} /* terminator */ |
| 1033 | }; |
| 1034 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1035 | static unsigned int ref927x_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1036 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 1037 | 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, |
| 1038 | 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, |
| 1039 | 0x01c42190, 0x40000100, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1040 | }; |
| 1041 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1042 | static unsigned int d965_3st_pin_configs[14] = { |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 1043 | 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, |
| 1044 | 0x01a19021, 0x01813024, 0x40000100, 0x40000100, |
| 1045 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 1046 | 0x40000100, 0x40000100 |
| 1047 | }; |
| 1048 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1049 | static unsigned int d965_5st_pin_configs[14] = { |
| 1050 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 1051 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 1052 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 1053 | 0x40000100, 0x40000100 |
| 1054 | }; |
| 1055 | |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 1056 | static unsigned int dell_3st_pin_configs[14] = { |
| 1057 | 0x02211230, 0x02a11220, 0x01a19040, 0x01114210, |
| 1058 | 0x01111212, 0x01116211, 0x01813050, 0x01112214, |
| 1059 | 0x403003fa, 0x40000100, 0x40000100, 0x404003fb, |
| 1060 | 0x40c003fc, 0x40000100 |
| 1061 | }; |
| 1062 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1063 | static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1064 | [STAC_D965_REF] = ref927x_pin_configs, |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1065 | [STAC_D965_3ST] = d965_3st_pin_configs, |
| 1066 | [STAC_D965_5ST] = d965_5st_pin_configs, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 1067 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1068 | }; |
| 1069 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1070 | static const char *stac927x_models[STAC_927X_MODELS] = { |
| 1071 | [STAC_D965_REF] = "ref", |
| 1072 | [STAC_D965_3ST] = "3stack", |
| 1073 | [STAC_D965_5ST] = "5stack", |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 1074 | [STAC_DELL_3ST] = "dell-3stack", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1075 | }; |
| 1076 | |
| 1077 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { |
| 1078 | /* SigmaTel reference board */ |
| 1079 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1080 | "DFI LanParty", STAC_D965_REF), |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 1081 | /* Intel 946 based systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1082 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
| 1083 | 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] | 1084 | /* 965 based 3 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1085 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST), |
| 1086 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST), |
| 1087 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST), |
| 1088 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST), |
| 1089 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST), |
| 1090 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST), |
| 1091 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST), |
| 1092 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST), |
| 1093 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST), |
| 1094 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST), |
| 1095 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST), |
| 1096 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST), |
| 1097 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST), |
| 1098 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST), |
| 1099 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST), |
| 1100 | 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] | 1101 | /* Dell 3 stack systems */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1102 | 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] | 1103 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), |
| 1104 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1105 | /* 965 based 5 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1106 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST), |
| 1107 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST), |
| 1108 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST), |
| 1109 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST), |
| 1110 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST), |
| 1111 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST), |
| 1112 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST), |
| 1113 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST), |
| 1114 | 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] | 1115 | {} /* terminator */ |
| 1116 | }; |
| 1117 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1118 | static unsigned int ref9205_pin_configs[12] = { |
| 1119 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1120 | 0x01813122, 0x01a19021, 0x40000100, 0x40000100, |
| 1121 | 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1122 | }; |
| 1123 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1124 | /* |
| 1125 | STAC 9205 pin configs for |
| 1126 | 102801F1 |
| 1127 | 102801F2 |
| 1128 | 102801FC |
| 1129 | 102801FD |
| 1130 | 10280204 |
| 1131 | 1028021F |
| 1132 | */ |
| 1133 | static unsigned int dell_9205_m42_pin_configs[12] = { |
| 1134 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
| 1135 | 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9, |
| 1136 | 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE, |
| 1137 | }; |
| 1138 | |
| 1139 | /* |
| 1140 | STAC 9205 pin configs for |
| 1141 | 102801F9 |
| 1142 | 102801FA |
| 1143 | 102801FE |
| 1144 | 102801FF (Dell Precision M4300) |
| 1145 | 10280206 |
| 1146 | 10280200 |
| 1147 | 10280201 |
| 1148 | */ |
| 1149 | static unsigned int dell_9205_m43_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1150 | 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310, |
| 1151 | 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9, |
| 1152 | 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8, |
| 1153 | }; |
| 1154 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1155 | static unsigned int dell_9205_m44_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1156 | 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310, |
| 1157 | 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9, |
| 1158 | 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe, |
| 1159 | }; |
| 1160 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1161 | static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1162 | [STAC_9205_REF] = ref9205_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1163 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, |
| 1164 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, |
| 1165 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1166 | [STAC_9205_M43xx] = NULL, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1167 | }; |
| 1168 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1169 | static const char *stac9205_models[STAC_9205_MODELS] = { |
| 1170 | [STAC_9205_REF] = "ref", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1171 | [STAC_9205_DELL_M42] = "dell-m42", |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1172 | [STAC_9205_DELL_M43] = "dell-m43", |
| 1173 | [STAC_9205_DELL_M44] = "dell-m44", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1174 | }; |
| 1175 | |
| 1176 | static struct snd_pci_quirk stac9205_cfg_tbl[] = { |
| 1177 | /* SigmaTel reference board */ |
| 1178 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1179 | "DFI LanParty", STAC_9205_REF), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1180 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
| 1181 | "unknown Dell", STAC_9205_DELL_M42), |
| 1182 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
| 1183 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1184 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8, |
| 1185 | "Dell Precision", STAC_9205_M43xx), |
| 1186 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9, |
| 1187 | "Dell Precision", STAC_9205_DELL_M43), |
Matthew Ranostay | e45e459 | 2007-09-10 23:09:42 +0200 | [diff] [blame^] | 1188 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b, |
| 1189 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1190 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa, |
| 1191 | "Dell Precision", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1192 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, |
| 1193 | "unknown Dell", STAC_9205_DELL_M42), |
| 1194 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, |
| 1195 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1196 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe, |
| 1197 | "Dell Precision", STAC_9205_DELL_M43), |
| 1198 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1199 | "Dell Precision M4300", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1200 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206, |
| 1201 | "Dell Precision", STAC_9205_DELL_M43), |
| 1202 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
| 1203 | "Dell Inspiron", STAC_9205_DELL_M44), |
| 1204 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
| 1205 | "Dell Inspiron", STAC_9205_DELL_M44), |
| 1206 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, |
| 1207 | "Dell Inspiron", STAC_9205_DELL_M44), |
| 1208 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, |
| 1209 | "Dell Inspiron", STAC_9205_DELL_M44), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1210 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, |
| 1211 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 1212 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f, |
| 1213 | "Dell Inspiron", STAC_9205_DELL_M44), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1214 | {} /* terminator */ |
| 1215 | }; |
| 1216 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1217 | static int stac92xx_save_bios_config_regs(struct hda_codec *codec) |
| 1218 | { |
| 1219 | int i; |
| 1220 | struct sigmatel_spec *spec = codec->spec; |
| 1221 | |
| 1222 | if (! spec->bios_pin_configs) { |
| 1223 | spec->bios_pin_configs = kcalloc(spec->num_pins, |
| 1224 | sizeof(*spec->bios_pin_configs), GFP_KERNEL); |
| 1225 | if (! spec->bios_pin_configs) |
| 1226 | return -ENOMEM; |
| 1227 | } |
| 1228 | |
| 1229 | for (i = 0; i < spec->num_pins; i++) { |
| 1230 | hda_nid_t nid = spec->pin_nids[i]; |
| 1231 | unsigned int pin_cfg; |
| 1232 | |
| 1233 | pin_cfg = snd_hda_codec_read(codec, nid, 0, |
| 1234 | AC_VERB_GET_CONFIG_DEFAULT, 0x00); |
| 1235 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", |
| 1236 | nid, pin_cfg); |
| 1237 | spec->bios_pin_configs[i] = pin_cfg; |
| 1238 | } |
| 1239 | |
| 1240 | return 0; |
| 1241 | } |
| 1242 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1243 | static void stac92xx_set_config_reg(struct hda_codec *codec, |
| 1244 | hda_nid_t pin_nid, unsigned int pin_config) |
| 1245 | { |
| 1246 | int i; |
| 1247 | snd_hda_codec_write(codec, pin_nid, 0, |
| 1248 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 1249 | pin_config & 0x000000ff); |
| 1250 | snd_hda_codec_write(codec, pin_nid, 0, |
| 1251 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 1252 | (pin_config & 0x0000ff00) >> 8); |
| 1253 | snd_hda_codec_write(codec, pin_nid, 0, |
| 1254 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 1255 | (pin_config & 0x00ff0000) >> 16); |
| 1256 | snd_hda_codec_write(codec, pin_nid, 0, |
| 1257 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 1258 | pin_config >> 24); |
| 1259 | i = snd_hda_codec_read(codec, pin_nid, 0, |
| 1260 | AC_VERB_GET_CONFIG_DEFAULT, |
| 1261 | 0x00); |
| 1262 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", |
| 1263 | pin_nid, i); |
| 1264 | } |
| 1265 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1266 | static void stac92xx_set_config_regs(struct hda_codec *codec) |
| 1267 | { |
| 1268 | int i; |
| 1269 | struct sigmatel_spec *spec = codec->spec; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1270 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1271 | if (!spec->pin_configs) |
| 1272 | return; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1273 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1274 | for (i = 0; i < spec->num_pins; i++) |
| 1275 | stac92xx_set_config_reg(codec, spec->pin_nids[i], |
| 1276 | spec->pin_configs[i]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1277 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1278 | |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 1279 | static void stac92xx_enable_gpio_mask(struct hda_codec *codec) |
Matthew Ranostay | 92a22be | 2007-06-19 16:48:28 +0200 | [diff] [blame] | 1280 | { |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 1281 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1282 | /* Configure GPIOx as output */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 1283 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 1284 | AC_VERB_SET_GPIO_DIRECTION, spec->gpio_mask); |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1285 | /* Configure GPIOx as CMOS */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 1286 | snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7e7, 0x00000000); |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1287 | /* Assert GPIOx */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 1288 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 1289 | AC_VERB_SET_GPIO_DATA, spec->gpio_data); |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 1290 | /* Enable GPIOx */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 1291 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 1292 | AC_VERB_SET_GPIO_MASK, spec->gpio_mask); |
Matthew Ranostay | 92a22be | 2007-06-19 16:48:28 +0200 | [diff] [blame] | 1293 | } |
| 1294 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1295 | /* |
| 1296 | * Analog playback callbacks |
| 1297 | */ |
| 1298 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 1299 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1300 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1301 | { |
| 1302 | struct sigmatel_spec *spec = codec->spec; |
| 1303 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 1304 | } |
| 1305 | |
| 1306 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1307 | struct hda_codec *codec, |
| 1308 | unsigned int stream_tag, |
| 1309 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1310 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1311 | { |
| 1312 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1313 | 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] | 1314 | } |
| 1315 | |
| 1316 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 1317 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1318 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1319 | { |
| 1320 | struct sigmatel_spec *spec = codec->spec; |
| 1321 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 1322 | } |
| 1323 | |
| 1324 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1325 | * Digital playback callbacks |
| 1326 | */ |
| 1327 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 1328 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1329 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1330 | { |
| 1331 | struct sigmatel_spec *spec = codec->spec; |
| 1332 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 1333 | } |
| 1334 | |
| 1335 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 1336 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1337 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1338 | { |
| 1339 | struct sigmatel_spec *spec = codec->spec; |
| 1340 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 1341 | } |
| 1342 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 1343 | static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1344 | struct hda_codec *codec, |
| 1345 | unsigned int stream_tag, |
| 1346 | unsigned int format, |
| 1347 | struct snd_pcm_substream *substream) |
| 1348 | { |
| 1349 | struct sigmatel_spec *spec = codec->spec; |
| 1350 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 1351 | stream_tag, format, substream); |
| 1352 | } |
| 1353 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1354 | |
| 1355 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1356 | * Analog capture callbacks |
| 1357 | */ |
| 1358 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1359 | struct hda_codec *codec, |
| 1360 | unsigned int stream_tag, |
| 1361 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1362 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1363 | { |
| 1364 | struct sigmatel_spec *spec = codec->spec; |
| 1365 | |
| 1366 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 1367 | stream_tag, 0, format); |
| 1368 | return 0; |
| 1369 | } |
| 1370 | |
| 1371 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 1372 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1373 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1374 | { |
| 1375 | struct sigmatel_spec *spec = codec->spec; |
| 1376 | |
| 1377 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); |
| 1378 | return 0; |
| 1379 | } |
| 1380 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1381 | static struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
| 1382 | .substreams = 1, |
| 1383 | .channels_min = 2, |
| 1384 | .channels_max = 2, |
| 1385 | /* NID is set in stac92xx_build_pcms */ |
| 1386 | .ops = { |
| 1387 | .open = stac92xx_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 1388 | .close = stac92xx_dig_playback_pcm_close, |
| 1389 | .prepare = stac92xx_dig_playback_pcm_prepare |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1390 | }, |
| 1391 | }; |
| 1392 | |
| 1393 | static struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
| 1394 | .substreams = 1, |
| 1395 | .channels_min = 2, |
| 1396 | .channels_max = 2, |
| 1397 | /* NID is set in stac92xx_build_pcms */ |
| 1398 | }; |
| 1399 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1400 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
| 1401 | .substreams = 1, |
| 1402 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1403 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1404 | .nid = 0x02, /* NID to query formats and rates */ |
| 1405 | .ops = { |
| 1406 | .open = stac92xx_playback_pcm_open, |
| 1407 | .prepare = stac92xx_playback_pcm_prepare, |
| 1408 | .cleanup = stac92xx_playback_pcm_cleanup |
| 1409 | }, |
| 1410 | }; |
| 1411 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1412 | static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
| 1413 | .substreams = 1, |
| 1414 | .channels_min = 2, |
| 1415 | .channels_max = 2, |
| 1416 | .nid = 0x06, /* NID to query formats and rates */ |
| 1417 | .ops = { |
| 1418 | .open = stac92xx_playback_pcm_open, |
| 1419 | .prepare = stac92xx_playback_pcm_prepare, |
| 1420 | .cleanup = stac92xx_playback_pcm_cleanup |
| 1421 | }, |
| 1422 | }; |
| 1423 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1424 | static struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1425 | .channels_min = 2, |
| 1426 | .channels_max = 2, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1427 | /* NID + .substreams is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1428 | .ops = { |
| 1429 | .prepare = stac92xx_capture_pcm_prepare, |
| 1430 | .cleanup = stac92xx_capture_pcm_cleanup |
| 1431 | }, |
| 1432 | }; |
| 1433 | |
| 1434 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 1435 | { |
| 1436 | struct sigmatel_spec *spec = codec->spec; |
| 1437 | struct hda_pcm *info = spec->pcm_rec; |
| 1438 | |
| 1439 | codec->num_pcms = 1; |
| 1440 | codec->pcm_info = info; |
| 1441 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1442 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1443 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1444 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1445 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1446 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1447 | |
| 1448 | if (spec->alt_switch) { |
| 1449 | codec->num_pcms++; |
| 1450 | info++; |
| 1451 | info->name = "STAC92xx Analog Alt"; |
| 1452 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 1453 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1454 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1455 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 1456 | codec->num_pcms++; |
| 1457 | info++; |
| 1458 | info->name = "STAC92xx Digital"; |
| 1459 | if (spec->multiout.dig_out_nid) { |
| 1460 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 1461 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 1462 | } |
| 1463 | if (spec->dig_in_nid) { |
| 1464 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 1465 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 1466 | } |
| 1467 | } |
| 1468 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1469 | return 0; |
| 1470 | } |
| 1471 | |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 1472 | static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) |
| 1473 | { |
| 1474 | unsigned int pincap = snd_hda_param_read(codec, nid, |
| 1475 | AC_PAR_PIN_CAP); |
| 1476 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 1477 | if (pincap & AC_PINCAP_VREF_100) |
| 1478 | return AC_PINCTL_VREF_100; |
| 1479 | if (pincap & AC_PINCAP_VREF_80) |
| 1480 | return AC_PINCTL_VREF_80; |
| 1481 | if (pincap & AC_PINCAP_VREF_50) |
| 1482 | return AC_PINCTL_VREF_50; |
| 1483 | if (pincap & AC_PINCAP_VREF_GRD) |
| 1484 | return AC_PINCTL_VREF_GRD; |
| 1485 | return 0; |
| 1486 | } |
| 1487 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1488 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 1489 | |
| 1490 | { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 1491 | snd_hda_codec_write_cache(codec, nid, 0, |
| 1492 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1493 | } |
| 1494 | |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 1495 | #define stac92xx_io_switch_info snd_ctl_boolean_mono_info |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1496 | |
| 1497 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 1498 | { |
| 1499 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1500 | struct sigmatel_spec *spec = codec->spec; |
| 1501 | int io_idx = kcontrol-> private_value & 0xff; |
| 1502 | |
| 1503 | ucontrol->value.integer.value[0] = spec->io_switch[io_idx]; |
| 1504 | return 0; |
| 1505 | } |
| 1506 | |
| 1507 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 1508 | { |
| 1509 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1510 | struct sigmatel_spec *spec = codec->spec; |
| 1511 | hda_nid_t nid = kcontrol->private_value >> 8; |
| 1512 | int io_idx = kcontrol-> private_value & 0xff; |
| 1513 | unsigned short val = ucontrol->value.integer.value[0]; |
| 1514 | |
| 1515 | spec->io_switch[io_idx] = val; |
| 1516 | |
| 1517 | if (val) |
| 1518 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 1519 | else { |
| 1520 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 1521 | if (io_idx) /* set VREF for mic */ |
| 1522 | pinctl |= stac92xx_get_vref(codec, nid); |
| 1523 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 1524 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1525 | return 1; |
| 1526 | } |
| 1527 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 1528 | #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info |
| 1529 | |
| 1530 | static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol, |
| 1531 | struct snd_ctl_elem_value *ucontrol) |
| 1532 | { |
| 1533 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1534 | struct sigmatel_spec *spec = codec->spec; |
| 1535 | |
| 1536 | ucontrol->value.integer.value[0] = spec->clfe_swap; |
| 1537 | return 0; |
| 1538 | } |
| 1539 | |
| 1540 | static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol, |
| 1541 | struct snd_ctl_elem_value *ucontrol) |
| 1542 | { |
| 1543 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1544 | struct sigmatel_spec *spec = codec->spec; |
| 1545 | hda_nid_t nid = kcontrol->private_value & 0xff; |
| 1546 | |
| 1547 | if (spec->clfe_swap == ucontrol->value.integer.value[0]) |
| 1548 | return 0; |
| 1549 | |
| 1550 | spec->clfe_swap = ucontrol->value.integer.value[0]; |
| 1551 | |
| 1552 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1553 | spec->clfe_swap ? 0x4 : 0x0); |
| 1554 | |
| 1555 | return 1; |
| 1556 | } |
| 1557 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1558 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 1559 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1560 | .name = xname, \ |
| 1561 | .index = 0, \ |
| 1562 | .info = stac92xx_io_switch_info, \ |
| 1563 | .get = stac92xx_io_switch_get, \ |
| 1564 | .put = stac92xx_io_switch_put, \ |
| 1565 | .private_value = xpval, \ |
| 1566 | } |
| 1567 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 1568 | #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \ |
| 1569 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1570 | .name = xname, \ |
| 1571 | .index = 0, \ |
| 1572 | .info = stac92xx_clfe_switch_info, \ |
| 1573 | .get = stac92xx_clfe_switch_get, \ |
| 1574 | .put = stac92xx_clfe_switch_put, \ |
| 1575 | .private_value = xpval, \ |
| 1576 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1577 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1578 | enum { |
| 1579 | STAC_CTL_WIDGET_VOL, |
| 1580 | STAC_CTL_WIDGET_MUTE, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1581 | STAC_CTL_WIDGET_IO_SWITCH, |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 1582 | STAC_CTL_WIDGET_CLFE_SWITCH |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1583 | }; |
| 1584 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1585 | static struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1586 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 1587 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1588 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 1589 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1590 | }; |
| 1591 | |
| 1592 | /* add dynamic controls */ |
| 1593 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val) |
| 1594 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1595 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1596 | |
| 1597 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 1598 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 1599 | |
| 1600 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ |
| 1601 | if (! knew) |
| 1602 | return -ENOMEM; |
| 1603 | if (spec->kctl_alloc) { |
| 1604 | memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); |
| 1605 | kfree(spec->kctl_alloc); |
| 1606 | } |
| 1607 | spec->kctl_alloc = knew; |
| 1608 | spec->num_kctl_alloc = num; |
| 1609 | } |
| 1610 | |
| 1611 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 1612 | *knew = stac92xx_control_templates[type]; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 1613 | knew->name = kstrdup(name, GFP_KERNEL); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1614 | if (! knew->name) |
| 1615 | return -ENOMEM; |
| 1616 | knew->private_value = val; |
| 1617 | spec->num_kctl_used++; |
| 1618 | return 0; |
| 1619 | } |
| 1620 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1621 | /* flag inputs as additional dynamic lineouts */ |
| 1622 | static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) |
| 1623 | { |
| 1624 | struct sigmatel_spec *spec = codec->spec; |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1625 | unsigned int wcaps, wtype; |
| 1626 | int i, num_dacs = 0; |
| 1627 | |
| 1628 | /* use the wcaps cache to count all DACs available for line-outs */ |
| 1629 | for (i = 0; i < codec->num_nodes; i++) { |
| 1630 | wcaps = codec->wcaps[i]; |
| 1631 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 1632 | if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL)) |
| 1633 | num_dacs++; |
| 1634 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1635 | |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1636 | snd_printdd("%s: total dac count=%d\n", __func__, num_dacs); |
| 1637 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1638 | switch (cfg->line_outs) { |
| 1639 | case 3: |
| 1640 | /* add line-in as side */ |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1641 | if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 1642 | cfg->line_out_pins[cfg->line_outs] = |
| 1643 | cfg->input_pins[AUTO_PIN_LINE]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1644 | spec->line_switch = 1; |
| 1645 | cfg->line_outs++; |
| 1646 | } |
| 1647 | break; |
| 1648 | case 2: |
| 1649 | /* add line-in as clfe and mic as side */ |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1650 | if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 1651 | cfg->line_out_pins[cfg->line_outs] = |
| 1652 | cfg->input_pins[AUTO_PIN_LINE]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1653 | spec->line_switch = 1; |
| 1654 | cfg->line_outs++; |
| 1655 | } |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1656 | if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 1657 | cfg->line_out_pins[cfg->line_outs] = |
| 1658 | cfg->input_pins[AUTO_PIN_MIC]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1659 | spec->mic_switch = 1; |
| 1660 | cfg->line_outs++; |
| 1661 | } |
| 1662 | break; |
| 1663 | case 1: |
| 1664 | /* add line-in as surr and mic as clfe */ |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1665 | if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 1666 | cfg->line_out_pins[cfg->line_outs] = |
| 1667 | cfg->input_pins[AUTO_PIN_LINE]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1668 | spec->line_switch = 1; |
| 1669 | cfg->line_outs++; |
| 1670 | } |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1671 | if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 1672 | cfg->line_out_pins[cfg->line_outs] = |
| 1673 | cfg->input_pins[AUTO_PIN_MIC]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1674 | spec->mic_switch = 1; |
| 1675 | cfg->line_outs++; |
| 1676 | } |
| 1677 | break; |
| 1678 | } |
| 1679 | |
| 1680 | return 0; |
| 1681 | } |
| 1682 | |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1683 | |
| 1684 | static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 1685 | { |
| 1686 | int i; |
| 1687 | |
| 1688 | for (i = 0; i < spec->multiout.num_dacs; i++) { |
| 1689 | if (spec->multiout.dac_nids[i] == nid) |
| 1690 | return 1; |
| 1691 | } |
| 1692 | |
| 1693 | return 0; |
| 1694 | } |
| 1695 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1696 | /* |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1697 | * Fill in the dac_nids table from the parsed pin configuration |
| 1698 | * This function only works when every pin in line_out_pins[] |
| 1699 | * contains atleast one DAC in its connection list. Some 92xx |
| 1700 | * codecs are not connected directly to a DAC, such as the 9200 |
| 1701 | * and 9202/925x. For those, dac_nids[] must be hard-coded. |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1702 | */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1703 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 1704 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1705 | { |
| 1706 | struct sigmatel_spec *spec = codec->spec; |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1707 | int i, j, conn_len = 0; |
| 1708 | hda_nid_t nid, conn[HDA_MAX_CONNECTIONS]; |
| 1709 | unsigned int wcaps, wtype; |
| 1710 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1711 | for (i = 0; i < cfg->line_outs; i++) { |
| 1712 | nid = cfg->line_out_pins[i]; |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1713 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 1714 | HDA_MAX_CONNECTIONS); |
| 1715 | for (j = 0; j < conn_len; j++) { |
| 1716 | wcaps = snd_hda_param_read(codec, conn[j], |
| 1717 | AC_PAR_AUDIO_WIDGET_CAP); |
| 1718 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 1719 | |
| 1720 | if (wtype != AC_WID_AUD_OUT || |
| 1721 | (wcaps & AC_WCAP_DIGITAL)) |
| 1722 | continue; |
| 1723 | /* conn[j] is a DAC routed to this line-out */ |
| 1724 | if (!is_in_dac_nids(spec, conn[j])) |
| 1725 | break; |
| 1726 | } |
| 1727 | |
| 1728 | if (j == conn_len) { |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 1729 | if (spec->multiout.num_dacs > 0) { |
| 1730 | /* we have already working output pins, |
| 1731 | * so let's drop the broken ones again |
| 1732 | */ |
| 1733 | cfg->line_outs = spec->multiout.num_dacs; |
| 1734 | break; |
| 1735 | } |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1736 | /* error out, no available DAC found */ |
| 1737 | snd_printk(KERN_ERR |
| 1738 | "%s: No available DAC for pin 0x%x\n", |
| 1739 | __func__, nid); |
| 1740 | return -ENODEV; |
| 1741 | } |
| 1742 | |
| 1743 | spec->multiout.dac_nids[i] = conn[j]; |
| 1744 | spec->multiout.num_dacs++; |
| 1745 | if (conn_len > 1) { |
| 1746 | /* select this DAC in the pin's input mux */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 1747 | snd_hda_codec_write_cache(codec, nid, 0, |
| 1748 | AC_VERB_SET_CONNECT_SEL, j); |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1749 | |
| 1750 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1751 | } |
| 1752 | |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1753 | snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", |
| 1754 | spec->multiout.num_dacs, |
| 1755 | spec->multiout.dac_nids[0], |
| 1756 | spec->multiout.dac_nids[1], |
| 1757 | spec->multiout.dac_nids[2], |
| 1758 | spec->multiout.dac_nids[3], |
| 1759 | spec->multiout.dac_nids[4]); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1760 | return 0; |
| 1761 | } |
| 1762 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1763 | /* create volume control/switch for the given prefx type */ |
| 1764 | static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs) |
| 1765 | { |
| 1766 | char name[32]; |
| 1767 | int err; |
| 1768 | |
| 1769 | sprintf(name, "%s Playback Volume", pfx); |
| 1770 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, |
| 1771 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 1772 | if (err < 0) |
| 1773 | return err; |
| 1774 | sprintf(name, "%s Playback Switch", pfx); |
| 1775 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, |
| 1776 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 1777 | if (err < 0) |
| 1778 | return err; |
| 1779 | return 0; |
| 1780 | } |
| 1781 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1782 | /* add playback controls from the parsed DAC table */ |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 1783 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1784 | const struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1785 | { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1786 | static const char *chname[4] = { |
| 1787 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 1788 | }; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1789 | hda_nid_t nid; |
| 1790 | int i, err; |
| 1791 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 1792 | struct sigmatel_spec *spec = codec->spec; |
| 1793 | unsigned int wid_caps; |
| 1794 | |
| 1795 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1796 | for (i = 0; i < cfg->line_outs; i++) { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1797 | if (!spec->multiout.dac_nids[i]) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1798 | continue; |
| 1799 | |
| 1800 | nid = spec->multiout.dac_nids[i]; |
| 1801 | |
| 1802 | if (i == 2) { |
| 1803 | /* Center/LFE */ |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1804 | err = create_controls(spec, "Center", nid, 1); |
| 1805 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1806 | return err; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1807 | err = create_controls(spec, "LFE", nid, 2); |
| 1808 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1809 | return err; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 1810 | |
| 1811 | wid_caps = get_wcaps(codec, nid); |
| 1812 | |
| 1813 | if (wid_caps & AC_WCAP_LR_SWAP) { |
| 1814 | err = stac92xx_add_control(spec, |
| 1815 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 1816 | "Swap Center/LFE Playback Switch", nid); |
| 1817 | |
| 1818 | if (err < 0) |
| 1819 | return err; |
| 1820 | } |
| 1821 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1822 | } else { |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1823 | err = create_controls(spec, chname[i], nid, 3); |
| 1824 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1825 | return err; |
| 1826 | } |
| 1827 | } |
| 1828 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1829 | if (spec->line_switch) |
| 1830 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Line In as Output Switch", cfg->input_pins[AUTO_PIN_LINE] << 8)) < 0) |
| 1831 | return err; |
| 1832 | |
| 1833 | if (spec->mic_switch) |
| 1834 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Mic as Output Switch", (cfg->input_pins[AUTO_PIN_MIC] << 8) | 1)) < 0) |
| 1835 | return err; |
| 1836 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1837 | return 0; |
| 1838 | } |
| 1839 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1840 | static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 1841 | { |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1842 | if (is_in_dac_nids(spec, nid)) |
| 1843 | return 1; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1844 | if (spec->multiout.hp_nid == nid) |
| 1845 | return 1; |
| 1846 | return 0; |
| 1847 | } |
| 1848 | |
| 1849 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
| 1850 | { |
| 1851 | if (!spec->multiout.hp_nid) |
| 1852 | spec->multiout.hp_nid = nid; |
| 1853 | else if (spec->multiout.num_dacs > 4) { |
| 1854 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); |
| 1855 | return 1; |
| 1856 | } else { |
| 1857 | spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; |
| 1858 | spec->multiout.num_dacs++; |
| 1859 | } |
| 1860 | return 0; |
| 1861 | } |
| 1862 | |
| 1863 | /* add playback controls for Speaker and HP outputs */ |
| 1864 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
| 1865 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1866 | { |
| 1867 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1868 | hda_nid_t nid; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1869 | int i, old_num_dacs, err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1870 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1871 | old_num_dacs = spec->multiout.num_dacs; |
| 1872 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1873 | unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); |
| 1874 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
| 1875 | spec->hp_detect = 1; |
| 1876 | nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, |
| 1877 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 1878 | if (check_in_dac_nids(spec, nid)) |
| 1879 | nid = 0; |
| 1880 | if (! nid) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1881 | continue; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1882 | add_spec_dacs(spec, nid); |
| 1883 | } |
| 1884 | for (i = 0; i < cfg->speaker_outs; i++) { |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 1885 | nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0, |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1886 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 1887 | if (check_in_dac_nids(spec, nid)) |
| 1888 | nid = 0; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1889 | if (! nid) |
| 1890 | continue; |
| 1891 | add_spec_dacs(spec, nid); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1892 | } |
Matthew Ranostay | 1b290a5 | 2007-07-12 15:17:34 +0200 | [diff] [blame] | 1893 | for (i = 0; i < cfg->line_outs; i++) { |
| 1894 | nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0, |
| 1895 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 1896 | if (check_in_dac_nids(spec, nid)) |
| 1897 | nid = 0; |
| 1898 | if (! nid) |
| 1899 | continue; |
| 1900 | add_spec_dacs(spec, nid); |
| 1901 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1902 | for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) { |
| 1903 | static const char *pfxs[] = { |
| 1904 | "Speaker", "External Speaker", "Speaker2", |
| 1905 | }; |
| 1906 | err = create_controls(spec, pfxs[i - old_num_dacs], |
| 1907 | spec->multiout.dac_nids[i], 3); |
| 1908 | if (err < 0) |
| 1909 | return err; |
| 1910 | } |
| 1911 | if (spec->multiout.hp_nid) { |
| 1912 | const char *pfx; |
| 1913 | if (old_num_dacs == spec->multiout.num_dacs) |
| 1914 | pfx = "Master"; |
| 1915 | else |
| 1916 | pfx = "Headphone"; |
| 1917 | err = create_controls(spec, pfx, spec->multiout.hp_nid, 3); |
| 1918 | if (err < 0) |
| 1919 | return err; |
| 1920 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1921 | |
| 1922 | return 0; |
| 1923 | } |
| 1924 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1925 | /* labels for dmic mux inputs */ |
Adrian Bunk | ddc2cec | 2006-11-20 12:03:44 +0100 | [diff] [blame] | 1926 | static const char *stac92xx_dmic_labels[5] = { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1927 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
| 1928 | "Digital Mic 3", "Digital Mic 4" |
| 1929 | }; |
| 1930 | |
| 1931 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| 1932 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
| 1933 | const struct auto_pin_cfg *cfg) |
| 1934 | { |
| 1935 | struct sigmatel_spec *spec = codec->spec; |
| 1936 | struct hda_input_mux *dimux = &spec->private_dimux; |
| 1937 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 1938 | int i, j; |
| 1939 | |
| 1940 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; |
| 1941 | dimux->items[dimux->num_items].index = 0; |
| 1942 | dimux->num_items++; |
| 1943 | |
| 1944 | for (i = 0; i < spec->num_dmics; i++) { |
| 1945 | int index; |
| 1946 | int num_cons; |
| 1947 | unsigned int def_conf; |
| 1948 | |
| 1949 | def_conf = snd_hda_codec_read(codec, |
| 1950 | spec->dmic_nids[i], |
| 1951 | 0, |
| 1952 | AC_VERB_GET_CONFIG_DEFAULT, |
| 1953 | 0); |
| 1954 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
| 1955 | continue; |
| 1956 | |
| 1957 | num_cons = snd_hda_get_connections(codec, |
| 1958 | spec->dmux_nid, |
| 1959 | con_lst, |
| 1960 | HDA_MAX_NUM_INPUTS); |
| 1961 | for (j = 0; j < num_cons; j++) |
| 1962 | if (con_lst[j] == spec->dmic_nids[i]) { |
| 1963 | index = j; |
| 1964 | goto found; |
| 1965 | } |
| 1966 | continue; |
| 1967 | found: |
| 1968 | dimux->items[dimux->num_items].label = |
| 1969 | stac92xx_dmic_labels[dimux->num_items]; |
| 1970 | dimux->items[dimux->num_items].index = index; |
| 1971 | dimux->num_items++; |
| 1972 | } |
| 1973 | |
| 1974 | return 0; |
| 1975 | } |
| 1976 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1977 | /* create playback/capture controls for input pins */ |
| 1978 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 1979 | { |
| 1980 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1981 | struct hda_input_mux *imux = &spec->private_imux; |
| 1982 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 1983 | int i, j, k; |
| 1984 | |
| 1985 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1986 | int index; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1987 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1988 | if (!cfg->input_pins[i]) |
| 1989 | continue; |
| 1990 | index = -1; |
| 1991 | for (j = 0; j < spec->num_muxes; j++) { |
| 1992 | int num_cons; |
| 1993 | num_cons = snd_hda_get_connections(codec, |
| 1994 | spec->mux_nids[j], |
| 1995 | con_lst, |
| 1996 | HDA_MAX_NUM_INPUTS); |
| 1997 | for (k = 0; k < num_cons; k++) |
| 1998 | if (con_lst[k] == cfg->input_pins[i]) { |
| 1999 | index = k; |
| 2000 | goto found; |
| 2001 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2002 | } |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2003 | continue; |
| 2004 | found: |
| 2005 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 2006 | imux->items[imux->num_items].index = index; |
| 2007 | imux->num_items++; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2008 | } |
| 2009 | |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2010 | if (imux->num_items) { |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 2011 | /* |
| 2012 | * Set the current input for the muxes. |
| 2013 | * The STAC9221 has two input muxes with identical source |
| 2014 | * NID lists. Hopefully this won't get confused. |
| 2015 | */ |
| 2016 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2017 | snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0, |
| 2018 | AC_VERB_SET_CONNECT_SEL, |
| 2019 | imux->items[0].index); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 2020 | } |
| 2021 | } |
| 2022 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2023 | return 0; |
| 2024 | } |
| 2025 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2026 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 2027 | { |
| 2028 | struct sigmatel_spec *spec = codec->spec; |
| 2029 | int i; |
| 2030 | |
| 2031 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 2032 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 2033 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 2038 | { |
| 2039 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2040 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2041 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2042 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 2043 | hda_nid_t pin; |
| 2044 | pin = spec->autocfg.hp_pins[i]; |
| 2045 | if (pin) /* connect to front */ |
| 2046 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 2047 | } |
| 2048 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 2049 | hda_nid_t pin; |
| 2050 | pin = spec->autocfg.speaker_pins[i]; |
| 2051 | if (pin) /* connect to front */ |
| 2052 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); |
| 2053 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2054 | } |
| 2055 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2056 | 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] | 2057 | { |
| 2058 | struct sigmatel_spec *spec = codec->spec; |
| 2059 | int err; |
| 2060 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2061 | if ((err = snd_hda_parse_pin_def_config(codec, |
| 2062 | &spec->autocfg, |
| 2063 | spec->dmic_nids)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2064 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2065 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 2066 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2067 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2068 | if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) |
| 2069 | return err; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2070 | if (spec->multiout.num_dacs == 0) |
| 2071 | if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) |
| 2072 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2073 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2074 | err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg); |
| 2075 | |
| 2076 | if (err < 0) |
| 2077 | return err; |
| 2078 | |
| 2079 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); |
| 2080 | |
| 2081 | if (err < 0) |
| 2082 | return err; |
| 2083 | |
| 2084 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); |
| 2085 | |
| 2086 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2087 | return err; |
| 2088 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2089 | if (spec->num_dmics > 0) |
| 2090 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
| 2091 | &spec->autocfg)) < 0) |
| 2092 | return err; |
| 2093 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2094 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2095 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2096 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2097 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2098 | if (spec->autocfg.dig_out_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2099 | spec->multiout.dig_out_nid = dig_out; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2100 | if (spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2101 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2102 | |
| 2103 | if (spec->kctl_alloc) |
| 2104 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 2105 | |
| 2106 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2107 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2108 | |
| 2109 | return 1; |
| 2110 | } |
| 2111 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2112 | /* add playback controls for HP output */ |
| 2113 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 2114 | struct auto_pin_cfg *cfg) |
| 2115 | { |
| 2116 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2117 | hda_nid_t pin = cfg->hp_pins[0]; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2118 | unsigned int wid_caps; |
| 2119 | |
| 2120 | if (! pin) |
| 2121 | return 0; |
| 2122 | |
| 2123 | wid_caps = get_wcaps(codec, pin); |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 2124 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2125 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2126 | |
| 2127 | return 0; |
| 2128 | } |
| 2129 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 2130 | /* add playback controls for LFE output */ |
| 2131 | static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, |
| 2132 | struct auto_pin_cfg *cfg) |
| 2133 | { |
| 2134 | struct sigmatel_spec *spec = codec->spec; |
| 2135 | int err; |
| 2136 | hda_nid_t lfe_pin = 0x0; |
| 2137 | int i; |
| 2138 | |
| 2139 | /* |
| 2140 | * search speaker outs and line outs for a mono speaker pin |
| 2141 | * with an amp. If one is found, add LFE controls |
| 2142 | * for it. |
| 2143 | */ |
| 2144 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
| 2145 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
| 2146 | unsigned long wcaps = get_wcaps(codec, pin); |
| 2147 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 2148 | if (wcaps == AC_WCAP_OUT_AMP) |
| 2149 | /* found a mono speaker with an amp, must be lfe */ |
| 2150 | lfe_pin = pin; |
| 2151 | } |
| 2152 | |
| 2153 | /* if speaker_outs is 0, then speakers may be in line_outs */ |
| 2154 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
| 2155 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
| 2156 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
| 2157 | unsigned long cfg; |
| 2158 | cfg = snd_hda_codec_read(codec, pin, 0, |
| 2159 | AC_VERB_GET_CONFIG_DEFAULT, |
| 2160 | 0x00); |
| 2161 | if (get_defcfg_device(cfg) == AC_JACK_SPEAKER) { |
| 2162 | unsigned long wcaps = get_wcaps(codec, pin); |
| 2163 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 2164 | if (wcaps == AC_WCAP_OUT_AMP) |
| 2165 | /* found a mono speaker with an amp, |
| 2166 | must be lfe */ |
| 2167 | lfe_pin = pin; |
| 2168 | } |
| 2169 | } |
| 2170 | } |
| 2171 | |
| 2172 | if (lfe_pin) { |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2173 | err = create_controls(spec, "LFE", lfe_pin, 1); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 2174 | if (err < 0) |
| 2175 | return err; |
| 2176 | } |
| 2177 | |
| 2178 | return 0; |
| 2179 | } |
| 2180 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2181 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 2182 | { |
| 2183 | struct sigmatel_spec *spec = codec->spec; |
| 2184 | int err; |
| 2185 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2186 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2187 | return err; |
| 2188 | |
| 2189 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 2190 | return err; |
| 2191 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2192 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 2193 | return err; |
| 2194 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 2195 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
| 2196 | return err; |
| 2197 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2198 | if (spec->autocfg.dig_out_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2199 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2200 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2201 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2202 | |
| 2203 | if (spec->kctl_alloc) |
| 2204 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 2205 | |
| 2206 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2207 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2208 | |
| 2209 | return 1; |
| 2210 | } |
| 2211 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 2212 | /* |
| 2213 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 2214 | * funky external mute control using GPIO pins. |
| 2215 | */ |
| 2216 | |
| 2217 | static void stac922x_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 2218 | { |
| 2219 | unsigned int gpiostate, gpiomask, gpiodir; |
| 2220 | |
| 2221 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 2222 | AC_VERB_GET_GPIO_DATA, 0); |
| 2223 | |
| 2224 | if (!muted) |
| 2225 | gpiostate |= (1 << pin); |
| 2226 | else |
| 2227 | gpiostate &= ~(1 << pin); |
| 2228 | |
| 2229 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 2230 | AC_VERB_GET_GPIO_MASK, 0); |
| 2231 | gpiomask |= (1 << pin); |
| 2232 | |
| 2233 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 2234 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 2235 | gpiodir |= (1 << pin); |
| 2236 | |
| 2237 | /* AppleHDA seems to do this -- WTF is this verb?? */ |
| 2238 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 2239 | |
| 2240 | snd_hda_codec_write(codec, codec->afg, 0, |
| 2241 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 2242 | snd_hda_codec_write(codec, codec->afg, 0, |
| 2243 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 2244 | |
| 2245 | msleep(1); |
| 2246 | |
| 2247 | snd_hda_codec_write(codec, codec->afg, 0, |
| 2248 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 2249 | } |
| 2250 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2251 | static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, |
| 2252 | unsigned int event) |
| 2253 | { |
| 2254 | if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 2255 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2256 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 2257 | (AC_USRSP_EN | event)); |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2258 | } |
| 2259 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2260 | static int stac92xx_init(struct hda_codec *codec) |
| 2261 | { |
| 2262 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2263 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2264 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2265 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2266 | snd_hda_sequence_write(codec, spec->init); |
| 2267 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2268 | /* set up pins */ |
| 2269 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 2270 | /* Enable unsolicited responses on the HP widget */ |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2271 | for (i = 0; i < cfg->hp_outs; i++) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2272 | enable_pin_detect(codec, cfg->hp_pins[i], |
| 2273 | STAC_HP_EVENT); |
Takashi Iwai | 0a07acaf | 2007-03-13 10:40:23 +0100 | [diff] [blame] | 2274 | /* force to enable the first line-out; the others are set up |
| 2275 | * in unsol_event |
| 2276 | */ |
| 2277 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
| 2278 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb995a8 | 2006-09-21 14:28:21 +0200 | [diff] [blame] | 2279 | stac92xx_auto_init_hp_out(codec); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2280 | /* fake event to set up pins */ |
| 2281 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
| 2282 | } else { |
| 2283 | stac92xx_auto_init_multi_out(codec); |
| 2284 | stac92xx_auto_init_hp_out(codec); |
| 2285 | } |
| 2286 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2287 | hda_nid_t nid = cfg->input_pins[i]; |
| 2288 | if (nid) { |
| 2289 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 2290 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) |
| 2291 | pinctl |= stac92xx_get_vref(codec, nid); |
| 2292 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 2293 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2294 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2295 | if (spec->num_dmics > 0) |
| 2296 | for (i = 0; i < spec->num_dmics; i++) |
| 2297 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
| 2298 | AC_PINCTL_IN_EN); |
| 2299 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2300 | if (cfg->dig_out_pin) |
| 2301 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, |
| 2302 | AC_PINCTL_OUT_EN); |
| 2303 | if (cfg->dig_in_pin) |
| 2304 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 2305 | AC_PINCTL_IN_EN); |
| 2306 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 2307 | if (spec->gpio_mute) { |
| 2308 | stac922x_gpio_mute(codec, 0, 0); |
| 2309 | stac922x_gpio_mute(codec, 1, 0); |
| 2310 | } |
| 2311 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2312 | return 0; |
| 2313 | } |
| 2314 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2315 | static void stac92xx_free(struct hda_codec *codec) |
| 2316 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2317 | struct sigmatel_spec *spec = codec->spec; |
| 2318 | int i; |
| 2319 | |
| 2320 | if (! spec) |
| 2321 | return; |
| 2322 | |
| 2323 | if (spec->kctl_alloc) { |
| 2324 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2325 | kfree(spec->kctl_alloc[i].name); |
| 2326 | kfree(spec->kctl_alloc); |
| 2327 | } |
| 2328 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2329 | if (spec->bios_pin_configs) |
| 2330 | kfree(spec->bios_pin_configs); |
| 2331 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2332 | kfree(spec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2333 | } |
| 2334 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 2335 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 2336 | unsigned int flag) |
| 2337 | { |
| 2338 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 2339 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2340 | |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 2341 | if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2342 | /* |
| 2343 | * we need to check the current set-up direction of |
| 2344 | * shared input pins since they can be switched via |
| 2345 | * "xxx as Output" mixer switch |
| 2346 | */ |
| 2347 | struct sigmatel_spec *spec = codec->spec; |
| 2348 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2349 | if ((nid == cfg->input_pins[AUTO_PIN_LINE] && |
| 2350 | spec->line_switch) || |
| 2351 | (nid == cfg->input_pins[AUTO_PIN_MIC] && |
| 2352 | spec->mic_switch)) |
| 2353 | return; |
| 2354 | } |
| 2355 | |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2356 | /* if setting pin direction bits, clear the current |
| 2357 | direction bits first */ |
| 2358 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
| 2359 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 2360 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2361 | snd_hda_codec_write_cache(codec, nid, 0, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 2362 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2363 | pin_ctl | flag); |
| 2364 | } |
| 2365 | |
| 2366 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 2367 | unsigned int flag) |
| 2368 | { |
| 2369 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 2370 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2371 | snd_hda_codec_write_cache(codec, nid, 0, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 2372 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2373 | pin_ctl & ~flag); |
| 2374 | } |
| 2375 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2376 | static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
| 2377 | { |
| 2378 | if (!nid) |
| 2379 | return 0; |
| 2380 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) |
| 2381 | & (1 << 31)) |
| 2382 | return 1; |
| 2383 | return 0; |
| 2384 | } |
| 2385 | |
| 2386 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 2387 | { |
| 2388 | struct sigmatel_spec *spec = codec->spec; |
| 2389 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2390 | int i, presence; |
| 2391 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2392 | presence = 0; |
| 2393 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2394 | presence = get_pin_presence(codec, cfg->hp_pins[i]); |
| 2395 | if (presence) |
| 2396 | break; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2397 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 2398 | |
| 2399 | if (presence) { |
| 2400 | /* disable lineouts, enable hp */ |
| 2401 | for (i = 0; i < cfg->line_outs; i++) |
| 2402 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 2403 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2404 | for (i = 0; i < cfg->speaker_outs; i++) |
| 2405 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
| 2406 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 2407 | } else { |
| 2408 | /* enable lineouts, disable hp */ |
| 2409 | for (i = 0; i < cfg->line_outs; i++) |
| 2410 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 2411 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2412 | for (i = 0; i < cfg->speaker_outs; i++) |
| 2413 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
| 2414 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 2415 | } |
| 2416 | } |
| 2417 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 2418 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2419 | { |
| 2420 | switch (res >> 26) { |
| 2421 | case STAC_HP_EVENT: |
| 2422 | stac92xx_hp_detect(codec, res); |
| 2423 | break; |
| 2424 | } |
| 2425 | } |
| 2426 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2427 | #ifdef SND_HDA_NEEDS_RESUME |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 2428 | static int stac92xx_resume(struct hda_codec *codec) |
| 2429 | { |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 2430 | struct sigmatel_spec *spec = codec->spec; |
| 2431 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2432 | stac92xx_set_config_regs(codec); |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 2433 | snd_hda_sequence_write(codec, spec->init); |
| 2434 | if (spec->gpio_mute) { |
| 2435 | stac922x_gpio_mute(codec, 0, 0); |
| 2436 | stac922x_gpio_mute(codec, 1, 0); |
| 2437 | } |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2438 | snd_hda_codec_resume_amp(codec); |
| 2439 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 2440 | /* invoke unsolicited event to reset the HP state */ |
| 2441 | if (spec->hp_detect) |
| 2442 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 2443 | return 0; |
| 2444 | } |
| 2445 | #endif |
| 2446 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2447 | static struct hda_codec_ops stac92xx_patch_ops = { |
| 2448 | .build_controls = stac92xx_build_controls, |
| 2449 | .build_pcms = stac92xx_build_pcms, |
| 2450 | .init = stac92xx_init, |
| 2451 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 2452 | .unsol_event = stac92xx_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2453 | #ifdef SND_HDA_NEEDS_RESUME |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 2454 | .resume = stac92xx_resume, |
| 2455 | #endif |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2456 | }; |
| 2457 | |
| 2458 | static int patch_stac9200(struct hda_codec *codec) |
| 2459 | { |
| 2460 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2461 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2462 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 2463 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2464 | if (spec == NULL) |
| 2465 | return -ENOMEM; |
| 2466 | |
| 2467 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 2468 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2469 | spec->pin_nids = stac9200_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2470 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
| 2471 | stac9200_models, |
| 2472 | stac9200_cfg_tbl); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2473 | if (spec->board_config < 0) { |
| 2474 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); |
| 2475 | err = stac92xx_save_bios_config_regs(codec); |
| 2476 | if (err < 0) { |
| 2477 | stac92xx_free(codec); |
| 2478 | return err; |
| 2479 | } |
| 2480 | spec->pin_configs = spec->bios_pin_configs; |
| 2481 | } else { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2482 | spec->pin_configs = stac9200_brd_tbl[spec->board_config]; |
| 2483 | stac92xx_set_config_regs(codec); |
| 2484 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2485 | |
| 2486 | spec->multiout.max_channels = 2; |
| 2487 | spec->multiout.num_dacs = 1; |
| 2488 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 2489 | spec->adc_nids = stac9200_adc_nids; |
| 2490 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2491 | spec->num_muxes = 1; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2492 | spec->num_dmics = 0; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2493 | spec->num_adcs = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2494 | |
| 2495 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2496 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2497 | |
| 2498 | err = stac9200_parse_auto_config(codec); |
| 2499 | if (err < 0) { |
| 2500 | stac92xx_free(codec); |
| 2501 | return err; |
| 2502 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2503 | |
| 2504 | codec->patch_ops = stac92xx_patch_ops; |
| 2505 | |
| 2506 | return 0; |
| 2507 | } |
| 2508 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 2509 | static int patch_stac925x(struct hda_codec *codec) |
| 2510 | { |
| 2511 | struct sigmatel_spec *spec; |
| 2512 | int err; |
| 2513 | |
| 2514 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 2515 | if (spec == NULL) |
| 2516 | return -ENOMEM; |
| 2517 | |
| 2518 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 2519 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 2520 | spec->pin_nids = stac925x_pin_nids; |
| 2521 | spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, |
| 2522 | stac925x_models, |
| 2523 | stac925x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 2524 | again: |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 2525 | if (spec->board_config < 0) { |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 2526 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," |
| 2527 | "using BIOS defaults\n"); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 2528 | err = stac92xx_save_bios_config_regs(codec); |
| 2529 | if (err < 0) { |
| 2530 | stac92xx_free(codec); |
| 2531 | return err; |
| 2532 | } |
| 2533 | spec->pin_configs = spec->bios_pin_configs; |
| 2534 | } else if (stac925x_brd_tbl[spec->board_config] != NULL){ |
| 2535 | spec->pin_configs = stac925x_brd_tbl[spec->board_config]; |
| 2536 | stac92xx_set_config_regs(codec); |
| 2537 | } |
| 2538 | |
| 2539 | spec->multiout.max_channels = 2; |
| 2540 | spec->multiout.num_dacs = 1; |
| 2541 | spec->multiout.dac_nids = stac925x_dac_nids; |
| 2542 | spec->adc_nids = stac925x_adc_nids; |
| 2543 | spec->mux_nids = stac925x_mux_nids; |
| 2544 | spec->num_muxes = 1; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2545 | spec->num_adcs = 1; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 2546 | switch (codec->vendor_id) { |
| 2547 | case 0x83847632: /* STAC9202 */ |
| 2548 | case 0x83847633: /* STAC9202D */ |
| 2549 | case 0x83847636: /* STAC9251 */ |
| 2550 | case 0x83847637: /* STAC9251D */ |
| 2551 | spec->num_dmics = 1; |
| 2552 | spec->dmic_nids = stac925x_dmic_nids; |
| 2553 | break; |
| 2554 | default: |
| 2555 | spec->num_dmics = 0; |
| 2556 | break; |
| 2557 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 2558 | |
| 2559 | spec->init = stac925x_core_init; |
| 2560 | spec->mixer = stac925x_mixer; |
| 2561 | |
| 2562 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 2563 | if (!err) { |
| 2564 | if (spec->board_config < 0) { |
| 2565 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 2566 | "available, default to model=ref\n"); |
| 2567 | spec->board_config = STAC_925x_REF; |
| 2568 | goto again; |
| 2569 | } |
| 2570 | err = -EINVAL; |
| 2571 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 2572 | if (err < 0) { |
| 2573 | stac92xx_free(codec); |
| 2574 | return err; |
| 2575 | } |
| 2576 | |
| 2577 | codec->patch_ops = stac92xx_patch_ops; |
| 2578 | |
| 2579 | return 0; |
| 2580 | } |
| 2581 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2582 | static int patch_stac922x(struct hda_codec *codec) |
| 2583 | { |
| 2584 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2585 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2586 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 2587 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2588 | if (spec == NULL) |
| 2589 | return -ENOMEM; |
| 2590 | |
| 2591 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 2592 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2593 | spec->pin_nids = stac922x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2594 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
| 2595 | stac922x_models, |
| 2596 | stac922x_cfg_tbl); |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2597 | if (spec->board_config == STAC_INTEL_MAC_V3) { |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 2598 | spec->gpio_mute = 1; |
| 2599 | /* Intel Macs have all same PCI SSID, so we need to check |
| 2600 | * codec SSID to distinguish the exact models |
| 2601 | */ |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 2602 | 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] | 2603 | switch (codec->subsystem_id) { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2604 | |
| 2605 | case 0x106b0800: |
| 2606 | spec->board_config = STAC_INTEL_MAC_V1; |
Abhijit Bhopatkar | c45e20e | 2007-04-17 11:57:16 +0200 | [diff] [blame] | 2607 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2608 | case 0x106b0600: |
| 2609 | case 0x106b0700: |
| 2610 | spec->board_config = STAC_INTEL_MAC_V2; |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 2611 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2612 | case 0x106b0e00: |
| 2613 | case 0x106b0f00: |
| 2614 | case 0x106b1600: |
| 2615 | case 0x106b1700: |
| 2616 | case 0x106b0200: |
| 2617 | case 0x106b1e00: |
| 2618 | spec->board_config = STAC_INTEL_MAC_V3; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 2619 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2620 | case 0x106b1a00: |
| 2621 | case 0x00000100: |
| 2622 | spec->board_config = STAC_INTEL_MAC_V4; |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 2623 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2624 | case 0x106b0a00: |
| 2625 | case 0x106b2200: |
| 2626 | spec->board_config = STAC_INTEL_MAC_V5; |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 2627 | break; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 2628 | } |
| 2629 | } |
| 2630 | |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 2631 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2632 | if (spec->board_config < 0) { |
| 2633 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " |
| 2634 | "using BIOS defaults\n"); |
| 2635 | err = stac92xx_save_bios_config_regs(codec); |
| 2636 | if (err < 0) { |
| 2637 | stac92xx_free(codec); |
| 2638 | return err; |
| 2639 | } |
| 2640 | spec->pin_configs = spec->bios_pin_configs; |
| 2641 | } else if (stac922x_brd_tbl[spec->board_config] != NULL) { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2642 | spec->pin_configs = stac922x_brd_tbl[spec->board_config]; |
| 2643 | stac92xx_set_config_regs(codec); |
| 2644 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2645 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2646 | spec->adc_nids = stac922x_adc_nids; |
| 2647 | spec->mux_nids = stac922x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 2648 | spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2649 | spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2650 | spec->num_dmics = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2651 | |
| 2652 | spec->init = stac922x_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2653 | spec->mixer = stac922x_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2654 | |
| 2655 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2656 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2657 | err = stac92xx_parse_auto_config(codec, 0x08, 0x09); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 2658 | if (!err) { |
| 2659 | if (spec->board_config < 0) { |
| 2660 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 2661 | "available, default to model=ref\n"); |
| 2662 | spec->board_config = STAC_D945_REF; |
| 2663 | goto again; |
| 2664 | } |
| 2665 | err = -EINVAL; |
| 2666 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2667 | if (err < 0) { |
| 2668 | stac92xx_free(codec); |
| 2669 | return err; |
| 2670 | } |
| 2671 | |
| 2672 | codec->patch_ops = stac92xx_patch_ops; |
| 2673 | |
Takashi Iwai | 807a4636 | 2007-05-29 19:01:37 +0200 | [diff] [blame] | 2674 | /* Fix Mux capture level; max to 2 */ |
| 2675 | snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT, |
| 2676 | (0 << AC_AMPCAP_OFFSET_SHIFT) | |
| 2677 | (2 << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 2678 | (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 2679 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 2680 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2681 | return 0; |
| 2682 | } |
| 2683 | |
| 2684 | static int patch_stac927x(struct hda_codec *codec) |
| 2685 | { |
| 2686 | struct sigmatel_spec *spec; |
| 2687 | int err; |
| 2688 | |
| 2689 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 2690 | if (spec == NULL) |
| 2691 | return -ENOMEM; |
| 2692 | |
| 2693 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 2694 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2695 | spec->pin_nids = stac927x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2696 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
| 2697 | stac927x_models, |
| 2698 | stac927x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 2699 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2700 | if (spec->board_config < 0) { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2701 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n"); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2702 | err = stac92xx_save_bios_config_regs(codec); |
| 2703 | if (err < 0) { |
| 2704 | stac92xx_free(codec); |
| 2705 | return err; |
| 2706 | } |
| 2707 | spec->pin_configs = spec->bios_pin_configs; |
| 2708 | } else if (stac927x_brd_tbl[spec->board_config] != NULL) { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2709 | spec->pin_configs = stac927x_brd_tbl[spec->board_config]; |
| 2710 | stac92xx_set_config_regs(codec); |
| 2711 | } |
| 2712 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2713 | switch (spec->board_config) { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2714 | case STAC_D965_3ST: |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2715 | spec->adc_nids = stac927x_adc_nids; |
| 2716 | spec->mux_nids = stac927x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 2717 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2718 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2719 | spec->num_dmics = 0; |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2720 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2721 | spec->mixer = stac927x_mixer; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2722 | break; |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2723 | case STAC_D965_5ST: |
| 2724 | spec->adc_nids = stac927x_adc_nids; |
| 2725 | spec->mux_nids = stac927x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 2726 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2727 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2728 | spec->num_dmics = 0; |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2729 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2730 | spec->mixer = stac927x_mixer; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2731 | break; |
| 2732 | default: |
| 2733 | spec->adc_nids = stac927x_adc_nids; |
| 2734 | spec->mux_nids = stac927x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 2735 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2736 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2737 | spec->num_dmics = 0; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2738 | spec->init = stac927x_core_init; |
| 2739 | spec->mixer = stac927x_mixer; |
| 2740 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2741 | |
| 2742 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2743 | /* GPIO0 High = Enable EAPD */ |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 2744 | spec->gpio_mask = spec->gpio_data = 0x00000001; |
| 2745 | stac92xx_enable_gpio_mask(codec); |
Matthew Ranostay | 92a22be | 2007-06-19 16:48:28 +0200 | [diff] [blame] | 2746 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2747 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 2748 | if (!err) { |
| 2749 | if (spec->board_config < 0) { |
| 2750 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 2751 | "available, default to model=ref\n"); |
| 2752 | spec->board_config = STAC_D965_REF; |
| 2753 | goto again; |
| 2754 | } |
| 2755 | err = -EINVAL; |
| 2756 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2757 | if (err < 0) { |
| 2758 | stac92xx_free(codec); |
| 2759 | return err; |
| 2760 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2761 | |
| 2762 | codec->patch_ops = stac92xx_patch_ops; |
| 2763 | |
| 2764 | return 0; |
| 2765 | } |
| 2766 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2767 | static int patch_stac9205(struct hda_codec *codec) |
| 2768 | { |
| 2769 | struct sigmatel_spec *spec; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 2770 | int err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2771 | |
| 2772 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 2773 | if (spec == NULL) |
| 2774 | return -ENOMEM; |
| 2775 | |
| 2776 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 2777 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2778 | spec->pin_nids = stac9205_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2779 | spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, |
| 2780 | stac9205_models, |
| 2781 | stac9205_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 2782 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2783 | if (spec->board_config < 0) { |
| 2784 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); |
| 2785 | err = stac92xx_save_bios_config_regs(codec); |
| 2786 | if (err < 0) { |
| 2787 | stac92xx_free(codec); |
| 2788 | return err; |
| 2789 | } |
| 2790 | spec->pin_configs = spec->bios_pin_configs; |
| 2791 | } else { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2792 | spec->pin_configs = stac9205_brd_tbl[spec->board_config]; |
| 2793 | stac92xx_set_config_regs(codec); |
| 2794 | } |
| 2795 | |
| 2796 | spec->adc_nids = stac9205_adc_nids; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2797 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2798 | spec->mux_nids = stac9205_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 2799 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2800 | spec->dmic_nids = stac9205_dmic_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 2801 | spec->num_dmics = ARRAY_SIZE(stac9205_dmic_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2802 | spec->dmux_nid = 0x1d; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2803 | |
| 2804 | spec->init = stac9205_core_init; |
| 2805 | spec->mixer = stac9205_mixer; |
| 2806 | |
| 2807 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2808 | |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2809 | switch (spec->board_config){ |
| 2810 | case STAC_9205_M43xx: |
| 2811 | case STAC_9205_DELL_M43: |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2812 | /* Enable SPDIF in/out */ |
| 2813 | stac92xx_set_config_reg(codec, 0x1f, 0x01441030); |
| 2814 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); |
Matt Porter | 3338240 | 2006-12-18 13:17:28 +0100 | [diff] [blame] | 2815 | |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 2816 | spec->gpio_mask = 0x00000007; /* GPIO0-2 */ |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2817 | /* GPIO0 High = EAPD, GPIO1 Low = DRM, |
| 2818 | * GPIO2 High = Headphone Mute |
| 2819 | */ |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 2820 | spec->gpio_data = 0x00000005; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2821 | break; |
| 2822 | default: |
| 2823 | /* GPIO0 High = EAPD */ |
| 2824 | spec->gpio_mask = spec->gpio_data = 0x00000001; |
| 2825 | break; |
| 2826 | } |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2827 | |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 2828 | stac92xx_enable_gpio_mask(codec); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2829 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 2830 | if (!err) { |
| 2831 | if (spec->board_config < 0) { |
| 2832 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 2833 | "available, default to model=ref\n"); |
| 2834 | spec->board_config = STAC_9205_REF; |
| 2835 | goto again; |
| 2836 | } |
| 2837 | err = -EINVAL; |
| 2838 | } |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2839 | if (err < 0) { |
| 2840 | stac92xx_free(codec); |
| 2841 | return err; |
| 2842 | } |
| 2843 | |
| 2844 | codec->patch_ops = stac92xx_patch_ops; |
| 2845 | |
| 2846 | return 0; |
| 2847 | } |
| 2848 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2849 | /* |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2850 | * STAC9872 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2851 | */ |
| 2852 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 2853 | /* static config for Sony VAIO FE550G and Sony VAIO AR */ |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2854 | static hda_nid_t vaio_dacs[] = { 0x2 }; |
| 2855 | #define VAIO_HP_DAC 0x5 |
| 2856 | static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ }; |
| 2857 | static hda_nid_t vaio_mux_nids[] = { 0x15 }; |
| 2858 | |
| 2859 | static struct hda_input_mux vaio_mux = { |
| 2860 | .num_items = 2, |
| 2861 | .items = { |
Takashi Iwai | d773781 | 2006-04-25 13:05:43 +0200 | [diff] [blame] | 2862 | /* { "HP", 0x0 }, */ |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 2863 | { "Mic Jack", 0x1 }, |
| 2864 | { "Internal Mic", 0x2 }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2865 | { "PCM", 0x3 }, |
| 2866 | } |
| 2867 | }; |
| 2868 | |
| 2869 | static struct hda_verb vaio_init[] = { |
| 2870 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 2871 | {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT}, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2872 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
| 2873 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
| 2874 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
| 2875 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 2876 | {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] | 2877 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ |
| 2878 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ |
| 2879 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ |
| 2880 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ |
| 2881 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 2882 | {} |
| 2883 | }; |
| 2884 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2885 | static struct hda_verb vaio_ar_init[] = { |
| 2886 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
| 2887 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
| 2888 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
| 2889 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
| 2890 | /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */ |
| 2891 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 2892 | {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] | 2893 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ |
| 2894 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ |
| 2895 | /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */ |
| 2896 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ |
| 2897 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ |
| 2898 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 2899 | {} |
| 2900 | }; |
| 2901 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2902 | /* bind volumes of both NID 0x02 and 0x05 */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 2903 | static struct hda_bind_ctls vaio_bind_master_vol = { |
| 2904 | .ops = &snd_hda_bind_vol, |
| 2905 | .values = { |
| 2906 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 2907 | HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), |
| 2908 | 0 |
| 2909 | }, |
| 2910 | }; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2911 | |
| 2912 | /* bind volumes of both NID 0x02 and 0x05 */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 2913 | static struct hda_bind_ctls vaio_bind_master_sw = { |
| 2914 | .ops = &snd_hda_bind_sw, |
| 2915 | .values = { |
| 2916 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 2917 | HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), |
| 2918 | 0, |
| 2919 | }, |
| 2920 | }; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2921 | |
| 2922 | static struct snd_kcontrol_new vaio_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 2923 | HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), |
| 2924 | HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2925 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
| 2926 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 2927 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
| 2928 | { |
| 2929 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2930 | .name = "Capture Source", |
| 2931 | .count = 1, |
| 2932 | .info = stac92xx_mux_enum_info, |
| 2933 | .get = stac92xx_mux_enum_get, |
| 2934 | .put = stac92xx_mux_enum_put, |
| 2935 | }, |
| 2936 | {} |
| 2937 | }; |
| 2938 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2939 | static struct snd_kcontrol_new vaio_ar_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 2940 | HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), |
| 2941 | HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2942 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
| 2943 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 2944 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
| 2945 | /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT), |
| 2946 | HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/ |
| 2947 | { |
| 2948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2949 | .name = "Capture Source", |
| 2950 | .count = 1, |
| 2951 | .info = stac92xx_mux_enum_info, |
| 2952 | .get = stac92xx_mux_enum_get, |
| 2953 | .put = stac92xx_mux_enum_put, |
| 2954 | }, |
| 2955 | {} |
| 2956 | }; |
| 2957 | |
| 2958 | static struct hda_codec_ops stac9872_patch_ops = { |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2959 | .build_controls = stac92xx_build_controls, |
| 2960 | .build_pcms = stac92xx_build_pcms, |
| 2961 | .init = stac92xx_init, |
| 2962 | .free = stac92xx_free, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2963 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2964 | .resume = stac92xx_resume, |
| 2965 | #endif |
| 2966 | }; |
| 2967 | |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 2968 | static int stac9872_vaio_init(struct hda_codec *codec) |
| 2969 | { |
| 2970 | int err; |
| 2971 | |
| 2972 | err = stac92xx_init(codec); |
| 2973 | if (err < 0) |
| 2974 | return err; |
| 2975 | if (codec->patch_ops.unsol_event) |
| 2976 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
| 2977 | return 0; |
| 2978 | } |
| 2979 | |
| 2980 | static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res) |
| 2981 | { |
| 2982 | if (get_pin_presence(codec, 0x0a)) { |
| 2983 | stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); |
| 2984 | stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); |
| 2985 | } else { |
| 2986 | stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); |
| 2987 | stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); |
| 2988 | } |
| 2989 | } |
| 2990 | |
| 2991 | static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2992 | { |
| 2993 | switch (res >> 26) { |
| 2994 | case STAC_HP_EVENT: |
| 2995 | stac9872_vaio_hp_detect(codec, res); |
| 2996 | break; |
| 2997 | } |
| 2998 | } |
| 2999 | |
| 3000 | static struct hda_codec_ops stac9872_vaio_patch_ops = { |
| 3001 | .build_controls = stac92xx_build_controls, |
| 3002 | .build_pcms = stac92xx_build_pcms, |
| 3003 | .init = stac9872_vaio_init, |
| 3004 | .free = stac92xx_free, |
| 3005 | .unsol_event = stac9872_vaio_unsol_event, |
| 3006 | #ifdef CONFIG_PM |
| 3007 | .resume = stac92xx_resume, |
| 3008 | #endif |
| 3009 | }; |
| 3010 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 3011 | enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ |
| 3012 | CXD9872RD_VAIO, |
| 3013 | /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ |
| 3014 | STAC9872AK_VAIO, |
| 3015 | /* Unknown. id=0x83847661 and subsys=0x104D1200. */ |
| 3016 | STAC9872K_VAIO, |
| 3017 | /* AR Series. id=0x83847664 and subsys=104D1300 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3018 | CXD9872AKD_VAIO, |
| 3019 | STAC_9872_MODELS, |
| 3020 | }; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 3021 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3022 | static const char *stac9872_models[STAC_9872_MODELS] = { |
| 3023 | [CXD9872RD_VAIO] = "vaio", |
| 3024 | [CXD9872AKD_VAIO] = "vaio-ar", |
| 3025 | }; |
| 3026 | |
| 3027 | static struct snd_pci_quirk stac9872_cfg_tbl[] = { |
| 3028 | SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO), |
| 3029 | SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO), |
| 3030 | SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO), |
Tobin Davis | 68e2254 | 2007-03-12 11:36:39 +0100 | [diff] [blame] | 3031 | SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO), |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 3032 | {} |
| 3033 | }; |
| 3034 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 3035 | static int patch_stac9872(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 3036 | { |
| 3037 | struct sigmatel_spec *spec; |
| 3038 | int board_config; |
| 3039 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3040 | board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, |
| 3041 | stac9872_models, |
| 3042 | stac9872_cfg_tbl); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 3043 | if (board_config < 0) |
| 3044 | /* unknown config, let generic-parser do its job... */ |
| 3045 | return snd_hda_parse_generic_codec(codec); |
| 3046 | |
| 3047 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 3048 | if (spec == NULL) |
| 3049 | return -ENOMEM; |
| 3050 | |
| 3051 | codec->spec = spec; |
| 3052 | switch (board_config) { |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 3053 | case CXD9872RD_VAIO: |
| 3054 | case STAC9872AK_VAIO: |
| 3055 | case STAC9872K_VAIO: |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 3056 | spec->mixer = vaio_mixer; |
| 3057 | spec->init = vaio_init; |
| 3058 | spec->multiout.max_channels = 2; |
| 3059 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); |
| 3060 | spec->multiout.dac_nids = vaio_dacs; |
| 3061 | spec->multiout.hp_nid = VAIO_HP_DAC; |
| 3062 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); |
| 3063 | spec->adc_nids = vaio_adcs; |
| 3064 | spec->input_mux = &vaio_mux; |
| 3065 | spec->mux_nids = vaio_mux_nids; |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 3066 | codec->patch_ops = stac9872_vaio_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 3067 | break; |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 3068 | |
| 3069 | case CXD9872AKD_VAIO: |
| 3070 | spec->mixer = vaio_ar_mixer; |
| 3071 | spec->init = vaio_ar_init; |
| 3072 | spec->multiout.max_channels = 2; |
| 3073 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); |
| 3074 | spec->multiout.dac_nids = vaio_dacs; |
| 3075 | spec->multiout.hp_nid = VAIO_HP_DAC; |
| 3076 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); |
| 3077 | spec->adc_nids = vaio_adcs; |
| 3078 | spec->input_mux = &vaio_mux; |
| 3079 | spec->mux_nids = vaio_mux_nids; |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 3080 | codec->patch_ops = stac9872_patch_ops; |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 3081 | break; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 3082 | } |
| 3083 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 3084 | return 0; |
| 3085 | } |
| 3086 | |
| 3087 | |
| 3088 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3089 | * patch entries |
| 3090 | */ |
| 3091 | struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
| 3092 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 3093 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 3094 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 3095 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 3096 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 3097 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 3098 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 3099 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 3100 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 3101 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 3102 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 3103 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 3104 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3105 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 3106 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 3107 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 3108 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 3109 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 3110 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 3111 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 3112 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 3113 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 3114 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 3115 | { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, |
| 3116 | { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, |
| 3117 | { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x }, |
| 3118 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
| 3119 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
| 3120 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 3121 | /* The following does not take into account .id=0x83847661 when subsys = |
| 3122 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
| 3123 | * currently not fully supported. |
| 3124 | */ |
| 3125 | { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, |
| 3126 | { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, |
| 3127 | { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 3128 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 3129 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 3130 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 3131 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 3132 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 3133 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 3134 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 3135 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 3136 | {} /* terminator */ |
| 3137 | }; |