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 |
| 39 | #define STAC_UNSOL_ENABLE (AC_USRSP_EN | STAC_HP_EVENT) |
| 40 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 41 | #define STAC_REF 0 |
| 42 | #define STAC_D945GTP3 1 |
| 43 | #define STAC_D945GTP5 2 |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 44 | #define STAC_MACMINI 3 |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 45 | #define STAC_D965_2112 4 |
| 46 | #define STAC_D965_284B 5 |
| 47 | #define STAC_922X_MODELS 6 /* number of 922x models */ |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 48 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 49 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 50 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 51 | unsigned int num_mixers; |
| 52 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 53 | int board_config; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 54 | unsigned int surr_switch: 1; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 55 | unsigned int line_switch: 1; |
| 56 | unsigned int mic_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 57 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 58 | unsigned int hp_detect: 1; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 59 | unsigned int gpio_mute: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 60 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 61 | /* playback */ |
| 62 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 63 | hda_nid_t dac_nids[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 64 | |
| 65 | /* capture */ |
| 66 | hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 67 | unsigned int num_adcs; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 68 | hda_nid_t *mux_nids; |
| 69 | unsigned int num_muxes; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 70 | hda_nid_t dig_in_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 71 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 72 | /* pin widgets */ |
| 73 | hda_nid_t *pin_nids; |
| 74 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 75 | unsigned int *pin_configs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 76 | |
| 77 | /* codec specific stuff */ |
| 78 | struct hda_verb *init; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 79 | struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 80 | |
| 81 | /* capture source */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 82 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 83 | unsigned int cur_mux[3]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 84 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 85 | /* i/o switches */ |
| 86 | unsigned int io_switch[2]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 87 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 88 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 89 | |
| 90 | /* dynamic controls and input_mux */ |
| 91 | struct auto_pin_cfg autocfg; |
| 92 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 93 | struct snd_kcontrol_new *kctl_alloc; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 94 | struct hda_input_mux private_imux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | static hda_nid_t stac9200_adc_nids[1] = { |
| 98 | 0x03, |
| 99 | }; |
| 100 | |
| 101 | static hda_nid_t stac9200_mux_nids[1] = { |
| 102 | 0x0c, |
| 103 | }; |
| 104 | |
| 105 | static hda_nid_t stac9200_dac_nids[1] = { |
| 106 | 0x02, |
| 107 | }; |
| 108 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 109 | static hda_nid_t stac922x_adc_nids[2] = { |
| 110 | 0x06, 0x07, |
| 111 | }; |
| 112 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 113 | static hda_nid_t stac9227_adc_nids[2] = { |
| 114 | 0x07, 0x08, |
| 115 | }; |
| 116 | |
| 117 | #if 0 |
| 118 | static hda_nid_t d965_2112_dac_nids[3] = { |
| 119 | 0x02, 0x03, 0x05, |
| 120 | }; |
| 121 | #endif |
| 122 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 123 | static hda_nid_t stac922x_mux_nids[2] = { |
| 124 | 0x12, 0x13, |
| 125 | }; |
| 126 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 127 | static hda_nid_t stac9227_mux_nids[2] = { |
| 128 | 0x15, 0x16, |
| 129 | }; |
| 130 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 131 | static hda_nid_t stac927x_adc_nids[3] = { |
| 132 | 0x07, 0x08, 0x09 |
| 133 | }; |
| 134 | |
| 135 | static hda_nid_t stac927x_mux_nids[3] = { |
| 136 | 0x15, 0x16, 0x17 |
| 137 | }; |
| 138 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 139 | static hda_nid_t stac9205_adc_nids[2] = { |
| 140 | 0x12, 0x13 |
| 141 | }; |
| 142 | |
| 143 | static hda_nid_t stac9205_mux_nids[2] = { |
| 144 | 0x19, 0x1a |
| 145 | }; |
| 146 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 147 | static hda_nid_t stac9200_pin_nids[8] = { |
| 148 | 0x08, 0x09, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 149 | }; |
| 150 | |
| 151 | static hda_nid_t stac922x_pin_nids[10] = { |
| 152 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 153 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 154 | }; |
| 155 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 156 | static hda_nid_t stac927x_pin_nids[14] = { |
| 157 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 158 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 159 | 0x14, 0x21, 0x22, 0x23, |
| 160 | }; |
| 161 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 162 | static hda_nid_t stac9205_pin_nids[12] = { |
| 163 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 164 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 165 | 0x21, 0x22, |
| 166 | |
| 167 | }; |
| 168 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 169 | 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] | 170 | { |
| 171 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 172 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 173 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 174 | } |
| 175 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 176 | 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] | 177 | { |
| 178 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 179 | struct sigmatel_spec *spec = codec->spec; |
| 180 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 181 | |
| 182 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 183 | return 0; |
| 184 | } |
| 185 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 186 | 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] | 187 | { |
| 188 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 189 | struct sigmatel_spec *spec = codec->spec; |
| 190 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 191 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 192 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 193 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); |
| 194 | } |
| 195 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 196 | static struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 197 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 198 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 199 | {} |
| 200 | }; |
| 201 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 202 | static struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 203 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 204 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 205 | {} |
| 206 | }; |
| 207 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 208 | static struct hda_verb stac9227_core_init[] = { |
| 209 | /* set master volume and direct control */ |
| 210 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 211 | /* unmute node 0x1b */ |
| 212 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 213 | {} |
| 214 | }; |
| 215 | |
| 216 | static struct hda_verb d965_2112_core_init[] = { |
| 217 | /* set master volume and direct control */ |
| 218 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 219 | /* unmute node 0x1b */ |
| 220 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 221 | /* select node 0x03 as DAC */ |
| 222 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 223 | {} |
| 224 | }; |
| 225 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 226 | static struct hda_verb stac927x_core_init[] = { |
| 227 | /* set master volume and direct control */ |
| 228 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 229 | {} |
| 230 | }; |
| 231 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 232 | static struct hda_verb stac9205_core_init[] = { |
| 233 | /* set master volume and direct control */ |
| 234 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 235 | {} |
| 236 | }; |
| 237 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 238 | static struct snd_kcontrol_new stac9200_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 239 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 240 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), |
| 241 | { |
| 242 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 243 | .name = "Input Source", |
| 244 | .count = 1, |
| 245 | .info = stac92xx_mux_enum_info, |
| 246 | .get = stac92xx_mux_enum_get, |
| 247 | .put = stac92xx_mux_enum_put, |
| 248 | }, |
| 249 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 250 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 251 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 252 | { } /* end */ |
| 253 | }; |
| 254 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 255 | /* This needs to be generated dynamically based on sequence */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 256 | static struct snd_kcontrol_new stac922x_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 257 | { |
| 258 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 259 | .name = "Input Source", |
| 260 | .count = 1, |
| 261 | .info = stac92xx_mux_enum_info, |
| 262 | .get = stac92xx_mux_enum_get, |
| 263 | .put = stac92xx_mux_enum_put, |
| 264 | }, |
| 265 | HDA_CODEC_VOLUME("Capture Volume", 0x17, 0x0, HDA_INPUT), |
Takashi Iwai | 0fd1708 | 2006-01-13 18:46:21 +0100 | [diff] [blame] | 266 | HDA_CODEC_MUTE("Capture Switch", 0x17, 0x0, HDA_INPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 267 | HDA_CODEC_VOLUME("Mux Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
| 268 | { } /* end */ |
| 269 | }; |
| 270 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 271 | /* This needs to be generated dynamically based on sequence */ |
| 272 | static struct snd_kcontrol_new stac9227_mixer[] = { |
| 273 | { |
| 274 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 275 | .name = "Input Source", |
| 276 | .count = 1, |
| 277 | .info = stac92xx_mux_enum_info, |
| 278 | .get = stac92xx_mux_enum_get, |
| 279 | .put = stac92xx_mux_enum_put, |
| 280 | }, |
| 281 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
| 282 | HDA_CODEC_MUTE("Capture Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 283 | { } /* end */ |
| 284 | }; |
| 285 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 286 | static snd_kcontrol_new_t stac927x_mixer[] = { |
| 287 | { |
| 288 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 289 | .name = "Input Source", |
| 290 | .count = 1, |
| 291 | .info = stac92xx_mux_enum_info, |
| 292 | .get = stac92xx_mux_enum_get, |
| 293 | .put = stac92xx_mux_enum_put, |
| 294 | }, |
| 295 | HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
| 296 | HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 297 | HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 298 | { } /* end */ |
| 299 | }; |
| 300 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 301 | static snd_kcontrol_new_t stac9205_mixer[] = { |
| 302 | { |
| 303 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 304 | .name = "Input Source", |
| 305 | .count = 1, |
| 306 | .info = stac92xx_mux_enum_info, |
| 307 | .get = stac92xx_mux_enum_get, |
| 308 | .put = stac92xx_mux_enum_put, |
| 309 | }, |
| 310 | HDA_CODEC_VOLUME("InMux Capture Volume", 0x19, 0x0, HDA_OUTPUT), |
| 311 | HDA_CODEC_VOLUME("InVol Capture Volume", 0x1b, 0x0, HDA_INPUT), |
| 312 | HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1d, 0x0, HDA_OUTPUT), |
| 313 | { } /* end */ |
| 314 | }; |
| 315 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 316 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 317 | { |
| 318 | struct sigmatel_spec *spec = codec->spec; |
| 319 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 320 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 321 | |
| 322 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 323 | if (err < 0) |
| 324 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 325 | |
| 326 | for (i = 0; i < spec->num_mixers; i++) { |
| 327 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 328 | if (err < 0) |
| 329 | return err; |
| 330 | } |
| 331 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 332 | if (spec->multiout.dig_out_nid) { |
| 333 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
| 334 | if (err < 0) |
| 335 | return err; |
| 336 | } |
| 337 | if (spec->dig_in_nid) { |
| 338 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 339 | if (err < 0) |
| 340 | return err; |
| 341 | } |
| 342 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 343 | } |
| 344 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 345 | static unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 346 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 347 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 348 | }; |
| 349 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 350 | static unsigned int *stac9200_brd_tbl[] = { |
| 351 | ref9200_pin_configs, |
| 352 | }; |
| 353 | |
| 354 | static struct hda_board_config stac9200_cfg_tbl[] = { |
| 355 | { .modelname = "ref", |
| 356 | .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 357 | .pci_subdevice = 0x2668, /* DFI LanParty */ |
| 358 | .config = STAC_REF }, |
| 359 | {} /* terminator */ |
| 360 | }; |
| 361 | |
| 362 | static unsigned int ref922x_pin_configs[10] = { |
| 363 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 364 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 365 | 0x40000100, 0x40000100, |
| 366 | }; |
| 367 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 368 | static unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 369 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 370 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 371 | 0x02a19120, 0x40000100, |
| 372 | }; |
| 373 | |
| 374 | static unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 375 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 376 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 377 | 0x02a19320, 0x40000100, |
| 378 | }; |
| 379 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 380 | static unsigned int d965_2112_pin_configs[10] = { |
| 381 | 0x0221401f, 0x40000100, 0x40000100, 0x01014011, |
| 382 | 0x01a19021, 0x01813024, 0x01452130, 0x40000100, |
| 383 | 0x02a19320, 0x40000100, |
| 384 | }; |
| 385 | |
| 386 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
| 387 | [STAC_REF] = ref922x_pin_configs, |
| 388 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 389 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Linus Torvalds | 7c3dec0 | 2006-07-10 22:21:43 -0700 | [diff] [blame] | 390 | [STAC_MACMINI] = d945gtp5_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 391 | [STAC_D965_2112] = d965_2112_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 392 | }; |
| 393 | |
| 394 | static struct hda_board_config stac922x_cfg_tbl[] = { |
| 395 | { .modelname = "ref", |
| 396 | .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 397 | .pci_subdevice = 0x2668, /* DFI LanParty */ |
| 398 | .config = STAC_REF }, /* SigmaTel reference board */ |
Tobin Davis | 948a4db | 2006-08-22 19:43:46 +0200 | [diff] [blame^] | 399 | /* Intel 945G based systems */ |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 400 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 401 | .pci_subdevice = 0x0101, |
| 402 | .config = STAC_D945GTP3 }, /* Intel D945GTP - 3 Stack */ |
| 403 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
Takashi Iwai | 353b9e6 | 2006-02-16 18:16:17 +0100 | [diff] [blame] | 404 | .pci_subdevice = 0x0202, |
Tobin Davis | 948a4db | 2006-08-22 19:43:46 +0200 | [diff] [blame^] | 405 | .config = STAC_D945GTP3 }, /* Intel D945GNT - 3 Stack */ |
Takashi Iwai | 353b9e6 | 2006-02-16 18:16:17 +0100 | [diff] [blame] | 406 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
Tobin Davis | 948a4db | 2006-08-22 19:43:46 +0200 | [diff] [blame^] | 407 | .pci_subdevice = 0x0606, |
| 408 | .config = STAC_D945GTP3 }, /* Intel D945GTP - 3 Stack */ |
Takashi Iwai | 353b9e6 | 2006-02-16 18:16:17 +0100 | [diff] [blame] | 409 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
Tobin Davis | 948a4db | 2006-08-22 19:43:46 +0200 | [diff] [blame^] | 410 | .pci_subdevice = 0x0601, |
| 411 | .config = STAC_D945GTP3 }, /* Intel D945GTP - 3 Stack */ |
| 412 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 413 | .pci_subdevice = 0x0111, |
| 414 | .config = STAC_D945GTP3 }, /* Intel D945GZP - 3 Stack */ |
| 415 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 416 | .pci_subdevice = 0x1115, |
| 417 | .config = STAC_D945GTP3 }, /* Intel D945GPM - 3 Stack */ |
| 418 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 419 | .pci_subdevice = 0x1116, |
| 420 | .config = STAC_D945GTP3 }, /* Intel D945GBO - 3 Stack */ |
| 421 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 422 | .pci_subdevice = 0x1117, |
| 423 | .config = STAC_D945GTP3 }, /* Intel D945GPM - 3 Stack */ |
| 424 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 425 | .pci_subdevice = 0x1118, |
| 426 | .config = STAC_D945GTP3 }, /* Intel D945GPM - 3 Stack */ |
| 427 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 428 | .pci_subdevice = 0x1119, |
| 429 | .config = STAC_D945GTP3 }, /* Intel D945GPM - 3 Stack */ |
| 430 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 431 | .pci_subdevice = 0x8826, |
| 432 | .config = STAC_D945GTP3 }, /* Intel D945GPM - 3 Stack */ |
| 433 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 434 | .pci_subdevice = 0x5049, |
| 435 | .config = STAC_D945GTP3 }, /* Intel D945GCZ - 3 Stack */ |
| 436 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 437 | .pci_subdevice = 0x5055, |
| 438 | .config = STAC_D945GTP3 }, /* Intel D945GCZ - 3 Stack */ |
| 439 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 440 | .pci_subdevice = 0x5048, |
| 441 | .config = STAC_D945GTP3 }, /* Intel D945GPB - 3 Stack */ |
| 442 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 443 | .pci_subdevice = 0x0110, |
| 444 | .config = STAC_D945GTP3 }, /* Intel D945GLR - 3 Stack */ |
| 445 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 446 | .pci_subdevice = 0x0404, |
| 447 | .config = STAC_D945GTP5 }, /* Intel D945GTP - 5 Stack */ |
| 448 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 449 | .pci_subdevice = 0x0303, |
| 450 | .config = STAC_D945GTP5 }, /* Intel D945GNT - 5 Stack */ |
| 451 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 452 | .pci_subdevice = 0x0013, |
| 453 | .config = STAC_D945GTP5 }, /* Intel D955XBK - 5 Stack */ |
Matt Porter | d62c40e | 2006-01-23 15:26:27 +0100 | [diff] [blame] | 454 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 455 | .pci_subdevice = 0x0417, |
| 456 | .config = STAC_D945GTP5 }, /* Intel D975XBK - 5 Stack */ |
Tobin Davis | 948a4db | 2006-08-22 19:43:46 +0200 | [diff] [blame^] | 457 | /* Intel 945P based systems */ |
| 458 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 459 | .pci_subdevice = 0x0b0b, |
| 460 | .config = STAC_D945GTP3 }, /* Intel D945PSN - 3 Stack */ |
| 461 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 462 | .pci_subdevice = 0x0112, |
| 463 | .config = STAC_D945GTP3 }, /* Intel D945PLN - 3 Stack */ |
| 464 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 465 | .pci_subdevice = 0x0d0d, |
| 466 | .config = STAC_D945GTP3 }, /* Intel D945PLM - 3 Stack */ |
| 467 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 468 | .pci_subdevice = 0x0909, |
| 469 | .config = STAC_D945GTP3 }, /* Intel D945PAW - 3 Stack */ |
| 470 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 471 | .pci_subdevice = 0x0505, |
| 472 | .config = STAC_D945GTP3 }, /* Intel D945PLM - 3 Stack */ |
| 473 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 474 | .pci_subdevice = 0x0707, |
| 475 | .config = STAC_D945GTP5 }, /* Intel D945PSV - 5 Stack */ |
| 476 | /* other systems */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 477 | { .pci_subvendor = 0x8384, |
| 478 | .pci_subdevice = 0x7680, |
| 479 | .config = STAC_MACMINI }, /* Apple Mac Mini (early 2006) */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 480 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 481 | .pci_subdevice = 0x2112, |
| 482 | .config = STAC_D965_2112 }, |
| 483 | { .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 484 | .pci_subdevice = 0x284b, |
| 485 | .config = STAC_D965_284B }, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 486 | {} /* terminator */ |
| 487 | }; |
| 488 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 489 | static unsigned int ref927x_pin_configs[14] = { |
| 490 | 0x01813122, 0x01a19021, 0x01014010, 0x01016011, |
| 491 | 0x01012012, 0x01011014, 0x40000100, 0x40000100, |
| 492 | 0x40000100, 0x40000100, 0x40000100, 0x01441030, |
| 493 | 0x01c41030, 0x40000100, |
| 494 | }; |
| 495 | |
| 496 | static unsigned int *stac927x_brd_tbl[] = { |
| 497 | ref927x_pin_configs, |
| 498 | }; |
| 499 | |
| 500 | static struct hda_board_config stac927x_cfg_tbl[] = { |
| 501 | { .modelname = "ref", |
| 502 | .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 503 | .pci_subdevice = 0x2668, /* DFI LanParty */ |
| 504 | .config = STAC_REF }, /* SigmaTel reference board */ |
| 505 | {} /* terminator */ |
| 506 | }; |
| 507 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 508 | static unsigned int ref9205_pin_configs[12] = { |
| 509 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
| 510 | 0x01813122, 0x01a19021, 0x40000100, 0x40000100, |
| 511 | 0x40000100, 0x40000100, 0x01441030, 0x01c41030 |
| 512 | }; |
| 513 | |
| 514 | static unsigned int *stac9205_brd_tbl[] = { |
| 515 | ref9205_pin_configs, |
| 516 | }; |
| 517 | |
| 518 | static struct hda_board_config stac9205_cfg_tbl[] = { |
| 519 | { .modelname = "ref", |
| 520 | .pci_subvendor = PCI_VENDOR_ID_INTEL, |
| 521 | .pci_subdevice = 0x2668, /* DFI LanParty */ |
| 522 | .config = STAC_REF }, /* SigmaTel reference board */ |
| 523 | {} /* terminator */ |
| 524 | }; |
| 525 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 526 | static void stac92xx_set_config_regs(struct hda_codec *codec) |
| 527 | { |
| 528 | int i; |
| 529 | struct sigmatel_spec *spec = codec->spec; |
| 530 | unsigned int pin_cfg; |
| 531 | |
| 532 | for (i=0; i < spec->num_pins; i++) { |
| 533 | snd_hda_codec_write(codec, spec->pin_nids[i], 0, |
| 534 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 535 | spec->pin_configs[i] & 0x000000ff); |
| 536 | snd_hda_codec_write(codec, spec->pin_nids[i], 0, |
| 537 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 538 | (spec->pin_configs[i] & 0x0000ff00) >> 8); |
| 539 | snd_hda_codec_write(codec, spec->pin_nids[i], 0, |
| 540 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 541 | (spec->pin_configs[i] & 0x00ff0000) >> 16); |
| 542 | snd_hda_codec_write(codec, spec->pin_nids[i], 0, |
| 543 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 544 | spec->pin_configs[i] >> 24); |
| 545 | pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0, |
| 546 | AC_VERB_GET_CONFIG_DEFAULT, |
| 547 | 0x00); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 548 | 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] | 549 | } |
| 550 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 551 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 552 | /* |
| 553 | * Analog playback callbacks |
| 554 | */ |
| 555 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 556 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 557 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 558 | { |
| 559 | struct sigmatel_spec *spec = codec->spec; |
| 560 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 561 | } |
| 562 | |
| 563 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 564 | struct hda_codec *codec, |
| 565 | unsigned int stream_tag, |
| 566 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 567 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 568 | { |
| 569 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 570 | 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] | 571 | } |
| 572 | |
| 573 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 574 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 575 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 576 | { |
| 577 | struct sigmatel_spec *spec = codec->spec; |
| 578 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 579 | } |
| 580 | |
| 581 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 582 | * Digital playback callbacks |
| 583 | */ |
| 584 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 585 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 586 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 587 | { |
| 588 | struct sigmatel_spec *spec = codec->spec; |
| 589 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 590 | } |
| 591 | |
| 592 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 593 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 594 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 595 | { |
| 596 | struct sigmatel_spec *spec = codec->spec; |
| 597 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 598 | } |
| 599 | |
| 600 | |
| 601 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 602 | * Analog capture callbacks |
| 603 | */ |
| 604 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 605 | struct hda_codec *codec, |
| 606 | unsigned int stream_tag, |
| 607 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 608 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 609 | { |
| 610 | struct sigmatel_spec *spec = codec->spec; |
| 611 | |
| 612 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 613 | stream_tag, 0, format); |
| 614 | return 0; |
| 615 | } |
| 616 | |
| 617 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 618 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 619 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 620 | { |
| 621 | struct sigmatel_spec *spec = codec->spec; |
| 622 | |
| 623 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); |
| 624 | return 0; |
| 625 | } |
| 626 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 627 | static struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
| 628 | .substreams = 1, |
| 629 | .channels_min = 2, |
| 630 | .channels_max = 2, |
| 631 | /* NID is set in stac92xx_build_pcms */ |
| 632 | .ops = { |
| 633 | .open = stac92xx_dig_playback_pcm_open, |
| 634 | .close = stac92xx_dig_playback_pcm_close |
| 635 | }, |
| 636 | }; |
| 637 | |
| 638 | static struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
| 639 | .substreams = 1, |
| 640 | .channels_min = 2, |
| 641 | .channels_max = 2, |
| 642 | /* NID is set in stac92xx_build_pcms */ |
| 643 | }; |
| 644 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 645 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
| 646 | .substreams = 1, |
| 647 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 648 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 649 | .nid = 0x02, /* NID to query formats and rates */ |
| 650 | .ops = { |
| 651 | .open = stac92xx_playback_pcm_open, |
| 652 | .prepare = stac92xx_playback_pcm_prepare, |
| 653 | .cleanup = stac92xx_playback_pcm_cleanup |
| 654 | }, |
| 655 | }; |
| 656 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 657 | static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
| 658 | .substreams = 1, |
| 659 | .channels_min = 2, |
| 660 | .channels_max = 2, |
| 661 | .nid = 0x06, /* NID to query formats and rates */ |
| 662 | .ops = { |
| 663 | .open = stac92xx_playback_pcm_open, |
| 664 | .prepare = stac92xx_playback_pcm_prepare, |
| 665 | .cleanup = stac92xx_playback_pcm_cleanup |
| 666 | }, |
| 667 | }; |
| 668 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 669 | static struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
| 670 | .substreams = 2, |
| 671 | .channels_min = 2, |
| 672 | .channels_max = 2, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 673 | /* NID is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 674 | .ops = { |
| 675 | .prepare = stac92xx_capture_pcm_prepare, |
| 676 | .cleanup = stac92xx_capture_pcm_cleanup |
| 677 | }, |
| 678 | }; |
| 679 | |
| 680 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 681 | { |
| 682 | struct sigmatel_spec *spec = codec->spec; |
| 683 | struct hda_pcm *info = spec->pcm_rec; |
| 684 | |
| 685 | codec->num_pcms = 1; |
| 686 | codec->pcm_info = info; |
| 687 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 688 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 689 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 690 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 691 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 692 | |
| 693 | if (spec->alt_switch) { |
| 694 | codec->num_pcms++; |
| 695 | info++; |
| 696 | info->name = "STAC92xx Analog Alt"; |
| 697 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 698 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 699 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 700 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 701 | codec->num_pcms++; |
| 702 | info++; |
| 703 | info->name = "STAC92xx Digital"; |
| 704 | if (spec->multiout.dig_out_nid) { |
| 705 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 706 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 707 | } |
| 708 | if (spec->dig_in_nid) { |
| 709 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 710 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 711 | } |
| 712 | } |
| 713 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 714 | return 0; |
| 715 | } |
| 716 | |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 717 | static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) |
| 718 | { |
| 719 | unsigned int pincap = snd_hda_param_read(codec, nid, |
| 720 | AC_PAR_PIN_CAP); |
| 721 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 722 | if (pincap & AC_PINCAP_VREF_100) |
| 723 | return AC_PINCTL_VREF_100; |
| 724 | if (pincap & AC_PINCAP_VREF_80) |
| 725 | return AC_PINCTL_VREF_80; |
| 726 | if (pincap & AC_PINCAP_VREF_50) |
| 727 | return AC_PINCTL_VREF_50; |
| 728 | if (pincap & AC_PINCAP_VREF_GRD) |
| 729 | return AC_PINCTL_VREF_GRD; |
| 730 | return 0; |
| 731 | } |
| 732 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 733 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 734 | |
| 735 | { |
| 736 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 737 | } |
| 738 | |
| 739 | static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
| 740 | { |
| 741 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 742 | uinfo->count = 1; |
| 743 | uinfo->value.integer.min = 0; |
| 744 | uinfo->value.integer.max = 1; |
| 745 | return 0; |
| 746 | } |
| 747 | |
| 748 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 749 | { |
| 750 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 751 | struct sigmatel_spec *spec = codec->spec; |
| 752 | int io_idx = kcontrol-> private_value & 0xff; |
| 753 | |
| 754 | ucontrol->value.integer.value[0] = spec->io_switch[io_idx]; |
| 755 | return 0; |
| 756 | } |
| 757 | |
| 758 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 759 | { |
| 760 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 761 | struct sigmatel_spec *spec = codec->spec; |
| 762 | hda_nid_t nid = kcontrol->private_value >> 8; |
| 763 | int io_idx = kcontrol-> private_value & 0xff; |
| 764 | unsigned short val = ucontrol->value.integer.value[0]; |
| 765 | |
| 766 | spec->io_switch[io_idx] = val; |
| 767 | |
| 768 | if (val) |
| 769 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 770 | else { |
| 771 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 772 | if (io_idx) /* set VREF for mic */ |
| 773 | pinctl |= stac92xx_get_vref(codec, nid); |
| 774 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 775 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 776 | return 1; |
| 777 | } |
| 778 | |
| 779 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 780 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 781 | .name = xname, \ |
| 782 | .index = 0, \ |
| 783 | .info = stac92xx_io_switch_info, \ |
| 784 | .get = stac92xx_io_switch_get, \ |
| 785 | .put = stac92xx_io_switch_put, \ |
| 786 | .private_value = xpval, \ |
| 787 | } |
| 788 | |
| 789 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 790 | enum { |
| 791 | STAC_CTL_WIDGET_VOL, |
| 792 | STAC_CTL_WIDGET_MUTE, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 793 | STAC_CTL_WIDGET_IO_SWITCH, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 794 | }; |
| 795 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 796 | static struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 797 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 798 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 799 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 800 | }; |
| 801 | |
| 802 | /* add dynamic controls */ |
| 803 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val) |
| 804 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 805 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 806 | |
| 807 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 808 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 809 | |
| 810 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ |
| 811 | if (! knew) |
| 812 | return -ENOMEM; |
| 813 | if (spec->kctl_alloc) { |
| 814 | memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); |
| 815 | kfree(spec->kctl_alloc); |
| 816 | } |
| 817 | spec->kctl_alloc = knew; |
| 818 | spec->num_kctl_alloc = num; |
| 819 | } |
| 820 | |
| 821 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 822 | *knew = stac92xx_control_templates[type]; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 823 | knew->name = kstrdup(name, GFP_KERNEL); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 824 | if (! knew->name) |
| 825 | return -ENOMEM; |
| 826 | knew->private_value = val; |
| 827 | spec->num_kctl_used++; |
| 828 | return 0; |
| 829 | } |
| 830 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 831 | /* flag inputs as additional dynamic lineouts */ |
| 832 | static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) |
| 833 | { |
| 834 | struct sigmatel_spec *spec = codec->spec; |
| 835 | |
| 836 | switch (cfg->line_outs) { |
| 837 | case 3: |
| 838 | /* add line-in as side */ |
| 839 | if (cfg->input_pins[AUTO_PIN_LINE]) { |
| 840 | cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_LINE]; |
| 841 | spec->line_switch = 1; |
| 842 | cfg->line_outs++; |
| 843 | } |
| 844 | break; |
| 845 | case 2: |
| 846 | /* add line-in as clfe and mic as side */ |
| 847 | if (cfg->input_pins[AUTO_PIN_LINE]) { |
| 848 | cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_LINE]; |
| 849 | spec->line_switch = 1; |
| 850 | cfg->line_outs++; |
| 851 | } |
| 852 | if (cfg->input_pins[AUTO_PIN_MIC]) { |
| 853 | cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_MIC]; |
| 854 | spec->mic_switch = 1; |
| 855 | cfg->line_outs++; |
| 856 | } |
| 857 | break; |
| 858 | case 1: |
| 859 | /* add line-in as surr and mic as clfe */ |
| 860 | if (cfg->input_pins[AUTO_PIN_LINE]) { |
| 861 | cfg->line_out_pins[1] = cfg->input_pins[AUTO_PIN_LINE]; |
| 862 | spec->line_switch = 1; |
| 863 | cfg->line_outs++; |
| 864 | } |
| 865 | if (cfg->input_pins[AUTO_PIN_MIC]) { |
| 866 | cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_MIC]; |
| 867 | spec->mic_switch = 1; |
| 868 | cfg->line_outs++; |
| 869 | } |
| 870 | break; |
| 871 | } |
| 872 | |
| 873 | return 0; |
| 874 | } |
| 875 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 876 | /* |
| 877 | * XXX The line_out pin widget connection list may not be set to the |
| 878 | * desired DAC nid. This is the case on 927x where ports A and B can |
| 879 | * be routed to several DACs. |
| 880 | * |
| 881 | * This requires an analysis of the line-out/hp pin configuration |
| 882 | * to provide a best fit for pin/DAC configurations that are routable. |
| 883 | * For now, 927x DAC4 is not supported and 927x DAC1 output to ports |
| 884 | * A and B is not supported. |
| 885 | */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 886 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 887 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, |
| 888 | const struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 889 | { |
| 890 | struct sigmatel_spec *spec = codec->spec; |
| 891 | hda_nid_t nid; |
| 892 | int i; |
| 893 | |
| 894 | /* check the pins hardwired to audio widget */ |
| 895 | for (i = 0; i < cfg->line_outs; i++) { |
| 896 | nid = cfg->line_out_pins[i]; |
| 897 | spec->multiout.dac_nids[i] = snd_hda_codec_read(codec, nid, 0, |
| 898 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 899 | } |
| 900 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 901 | spec->multiout.num_dacs = cfg->line_outs; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 902 | |
| 903 | return 0; |
| 904 | } |
| 905 | |
| 906 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 907 | static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec, |
| 908 | const struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 909 | { |
| 910 | char name[32]; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 911 | static const char *chname[4] = { |
| 912 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 913 | }; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 914 | hda_nid_t nid; |
| 915 | int i, err; |
| 916 | |
| 917 | for (i = 0; i < cfg->line_outs; i++) { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 918 | if (!spec->multiout.dac_nids[i]) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 919 | continue; |
| 920 | |
| 921 | nid = spec->multiout.dac_nids[i]; |
| 922 | |
| 923 | if (i == 2) { |
| 924 | /* Center/LFE */ |
| 925 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "Center Playback Volume", |
| 926 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) |
| 927 | return err; |
| 928 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "LFE Playback Volume", |
| 929 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 930 | return err; |
| 931 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "Center Playback Switch", |
| 932 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) |
| 933 | return err; |
| 934 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "LFE Playback Switch", |
| 935 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 936 | return err; |
| 937 | } else { |
| 938 | sprintf(name, "%s Playback Volume", chname[i]); |
| 939 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, |
| 940 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 941 | return err; |
| 942 | sprintf(name, "%s Playback Switch", chname[i]); |
| 943 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, |
| 944 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 945 | return err; |
| 946 | } |
| 947 | } |
| 948 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 949 | if (spec->line_switch) |
| 950 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Line In as Output Switch", cfg->input_pins[AUTO_PIN_LINE] << 8)) < 0) |
| 951 | return err; |
| 952 | |
| 953 | if (spec->mic_switch) |
| 954 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Mic as Output Switch", (cfg->input_pins[AUTO_PIN_MIC] << 8) | 1)) < 0) |
| 955 | return err; |
| 956 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 957 | return 0; |
| 958 | } |
| 959 | |
| 960 | /* add playback controls for HP output */ |
| 961 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, struct auto_pin_cfg *cfg) |
| 962 | { |
| 963 | struct sigmatel_spec *spec = codec->spec; |
| 964 | hda_nid_t pin = cfg->hp_pin; |
| 965 | hda_nid_t nid; |
| 966 | int i, err; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 967 | unsigned int wid_caps; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 968 | |
| 969 | if (! pin) |
| 970 | return 0; |
| 971 | |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 972 | wid_caps = get_wcaps(codec, pin); |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 973 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 974 | spec->hp_detect = 1; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 975 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 976 | nid = snd_hda_codec_read(codec, pin, 0, AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 977 | for (i = 0; i < cfg->line_outs; i++) { |
| 978 | if (! spec->multiout.dac_nids[i]) |
| 979 | continue; |
| 980 | if (spec->multiout.dac_nids[i] == nid) |
| 981 | return 0; |
| 982 | } |
| 983 | |
| 984 | spec->multiout.hp_nid = nid; |
| 985 | |
| 986 | /* control HP volume/switch on the output mixer amp */ |
| 987 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "Headphone Playback Volume", |
| 988 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 989 | return err; |
| 990 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "Headphone Playback Switch", |
| 991 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 992 | return err; |
| 993 | |
| 994 | return 0; |
| 995 | } |
| 996 | |
| 997 | /* create playback/capture controls for input pins */ |
| 998 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 999 | { |
| 1000 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1001 | struct hda_input_mux *imux = &spec->private_imux; |
| 1002 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 1003 | int i, j, k; |
| 1004 | |
| 1005 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 1006 | int index = -1; |
| 1007 | if (cfg->input_pins[i]) { |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 1008 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1009 | |
| 1010 | for (j=0; j<spec->num_muxes; j++) { |
| 1011 | int num_cons = snd_hda_get_connections(codec, spec->mux_nids[j], con_lst, HDA_MAX_NUM_INPUTS); |
| 1012 | for (k=0; k<num_cons; k++) |
| 1013 | if (con_lst[k] == cfg->input_pins[i]) { |
| 1014 | index = k; |
| 1015 | break; |
| 1016 | } |
| 1017 | if (index >= 0) |
| 1018 | break; |
| 1019 | } |
| 1020 | imux->items[imux->num_items].index = index; |
| 1021 | imux->num_items++; |
| 1022 | } |
| 1023 | } |
| 1024 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 1025 | if (imux->num_items == 1) { |
| 1026 | /* |
| 1027 | * Set the current input for the muxes. |
| 1028 | * The STAC9221 has two input muxes with identical source |
| 1029 | * NID lists. Hopefully this won't get confused. |
| 1030 | */ |
| 1031 | for (i = 0; i < spec->num_muxes; i++) { |
| 1032 | snd_hda_codec_write(codec, spec->mux_nids[i], 0, |
| 1033 | AC_VERB_SET_CONNECT_SEL, |
| 1034 | imux->items[0].index); |
| 1035 | } |
| 1036 | } |
| 1037 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1038 | return 0; |
| 1039 | } |
| 1040 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1041 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 1042 | { |
| 1043 | struct sigmatel_spec *spec = codec->spec; |
| 1044 | int i; |
| 1045 | |
| 1046 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 1047 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 1048 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 1049 | } |
| 1050 | } |
| 1051 | |
| 1052 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 1053 | { |
| 1054 | struct sigmatel_spec *spec = codec->spec; |
| 1055 | hda_nid_t pin; |
| 1056 | |
| 1057 | pin = spec->autocfg.hp_pin; |
| 1058 | if (pin) /* connect to front */ |
| 1059 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 1060 | } |
| 1061 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1062 | 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] | 1063 | { |
| 1064 | struct sigmatel_spec *spec = codec->spec; |
| 1065 | int err; |
| 1066 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1067 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1068 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1069 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1070 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1071 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1072 | if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) |
| 1073 | return err; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1074 | if (spec->multiout.num_dacs == 0) |
| 1075 | if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) |
| 1076 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1077 | |
| 1078 | if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || |
| 1079 | (err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg)) < 0 || |
| 1080 | (err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 1081 | return err; |
| 1082 | |
| 1083 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1084 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1085 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1086 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1087 | if (spec->autocfg.dig_out_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1088 | spec->multiout.dig_out_nid = dig_out; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1089 | if (spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1090 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1091 | |
| 1092 | if (spec->kctl_alloc) |
| 1093 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 1094 | |
| 1095 | spec->input_mux = &spec->private_imux; |
| 1096 | |
| 1097 | return 1; |
| 1098 | } |
| 1099 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1100 | /* add playback controls for HP output */ |
| 1101 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 1102 | struct auto_pin_cfg *cfg) |
| 1103 | { |
| 1104 | struct sigmatel_spec *spec = codec->spec; |
| 1105 | hda_nid_t pin = cfg->hp_pin; |
| 1106 | unsigned int wid_caps; |
| 1107 | |
| 1108 | if (! pin) |
| 1109 | return 0; |
| 1110 | |
| 1111 | wid_caps = get_wcaps(codec, pin); |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 1112 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1113 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1114 | |
| 1115 | return 0; |
| 1116 | } |
| 1117 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1118 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 1119 | { |
| 1120 | struct sigmatel_spec *spec = codec->spec; |
| 1121 | int err; |
| 1122 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1123 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1124 | return err; |
| 1125 | |
| 1126 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 1127 | return err; |
| 1128 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1129 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 1130 | return err; |
| 1131 | |
| 1132 | if (spec->autocfg.dig_out_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1133 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1134 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1135 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1136 | |
| 1137 | if (spec->kctl_alloc) |
| 1138 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 1139 | |
| 1140 | spec->input_mux = &spec->private_imux; |
| 1141 | |
| 1142 | return 1; |
| 1143 | } |
| 1144 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 1145 | /* |
| 1146 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 1147 | * funky external mute control using GPIO pins. |
| 1148 | */ |
| 1149 | |
| 1150 | static void stac922x_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 1151 | { |
| 1152 | unsigned int gpiostate, gpiomask, gpiodir; |
| 1153 | |
| 1154 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 1155 | AC_VERB_GET_GPIO_DATA, 0); |
| 1156 | |
| 1157 | if (!muted) |
| 1158 | gpiostate |= (1 << pin); |
| 1159 | else |
| 1160 | gpiostate &= ~(1 << pin); |
| 1161 | |
| 1162 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 1163 | AC_VERB_GET_GPIO_MASK, 0); |
| 1164 | gpiomask |= (1 << pin); |
| 1165 | |
| 1166 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 1167 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 1168 | gpiodir |= (1 << pin); |
| 1169 | |
| 1170 | /* AppleHDA seems to do this -- WTF is this verb?? */ |
| 1171 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 1172 | |
| 1173 | snd_hda_codec_write(codec, codec->afg, 0, |
| 1174 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 1175 | snd_hda_codec_write(codec, codec->afg, 0, |
| 1176 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 1177 | |
| 1178 | msleep(1); |
| 1179 | |
| 1180 | snd_hda_codec_write(codec, codec->afg, 0, |
| 1181 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 1182 | } |
| 1183 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1184 | static int stac92xx_init(struct hda_codec *codec) |
| 1185 | { |
| 1186 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1187 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1188 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1189 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1190 | snd_hda_sequence_write(codec, spec->init); |
| 1191 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1192 | /* set up pins */ |
| 1193 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 1194 | /* Enable unsolicited responses on the HP widget */ |
| 1195 | snd_hda_codec_write(codec, cfg->hp_pin, 0, |
| 1196 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1197 | STAC_UNSOL_ENABLE); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1198 | /* fake event to set up pins */ |
| 1199 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
Tobin Davis | 68a6abd | 2006-08-21 19:02:10 +0200 | [diff] [blame] | 1200 | /* enable the headphones by default. If/when unsol_event detection works, this will be ignored */ |
| 1201 | stac92xx_auto_init_hp_out(codec); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1202 | } else { |
| 1203 | stac92xx_auto_init_multi_out(codec); |
| 1204 | stac92xx_auto_init_hp_out(codec); |
| 1205 | } |
| 1206 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 1207 | hda_nid_t nid = cfg->input_pins[i]; |
| 1208 | if (nid) { |
| 1209 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 1210 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) |
| 1211 | pinctl |= stac92xx_get_vref(codec, nid); |
| 1212 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 1213 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 1214 | } |
| 1215 | if (cfg->dig_out_pin) |
| 1216 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, |
| 1217 | AC_PINCTL_OUT_EN); |
| 1218 | if (cfg->dig_in_pin) |
| 1219 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 1220 | AC_PINCTL_IN_EN); |
| 1221 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 1222 | if (spec->gpio_mute) { |
| 1223 | stac922x_gpio_mute(codec, 0, 0); |
| 1224 | stac922x_gpio_mute(codec, 1, 0); |
| 1225 | } |
| 1226 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1227 | return 0; |
| 1228 | } |
| 1229 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1230 | static void stac92xx_free(struct hda_codec *codec) |
| 1231 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1232 | struct sigmatel_spec *spec = codec->spec; |
| 1233 | int i; |
| 1234 | |
| 1235 | if (! spec) |
| 1236 | return; |
| 1237 | |
| 1238 | if (spec->kctl_alloc) { |
| 1239 | for (i = 0; i < spec->num_kctl_used; i++) |
| 1240 | kfree(spec->kctl_alloc[i].name); |
| 1241 | kfree(spec->kctl_alloc); |
| 1242 | } |
| 1243 | |
| 1244 | kfree(spec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1245 | } |
| 1246 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 1247 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 1248 | unsigned int flag) |
| 1249 | { |
| 1250 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 1251 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
| 1252 | snd_hda_codec_write(codec, nid, 0, |
| 1253 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1254 | pin_ctl | flag); |
| 1255 | } |
| 1256 | |
| 1257 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 1258 | unsigned int flag) |
| 1259 | { |
| 1260 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 1261 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
| 1262 | snd_hda_codec_write(codec, nid, 0, |
| 1263 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1264 | pin_ctl & ~flag); |
| 1265 | } |
| 1266 | |
| 1267 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1268 | { |
| 1269 | struct sigmatel_spec *spec = codec->spec; |
| 1270 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1271 | int i, presence; |
| 1272 | |
| 1273 | if ((res >> 26) != STAC_HP_EVENT) |
| 1274 | return; |
| 1275 | |
| 1276 | presence = snd_hda_codec_read(codec, cfg->hp_pin, 0, |
| 1277 | AC_VERB_GET_PIN_SENSE, 0x00) >> 31; |
| 1278 | |
| 1279 | if (presence) { |
| 1280 | /* disable lineouts, enable hp */ |
| 1281 | for (i = 0; i < cfg->line_outs; i++) |
| 1282 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 1283 | AC_PINCTL_OUT_EN); |
| 1284 | stac92xx_set_pinctl(codec, cfg->hp_pin, AC_PINCTL_OUT_EN); |
| 1285 | } else { |
| 1286 | /* enable lineouts, disable hp */ |
| 1287 | for (i = 0; i < cfg->line_outs; i++) |
| 1288 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 1289 | AC_PINCTL_OUT_EN); |
| 1290 | stac92xx_reset_pinctl(codec, cfg->hp_pin, AC_PINCTL_OUT_EN); |
| 1291 | } |
| 1292 | } |
| 1293 | |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 1294 | #ifdef CONFIG_PM |
| 1295 | static int stac92xx_resume(struct hda_codec *codec) |
| 1296 | { |
| 1297 | struct sigmatel_spec *spec = codec->spec; |
| 1298 | int i; |
| 1299 | |
| 1300 | stac92xx_init(codec); |
| 1301 | for (i = 0; i < spec->num_mixers; i++) |
| 1302 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
| 1303 | if (spec->multiout.dig_out_nid) |
| 1304 | snd_hda_resume_spdif_out(codec); |
| 1305 | if (spec->dig_in_nid) |
| 1306 | snd_hda_resume_spdif_in(codec); |
| 1307 | |
| 1308 | return 0; |
| 1309 | } |
| 1310 | #endif |
| 1311 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1312 | static struct hda_codec_ops stac92xx_patch_ops = { |
| 1313 | .build_controls = stac92xx_build_controls, |
| 1314 | .build_pcms = stac92xx_build_pcms, |
| 1315 | .init = stac92xx_init, |
| 1316 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 1317 | .unsol_event = stac92xx_unsol_event, |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 1318 | #ifdef CONFIG_PM |
| 1319 | .resume = stac92xx_resume, |
| 1320 | #endif |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1321 | }; |
| 1322 | |
| 1323 | static int patch_stac9200(struct hda_codec *codec) |
| 1324 | { |
| 1325 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1326 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1327 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 1328 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1329 | if (spec == NULL) |
| 1330 | return -ENOMEM; |
| 1331 | |
| 1332 | codec->spec = spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1333 | spec->board_config = snd_hda_check_board_config(codec, stac9200_cfg_tbl); |
| 1334 | if (spec->board_config < 0) |
| 1335 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); |
| 1336 | else { |
| 1337 | spec->num_pins = 8; |
| 1338 | spec->pin_nids = stac9200_pin_nids; |
| 1339 | spec->pin_configs = stac9200_brd_tbl[spec->board_config]; |
| 1340 | stac92xx_set_config_regs(codec); |
| 1341 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1342 | |
| 1343 | spec->multiout.max_channels = 2; |
| 1344 | spec->multiout.num_dacs = 1; |
| 1345 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 1346 | spec->adc_nids = stac9200_adc_nids; |
| 1347 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1348 | spec->num_muxes = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1349 | |
| 1350 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1351 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1352 | |
| 1353 | err = stac9200_parse_auto_config(codec); |
| 1354 | if (err < 0) { |
| 1355 | stac92xx_free(codec); |
| 1356 | return err; |
| 1357 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1358 | |
| 1359 | codec->patch_ops = stac92xx_patch_ops; |
| 1360 | |
| 1361 | return 0; |
| 1362 | } |
| 1363 | |
| 1364 | static int patch_stac922x(struct hda_codec *codec) |
| 1365 | { |
| 1366 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1367 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1368 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 1369 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1370 | if (spec == NULL) |
| 1371 | return -ENOMEM; |
| 1372 | |
| 1373 | codec->spec = spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1374 | spec->board_config = snd_hda_check_board_config(codec, stac922x_cfg_tbl); |
| 1375 | if (spec->board_config < 0) |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1376 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " |
| 1377 | "using BIOS defaults\n"); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 1378 | else if (stac922x_brd_tbl[spec->board_config] != NULL) { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1379 | spec->num_pins = 10; |
| 1380 | spec->pin_nids = stac922x_pin_nids; |
| 1381 | spec->pin_configs = stac922x_brd_tbl[spec->board_config]; |
| 1382 | stac92xx_set_config_regs(codec); |
| 1383 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1384 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1385 | spec->adc_nids = stac922x_adc_nids; |
| 1386 | spec->mux_nids = stac922x_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1387 | spec->num_muxes = 2; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1388 | |
| 1389 | spec->init = stac922x_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1390 | spec->mixer = stac922x_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1391 | |
| 1392 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1393 | |
| 1394 | switch (spec->board_config) { |
| 1395 | case STAC_D965_2112: |
| 1396 | spec->adc_nids = stac9227_adc_nids; |
| 1397 | spec->mux_nids = stac9227_mux_nids; |
| 1398 | #if 0 |
| 1399 | spec->multiout.dac_nids = d965_2112_dac_nids; |
| 1400 | spec->multiout.num_dacs = ARRAY_SIZE(d965_2112_dac_nids); |
| 1401 | #endif |
| 1402 | spec->init = d965_2112_core_init; |
| 1403 | spec->mixer = stac9227_mixer; |
| 1404 | break; |
| 1405 | case STAC_D965_284B: |
| 1406 | spec->adc_nids = stac9227_adc_nids; |
| 1407 | spec->mux_nids = stac9227_mux_nids; |
| 1408 | spec->init = stac9227_core_init; |
| 1409 | spec->mixer = stac9227_mixer; |
| 1410 | break; |
| 1411 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1412 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1413 | err = stac92xx_parse_auto_config(codec, 0x08, 0x09); |
| 1414 | if (err < 0) { |
| 1415 | stac92xx_free(codec); |
| 1416 | return err; |
| 1417 | } |
| 1418 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 1419 | if (spec->board_config == STAC_MACMINI) |
| 1420 | spec->gpio_mute = 1; |
| 1421 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1422 | codec->patch_ops = stac92xx_patch_ops; |
| 1423 | |
| 1424 | return 0; |
| 1425 | } |
| 1426 | |
| 1427 | static int patch_stac927x(struct hda_codec *codec) |
| 1428 | { |
| 1429 | struct sigmatel_spec *spec; |
| 1430 | int err; |
| 1431 | |
| 1432 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 1433 | if (spec == NULL) |
| 1434 | return -ENOMEM; |
| 1435 | |
| 1436 | codec->spec = spec; |
| 1437 | spec->board_config = snd_hda_check_board_config(codec, stac927x_cfg_tbl); |
| 1438 | if (spec->board_config < 0) |
| 1439 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n"); |
| 1440 | else { |
| 1441 | spec->num_pins = 14; |
| 1442 | spec->pin_nids = stac927x_pin_nids; |
| 1443 | spec->pin_configs = stac927x_brd_tbl[spec->board_config]; |
| 1444 | stac92xx_set_config_regs(codec); |
| 1445 | } |
| 1446 | |
| 1447 | spec->adc_nids = stac927x_adc_nids; |
| 1448 | spec->mux_nids = stac927x_mux_nids; |
| 1449 | spec->num_muxes = 3; |
| 1450 | |
| 1451 | spec->init = stac927x_core_init; |
| 1452 | spec->mixer = stac927x_mixer; |
| 1453 | |
| 1454 | spec->multiout.dac_nids = spec->dac_nids; |
| 1455 | |
| 1456 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1457 | if (err < 0) { |
| 1458 | stac92xx_free(codec); |
| 1459 | return err; |
| 1460 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1461 | |
| 1462 | codec->patch_ops = stac92xx_patch_ops; |
| 1463 | |
| 1464 | return 0; |
| 1465 | } |
| 1466 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1467 | static int patch_stac9205(struct hda_codec *codec) |
| 1468 | { |
| 1469 | struct sigmatel_spec *spec; |
| 1470 | int err; |
| 1471 | |
| 1472 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 1473 | if (spec == NULL) |
| 1474 | return -ENOMEM; |
| 1475 | |
| 1476 | codec->spec = spec; |
| 1477 | spec->board_config = snd_hda_check_board_config(codec, stac9205_cfg_tbl); |
| 1478 | if (spec->board_config < 0) |
| 1479 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); |
| 1480 | else { |
| 1481 | spec->num_pins = 14; |
| 1482 | spec->pin_nids = stac9205_pin_nids; |
| 1483 | spec->pin_configs = stac9205_brd_tbl[spec->board_config]; |
| 1484 | stac92xx_set_config_regs(codec); |
| 1485 | } |
| 1486 | |
| 1487 | spec->adc_nids = stac9205_adc_nids; |
| 1488 | spec->mux_nids = stac9205_mux_nids; |
| 1489 | spec->num_muxes = 3; |
| 1490 | |
| 1491 | spec->init = stac9205_core_init; |
| 1492 | spec->mixer = stac9205_mixer; |
| 1493 | |
| 1494 | spec->multiout.dac_nids = spec->dac_nids; |
| 1495 | |
| 1496 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); |
| 1497 | if (err < 0) { |
| 1498 | stac92xx_free(codec); |
| 1499 | return err; |
| 1500 | } |
| 1501 | |
| 1502 | codec->patch_ops = stac92xx_patch_ops; |
| 1503 | |
| 1504 | return 0; |
| 1505 | } |
| 1506 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1507 | /* |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1508 | * STAC 7661(?) and 7664 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1509 | */ |
| 1510 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1511 | /* static config for Sony VAIO FE550G and Sony VAIO AR */ |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1512 | static hda_nid_t vaio_dacs[] = { 0x2 }; |
| 1513 | #define VAIO_HP_DAC 0x5 |
| 1514 | static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ }; |
| 1515 | static hda_nid_t vaio_mux_nids[] = { 0x15 }; |
| 1516 | |
| 1517 | static struct hda_input_mux vaio_mux = { |
| 1518 | .num_items = 2, |
| 1519 | .items = { |
Takashi Iwai | d773781 | 2006-04-25 13:05:43 +0200 | [diff] [blame] | 1520 | /* { "HP", 0x0 }, */ |
| 1521 | { "Line", 0x1 }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1522 | { "Mic", 0x2 }, |
| 1523 | { "PCM", 0x3 }, |
| 1524 | } |
| 1525 | }; |
| 1526 | |
| 1527 | static struct hda_verb vaio_init[] = { |
| 1528 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
| 1529 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
| 1530 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
| 1531 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
| 1532 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ |
| 1533 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */ |
| 1534 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ |
| 1535 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ |
| 1536 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ |
| 1537 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ |
| 1538 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 1539 | {} |
| 1540 | }; |
| 1541 | |
| 1542 | /* bind volumes of both NID 0x02 and 0x05 */ |
| 1543 | static int vaio_master_vol_put(struct snd_kcontrol *kcontrol, |
| 1544 | struct snd_ctl_elem_value *ucontrol) |
| 1545 | { |
| 1546 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1547 | long *valp = ucontrol->value.integer.value; |
| 1548 | int change; |
| 1549 | |
| 1550 | change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, |
| 1551 | 0x7f, valp[0] & 0x7f); |
| 1552 | change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, |
| 1553 | 0x7f, valp[1] & 0x7f); |
| 1554 | snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, |
| 1555 | 0x7f, valp[0] & 0x7f); |
| 1556 | snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, |
| 1557 | 0x7f, valp[1] & 0x7f); |
| 1558 | return change; |
| 1559 | } |
| 1560 | |
| 1561 | /* bind volumes of both NID 0x02 and 0x05 */ |
| 1562 | static int vaio_master_sw_put(struct snd_kcontrol *kcontrol, |
| 1563 | struct snd_ctl_elem_value *ucontrol) |
| 1564 | { |
| 1565 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1566 | long *valp = ucontrol->value.integer.value; |
| 1567 | int change; |
| 1568 | |
| 1569 | change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, |
Takashi Iwai | a9393d7 | 2006-05-03 11:59:03 +0200 | [diff] [blame] | 1570 | 0x80, (valp[0] ? 0 : 0x80)); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1571 | change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, |
Takashi Iwai | a9393d7 | 2006-05-03 11:59:03 +0200 | [diff] [blame] | 1572 | 0x80, (valp[1] ? 0 : 0x80)); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1573 | snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, |
Takashi Iwai | a9393d7 | 2006-05-03 11:59:03 +0200 | [diff] [blame] | 1574 | 0x80, (valp[0] ? 0 : 0x80)); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1575 | snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, |
Takashi Iwai | a9393d7 | 2006-05-03 11:59:03 +0200 | [diff] [blame] | 1576 | 0x80, (valp[1] ? 0 : 0x80)); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1577 | return change; |
| 1578 | } |
| 1579 | |
| 1580 | static struct snd_kcontrol_new vaio_mixer[] = { |
| 1581 | { |
| 1582 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1583 | .name = "Master Playback Volume", |
| 1584 | .info = snd_hda_mixer_amp_volume_info, |
| 1585 | .get = snd_hda_mixer_amp_volume_get, |
| 1586 | .put = vaio_master_vol_put, |
Takashi Iwai | c256652 | 2006-08-17 18:21:36 +0200 | [diff] [blame] | 1587 | .tlv = { .c = snd_hda_mixer_amp_tlv }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1588 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 1589 | }, |
| 1590 | { |
| 1591 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1592 | .name = "Master Playback Switch", |
| 1593 | .info = snd_hda_mixer_amp_switch_info, |
| 1594 | .get = snd_hda_mixer_amp_switch_get, |
| 1595 | .put = vaio_master_sw_put, |
| 1596 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 1597 | }, |
| 1598 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
| 1599 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 1600 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
| 1601 | { |
| 1602 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1603 | .name = "Capture Source", |
| 1604 | .count = 1, |
| 1605 | .info = stac92xx_mux_enum_info, |
| 1606 | .get = stac92xx_mux_enum_get, |
| 1607 | .put = stac92xx_mux_enum_put, |
| 1608 | }, |
| 1609 | {} |
| 1610 | }; |
| 1611 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1612 | static struct hda_codec_ops stac766x_patch_ops = { |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1613 | .build_controls = stac92xx_build_controls, |
| 1614 | .build_pcms = stac92xx_build_pcms, |
| 1615 | .init = stac92xx_init, |
| 1616 | .free = stac92xx_free, |
| 1617 | #ifdef CONFIG_PM |
| 1618 | .resume = stac92xx_resume, |
| 1619 | #endif |
| 1620 | }; |
| 1621 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1622 | enum { STAC766x_VAIO }; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1623 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1624 | static struct hda_board_config stac766x_cfg_tbl[] = { |
| 1625 | { .modelname = "vaio", .config = STAC766x_VAIO }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1626 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81e6, |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1627 | .config = STAC766x_VAIO }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1628 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81ef, |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1629 | .config = STAC766x_VAIO }, |
| 1630 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81fd, |
| 1631 | .config = STAC766x_VAIO }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1632 | {} |
| 1633 | }; |
| 1634 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1635 | static int patch_stac766x(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1636 | { |
| 1637 | struct sigmatel_spec *spec; |
| 1638 | int board_config; |
| 1639 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1640 | board_config = snd_hda_check_board_config(codec, stac766x_cfg_tbl); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1641 | if (board_config < 0) |
| 1642 | /* unknown config, let generic-parser do its job... */ |
| 1643 | return snd_hda_parse_generic_codec(codec); |
| 1644 | |
| 1645 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 1646 | if (spec == NULL) |
| 1647 | return -ENOMEM; |
| 1648 | |
| 1649 | codec->spec = spec; |
| 1650 | switch (board_config) { |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1651 | case STAC766x_VAIO: |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1652 | spec->mixer = vaio_mixer; |
| 1653 | spec->init = vaio_init; |
| 1654 | spec->multiout.max_channels = 2; |
| 1655 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); |
| 1656 | spec->multiout.dac_nids = vaio_dacs; |
| 1657 | spec->multiout.hp_nid = VAIO_HP_DAC; |
| 1658 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); |
| 1659 | spec->adc_nids = vaio_adcs; |
| 1660 | spec->input_mux = &vaio_mux; |
| 1661 | spec->mux_nids = vaio_mux_nids; |
| 1662 | break; |
| 1663 | } |
| 1664 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1665 | codec->patch_ops = stac766x_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 1666 | return 0; |
| 1667 | } |
| 1668 | |
| 1669 | |
| 1670 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1671 | * patch entries |
| 1672 | */ |
| 1673 | struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
| 1674 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 1675 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 1676 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 1677 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 1678 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 1679 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 1680 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 1681 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 1682 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 1683 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 1684 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 1685 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 1686 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1687 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 1688 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 1689 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 1690 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 1691 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 1692 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 1693 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 1694 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 1695 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 1696 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1697 | { .id = 0x83847661, .name = "STAC7661", .patch = patch_stac766x }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1698 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 1699 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 1700 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 1701 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 1702 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 1703 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 1704 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 1705 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 1706 | { .id = 0x83847664, .name = "STAC7664", .patch = patch_stac766x }, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1707 | {} /* terminator */ |
| 1708 | }; |