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, |
| 42 | STAC_9200_MODELS |
| 43 | }; |
| 44 | |
| 45 | enum { |
| 46 | STAC_9205_REF, |
| 47 | STAC_9205_MODELS |
| 48 | }; |
| 49 | |
| 50 | enum { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 51 | STAC_925x_REF, |
| 52 | STAC_M2_2, |
| 53 | STAC_MA6, |
| 54 | STAC_925x_MODELS |
| 55 | }; |
| 56 | |
| 57 | enum { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 58 | STAC_D945_REF, |
| 59 | STAC_D945GTP3, |
| 60 | STAC_D945GTP5, |
| 61 | STAC_MACMINI, |
| 62 | STAC_922X_MODELS |
| 63 | }; |
| 64 | |
| 65 | enum { |
| 66 | STAC_D965_REF, |
| 67 | STAC_D965_3ST, |
| 68 | STAC_D965_5ST, |
| 69 | STAC_927X_MODELS |
| 70 | }; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 71 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 72 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 73 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 74 | unsigned int num_mixers; |
| 75 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 76 | int board_config; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 77 | unsigned int surr_switch: 1; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 78 | unsigned int line_switch: 1; |
| 79 | unsigned int mic_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 80 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 81 | unsigned int hp_detect: 1; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 82 | unsigned int gpio_mute: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 83 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 84 | /* playback */ |
| 85 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 86 | hda_nid_t dac_nids[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 87 | |
| 88 | /* capture */ |
| 89 | hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 90 | unsigned int num_adcs; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 91 | hda_nid_t *mux_nids; |
| 92 | unsigned int num_muxes; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 93 | hda_nid_t *dmic_nids; |
| 94 | unsigned int num_dmics; |
| 95 | hda_nid_t dmux_nid; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 96 | hda_nid_t dig_in_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 97 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 98 | /* pin widgets */ |
| 99 | hda_nid_t *pin_nids; |
| 100 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 101 | unsigned int *pin_configs; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 102 | unsigned int *bios_pin_configs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 103 | |
| 104 | /* codec specific stuff */ |
| 105 | struct hda_verb *init; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 106 | struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 107 | |
| 108 | /* capture source */ |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 109 | struct hda_input_mux *dinput_mux; |
| 110 | unsigned int cur_dmux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 111 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 112 | unsigned int cur_mux[3]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 113 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 114 | /* i/o switches */ |
| 115 | unsigned int io_switch[2]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 116 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 117 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 118 | |
| 119 | /* dynamic controls and input_mux */ |
| 120 | struct auto_pin_cfg autocfg; |
| 121 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 122 | struct snd_kcontrol_new *kctl_alloc; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 123 | struct hda_input_mux private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 124 | struct hda_input_mux private_imux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | static hda_nid_t stac9200_adc_nids[1] = { |
| 128 | 0x03, |
| 129 | }; |
| 130 | |
| 131 | static hda_nid_t stac9200_mux_nids[1] = { |
| 132 | 0x0c, |
| 133 | }; |
| 134 | |
| 135 | static hda_nid_t stac9200_dac_nids[1] = { |
| 136 | 0x02, |
| 137 | }; |
| 138 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 139 | static hda_nid_t stac925x_adc_nids[1] = { |
| 140 | 0x03, |
| 141 | }; |
| 142 | |
| 143 | static hda_nid_t stac925x_mux_nids[1] = { |
| 144 | 0x0f, |
| 145 | }; |
| 146 | |
| 147 | static hda_nid_t stac925x_dac_nids[1] = { |
| 148 | 0x02, |
| 149 | }; |
| 150 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 151 | static hda_nid_t stac922x_adc_nids[2] = { |
| 152 | 0x06, 0x07, |
| 153 | }; |
| 154 | |
| 155 | static hda_nid_t stac922x_mux_nids[2] = { |
| 156 | 0x12, 0x13, |
| 157 | }; |
| 158 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 159 | static hda_nid_t stac927x_adc_nids[3] = { |
| 160 | 0x07, 0x08, 0x09 |
| 161 | }; |
| 162 | |
| 163 | static hda_nid_t stac927x_mux_nids[3] = { |
| 164 | 0x15, 0x16, 0x17 |
| 165 | }; |
| 166 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 167 | static hda_nid_t stac9205_adc_nids[2] = { |
| 168 | 0x12, 0x13 |
| 169 | }; |
| 170 | |
| 171 | static hda_nid_t stac9205_mux_nids[2] = { |
| 172 | 0x19, 0x1a |
| 173 | }; |
| 174 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 175 | static hda_nid_t stac9205_dmic_nids[3] = { |
| 176 | 0x17, 0x18, 0 |
| 177 | }; |
| 178 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 179 | static hda_nid_t stac9200_pin_nids[8] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 180 | 0x08, 0x09, 0x0d, 0x0e, |
| 181 | 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 182 | }; |
| 183 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 184 | static hda_nid_t stac925x_pin_nids[8] = { |
| 185 | 0x07, 0x08, 0x0a, 0x0b, |
| 186 | 0x0c, 0x0d, 0x10, 0x11, |
| 187 | }; |
| 188 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 189 | static hda_nid_t stac922x_pin_nids[10] = { |
| 190 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 191 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 192 | }; |
| 193 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 194 | static hda_nid_t stac927x_pin_nids[14] = { |
| 195 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 196 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 197 | 0x14, 0x21, 0x22, 0x23, |
| 198 | }; |
| 199 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 200 | static hda_nid_t stac9205_pin_nids[12] = { |
| 201 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 202 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 203 | 0x21, 0x22, |
| 204 | |
| 205 | }; |
| 206 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 207 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
| 208 | struct snd_ctl_elem_info *uinfo) |
| 209 | { |
| 210 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 211 | struct sigmatel_spec *spec = codec->spec; |
| 212 | return snd_hda_input_mux_info(spec->dinput_mux, uinfo); |
| 213 | } |
| 214 | |
| 215 | static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, |
| 216 | struct snd_ctl_elem_value *ucontrol) |
| 217 | { |
| 218 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 219 | struct sigmatel_spec *spec = codec->spec; |
| 220 | |
| 221 | ucontrol->value.enumerated.item[0] = spec->cur_dmux; |
| 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, |
| 226 | struct snd_ctl_elem_value *ucontrol) |
| 227 | { |
| 228 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 229 | struct sigmatel_spec *spec = codec->spec; |
| 230 | |
| 231 | return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, |
| 232 | spec->dmux_nid, &spec->cur_dmux); |
| 233 | } |
| 234 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 235 | 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] | 236 | { |
| 237 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 238 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 239 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 240 | } |
| 241 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 242 | 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] | 243 | { |
| 244 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 245 | struct sigmatel_spec *spec = codec->spec; |
| 246 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 247 | |
| 248 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 249 | return 0; |
| 250 | } |
| 251 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 252 | 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] | 253 | { |
| 254 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 255 | struct sigmatel_spec *spec = codec->spec; |
| 256 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 257 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 258 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 259 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); |
| 260 | } |
| 261 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 262 | static struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 263 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 264 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 265 | {} |
| 266 | }; |
| 267 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 268 | static struct hda_verb stac925x_core_init[] = { |
| 269 | /* set dac0mux for dac converter */ |
| 270 | { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 271 | {} |
| 272 | }; |
| 273 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 274 | static struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 275 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 276 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 277 | {} |
| 278 | }; |
| 279 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 280 | static struct hda_verb d965_core_init[] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 281 | /* set master volume and direct control */ |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 282 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 283 | /* unmute node 0x1b */ |
| 284 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 285 | /* select node 0x03 as DAC */ |
| 286 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 287 | {} |
| 288 | }; |
| 289 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 290 | static struct hda_verb stac927x_core_init[] = { |
| 291 | /* set master volume and direct control */ |
| 292 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 293 | {} |
| 294 | }; |
| 295 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 296 | static struct hda_verb stac9205_core_init[] = { |
| 297 | /* set master volume and direct control */ |
| 298 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 299 | {} |
| 300 | }; |
| 301 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 302 | static struct snd_kcontrol_new stac9200_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 303 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 304 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), |
| 305 | { |
| 306 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 307 | .name = "Input Source", |
| 308 | .count = 1, |
| 309 | .info = stac92xx_mux_enum_info, |
| 310 | .get = stac92xx_mux_enum_get, |
| 311 | .put = stac92xx_mux_enum_put, |
| 312 | }, |
| 313 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 314 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 315 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 316 | { } /* end */ |
| 317 | }; |
| 318 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 319 | static struct snd_kcontrol_new stac925x_mixer[] = { |
| 320 | HDA_CODEC_VOLUME("Master Playback Volume", 0xe, 0, HDA_OUTPUT), |
| 321 | HDA_CODEC_MUTE("Master Playback Switch", 0xe, 0, HDA_OUTPUT), |
| 322 | { |
| 323 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 324 | .name = "Input Source", |
| 325 | .count = 1, |
| 326 | .info = stac92xx_mux_enum_info, |
| 327 | .get = stac92xx_mux_enum_get, |
| 328 | .put = stac92xx_mux_enum_put, |
| 329 | }, |
| 330 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), |
| 331 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT), |
| 332 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT), |
| 333 | { } /* end */ |
| 334 | }; |
| 335 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 336 | /* This needs to be generated dynamically based on sequence */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 337 | static struct snd_kcontrol_new stac922x_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 338 | { |
| 339 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 340 | .name = "Input Source", |
| 341 | .count = 1, |
| 342 | .info = stac92xx_mux_enum_info, |
| 343 | .get = stac92xx_mux_enum_get, |
| 344 | .put = stac92xx_mux_enum_put, |
| 345 | }, |
| 346 | HDA_CODEC_VOLUME("Capture Volume", 0x17, 0x0, HDA_INPUT), |
Takashi Iwai | 0fd1708 | 2006-01-13 18:46:21 +0100 | [diff] [blame] | 347 | HDA_CODEC_MUTE("Capture Switch", 0x17, 0x0, HDA_INPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 348 | HDA_CODEC_VOLUME("Mux Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
| 349 | { } /* end */ |
| 350 | }; |
| 351 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 352 | /* This needs to be generated dynamically based on sequence */ |
| 353 | static struct snd_kcontrol_new stac9227_mixer[] = { |
| 354 | { |
| 355 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 356 | .name = "Input Source", |
| 357 | .count = 1, |
| 358 | .info = stac92xx_mux_enum_info, |
| 359 | .get = stac92xx_mux_enum_get, |
| 360 | .put = stac92xx_mux_enum_put, |
| 361 | }, |
| 362 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
| 363 | HDA_CODEC_MUTE("Capture Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 364 | { } /* end */ |
| 365 | }; |
| 366 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 367 | static struct snd_kcontrol_new stac927x_mixer[] = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 368 | { |
| 369 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 370 | .name = "Input Source", |
| 371 | .count = 1, |
| 372 | .info = stac92xx_mux_enum_info, |
| 373 | .get = stac92xx_mux_enum_get, |
| 374 | .put = stac92xx_mux_enum_put, |
| 375 | }, |
| 376 | HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
| 377 | HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 378 | HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 379 | { } /* end */ |
| 380 | }; |
| 381 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 382 | static struct snd_kcontrol_new stac9205_mixer[] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 383 | { |
| 384 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 385 | .name = "Digital Input Source", |
| 386 | .count = 1, |
| 387 | .info = stac92xx_dmux_enum_info, |
| 388 | .get = stac92xx_dmux_enum_get, |
| 389 | .put = stac92xx_dmux_enum_put, |
| 390 | }, |
| 391 | { |
| 392 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 393 | .name = "Input Source", |
| 394 | .count = 1, |
| 395 | .info = stac92xx_mux_enum_info, |
| 396 | .get = stac92xx_mux_enum_get, |
| 397 | .put = stac92xx_mux_enum_put, |
| 398 | }, |
| 399 | HDA_CODEC_VOLUME("InMux Capture Volume", 0x19, 0x0, HDA_OUTPUT), |
| 400 | HDA_CODEC_VOLUME("InVol Capture Volume", 0x1b, 0x0, HDA_INPUT), |
| 401 | HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1d, 0x0, HDA_OUTPUT), |
| 402 | { } /* end */ |
| 403 | }; |
| 404 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 405 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 406 | { |
| 407 | struct sigmatel_spec *spec = codec->spec; |
| 408 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 409 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 410 | |
| 411 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 412 | if (err < 0) |
| 413 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 414 | |
| 415 | for (i = 0; i < spec->num_mixers; i++) { |
| 416 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 417 | if (err < 0) |
| 418 | return err; |
| 419 | } |
| 420 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 421 | if (spec->multiout.dig_out_nid) { |
| 422 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
| 423 | if (err < 0) |
| 424 | return err; |
| 425 | } |
| 426 | if (spec->dig_in_nid) { |
| 427 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 428 | if (err < 0) |
| 429 | return err; |
| 430 | } |
| 431 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 432 | } |
| 433 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 434 | static unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 435 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 436 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 437 | }; |
| 438 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 439 | static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
| 440 | [STAC_REF] = ref9200_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 441 | }; |
| 442 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 443 | static const char *stac9200_models[STAC_9200_MODELS] = { |
| 444 | [STAC_REF] = "ref", |
| 445 | }; |
| 446 | |
| 447 | static struct snd_pci_quirk stac9200_cfg_tbl[] = { |
| 448 | /* SigmaTel reference board */ |
| 449 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 450 | "DFI LanParty", STAC_REF), |
Matt Porter | e737707 | 2006-11-06 11:20:38 +0100 | [diff] [blame] | 451 | /* Dell laptops have BIOS problem */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 452 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, |
| 453 | "Dell Inspiron 630m", STAC_REF), |
| 454 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, |
| 455 | "Dell Latitude D620", STAC_REF), |
| 456 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, |
| 457 | "Dell Latitude 120L", STAC_REF), |
Cory T. Tusar | 877b866 | 2007-01-30 17:30:55 +0100 | [diff] [blame] | 458 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc, |
| 459 | "Dell Latitude D820", STAC_REF), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 460 | {} /* terminator */ |
| 461 | }; |
| 462 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 463 | static unsigned int ref925x_pin_configs[8] = { |
| 464 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
| 465 | 0x90a70320, 0x02214210, 0x400003f1, 0x9033032e, |
| 466 | }; |
| 467 | |
| 468 | static unsigned int stac925x_MA6_pin_configs[8] = { |
| 469 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
| 470 | 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, |
| 471 | }; |
| 472 | |
| 473 | static unsigned int stac925xM2_2_pin_configs[8] = { |
| 474 | 0x40c003f3, 0x424503f2, 0x041800f4, 0x02a19020, |
| 475 | 0x50a103F0, 0x90100210, 0x400003f1, 0x9033032e, |
| 476 | }; |
| 477 | |
| 478 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
| 479 | [STAC_REF] = ref925x_pin_configs, |
| 480 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
| 481 | [STAC_MA6] = stac925x_MA6_pin_configs, |
| 482 | }; |
| 483 | |
| 484 | static const char *stac925x_models[STAC_925x_MODELS] = { |
| 485 | [STAC_REF] = "ref", |
| 486 | [STAC_M2_2] = "m2-2", |
| 487 | [STAC_MA6] = "m6", |
| 488 | }; |
| 489 | |
| 490 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
| 491 | /* SigmaTel reference board */ |
| 492 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
| 493 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), |
| 494 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), |
| 495 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), |
| 496 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), |
| 497 | {} /* terminator */ |
| 498 | }; |
| 499 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 500 | static unsigned int ref922x_pin_configs[10] = { |
| 501 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 502 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 503 | 0x40000100, 0x40000100, |
| 504 | }; |
| 505 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 506 | static unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 507 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 508 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 509 | 0x02a19120, 0x40000100, |
| 510 | }; |
| 511 | |
| 512 | static unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 513 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 514 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 515 | 0x02a19320, 0x40000100, |
| 516 | }; |
| 517 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 518 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 519 | [STAC_D945_REF] = ref922x_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 520 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 521 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Linus Torvalds | 7c3dec0 | 2006-07-10 22:21:43 -0700 | [diff] [blame] | 522 | [STAC_MACMINI] = d945gtp5_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 523 | }; |
| 524 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 525 | static const char *stac922x_models[STAC_922X_MODELS] = { |
| 526 | [STAC_D945_REF] = "ref", |
| 527 | [STAC_D945GTP5] = "5stack", |
| 528 | [STAC_D945GTP3] = "3stack", |
| 529 | [STAC_MACMINI] = "macmini", |
| 530 | }; |
| 531 | |
| 532 | static struct snd_pci_quirk stac922x_cfg_tbl[] = { |
| 533 | /* SigmaTel reference board */ |
| 534 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 535 | "DFI LanParty", STAC_D945_REF), |
| 536 | /* Intel 945G based systems */ |
| 537 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
| 538 | "Intel D945G", STAC_D945GTP3), |
| 539 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, |
| 540 | "Intel D945G", STAC_D945GTP3), |
| 541 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, |
| 542 | "Intel D945G", STAC_D945GTP3), |
| 543 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, |
| 544 | "Intel D945G", STAC_D945GTP3), |
| 545 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, |
| 546 | "Intel D945G", STAC_D945GTP3), |
| 547 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, |
| 548 | "Intel D945G", STAC_D945GTP3), |
| 549 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, |
| 550 | "Intel D945G", STAC_D945GTP3), |
| 551 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, |
| 552 | "Intel D945G", STAC_D945GTP3), |
| 553 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, |
| 554 | "Intel D945G", STAC_D945GTP3), |
| 555 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, |
| 556 | "Intel D945G", STAC_D945GTP3), |
| 557 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, |
| 558 | "Intel D945G", STAC_D945GTP3), |
| 559 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, |
| 560 | "Intel D945G", STAC_D945GTP3), |
| 561 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, |
| 562 | "Intel D945G", STAC_D945GTP3), |
| 563 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, |
| 564 | "Intel D945G", STAC_D945GTP3), |
| 565 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, |
| 566 | "Intel D945G", STAC_D945GTP3), |
| 567 | /* Intel D945G 5-stack systems */ |
| 568 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, |
| 569 | "Intel D945G", STAC_D945GTP5), |
| 570 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, |
| 571 | "Intel D945G", STAC_D945GTP5), |
| 572 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, |
| 573 | "Intel D945G", STAC_D945GTP5), |
| 574 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, |
| 575 | "Intel D945G", STAC_D945GTP5), |
| 576 | /* Intel 945P based systems */ |
| 577 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, |
| 578 | "Intel D945P", STAC_D945GTP3), |
| 579 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, |
| 580 | "Intel D945P", STAC_D945GTP3), |
| 581 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, |
| 582 | "Intel D945P", STAC_D945GTP3), |
| 583 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, |
| 584 | "Intel D945P", STAC_D945GTP3), |
| 585 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, |
| 586 | "Intel D945P", STAC_D945GTP3), |
| 587 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
| 588 | "Intel D945P", STAC_D945GTP5), |
| 589 | /* other systems */ |
| 590 | /* Apple Mac Mini (early 2006) */ |
| 591 | SND_PCI_QUIRK(0x8384, 0x7680, |
| 592 | "Mac Mini", STAC_MACMINI), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 593 | {} /* terminator */ |
| 594 | }; |
| 595 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 596 | static unsigned int ref927x_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 597 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 598 | 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, |
| 599 | 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, |
| 600 | 0x01c42190, 0x40000100, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 601 | }; |
| 602 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 603 | static unsigned int d965_3st_pin_configs[14] = { |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 604 | 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, |
| 605 | 0x01a19021, 0x01813024, 0x40000100, 0x40000100, |
| 606 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 607 | 0x40000100, 0x40000100 |
| 608 | }; |
| 609 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 610 | static unsigned int d965_5st_pin_configs[14] = { |
| 611 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 612 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 613 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 614 | 0x40000100, 0x40000100 |
| 615 | }; |
| 616 | |
| 617 | static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 618 | [STAC_D965_REF] = ref927x_pin_configs, |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 619 | [STAC_D965_3ST] = d965_3st_pin_configs, |
| 620 | [STAC_D965_5ST] = d965_5st_pin_configs, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 621 | }; |
| 622 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 623 | static const char *stac927x_models[STAC_927X_MODELS] = { |
| 624 | [STAC_D965_REF] = "ref", |
| 625 | [STAC_D965_3ST] = "3stack", |
| 626 | [STAC_D965_5ST] = "5stack", |
| 627 | }; |
| 628 | |
| 629 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { |
| 630 | /* SigmaTel reference board */ |
| 631 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 632 | "DFI LanParty", STAC_D965_REF), |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 633 | /* Intel 946 based systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 634 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
| 635 | 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] | 636 | /* 965 based 3 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 637 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST), |
| 638 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST), |
| 639 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST), |
| 640 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST), |
| 641 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST), |
| 642 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST), |
| 643 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST), |
| 644 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST), |
| 645 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST), |
| 646 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST), |
| 647 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST), |
| 648 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST), |
| 649 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST), |
| 650 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST), |
| 651 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST), |
| 652 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST), |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 653 | /* 965 based 5 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 654 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST), |
| 655 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST), |
| 656 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST), |
| 657 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST), |
| 658 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST), |
| 659 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST), |
| 660 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST), |
| 661 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST), |
| 662 | 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] | 663 | {} /* terminator */ |
| 664 | }; |
| 665 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 666 | static unsigned int ref9205_pin_configs[12] = { |
| 667 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 668 | 0x01813122, 0x01a19021, 0x40000100, 0x40000100, |
| 669 | 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 670 | }; |
| 671 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 672 | static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 673 | ref9205_pin_configs, |
| 674 | }; |
| 675 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 676 | static const char *stac9205_models[STAC_9205_MODELS] = { |
| 677 | [STAC_9205_REF] = "ref", |
| 678 | }; |
| 679 | |
| 680 | static struct snd_pci_quirk stac9205_cfg_tbl[] = { |
| 681 | /* SigmaTel reference board */ |
| 682 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 683 | "DFI LanParty", STAC_9205_REF), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 684 | {} /* terminator */ |
| 685 | }; |
| 686 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 687 | static int stac92xx_save_bios_config_regs(struct hda_codec *codec) |
| 688 | { |
| 689 | int i; |
| 690 | struct sigmatel_spec *spec = codec->spec; |
| 691 | |
| 692 | if (! spec->bios_pin_configs) { |
| 693 | spec->bios_pin_configs = kcalloc(spec->num_pins, |
| 694 | sizeof(*spec->bios_pin_configs), GFP_KERNEL); |
| 695 | if (! spec->bios_pin_configs) |
| 696 | return -ENOMEM; |
| 697 | } |
| 698 | |
| 699 | for (i = 0; i < spec->num_pins; i++) { |
| 700 | hda_nid_t nid = spec->pin_nids[i]; |
| 701 | unsigned int pin_cfg; |
| 702 | |
| 703 | pin_cfg = snd_hda_codec_read(codec, nid, 0, |
| 704 | AC_VERB_GET_CONFIG_DEFAULT, 0x00); |
| 705 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", |
| 706 | nid, pin_cfg); |
| 707 | spec->bios_pin_configs[i] = pin_cfg; |
| 708 | } |
| 709 | |
| 710 | return 0; |
| 711 | } |
| 712 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 713 | static void stac92xx_set_config_regs(struct hda_codec *codec) |
| 714 | { |
| 715 | int i; |
| 716 | struct sigmatel_spec *spec = codec->spec; |
| 717 | unsigned int pin_cfg; |
| 718 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 719 | if (! spec->pin_nids || ! spec->pin_configs) |
| 720 | return; |
| 721 | |
| 722 | for (i = 0; i < spec->num_pins; i++) { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 723 | snd_hda_codec_write(codec, spec->pin_nids[i], 0, |
| 724 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 725 | spec->pin_configs[i] & 0x000000ff); |
| 726 | snd_hda_codec_write(codec, spec->pin_nids[i], 0, |
| 727 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 728 | (spec->pin_configs[i] & 0x0000ff00) >> 8); |
| 729 | snd_hda_codec_write(codec, spec->pin_nids[i], 0, |
| 730 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 731 | (spec->pin_configs[i] & 0x00ff0000) >> 16); |
| 732 | snd_hda_codec_write(codec, spec->pin_nids[i], 0, |
| 733 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 734 | spec->pin_configs[i] >> 24); |
| 735 | pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0, |
| 736 | AC_VERB_GET_CONFIG_DEFAULT, |
| 737 | 0x00); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 738 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", spec->pin_nids[i], pin_cfg); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 739 | } |
| 740 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 741 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 742 | /* |
| 743 | * Analog playback callbacks |
| 744 | */ |
| 745 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 746 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 747 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 748 | { |
| 749 | struct sigmatel_spec *spec = codec->spec; |
| 750 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 751 | } |
| 752 | |
| 753 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 754 | struct hda_codec *codec, |
| 755 | unsigned int stream_tag, |
| 756 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 757 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 758 | { |
| 759 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 760 | 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] | 761 | } |
| 762 | |
| 763 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 764 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 765 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 766 | { |
| 767 | struct sigmatel_spec *spec = codec->spec; |
| 768 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 769 | } |
| 770 | |
| 771 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 772 | * Digital playback callbacks |
| 773 | */ |
| 774 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 775 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 776 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 777 | { |
| 778 | struct sigmatel_spec *spec = codec->spec; |
| 779 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 780 | } |
| 781 | |
| 782 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 783 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 784 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 785 | { |
| 786 | struct sigmatel_spec *spec = codec->spec; |
| 787 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 788 | } |
| 789 | |
| 790 | |
| 791 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 792 | * Analog capture callbacks |
| 793 | */ |
| 794 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 795 | struct hda_codec *codec, |
| 796 | unsigned int stream_tag, |
| 797 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 798 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 799 | { |
| 800 | struct sigmatel_spec *spec = codec->spec; |
| 801 | |
| 802 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 803 | stream_tag, 0, format); |
| 804 | return 0; |
| 805 | } |
| 806 | |
| 807 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 808 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 809 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 810 | { |
| 811 | struct sigmatel_spec *spec = codec->spec; |
| 812 | |
| 813 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); |
| 814 | return 0; |
| 815 | } |
| 816 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 817 | static struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
| 818 | .substreams = 1, |
| 819 | .channels_min = 2, |
| 820 | .channels_max = 2, |
| 821 | /* NID is set in stac92xx_build_pcms */ |
| 822 | .ops = { |
| 823 | .open = stac92xx_dig_playback_pcm_open, |
| 824 | .close = stac92xx_dig_playback_pcm_close |
| 825 | }, |
| 826 | }; |
| 827 | |
| 828 | static struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
| 829 | .substreams = 1, |
| 830 | .channels_min = 2, |
| 831 | .channels_max = 2, |
| 832 | /* NID is set in stac92xx_build_pcms */ |
| 833 | }; |
| 834 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 835 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
| 836 | .substreams = 1, |
| 837 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 838 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 839 | .nid = 0x02, /* NID to query formats and rates */ |
| 840 | .ops = { |
| 841 | .open = stac92xx_playback_pcm_open, |
| 842 | .prepare = stac92xx_playback_pcm_prepare, |
| 843 | .cleanup = stac92xx_playback_pcm_cleanup |
| 844 | }, |
| 845 | }; |
| 846 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 847 | static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
| 848 | .substreams = 1, |
| 849 | .channels_min = 2, |
| 850 | .channels_max = 2, |
| 851 | .nid = 0x06, /* NID to query formats and rates */ |
| 852 | .ops = { |
| 853 | .open = stac92xx_playback_pcm_open, |
| 854 | .prepare = stac92xx_playback_pcm_prepare, |
| 855 | .cleanup = stac92xx_playback_pcm_cleanup |
| 856 | }, |
| 857 | }; |
| 858 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 859 | static struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
| 860 | .substreams = 2, |
| 861 | .channels_min = 2, |
| 862 | .channels_max = 2, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 863 | /* NID is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 864 | .ops = { |
| 865 | .prepare = stac92xx_capture_pcm_prepare, |
| 866 | .cleanup = stac92xx_capture_pcm_cleanup |
| 867 | }, |
| 868 | }; |
| 869 | |
| 870 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 871 | { |
| 872 | struct sigmatel_spec *spec = codec->spec; |
| 873 | struct hda_pcm *info = spec->pcm_rec; |
| 874 | |
| 875 | codec->num_pcms = 1; |
| 876 | codec->pcm_info = info; |
| 877 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 878 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 879 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 880 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 881 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 882 | |
| 883 | if (spec->alt_switch) { |
| 884 | codec->num_pcms++; |
| 885 | info++; |
| 886 | info->name = "STAC92xx Analog Alt"; |
| 887 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 888 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 889 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 890 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 891 | codec->num_pcms++; |
| 892 | info++; |
| 893 | info->name = "STAC92xx Digital"; |
| 894 | if (spec->multiout.dig_out_nid) { |
| 895 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 896 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 897 | } |
| 898 | if (spec->dig_in_nid) { |
| 899 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 900 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 901 | } |
| 902 | } |
| 903 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 904 | return 0; |
| 905 | } |
| 906 | |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 907 | static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) |
| 908 | { |
| 909 | unsigned int pincap = snd_hda_param_read(codec, nid, |
| 910 | AC_PAR_PIN_CAP); |
| 911 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 912 | if (pincap & AC_PINCAP_VREF_100) |
| 913 | return AC_PINCTL_VREF_100; |
| 914 | if (pincap & AC_PINCAP_VREF_80) |
| 915 | return AC_PINCTL_VREF_80; |
| 916 | if (pincap & AC_PINCAP_VREF_50) |
| 917 | return AC_PINCTL_VREF_50; |
| 918 | if (pincap & AC_PINCAP_VREF_GRD) |
| 919 | return AC_PINCTL_VREF_GRD; |
| 920 | return 0; |
| 921 | } |
| 922 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 923 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 924 | |
| 925 | { |
| 926 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 927 | } |
| 928 | |
| 929 | static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
| 930 | { |
| 931 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 932 | uinfo->count = 1; |
| 933 | uinfo->value.integer.min = 0; |
| 934 | uinfo->value.integer.max = 1; |
| 935 | return 0; |
| 936 | } |
| 937 | |
| 938 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 939 | { |
| 940 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 941 | struct sigmatel_spec *spec = codec->spec; |
| 942 | int io_idx = kcontrol-> private_value & 0xff; |
| 943 | |
| 944 | ucontrol->value.integer.value[0] = spec->io_switch[io_idx]; |
| 945 | return 0; |
| 946 | } |
| 947 | |
| 948 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 949 | { |
| 950 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 951 | struct sigmatel_spec *spec = codec->spec; |
| 952 | hda_nid_t nid = kcontrol->private_value >> 8; |
| 953 | int io_idx = kcontrol-> private_value & 0xff; |
| 954 | unsigned short val = ucontrol->value.integer.value[0]; |
| 955 | |
| 956 | spec->io_switch[io_idx] = val; |
| 957 | |
| 958 | if (val) |
| 959 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 960 | else { |
| 961 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 962 | if (io_idx) /* set VREF for mic */ |
| 963 | pinctl |= stac92xx_get_vref(codec, nid); |
| 964 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 965 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 966 | return 1; |
| 967 | } |
| 968 | |
| 969 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 970 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 971 | .name = xname, \ |
| 972 | .index = 0, \ |
| 973 | .info = stac92xx_io_switch_info, \ |
| 974 | .get = stac92xx_io_switch_get, \ |
| 975 | .put = stac92xx_io_switch_put, \ |
| 976 | .private_value = xpval, \ |
| 977 | } |
| 978 | |
| 979 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 980 | enum { |
| 981 | STAC_CTL_WIDGET_VOL, |
| 982 | STAC_CTL_WIDGET_MUTE, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 983 | STAC_CTL_WIDGET_IO_SWITCH, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 984 | }; |
| 985 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 986 | static struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 987 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 988 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 989 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 990 | }; |
| 991 | |
| 992 | /* add dynamic controls */ |
| 993 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val) |
| 994 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 995 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 996 | |
| 997 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 998 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 999 | |
| 1000 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ |
| 1001 | if (! knew) |
| 1002 | return -ENOMEM; |
| 1003 | if (spec->kctl_alloc) { |
| 1004 | memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); |
| 1005 | kfree(spec->kctl_alloc); |
| 1006 | } |
| 1007 | spec->kctl_alloc = knew; |
| 1008 | spec->num_kctl_alloc = num; |
| 1009 | } |
| 1010 | |
| 1011 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 1012 | *knew = stac92xx_control_templates[type]; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 1013 | knew->name = kstrdup(name, GFP_KERNEL); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1014 | if (! knew->name) |
| 1015 | return -ENOMEM; |
| 1016 | knew->private_value = val; |
| 1017 | spec->num_kctl_used++; |
| 1018 | return 0; |
| 1019 | } |
| 1020 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1021 | /* flag inputs as additional dynamic lineouts */ |
| 1022 | static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) |
| 1023 | { |
| 1024 | struct sigmatel_spec *spec = codec->spec; |
| 1025 | |
| 1026 | switch (cfg->line_outs) { |
| 1027 | case 3: |
| 1028 | /* add line-in as side */ |
| 1029 | if (cfg->input_pins[AUTO_PIN_LINE]) { |
| 1030 | cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_LINE]; |
| 1031 | spec->line_switch = 1; |
| 1032 | cfg->line_outs++; |
| 1033 | } |
| 1034 | break; |
| 1035 | case 2: |
| 1036 | /* add line-in as clfe and mic as side */ |
| 1037 | if (cfg->input_pins[AUTO_PIN_LINE]) { |
| 1038 | cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_LINE]; |
| 1039 | spec->line_switch = 1; |
| 1040 | cfg->line_outs++; |
| 1041 | } |
| 1042 | if (cfg->input_pins[AUTO_PIN_MIC]) { |
| 1043 | cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_MIC]; |
| 1044 | spec->mic_switch = 1; |
| 1045 | cfg->line_outs++; |
| 1046 | } |
| 1047 | break; |
| 1048 | case 1: |
| 1049 | /* add line-in as surr and mic as clfe */ |
| 1050 | if (cfg->input_pins[AUTO_PIN_LINE]) { |
| 1051 | cfg->line_out_pins[1] = cfg->input_pins[AUTO_PIN_LINE]; |
| 1052 | spec->line_switch = 1; |
| 1053 | cfg->line_outs++; |
| 1054 | } |
| 1055 | if (cfg->input_pins[AUTO_PIN_MIC]) { |
| 1056 | cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_MIC]; |
| 1057 | spec->mic_switch = 1; |
| 1058 | cfg->line_outs++; |
| 1059 | } |
| 1060 | break; |
| 1061 | } |
| 1062 | |
| 1063 | return 0; |
| 1064 | } |
| 1065 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1066 | /* |
| 1067 | * XXX The line_out pin widget connection list may not be set to the |
| 1068 | * desired DAC nid. This is the case on 927x where ports A and B can |
| 1069 | * be routed to several DACs. |
| 1070 | * |
| 1071 | * This requires an analysis of the line-out/hp pin configuration |
| 1072 | * to provide a best fit for pin/DAC configurations that are routable. |
| 1073 | * For now, 927x DAC4 is not supported and 927x DAC1 output to ports |
| 1074 | * A and B is not supported. |
| 1075 | */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1076 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1077 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, |
| 1078 | const struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1079 | { |
| 1080 | struct sigmatel_spec *spec = codec->spec; |
| 1081 | hda_nid_t nid; |
| 1082 | int i; |
| 1083 | |
| 1084 | /* check the pins hardwired to audio widget */ |
| 1085 | for (i = 0; i < cfg->line_outs; i++) { |
| 1086 | nid = cfg->line_out_pins[i]; |
| 1087 | spec->multiout.dac_nids[i] = snd_hda_codec_read(codec, nid, 0, |
| 1088 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 1089 | } |
| 1090 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1091 | spec->multiout.num_dacs = cfg->line_outs; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1092 | |
| 1093 | return 0; |
| 1094 | } |
| 1095 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1096 | /* create volume control/switch for the given prefx type */ |
| 1097 | static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs) |
| 1098 | { |
| 1099 | char name[32]; |
| 1100 | int err; |
| 1101 | |
| 1102 | sprintf(name, "%s Playback Volume", pfx); |
| 1103 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, |
| 1104 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 1105 | if (err < 0) |
| 1106 | return err; |
| 1107 | sprintf(name, "%s Playback Switch", pfx); |
| 1108 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, |
| 1109 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 1110 | if (err < 0) |
| 1111 | return err; |
| 1112 | return 0; |
| 1113 | } |
| 1114 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1115 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1116 | static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec, |
| 1117 | const struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1118 | { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1119 | static const char *chname[4] = { |
| 1120 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 1121 | }; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1122 | hda_nid_t nid; |
| 1123 | int i, err; |
| 1124 | |
| 1125 | for (i = 0; i < cfg->line_outs; i++) { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1126 | if (!spec->multiout.dac_nids[i]) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1127 | continue; |
| 1128 | |
| 1129 | nid = spec->multiout.dac_nids[i]; |
| 1130 | |
| 1131 | if (i == 2) { |
| 1132 | /* Center/LFE */ |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1133 | err = create_controls(spec, "Center", nid, 1); |
| 1134 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1135 | return err; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1136 | err = create_controls(spec, "LFE", nid, 2); |
| 1137 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1138 | return err; |
| 1139 | } else { |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1140 | err = create_controls(spec, chname[i], nid, 3); |
| 1141 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1142 | return err; |
| 1143 | } |
| 1144 | } |
| 1145 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1146 | if (spec->line_switch) |
| 1147 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Line In as Output Switch", cfg->input_pins[AUTO_PIN_LINE] << 8)) < 0) |
| 1148 | return err; |
| 1149 | |
| 1150 | if (spec->mic_switch) |
| 1151 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Mic as Output Switch", (cfg->input_pins[AUTO_PIN_MIC] << 8) | 1)) < 0) |
| 1152 | return err; |
| 1153 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1154 | return 0; |
| 1155 | } |
| 1156 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1157 | static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 1158 | { |
| 1159 | int i; |
| 1160 | |
| 1161 | for (i = 0; i < spec->multiout.num_dacs; i++) { |
| 1162 | if (spec->multiout.dac_nids[i] == nid) |
| 1163 | return 1; |
| 1164 | } |
| 1165 | if (spec->multiout.hp_nid == nid) |
| 1166 | return 1; |
| 1167 | return 0; |
| 1168 | } |
| 1169 | |
| 1170 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
| 1171 | { |
| 1172 | if (!spec->multiout.hp_nid) |
| 1173 | spec->multiout.hp_nid = nid; |
| 1174 | else if (spec->multiout.num_dacs > 4) { |
| 1175 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); |
| 1176 | return 1; |
| 1177 | } else { |
| 1178 | spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; |
| 1179 | spec->multiout.num_dacs++; |
| 1180 | } |
| 1181 | return 0; |
| 1182 | } |
| 1183 | |
| 1184 | /* add playback controls for Speaker and HP outputs */ |
| 1185 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
| 1186 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1187 | { |
| 1188 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1189 | hda_nid_t nid; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1190 | int i, old_num_dacs, err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1191 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1192 | old_num_dacs = spec->multiout.num_dacs; |
| 1193 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1194 | unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); |
| 1195 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
| 1196 | spec->hp_detect = 1; |
| 1197 | nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, |
| 1198 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 1199 | if (check_in_dac_nids(spec, nid)) |
| 1200 | nid = 0; |
| 1201 | if (! nid) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1202 | continue; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1203 | add_spec_dacs(spec, nid); |
| 1204 | } |
| 1205 | for (i = 0; i < cfg->speaker_outs; i++) { |
| 1206 | nid = snd_hda_codec_read(codec, cfg->speaker_pins[0], 0, |
| 1207 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 1208 | if (check_in_dac_nids(spec, nid)) |
| 1209 | nid = 0; |
| 1210 | if (check_in_dac_nids(spec, nid)) |
| 1211 | nid = 0; |
| 1212 | if (! nid) |
| 1213 | continue; |
| 1214 | add_spec_dacs(spec, nid); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1215 | } |
| 1216 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1217 | for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) { |
| 1218 | static const char *pfxs[] = { |
| 1219 | "Speaker", "External Speaker", "Speaker2", |
| 1220 | }; |
| 1221 | err = create_controls(spec, pfxs[i - old_num_dacs], |
| 1222 | spec->multiout.dac_nids[i], 3); |
| 1223 | if (err < 0) |
| 1224 | return err; |
| 1225 | } |
| 1226 | if (spec->multiout.hp_nid) { |
| 1227 | const char *pfx; |
| 1228 | if (old_num_dacs == spec->multiout.num_dacs) |
| 1229 | pfx = "Master"; |
| 1230 | else |
| 1231 | pfx = "Headphone"; |
| 1232 | err = create_controls(spec, pfx, spec->multiout.hp_nid, 3); |
| 1233 | if (err < 0) |
| 1234 | return err; |
| 1235 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1236 | |
| 1237 | return 0; |
| 1238 | } |
| 1239 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1240 | /* labels for dmic mux inputs */ |
Adrian Bunk | ddc2cec | 2006-11-20 12:03:44 +0100 | [diff] [blame] | 1241 | static const char *stac92xx_dmic_labels[5] = { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1242 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
| 1243 | "Digital Mic 3", "Digital Mic 4" |
| 1244 | }; |
| 1245 | |
| 1246 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| 1247 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
| 1248 | const struct auto_pin_cfg *cfg) |
| 1249 | { |
| 1250 | struct sigmatel_spec *spec = codec->spec; |
| 1251 | struct hda_input_mux *dimux = &spec->private_dimux; |
| 1252 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 1253 | int i, j; |
| 1254 | |
| 1255 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; |
| 1256 | dimux->items[dimux->num_items].index = 0; |
| 1257 | dimux->num_items++; |
| 1258 | |
| 1259 | for (i = 0; i < spec->num_dmics; i++) { |
| 1260 | int index; |
| 1261 | int num_cons; |
| 1262 | unsigned int def_conf; |
| 1263 | |
| 1264 | def_conf = snd_hda_codec_read(codec, |
| 1265 | spec->dmic_nids[i], |
| 1266 | 0, |
| 1267 | AC_VERB_GET_CONFIG_DEFAULT, |
| 1268 | 0); |
| 1269 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
| 1270 | continue; |
| 1271 | |
| 1272 | num_cons = snd_hda_get_connections(codec, |
| 1273 | spec->dmux_nid, |
| 1274 | con_lst, |
| 1275 | HDA_MAX_NUM_INPUTS); |
| 1276 | for (j = 0; j < num_cons; j++) |
| 1277 | if (con_lst[j] == spec->dmic_nids[i]) { |
| 1278 | index = j; |
| 1279 | goto found; |
| 1280 | } |
| 1281 | continue; |
| 1282 | found: |
| 1283 | dimux->items[dimux->num_items].label = |
| 1284 | stac92xx_dmic_labels[dimux->num_items]; |
| 1285 | dimux->items[dimux->num_items].index = index; |
| 1286 | dimux->num_items++; |
| 1287 | } |
| 1288 | |
| 1289 | return 0; |
| 1290 | } |
| 1291 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1292 | /* create playback/capture controls for input pins */ |
| 1293 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 1294 | { |
| 1295 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1296 | struct hda_input_mux *imux = &spec->private_imux; |
| 1297 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 1298 | int i, j, k; |
| 1299 | |
| 1300 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1301 | int index; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1302 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1303 | if (!cfg->input_pins[i]) |
| 1304 | continue; |
| 1305 | index = -1; |
| 1306 | for (j = 0; j < spec->num_muxes; j++) { |
| 1307 | int num_cons; |
| 1308 | num_cons = snd_hda_get_connections(codec, |
| 1309 | spec->mux_nids[j], |
| 1310 | con_lst, |
| 1311 | HDA_MAX_NUM_INPUTS); |
| 1312 | for (k = 0; k < num_cons; k++) |
| 1313 | if (con_lst[k] == cfg->input_pins[i]) { |
| 1314 | index = k; |
| 1315 | goto found; |
| 1316 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1317 | } |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1318 | continue; |
| 1319 | found: |
| 1320 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 1321 | imux->items[imux->num_items].index = index; |
| 1322 | imux->num_items++; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1323 | } |
| 1324 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 1325 | if (imux->num_items == 1) { |
| 1326 | /* |
| 1327 | * Set the current input for the muxes. |
| 1328 | * The STAC9221 has two input muxes with identical source |
| 1329 | * NID lists. Hopefully this won't get confused. |
| 1330 | */ |
| 1331 | for (i = 0; i < spec->num_muxes; i++) { |
| 1332 | snd_hda_codec_write(codec, spec->mux_nids[i], 0, |
| 1333 | AC_VERB_SET_CONNECT_SEL, |
| 1334 | imux->items[0].index); |
| 1335 | } |
| 1336 | } |
| 1337 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1338 | return 0; |
| 1339 | } |
| 1340 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1341 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 1342 | { |
| 1343 | struct sigmatel_spec *spec = codec->spec; |
| 1344 | int i; |
| 1345 | |
| 1346 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 1347 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 1348 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 1349 | } |
| 1350 | } |
| 1351 | |
| 1352 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 1353 | { |
| 1354 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1355 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1356 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1357 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 1358 | hda_nid_t pin; |
| 1359 | pin = spec->autocfg.hp_pins[i]; |
| 1360 | if (pin) /* connect to front */ |
| 1361 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 1362 | } |
| 1363 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 1364 | hda_nid_t pin; |
| 1365 | pin = spec->autocfg.speaker_pins[i]; |
| 1366 | if (pin) /* connect to front */ |
| 1367 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); |
| 1368 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1369 | } |
| 1370 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1371 | 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] | 1372 | { |
| 1373 | struct sigmatel_spec *spec = codec->spec; |
| 1374 | int err; |
| 1375 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1376 | if ((err = snd_hda_parse_pin_def_config(codec, |
| 1377 | &spec->autocfg, |
| 1378 | spec->dmic_nids)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1379 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1380 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1381 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1382 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1383 | if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) |
| 1384 | return err; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1385 | if (spec->multiout.num_dacs == 0) |
| 1386 | if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) |
| 1387 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1388 | |
| 1389 | if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || |
| 1390 | (err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg)) < 0 || |
| 1391 | (err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 1392 | return err; |
| 1393 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1394 | if (spec->num_dmics > 0) |
| 1395 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
| 1396 | &spec->autocfg)) < 0) |
| 1397 | return err; |
| 1398 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1399 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1400 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1401 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1402 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1403 | if (spec->autocfg.dig_out_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1404 | spec->multiout.dig_out_nid = dig_out; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1405 | if (spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1406 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1407 | |
| 1408 | if (spec->kctl_alloc) |
| 1409 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 1410 | |
| 1411 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1412 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1413 | |
| 1414 | return 1; |
| 1415 | } |
| 1416 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1417 | /* add playback controls for HP output */ |
| 1418 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 1419 | struct auto_pin_cfg *cfg) |
| 1420 | { |
| 1421 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1422 | hda_nid_t pin = cfg->hp_pins[0]; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1423 | unsigned int wid_caps; |
| 1424 | |
| 1425 | if (! pin) |
| 1426 | return 0; |
| 1427 | |
| 1428 | wid_caps = get_wcaps(codec, pin); |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 1429 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1430 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1431 | |
| 1432 | return 0; |
| 1433 | } |
| 1434 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 1435 | /* add playback controls for LFE output */ |
| 1436 | static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, |
| 1437 | struct auto_pin_cfg *cfg) |
| 1438 | { |
| 1439 | struct sigmatel_spec *spec = codec->spec; |
| 1440 | int err; |
| 1441 | hda_nid_t lfe_pin = 0x0; |
| 1442 | int i; |
| 1443 | |
| 1444 | /* |
| 1445 | * search speaker outs and line outs for a mono speaker pin |
| 1446 | * with an amp. If one is found, add LFE controls |
| 1447 | * for it. |
| 1448 | */ |
| 1449 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
| 1450 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
| 1451 | unsigned long wcaps = get_wcaps(codec, pin); |
| 1452 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 1453 | if (wcaps == AC_WCAP_OUT_AMP) |
| 1454 | /* found a mono speaker with an amp, must be lfe */ |
| 1455 | lfe_pin = pin; |
| 1456 | } |
| 1457 | |
| 1458 | /* if speaker_outs is 0, then speakers may be in line_outs */ |
| 1459 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
| 1460 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
| 1461 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
| 1462 | unsigned long cfg; |
| 1463 | cfg = snd_hda_codec_read(codec, pin, 0, |
| 1464 | AC_VERB_GET_CONFIG_DEFAULT, |
| 1465 | 0x00); |
| 1466 | if (get_defcfg_device(cfg) == AC_JACK_SPEAKER) { |
| 1467 | unsigned long wcaps = get_wcaps(codec, pin); |
| 1468 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 1469 | if (wcaps == AC_WCAP_OUT_AMP) |
| 1470 | /* found a mono speaker with an amp, |
| 1471 | must be lfe */ |
| 1472 | lfe_pin = pin; |
| 1473 | } |
| 1474 | } |
| 1475 | } |
| 1476 | |
| 1477 | if (lfe_pin) { |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1478 | err = create_controls(spec, "LFE", lfe_pin, 1); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 1479 | if (err < 0) |
| 1480 | return err; |
| 1481 | } |
| 1482 | |
| 1483 | return 0; |
| 1484 | } |
| 1485 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1486 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 1487 | { |
| 1488 | struct sigmatel_spec *spec = codec->spec; |
| 1489 | int err; |
| 1490 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1491 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1492 | return err; |
| 1493 | |
| 1494 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 1495 | return err; |
| 1496 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1497 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 1498 | return err; |
| 1499 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 1500 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
| 1501 | return err; |
| 1502 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1503 | if (spec->autocfg.dig_out_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1504 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1505 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1506 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1507 | |
| 1508 | if (spec->kctl_alloc) |
| 1509 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 1510 | |
| 1511 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1512 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1513 | |
| 1514 | return 1; |
| 1515 | } |
| 1516 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 1517 | /* |
| 1518 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 1519 | * funky external mute control using GPIO pins. |
| 1520 | */ |
| 1521 | |
| 1522 | static void stac922x_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 1523 | { |
| 1524 | unsigned int gpiostate, gpiomask, gpiodir; |
| 1525 | |
| 1526 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 1527 | AC_VERB_GET_GPIO_DATA, 0); |
| 1528 | |
| 1529 | if (!muted) |
| 1530 | gpiostate |= (1 << pin); |
| 1531 | else |
| 1532 | gpiostate &= ~(1 << pin); |
| 1533 | |
| 1534 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 1535 | AC_VERB_GET_GPIO_MASK, 0); |
| 1536 | gpiomask |= (1 << pin); |
| 1537 | |
| 1538 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 1539 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 1540 | gpiodir |= (1 << pin); |
| 1541 | |
| 1542 | /* AppleHDA seems to do this -- WTF is this verb?? */ |
| 1543 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 1544 | |
| 1545 | snd_hda_codec_write(codec, codec->afg, 0, |
| 1546 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 1547 | snd_hda_codec_write(codec, codec->afg, 0, |
| 1548 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 1549 | |
| 1550 | msleep(1); |
| 1551 | |
| 1552 | snd_hda_codec_write(codec, codec->afg, 0, |
| 1553 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 1554 | } |
| 1555 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1556 | static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, |
| 1557 | unsigned int event) |
| 1558 | { |
| 1559 | if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) |
| 1560 | snd_hda_codec_write(codec, nid, 0, |
| 1561 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1562 | (AC_USRSP_EN | event)); |
| 1563 | } |
| 1564 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1565 | static int stac92xx_init(struct hda_codec *codec) |
| 1566 | { |
| 1567 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1568 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1569 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1570 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1571 | snd_hda_sequence_write(codec, spec->init); |
| 1572 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1573 | /* set up pins */ |
| 1574 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 1575 | /* Enable unsolicited responses on the HP widget */ |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1576 | for (i = 0; i < cfg->hp_outs; i++) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1577 | enable_pin_detect(codec, cfg->hp_pins[i], |
| 1578 | STAC_HP_EVENT); |
Takashi Iwai | eb995a8 | 2006-09-21 14:28:21 +0200 | [diff] [blame] | 1579 | stac92xx_auto_init_hp_out(codec); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1580 | /* fake event to set up pins */ |
| 1581 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
| 1582 | } else { |
| 1583 | stac92xx_auto_init_multi_out(codec); |
| 1584 | stac92xx_auto_init_hp_out(codec); |
| 1585 | } |
| 1586 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 1587 | hda_nid_t nid = cfg->input_pins[i]; |
| 1588 | if (nid) { |
| 1589 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 1590 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) |
| 1591 | pinctl |= stac92xx_get_vref(codec, nid); |
| 1592 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 1593 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1594 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1595 | if (spec->num_dmics > 0) |
| 1596 | for (i = 0; i < spec->num_dmics; i++) |
| 1597 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
| 1598 | AC_PINCTL_IN_EN); |
| 1599 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1600 | if (cfg->dig_out_pin) |
| 1601 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, |
| 1602 | AC_PINCTL_OUT_EN); |
| 1603 | if (cfg->dig_in_pin) |
| 1604 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 1605 | AC_PINCTL_IN_EN); |
| 1606 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 1607 | if (spec->gpio_mute) { |
| 1608 | stac922x_gpio_mute(codec, 0, 0); |
| 1609 | stac922x_gpio_mute(codec, 1, 0); |
| 1610 | } |
| 1611 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1612 | return 0; |
| 1613 | } |
| 1614 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1615 | static void stac92xx_free(struct hda_codec *codec) |
| 1616 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1617 | struct sigmatel_spec *spec = codec->spec; |
| 1618 | int i; |
| 1619 | |
| 1620 | if (! spec) |
| 1621 | return; |
| 1622 | |
| 1623 | if (spec->kctl_alloc) { |
| 1624 | for (i = 0; i < spec->num_kctl_used; i++) |
| 1625 | kfree(spec->kctl_alloc[i].name); |
| 1626 | kfree(spec->kctl_alloc); |
| 1627 | } |
| 1628 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1629 | if (spec->bios_pin_configs) |
| 1630 | kfree(spec->bios_pin_configs); |
| 1631 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1632 | kfree(spec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1633 | } |
| 1634 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 1635 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 1636 | unsigned int flag) |
| 1637 | { |
| 1638 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 1639 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1640 | if (flag == AC_PINCTL_OUT_EN && (pin_ctl & AC_PINCTL_IN_EN)) |
| 1641 | return; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 1642 | snd_hda_codec_write(codec, nid, 0, |
| 1643 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1644 | pin_ctl | flag); |
| 1645 | } |
| 1646 | |
| 1647 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 1648 | unsigned int flag) |
| 1649 | { |
| 1650 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 1651 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
| 1652 | snd_hda_codec_write(codec, nid, 0, |
| 1653 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1654 | pin_ctl & ~flag); |
| 1655 | } |
| 1656 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1657 | static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
| 1658 | { |
| 1659 | if (!nid) |
| 1660 | return 0; |
| 1661 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) |
| 1662 | & (1 << 31)) |
| 1663 | return 1; |
| 1664 | return 0; |
| 1665 | } |
| 1666 | |
| 1667 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 1668 | { |
| 1669 | struct sigmatel_spec *spec = codec->spec; |
| 1670 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1671 | int i, presence; |
| 1672 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1673 | presence = 0; |
| 1674 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1675 | presence = get_pin_presence(codec, cfg->hp_pins[i]); |
| 1676 | if (presence) |
| 1677 | break; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1678 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 1679 | |
| 1680 | if (presence) { |
| 1681 | /* disable lineouts, enable hp */ |
| 1682 | for (i = 0; i < cfg->line_outs; i++) |
| 1683 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 1684 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1685 | for (i = 0; i < cfg->speaker_outs; i++) |
| 1686 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
| 1687 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 1688 | } else { |
| 1689 | /* enable lineouts, disable hp */ |
| 1690 | for (i = 0; i < cfg->line_outs; i++) |
| 1691 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 1692 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 1693 | for (i = 0; i < cfg->speaker_outs; i++) |
| 1694 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
| 1695 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 1696 | } |
| 1697 | } |
| 1698 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 1699 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1700 | { |
| 1701 | switch (res >> 26) { |
| 1702 | case STAC_HP_EVENT: |
| 1703 | stac92xx_hp_detect(codec, res); |
| 1704 | break; |
| 1705 | } |
| 1706 | } |
| 1707 | |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 1708 | #ifdef CONFIG_PM |
| 1709 | static int stac92xx_resume(struct hda_codec *codec) |
| 1710 | { |
| 1711 | struct sigmatel_spec *spec = codec->spec; |
| 1712 | int i; |
| 1713 | |
| 1714 | stac92xx_init(codec); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1715 | stac92xx_set_config_regs(codec); |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 1716 | for (i = 0; i < spec->num_mixers; i++) |
| 1717 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
| 1718 | if (spec->multiout.dig_out_nid) |
| 1719 | snd_hda_resume_spdif_out(codec); |
| 1720 | if (spec->dig_in_nid) |
| 1721 | snd_hda_resume_spdif_in(codec); |
| 1722 | |
| 1723 | return 0; |
| 1724 | } |
| 1725 | #endif |
| 1726 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1727 | static struct hda_codec_ops stac92xx_patch_ops = { |
| 1728 | .build_controls = stac92xx_build_controls, |
| 1729 | .build_pcms = stac92xx_build_pcms, |
| 1730 | .init = stac92xx_init, |
| 1731 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 1732 | .unsol_event = stac92xx_unsol_event, |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 1733 | #ifdef CONFIG_PM |
| 1734 | .resume = stac92xx_resume, |
| 1735 | #endif |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1736 | }; |
| 1737 | |
| 1738 | static int patch_stac9200(struct hda_codec *codec) |
| 1739 | { |
| 1740 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1741 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1742 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 1743 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1744 | if (spec == NULL) |
| 1745 | return -ENOMEM; |
| 1746 | |
| 1747 | codec->spec = spec; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1748 | spec->num_pins = 8; |
| 1749 | spec->pin_nids = stac9200_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1750 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
| 1751 | stac9200_models, |
| 1752 | stac9200_cfg_tbl); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1753 | if (spec->board_config < 0) { |
| 1754 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); |
| 1755 | err = stac92xx_save_bios_config_regs(codec); |
| 1756 | if (err < 0) { |
| 1757 | stac92xx_free(codec); |
| 1758 | return err; |
| 1759 | } |
| 1760 | spec->pin_configs = spec->bios_pin_configs; |
| 1761 | } else { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1762 | spec->pin_configs = stac9200_brd_tbl[spec->board_config]; |
| 1763 | stac92xx_set_config_regs(codec); |
| 1764 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1765 | |
| 1766 | spec->multiout.max_channels = 2; |
| 1767 | spec->multiout.num_dacs = 1; |
| 1768 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 1769 | spec->adc_nids = stac9200_adc_nids; |
| 1770 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1771 | spec->num_muxes = 1; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1772 | spec->num_dmics = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1773 | |
| 1774 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1775 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1776 | |
| 1777 | err = stac9200_parse_auto_config(codec); |
| 1778 | if (err < 0) { |
| 1779 | stac92xx_free(codec); |
| 1780 | return err; |
| 1781 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1782 | |
| 1783 | codec->patch_ops = stac92xx_patch_ops; |
| 1784 | |
| 1785 | return 0; |
| 1786 | } |
| 1787 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1788 | static int patch_stac925x(struct hda_codec *codec) |
| 1789 | { |
| 1790 | struct sigmatel_spec *spec; |
| 1791 | int err; |
| 1792 | |
| 1793 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 1794 | if (spec == NULL) |
| 1795 | return -ENOMEM; |
| 1796 | |
| 1797 | codec->spec = spec; |
| 1798 | spec->num_pins = 8; |
| 1799 | spec->pin_nids = stac925x_pin_nids; |
| 1800 | spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, |
| 1801 | stac925x_models, |
| 1802 | stac925x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame^] | 1803 | again: |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1804 | if (spec->board_config < 0) { |
| 1805 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x, using BIOS defaults\n"); |
| 1806 | err = stac92xx_save_bios_config_regs(codec); |
| 1807 | if (err < 0) { |
| 1808 | stac92xx_free(codec); |
| 1809 | return err; |
| 1810 | } |
| 1811 | spec->pin_configs = spec->bios_pin_configs; |
| 1812 | } else if (stac925x_brd_tbl[spec->board_config] != NULL){ |
| 1813 | spec->pin_configs = stac925x_brd_tbl[spec->board_config]; |
| 1814 | stac92xx_set_config_regs(codec); |
| 1815 | } |
| 1816 | |
| 1817 | spec->multiout.max_channels = 2; |
| 1818 | spec->multiout.num_dacs = 1; |
| 1819 | spec->multiout.dac_nids = stac925x_dac_nids; |
| 1820 | spec->adc_nids = stac925x_adc_nids; |
| 1821 | spec->mux_nids = stac925x_mux_nids; |
| 1822 | spec->num_muxes = 1; |
| 1823 | spec->num_dmics = 0; |
| 1824 | |
| 1825 | spec->init = stac925x_core_init; |
| 1826 | spec->mixer = stac925x_mixer; |
| 1827 | |
| 1828 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame^] | 1829 | if (!err) { |
| 1830 | if (spec->board_config < 0) { |
| 1831 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 1832 | "available, default to model=ref\n"); |
| 1833 | spec->board_config = STAC_925x_REF; |
| 1834 | goto again; |
| 1835 | } |
| 1836 | err = -EINVAL; |
| 1837 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1838 | if (err < 0) { |
| 1839 | stac92xx_free(codec); |
| 1840 | return err; |
| 1841 | } |
| 1842 | |
| 1843 | codec->patch_ops = stac92xx_patch_ops; |
| 1844 | |
| 1845 | return 0; |
| 1846 | } |
| 1847 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1848 | static int patch_stac922x(struct hda_codec *codec) |
| 1849 | { |
| 1850 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1851 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1852 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 1853 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1854 | if (spec == NULL) |
| 1855 | return -ENOMEM; |
| 1856 | |
| 1857 | codec->spec = spec; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1858 | spec->num_pins = 10; |
| 1859 | spec->pin_nids = stac922x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1860 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
| 1861 | stac922x_models, |
| 1862 | stac922x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame^] | 1863 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1864 | if (spec->board_config < 0) { |
| 1865 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " |
| 1866 | "using BIOS defaults\n"); |
| 1867 | err = stac92xx_save_bios_config_regs(codec); |
| 1868 | if (err < 0) { |
| 1869 | stac92xx_free(codec); |
| 1870 | return err; |
| 1871 | } |
| 1872 | spec->pin_configs = spec->bios_pin_configs; |
| 1873 | } else if (stac922x_brd_tbl[spec->board_config] != NULL) { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1874 | spec->pin_configs = stac922x_brd_tbl[spec->board_config]; |
| 1875 | stac92xx_set_config_regs(codec); |
| 1876 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1877 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1878 | spec->adc_nids = stac922x_adc_nids; |
| 1879 | spec->mux_nids = stac922x_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1880 | spec->num_muxes = 2; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1881 | spec->num_dmics = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1882 | |
| 1883 | spec->init = stac922x_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1884 | spec->mixer = stac922x_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1885 | |
| 1886 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1887 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1888 | err = stac92xx_parse_auto_config(codec, 0x08, 0x09); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame^] | 1889 | if (!err) { |
| 1890 | if (spec->board_config < 0) { |
| 1891 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 1892 | "available, default to model=ref\n"); |
| 1893 | spec->board_config = STAC_D945_REF; |
| 1894 | goto again; |
| 1895 | } |
| 1896 | err = -EINVAL; |
| 1897 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1898 | if (err < 0) { |
| 1899 | stac92xx_free(codec); |
| 1900 | return err; |
| 1901 | } |
| 1902 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 1903 | if (spec->board_config == STAC_MACMINI) |
| 1904 | spec->gpio_mute = 1; |
| 1905 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1906 | codec->patch_ops = stac92xx_patch_ops; |
| 1907 | |
| 1908 | return 0; |
| 1909 | } |
| 1910 | |
| 1911 | static int patch_stac927x(struct hda_codec *codec) |
| 1912 | { |
| 1913 | struct sigmatel_spec *spec; |
| 1914 | int err; |
| 1915 | |
| 1916 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 1917 | if (spec == NULL) |
| 1918 | return -ENOMEM; |
| 1919 | |
| 1920 | codec->spec = spec; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1921 | spec->num_pins = 14; |
| 1922 | spec->pin_nids = stac927x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1923 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
| 1924 | stac927x_models, |
| 1925 | stac927x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame^] | 1926 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1927 | if (spec->board_config < 0) { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1928 | 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] | 1929 | err = stac92xx_save_bios_config_regs(codec); |
| 1930 | if (err < 0) { |
| 1931 | stac92xx_free(codec); |
| 1932 | return err; |
| 1933 | } |
| 1934 | spec->pin_configs = spec->bios_pin_configs; |
| 1935 | } else if (stac927x_brd_tbl[spec->board_config] != NULL) { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1936 | spec->pin_configs = stac927x_brd_tbl[spec->board_config]; |
| 1937 | stac92xx_set_config_regs(codec); |
| 1938 | } |
| 1939 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 1940 | switch (spec->board_config) { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1941 | case STAC_D965_3ST: |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 1942 | spec->adc_nids = stac927x_adc_nids; |
| 1943 | spec->mux_nids = stac927x_mux_nids; |
| 1944 | spec->num_muxes = 3; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1945 | spec->num_dmics = 0; |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1946 | spec->init = d965_core_init; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 1947 | spec->mixer = stac9227_mixer; |
| 1948 | break; |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1949 | case STAC_D965_5ST: |
| 1950 | spec->adc_nids = stac927x_adc_nids; |
| 1951 | spec->mux_nids = stac927x_mux_nids; |
| 1952 | spec->num_muxes = 3; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1953 | spec->num_dmics = 0; |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1954 | spec->init = d965_core_init; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 1955 | spec->mixer = stac9227_mixer; |
| 1956 | break; |
| 1957 | default: |
| 1958 | spec->adc_nids = stac927x_adc_nids; |
| 1959 | spec->mux_nids = stac927x_mux_nids; |
| 1960 | spec->num_muxes = 3; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 1961 | spec->num_dmics = 0; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 1962 | spec->init = stac927x_core_init; |
| 1963 | spec->mixer = stac927x_mixer; |
| 1964 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1965 | |
| 1966 | spec->multiout.dac_nids = spec->dac_nids; |
| 1967 | |
| 1968 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame^] | 1969 | if (!err) { |
| 1970 | if (spec->board_config < 0) { |
| 1971 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 1972 | "available, default to model=ref\n"); |
| 1973 | spec->board_config = STAC_D965_REF; |
| 1974 | goto again; |
| 1975 | } |
| 1976 | err = -EINVAL; |
| 1977 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1978 | if (err < 0) { |
| 1979 | stac92xx_free(codec); |
| 1980 | return err; |
| 1981 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1982 | |
| 1983 | codec->patch_ops = stac92xx_patch_ops; |
| 1984 | |
| 1985 | return 0; |
| 1986 | } |
| 1987 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1988 | static int patch_stac9205(struct hda_codec *codec) |
| 1989 | { |
| 1990 | struct sigmatel_spec *spec; |
| 1991 | int err; |
| 1992 | |
| 1993 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 1994 | if (spec == NULL) |
| 1995 | return -ENOMEM; |
| 1996 | |
| 1997 | codec->spec = spec; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 1998 | spec->num_pins = 14; |
| 1999 | spec->pin_nids = stac9205_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2000 | spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, |
| 2001 | stac9205_models, |
| 2002 | stac9205_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame^] | 2003 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2004 | if (spec->board_config < 0) { |
| 2005 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); |
| 2006 | err = stac92xx_save_bios_config_regs(codec); |
| 2007 | if (err < 0) { |
| 2008 | stac92xx_free(codec); |
| 2009 | return err; |
| 2010 | } |
| 2011 | spec->pin_configs = spec->bios_pin_configs; |
| 2012 | } else { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2013 | spec->pin_configs = stac9205_brd_tbl[spec->board_config]; |
| 2014 | stac92xx_set_config_regs(codec); |
| 2015 | } |
| 2016 | |
| 2017 | spec->adc_nids = stac9205_adc_nids; |
| 2018 | spec->mux_nids = stac9205_mux_nids; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2019 | spec->num_muxes = 2; |
| 2020 | spec->dmic_nids = stac9205_dmic_nids; |
| 2021 | spec->num_dmics = 2; |
| 2022 | spec->dmux_nid = 0x1d; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2023 | |
| 2024 | spec->init = stac9205_core_init; |
| 2025 | spec->mixer = stac9205_mixer; |
| 2026 | |
| 2027 | spec->multiout.dac_nids = spec->dac_nids; |
| 2028 | |
Matt Porter | 3338240 | 2006-12-18 13:17:28 +0100 | [diff] [blame] | 2029 | /* Configure GPIO0 as EAPD output */ |
| 2030 | snd_hda_codec_write(codec, codec->afg, 0, |
| 2031 | AC_VERB_SET_GPIO_DIRECTION, 0x00000001); |
| 2032 | /* Configure GPIO0 as CMOS */ |
| 2033 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0x00000000); |
| 2034 | /* Assert GPIO0 high */ |
| 2035 | snd_hda_codec_write(codec, codec->afg, 0, |
| 2036 | AC_VERB_SET_GPIO_DATA, 0x00000001); |
| 2037 | /* Enable GPIO0 */ |
| 2038 | snd_hda_codec_write(codec, codec->afg, 0, |
| 2039 | AC_VERB_SET_GPIO_MASK, 0x00000001); |
| 2040 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2041 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame^] | 2042 | if (!err) { |
| 2043 | if (spec->board_config < 0) { |
| 2044 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 2045 | "available, default to model=ref\n"); |
| 2046 | spec->board_config = STAC_9205_REF; |
| 2047 | goto again; |
| 2048 | } |
| 2049 | err = -EINVAL; |
| 2050 | } |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2051 | if (err < 0) { |
| 2052 | stac92xx_free(codec); |
| 2053 | return err; |
| 2054 | } |
| 2055 | |
| 2056 | codec->patch_ops = stac92xx_patch_ops; |
| 2057 | |
| 2058 | return 0; |
| 2059 | } |
| 2060 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2061 | /* |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2062 | * STAC9872 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2063 | */ |
| 2064 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 2065 | /* static config for Sony VAIO FE550G and Sony VAIO AR */ |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2066 | static hda_nid_t vaio_dacs[] = { 0x2 }; |
| 2067 | #define VAIO_HP_DAC 0x5 |
| 2068 | static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ }; |
| 2069 | static hda_nid_t vaio_mux_nids[] = { 0x15 }; |
| 2070 | |
| 2071 | static struct hda_input_mux vaio_mux = { |
| 2072 | .num_items = 2, |
| 2073 | .items = { |
Takashi Iwai | d773781 | 2006-04-25 13:05:43 +0200 | [diff] [blame] | 2074 | /* { "HP", 0x0 }, */ |
| 2075 | { "Line", 0x1 }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2076 | { "Mic", 0x2 }, |
| 2077 | { "PCM", 0x3 }, |
| 2078 | } |
| 2079 | }; |
| 2080 | |
| 2081 | static struct hda_verb vaio_init[] = { |
| 2082 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
| 2083 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
| 2084 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
| 2085 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
| 2086 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ |
| 2087 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */ |
| 2088 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ |
| 2089 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ |
| 2090 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ |
| 2091 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ |
| 2092 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 2093 | {} |
| 2094 | }; |
| 2095 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2096 | static struct hda_verb vaio_ar_init[] = { |
| 2097 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
| 2098 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
| 2099 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
| 2100 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
| 2101 | /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */ |
| 2102 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ |
| 2103 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */ |
| 2104 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ |
| 2105 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ |
| 2106 | /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */ |
| 2107 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ |
| 2108 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ |
| 2109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 2110 | {} |
| 2111 | }; |
| 2112 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2113 | /* bind volumes of both NID 0x02 and 0x05 */ |
| 2114 | static int vaio_master_vol_put(struct snd_kcontrol *kcontrol, |
| 2115 | struct snd_ctl_elem_value *ucontrol) |
| 2116 | { |
| 2117 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2118 | long *valp = ucontrol->value.integer.value; |
| 2119 | int change; |
| 2120 | |
| 2121 | change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, |
| 2122 | 0x7f, valp[0] & 0x7f); |
| 2123 | change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, |
| 2124 | 0x7f, valp[1] & 0x7f); |
| 2125 | snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, |
| 2126 | 0x7f, valp[0] & 0x7f); |
| 2127 | snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, |
| 2128 | 0x7f, valp[1] & 0x7f); |
| 2129 | return change; |
| 2130 | } |
| 2131 | |
| 2132 | /* bind volumes of both NID 0x02 and 0x05 */ |
| 2133 | static int vaio_master_sw_put(struct snd_kcontrol *kcontrol, |
| 2134 | struct snd_ctl_elem_value *ucontrol) |
| 2135 | { |
| 2136 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2137 | long *valp = ucontrol->value.integer.value; |
| 2138 | int change; |
| 2139 | |
| 2140 | change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, |
Takashi Iwai | a9393d7 | 2006-05-03 11:59:03 +0200 | [diff] [blame] | 2141 | 0x80, (valp[0] ? 0 : 0x80)); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2142 | change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, |
Takashi Iwai | a9393d7 | 2006-05-03 11:59:03 +0200 | [diff] [blame] | 2143 | 0x80, (valp[1] ? 0 : 0x80)); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2144 | snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, |
Takashi Iwai | a9393d7 | 2006-05-03 11:59:03 +0200 | [diff] [blame] | 2145 | 0x80, (valp[0] ? 0 : 0x80)); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2146 | snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, |
Takashi Iwai | a9393d7 | 2006-05-03 11:59:03 +0200 | [diff] [blame] | 2147 | 0x80, (valp[1] ? 0 : 0x80)); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2148 | return change; |
| 2149 | } |
| 2150 | |
| 2151 | static struct snd_kcontrol_new vaio_mixer[] = { |
| 2152 | { |
| 2153 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2154 | .name = "Master Playback Volume", |
| 2155 | .info = snd_hda_mixer_amp_volume_info, |
| 2156 | .get = snd_hda_mixer_amp_volume_get, |
| 2157 | .put = vaio_master_vol_put, |
Takashi Iwai | c256652 | 2006-08-17 18:21:36 +0200 | [diff] [blame] | 2158 | .tlv = { .c = snd_hda_mixer_amp_tlv }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2159 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 2160 | }, |
| 2161 | { |
| 2162 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2163 | .name = "Master Playback Switch", |
| 2164 | .info = snd_hda_mixer_amp_switch_info, |
| 2165 | .get = snd_hda_mixer_amp_switch_get, |
| 2166 | .put = vaio_master_sw_put, |
| 2167 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 2168 | }, |
| 2169 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
| 2170 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 2171 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
| 2172 | { |
| 2173 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2174 | .name = "Capture Source", |
| 2175 | .count = 1, |
| 2176 | .info = stac92xx_mux_enum_info, |
| 2177 | .get = stac92xx_mux_enum_get, |
| 2178 | .put = stac92xx_mux_enum_put, |
| 2179 | }, |
| 2180 | {} |
| 2181 | }; |
| 2182 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2183 | static struct snd_kcontrol_new vaio_ar_mixer[] = { |
| 2184 | { |
| 2185 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2186 | .name = "Master Playback Volume", |
| 2187 | .info = snd_hda_mixer_amp_volume_info, |
| 2188 | .get = snd_hda_mixer_amp_volume_get, |
| 2189 | .put = vaio_master_vol_put, |
| 2190 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 2191 | }, |
| 2192 | { |
| 2193 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2194 | .name = "Master Playback Switch", |
| 2195 | .info = snd_hda_mixer_amp_switch_info, |
| 2196 | .get = snd_hda_mixer_amp_switch_get, |
| 2197 | .put = vaio_master_sw_put, |
| 2198 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 2199 | }, |
| 2200 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
| 2201 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 2202 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
| 2203 | /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT), |
| 2204 | HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/ |
| 2205 | { |
| 2206 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2207 | .name = "Capture Source", |
| 2208 | .count = 1, |
| 2209 | .info = stac92xx_mux_enum_info, |
| 2210 | .get = stac92xx_mux_enum_get, |
| 2211 | .put = stac92xx_mux_enum_put, |
| 2212 | }, |
| 2213 | {} |
| 2214 | }; |
| 2215 | |
| 2216 | static struct hda_codec_ops stac9872_patch_ops = { |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2217 | .build_controls = stac92xx_build_controls, |
| 2218 | .build_pcms = stac92xx_build_pcms, |
| 2219 | .init = stac92xx_init, |
| 2220 | .free = stac92xx_free, |
| 2221 | #ifdef CONFIG_PM |
| 2222 | .resume = stac92xx_resume, |
| 2223 | #endif |
| 2224 | }; |
| 2225 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2226 | enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ |
| 2227 | CXD9872RD_VAIO, |
| 2228 | /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ |
| 2229 | STAC9872AK_VAIO, |
| 2230 | /* Unknown. id=0x83847661 and subsys=0x104D1200. */ |
| 2231 | STAC9872K_VAIO, |
| 2232 | /* AR Series. id=0x83847664 and subsys=104D1300 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2233 | CXD9872AKD_VAIO, |
| 2234 | STAC_9872_MODELS, |
| 2235 | }; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2236 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2237 | static const char *stac9872_models[STAC_9872_MODELS] = { |
| 2238 | [CXD9872RD_VAIO] = "vaio", |
| 2239 | [CXD9872AKD_VAIO] = "vaio-ar", |
| 2240 | }; |
| 2241 | |
| 2242 | static struct snd_pci_quirk stac9872_cfg_tbl[] = { |
| 2243 | SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO), |
| 2244 | SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO), |
| 2245 | SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO), |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2246 | {} |
| 2247 | }; |
| 2248 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2249 | static int patch_stac9872(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2250 | { |
| 2251 | struct sigmatel_spec *spec; |
| 2252 | int board_config; |
| 2253 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2254 | board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, |
| 2255 | stac9872_models, |
| 2256 | stac9872_cfg_tbl); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2257 | if (board_config < 0) |
| 2258 | /* unknown config, let generic-parser do its job... */ |
| 2259 | return snd_hda_parse_generic_codec(codec); |
| 2260 | |
| 2261 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 2262 | if (spec == NULL) |
| 2263 | return -ENOMEM; |
| 2264 | |
| 2265 | codec->spec = spec; |
| 2266 | switch (board_config) { |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2267 | case CXD9872RD_VAIO: |
| 2268 | case STAC9872AK_VAIO: |
| 2269 | case STAC9872K_VAIO: |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2270 | spec->mixer = vaio_mixer; |
| 2271 | spec->init = vaio_init; |
| 2272 | spec->multiout.max_channels = 2; |
| 2273 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); |
| 2274 | spec->multiout.dac_nids = vaio_dacs; |
| 2275 | spec->multiout.hp_nid = VAIO_HP_DAC; |
| 2276 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); |
| 2277 | spec->adc_nids = vaio_adcs; |
| 2278 | spec->input_mux = &vaio_mux; |
| 2279 | spec->mux_nids = vaio_mux_nids; |
| 2280 | break; |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2281 | |
| 2282 | case CXD9872AKD_VAIO: |
| 2283 | spec->mixer = vaio_ar_mixer; |
| 2284 | spec->init = vaio_ar_init; |
| 2285 | spec->multiout.max_channels = 2; |
| 2286 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); |
| 2287 | spec->multiout.dac_nids = vaio_dacs; |
| 2288 | spec->multiout.hp_nid = VAIO_HP_DAC; |
| 2289 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); |
| 2290 | spec->adc_nids = vaio_adcs; |
| 2291 | spec->input_mux = &vaio_mux; |
| 2292 | spec->mux_nids = vaio_mux_nids; |
| 2293 | break; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2294 | } |
| 2295 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2296 | codec->patch_ops = stac9872_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 2297 | return 0; |
| 2298 | } |
| 2299 | |
| 2300 | |
| 2301 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2302 | * patch entries |
| 2303 | */ |
| 2304 | struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
| 2305 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 2306 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 2307 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 2308 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 2309 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 2310 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 2311 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 2312 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 2313 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 2314 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 2315 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 2316 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 2317 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2318 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 2319 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 2320 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 2321 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 2322 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 2323 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 2324 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 2325 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 2326 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 2327 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 2328 | { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, |
| 2329 | { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, |
| 2330 | { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x }, |
| 2331 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
| 2332 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
| 2333 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 2334 | /* The following does not take into account .id=0x83847661 when subsys = |
| 2335 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
| 2336 | * currently not fully supported. |
| 2337 | */ |
| 2338 | { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, |
| 2339 | { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, |
| 2340 | { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2341 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 2342 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 2343 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 2344 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 2345 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 2346 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 2347 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 2348 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2349 | {} /* terminator */ |
| 2350 | }; |