Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
| 26 | #include <sound/driver.h> |
| 27 | #include <linux/init.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/slab.h> |
| 30 | #include <linux/pci.h> |
| 31 | #include <sound/core.h> |
| 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
| 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 55 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 56 | ALC880_UNIWILL, |
| 57 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 58 | ALC880_CLEVO, |
| 59 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 60 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 61 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 62 | #ifdef CONFIG_SND_DEBUG |
| 63 | ALC880_TEST, |
| 64 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 65 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 66 | ALC880_MODEL_LAST /* last tag */ |
| 67 | }; |
| 68 | |
| 69 | /* ALC260 models */ |
| 70 | enum { |
| 71 | ALC260_BASIC, |
| 72 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 73 | ALC260_HP_3013, |
| 74 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 75 | ALC260_ACER, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 76 | #ifdef CONFIG_SND_DEBUG |
| 77 | ALC260_TEST, |
| 78 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 79 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 80 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | }; |
| 82 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 83 | /* ALC262 models */ |
| 84 | enum { |
| 85 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 86 | ALC262_HIPPO, |
| 87 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 88 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 89 | ALC262_HP_BPC, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 90 | ALC262_BENQ_ED8, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 91 | ALC262_AUTO, |
| 92 | ALC262_MODEL_LAST /* last tag */ |
| 93 | }; |
| 94 | |
| 95 | /* ALC861 models */ |
| 96 | enum { |
| 97 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 98 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 99 | ALC861_3ST_DIG, |
| 100 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 101 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 102 | ALC861_TOSHIBA, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 103 | ALC861_AUTO, |
| 104 | ALC861_MODEL_LAST, |
| 105 | }; |
| 106 | |
| 107 | /* ALC882 models */ |
| 108 | enum { |
| 109 | ALC882_3ST_DIG, |
| 110 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 111 | ALC882_ARIMA, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 112 | ALC882_AUTO, |
| 113 | ALC882_MODEL_LAST, |
| 114 | }; |
| 115 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 116 | /* ALC883 models */ |
| 117 | enum { |
| 118 | ALC883_3ST_2ch_DIG, |
| 119 | ALC883_3ST_6ch_DIG, |
| 120 | ALC883_3ST_6ch, |
| 121 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 122 | ALC883_TARGA_DIG, |
| 123 | ALC883_TARGA_2ch_DIG, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 124 | ALC888_DEMO_BOARD, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 125 | ALC883_ACER, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 126 | ALC883_MEDION, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 127 | ALC883_AUTO, |
| 128 | ALC883_MODEL_LAST, |
| 129 | }; |
| 130 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 131 | /* for GPIO Poll */ |
| 132 | #define GPIO_MASK 0x03 |
| 133 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | struct alc_spec { |
| 135 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 136 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | unsigned int num_mixers; |
| 138 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 139 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 140 | * don't forget NULL |
| 141 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 142 | */ |
| 143 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 145 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | struct hda_pcm_stream *stream_analog_playback; |
| 147 | struct hda_pcm_stream *stream_analog_capture; |
| 148 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 149 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | struct hda_pcm_stream *stream_digital_playback; |
| 151 | struct hda_pcm_stream *stream_digital_capture; |
| 152 | |
| 153 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 154 | struct hda_multi_out multiout; /* playback set-up |
| 155 | * max_channels, dacs must be set |
| 156 | * dig_out_nid and hp_nid are optional |
| 157 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | |
| 159 | /* capture */ |
| 160 | unsigned int num_adc_nids; |
| 161 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 162 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
| 164 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 165 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | const struct hda_input_mux *input_mux; |
| 167 | unsigned int cur_mux[3]; |
| 168 | |
| 169 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 170 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 172 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | |
| 174 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 175 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 176 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 177 | /* dynamic controls, init_verbs and input_mux */ |
| 178 | struct auto_pin_cfg autocfg; |
| 179 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 180 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 181 | struct hda_input_mux private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 182 | hda_nid_t private_dac_nids[5]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 183 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 184 | /* hooks */ |
| 185 | void (*init_hook)(struct hda_codec *codec); |
| 186 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 187 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 188 | /* for pin sensing */ |
| 189 | unsigned int sense_updated: 1; |
| 190 | unsigned int jack_present: 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 191 | }; |
| 192 | |
| 193 | /* |
| 194 | * configuration template - to be copied to the spec instance |
| 195 | */ |
| 196 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 197 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 198 | * with spec |
| 199 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 200 | const struct hda_verb *init_verbs[5]; |
| 201 | unsigned int num_dacs; |
| 202 | hda_nid_t *dac_nids; |
| 203 | hda_nid_t dig_out_nid; /* optional */ |
| 204 | hda_nid_t hp_nid; /* optional */ |
| 205 | unsigned int num_adc_nids; |
| 206 | hda_nid_t *adc_nids; |
| 207 | hda_nid_t dig_in_nid; |
| 208 | unsigned int num_channel_mode; |
| 209 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 210 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 211 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 213 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 214 | void (*init_hook)(struct hda_codec *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | }; |
| 216 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | |
| 218 | /* |
| 219 | * input MUX handling |
| 220 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 221 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 222 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | { |
| 224 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 225 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 226 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 227 | if (mux_idx >= spec->num_mux_defs) |
| 228 | mux_idx = 0; |
| 229 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | } |
| 231 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 232 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 233 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | { |
| 235 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 236 | struct alc_spec *spec = codec->spec; |
| 237 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 238 | |
| 239 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 240 | return 0; |
| 241 | } |
| 242 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 243 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 244 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | { |
| 246 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 247 | struct alc_spec *spec = codec->spec; |
| 248 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 249 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 250 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 251 | spec->adc_nids[adc_idx], |
| 252 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | } |
| 254 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 255 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | /* |
| 257 | * channel mode setting |
| 258 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 259 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 260 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | { |
| 262 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 263 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 264 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 265 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | } |
| 267 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 268 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 269 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | { |
| 271 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 272 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 273 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 274 | spec->num_channel_mode, |
| 275 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | } |
| 277 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 278 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 279 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | { |
| 281 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 282 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 283 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 284 | spec->num_channel_mode, |
| 285 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 286 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 287 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 288 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | } |
| 290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 292 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 293 | * instead of "%" to avoid consequences of accidently treating the % as |
| 294 | * being part of a format specifier. Maximum allowed length of a value is |
| 295 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 296 | * |
| 297 | * Note: some retasking pin complexes seem to ignore requests for input |
| 298 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 299 | * are requested. Therefore order this list so that this behaviour will not |
| 300 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 301 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 302 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 303 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 304 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 305 | "Mic 50pc bias", "Mic 80pc bias", |
| 306 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 307 | }; |
| 308 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 309 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 310 | }; |
| 311 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 312 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 313 | * addition, "input" pins may or may not process the mic bias option |
| 314 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 315 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 316 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 317 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 318 | #define ALC_PIN_DIR_IN 0x00 |
| 319 | #define ALC_PIN_DIR_OUT 0x01 |
| 320 | #define ALC_PIN_DIR_INOUT 0x02 |
| 321 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 322 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 323 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 324 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 325 | * For each direction the minimum and maximum values are given. |
| 326 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 327 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 328 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 329 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 330 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 331 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 332 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 333 | }; |
| 334 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 335 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 336 | #define alc_pin_mode_n_items(_dir) \ |
| 337 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 338 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 339 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 340 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 341 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 342 | unsigned int item_num = uinfo->value.enumerated.item; |
| 343 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 344 | |
| 345 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 346 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 347 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 348 | |
| 349 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 350 | item_num = alc_pin_mode_min(dir); |
| 351 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 352 | return 0; |
| 353 | } |
| 354 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 355 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 356 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 357 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 358 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 359 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 360 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 361 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 362 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 363 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 364 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 365 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 366 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 367 | /* Find enumerated value for current pinctl setting */ |
| 368 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 369 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 370 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 371 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 372 | return 0; |
| 373 | } |
| 374 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 375 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 376 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 377 | { |
| 378 | signed int change; |
| 379 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 380 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 381 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 382 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 383 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 384 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 385 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 386 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 387 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 388 | val = alc_pin_mode_min(dir); |
| 389 | |
| 390 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 391 | if (change) { |
| 392 | /* Set pin mode to that requested */ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 393 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 394 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 395 | |
| 396 | /* Also enable the retasking pin's input/output as required |
| 397 | * for the requested pin mode. Enum values of 2 or less are |
| 398 | * input modes. |
| 399 | * |
| 400 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 401 | * reduces noise slightly (particularly on input) so we'll |
| 402 | * do it. However, having both input and output buffers |
| 403 | * enabled simultaneously doesn't seem to be problematic if |
| 404 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 405 | */ |
| 406 | if (val <= 2) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 407 | snd_hda_codec_write(codec, nid, 0, |
| 408 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 409 | AMP_OUT_MUTE); |
| 410 | snd_hda_codec_write(codec, nid, 0, |
| 411 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 412 | AMP_IN_UNMUTE(0)); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 413 | } else { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 414 | snd_hda_codec_write(codec, nid, 0, |
| 415 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 416 | AMP_IN_MUTE(0)); |
| 417 | snd_hda_codec_write(codec, nid, 0, |
| 418 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 419 | AMP_OUT_UNMUTE); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 420 | } |
| 421 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 422 | return change; |
| 423 | } |
| 424 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 425 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 426 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 427 | .info = alc_pin_mode_info, \ |
| 428 | .get = alc_pin_mode_get, \ |
| 429 | .put = alc_pin_mode_put, \ |
| 430 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 431 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 432 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 433 | * together using a mask with more than one bit set. This control is |
| 434 | * currently used only by the ALC260 test model. At this stage they are not |
| 435 | * needed for any "production" models. |
| 436 | */ |
| 437 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 438 | static int alc_gpio_data_info(struct snd_kcontrol *kcontrol, |
| 439 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 440 | { |
| 441 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 442 | uinfo->count = 1; |
| 443 | uinfo->value.integer.min = 0; |
| 444 | uinfo->value.integer.max = 1; |
| 445 | return 0; |
| 446 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 447 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 448 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 449 | { |
| 450 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 451 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 452 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 453 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 454 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 455 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 456 | |
| 457 | *valp = (val & mask) != 0; |
| 458 | return 0; |
| 459 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 460 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 461 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 462 | { |
| 463 | signed int change; |
| 464 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 465 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 466 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 467 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 468 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 469 | AC_VERB_GET_GPIO_DATA, |
| 470 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 471 | |
| 472 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 473 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 474 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 475 | gpio_data &= ~mask; |
| 476 | else |
| 477 | gpio_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 478 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 479 | |
| 480 | return change; |
| 481 | } |
| 482 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 483 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 484 | .info = alc_gpio_data_info, \ |
| 485 | .get = alc_gpio_data_get, \ |
| 486 | .put = alc_gpio_data_put, \ |
| 487 | .private_value = nid | (mask<<16) } |
| 488 | #endif /* CONFIG_SND_DEBUG */ |
| 489 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 490 | /* A switch control to allow the enabling of the digital IO pins on the |
| 491 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 492 | * to provide something in the test model allowing digital outputs to be |
| 493 | * identified if present. If models are found which can utilise these |
| 494 | * outputs a more complete mixer control can be devised for those models if |
| 495 | * necessary. |
| 496 | */ |
| 497 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 498 | static int alc_spdif_ctrl_info(struct snd_kcontrol *kcontrol, |
| 499 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 500 | { |
| 501 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 502 | uinfo->count = 1; |
| 503 | uinfo->value.integer.min = 0; |
| 504 | uinfo->value.integer.max = 1; |
| 505 | return 0; |
| 506 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 507 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 508 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 509 | { |
| 510 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 511 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 512 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 513 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 514 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 515 | AC_VERB_GET_DIGI_CONVERT, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 516 | |
| 517 | *valp = (val & mask) != 0; |
| 518 | return 0; |
| 519 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 520 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 521 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 522 | { |
| 523 | signed int change; |
| 524 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 525 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 526 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 527 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 528 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 529 | AC_VERB_GET_DIGI_CONVERT, |
| 530 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 531 | |
| 532 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 533 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 534 | if (val==0) |
| 535 | ctrl_data &= ~mask; |
| 536 | else |
| 537 | ctrl_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 539 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 540 | |
| 541 | return change; |
| 542 | } |
| 543 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 544 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 545 | .info = alc_spdif_ctrl_info, \ |
| 546 | .get = alc_spdif_ctrl_get, \ |
| 547 | .put = alc_spdif_ctrl_put, \ |
| 548 | .private_value = nid | (mask<<16) } |
| 549 | #endif /* CONFIG_SND_DEBUG */ |
| 550 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 551 | /* |
| 552 | * set up from the preset table |
| 553 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 554 | static void setup_preset(struct alc_spec *spec, |
| 555 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 556 | { |
| 557 | int i; |
| 558 | |
| 559 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 560 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 561 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 562 | i++) |
| 563 | spec->init_verbs[spec->num_init_verbs++] = |
| 564 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 565 | |
| 566 | spec->channel_mode = preset->channel_mode; |
| 567 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 568 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 569 | |
| 570 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 571 | |
| 572 | spec->multiout.num_dacs = preset->num_dacs; |
| 573 | spec->multiout.dac_nids = preset->dac_nids; |
| 574 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 575 | spec->multiout.hp_nid = preset->hp_nid; |
| 576 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 577 | spec->num_mux_defs = preset->num_mux_defs; |
| 578 | if (! spec->num_mux_defs) |
| 579 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 580 | spec->input_mux = preset->input_mux; |
| 581 | |
| 582 | spec->num_adc_nids = preset->num_adc_nids; |
| 583 | spec->adc_nids = preset->adc_nids; |
| 584 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 585 | |
| 586 | spec->unsol_event = preset->unsol_event; |
| 587 | spec->init_hook = preset->init_hook; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 588 | } |
| 589 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 590 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 591 | * ALC880 3-stack model |
| 592 | * |
| 593 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 594 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 595 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 | */ |
| 597 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 598 | static hda_nid_t alc880_dac_nids[4] = { |
| 599 | /* front, rear, clfe, rear_surr */ |
| 600 | 0x02, 0x05, 0x04, 0x03 |
| 601 | }; |
| 602 | |
| 603 | static hda_nid_t alc880_adc_nids[3] = { |
| 604 | /* ADC0-2 */ |
| 605 | 0x07, 0x08, 0x09, |
| 606 | }; |
| 607 | |
| 608 | /* The datasheet says the node 0x07 is connected from inputs, |
| 609 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 610 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 612 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 613 | /* ADC1-2 */ |
| 614 | 0x08, 0x09, |
| 615 | }; |
| 616 | |
| 617 | #define ALC880_DIGOUT_NID 0x06 |
| 618 | #define ALC880_DIGIN_NID 0x0a |
| 619 | |
| 620 | static struct hda_input_mux alc880_capture_source = { |
| 621 | .num_items = 4, |
| 622 | .items = { |
| 623 | { "Mic", 0x0 }, |
| 624 | { "Front Mic", 0x3 }, |
| 625 | { "Line", 0x2 }, |
| 626 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 627 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 628 | }; |
| 629 | |
| 630 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 631 | /* 2ch mode */ |
| 632 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 633 | /* set line-in to input, mute it */ |
| 634 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 635 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 636 | /* set mic-in to input vref 80%, mute it */ |
| 637 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 638 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 639 | { } /* end */ |
| 640 | }; |
| 641 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 642 | /* 6ch mode */ |
| 643 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 644 | /* set line-in to output, unmute it */ |
| 645 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 646 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 647 | /* set mic-in to output, unmute it */ |
| 648 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 649 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 650 | { } /* end */ |
| 651 | }; |
| 652 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 653 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 654 | { 2, alc880_threestack_ch2_init }, |
| 655 | { 6, alc880_threestack_ch6_init }, |
| 656 | }; |
| 657 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 658 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 659 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 660 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 661 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 662 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 663 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 664 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 665 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 666 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 667 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 668 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 669 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 670 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 671 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 672 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 673 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 674 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 675 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 676 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 678 | { |
| 679 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 680 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 681 | .info = alc_ch_mode_info, |
| 682 | .get = alc_ch_mode_get, |
| 683 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 684 | }, |
| 685 | { } /* end */ |
| 686 | }; |
| 687 | |
| 688 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 689 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 690 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 691 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 692 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 693 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 694 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 695 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 696 | { |
| 697 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 698 | /* The multiple "Capture Source" controls confuse alsamixer |
| 699 | * So call somewhat different.. |
| 700 | * FIXME: the controls appear in the "playback" view! |
| 701 | */ |
| 702 | /* .name = "Capture Source", */ |
| 703 | .name = "Input Source", |
| 704 | .count = 3, |
| 705 | .info = alc_mux_enum_info, |
| 706 | .get = alc_mux_enum_get, |
| 707 | .put = alc_mux_enum_put, |
| 708 | }, |
| 709 | { } /* end */ |
| 710 | }; |
| 711 | |
| 712 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 713 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 714 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 715 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 716 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 717 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 718 | { |
| 719 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 720 | /* The multiple "Capture Source" controls confuse alsamixer |
| 721 | * So call somewhat different.. |
| 722 | * FIXME: the controls appear in the "playback" view! |
| 723 | */ |
| 724 | /* .name = "Capture Source", */ |
| 725 | .name = "Input Source", |
| 726 | .count = 2, |
| 727 | .info = alc_mux_enum_info, |
| 728 | .get = alc_mux_enum_get, |
| 729 | .put = alc_mux_enum_put, |
| 730 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 731 | { } /* end */ |
| 732 | }; |
| 733 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 734 | |
| 735 | |
| 736 | /* |
| 737 | * ALC880 5-stack model |
| 738 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 739 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 740 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 741 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 742 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 743 | */ |
| 744 | |
| 745 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 746 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 747 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 748 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 749 | { } /* end */ |
| 750 | }; |
| 751 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 752 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 753 | /* 6ch mode */ |
| 754 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 755 | /* set line-in to input, mute it */ |
| 756 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 757 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 758 | { } /* end */ |
| 759 | }; |
| 760 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 761 | /* 8ch mode */ |
| 762 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 763 | /* set line-in to output, unmute it */ |
| 764 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 765 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 766 | { } /* end */ |
| 767 | }; |
| 768 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 769 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 770 | { 6, alc880_fivestack_ch6_init }, |
| 771 | { 8, alc880_fivestack_ch8_init }, |
| 772 | }; |
| 773 | |
| 774 | |
| 775 | /* |
| 776 | * ALC880 6-stack model |
| 777 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 778 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 779 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 780 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 781 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 782 | */ |
| 783 | |
| 784 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 785 | /* front, rear, clfe, rear_surr */ |
| 786 | 0x02, 0x03, 0x04, 0x05 |
| 787 | }; |
| 788 | |
| 789 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 790 | .num_items = 4, |
| 791 | .items = { |
| 792 | { "Mic", 0x0 }, |
| 793 | { "Front Mic", 0x1 }, |
| 794 | { "Line", 0x2 }, |
| 795 | { "CD", 0x4 }, |
| 796 | }, |
| 797 | }; |
| 798 | |
| 799 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 800 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 801 | { 8, NULL }, |
| 802 | }; |
| 803 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 804 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 805 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 806 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 807 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 808 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 809 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 810 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 811 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 812 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 813 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 814 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 815 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 816 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 818 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 821 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 822 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 823 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 824 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 825 | { |
| 826 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 827 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 828 | .info = alc_ch_mode_info, |
| 829 | .get = alc_ch_mode_get, |
| 830 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 831 | }, |
| 832 | { } /* end */ |
| 833 | }; |
| 834 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 835 | |
| 836 | /* |
| 837 | * ALC880 W810 model |
| 838 | * |
| 839 | * W810 has rear IO for: |
| 840 | * Front (DAC 02) |
| 841 | * Surround (DAC 03) |
| 842 | * Center/LFE (DAC 04) |
| 843 | * Digital out (06) |
| 844 | * |
| 845 | * The system also has a pair of internal speakers, and a headphone jack. |
| 846 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 847 | * |
| 848 | * There is a variable resistor to control the speaker or headphone |
| 849 | * volume. This is a hardware-only device without a software API. |
| 850 | * |
| 851 | * Plugging headphones in will disable the internal speakers. This is |
| 852 | * implemented in hardware, not via the driver using jack sense. In |
| 853 | * a similar fashion, plugging into the rear socket marked "front" will |
| 854 | * disable both the speakers and headphones. |
| 855 | * |
| 856 | * For input, there's a microphone jack, and an "audio in" jack. |
| 857 | * These may not do anything useful with this driver yet, because I |
| 858 | * haven't setup any initialization verbs for these yet... |
| 859 | */ |
| 860 | |
| 861 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 862 | /* front, rear/surround, clfe */ |
| 863 | 0x02, 0x03, 0x04 |
| 864 | }; |
| 865 | |
| 866 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 867 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 868 | { 6, NULL } |
| 869 | }; |
| 870 | |
| 871 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 872 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 873 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 874 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 875 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 876 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 877 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 878 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 879 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 880 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 881 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 882 | { } /* end */ |
| 883 | }; |
| 884 | |
| 885 | |
| 886 | /* |
| 887 | * Z710V model |
| 888 | * |
| 889 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 890 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 891 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 892 | */ |
| 893 | |
| 894 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 895 | 0x02 |
| 896 | }; |
| 897 | #define ALC880_Z71V_HP_DAC 0x03 |
| 898 | |
| 899 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 900 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 901 | { 2, NULL } |
| 902 | }; |
| 903 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 904 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 905 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 906 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 907 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 908 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 909 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 910 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 911 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 912 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 913 | { } /* end */ |
| 914 | }; |
| 915 | |
| 916 | |
| 917 | /* FIXME! */ |
| 918 | /* |
| 919 | * ALC880 F1734 model |
| 920 | * |
| 921 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 922 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 923 | */ |
| 924 | |
| 925 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 926 | 0x03 |
| 927 | }; |
| 928 | #define ALC880_F1734_HP_DAC 0x02 |
| 929 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 930 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 931 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 932 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 933 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 934 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 935 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 936 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 937 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 939 | { } /* end */ |
| 940 | }; |
| 941 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 942 | |
| 943 | /* FIXME! */ |
| 944 | /* |
| 945 | * ALC880 ASUS model |
| 946 | * |
| 947 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 948 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 949 | * Mic = 0x18, Line = 0x1a |
| 950 | */ |
| 951 | |
| 952 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 953 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 954 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 955 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 956 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 957 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 958 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 959 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 960 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 961 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 962 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 963 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 964 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 965 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 966 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 967 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 968 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 969 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 970 | { |
| 971 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 972 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 973 | .info = alc_ch_mode_info, |
| 974 | .get = alc_ch_mode_get, |
| 975 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 976 | }, |
| 977 | { } /* end */ |
| 978 | }; |
| 979 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 980 | /* FIXME! */ |
| 981 | /* |
| 982 | * ALC880 ASUS W1V model |
| 983 | * |
| 984 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 985 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 986 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 987 | */ |
| 988 | |
| 989 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 990 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 991 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 992 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 993 | { } /* end */ |
| 994 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 995 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 996 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 997 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 998 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 999 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1000 | { } /* end */ |
| 1001 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1002 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1003 | /* TCL S700 */ |
| 1004 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1006 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1007 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1008 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1009 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1010 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1011 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1012 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1013 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1014 | { |
| 1015 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1016 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1017 | * So call somewhat different.. |
| 1018 | * FIXME: the controls appear in the "playback" view! |
| 1019 | */ |
| 1020 | /* .name = "Capture Source", */ |
| 1021 | .name = "Input Source", |
| 1022 | .count = 1, |
| 1023 | .info = alc_mux_enum_info, |
| 1024 | .get = alc_mux_enum_get, |
| 1025 | .put = alc_mux_enum_put, |
| 1026 | }, |
| 1027 | { } /* end */ |
| 1028 | }; |
| 1029 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 1030 | /* Uniwill */ |
| 1031 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
| 1032 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1033 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1034 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1035 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1036 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1037 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1038 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1039 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1040 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1041 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1043 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1045 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1046 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1047 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1048 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1049 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1050 | { |
| 1051 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1052 | .name = "Channel Mode", |
| 1053 | .info = alc_ch_mode_info, |
| 1054 | .get = alc_ch_mode_get, |
| 1055 | .put = alc_ch_mode_put, |
| 1056 | }, |
| 1057 | { } /* end */ |
| 1058 | }; |
| 1059 | |
| 1060 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
| 1061 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1062 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1063 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1064 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1065 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1066 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1067 | { } /* end */ |
| 1068 | }; |
| 1069 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1070 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1071 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1072 | */ |
| 1073 | static int alc_build_controls(struct hda_codec *codec) |
| 1074 | { |
| 1075 | struct alc_spec *spec = codec->spec; |
| 1076 | int err; |
| 1077 | int i; |
| 1078 | |
| 1079 | for (i = 0; i < spec->num_mixers; i++) { |
| 1080 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1081 | if (err < 0) |
| 1082 | return err; |
| 1083 | } |
| 1084 | |
| 1085 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1086 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1087 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1088 | if (err < 0) |
| 1089 | return err; |
| 1090 | } |
| 1091 | if (spec->dig_in_nid) { |
| 1092 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1093 | if (err < 0) |
| 1094 | return err; |
| 1095 | } |
| 1096 | return 0; |
| 1097 | } |
| 1098 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1099 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1100 | /* |
| 1101 | * initialize the codec volumes, etc |
| 1102 | */ |
| 1103 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1104 | /* |
| 1105 | * generic initialization of ADC, input mixers and output mixers |
| 1106 | */ |
| 1107 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1108 | /* |
| 1109 | * Unmute ADC0-2 and set the default input to mic-in |
| 1110 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1111 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1112 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1113 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1114 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1115 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1116 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1117 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1118 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1119 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1120 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1121 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1122 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1123 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1124 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1125 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1126 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 1127 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 1128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1129 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1130 | /* |
| 1131 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1132 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1133 | /* set vol=0 to output mixers */ |
| 1134 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1135 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1136 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1137 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1138 | /* set up input amps for analog loopback */ |
| 1139 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1140 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1141 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1142 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1143 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1144 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1145 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1146 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1147 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1148 | |
| 1149 | { } |
| 1150 | }; |
| 1151 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1152 | /* |
| 1153 | * 3-stack pin configuration: |
| 1154 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1155 | */ |
| 1156 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1157 | /* |
| 1158 | * preset connection lists of input pins |
| 1159 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1160 | */ |
| 1161 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1162 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1163 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1164 | |
| 1165 | /* |
| 1166 | * Set pin mode and muting |
| 1167 | */ |
| 1168 | /* set front pin widgets 0x14 for output */ |
| 1169 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1170 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1171 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1172 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1173 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1174 | /* Mic2 (as headphone out) for HP output */ |
| 1175 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1176 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1177 | /* Line In pin widget for input */ |
| 1178 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1179 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1180 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1181 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1182 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1183 | /* CD pin widget for input */ |
| 1184 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1185 | |
| 1186 | { } |
| 1187 | }; |
| 1188 | |
| 1189 | /* |
| 1190 | * 5-stack pin configuration: |
| 1191 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1192 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1193 | */ |
| 1194 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1195 | /* |
| 1196 | * preset connection lists of input pins |
| 1197 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1198 | */ |
| 1199 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1200 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1201 | |
| 1202 | /* |
| 1203 | * Set pin mode and muting |
| 1204 | */ |
| 1205 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1207 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1208 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1209 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1210 | /* unmute pins for output (no gain on this amp) */ |
| 1211 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1212 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1213 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1214 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1215 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1216 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1217 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1218 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1219 | /* Mic2 (as headphone out) for HP output */ |
| 1220 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1221 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1222 | /* Line In pin widget for input */ |
| 1223 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1224 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1225 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1226 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1227 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1228 | /* CD pin widget for input */ |
| 1229 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1230 | |
| 1231 | { } |
| 1232 | }; |
| 1233 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1234 | /* |
| 1235 | * W810 pin configuration: |
| 1236 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1237 | */ |
| 1238 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1239 | /* hphone/speaker input selector: front DAC */ |
| 1240 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1241 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1242 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1243 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1244 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1245 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1246 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1247 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1248 | |
| 1249 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1250 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1251 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1252 | { } |
| 1253 | }; |
| 1254 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1255 | /* |
| 1256 | * Z71V pin configuration: |
| 1257 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1258 | */ |
| 1259 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1260 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1261 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1262 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1263 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1264 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1265 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1266 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1267 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1268 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1269 | |
| 1270 | { } |
| 1271 | }; |
| 1272 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1273 | /* |
| 1274 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1275 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1276 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1277 | */ |
| 1278 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1279 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1280 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1281 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1282 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1283 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1284 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1285 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1286 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1287 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1288 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1289 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1290 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1291 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1292 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1293 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1294 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1295 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1296 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1297 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1298 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1299 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1300 | { } |
| 1301 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1302 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 1303 | /* |
| 1304 | * Uniwill pin configuration: |
| 1305 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1306 | * line = 0x1a |
| 1307 | */ |
| 1308 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1309 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1310 | |
| 1311 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1312 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1313 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1314 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1315 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1316 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1317 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1318 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1319 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1320 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1321 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1322 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1323 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1324 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1325 | |
| 1326 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1327 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1328 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1329 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1330 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1331 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1332 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1333 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1334 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1335 | |
| 1336 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1337 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1338 | |
| 1339 | { } |
| 1340 | }; |
| 1341 | |
| 1342 | /* |
| 1343 | * Uniwill P53 |
| 1344 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1345 | */ |
| 1346 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1347 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1348 | |
| 1349 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1350 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1351 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1352 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1353 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1354 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1355 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1356 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1357 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1358 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1359 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1360 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1361 | |
| 1362 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1363 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1364 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1365 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1366 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1367 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1368 | |
| 1369 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1370 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1371 | |
| 1372 | { } |
| 1373 | }; |
| 1374 | |
| 1375 | /* toggle speaker-output according to the hp-jack state */ |
| 1376 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1377 | { |
| 1378 | unsigned int present; |
| 1379 | |
| 1380 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1381 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1382 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 1383 | 0x80, present ? 0x80 : 0); |
| 1384 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 1385 | 0x80, present ? 0x80 : 0); |
| 1386 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0, |
| 1387 | 0x80, present ? 0x80 : 0); |
| 1388 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, |
| 1389 | 0x80, present ? 0x80 : 0); |
| 1390 | |
| 1391 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1392 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1393 | snd_hda_codec_write(codec, 0x0b, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 1394 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 1395 | } |
| 1396 | |
| 1397 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1398 | unsigned int res) |
| 1399 | { |
| 1400 | /* Looks like the unsol event is incompatible with the standard |
| 1401 | * definition. 4bit tag is placed at 28 bit! |
| 1402 | */ |
| 1403 | if ((res >> 28) == ALC880_HP_EVENT || |
| 1404 | (res >> 28) == ALC880_MIC_EVENT) |
| 1405 | alc880_uniwill_automute(codec); |
| 1406 | } |
| 1407 | |
| 1408 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1409 | { |
| 1410 | unsigned int present; |
| 1411 | |
| 1412 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1413 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1414 | |
| 1415 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, |
| 1416 | 0x80, present ? 0x80 : 0); |
| 1417 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0, |
| 1418 | 0x80, present ? 0x80 : 0); |
| 1419 | } |
| 1420 | |
| 1421 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1422 | { |
| 1423 | unsigned int present; |
| 1424 | |
| 1425 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 1426 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; |
| 1427 | |
| 1428 | snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 1429 | 0x7f, present); |
| 1430 | snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 1431 | 0x7f, present); |
| 1432 | |
| 1433 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 1434 | 0x7f, present); |
| 1435 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 1436 | 0x7f, present); |
| 1437 | |
| 1438 | } |
| 1439 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1440 | unsigned int res) |
| 1441 | { |
| 1442 | /* Looks like the unsol event is incompatible with the standard |
| 1443 | * definition. 4bit tag is placed at 28 bit! |
| 1444 | */ |
| 1445 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1446 | alc880_uniwill_p53_hp_automute(codec); |
| 1447 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
| 1448 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1449 | } |
| 1450 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1451 | /* FIXME! */ |
| 1452 | /* |
| 1453 | * F1734 pin configuration: |
| 1454 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1455 | */ |
| 1456 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1457 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1458 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1459 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1460 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1461 | |
| 1462 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1463 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1465 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1466 | |
| 1467 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1468 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1469 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1470 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1471 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1472 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1473 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1474 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1475 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1476 | |
| 1477 | { } |
| 1478 | }; |
| 1479 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1480 | /* FIXME! */ |
| 1481 | /* |
| 1482 | * ASUS pin configuration: |
| 1483 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1484 | */ |
| 1485 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1486 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1487 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1488 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1489 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1490 | |
| 1491 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1492 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1493 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1494 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1495 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1497 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1498 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1499 | |
| 1500 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1501 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1502 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1503 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1504 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1506 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1507 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1508 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1509 | |
| 1510 | { } |
| 1511 | }; |
| 1512 | |
| 1513 | /* Enable GPIO mask and set output */ |
| 1514 | static struct hda_verb alc880_gpio1_init_verbs[] = { |
| 1515 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 1516 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 1517 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1518 | |
| 1519 | { } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1520 | }; |
| 1521 | |
| 1522 | /* Enable GPIO mask and set output */ |
| 1523 | static struct hda_verb alc880_gpio2_init_verbs[] = { |
| 1524 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 1525 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 1526 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1527 | |
| 1528 | { } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1529 | }; |
| 1530 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1531 | /* Clevo m520g init */ |
| 1532 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1533 | /* headphone output */ |
| 1534 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1535 | /* line-out */ |
| 1536 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1537 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1538 | /* Line-in */ |
| 1539 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1540 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1541 | /* CD */ |
| 1542 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1543 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1544 | /* Mic1 (rear panel) */ |
| 1545 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1546 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1547 | /* Mic2 (front panel) */ |
| 1548 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1549 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1550 | /* headphone */ |
| 1551 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1552 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1553 | /* change to EAPD mode */ |
| 1554 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1555 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1556 | |
| 1557 | { } |
| 1558 | }; |
| 1559 | |
| 1560 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 1561 | /* change to EAPD mode */ |
| 1562 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1563 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1565 | /* Headphone output */ |
| 1566 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1567 | /* Front output*/ |
| 1568 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1569 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1570 | |
| 1571 | /* Line In pin widget for input */ |
| 1572 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1573 | /* CD pin widget for input */ |
| 1574 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1575 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1576 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1577 | |
| 1578 | /* change to EAPD mode */ |
| 1579 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1580 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 1581 | |
| 1582 | { } |
| 1583 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1584 | |
| 1585 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1586 | * LG m1 express dual |
| 1587 | * |
| 1588 | * Pin assignment: |
| 1589 | * Rear Line-In/Out (blue): 0x14 |
| 1590 | * Build-in Mic-In: 0x15 |
| 1591 | * Speaker-out: 0x17 |
| 1592 | * HP-Out (green): 0x1b |
| 1593 | * Mic-In/Out (red): 0x19 |
| 1594 | * SPDIF-Out: 0x1e |
| 1595 | */ |
| 1596 | |
| 1597 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 1598 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 1599 | 0x05, 0x02, 0x03 |
| 1600 | }; |
| 1601 | |
| 1602 | /* seems analog CD is not working */ |
| 1603 | static struct hda_input_mux alc880_lg_capture_source = { |
| 1604 | .num_items = 3, |
| 1605 | .items = { |
| 1606 | { "Mic", 0x1 }, |
| 1607 | { "Line", 0x5 }, |
| 1608 | { "Internal Mic", 0x6 }, |
| 1609 | }, |
| 1610 | }; |
| 1611 | |
| 1612 | /* 2,4,6 channel modes */ |
| 1613 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 1614 | /* set line-in and mic-in to input */ |
| 1615 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1616 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1617 | { } |
| 1618 | }; |
| 1619 | |
| 1620 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 1621 | /* set line-in to out and mic-in to input */ |
| 1622 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1623 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1624 | { } |
| 1625 | }; |
| 1626 | |
| 1627 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 1628 | /* set line-in and mic-in to output */ |
| 1629 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1630 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1631 | { } |
| 1632 | }; |
| 1633 | |
| 1634 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 1635 | { 2, alc880_lg_ch2_init }, |
| 1636 | { 4, alc880_lg_ch4_init }, |
| 1637 | { 6, alc880_lg_ch6_init }, |
| 1638 | }; |
| 1639 | |
| 1640 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 1641 | /* FIXME: it's not really "master" but front channels */ |
| 1642 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1643 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1644 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1645 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1646 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 1647 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 1648 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 1649 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 1650 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1651 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1652 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 1653 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 1654 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 1655 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 1656 | { |
| 1657 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1658 | .name = "Channel Mode", |
| 1659 | .info = alc_ch_mode_info, |
| 1660 | .get = alc_ch_mode_get, |
| 1661 | .put = alc_ch_mode_put, |
| 1662 | }, |
| 1663 | { } /* end */ |
| 1664 | }; |
| 1665 | |
| 1666 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 1667 | /* set capture source to mic-in */ |
| 1668 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1669 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1670 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1671 | /* mute all amp mixer inputs */ |
| 1672 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 1673 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 1674 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1675 | /* line-in to input */ |
| 1676 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1677 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1678 | /* built-in mic */ |
| 1679 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1680 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1681 | /* speaker-out */ |
| 1682 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1683 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1684 | /* mic-in to input */ |
| 1685 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1686 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1687 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1688 | /* HP-out */ |
| 1689 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1690 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1691 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1692 | /* jack sense */ |
| 1693 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1694 | { } |
| 1695 | }; |
| 1696 | |
| 1697 | /* toggle speaker-output according to the hp-jack state */ |
| 1698 | static void alc880_lg_automute(struct hda_codec *codec) |
| 1699 | { |
| 1700 | unsigned int present; |
| 1701 | |
| 1702 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1703 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1704 | snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, |
| 1705 | 0x80, present ? 0x80 : 0); |
| 1706 | snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0, |
| 1707 | 0x80, present ? 0x80 : 0); |
| 1708 | } |
| 1709 | |
| 1710 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1711 | { |
| 1712 | /* Looks like the unsol event is incompatible with the standard |
| 1713 | * definition. 4bit tag is placed at 28 bit! |
| 1714 | */ |
| 1715 | if ((res >> 28) == 0x01) |
| 1716 | alc880_lg_automute(codec); |
| 1717 | } |
| 1718 | |
| 1719 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1720 | * LG LW20 |
| 1721 | * |
| 1722 | * Pin assignment: |
| 1723 | * Speaker-out: 0x14 |
| 1724 | * Mic-In: 0x18 |
| 1725 | * Built-in Mic-In: 0x19 (?) |
| 1726 | * HP-Out: 0x1b |
| 1727 | * SPDIF-Out: 0x1e |
| 1728 | */ |
| 1729 | |
| 1730 | /* seems analog CD is not working */ |
| 1731 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
| 1732 | .num_items = 2, |
| 1733 | .items = { |
| 1734 | { "Mic", 0x0 }, |
| 1735 | { "Internal Mic", 0x1 }, |
| 1736 | }, |
| 1737 | }; |
| 1738 | |
| 1739 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
| 1740 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1741 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1742 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1743 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1744 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 1745 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 1746 | { } /* end */ |
| 1747 | }; |
| 1748 | |
| 1749 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
| 1750 | /* set capture source to mic-in */ |
| 1751 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1752 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1753 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1754 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1755 | /* speaker-out */ |
| 1756 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1757 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1758 | /* HP-out */ |
| 1759 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1761 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1762 | /* mic-in to input */ |
| 1763 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1764 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1765 | /* built-in mic */ |
| 1766 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1767 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1768 | /* jack sense */ |
| 1769 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1770 | { } |
| 1771 | }; |
| 1772 | |
| 1773 | /* toggle speaker-output according to the hp-jack state */ |
| 1774 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 1775 | { |
| 1776 | unsigned int present; |
| 1777 | |
| 1778 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1779 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1780 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 1781 | 0x80, present ? 0x80 : 0); |
| 1782 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 1783 | 0x80, present ? 0x80 : 0); |
| 1784 | } |
| 1785 | |
| 1786 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1787 | { |
| 1788 | /* Looks like the unsol event is incompatible with the standard |
| 1789 | * definition. 4bit tag is placed at 28 bit! |
| 1790 | */ |
| 1791 | if ((res >> 28) == 0x01) |
| 1792 | alc880_lg_lw_automute(codec); |
| 1793 | } |
| 1794 | |
| 1795 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1796 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1797 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1798 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1799 | static int alc_init(struct hda_codec *codec) |
| 1800 | { |
| 1801 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1802 | unsigned int i; |
| 1803 | |
| 1804 | for (i = 0; i < spec->num_init_verbs; i++) |
| 1805 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1806 | |
| 1807 | if (spec->init_hook) |
| 1808 | spec->init_hook(codec); |
| 1809 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1810 | return 0; |
| 1811 | } |
| 1812 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1813 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1814 | { |
| 1815 | struct alc_spec *spec = codec->spec; |
| 1816 | |
| 1817 | if (spec->unsol_event) |
| 1818 | spec->unsol_event(codec, res); |
| 1819 | } |
| 1820 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1821 | #ifdef CONFIG_PM |
| 1822 | /* |
| 1823 | * resume |
| 1824 | */ |
| 1825 | static int alc_resume(struct hda_codec *codec) |
| 1826 | { |
| 1827 | struct alc_spec *spec = codec->spec; |
| 1828 | int i; |
| 1829 | |
| 1830 | alc_init(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1831 | for (i = 0; i < spec->num_mixers; i++) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1832 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1833 | if (spec->multiout.dig_out_nid) |
| 1834 | snd_hda_resume_spdif_out(codec); |
| 1835 | if (spec->dig_in_nid) |
| 1836 | snd_hda_resume_spdif_in(codec); |
| 1837 | |
| 1838 | return 0; |
| 1839 | } |
| 1840 | #endif |
| 1841 | |
| 1842 | /* |
| 1843 | * Analog playback callbacks |
| 1844 | */ |
| 1845 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 1846 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1847 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1848 | { |
| 1849 | struct alc_spec *spec = codec->spec; |
| 1850 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 1851 | } |
| 1852 | |
| 1853 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1854 | struct hda_codec *codec, |
| 1855 | unsigned int stream_tag, |
| 1856 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1857 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1858 | { |
| 1859 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1860 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 1861 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1862 | } |
| 1863 | |
| 1864 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 1865 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1866 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1867 | { |
| 1868 | struct alc_spec *spec = codec->spec; |
| 1869 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 1870 | } |
| 1871 | |
| 1872 | /* |
| 1873 | * Digital out |
| 1874 | */ |
| 1875 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 1876 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1877 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1878 | { |
| 1879 | struct alc_spec *spec = codec->spec; |
| 1880 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 1881 | } |
| 1882 | |
| 1883 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 1884 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1885 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1886 | { |
| 1887 | struct alc_spec *spec = codec->spec; |
| 1888 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 1889 | } |
| 1890 | |
| 1891 | /* |
| 1892 | * Analog capture |
| 1893 | */ |
| 1894 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1895 | struct hda_codec *codec, |
| 1896 | unsigned int stream_tag, |
| 1897 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1898 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1899 | { |
| 1900 | struct alc_spec *spec = codec->spec; |
| 1901 | |
| 1902 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 1903 | stream_tag, 0, format); |
| 1904 | return 0; |
| 1905 | } |
| 1906 | |
| 1907 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 1908 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1909 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1910 | { |
| 1911 | struct alc_spec *spec = codec->spec; |
| 1912 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1913 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 1914 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1915 | return 0; |
| 1916 | } |
| 1917 | |
| 1918 | |
| 1919 | /* |
| 1920 | */ |
| 1921 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 1922 | .substreams = 1, |
| 1923 | .channels_min = 2, |
| 1924 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1925 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1926 | .ops = { |
| 1927 | .open = alc880_playback_pcm_open, |
| 1928 | .prepare = alc880_playback_pcm_prepare, |
| 1929 | .cleanup = alc880_playback_pcm_cleanup |
| 1930 | }, |
| 1931 | }; |
| 1932 | |
| 1933 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 1934 | .substreams = 2, |
| 1935 | .channels_min = 2, |
| 1936 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1937 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1938 | .ops = { |
| 1939 | .prepare = alc880_capture_pcm_prepare, |
| 1940 | .cleanup = alc880_capture_pcm_cleanup |
| 1941 | }, |
| 1942 | }; |
| 1943 | |
| 1944 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 1945 | .substreams = 1, |
| 1946 | .channels_min = 2, |
| 1947 | .channels_max = 2, |
| 1948 | /* NID is set in alc_build_pcms */ |
| 1949 | .ops = { |
| 1950 | .open = alc880_dig_playback_pcm_open, |
| 1951 | .close = alc880_dig_playback_pcm_close |
| 1952 | }, |
| 1953 | }; |
| 1954 | |
| 1955 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 1956 | .substreams = 1, |
| 1957 | .channels_min = 2, |
| 1958 | .channels_max = 2, |
| 1959 | /* NID is set in alc_build_pcms */ |
| 1960 | }; |
| 1961 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 1962 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 1963 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 1964 | .substreams = 0, |
| 1965 | .channels_min = 0, |
| 1966 | .channels_max = 0, |
| 1967 | }; |
| 1968 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1969 | static int alc_build_pcms(struct hda_codec *codec) |
| 1970 | { |
| 1971 | struct alc_spec *spec = codec->spec; |
| 1972 | struct hda_pcm *info = spec->pcm_rec; |
| 1973 | int i; |
| 1974 | |
| 1975 | codec->num_pcms = 1; |
| 1976 | codec->pcm_info = info; |
| 1977 | |
| 1978 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 1979 | if (spec->stream_analog_playback) { |
| 1980 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 1981 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 1982 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 1983 | } |
| 1984 | if (spec->stream_analog_capture) { |
| 1985 | snd_assert(spec->adc_nids, return -EINVAL); |
| 1986 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 1987 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 1988 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1989 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 1990 | if (spec->channel_mode) { |
| 1991 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 1992 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 1993 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 1994 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 1995 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1996 | } |
| 1997 | } |
| 1998 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 1999 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2000 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2001 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2002 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2003 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2004 | if (spec->multiout.dig_out_nid && |
| 2005 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2006 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2007 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2008 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2009 | if (spec->dig_in_nid && |
| 2010 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2011 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2012 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2013 | } |
| 2014 | } |
| 2015 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2016 | /* If the use of more than one ADC is requested for the current |
| 2017 | * model, configure a second analog capture-only PCM. |
| 2018 | */ |
| 2019 | /* Additional Analaog capture for index #2 */ |
| 2020 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2021 | spec->adc_nids) { |
| 2022 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2023 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2024 | info->name = spec->stream_name_analog; |
| 2025 | /* No playback stream for second PCM */ |
| 2026 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2027 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2028 | if (spec->stream_analog_capture) { |
| 2029 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2030 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2031 | } |
| 2032 | } |
| 2033 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2034 | return 0; |
| 2035 | } |
| 2036 | |
| 2037 | static void alc_free(struct hda_codec *codec) |
| 2038 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2039 | struct alc_spec *spec = codec->spec; |
| 2040 | unsigned int i; |
| 2041 | |
| 2042 | if (! spec) |
| 2043 | return; |
| 2044 | |
| 2045 | if (spec->kctl_alloc) { |
| 2046 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2047 | kfree(spec->kctl_alloc[i].name); |
| 2048 | kfree(spec->kctl_alloc); |
| 2049 | } |
| 2050 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2051 | } |
| 2052 | |
| 2053 | /* |
| 2054 | */ |
| 2055 | static struct hda_codec_ops alc_patch_ops = { |
| 2056 | .build_controls = alc_build_controls, |
| 2057 | .build_pcms = alc_build_pcms, |
| 2058 | .init = alc_init, |
| 2059 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2060 | .unsol_event = alc_unsol_event, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2061 | #ifdef CONFIG_PM |
| 2062 | .resume = alc_resume, |
| 2063 | #endif |
| 2064 | }; |
| 2065 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2066 | |
| 2067 | /* |
| 2068 | * Test configuration for debugging |
| 2069 | * |
| 2070 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2071 | * enum controls. |
| 2072 | */ |
| 2073 | #ifdef CONFIG_SND_DEBUG |
| 2074 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2075 | 0x02, 0x03, 0x04, 0x05 |
| 2076 | }; |
| 2077 | |
| 2078 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2079 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2080 | .items = { |
| 2081 | { "In-1", 0x0 }, |
| 2082 | { "In-2", 0x1 }, |
| 2083 | { "In-3", 0x2 }, |
| 2084 | { "In-4", 0x3 }, |
| 2085 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2086 | { "Front", 0x5 }, |
| 2087 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2088 | }, |
| 2089 | }; |
| 2090 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2091 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2092 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2093 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2094 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2095 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2096 | }; |
| 2097 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2098 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2099 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2100 | { |
| 2101 | static char *texts[] = { |
| 2102 | "N/A", "Line Out", "HP Out", |
| 2103 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2104 | }; |
| 2105 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2106 | uinfo->count = 1; |
| 2107 | uinfo->value.enumerated.items = 8; |
| 2108 | if (uinfo->value.enumerated.item >= 8) |
| 2109 | uinfo->value.enumerated.item = 7; |
| 2110 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2111 | return 0; |
| 2112 | } |
| 2113 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2114 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2115 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2116 | { |
| 2117 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2118 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2119 | unsigned int pin_ctl, item = 0; |
| 2120 | |
| 2121 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2122 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2123 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2124 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2125 | item = 2; |
| 2126 | else |
| 2127 | item = 1; |
| 2128 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2129 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2130 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2131 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2132 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2133 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2134 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2135 | } |
| 2136 | } |
| 2137 | ucontrol->value.enumerated.item[0] = item; |
| 2138 | return 0; |
| 2139 | } |
| 2140 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2141 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2142 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2143 | { |
| 2144 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2145 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2146 | static unsigned int ctls[] = { |
| 2147 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2148 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2149 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2150 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2151 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2152 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2153 | }; |
| 2154 | unsigned int old_ctl, new_ctl; |
| 2155 | |
| 2156 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2157 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2158 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2159 | if (old_ctl != new_ctl) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2160 | snd_hda_codec_write(codec, nid, 0, |
| 2161 | AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2162 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2163 | (ucontrol->value.enumerated.item[0] >= 3 ? |
| 2164 | 0xb080 : 0xb000)); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2165 | return 1; |
| 2166 | } |
| 2167 | return 0; |
| 2168 | } |
| 2169 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2170 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2171 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2172 | { |
| 2173 | static char *texts[] = { |
| 2174 | "Front", "Surround", "CLFE", "Side" |
| 2175 | }; |
| 2176 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2177 | uinfo->count = 1; |
| 2178 | uinfo->value.enumerated.items = 4; |
| 2179 | if (uinfo->value.enumerated.item >= 4) |
| 2180 | uinfo->value.enumerated.item = 3; |
| 2181 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2182 | return 0; |
| 2183 | } |
| 2184 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2185 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2186 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2187 | { |
| 2188 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2189 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2190 | unsigned int sel; |
| 2191 | |
| 2192 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2193 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2194 | return 0; |
| 2195 | } |
| 2196 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2197 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2198 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2199 | { |
| 2200 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2201 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2202 | unsigned int sel; |
| 2203 | |
| 2204 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2205 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2206 | sel = ucontrol->value.enumerated.item[0] & 3; |
| 2207 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel); |
| 2208 | return 1; |
| 2209 | } |
| 2210 | return 0; |
| 2211 | } |
| 2212 | |
| 2213 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2214 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2215 | .name = xname, \ |
| 2216 | .info = alc_test_pin_ctl_info, \ |
| 2217 | .get = alc_test_pin_ctl_get, \ |
| 2218 | .put = alc_test_pin_ctl_put, \ |
| 2219 | .private_value = nid \ |
| 2220 | } |
| 2221 | |
| 2222 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2223 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2224 | .name = xname, \ |
| 2225 | .info = alc_test_pin_src_info, \ |
| 2226 | .get = alc_test_pin_src_get, \ |
| 2227 | .put = alc_test_pin_src_put, \ |
| 2228 | .private_value = nid \ |
| 2229 | } |
| 2230 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2231 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2232 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2233 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2234 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2235 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2236 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2237 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2238 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2239 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2240 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2241 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2242 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2243 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2244 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2245 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2246 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2247 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2248 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2249 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2250 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2251 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2252 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2253 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2254 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2255 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2256 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2257 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2258 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2259 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2260 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2261 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2262 | { |
| 2263 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2264 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2265 | .info = alc_ch_mode_info, |
| 2266 | .get = alc_ch_mode_get, |
| 2267 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2268 | }, |
| 2269 | { } /* end */ |
| 2270 | }; |
| 2271 | |
| 2272 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2273 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2274 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2275 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2276 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2277 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2278 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2279 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2280 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2281 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2282 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2283 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2284 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2285 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2286 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2287 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2288 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2289 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2290 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2291 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2292 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2293 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2294 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2295 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2296 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2297 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2298 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2299 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2300 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2301 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2302 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2303 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2304 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2305 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2306 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2307 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2308 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2309 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2310 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2311 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2312 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2313 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2314 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2315 | /* Analog input/passthru */ |
| 2316 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2317 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2318 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2319 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2320 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2321 | { } |
| 2322 | }; |
| 2323 | #endif |
| 2324 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2325 | /* |
| 2326 | */ |
| 2327 | |
| 2328 | static struct hda_board_config alc880_cfg_tbl[] = { |
| 2329 | /* Back 3 jack, front 2 jack */ |
| 2330 | { .modelname = "3stack", .config = ALC880_3ST }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2331 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe200, .config = ALC880_3ST }, |
| 2332 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe201, .config = ALC880_3ST }, |
| 2333 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe202, .config = ALC880_3ST }, |
| 2334 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe203, .config = ALC880_3ST }, |
| 2335 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe204, .config = ALC880_3ST }, |
| 2336 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe205, .config = ALC880_3ST }, |
| 2337 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe206, .config = ALC880_3ST }, |
| 2338 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe207, .config = ALC880_3ST }, |
| 2339 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe208, .config = ALC880_3ST }, |
| 2340 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe209, .config = ALC880_3ST }, |
| 2341 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20a, .config = ALC880_3ST }, |
| 2342 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20b, .config = ALC880_3ST }, |
| 2343 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20c, .config = ALC880_3ST }, |
| 2344 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20d, .config = ALC880_3ST }, |
| 2345 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20e, .config = ALC880_3ST }, |
| 2346 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20f, .config = ALC880_3ST }, |
| 2347 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe210, .config = ALC880_3ST }, |
| 2348 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe211, .config = ALC880_3ST }, |
Tobin Davis | 2aaeee8 | 2006-08-21 19:01:12 +0200 | [diff] [blame] | 2349 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe212, .config = ALC880_3ST }, |
| 2350 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe213, .config = ALC880_3ST }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2351 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe214, .config = ALC880_3ST }, |
Tobin Davis | 2aaeee8 | 2006-08-21 19:01:12 +0200 | [diff] [blame] | 2352 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe234, .config = ALC880_3ST }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2353 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe302, .config = ALC880_3ST }, |
| 2354 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe303, .config = ALC880_3ST }, |
| 2355 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe304, .config = ALC880_3ST }, |
| 2356 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe306, .config = ALC880_3ST }, |
| 2357 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe307, .config = ALC880_3ST }, |
| 2358 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe404, .config = ALC880_3ST }, |
| 2359 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xa101, .config = ALC880_3ST }, |
| 2360 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x3031, .config = ALC880_3ST }, |
| 2361 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4036, .config = ALC880_3ST }, |
| 2362 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4037, .config = ALC880_3ST }, |
| 2363 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4038, .config = ALC880_3ST }, |
| 2364 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4040, .config = ALC880_3ST }, |
| 2365 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4041, .config = ALC880_3ST }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2366 | /* TCL S700 */ |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2367 | { .modelname = "tcl", .config = ALC880_TCL_S700 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2368 | { .pci_subvendor = 0x19db, .pci_subdevice = 0x4188, .config = ALC880_TCL_S700 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2369 | |
| 2370 | /* Back 3 jack, front 2 jack (Internal add Aux-In) */ |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2371 | { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2372 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST }, |
Davide Libenzi | 0ca2161 | 2005-09-05 11:56:47 +0200 | [diff] [blame] | 2373 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81a0, .config = ALC880_3ST }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2374 | |
| 2375 | /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */ |
| 2376 | { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2377 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe308, .config = ALC880_3ST_DIG }, |
Jaroslav Kysela | 5a47fe3c | 2005-08-15 20:01:40 +0200 | [diff] [blame] | 2378 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0070, .config = ALC880_3ST_DIG }, |
Takashi Iwai | 5a053d0 | 2006-07-25 14:51:15 +0200 | [diff] [blame] | 2379 | |
| 2380 | /* Clevo laptops */ |
| 2381 | { .modelname = "clevo", .config = ALC880_CLEVO }, |
| 2382 | { .pci_subvendor = 0x1558, .pci_subdevice = 0x0520, |
| 2383 | .config = ALC880_CLEVO }, /* Clevo m520G NB */ |
| 2384 | { .pci_subvendor = 0x1558, .pci_subdevice = 0x0660, |
| 2385 | .config = ALC880_CLEVO }, /* Clevo m665n */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2386 | |
| 2387 | /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/ |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2388 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe305, .config = ALC880_3ST_DIG }, |
| 2389 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd402, .config = ALC880_3ST_DIG }, |
| 2390 | { .pci_subvendor = 0x1025, .pci_subdevice = 0xe309, .config = ALC880_3ST_DIG }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2391 | |
| 2392 | /* Back 5 jack, front 2 jack */ |
| 2393 | { .modelname = "5stack", .config = ALC880_5ST }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2394 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x3033, .config = ALC880_5ST }, |
| 2395 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4039, .config = ALC880_5ST }, |
| 2396 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x3032, .config = ALC880_5ST }, |
| 2397 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x2a09, .config = ALC880_5ST }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2398 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x814e, .config = ALC880_5ST }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2399 | |
| 2400 | /* Back 5 jack plus 1 SPDIF out jack, front 2 jack */ |
| 2401 | { .modelname = "5stack-digout", .config = ALC880_5ST_DIG }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2402 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe224, .config = ALC880_5ST_DIG }, |
| 2403 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe400, .config = ALC880_5ST_DIG }, |
| 2404 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe401, .config = ALC880_5ST_DIG }, |
| 2405 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe402, .config = ALC880_5ST_DIG }, |
| 2406 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd400, .config = ALC880_5ST_DIG }, |
| 2407 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd401, .config = ALC880_5ST_DIG }, |
| 2408 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xa100, .config = ALC880_5ST_DIG }, |
| 2409 | { .pci_subvendor = 0x1565, .pci_subdevice = 0x8202, .config = ALC880_5ST_DIG }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2410 | { .pci_subvendor = 0x1019, .pci_subdevice = 0xa880, .config = ALC880_5ST_DIG }, |
Takashi Iwai | ede3531 | 2006-03-13 14:21:16 +0100 | [diff] [blame] | 2411 | { .pci_subvendor = 0xa0a0, .pci_subdevice = 0x0560, |
| 2412 | .config = ALC880_5ST_DIG }, /* Aopen i915GMm-HFS */ |
Takashi Iwai | 7a318a7 | 2005-06-28 14:16:21 +0200 | [diff] [blame] | 2413 | /* { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_5ST_DIG }, */ /* conflict with 6stack */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2414 | { .pci_subvendor = 0x1695, .pci_subdevice = 0x400d, .config = ALC880_5ST_DIG }, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2415 | /* note subvendor = 0 below */ |
| 2416 | /* { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG }, */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2417 | |
| 2418 | { .modelname = "w810", .config = ALC880_W810 }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2419 | { .pci_subvendor = 0x161f, .pci_subdevice = 0x203d, .config = ALC880_W810 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2420 | |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2421 | { .modelname = "z71v", .config = ALC880_Z71V }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2422 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_Z71V }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2423 | |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2424 | { .modelname = "6stack", .config = ALC880_6ST }, |
Takashi Iwai | 7632c7b | 2005-12-07 18:25:47 +0100 | [diff] [blame] | 2425 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x8196, .config = ALC880_6ST }, /* ASUS P5GD1-HVM */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2426 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x81b4, .config = ALC880_6ST }, |
Takashi Iwai | 7a318a7 | 2005-06-28 14:16:21 +0200 | [diff] [blame] | 2427 | { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_6ST }, /* Acer APFV */ |
Arnaud Patard | bae2bdb | 2006-01-27 12:05:02 +0100 | [diff] [blame] | 2428 | { .pci_subvendor = 0x1458, .pci_subdevice = 0xa102, .config = ALC880_6ST }, /* Gigabyte K8N51 */ |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2429 | |
| 2430 | { .modelname = "6stack-digout", .config = ALC880_6ST_DIG }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2431 | { .pci_subvendor = 0x2668, .pci_subdevice = 0x8086, .config = ALC880_6ST_DIG }, |
| 2432 | { .pci_subvendor = 0x8086, .pci_subdevice = 0x2668, .config = ALC880_6ST_DIG }, |
| 2433 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x1150, .config = ALC880_6ST_DIG }, |
| 2434 | { .pci_subvendor = 0xe803, .pci_subdevice = 0x1019, .config = ALC880_6ST_DIG }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2435 | { .pci_subvendor = 0x1039, .pci_subdevice = 0x1234, .config = ALC880_6ST_DIG }, |
| 2436 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0077, .config = ALC880_6ST_DIG }, |
| 2437 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0078, .config = ALC880_6ST_DIG }, |
| 2438 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0087, .config = ALC880_6ST_DIG }, |
Takashi Iwai | 041dec0 | 2005-12-23 12:27:52 +0100 | [diff] [blame] | 2439 | { .pci_subvendor = 0x1297, .pci_subdevice = 0xc790, .config = ALC880_6ST_DIG }, /* Shuttle ST20G5 */ |
Takashi Iwai | a12606c | 2006-03-15 18:24:43 +0100 | [diff] [blame] | 2440 | { .pci_subvendor = 0x1509, .pci_subdevice = 0x925d, .config = ALC880_6ST_DIG }, /* FIC P4M-915GD1 */ |
Takashi Iwai | 531213a | 2006-04-18 13:46:08 +0200 | [diff] [blame] | 2441 | { .pci_subvendor = 0x1695, .pci_subdevice = 0x4012, .config = ALC880_5ST_DIG }, /* Epox EP-5LDA+ GLi */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2442 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2443 | { .modelname = "asus", .config = ALC880_ASUS }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2444 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_ASUS_DIG }, |
| 2445 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG }, |
| 2446 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG }, |
| 2447 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG }, |
Takashi Iwai | 8648811 | 2005-09-09 13:56:32 +0200 | [diff] [blame] | 2448 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1173, .config = ALC880_ASUS_DIG }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2449 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS }, |
Danny Tholen | f5a5ffa | 2006-08-08 18:59:07 +0200 | [diff] [blame] | 2450 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c2, .config = ALC880_ASUS_DIG }, /* Asus W6A */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2451 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG }, |
| 2452 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS }, |
| 2453 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1123, .config = ALC880_ASUS_DIG }, |
| 2454 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1143, .config = ALC880_ASUS }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2455 | { .modelname = "asus-w1v", .config = ALC880_ASUS_W1V }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2456 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x10b3, .config = ALC880_ASUS_W1V }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2457 | { .modelname = "asus-dig", .config = ALC880_ASUS_DIG }, |
Takashi Iwai | 84f3430 | 2006-03-21 19:12:53 +0100 | [diff] [blame] | 2458 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x8181, .config = ALC880_ASUS_DIG }, /* ASUS P4GPL-X */ |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2459 | { .modelname = "asus-dig2", .config = ALC880_ASUS_DIG2 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2460 | { .pci_subvendor = 0x1558, .pci_subdevice = 0x5401, .config = ALC880_ASUS_DIG2 }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2461 | |
| 2462 | { .modelname = "uniwill", .config = ALC880_UNIWILL_DIG }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 2463 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9050, .config = ALC880_UNIWILL_DIG }, |
| 2464 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9070, .config = ALC880_UNIWILL }, |
| 2465 | { .pci_subvendor = 0x1734, .pci_subdevice = 0x10ac, .config = ALC880_UNIWILL }, |
| 2466 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9077, .config = ALC880_UNIWILL_P53 }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2467 | |
| 2468 | { .modelname = "F1734", .config = ALC880_F1734 }, |
| 2469 | { .pci_subvendor = 0x1734, .pci_subdevice = 0x107c, .config = ALC880_F1734 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2470 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9054, .config = ALC880_F1734 }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2471 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2472 | { .modelname = "lg", .config = ALC880_LG }, |
| 2473 | { .pci_subvendor = 0x1854, .pci_subdevice = 0x003b, .config = ALC880_LG }, |
Takashi Iwai | 886da86 | 2006-05-02 18:17:57 +0200 | [diff] [blame] | 2474 | { .pci_subvendor = 0x1854, .pci_subdevice = 0x0068, .config = ALC880_LG }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2475 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2476 | { .modelname = "lg-lw", .config = ALC880_LG_LW }, |
| 2477 | { .pci_subvendor = 0x1854, .pci_subdevice = 0x0018, .config = ALC880_LG_LW }, |
Takashi Iwai | cd417d4 | 2006-09-06 16:03:11 +0200 | [diff] [blame] | 2478 | { .pci_subvendor = 0x1854, .pci_subdevice = 0x0077, .config = ALC880_LG_LW }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2479 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2480 | #ifdef CONFIG_SND_DEBUG |
| 2481 | { .modelname = "test", .config = ALC880_TEST }, |
| 2482 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2483 | { .modelname = "auto", .config = ALC880_AUTO }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2484 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2485 | {} |
| 2486 | }; |
| 2487 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2488 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2489 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2490 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2491 | static struct alc_config_preset alc880_presets[] = { |
| 2492 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2493 | .mixers = { alc880_three_stack_mixer }, |
| 2494 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2495 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2496 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2497 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2498 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2499 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2500 | .input_mux = &alc880_capture_source, |
| 2501 | }, |
| 2502 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2503 | .mixers = { alc880_three_stack_mixer }, |
| 2504 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2505 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2506 | .dac_nids = alc880_dac_nids, |
| 2507 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2508 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2509 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2510 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2511 | .input_mux = &alc880_capture_source, |
| 2512 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2513 | [ALC880_TCL_S700] = { |
| 2514 | .mixers = { alc880_tcl_s700_mixer }, |
| 2515 | .init_verbs = { alc880_volume_init_verbs, |
| 2516 | alc880_pin_tcl_S700_init_verbs, |
| 2517 | alc880_gpio2_init_verbs }, |
| 2518 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2519 | .dac_nids = alc880_dac_nids, |
| 2520 | .hp_nid = 0x03, |
| 2521 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2522 | .channel_mode = alc880_2_jack_modes, |
| 2523 | .input_mux = &alc880_capture_source, |
| 2524 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2525 | [ALC880_5ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2526 | .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer}, |
| 2527 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2528 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2529 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2530 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2531 | .channel_mode = alc880_fivestack_modes, |
| 2532 | .input_mux = &alc880_capture_source, |
| 2533 | }, |
| 2534 | [ALC880_5ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2535 | .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer }, |
| 2536 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2537 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2538 | .dac_nids = alc880_dac_nids, |
| 2539 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2540 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2541 | .channel_mode = alc880_fivestack_modes, |
| 2542 | .input_mux = &alc880_capture_source, |
| 2543 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2544 | [ALC880_6ST] = { |
| 2545 | .mixers = { alc880_six_stack_mixer }, |
| 2546 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, |
| 2547 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2548 | .dac_nids = alc880_6st_dac_nids, |
| 2549 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2550 | .channel_mode = alc880_sixstack_modes, |
| 2551 | .input_mux = &alc880_6stack_capture_source, |
| 2552 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2553 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2554 | .mixers = { alc880_six_stack_mixer }, |
| 2555 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2556 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2557 | .dac_nids = alc880_6st_dac_nids, |
| 2558 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2559 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2560 | .channel_mode = alc880_sixstack_modes, |
| 2561 | .input_mux = &alc880_6stack_capture_source, |
| 2562 | }, |
| 2563 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2564 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2565 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_w810_init_verbs, |
| 2566 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2567 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 2568 | .dac_nids = alc880_w810_dac_nids, |
| 2569 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2570 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2571 | .channel_mode = alc880_w810_modes, |
| 2572 | .input_mux = &alc880_capture_source, |
| 2573 | }, |
| 2574 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2575 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2576 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2577 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 2578 | .dac_nids = alc880_z71v_dac_nids, |
| 2579 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2580 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2581 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2582 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2583 | .input_mux = &alc880_capture_source, |
| 2584 | }, |
| 2585 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2586 | .mixers = { alc880_f1734_mixer }, |
| 2587 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_f1734_init_verbs }, |
| 2588 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 2589 | .dac_nids = alc880_f1734_dac_nids, |
| 2590 | .hp_nid = 0x02, |
| 2591 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2592 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2593 | .input_mux = &alc880_capture_source, |
| 2594 | }, |
| 2595 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2596 | .mixers = { alc880_asus_mixer }, |
| 2597 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, |
| 2598 | alc880_gpio1_init_verbs }, |
| 2599 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2600 | .dac_nids = alc880_asus_dac_nids, |
| 2601 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2602 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2603 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2604 | .input_mux = &alc880_capture_source, |
| 2605 | }, |
| 2606 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2607 | .mixers = { alc880_asus_mixer }, |
| 2608 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, |
| 2609 | alc880_gpio1_init_verbs }, |
| 2610 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2611 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2612 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2613 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2614 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2615 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2616 | .input_mux = &alc880_capture_source, |
| 2617 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2618 | [ALC880_ASUS_DIG2] = { |
| 2619 | .mixers = { alc880_asus_mixer }, |
| 2620 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, |
| 2621 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 2622 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2623 | .dac_nids = alc880_asus_dac_nids, |
| 2624 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2625 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2626 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2627 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2628 | .input_mux = &alc880_capture_source, |
| 2629 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2630 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2631 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
| 2632 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, |
| 2633 | alc880_gpio1_init_verbs }, |
| 2634 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2635 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2636 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2637 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2638 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2639 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2640 | .input_mux = &alc880_capture_source, |
| 2641 | }, |
| 2642 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 2643 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 2644 | .init_verbs = { alc880_volume_init_verbs, |
| 2645 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2646 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2647 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2648 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2649 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2650 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2651 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2652 | .input_mux = &alc880_capture_source, |
| 2653 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 2654 | [ALC880_UNIWILL] = { |
| 2655 | .mixers = { alc880_uniwill_mixer }, |
| 2656 | .init_verbs = { alc880_volume_init_verbs, |
| 2657 | alc880_uniwill_init_verbs }, |
| 2658 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2659 | .dac_nids = alc880_asus_dac_nids, |
| 2660 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2661 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2662 | .channel_mode = alc880_threestack_modes, |
| 2663 | .need_dac_fix = 1, |
| 2664 | .input_mux = &alc880_capture_source, |
| 2665 | .unsol_event = alc880_uniwill_unsol_event, |
| 2666 | .init_hook = alc880_uniwill_automute, |
| 2667 | }, |
| 2668 | [ALC880_UNIWILL_P53] = { |
| 2669 | .mixers = { alc880_uniwill_p53_mixer }, |
| 2670 | .init_verbs = { alc880_volume_init_verbs, |
| 2671 | alc880_uniwill_p53_init_verbs }, |
| 2672 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2673 | .dac_nids = alc880_asus_dac_nids, |
| 2674 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2675 | .channel_mode = alc880_w810_modes, |
| 2676 | .input_mux = &alc880_capture_source, |
| 2677 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2678 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2679 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2680 | [ALC880_CLEVO] = { |
| 2681 | .mixers = { alc880_three_stack_mixer }, |
| 2682 | .init_verbs = { alc880_volume_init_verbs, |
| 2683 | alc880_pin_clevo_init_verbs }, |
| 2684 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2685 | .dac_nids = alc880_dac_nids, |
| 2686 | .hp_nid = 0x03, |
| 2687 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2688 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2689 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2690 | .input_mux = &alc880_capture_source, |
| 2691 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2692 | [ALC880_LG] = { |
| 2693 | .mixers = { alc880_lg_mixer }, |
| 2694 | .init_verbs = { alc880_volume_init_verbs, |
| 2695 | alc880_lg_init_verbs }, |
| 2696 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 2697 | .dac_nids = alc880_lg_dac_nids, |
| 2698 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2699 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 2700 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2701 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2702 | .input_mux = &alc880_lg_capture_source, |
| 2703 | .unsol_event = alc880_lg_unsol_event, |
| 2704 | .init_hook = alc880_lg_automute, |
| 2705 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2706 | [ALC880_LG_LW] = { |
| 2707 | .mixers = { alc880_lg_lw_mixer }, |
| 2708 | .init_verbs = { alc880_volume_init_verbs, |
| 2709 | alc880_lg_lw_init_verbs }, |
| 2710 | .num_dacs = 1, |
| 2711 | .dac_nids = alc880_dac_nids, |
| 2712 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2713 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2714 | .channel_mode = alc880_2_jack_modes, |
| 2715 | .input_mux = &alc880_lg_lw_capture_source, |
| 2716 | .unsol_event = alc880_lg_lw_unsol_event, |
| 2717 | .init_hook = alc880_lg_lw_automute, |
| 2718 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2719 | #ifdef CONFIG_SND_DEBUG |
| 2720 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2721 | .mixers = { alc880_test_mixer }, |
| 2722 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2723 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 2724 | .dac_nids = alc880_test_dac_nids, |
| 2725 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2726 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 2727 | .channel_mode = alc880_test_modes, |
| 2728 | .input_mux = &alc880_test_capture_source, |
| 2729 | }, |
| 2730 | #endif |
| 2731 | }; |
| 2732 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2733 | /* |
| 2734 | * Automatic parse of I/O pins from the BIOS configuration |
| 2735 | */ |
| 2736 | |
| 2737 | #define NUM_CONTROL_ALLOC 32 |
| 2738 | #define NUM_VERB_ALLOC 32 |
| 2739 | |
| 2740 | enum { |
| 2741 | ALC_CTL_WIDGET_VOL, |
| 2742 | ALC_CTL_WIDGET_MUTE, |
| 2743 | ALC_CTL_BIND_MUTE, |
| 2744 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2745 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2746 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2747 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2748 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2749 | }; |
| 2750 | |
| 2751 | /* add dynamic controls */ |
| 2752 | static int add_control(struct alc_spec *spec, int type, const char *name, unsigned long val) |
| 2753 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2754 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2755 | |
| 2756 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 2757 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 2758 | |
| 2759 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ |
| 2760 | if (! knew) |
| 2761 | return -ENOMEM; |
| 2762 | if (spec->kctl_alloc) { |
| 2763 | memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); |
| 2764 | kfree(spec->kctl_alloc); |
| 2765 | } |
| 2766 | spec->kctl_alloc = knew; |
| 2767 | spec->num_kctl_alloc = num; |
| 2768 | } |
| 2769 | |
| 2770 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 2771 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 2772 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2773 | if (! knew->name) |
| 2774 | return -ENOMEM; |
| 2775 | knew->private_value = val; |
| 2776 | spec->num_kctl_used++; |
| 2777 | return 0; |
| 2778 | } |
| 2779 | |
| 2780 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 2781 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 2782 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 2783 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 2784 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 2785 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 2786 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 2787 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 2788 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 2789 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 2790 | #define ALC880_PIN_CD_NID 0x1c |
| 2791 | |
| 2792 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 2793 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pin_cfg *cfg) |
| 2794 | { |
| 2795 | hda_nid_t nid; |
| 2796 | int assigned[4]; |
| 2797 | int i, j; |
| 2798 | |
| 2799 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2800 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2801 | |
| 2802 | /* check the pins hardwired to audio widget */ |
| 2803 | for (i = 0; i < cfg->line_outs; i++) { |
| 2804 | nid = cfg->line_out_pins[i]; |
| 2805 | if (alc880_is_fixed_pin(nid)) { |
| 2806 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 2807 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2808 | assigned[idx] = 1; |
| 2809 | } |
| 2810 | } |
| 2811 | /* left pins can be connect to any audio widget */ |
| 2812 | for (i = 0; i < cfg->line_outs; i++) { |
| 2813 | nid = cfg->line_out_pins[i]; |
| 2814 | if (alc880_is_fixed_pin(nid)) |
| 2815 | continue; |
| 2816 | /* search for an empty channel */ |
| 2817 | for (j = 0; j < cfg->line_outs; j++) { |
| 2818 | if (! assigned[j]) { |
| 2819 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(j); |
| 2820 | assigned[j] = 1; |
| 2821 | break; |
| 2822 | } |
| 2823 | } |
| 2824 | } |
| 2825 | spec->multiout.num_dacs = cfg->line_outs; |
| 2826 | return 0; |
| 2827 | } |
| 2828 | |
| 2829 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2830 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 2831 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2832 | { |
| 2833 | char name[32]; |
| 2834 | static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; |
| 2835 | hda_nid_t nid; |
| 2836 | int i, err; |
| 2837 | |
| 2838 | for (i = 0; i < cfg->line_outs; i++) { |
| 2839 | if (! spec->multiout.dac_nids[i]) |
| 2840 | continue; |
| 2841 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 2842 | if (i == 2) { |
| 2843 | /* Center/LFE */ |
| 2844 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Center Playback Volume", |
| 2845 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) |
| 2846 | return err; |
| 2847 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "LFE Playback Volume", |
| 2848 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 2849 | return err; |
| 2850 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "Center Playback Switch", |
| 2851 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, HDA_INPUT))) < 0) |
| 2852 | return err; |
| 2853 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "LFE Playback Switch", |
| 2854 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, HDA_INPUT))) < 0) |
| 2855 | return err; |
| 2856 | } else { |
| 2857 | sprintf(name, "%s Playback Volume", chname[i]); |
| 2858 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 2859 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 2860 | return err; |
| 2861 | sprintf(name, "%s Playback Switch", chname[i]); |
| 2862 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 2863 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0) |
| 2864 | return err; |
| 2865 | } |
| 2866 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2867 | return 0; |
| 2868 | } |
| 2869 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2870 | /* add playback controls for speaker and HP outputs */ |
| 2871 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 2872 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2873 | { |
| 2874 | hda_nid_t nid; |
| 2875 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2876 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2877 | |
| 2878 | if (! pin) |
| 2879 | return 0; |
| 2880 | |
| 2881 | if (alc880_is_fixed_pin(pin)) { |
| 2882 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2883 | /* specify the DAC as the extra output */ |
| 2884 | if (! spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2885 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2886 | else |
| 2887 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2888 | /* control HP volume/switch on the output mixer amp */ |
| 2889 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2890 | sprintf(name, "%s Playback Volume", pfx); |
| 2891 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2892 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 2893 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2894 | sprintf(name, "%s Playback Switch", pfx); |
| 2895 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2896 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0) |
| 2897 | return err; |
| 2898 | } else if (alc880_is_multi_pin(pin)) { |
| 2899 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2900 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2901 | sprintf(name, "%s Playback Switch", pfx); |
| 2902 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2903 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT))) < 0) |
| 2904 | return err; |
| 2905 | } |
| 2906 | return 0; |
| 2907 | } |
| 2908 | |
| 2909 | /* create input playback/capture controls for the given pin */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2910 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, const char *ctlname, |
| 2911 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2912 | { |
| 2913 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2914 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2915 | |
| 2916 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2917 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2918 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT))) < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2919 | return err; |
| 2920 | sprintf(name, "%s Playback Switch", ctlname); |
| 2921 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2922 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT))) < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2923 | return err; |
| 2924 | return 0; |
| 2925 | } |
| 2926 | |
| 2927 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2928 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 2929 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2930 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2931 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2932 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2933 | |
| 2934 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 2935 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2936 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2937 | err = new_analog_input(spec, cfg->input_pins[i], |
| 2938 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2939 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2940 | if (err < 0) |
| 2941 | return err; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2942 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2943 | imux->items[imux->num_items].index = alc880_input_pin_idx(cfg->input_pins[i]); |
| 2944 | imux->num_items++; |
| 2945 | } |
| 2946 | } |
| 2947 | return 0; |
| 2948 | } |
| 2949 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2950 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 2951 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2952 | int dac_idx) |
| 2953 | { |
| 2954 | /* set as output */ |
| 2955 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 2956 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 2957 | /* need the manual connection? */ |
| 2958 | if (alc880_is_multi_pin(nid)) { |
| 2959 | struct alc_spec *spec = codec->spec; |
| 2960 | int idx = alc880_multi_pin_idx(nid); |
| 2961 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 2962 | AC_VERB_SET_CONNECT_SEL, |
| 2963 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 2964 | } |
| 2965 | } |
| 2966 | |
| 2967 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 2968 | { |
| 2969 | struct alc_spec *spec = codec->spec; |
| 2970 | int i; |
| 2971 | |
| 2972 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 2973 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 2974 | alc880_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); |
| 2975 | } |
| 2976 | } |
| 2977 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2978 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2979 | { |
| 2980 | struct alc_spec *spec = codec->spec; |
| 2981 | hda_nid_t pin; |
| 2982 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2983 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2984 | if (pin) /* connect to front */ |
| 2985 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2986 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2987 | if (pin) /* connect to front */ |
| 2988 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 2989 | } |
| 2990 | |
| 2991 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 2992 | { |
| 2993 | struct alc_spec *spec = codec->spec; |
| 2994 | int i; |
| 2995 | |
| 2996 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 2997 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 2998 | if (alc880_is_input_pin(nid)) { |
| 2999 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3000 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); |
| 3001 | if (nid != ALC880_PIN_CD_NID) |
| 3002 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3003 | AMP_OUT_MUTE); |
| 3004 | } |
| 3005 | } |
| 3006 | } |
| 3007 | |
| 3008 | /* parse the BIOS configuration and set up the alc_spec */ |
| 3009 | /* return 1 if successful, 0 if the proper config is not found, or a negative error code */ |
| 3010 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3011 | { |
| 3012 | struct alc_spec *spec = codec->spec; |
| 3013 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3014 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3015 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3016 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3017 | alc880_ignore)) < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3018 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3019 | if (! spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3020 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3021 | |
| 3022 | if ((err = alc880_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || |
| 3023 | (err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3024 | (err = alc880_auto_create_extra_out(spec, |
| 3025 | spec->autocfg.speaker_pins[0], |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3026 | "Speaker")) < 0 || |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3027 | (err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3028 | "Headphone")) < 0 || |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3029 | (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
| 3030 | return err; |
| 3031 | |
| 3032 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3033 | |
| 3034 | if (spec->autocfg.dig_out_pin) |
| 3035 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3036 | if (spec->autocfg.dig_in_pin) |
| 3037 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3038 | |
| 3039 | if (spec->kctl_alloc) |
| 3040 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3041 | |
| 3042 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3043 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3044 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3045 | spec->input_mux = &spec->private_imux; |
| 3046 | |
| 3047 | return 1; |
| 3048 | } |
| 3049 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3050 | /* additional initialization for auto-configuration model */ |
| 3051 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3052 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3053 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3054 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3055 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3056 | } |
| 3057 | |
| 3058 | /* |
| 3059 | * OK, here we have finally the patch for ALC880 |
| 3060 | */ |
| 3061 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3062 | static int patch_alc880(struct hda_codec *codec) |
| 3063 | { |
| 3064 | struct alc_spec *spec; |
| 3065 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3066 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3067 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3068 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3069 | if (spec == NULL) |
| 3070 | return -ENOMEM; |
| 3071 | |
| 3072 | codec->spec = spec; |
| 3073 | |
| 3074 | board_config = snd_hda_check_board_config(codec, alc880_cfg_tbl); |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3075 | if (board_config < 0 || board_config >= ALC880_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3076 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3077 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3078 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3079 | } |
| 3080 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3081 | if (board_config == ALC880_AUTO) { |
| 3082 | /* automatic parse from the BIOS config */ |
| 3083 | err = alc880_parse_auto_config(codec); |
| 3084 | if (err < 0) { |
| 3085 | alc_free(codec); |
| 3086 | return err; |
| 3087 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3088 | printk(KERN_INFO |
| 3089 | "hda_codec: Cannot set up configuration " |
| 3090 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3091 | board_config = ALC880_3ST; |
| 3092 | } |
| 3093 | } |
| 3094 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3095 | if (board_config != ALC880_AUTO) |
| 3096 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3097 | |
| 3098 | spec->stream_name_analog = "ALC880 Analog"; |
| 3099 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3100 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3101 | |
| 3102 | spec->stream_name_digital = "ALC880 Digital"; |
| 3103 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3104 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3105 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3106 | if (! spec->adc_nids && spec->input_mux) { |
| 3107 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3108 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3109 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 3110 | if (wcap != AC_WID_AUD_IN) { |
| 3111 | spec->adc_nids = alc880_adc_nids_alt; |
| 3112 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
| 3113 | spec->mixers[spec->num_mixers] = alc880_capture_alt_mixer; |
| 3114 | spec->num_mixers++; |
| 3115 | } else { |
| 3116 | spec->adc_nids = alc880_adc_nids; |
| 3117 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3118 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3119 | spec->num_mixers++; |
| 3120 | } |
| 3121 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3122 | |
| 3123 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3124 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3125 | spec->init_hook = alc880_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3126 | |
| 3127 | return 0; |
| 3128 | } |
| 3129 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3130 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3131 | /* |
| 3132 | * ALC260 support |
| 3133 | */ |
| 3134 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3135 | static hda_nid_t alc260_dac_nids[1] = { |
| 3136 | /* front */ |
| 3137 | 0x02, |
| 3138 | }; |
| 3139 | |
| 3140 | static hda_nid_t alc260_adc_nids[1] = { |
| 3141 | /* ADC0 */ |
| 3142 | 0x04, |
| 3143 | }; |
| 3144 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3145 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | /* ADC1 */ |
| 3147 | 0x05, |
| 3148 | }; |
| 3149 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3150 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3151 | /* ADC1, 0 */ |
| 3152 | 0x05, 0x04 |
| 3153 | }; |
| 3154 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3155 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3156 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3157 | */ |
| 3158 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3159 | /* ADC0, ADC1 */ |
| 3160 | 0x04, 0x05 |
| 3161 | }; |
| 3162 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3163 | #define ALC260_DIGOUT_NID 0x03 |
| 3164 | #define ALC260_DIGIN_NID 0x06 |
| 3165 | |
| 3166 | static struct hda_input_mux alc260_capture_source = { |
| 3167 | .num_items = 4, |
| 3168 | .items = { |
| 3169 | { "Mic", 0x0 }, |
| 3170 | { "Front Mic", 0x1 }, |
| 3171 | { "Line", 0x2 }, |
| 3172 | { "CD", 0x4 }, |
| 3173 | }, |
| 3174 | }; |
| 3175 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3176 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3177 | * headphone jack and the internal CD lines since these are the only pins at |
| 3178 | * which audio can appear. For flexibility, also allow the option of |
| 3179 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3180 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3181 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3182 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3183 | { |
| 3184 | .num_items = 3, |
| 3185 | .items = { |
| 3186 | { "Mic/Line", 0x0 }, |
| 3187 | { "CD", 0x4 }, |
| 3188 | { "Headphone", 0x2 }, |
| 3189 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3190 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3191 | { |
| 3192 | .num_items = 4, |
| 3193 | .items = { |
| 3194 | { "Mic/Line", 0x0 }, |
| 3195 | { "CD", 0x4 }, |
| 3196 | { "Headphone", 0x2 }, |
| 3197 | { "Mixer", 0x5 }, |
| 3198 | }, |
| 3199 | }, |
| 3200 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3201 | }; |
| 3202 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3203 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3204 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3205 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3206 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3207 | { |
| 3208 | .num_items = 4, |
| 3209 | .items = { |
| 3210 | { "Mic", 0x0 }, |
| 3211 | { "Line", 0x2 }, |
| 3212 | { "CD", 0x4 }, |
| 3213 | { "Headphone", 0x5 }, |
| 3214 | }, |
| 3215 | }, |
| 3216 | { |
| 3217 | .num_items = 5, |
| 3218 | .items = { |
| 3219 | { "Mic", 0x0 }, |
| 3220 | { "Line", 0x2 }, |
| 3221 | { "CD", 0x4 }, |
| 3222 | { "Headphone", 0x6 }, |
| 3223 | { "Mixer", 0x5 }, |
| 3224 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3225 | }, |
| 3226 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3227 | /* |
| 3228 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3229 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3230 | * element which allows changing the channel mode, so the verb list is |
| 3231 | * never used. |
| 3232 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3233 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3234 | { 2, NULL }, |
| 3235 | }; |
| 3236 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3237 | |
| 3238 | /* Mixer combinations |
| 3239 | * |
| 3240 | * basic: base_output + input + pc_beep + capture |
| 3241 | * HP: base_output + input + capture_alt |
| 3242 | * HP_3013: hp_3013 + input + capture |
| 3243 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3244 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3245 | */ |
| 3246 | |
| 3247 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3248 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3249 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3250 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3251 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3252 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3253 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3254 | { } /* end */ |
| 3255 | }; |
| 3256 | |
| 3257 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3258 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3259 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3260 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3261 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3263 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3264 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3265 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3266 | { } /* end */ |
| 3267 | }; |
| 3268 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3269 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3270 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3271 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3272 | { } /* end */ |
| 3273 | }; |
| 3274 | |
| 3275 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3276 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3277 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3278 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3279 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3280 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3281 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3282 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3283 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3284 | { } /* end */ |
| 3285 | }; |
| 3286 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3287 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3288 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3289 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3290 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3291 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3292 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3293 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3294 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3295 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3296 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3297 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3298 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3299 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3300 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3301 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3302 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3303 | { } /* end */ |
| 3304 | }; |
| 3305 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3306 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3307 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3308 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3309 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3310 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3311 | * revisions available in early 2006. Therefore for now allow the |
| 3312 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3313 | * that the lack of mic bias for this NID is intentional we could change the |
| 3314 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3315 | * |
| 3316 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3317 | * don't appear to make the mic bias available from the "line" jack, even |
| 3318 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3319 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3320 | * and the output jack. If this turns out to be the case for all such |
| 3321 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3322 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3323 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3324 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3325 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3326 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3327 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3328 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3329 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3330 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3331 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3332 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3333 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3334 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3335 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3336 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3337 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3338 | { } /* end */ |
| 3339 | }; |
| 3340 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3341 | /* capture mixer elements */ |
| 3342 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3343 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3344 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3345 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3346 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3347 | { |
| 3348 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3349 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3350 | * So call somewhat different.. |
| 3351 | * FIXME: the controls appear in the "playback" view! |
| 3352 | */ |
| 3353 | /* .name = "Capture Source", */ |
| 3354 | .name = "Input Source", |
| 3355 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3356 | .info = alc_mux_enum_info, |
| 3357 | .get = alc_mux_enum_get, |
| 3358 | .put = alc_mux_enum_put, |
| 3359 | }, |
| 3360 | { } /* end */ |
| 3361 | }; |
| 3362 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3363 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3364 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3365 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3366 | { |
| 3367 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3368 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3369 | * So call somewhat different.. |
| 3370 | * FIXME: the controls appear in the "playback" view! |
| 3371 | */ |
| 3372 | /* .name = "Capture Source", */ |
| 3373 | .name = "Input Source", |
| 3374 | .count = 1, |
| 3375 | .info = alc_mux_enum_info, |
| 3376 | .get = alc_mux_enum_get, |
| 3377 | .put = alc_mux_enum_put, |
| 3378 | }, |
| 3379 | { } /* end */ |
| 3380 | }; |
| 3381 | |
| 3382 | /* |
| 3383 | * initialization verbs |
| 3384 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3385 | static struct hda_verb alc260_init_verbs[] = { |
| 3386 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3387 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3388 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3389 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3390 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3391 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3392 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3393 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3394 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3396 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3397 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3398 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3399 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3400 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3401 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3402 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3403 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3404 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3405 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3406 | /* set connection select to line in (default select for this ADC) */ |
| 3407 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3408 | /* mute capture amp left and right */ |
| 3409 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3410 | /* set connection select to line in (default select for this ADC) */ |
| 3411 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3412 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3413 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3414 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3415 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3416 | /* set vol=0 HP mixer amp left and right */ |
| 3417 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3418 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3419 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3420 | /* set vol=0 Mono mixer amp left and right */ |
| 3421 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3422 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3423 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3424 | /* unmute LINE-2 out pin */ |
| 3425 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3426 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3427 | /* mute CD */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3428 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3429 | /* mute Line In */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3430 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3431 | /* mute Mic */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3432 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3433 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3434 | /* mute Front out path */ |
| 3435 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3436 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3437 | /* mute Headphone out path */ |
| 3438 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3439 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3440 | /* mute Mono out path */ |
| 3441 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3442 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3443 | { } |
| 3444 | }; |
| 3445 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3446 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3447 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 3448 | /* Headphone and output */ |
| 3449 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3450 | /* mono output */ |
| 3451 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3452 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3453 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3454 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3455 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3456 | /* Line In pin widget for input */ |
| 3457 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3458 | /* Line-2 pin widget for output */ |
| 3459 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3460 | /* CD pin widget for input */ |
| 3461 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3462 | /* unmute amp left and right */ |
| 3463 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3464 | /* set connection select to line in (default select for this ADC) */ |
| 3465 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3466 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3467 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3468 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3470 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3471 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3472 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3473 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3474 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ |
| 3475 | /* unmute CD */ |
| 3476 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3477 | /* unmute Line In */ |
| 3478 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3479 | /* unmute Mic */ |
| 3480 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3481 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3482 | /* Unmute Front out path */ |
| 3483 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3484 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3485 | /* Unmute Headphone out path */ |
| 3486 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3487 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3488 | /* Unmute Mono out path */ |
| 3489 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3490 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3491 | { } |
| 3492 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3493 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3494 | |
| 3495 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 3496 | /* Line out and output */ |
| 3497 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3498 | /* mono output */ |
| 3499 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3500 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3501 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3502 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3503 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3504 | /* Line In pin widget for input */ |
| 3505 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3506 | /* Headphone pin widget for output */ |
| 3507 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3508 | /* CD pin widget for input */ |
| 3509 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3510 | /* unmute amp left and right */ |
| 3511 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3512 | /* set connection select to line in (default select for this ADC) */ |
| 3513 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3514 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3516 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3517 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3518 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3519 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3520 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3521 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3522 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ |
| 3523 | /* unmute CD */ |
| 3524 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3525 | /* unmute Line In */ |
| 3526 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3527 | /* unmute Mic */ |
| 3528 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3529 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3530 | /* Unmute Front out path */ |
| 3531 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3532 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3533 | /* Unmute Headphone out path */ |
| 3534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3535 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3536 | /* Unmute Mono out path */ |
| 3537 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3538 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3539 | { } |
| 3540 | }; |
| 3541 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3542 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3543 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 3544 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3545 | */ |
| 3546 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 3547 | /* Disable all GPIOs */ |
| 3548 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 3549 | /* Internal speaker is connected to headphone pin */ |
| 3550 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3551 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 3552 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3553 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 3554 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3555 | /* Ensure all other unused pins are disabled and muted. */ |
| 3556 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3557 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3558 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3559 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3560 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3561 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3562 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3563 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3564 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3565 | /* Disable digital (SPDIF) pins */ |
| 3566 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3567 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3568 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3569 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 3570 | * when acting as an output. |
| 3571 | */ |
| 3572 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3573 | |
| 3574 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 3575 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3576 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3577 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3578 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3579 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3580 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3581 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3582 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3583 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3584 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3585 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 3586 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3587 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 3588 | * If the pin mode is changed by the user the pin mode control will |
| 3589 | * take care of enabling the pin's input/output buffers as needed. |
| 3590 | * Therefore there's no need to enable the input buffer at this |
| 3591 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3592 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3593 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3594 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 3595 | * mixer ctrl) |
| 3596 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3597 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3598 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3599 | /* Mute capture amp left and right */ |
| 3600 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3601 | /* Set ADC connection select to match default mixer setting - line |
| 3602 | * in (on mic1 pin) |
| 3603 | */ |
| 3604 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3605 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3606 | /* Do the same for the second ADC: mute capture input amp and |
| 3607 | * set ADC connection to line in (on mic1 pin) |
| 3608 | */ |
| 3609 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3610 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3611 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3612 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3614 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3615 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3616 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3617 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3618 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3619 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3620 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3621 | |
| 3622 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3623 | }; |
| 3624 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3625 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 3626 | * similar laptops (adapted from Fujitsu init verbs). |
| 3627 | */ |
| 3628 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 3629 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 3630 | * the headphone jack. Turn this on and rely on the standard mute |
| 3631 | * methods whenever the user wants to turn these outputs off. |
| 3632 | */ |
| 3633 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 3634 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3635 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 3636 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 3637 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3638 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 3639 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 3640 | /* Line In jack is connected to Line1 pin */ |
| 3641 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3642 | /* Ensure all other unused pins are disabled and muted. */ |
| 3643 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3644 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3645 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3646 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3647 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3648 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3649 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3651 | /* Disable digital (SPDIF) pins */ |
| 3652 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3653 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3654 | |
| 3655 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 3656 | * bus when acting as outputs. |
| 3657 | */ |
| 3658 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3659 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3660 | |
| 3661 | /* Start with output sum widgets muted and their output gains at min */ |
| 3662 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3663 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3664 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3665 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3666 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3667 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3668 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3669 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3670 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3671 | |
| 3672 | /* Unmute Line-out pin widget amp left and right (no equiv mixer ctrl) */ |
| 3673 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3674 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 3675 | * inputs. If the pin mode is changed by the user the pin mode control |
| 3676 | * will take care of enabling the pin's input/output buffers as needed. |
| 3677 | * Therefore there's no need to enable the input buffer at this |
| 3678 | * stage. |
| 3679 | */ |
| 3680 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3681 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3682 | |
| 3683 | /* Mute capture amp left and right */ |
| 3684 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3685 | /* Set ADC connection select to match default mixer setting - mic |
| 3686 | * (on mic1 pin) |
| 3687 | */ |
| 3688 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3689 | |
| 3690 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3691 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3692 | */ |
| 3693 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3694 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3695 | |
| 3696 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3700 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3701 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3702 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3704 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 3705 | |
| 3706 | { } |
| 3707 | }; |
| 3708 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3709 | /* Test configuration for debugging, modelled after the ALC880 test |
| 3710 | * configuration. |
| 3711 | */ |
| 3712 | #ifdef CONFIG_SND_DEBUG |
| 3713 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 3714 | 0x02, |
| 3715 | }; |
| 3716 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 3717 | 0x04, 0x05, |
| 3718 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3719 | /* For testing the ALC260, each input MUX needs its own definition since |
| 3720 | * the signal assignments are different. This assumes that the first ADC |
| 3721 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3722 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3723 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 3724 | { |
| 3725 | .num_items = 7, |
| 3726 | .items = { |
| 3727 | { "MIC1 pin", 0x0 }, |
| 3728 | { "MIC2 pin", 0x1 }, |
| 3729 | { "LINE1 pin", 0x2 }, |
| 3730 | { "LINE2 pin", 0x3 }, |
| 3731 | { "CD pin", 0x4 }, |
| 3732 | { "LINE-OUT pin", 0x5 }, |
| 3733 | { "HP-OUT pin", 0x6 }, |
| 3734 | }, |
| 3735 | }, |
| 3736 | { |
| 3737 | .num_items = 8, |
| 3738 | .items = { |
| 3739 | { "MIC1 pin", 0x0 }, |
| 3740 | { "MIC2 pin", 0x1 }, |
| 3741 | { "LINE1 pin", 0x2 }, |
| 3742 | { "LINE2 pin", 0x3 }, |
| 3743 | { "CD pin", 0x4 }, |
| 3744 | { "Mixer", 0x5 }, |
| 3745 | { "LINE-OUT pin", 0x6 }, |
| 3746 | { "HP-OUT pin", 0x7 }, |
| 3747 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3748 | }, |
| 3749 | }; |
| 3750 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 3751 | /* Output driver widgets */ |
| 3752 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3753 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3754 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3755 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 3756 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3757 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 3758 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3759 | /* Modes for retasking pin widgets |
| 3760 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 3761 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 3762 | * mention this restriction. At this stage it's not clear whether |
| 3763 | * this behaviour is intentional or is a hardware bug in chip |
| 3764 | * revisions available at least up until early 2006. Therefore for |
| 3765 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 3766 | * choices, but if it turns out that the lack of mic bias for these |
| 3767 | * NIDs is intentional we could change their modes from |
| 3768 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3769 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3770 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 3771 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 3772 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 3773 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3774 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 3775 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 3776 | |
| 3777 | /* Loopback mixer controls */ |
| 3778 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 3779 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 3780 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3781 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 3782 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3783 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3784 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 3785 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 3786 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3787 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3788 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3789 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3790 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3791 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3792 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 3793 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 3794 | |
| 3795 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 3796 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 3797 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 3798 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 3799 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 3800 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 3801 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 3802 | * is ambigious as to which NID is which; testing on laptops which |
| 3803 | * make this output available should provide clarification. |
| 3804 | */ |
| 3805 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 3806 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 3807 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3808 | { } /* end */ |
| 3809 | }; |
| 3810 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 3811 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 3812 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 3813 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 3814 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 3815 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3816 | /* Enable retasking pins as output, initially without power amp */ |
| 3817 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3818 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3819 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3820 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3821 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3822 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3823 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 3824 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 3825 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 3826 | * payload also sets the generation to 0, output to be in "consumer" |
| 3827 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 3828 | * control. |
| 3829 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3830 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3831 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3832 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3833 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3834 | * OUT1 sum bus when acting as an output. |
| 3835 | */ |
| 3836 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3837 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3838 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3839 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3840 | |
| 3841 | /* Start with output sum widgets muted and their output gains at min */ |
| 3842 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3843 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3844 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3845 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3846 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3847 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3848 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3849 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3850 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3851 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3852 | /* Unmute retasking pin widget output buffers since the default |
| 3853 | * state appears to be output. As the pin mode is changed by the |
| 3854 | * user the pin mode control will take care of enabling the pin's |
| 3855 | * input/output buffers as needed. |
| 3856 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3857 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3858 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3859 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3860 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3861 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3862 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3863 | /* Also unmute the mono-out pin widget */ |
| 3864 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3865 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3866 | /* Mute capture amp left and right */ |
| 3867 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3868 | /* Set ADC connection select to match default mixer setting (mic1 |
| 3869 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3870 | */ |
| 3871 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3872 | |
| 3873 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3874 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3875 | */ |
| 3876 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3877 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3878 | |
| 3879 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3880 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3881 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3882 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3883 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3884 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3885 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3886 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3887 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 3888 | |
| 3889 | { } |
| 3890 | }; |
| 3891 | #endif |
| 3892 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3893 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 3894 | .substreams = 1, |
| 3895 | .channels_min = 2, |
| 3896 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3897 | }; |
| 3898 | |
| 3899 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 3900 | .substreams = 1, |
| 3901 | .channels_min = 2, |
| 3902 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3903 | }; |
| 3904 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 3905 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 3906 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 3907 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3908 | /* |
| 3909 | * for BIOS auto-configuration |
| 3910 | */ |
| 3911 | |
| 3912 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 3913 | const char *pfx) |
| 3914 | { |
| 3915 | hda_nid_t nid_vol; |
| 3916 | unsigned long vol_val, sw_val; |
| 3917 | char name[32]; |
| 3918 | int err; |
| 3919 | |
| 3920 | if (nid >= 0x0f && nid < 0x11) { |
| 3921 | nid_vol = nid - 0x7; |
| 3922 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 3923 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 3924 | } else if (nid == 0x11) { |
| 3925 | nid_vol = nid - 0x7; |
| 3926 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 3927 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 3928 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 3929 | nid_vol = 0x08; |
| 3930 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 3931 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 3932 | } else |
| 3933 | return 0; /* N/A */ |
| 3934 | |
| 3935 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 3936 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val)) < 0) |
| 3937 | return err; |
| 3938 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 3939 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val)) < 0) |
| 3940 | return err; |
| 3941 | return 1; |
| 3942 | } |
| 3943 | |
| 3944 | /* add playback controls from the parsed DAC table */ |
| 3945 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3946 | const struct auto_pin_cfg *cfg) |
| 3947 | { |
| 3948 | hda_nid_t nid; |
| 3949 | int err; |
| 3950 | |
| 3951 | spec->multiout.num_dacs = 1; |
| 3952 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 3953 | spec->multiout.dac_nids[0] = 0x02; |
| 3954 | |
| 3955 | nid = cfg->line_out_pins[0]; |
| 3956 | if (nid) { |
| 3957 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 3958 | if (err < 0) |
| 3959 | return err; |
| 3960 | } |
| 3961 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3962 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3963 | if (nid) { |
| 3964 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 3965 | if (err < 0) |
| 3966 | return err; |
| 3967 | } |
| 3968 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3969 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3970 | if (nid) { |
| 3971 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 3972 | if (err < 0) |
| 3973 | return err; |
| 3974 | } |
| 3975 | return 0; |
| 3976 | } |
| 3977 | |
| 3978 | /* create playback/capture controls for input pins */ |
| 3979 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3980 | const struct auto_pin_cfg *cfg) |
| 3981 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3982 | struct hda_input_mux *imux = &spec->private_imux; |
| 3983 | int i, err, idx; |
| 3984 | |
| 3985 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3986 | if (cfg->input_pins[i] >= 0x12) { |
| 3987 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3988 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3989 | auto_pin_cfg_labels[i], idx, 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3990 | if (err < 0) |
| 3991 | return err; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3992 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3993 | imux->items[imux->num_items].index = idx; |
| 3994 | imux->num_items++; |
| 3995 | } |
| 3996 | if ((cfg->input_pins[i] >= 0x0f) && (cfg->input_pins[i] <= 0x10)){ |
| 3997 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3998 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3999 | auto_pin_cfg_labels[i], idx, 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4000 | if (err < 0) |
| 4001 | return err; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4002 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4003 | imux->items[imux->num_items].index = idx; |
| 4004 | imux->num_items++; |
| 4005 | } |
| 4006 | } |
| 4007 | return 0; |
| 4008 | } |
| 4009 | |
| 4010 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4011 | hda_nid_t nid, int pin_type, |
| 4012 | int sel_idx) |
| 4013 | { |
| 4014 | /* set as output */ |
| 4015 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 4016 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 4017 | /* need the manual connection? */ |
| 4018 | if (nid >= 0x12) { |
| 4019 | int idx = nid - 0x12; |
| 4020 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4021 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
| 4022 | |
| 4023 | } |
| 4024 | } |
| 4025 | |
| 4026 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4027 | { |
| 4028 | struct alc_spec *spec = codec->spec; |
| 4029 | hda_nid_t nid; |
| 4030 | |
| 4031 | nid = spec->autocfg.line_out_pins[0]; |
| 4032 | if (nid) |
| 4033 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4034 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4035 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4036 | if (nid) |
| 4037 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4038 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4039 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4040 | if (nid) |
| 4041 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4042 | } |
| 4043 | |
| 4044 | #define ALC260_PIN_CD_NID 0x16 |
| 4045 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4046 | { |
| 4047 | struct alc_spec *spec = codec->spec; |
| 4048 | int i; |
| 4049 | |
| 4050 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4051 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4052 | if (nid >= 0x12) { |
| 4053 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4054 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); |
| 4055 | if (nid != ALC260_PIN_CD_NID) |
| 4056 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4057 | AMP_OUT_MUTE); |
| 4058 | } |
| 4059 | } |
| 4060 | } |
| 4061 | |
| 4062 | /* |
| 4063 | * generic initialization of ADC, input mixers and output mixers |
| 4064 | */ |
| 4065 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4066 | /* |
| 4067 | * Unmute ADC0-1 and set the default input to mic-in |
| 4068 | */ |
| 4069 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4070 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4071 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4072 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4073 | |
| 4074 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4075 | * mixer widget |
| 4076 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 4077 | * mic (mic 2) |
| 4078 | */ |
| 4079 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 4080 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4081 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4082 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 4083 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 4084 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 4085 | |
| 4086 | /* |
| 4087 | * Set up output mixers (0x08 - 0x0a) |
| 4088 | */ |
| 4089 | /* set vol=0 to output mixers */ |
| 4090 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4091 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4092 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4093 | /* set up input amps for analog loopback */ |
| 4094 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4095 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4096 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4097 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4098 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4099 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4100 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4101 | |
| 4102 | { } |
| 4103 | }; |
| 4104 | |
| 4105 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4106 | { |
| 4107 | struct alc_spec *spec = codec->spec; |
| 4108 | unsigned int wcap; |
| 4109 | int err; |
| 4110 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4111 | |
| 4112 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4113 | alc260_ignore)) < 0) |
| 4114 | return err; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4115 | if ((err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0) |
| 4116 | return err; |
| 4117 | if (! spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4118 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4119 | if ((err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4120 | return err; |
| 4121 | |
| 4122 | spec->multiout.max_channels = 2; |
| 4123 | |
| 4124 | if (spec->autocfg.dig_out_pin) |
| 4125 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4126 | if (spec->kctl_alloc) |
| 4127 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4128 | |
| 4129 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4130 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4131 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4132 | spec->input_mux = &spec->private_imux; |
| 4133 | |
| 4134 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4135 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4136 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4137 | if (wcap != AC_WID_AUD_IN) { |
| 4138 | spec->adc_nids = alc260_adc_nids_alt; |
| 4139 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4140 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4141 | } else { |
| 4142 | spec->adc_nids = alc260_adc_nids; |
| 4143 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4144 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4145 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4146 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4147 | |
| 4148 | return 1; |
| 4149 | } |
| 4150 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4151 | /* additional initialization for auto-configuration model */ |
| 4152 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4153 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4154 | alc260_auto_init_multi_out(codec); |
| 4155 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4156 | } |
| 4157 | |
| 4158 | /* |
| 4159 | * ALC260 configurations |
| 4160 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4161 | static struct hda_board_config alc260_cfg_tbl[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4162 | { .modelname = "basic", .config = ALC260_BASIC }, |
Takashi Iwai | b14e77e | 2006-01-11 18:10:50 +0100 | [diff] [blame] | 4163 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81bb, |
| 4164 | .config = ALC260_BASIC }, /* Sony VAIO */ |
Takashi Iwai | 3206b9c | 2006-05-10 16:33:11 +0200 | [diff] [blame] | 4165 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81cc, |
| 4166 | .config = ALC260_BASIC }, /* Sony VAIO VGN-S3HP */ |
Kenneth Crudup | 5e1b151 | 2006-04-28 13:03:48 +0200 | [diff] [blame] | 4167 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81cd, |
| 4168 | .config = ALC260_BASIC }, /* Sony VAIO */ |
Takashi Iwai | c1fc804 | 2006-03-06 14:17:31 +0100 | [diff] [blame] | 4169 | { .pci_subvendor = 0x152d, .pci_subdevice = 0x0729, |
| 4170 | .config = ALC260_BASIC }, /* CTL Travel Master U553W */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4171 | { .modelname = "hp", .config = ALC260_HP }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4172 | { .modelname = "hp-3013", .config = ALC260_HP_3013 }, |
Takashi Iwai | 25b6c43 | 2006-08-08 13:01:14 +0200 | [diff] [blame] | 4173 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3010, .config = ALC260_HP_3013 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4174 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3011, .config = ALC260_HP }, |
Takashi Iwai | 766a6c3 | 2006-05-26 14:58:29 +0200 | [diff] [blame] | 4175 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3012, .config = ALC260_HP_3013 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4176 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3013, .config = ALC260_HP_3013 }, |
| 4177 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, .config = ALC260_HP }, |
| 4178 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3015, .config = ALC260_HP }, |
| 4179 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3016, .config = ALC260_HP }, |
| 4180 | { .modelname = "fujitsu", .config = ALC260_FUJITSU_S702X }, |
| 4181 | { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1326, .config = ALC260_FUJITSU_S702X }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4182 | { .modelname = "acer", .config = ALC260_ACER }, |
| 4183 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x008f, .config = ALC260_ACER }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4184 | #ifdef CONFIG_SND_DEBUG |
| 4185 | { .modelname = "test", .config = ALC260_TEST }, |
| 4186 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4187 | { .modelname = "auto", .config = ALC260_AUTO }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4188 | {} |
| 4189 | }; |
| 4190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4191 | static struct alc_config_preset alc260_presets[] = { |
| 4192 | [ALC260_BASIC] = { |
| 4193 | .mixers = { alc260_base_output_mixer, |
| 4194 | alc260_input_mixer, |
| 4195 | alc260_pc_beep_mixer, |
| 4196 | alc260_capture_mixer }, |
| 4197 | .init_verbs = { alc260_init_verbs }, |
| 4198 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4199 | .dac_nids = alc260_dac_nids, |
| 4200 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4201 | .adc_nids = alc260_adc_nids, |
| 4202 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4203 | .channel_mode = alc260_modes, |
| 4204 | .input_mux = &alc260_capture_source, |
| 4205 | }, |
| 4206 | [ALC260_HP] = { |
| 4207 | .mixers = { alc260_base_output_mixer, |
| 4208 | alc260_input_mixer, |
| 4209 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4210 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4211 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4212 | .dac_nids = alc260_dac_nids, |
| 4213 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4214 | .adc_nids = alc260_hp_adc_nids, |
| 4215 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4216 | .channel_mode = alc260_modes, |
| 4217 | .input_mux = &alc260_capture_source, |
| 4218 | }, |
| 4219 | [ALC260_HP_3013] = { |
| 4220 | .mixers = { alc260_hp_3013_mixer, |
| 4221 | alc260_input_mixer, |
| 4222 | alc260_capture_alt_mixer }, |
| 4223 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4224 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4225 | .dac_nids = alc260_dac_nids, |
| 4226 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4227 | .adc_nids = alc260_hp_adc_nids, |
| 4228 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4229 | .channel_mode = alc260_modes, |
| 4230 | .input_mux = &alc260_capture_source, |
| 4231 | }, |
| 4232 | [ALC260_FUJITSU_S702X] = { |
| 4233 | .mixers = { alc260_fujitsu_mixer, |
| 4234 | alc260_capture_mixer }, |
| 4235 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4236 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4237 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4238 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4239 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4240 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4241 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4242 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4243 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4244 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4245 | [ALC260_ACER] = { |
| 4246 | .mixers = { alc260_acer_mixer, |
| 4247 | alc260_capture_mixer }, |
| 4248 | .init_verbs = { alc260_acer_init_verbs }, |
| 4249 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4250 | .dac_nids = alc260_dac_nids, |
| 4251 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4252 | .adc_nids = alc260_dual_adc_nids, |
| 4253 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4254 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4255 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4256 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4257 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4258 | #ifdef CONFIG_SND_DEBUG |
| 4259 | [ALC260_TEST] = { |
| 4260 | .mixers = { alc260_test_mixer, |
| 4261 | alc260_capture_mixer }, |
| 4262 | .init_verbs = { alc260_test_init_verbs }, |
| 4263 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4264 | .dac_nids = alc260_test_dac_nids, |
| 4265 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4266 | .adc_nids = alc260_test_adc_nids, |
| 4267 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4268 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4269 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4270 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4271 | }, |
| 4272 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4273 | }; |
| 4274 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4275 | static int patch_alc260(struct hda_codec *codec) |
| 4276 | { |
| 4277 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4278 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4279 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4280 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4281 | if (spec == NULL) |
| 4282 | return -ENOMEM; |
| 4283 | |
| 4284 | codec->spec = spec; |
| 4285 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4286 | board_config = snd_hda_check_board_config(codec, alc260_cfg_tbl); |
| 4287 | if (board_config < 0 || board_config >= ALC260_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4288 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4289 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4290 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4291 | } |
| 4292 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4293 | if (board_config == ALC260_AUTO) { |
| 4294 | /* automatic parse from the BIOS config */ |
| 4295 | err = alc260_parse_auto_config(codec); |
| 4296 | if (err < 0) { |
| 4297 | alc_free(codec); |
| 4298 | return err; |
| 4299 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4300 | printk(KERN_INFO |
| 4301 | "hda_codec: Cannot set up configuration " |
| 4302 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4303 | board_config = ALC260_BASIC; |
| 4304 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4305 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4306 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4307 | if (board_config != ALC260_AUTO) |
| 4308 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4309 | |
| 4310 | spec->stream_name_analog = "ALC260 Analog"; |
| 4311 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 4312 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 4313 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4314 | spec->stream_name_digital = "ALC260 Digital"; |
| 4315 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 4316 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 4317 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4318 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4319 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4320 | spec->init_hook = alc260_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4321 | |
| 4322 | return 0; |
| 4323 | } |
| 4324 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4325 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4326 | /* |
| 4327 | * ALC882 support |
| 4328 | * |
| 4329 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 4330 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4331 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4332 | * 6-channel independent captures. |
| 4333 | * |
| 4334 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4335 | * driver yet). |
| 4336 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4337 | #define ALC882_DIGOUT_NID 0x06 |
| 4338 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4339 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4340 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4341 | { 8, NULL } |
| 4342 | }; |
| 4343 | |
| 4344 | static hda_nid_t alc882_dac_nids[4] = { |
| 4345 | /* front, rear, clfe, rear_surr */ |
| 4346 | 0x02, 0x03, 0x04, 0x05 |
| 4347 | }; |
| 4348 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4349 | /* identical with ALC880 */ |
| 4350 | #define alc882_adc_nids alc880_adc_nids |
| 4351 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4352 | |
| 4353 | /* input MUX */ |
| 4354 | /* FIXME: should be a matrix-type input source selection */ |
| 4355 | |
| 4356 | static struct hda_input_mux alc882_capture_source = { |
| 4357 | .num_items = 4, |
| 4358 | .items = { |
| 4359 | { "Mic", 0x0 }, |
| 4360 | { "Front Mic", 0x1 }, |
| 4361 | { "Line", 0x2 }, |
| 4362 | { "CD", 0x4 }, |
| 4363 | }, |
| 4364 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4365 | #define alc882_mux_enum_info alc_mux_enum_info |
| 4366 | #define alc882_mux_enum_get alc_mux_enum_get |
| 4367 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4368 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4369 | { |
| 4370 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4371 | struct alc_spec *spec = codec->spec; |
| 4372 | const struct hda_input_mux *imux = spec->input_mux; |
| 4373 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4374 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4375 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4376 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4377 | unsigned int i, idx; |
| 4378 | |
| 4379 | idx = ucontrol->value.enumerated.item[0]; |
| 4380 | if (idx >= imux->num_items) |
| 4381 | idx = imux->num_items - 1; |
| 4382 | if (*cur_val == idx && ! codec->in_resume) |
| 4383 | return 0; |
| 4384 | for (i = 0; i < imux->num_items; i++) { |
| 4385 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 4386 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4387 | v | (imux->items[i].index << 8)); |
| 4388 | } |
| 4389 | *cur_val = idx; |
| 4390 | return 1; |
| 4391 | } |
| 4392 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4393 | /* |
| 4394 | * 6ch mode |
| 4395 | */ |
| 4396 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 4397 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4398 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4399 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4400 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4401 | { } /* end */ |
| 4402 | }; |
| 4403 | |
| 4404 | /* |
| 4405 | * 8ch mode |
| 4406 | */ |
| 4407 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 4408 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4409 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4410 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4411 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4412 | { } /* end */ |
| 4413 | }; |
| 4414 | |
| 4415 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 4416 | { 6, alc882_sixstack_ch6_init }, |
| 4417 | { 8, alc882_sixstack_ch8_init }, |
| 4418 | }; |
| 4419 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4420 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 4421 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 4422 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4423 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4424 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4425 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4426 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4427 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4428 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 4429 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4430 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 4431 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4432 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4433 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4434 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4435 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4436 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4437 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4438 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4439 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4440 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4441 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4442 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4443 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4444 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4445 | { } /* end */ |
| 4446 | }; |
| 4447 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4448 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 4449 | { |
| 4450 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4451 | .name = "Channel Mode", |
| 4452 | .info = alc_ch_mode_info, |
| 4453 | .get = alc_ch_mode_get, |
| 4454 | .put = alc_ch_mode_put, |
| 4455 | }, |
| 4456 | { } /* end */ |
| 4457 | }; |
| 4458 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4459 | static struct hda_verb alc882_init_verbs[] = { |
| 4460 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4461 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4464 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4465 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4466 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4467 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4468 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4469 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4470 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4471 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4472 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4473 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4474 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4475 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4476 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4477 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4478 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4479 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4480 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4481 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4482 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4483 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4484 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4485 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4486 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4487 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4488 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4489 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4490 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4491 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4492 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4493 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4494 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4495 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4496 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4497 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4498 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4499 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4500 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4501 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4502 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 4503 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4504 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4505 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4506 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4507 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4508 | |
| 4509 | /* FIXME: use matrix-type input source selection */ |
| 4510 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 4511 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4512 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4513 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4514 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4515 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4516 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4517 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4518 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4519 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4520 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4521 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4522 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 4526 | /* ADC1: mute amp left and right */ |
| 4527 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4528 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4529 | /* ADC2: mute amp left and right */ |
| 4530 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4531 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4532 | /* ADC3: mute amp left and right */ |
| 4533 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4534 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4535 | |
| 4536 | { } |
| 4537 | }; |
| 4538 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4539 | static struct hda_verb alc882_eapd_verbs[] = { |
| 4540 | /* change to EAPD mode */ |
| 4541 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 4542 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4543 | { } |
| 4544 | }; |
| 4545 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4546 | /* |
| 4547 | * generic initialization of ADC, input mixers and output mixers |
| 4548 | */ |
| 4549 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 4550 | /* |
| 4551 | * Unmute ADC0-2 and set the default input to mic-in |
| 4552 | */ |
| 4553 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4554 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4555 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4556 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4557 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4558 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4559 | |
| 4560 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4561 | * mixer widget |
| 4562 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 4563 | * mic (mic 2) |
| 4564 | */ |
| 4565 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 4566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 4569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 4570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 4571 | |
| 4572 | /* |
| 4573 | * Set up output mixers (0x0c - 0x0f) |
| 4574 | */ |
| 4575 | /* set vol=0 to output mixers */ |
| 4576 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4577 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4578 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4579 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4580 | /* set up input amps for analog loopback */ |
| 4581 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4583 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4584 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4585 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4586 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4587 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4588 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4589 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4590 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4591 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4592 | |
| 4593 | /* FIXME: use matrix-type input source selection */ |
| 4594 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 4595 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 4596 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4597 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 4598 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 4599 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 4600 | /* Input mixer2 */ |
| 4601 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4602 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 4603 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 4604 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 4605 | /* Input mixer3 */ |
| 4606 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4607 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 4608 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 4609 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 4610 | |
| 4611 | { } |
| 4612 | }; |
| 4613 | |
| 4614 | /* capture mixer elements */ |
| 4615 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 4616 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 4617 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 4618 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 4619 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 4620 | { |
| 4621 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4622 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4623 | * So call somewhat different.. |
| 4624 | * FIXME: the controls appear in the "playback" view! |
| 4625 | */ |
| 4626 | /* .name = "Capture Source", */ |
| 4627 | .name = "Input Source", |
| 4628 | .count = 2, |
| 4629 | .info = alc882_mux_enum_info, |
| 4630 | .get = alc882_mux_enum_get, |
| 4631 | .put = alc882_mux_enum_put, |
| 4632 | }, |
| 4633 | { } /* end */ |
| 4634 | }; |
| 4635 | |
| 4636 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 4637 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 4638 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 4639 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 4640 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 4641 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 4642 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 4643 | { |
| 4644 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4645 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4646 | * So call somewhat different.. |
| 4647 | * FIXME: the controls appear in the "playback" view! |
| 4648 | */ |
| 4649 | /* .name = "Capture Source", */ |
| 4650 | .name = "Input Source", |
| 4651 | .count = 3, |
| 4652 | .info = alc882_mux_enum_info, |
| 4653 | .get = alc882_mux_enum_get, |
| 4654 | .put = alc882_mux_enum_put, |
| 4655 | }, |
| 4656 | { } /* end */ |
| 4657 | }; |
| 4658 | |
| 4659 | /* pcm configuration: identiacal with ALC880 */ |
| 4660 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 4661 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 4662 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 4663 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 4664 | |
| 4665 | /* |
| 4666 | * configuration and preset |
| 4667 | */ |
| 4668 | static struct hda_board_config alc882_cfg_tbl[] = { |
Takashi Iwai | 1494a92 | 2006-01-31 10:58:46 +0100 | [diff] [blame] | 4669 | { .modelname = "3stack-dig", .config = ALC882_3ST_DIG }, |
| 4670 | { .modelname = "6stack-dig", .config = ALC882_6ST_DIG }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4671 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668, |
| 4672 | .config = ALC882_6ST_DIG }, /* MSI */ |
| 4673 | { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668, |
| 4674 | .config = ALC882_6ST_DIG }, /* Foxconn */ |
| 4675 | { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668, |
| 4676 | .config = ALC882_6ST_DIG }, /* ECS to Intel*/ |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4677 | { .modelname = "arima", .config = ALC882_ARIMA }, |
| 4678 | { .pci_subvendor = 0x161f, .pci_subdevice = 0x2054, |
| 4679 | .config = ALC882_ARIMA }, /* Arima W820Di1 */ |
Takashi Iwai | 1494a92 | 2006-01-31 10:58:46 +0100 | [diff] [blame] | 4680 | { .modelname = "auto", .config = ALC882_AUTO }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4681 | {} |
| 4682 | }; |
| 4683 | |
| 4684 | static struct alc_config_preset alc882_presets[] = { |
| 4685 | [ALC882_3ST_DIG] = { |
| 4686 | .mixers = { alc882_base_mixer }, |
| 4687 | .init_verbs = { alc882_init_verbs }, |
| 4688 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 4689 | .dac_nids = alc882_dac_nids, |
| 4690 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4691 | .dig_in_nid = ALC882_DIGIN_NID, |
| 4692 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 4693 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4694 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4695 | .input_mux = &alc882_capture_source, |
| 4696 | }, |
| 4697 | [ALC882_6ST_DIG] = { |
| 4698 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 4699 | .init_verbs = { alc882_init_verbs }, |
| 4700 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 4701 | .dac_nids = alc882_dac_nids, |
| 4702 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4703 | .dig_in_nid = ALC882_DIGIN_NID, |
| 4704 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 4705 | .channel_mode = alc882_sixstack_modes, |
| 4706 | .input_mux = &alc882_capture_source, |
| 4707 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4708 | [ALC882_ARIMA] = { |
| 4709 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 4710 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 4711 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 4712 | .dac_nids = alc882_dac_nids, |
| 4713 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 4714 | .channel_mode = alc882_sixstack_modes, |
| 4715 | .input_mux = &alc882_capture_source, |
| 4716 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4717 | }; |
| 4718 | |
| 4719 | |
| 4720 | /* |
| 4721 | * BIOS auto configuration |
| 4722 | */ |
| 4723 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4724 | hda_nid_t nid, int pin_type, |
| 4725 | int dac_idx) |
| 4726 | { |
| 4727 | /* set as output */ |
| 4728 | struct alc_spec *spec = codec->spec; |
| 4729 | int idx; |
| 4730 | |
| 4731 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 4732 | idx = 4; |
| 4733 | else |
| 4734 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 4735 | |
| 4736 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 4737 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 4738 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 4739 | |
| 4740 | } |
| 4741 | |
| 4742 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 4743 | { |
| 4744 | struct alc_spec *spec = codec->spec; |
| 4745 | int i; |
| 4746 | |
| 4747 | for (i = 0; i <= HDA_SIDE; i++) { |
| 4748 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 4749 | if (nid) |
| 4750 | alc882_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); |
| 4751 | } |
| 4752 | } |
| 4753 | |
| 4754 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 4755 | { |
| 4756 | struct alc_spec *spec = codec->spec; |
| 4757 | hda_nid_t pin; |
| 4758 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4759 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4760 | if (pin) /* connect to front */ |
| 4761 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); /* use dac 0 */ |
| 4762 | } |
| 4763 | |
| 4764 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 4765 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 4766 | |
| 4767 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 4768 | { |
| 4769 | struct alc_spec *spec = codec->spec; |
| 4770 | int i; |
| 4771 | |
| 4772 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4773 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4774 | if (alc882_is_input_pin(nid)) { |
| 4775 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4776 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); |
| 4777 | if (nid != ALC882_PIN_CD_NID) |
| 4778 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4779 | AMP_OUT_MUTE); |
| 4780 | } |
| 4781 | } |
| 4782 | } |
| 4783 | |
| 4784 | /* almost identical with ALC880 parser... */ |
| 4785 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 4786 | { |
| 4787 | struct alc_spec *spec = codec->spec; |
| 4788 | int err = alc880_parse_auto_config(codec); |
| 4789 | |
| 4790 | if (err < 0) |
| 4791 | return err; |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 4792 | else if (err > 0) |
| 4793 | /* hack - override the init verbs */ |
| 4794 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 4795 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4796 | } |
| 4797 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4798 | /* additional initialization for auto-configuration model */ |
| 4799 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4800 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4801 | alc882_auto_init_multi_out(codec); |
| 4802 | alc882_auto_init_hp_out(codec); |
| 4803 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4804 | } |
| 4805 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4806 | static int patch_alc882(struct hda_codec *codec) |
| 4807 | { |
| 4808 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4809 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4810 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4811 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4812 | if (spec == NULL) |
| 4813 | return -ENOMEM; |
| 4814 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4815 | codec->spec = spec; |
| 4816 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4817 | board_config = snd_hda_check_board_config(codec, alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4818 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4819 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4820 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 4821 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4822 | board_config = ALC882_AUTO; |
| 4823 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4824 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4825 | if (board_config == ALC882_AUTO) { |
| 4826 | /* automatic parse from the BIOS config */ |
| 4827 | err = alc882_parse_auto_config(codec); |
| 4828 | if (err < 0) { |
| 4829 | alc_free(codec); |
| 4830 | return err; |
| 4831 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4832 | printk(KERN_INFO |
| 4833 | "hda_codec: Cannot set up configuration " |
| 4834 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4835 | board_config = ALC882_3ST_DIG; |
| 4836 | } |
| 4837 | } |
| 4838 | |
| 4839 | if (board_config != ALC882_AUTO) |
| 4840 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4841 | |
| 4842 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4843 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 4844 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4845 | |
| 4846 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4847 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 4848 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4849 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4850 | if (! spec->adc_nids && spec->input_mux) { |
| 4851 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4852 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4853 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4854 | if (wcap != AC_WID_AUD_IN) { |
| 4855 | spec->adc_nids = alc882_adc_nids_alt; |
| 4856 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
| 4857 | spec->mixers[spec->num_mixers] = alc882_capture_alt_mixer; |
| 4858 | spec->num_mixers++; |
| 4859 | } else { |
| 4860 | spec->adc_nids = alc882_adc_nids; |
| 4861 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 4862 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 4863 | spec->num_mixers++; |
| 4864 | } |
| 4865 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4866 | |
| 4867 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4868 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4869 | spec->init_hook = alc882_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4870 | |
| 4871 | return 0; |
| 4872 | } |
| 4873 | |
| 4874 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4875 | * ALC883 support |
| 4876 | * |
| 4877 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 4878 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4879 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4880 | * 6-channel independent captures. |
| 4881 | * |
| 4882 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4883 | * driver yet). |
| 4884 | */ |
| 4885 | #define ALC883_DIGOUT_NID 0x06 |
| 4886 | #define ALC883_DIGIN_NID 0x0a |
| 4887 | |
| 4888 | static hda_nid_t alc883_dac_nids[4] = { |
| 4889 | /* front, rear, clfe, rear_surr */ |
| 4890 | 0x02, 0x04, 0x03, 0x05 |
| 4891 | }; |
| 4892 | |
| 4893 | static hda_nid_t alc883_adc_nids[2] = { |
| 4894 | /* ADC1-2 */ |
| 4895 | 0x08, 0x09, |
| 4896 | }; |
| 4897 | /* input MUX */ |
| 4898 | /* FIXME: should be a matrix-type input source selection */ |
| 4899 | |
| 4900 | static struct hda_input_mux alc883_capture_source = { |
| 4901 | .num_items = 4, |
| 4902 | .items = { |
| 4903 | { "Mic", 0x0 }, |
| 4904 | { "Front Mic", 0x1 }, |
| 4905 | { "Line", 0x2 }, |
| 4906 | { "CD", 0x4 }, |
| 4907 | }, |
| 4908 | }; |
| 4909 | #define alc883_mux_enum_info alc_mux_enum_info |
| 4910 | #define alc883_mux_enum_get alc_mux_enum_get |
| 4911 | |
| 4912 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 4913 | struct snd_ctl_elem_value *ucontrol) |
| 4914 | { |
| 4915 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4916 | struct alc_spec *spec = codec->spec; |
| 4917 | const struct hda_input_mux *imux = spec->input_mux; |
| 4918 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4919 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4920 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4921 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4922 | unsigned int i, idx; |
| 4923 | |
| 4924 | idx = ucontrol->value.enumerated.item[0]; |
| 4925 | if (idx >= imux->num_items) |
| 4926 | idx = imux->num_items - 1; |
| 4927 | if (*cur_val == idx && ! codec->in_resume) |
| 4928 | return 0; |
| 4929 | for (i = 0; i < imux->num_items; i++) { |
| 4930 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 4931 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4932 | v | (imux->items[i].index << 8)); |
| 4933 | } |
| 4934 | *cur_val = idx; |
| 4935 | return 1; |
| 4936 | } |
| 4937 | /* |
| 4938 | * 2ch mode |
| 4939 | */ |
| 4940 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 4941 | { 2, NULL } |
| 4942 | }; |
| 4943 | |
| 4944 | /* |
| 4945 | * 2ch mode |
| 4946 | */ |
| 4947 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 4948 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 4949 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4950 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 4951 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4952 | { } /* end */ |
| 4953 | }; |
| 4954 | |
| 4955 | /* |
| 4956 | * 6ch mode |
| 4957 | */ |
| 4958 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 4959 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4960 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4961 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 4962 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4963 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4964 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 4965 | { } /* end */ |
| 4966 | }; |
| 4967 | |
| 4968 | static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { |
| 4969 | { 2, alc883_3ST_ch2_init }, |
| 4970 | { 6, alc883_3ST_ch6_init }, |
| 4971 | }; |
| 4972 | |
| 4973 | /* |
| 4974 | * 6ch mode |
| 4975 | */ |
| 4976 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 4977 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4978 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4979 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4980 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4981 | { } /* end */ |
| 4982 | }; |
| 4983 | |
| 4984 | /* |
| 4985 | * 8ch mode |
| 4986 | */ |
| 4987 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 4988 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4989 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4990 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4991 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4992 | { } /* end */ |
| 4993 | }; |
| 4994 | |
| 4995 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 4996 | { 6, alc883_sixstack_ch6_init }, |
| 4997 | { 8, alc883_sixstack_ch8_init }, |
| 4998 | }; |
| 4999 | |
| 5000 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5001 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5002 | */ |
| 5003 | |
| 5004 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 5005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5006 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5007 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5008 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5009 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5010 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5011 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5012 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5013 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 5014 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 5015 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5016 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5017 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5018 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5019 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5022 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5023 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5024 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5025 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5026 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5027 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5028 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5029 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5030 | { |
| 5031 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5032 | /* .name = "Capture Source", */ |
| 5033 | .name = "Input Source", |
| 5034 | .count = 2, |
| 5035 | .info = alc883_mux_enum_info, |
| 5036 | .get = alc883_mux_enum_get, |
| 5037 | .put = alc883_mux_enum_put, |
| 5038 | }, |
| 5039 | { } /* end */ |
| 5040 | }; |
| 5041 | |
| 5042 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 5043 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5044 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5045 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5046 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5047 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5049 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5051 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5052 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5053 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5054 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5055 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5056 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5057 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5058 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5059 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5060 | { |
| 5061 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5062 | /* .name = "Capture Source", */ |
| 5063 | .name = "Input Source", |
| 5064 | .count = 2, |
| 5065 | .info = alc883_mux_enum_info, |
| 5066 | .get = alc883_mux_enum_get, |
| 5067 | .put = alc883_mux_enum_put, |
| 5068 | }, |
| 5069 | { } /* end */ |
| 5070 | }; |
| 5071 | |
| 5072 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 5073 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5074 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5075 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5076 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5077 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5078 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5079 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5080 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5081 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5082 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5083 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5084 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5085 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5086 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5087 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5088 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5089 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5090 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5091 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5092 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5093 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5094 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5095 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5096 | { |
| 5097 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5098 | /* .name = "Capture Source", */ |
| 5099 | .name = "Input Source", |
| 5100 | .count = 2, |
| 5101 | .info = alc883_mux_enum_info, |
| 5102 | .get = alc883_mux_enum_get, |
| 5103 | .put = alc883_mux_enum_put, |
| 5104 | }, |
| 5105 | { } /* end */ |
| 5106 | }; |
| 5107 | |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5108 | static snd_kcontrol_new_t alc883_fivestack_mixer[] = { |
| 5109 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5110 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5111 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5112 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5113 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5114 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5115 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 5116 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 5117 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5118 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5119 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5120 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5121 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5124 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5125 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5126 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5127 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5128 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5129 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5130 | |
| 5131 | { |
| 5132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5133 | /* .name = "Capture Source", */ |
| 5134 | .name = "Input Source", |
| 5135 | .count = 1, |
| 5136 | .info = alc883_mux_enum_info, |
| 5137 | .get = alc883_mux_enum_get, |
| 5138 | .put = alc883_mux_enum_put, |
| 5139 | }, |
| 5140 | { } /* end */ |
| 5141 | }; |
| 5142 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 5143 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 5144 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5145 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5146 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5147 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5148 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5149 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5150 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5151 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5152 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5153 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5154 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5155 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5156 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5157 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5158 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5159 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5160 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5161 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5162 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5163 | { |
| 5164 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5165 | /* .name = "Capture Source", */ |
| 5166 | .name = "Input Source", |
| 5167 | .count = 2, |
| 5168 | .info = alc883_mux_enum_info, |
| 5169 | .get = alc883_mux_enum_get, |
| 5170 | .put = alc883_mux_enum_put, |
| 5171 | }, |
| 5172 | { } /* end */ |
| 5173 | }; |
| 5174 | |
| 5175 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 5176 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5178 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5179 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5180 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5181 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5183 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5184 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5185 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5186 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5187 | { |
| 5188 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5189 | /* .name = "Capture Source", */ |
| 5190 | .name = "Input Source", |
| 5191 | .count = 2, |
| 5192 | .info = alc883_mux_enum_info, |
| 5193 | .get = alc883_mux_enum_get, |
| 5194 | .put = alc883_mux_enum_put, |
| 5195 | }, |
| 5196 | { } /* end */ |
| 5197 | }; |
| 5198 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5199 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 5200 | { |
| 5201 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5202 | .name = "Channel Mode", |
| 5203 | .info = alc_ch_mode_info, |
| 5204 | .get = alc_ch_mode_get, |
| 5205 | .put = alc_ch_mode_put, |
| 5206 | }, |
| 5207 | { } /* end */ |
| 5208 | }; |
| 5209 | |
| 5210 | static struct hda_verb alc883_init_verbs[] = { |
| 5211 | /* ADC1: mute amp left and right */ |
| 5212 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5213 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5214 | /* ADC2: mute amp left and right */ |
| 5215 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5216 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5217 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5218 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5220 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5221 | /* Rear mixer */ |
| 5222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5223 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5224 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5225 | /* CLFE mixer */ |
| 5226 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5227 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5228 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5229 | /* Side mixer */ |
| 5230 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5231 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5232 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5233 | |
| 5234 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5235 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5236 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5237 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5238 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5239 | |
| 5240 | /* Front Pin: output 0 (0x0c) */ |
| 5241 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5242 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5243 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5244 | /* Rear Pin: output 1 (0x0d) */ |
| 5245 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5246 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5247 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5248 | /* CLFE Pin: output 2 (0x0e) */ |
| 5249 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5250 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5251 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5252 | /* Side Pin: output 3 (0x0f) */ |
| 5253 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5254 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5255 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 5256 | /* Mic (rear) pin: input vref at 80% */ |
| 5257 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5258 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5259 | /* Front Mic pin: input vref at 80% */ |
| 5260 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5261 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5262 | /* Line In pin: input */ |
| 5263 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5264 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5265 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5266 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5267 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5268 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5269 | /* CD pin widget for input */ |
| 5270 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5271 | |
| 5272 | /* FIXME: use matrix-type input source selection */ |
| 5273 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5274 | /* Input mixer2 */ |
| 5275 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5276 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5277 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5278 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5279 | /* Input mixer3 */ |
| 5280 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5281 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5282 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5283 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5284 | { } |
| 5285 | }; |
| 5286 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 5287 | static struct hda_verb alc883_tagra_verbs[] = { |
| 5288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5289 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5290 | |
| 5291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5292 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5293 | |
| 5294 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5295 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5296 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5297 | |
| 5298 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5299 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5300 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5301 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5302 | |
| 5303 | { } /* end */ |
| 5304 | }; |
| 5305 | |
| 5306 | /* toggle speaker-output according to the hp-jack state */ |
| 5307 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 5308 | { |
| 5309 | unsigned int present; |
| 5310 | |
| 5311 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5312 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5313 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 5314 | 0x80, present ? 0x80 : 0); |
| 5315 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 5316 | 0x80, present ? 0x80 : 0); |
| 5317 | snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3); |
| 5318 | } |
| 5319 | |
| 5320 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5321 | { |
| 5322 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5323 | alc883_tagra_automute(codec); |
| 5324 | } |
| 5325 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5326 | /* |
| 5327 | * generic initialization of ADC, input mixers and output mixers |
| 5328 | */ |
| 5329 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 5330 | /* |
| 5331 | * Unmute ADC0-2 and set the default input to mic-in |
| 5332 | */ |
| 5333 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5334 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5335 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5336 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5337 | |
| 5338 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5339 | * mixer widget |
| 5340 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 5341 | * mic (mic 2) |
| 5342 | */ |
| 5343 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 5344 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5345 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5346 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5347 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5348 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5349 | |
| 5350 | /* |
| 5351 | * Set up output mixers (0x0c - 0x0f) |
| 5352 | */ |
| 5353 | /* set vol=0 to output mixers */ |
| 5354 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5355 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5356 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5357 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5358 | /* set up input amps for analog loopback */ |
| 5359 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5360 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5361 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5362 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5363 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5364 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5365 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5366 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5367 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5368 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5369 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5370 | |
| 5371 | /* FIXME: use matrix-type input source selection */ |
| 5372 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5373 | /* Input mixer1 */ |
| 5374 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5375 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5376 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5377 | //{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5378 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5379 | /* Input mixer2 */ |
| 5380 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5381 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5382 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5383 | //{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5384 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5385 | |
| 5386 | { } |
| 5387 | }; |
| 5388 | |
| 5389 | /* capture mixer elements */ |
| 5390 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 5391 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5392 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5393 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5394 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5395 | { |
| 5396 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5397 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5398 | * So call somewhat different.. |
| 5399 | * FIXME: the controls appear in the "playback" view! |
| 5400 | */ |
| 5401 | /* .name = "Capture Source", */ |
| 5402 | .name = "Input Source", |
| 5403 | .count = 2, |
| 5404 | .info = alc882_mux_enum_info, |
| 5405 | .get = alc882_mux_enum_get, |
| 5406 | .put = alc882_mux_enum_put, |
| 5407 | }, |
| 5408 | { } /* end */ |
| 5409 | }; |
| 5410 | |
| 5411 | /* pcm configuration: identiacal with ALC880 */ |
| 5412 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 5413 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 5414 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 5415 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 5416 | |
| 5417 | /* |
| 5418 | * configuration and preset |
| 5419 | */ |
| 5420 | static struct hda_board_config alc883_cfg_tbl[] = { |
| 5421 | { .modelname = "3stack-dig", .config = ALC883_3ST_2ch_DIG }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5422 | { .modelname = "3stack-6ch-dig", .config = ALC883_3ST_6ch_DIG }, |
| 5423 | { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668, |
| 5424 | .config = ALC883_3ST_6ch_DIG }, /* ECS to Intel*/ |
| 5425 | { .modelname = "3stack-6ch", .config = ALC883_3ST_6ch }, |
| 5426 | { .pci_subvendor = 0x108e, .pci_subdevice = 0x534d, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 5427 | .config = ALC883_3ST_6ch }, |
| 5428 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd601, |
| 5429 | .config = ALC883_3ST_6ch }, /* D102GGC */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5430 | { .modelname = "6stack-dig", .config = ALC883_6ST_DIG }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5431 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668, |
| 5432 | .config = ALC883_6ST_DIG }, /* MSI */ |
Leonard Norrgård | e22a9a8 | 2007-01-01 19:00:54 +0200 | [diff] [blame] | 5433 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x7280, |
| 5434 | .config = ALC883_6ST_DIG }, /* MSI K9A Platinum (MS-7280) */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5435 | { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668, |
| 5436 | .config = ALC883_6ST_DIG }, /* Foxconn */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 5437 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x7187, |
| 5438 | .config = ALC883_6ST_DIG }, /* MSI */ |
| 5439 | { .modelname = "targa-dig", .config = ALC883_TARGA_DIG }, |
| 5440 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x4314, |
| 5441 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5442 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3fcc, |
| 5443 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5444 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3fc1, |
| 5445 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5446 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3fc3, |
| 5447 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5448 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x4314, |
| 5449 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5450 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x4319, |
| 5451 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5452 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3ef9, |
| 5453 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5454 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x4324, |
| 5455 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5456 | { .modelname = "targa-2ch-dig", .config = ALC883_TARGA_2ch_DIG }, |
| 5457 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x0579, |
| 5458 | .config = ALC883_TARGA_2ch_DIG }, /* MSI */ |
| 5459 | { .pci_subvendor = 0x1462, .pci_subdevice = 0xa422, |
| 5460 | .config = ALC883_TARGA_2ch_DIG }, /* MSI */ |
| 5461 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3b7f, |
| 5462 | .config = ALC883_TARGA_2ch_DIG }, /* MSI */ |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5463 | { .modelname = "6stack-dig-demo", .config = ALC888_DEMO_BOARD }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 5464 | { .modelname = "acer", .config = ALC883_ACER }, |
| 5465 | { .pci_subvendor = 0x1025, .pci_subdevice = 0/*0x0102*/, |
| 5466 | .config = ALC883_ACER }, |
Tobin Davis | 7a99795 | 2006-09-26 15:30:10 +0200 | [diff] [blame] | 5467 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0102, |
| 5468 | .config = ALC883_ACER }, |
| 5469 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x009f, |
| 5470 | .config = ALC883_ACER }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5471 | { .pci_subvendor = 0x161f, .pci_subdevice = 0x2054, |
Takashi Iwai | 35f6083 | 2006-10-13 12:46:10 +0200 | [diff] [blame] | 5472 | .modelname = "medion", .config = ALC883_MEDION }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5473 | { .modelname = "auto", .config = ALC883_AUTO }, |
| 5474 | {} |
| 5475 | }; |
| 5476 | |
| 5477 | static struct alc_config_preset alc883_presets[] = { |
| 5478 | [ALC883_3ST_2ch_DIG] = { |
| 5479 | .mixers = { alc883_3ST_2ch_mixer }, |
| 5480 | .init_verbs = { alc883_init_verbs }, |
| 5481 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5482 | .dac_nids = alc883_dac_nids, |
| 5483 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5484 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5485 | .adc_nids = alc883_adc_nids, |
| 5486 | .dig_in_nid = ALC883_DIGIN_NID, |
| 5487 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 5488 | .channel_mode = alc883_3ST_2ch_modes, |
| 5489 | .input_mux = &alc883_capture_source, |
| 5490 | }, |
| 5491 | [ALC883_3ST_6ch_DIG] = { |
| 5492 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 5493 | .init_verbs = { alc883_init_verbs }, |
| 5494 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5495 | .dac_nids = alc883_dac_nids, |
| 5496 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5497 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5498 | .adc_nids = alc883_adc_nids, |
| 5499 | .dig_in_nid = ALC883_DIGIN_NID, |
| 5500 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 5501 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5502 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5503 | .input_mux = &alc883_capture_source, |
| 5504 | }, |
| 5505 | [ALC883_3ST_6ch] = { |
| 5506 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 5507 | .init_verbs = { alc883_init_verbs }, |
| 5508 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5509 | .dac_nids = alc883_dac_nids, |
| 5510 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5511 | .adc_nids = alc883_adc_nids, |
| 5512 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 5513 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5514 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5515 | .input_mux = &alc883_capture_source, |
| 5516 | }, |
| 5517 | [ALC883_6ST_DIG] = { |
| 5518 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 5519 | .init_verbs = { alc883_init_verbs }, |
| 5520 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5521 | .dac_nids = alc883_dac_nids, |
| 5522 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5523 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5524 | .adc_nids = alc883_adc_nids, |
| 5525 | .dig_in_nid = ALC883_DIGIN_NID, |
| 5526 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 5527 | .channel_mode = alc883_sixstack_modes, |
| 5528 | .input_mux = &alc883_capture_source, |
| 5529 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 5530 | [ALC883_TARGA_DIG] = { |
| 5531 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 5532 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 5533 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5534 | .dac_nids = alc883_dac_nids, |
| 5535 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5536 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5537 | .adc_nids = alc883_adc_nids, |
| 5538 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 5539 | .channel_mode = alc883_3ST_6ch_modes, |
| 5540 | .need_dac_fix = 1, |
| 5541 | .input_mux = &alc883_capture_source, |
| 5542 | .unsol_event = alc883_tagra_unsol_event, |
| 5543 | .init_hook = alc883_tagra_automute, |
| 5544 | }, |
| 5545 | [ALC883_TARGA_2ch_DIG] = { |
| 5546 | .mixers = { alc883_tagra_2ch_mixer}, |
| 5547 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 5548 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5549 | .dac_nids = alc883_dac_nids, |
| 5550 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5551 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5552 | .adc_nids = alc883_adc_nids, |
| 5553 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 5554 | .channel_mode = alc883_3ST_2ch_modes, |
| 5555 | .input_mux = &alc883_capture_source, |
| 5556 | .unsol_event = alc883_tagra_unsol_event, |
| 5557 | .init_hook = alc883_tagra_automute, |
| 5558 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5559 | [ALC888_DEMO_BOARD] = { |
| 5560 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 5561 | .init_verbs = { alc883_init_verbs }, |
| 5562 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5563 | .dac_nids = alc883_dac_nids, |
| 5564 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5565 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5566 | .adc_nids = alc883_adc_nids, |
| 5567 | .dig_in_nid = ALC883_DIGIN_NID, |
| 5568 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 5569 | .channel_mode = alc883_sixstack_modes, |
| 5570 | .input_mux = &alc883_capture_source, |
| 5571 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 5572 | [ALC883_ACER] = { |
| 5573 | .mixers = { alc883_base_mixer, |
| 5574 | alc883_chmode_mixer }, |
| 5575 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 5576 | * and the headphone jack. Turn this on and rely on the |
| 5577 | * standard mute methods whenever the user wants to turn |
| 5578 | * these outputs off. |
| 5579 | */ |
| 5580 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 5581 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5582 | .dac_nids = alc883_dac_nids, |
| 5583 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5584 | .adc_nids = alc883_adc_nids, |
| 5585 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 5586 | .channel_mode = alc883_3ST_2ch_modes, |
| 5587 | .input_mux = &alc883_capture_source, |
| 5588 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5589 | [ALC883_MEDION] = { |
| 5590 | .mixers = { alc883_fivestack_mixer, |
| 5591 | alc883_chmode_mixer }, |
| 5592 | .init_verbs = { alc883_init_verbs, |
| 5593 | alc882_eapd_verbs }, |
| 5594 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5595 | .dac_nids = alc883_dac_nids, |
| 5596 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5597 | .adc_nids = alc883_adc_nids, |
| 5598 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 5599 | .channel_mode = alc883_sixstack_modes, |
| 5600 | .input_mux = &alc883_capture_source, |
| 5601 | } |
| 5602 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5603 | }; |
| 5604 | |
| 5605 | |
| 5606 | /* |
| 5607 | * BIOS auto configuration |
| 5608 | */ |
| 5609 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5610 | hda_nid_t nid, int pin_type, |
| 5611 | int dac_idx) |
| 5612 | { |
| 5613 | /* set as output */ |
| 5614 | struct alc_spec *spec = codec->spec; |
| 5615 | int idx; |
| 5616 | |
| 5617 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 5618 | idx = 4; |
| 5619 | else |
| 5620 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 5621 | |
| 5622 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5623 | pin_type); |
| 5624 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5625 | AMP_OUT_UNMUTE); |
| 5626 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 5627 | |
| 5628 | } |
| 5629 | |
| 5630 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 5631 | { |
| 5632 | struct alc_spec *spec = codec->spec; |
| 5633 | int i; |
| 5634 | |
| 5635 | for (i = 0; i <= HDA_SIDE; i++) { |
| 5636 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 5637 | if (nid) |
| 5638 | alc883_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); |
| 5639 | } |
| 5640 | } |
| 5641 | |
| 5642 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 5643 | { |
| 5644 | struct alc_spec *spec = codec->spec; |
| 5645 | hda_nid_t pin; |
| 5646 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5647 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5648 | if (pin) /* connect to front */ |
| 5649 | /* use dac 0 */ |
| 5650 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5651 | } |
| 5652 | |
| 5653 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 5654 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 5655 | |
| 5656 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 5657 | { |
| 5658 | struct alc_spec *spec = codec->spec; |
| 5659 | int i; |
| 5660 | |
| 5661 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5662 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5663 | if (alc883_is_input_pin(nid)) { |
| 5664 | snd_hda_codec_write(codec, nid, 0, |
| 5665 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5666 | (i <= AUTO_PIN_FRONT_MIC ? |
| 5667 | PIN_VREF80 : PIN_IN)); |
| 5668 | if (nid != ALC883_PIN_CD_NID) |
| 5669 | snd_hda_codec_write(codec, nid, 0, |
| 5670 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 5671 | AMP_OUT_MUTE); |
| 5672 | } |
| 5673 | } |
| 5674 | } |
| 5675 | |
| 5676 | /* almost identical with ALC880 parser... */ |
| 5677 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 5678 | { |
| 5679 | struct alc_spec *spec = codec->spec; |
| 5680 | int err = alc880_parse_auto_config(codec); |
| 5681 | |
| 5682 | if (err < 0) |
| 5683 | return err; |
| 5684 | else if (err > 0) |
| 5685 | /* hack - override the init verbs */ |
| 5686 | spec->init_verbs[0] = alc883_auto_init_verbs; |
| 5687 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 5688 | spec->num_mixers++; |
| 5689 | return err; |
| 5690 | } |
| 5691 | |
| 5692 | /* additional initialization for auto-configuration model */ |
| 5693 | static void alc883_auto_init(struct hda_codec *codec) |
| 5694 | { |
| 5695 | alc883_auto_init_multi_out(codec); |
| 5696 | alc883_auto_init_hp_out(codec); |
| 5697 | alc883_auto_init_analog_input(codec); |
| 5698 | } |
| 5699 | |
| 5700 | static int patch_alc883(struct hda_codec *codec) |
| 5701 | { |
| 5702 | struct alc_spec *spec; |
| 5703 | int err, board_config; |
| 5704 | |
| 5705 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5706 | if (spec == NULL) |
| 5707 | return -ENOMEM; |
| 5708 | |
| 5709 | codec->spec = spec; |
| 5710 | |
| 5711 | board_config = snd_hda_check_board_config(codec, alc883_cfg_tbl); |
| 5712 | if (board_config < 0 || board_config >= ALC883_MODEL_LAST) { |
| 5713 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 5714 | "trying auto-probe from BIOS...\n"); |
| 5715 | board_config = ALC883_AUTO; |
| 5716 | } |
| 5717 | |
| 5718 | if (board_config == ALC883_AUTO) { |
| 5719 | /* automatic parse from the BIOS config */ |
| 5720 | err = alc883_parse_auto_config(codec); |
| 5721 | if (err < 0) { |
| 5722 | alc_free(codec); |
| 5723 | return err; |
| 5724 | } else if (! err) { |
| 5725 | printk(KERN_INFO |
| 5726 | "hda_codec: Cannot set up configuration " |
| 5727 | "from BIOS. Using base mode...\n"); |
| 5728 | board_config = ALC883_3ST_2ch_DIG; |
| 5729 | } |
| 5730 | } |
| 5731 | |
| 5732 | if (board_config != ALC883_AUTO) |
| 5733 | setup_preset(spec, &alc883_presets[board_config]); |
| 5734 | |
| 5735 | spec->stream_name_analog = "ALC883 Analog"; |
| 5736 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 5737 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 5738 | |
| 5739 | spec->stream_name_digital = "ALC883 Digital"; |
| 5740 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 5741 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 5742 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5743 | if (! spec->adc_nids && spec->input_mux) { |
| 5744 | spec->adc_nids = alc883_adc_nids; |
| 5745 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 5746 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5747 | |
| 5748 | codec->patch_ops = alc_patch_ops; |
| 5749 | if (board_config == ALC883_AUTO) |
| 5750 | spec->init_hook = alc883_auto_init; |
| 5751 | |
| 5752 | return 0; |
| 5753 | } |
| 5754 | |
| 5755 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5756 | * ALC262 support |
| 5757 | */ |
| 5758 | |
| 5759 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 5760 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 5761 | |
| 5762 | #define alc262_dac_nids alc260_dac_nids |
| 5763 | #define alc262_adc_nids alc882_adc_nids |
| 5764 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 5765 | |
| 5766 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 5767 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5768 | |
| 5769 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 5770 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5771 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5772 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5773 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5774 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5775 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5776 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5777 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5778 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5779 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5780 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5781 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 5782 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 5783 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5784 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5785 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5786 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 5787 | }; |
| 5788 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 5789 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 5790 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5791 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5793 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5794 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5795 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5798 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5799 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5800 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5801 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 5802 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 5803 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5804 | { } /* end */ |
| 5805 | }; |
| 5806 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5807 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 5808 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5809 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5810 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5811 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5812 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 5813 | |
| 5814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5816 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5817 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5819 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5820 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5821 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5822 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5823 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5824 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 5825 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 5826 | { } /* end */ |
| 5827 | }; |
| 5828 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5829 | #define alc262_capture_mixer alc882_capture_mixer |
| 5830 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 5831 | |
| 5832 | /* |
| 5833 | * generic initialization of ADC, input mixers and output mixers |
| 5834 | */ |
| 5835 | static struct hda_verb alc262_init_verbs[] = { |
| 5836 | /* |
| 5837 | * Unmute ADC0-2 and set the default input to mic-in |
| 5838 | */ |
| 5839 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5840 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5841 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5842 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5843 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5844 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5845 | |
| 5846 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5847 | * mixer widget |
| 5848 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 5849 | * mic (mic 2) |
| 5850 | */ |
| 5851 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 5852 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5853 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5854 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5855 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5856 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5857 | |
| 5858 | /* |
| 5859 | * Set up output mixers (0x0c - 0x0e) |
| 5860 | */ |
| 5861 | /* set vol=0 to output mixers */ |
| 5862 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5863 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5864 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5865 | /* set up input amps for analog loopback */ |
| 5866 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5867 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5868 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5869 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5870 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5871 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5872 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5873 | |
| 5874 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5875 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5876 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5877 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5878 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5879 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5880 | |
| 5881 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5882 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5883 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5884 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5885 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5886 | |
| 5887 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5888 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5889 | |
| 5890 | /* FIXME: use matrix-type input source selection */ |
| 5891 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5892 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5893 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5894 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5895 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5896 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5897 | /* Input mixer2 */ |
| 5898 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5899 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5900 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5901 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5902 | /* Input mixer3 */ |
| 5903 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5904 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5905 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5906 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5907 | |
| 5908 | { } |
| 5909 | }; |
| 5910 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 5911 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 5912 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5913 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5914 | {} |
| 5915 | }; |
| 5916 | |
| 5917 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 5918 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5919 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5920 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5921 | |
| 5922 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5923 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5924 | {} |
| 5925 | }; |
| 5926 | |
| 5927 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 5928 | static void alc262_hippo_automute(struct hda_codec *codec, int force) |
| 5929 | { |
| 5930 | struct alc_spec *spec = codec->spec; |
| 5931 | unsigned int mute; |
| 5932 | |
| 5933 | if (force || ! spec->sense_updated) { |
| 5934 | unsigned int present; |
| 5935 | /* need to execute and sync at first */ |
| 5936 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 5937 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5938 | AC_VERB_GET_PIN_SENSE, 0); |
| 5939 | spec->jack_present = (present & 0x80000000) != 0; |
| 5940 | spec->sense_updated = 1; |
| 5941 | } |
| 5942 | if (spec->jack_present) { |
| 5943 | /* mute internal speaker */ |
| 5944 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 5945 | 0x80, 0x80); |
| 5946 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 5947 | 0x80, 0x80); |
| 5948 | } else { |
| 5949 | /* unmute internal speaker if necessary */ |
| 5950 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 5951 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 5952 | 0x80, mute & 0x80); |
| 5953 | mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0); |
| 5954 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 5955 | 0x80, mute & 0x80); |
| 5956 | } |
| 5957 | } |
| 5958 | |
| 5959 | /* unsolicited event for HP jack sensing */ |
| 5960 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 5961 | unsigned int res) |
| 5962 | { |
| 5963 | if ((res >> 26) != ALC880_HP_EVENT) |
| 5964 | return; |
| 5965 | alc262_hippo_automute(codec, 1); |
| 5966 | } |
| 5967 | |
| 5968 | static void alc262_hippo1_automute(struct hda_codec *codec, int force) |
| 5969 | { |
| 5970 | struct alc_spec *spec = codec->spec; |
| 5971 | unsigned int mute; |
| 5972 | |
| 5973 | if (force || ! spec->sense_updated) { |
| 5974 | unsigned int present; |
| 5975 | /* need to execute and sync at first */ |
| 5976 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 5977 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 5978 | AC_VERB_GET_PIN_SENSE, 0); |
| 5979 | spec->jack_present = (present & 0x80000000) != 0; |
| 5980 | spec->sense_updated = 1; |
| 5981 | } |
| 5982 | if (spec->jack_present) { |
| 5983 | /* mute internal speaker */ |
| 5984 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 5985 | 0x80, 0x80); |
| 5986 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 5987 | 0x80, 0x80); |
| 5988 | } else { |
| 5989 | /* unmute internal speaker if necessary */ |
| 5990 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 5991 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 5992 | 0x80, mute & 0x80); |
| 5993 | mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0); |
| 5994 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 5995 | 0x80, mute & 0x80); |
| 5996 | } |
| 5997 | } |
| 5998 | |
| 5999 | /* unsolicited event for HP jack sensing */ |
| 6000 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 6001 | unsigned int res) |
| 6002 | { |
| 6003 | if ((res >> 26) != ALC880_HP_EVENT) |
| 6004 | return; |
| 6005 | alc262_hippo1_automute(codec, 1); |
| 6006 | } |
| 6007 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6008 | /* |
| 6009 | * fujitsu model |
| 6010 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 6011 | */ |
| 6012 | |
| 6013 | #define ALC_HP_EVENT 0x37 |
| 6014 | |
| 6015 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 6016 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 6017 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6018 | {} |
| 6019 | }; |
| 6020 | |
| 6021 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
| 6022 | .num_items = 2, |
| 6023 | .items = { |
| 6024 | { "Mic", 0x0 }, |
| 6025 | { "CD", 0x4 }, |
| 6026 | }, |
| 6027 | }; |
| 6028 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6029 | static struct hda_input_mux alc262_HP_capture_source = { |
| 6030 | .num_items = 5, |
| 6031 | .items = { |
| 6032 | { "Mic", 0x0 }, |
| 6033 | { "Front Mic", 0x3 }, |
| 6034 | { "Line", 0x2 }, |
| 6035 | { "CD", 0x4 }, |
| 6036 | { "AUX IN", 0x6 }, |
| 6037 | }, |
| 6038 | }; |
| 6039 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6040 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 6041 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 6042 | { |
| 6043 | struct alc_spec *spec = codec->spec; |
| 6044 | unsigned int mute; |
| 6045 | |
| 6046 | if (force || ! spec->sense_updated) { |
| 6047 | unsigned int present; |
| 6048 | /* need to execute and sync at first */ |
| 6049 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 6050 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6051 | AC_VERB_GET_PIN_SENSE, 0); |
| 6052 | spec->jack_present = (present & 0x80000000) != 0; |
| 6053 | spec->sense_updated = 1; |
| 6054 | } |
| 6055 | if (spec->jack_present) { |
| 6056 | /* mute internal speaker */ |
| 6057 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6058 | 0x80, 0x80); |
| 6059 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6060 | 0x80, 0x80); |
| 6061 | } else { |
| 6062 | /* unmute internal speaker if necessary */ |
| 6063 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 6064 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6065 | 0x80, mute & 0x80); |
| 6066 | mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0); |
| 6067 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6068 | 0x80, mute & 0x80); |
| 6069 | } |
| 6070 | } |
| 6071 | |
| 6072 | /* unsolicited event for HP jack sensing */ |
| 6073 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 6074 | unsigned int res) |
| 6075 | { |
| 6076 | if ((res >> 26) != ALC_HP_EVENT) |
| 6077 | return; |
| 6078 | alc262_fujitsu_automute(codec, 1); |
| 6079 | } |
| 6080 | |
| 6081 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 6082 | static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol, |
| 6083 | struct snd_ctl_elem_value *ucontrol) |
| 6084 | { |
| 6085 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6086 | long *valp = ucontrol->value.integer.value; |
| 6087 | int change; |
| 6088 | |
| 6089 | change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 6090 | 0x7f, valp[0] & 0x7f); |
| 6091 | change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 6092 | 0x7f, valp[1] & 0x7f); |
| 6093 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 6094 | 0x7f, valp[0] & 0x7f); |
| 6095 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 6096 | 0x7f, valp[1] & 0x7f); |
| 6097 | return change; |
| 6098 | } |
| 6099 | |
| 6100 | /* bind hp and internal speaker mute (with plug check) */ |
| 6101 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 6102 | struct snd_ctl_elem_value *ucontrol) |
| 6103 | { |
| 6104 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6105 | long *valp = ucontrol->value.integer.value; |
| 6106 | int change; |
| 6107 | |
| 6108 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 6109 | 0x80, valp[0] ? 0 : 0x80); |
| 6110 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 6111 | 0x80, valp[1] ? 0 : 0x80); |
| 6112 | if (change || codec->in_resume) |
| 6113 | alc262_fujitsu_automute(codec, codec->in_resume); |
| 6114 | return change; |
| 6115 | } |
| 6116 | |
| 6117 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
| 6118 | { |
| 6119 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6120 | .name = "Master Playback Volume", |
| 6121 | .info = snd_hda_mixer_amp_volume_info, |
| 6122 | .get = snd_hda_mixer_amp_volume_get, |
| 6123 | .put = alc262_fujitsu_master_vol_put, |
Takashi Iwai | c256652 | 2006-08-17 18:21:36 +0200 | [diff] [blame] | 6124 | .tlv = { .c = snd_hda_mixer_amp_tlv }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6125 | .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 6126 | }, |
| 6127 | { |
| 6128 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6129 | .name = "Master Playback Switch", |
| 6130 | .info = snd_hda_mixer_amp_switch_info, |
| 6131 | .get = snd_hda_mixer_amp_switch_get, |
| 6132 | .put = alc262_fujitsu_master_sw_put, |
| 6133 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 6134 | }, |
| 6135 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6136 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6137 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6138 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6139 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6140 | { } /* end */ |
| 6141 | }; |
| 6142 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 6143 | /* additional init verbs for Benq laptops */ |
| 6144 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 6145 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6146 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6147 | {} |
| 6148 | }; |
| 6149 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6150 | /* add playback controls from the parsed DAC table */ |
| 6151 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) |
| 6152 | { |
| 6153 | hda_nid_t nid; |
| 6154 | int err; |
| 6155 | |
| 6156 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 6157 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6158 | spec->multiout.dac_nids[0] = 2; |
| 6159 | |
| 6160 | nid = cfg->line_out_pins[0]; |
| 6161 | if (nid) { |
| 6162 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Front Playback Volume", |
| 6163 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT))) < 0) |
| 6164 | return err; |
| 6165 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Front Playback Switch", |
| 6166 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 6167 | return err; |
| 6168 | } |
| 6169 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6170 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6171 | if (nid) { |
| 6172 | if (nid == 0x16) { |
| 6173 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Speaker Playback Volume", |
| 6174 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT))) < 0) |
| 6175 | return err; |
| 6176 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", |
| 6177 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 6178 | return err; |
| 6179 | } else { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6180 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", |
| 6181 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 6182 | return err; |
| 6183 | } |
| 6184 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6185 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6186 | if (nid) { |
| 6187 | /* spec->multiout.hp_nid = 2; */ |
| 6188 | if (nid == 0x16) { |
| 6189 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Headphone Playback Volume", |
| 6190 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT))) < 0) |
| 6191 | return err; |
| 6192 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", |
| 6193 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 6194 | return err; |
| 6195 | } else { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6196 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", |
| 6197 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 6198 | return err; |
| 6199 | } |
| 6200 | } |
| 6201 | return 0; |
| 6202 | } |
| 6203 | |
| 6204 | /* identical with ALC880 */ |
| 6205 | #define alc262_auto_create_analog_input_ctls alc880_auto_create_analog_input_ctls |
| 6206 | |
| 6207 | /* |
| 6208 | * generic initialization of ADC, input mixers and output mixers |
| 6209 | */ |
| 6210 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 6211 | /* |
| 6212 | * Unmute ADC0-2 and set the default input to mic-in |
| 6213 | */ |
| 6214 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6215 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6216 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6217 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6218 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6219 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6220 | |
| 6221 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6222 | * mixer widget |
| 6223 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 6224 | * mic (mic 2) |
| 6225 | */ |
| 6226 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6227 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6228 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6229 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6230 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6231 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6232 | |
| 6233 | /* |
| 6234 | * Set up output mixers (0x0c - 0x0f) |
| 6235 | */ |
| 6236 | /* set vol=0 to output mixers */ |
| 6237 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6238 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6239 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6240 | |
| 6241 | /* set up input amps for analog loopback */ |
| 6242 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6243 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6244 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6245 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6246 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6247 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6248 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6249 | |
| 6250 | /* FIXME: use matrix-type input source selection */ |
| 6251 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6252 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6253 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6256 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6257 | /* Input mixer2 */ |
| 6258 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6261 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6262 | /* Input mixer3 */ |
| 6263 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6266 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6267 | |
| 6268 | { } |
| 6269 | }; |
| 6270 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6271 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 6272 | /* |
| 6273 | * Unmute ADC0-2 and set the default input to mic-in |
| 6274 | */ |
| 6275 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6276 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6277 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6278 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6279 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6280 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6281 | |
| 6282 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6283 | * mixer widget |
| 6284 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 6285 | * mic (mic 2) |
| 6286 | */ |
| 6287 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 6294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 6295 | |
| 6296 | /* |
| 6297 | * Set up output mixers (0x0c - 0x0e) |
| 6298 | */ |
| 6299 | /* set vol=0 to output mixers */ |
| 6300 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6301 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6302 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6303 | |
| 6304 | /* set up input amps for analog loopback */ |
| 6305 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6308 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6312 | |
| 6313 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6314 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6315 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6316 | |
| 6317 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6318 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6319 | |
| 6320 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6321 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6322 | |
| 6323 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6324 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6325 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6326 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6327 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6328 | |
| 6329 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 6330 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 6331 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 6332 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 6333 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 6334 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 6335 | |
| 6336 | |
| 6337 | /* FIXME: use matrix-type input source selection */ |
| 6338 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6339 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6340 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6341 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 6342 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 6343 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 6344 | /* Input mixer2 */ |
| 6345 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6346 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 6347 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 6348 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 6349 | /* Input mixer3 */ |
| 6350 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6351 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 6352 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 6353 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 6354 | |
| 6355 | { } |
| 6356 | }; |
| 6357 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6358 | /* pcm configuration: identiacal with ALC880 */ |
| 6359 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 6360 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 6361 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 6362 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 6363 | |
| 6364 | /* |
| 6365 | * BIOS auto configuration |
| 6366 | */ |
| 6367 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 6368 | { |
| 6369 | struct alc_spec *spec = codec->spec; |
| 6370 | int err; |
| 6371 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 6372 | |
| 6373 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6374 | alc262_ignore)) < 0) |
| 6375 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6376 | if (! spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6377 | return 0; /* can't find valid BIOS pin config */ |
| 6378 | if ((err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || |
| 6379 | (err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
| 6380 | return err; |
| 6381 | |
| 6382 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 6383 | |
| 6384 | if (spec->autocfg.dig_out_pin) |
| 6385 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 6386 | if (spec->autocfg.dig_in_pin) |
| 6387 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 6388 | |
| 6389 | if (spec->kctl_alloc) |
| 6390 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 6391 | |
| 6392 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6393 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6394 | spec->input_mux = &spec->private_imux; |
| 6395 | |
| 6396 | return 1; |
| 6397 | } |
| 6398 | |
| 6399 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 6400 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 6401 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 6402 | |
| 6403 | |
| 6404 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6405 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6406 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6407 | alc262_auto_init_multi_out(codec); |
| 6408 | alc262_auto_init_hp_out(codec); |
| 6409 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6410 | } |
| 6411 | |
| 6412 | /* |
| 6413 | * configuration and preset |
| 6414 | */ |
| 6415 | static struct hda_board_config alc262_cfg_tbl[] = { |
| 6416 | { .modelname = "basic", .config = ALC262_BASIC }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 6417 | { .modelname = "hippo", |
| 6418 | .pci_subvendor =0x1002, .pci_subdevice = 0x437b, |
| 6419 | .config = ALC262_HIPPO}, |
| 6420 | { .modelname = "hippo_1", |
| 6421 | .pci_subvendor =0x17ff, .pci_subdevice = 0x058f, |
| 6422 | .config = ALC262_HIPPO_1}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6423 | { .modelname = "fujitsu", .config = ALC262_FUJITSU }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6424 | { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1397, |
| 6425 | .config = ALC262_FUJITSU }, |
Takashi Iwai | 6d177ba7 | 2006-07-25 14:51:15 +0200 | [diff] [blame] | 6426 | { .modelname = "hp-bpc", .config = ALC262_HP_BPC }, |
John W. Linville | 282e0c8 | 2006-11-06 12:01:53 +0100 | [diff] [blame] | 6427 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x280c, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6428 | .config = ALC262_HP_BPC }, /* xw4400 */ |
Takashi Iwai | efeccac | 2006-10-24 14:57:52 +0200 | [diff] [blame] | 6429 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x2801, |
| 6430 | .config = ALC262_HP_BPC }, /* q965 */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6431 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, |
| 6432 | .config = ALC262_HP_BPC }, /* xw6400 */ |
| 6433 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3015, |
| 6434 | .config = ALC262_HP_BPC }, /* xw8400 */ |
| 6435 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x12fe, |
| 6436 | .config = ALC262_HP_BPC }, /* xw9400 */ |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 6437 | { .modelname = "benq", .config = ALC262_BENQ_ED8 }, |
| 6438 | { .pci_subvendor = 0x17ff, .pci_subdevice = 0x0560, |
| 6439 | .config = ALC262_BENQ_ED8 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6440 | { .modelname = "auto", .config = ALC262_AUTO }, |
| 6441 | {} |
| 6442 | }; |
| 6443 | |
| 6444 | static struct alc_config_preset alc262_presets[] = { |
| 6445 | [ALC262_BASIC] = { |
| 6446 | .mixers = { alc262_base_mixer }, |
| 6447 | .init_verbs = { alc262_init_verbs }, |
| 6448 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6449 | .dac_nids = alc262_dac_nids, |
| 6450 | .hp_nid = 0x03, |
| 6451 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6452 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6453 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6454 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 6455 | [ALC262_HIPPO] = { |
| 6456 | .mixers = { alc262_base_mixer }, |
| 6457 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 6458 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6459 | .dac_nids = alc262_dac_nids, |
| 6460 | .hp_nid = 0x03, |
| 6461 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 6462 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6463 | .channel_mode = alc262_modes, |
| 6464 | .input_mux = &alc262_capture_source, |
| 6465 | .unsol_event = alc262_hippo_unsol_event, |
| 6466 | }, |
| 6467 | [ALC262_HIPPO_1] = { |
| 6468 | .mixers = { alc262_hippo1_mixer }, |
| 6469 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 6470 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6471 | .dac_nids = alc262_dac_nids, |
| 6472 | .hp_nid = 0x02, |
| 6473 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 6474 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6475 | .channel_mode = alc262_modes, |
| 6476 | .input_mux = &alc262_capture_source, |
| 6477 | .unsol_event = alc262_hippo1_unsol_event, |
| 6478 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6479 | [ALC262_FUJITSU] = { |
| 6480 | .mixers = { alc262_fujitsu_mixer }, |
| 6481 | .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, |
| 6482 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6483 | .dac_nids = alc262_dac_nids, |
| 6484 | .hp_nid = 0x03, |
| 6485 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 6486 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6487 | .channel_mode = alc262_modes, |
| 6488 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6489 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6490 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6491 | [ALC262_HP_BPC] = { |
| 6492 | .mixers = { alc262_HP_BPC_mixer }, |
| 6493 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 6494 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6495 | .dac_nids = alc262_dac_nids, |
| 6496 | .hp_nid = 0x03, |
| 6497 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6498 | .channel_mode = alc262_modes, |
| 6499 | .input_mux = &alc262_HP_capture_source, |
| 6500 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 6501 | [ALC262_BENQ_ED8] = { |
| 6502 | .mixers = { alc262_base_mixer }, |
| 6503 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 6504 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6505 | .dac_nids = alc262_dac_nids, |
| 6506 | .hp_nid = 0x03, |
| 6507 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6508 | .channel_mode = alc262_modes, |
| 6509 | .input_mux = &alc262_capture_source, |
| 6510 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6511 | }; |
| 6512 | |
| 6513 | static int patch_alc262(struct hda_codec *codec) |
| 6514 | { |
| 6515 | struct alc_spec *spec; |
| 6516 | int board_config; |
| 6517 | int err; |
| 6518 | |
| 6519 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 6520 | if (spec == NULL) |
| 6521 | return -ENOMEM; |
| 6522 | |
| 6523 | codec->spec = spec; |
| 6524 | #if 0 |
| 6525 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is under-run */ |
| 6526 | { |
| 6527 | int tmp; |
| 6528 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 6529 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 6530 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 6531 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 6532 | } |
| 6533 | #endif |
| 6534 | |
| 6535 | board_config = snd_hda_check_board_config(codec, alc262_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6536 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6537 | if (board_config < 0 || board_config >= ALC262_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6538 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 6539 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6540 | board_config = ALC262_AUTO; |
| 6541 | } |
| 6542 | |
| 6543 | if (board_config == ALC262_AUTO) { |
| 6544 | /* automatic parse from the BIOS config */ |
| 6545 | err = alc262_parse_auto_config(codec); |
| 6546 | if (err < 0) { |
| 6547 | alc_free(codec); |
| 6548 | return err; |
| 6549 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6550 | printk(KERN_INFO |
| 6551 | "hda_codec: Cannot set up configuration " |
| 6552 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6553 | board_config = ALC262_BASIC; |
| 6554 | } |
| 6555 | } |
| 6556 | |
| 6557 | if (board_config != ALC262_AUTO) |
| 6558 | setup_preset(spec, &alc262_presets[board_config]); |
| 6559 | |
| 6560 | spec->stream_name_analog = "ALC262 Analog"; |
| 6561 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 6562 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 6563 | |
| 6564 | spec->stream_name_digital = "ALC262 Digital"; |
| 6565 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 6566 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 6567 | |
| 6568 | if (! spec->adc_nids && spec->input_mux) { |
| 6569 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6570 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 6571 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6572 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 6573 | if (wcap != AC_WID_AUD_IN) { |
| 6574 | spec->adc_nids = alc262_adc_nids_alt; |
| 6575 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
| 6576 | spec->mixers[spec->num_mixers] = alc262_capture_alt_mixer; |
| 6577 | spec->num_mixers++; |
| 6578 | } else { |
| 6579 | spec->adc_nids = alc262_adc_nids; |
| 6580 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 6581 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 6582 | spec->num_mixers++; |
| 6583 | } |
| 6584 | } |
| 6585 | |
| 6586 | codec->patch_ops = alc_patch_ops; |
| 6587 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6588 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6589 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6590 | return 0; |
| 6591 | } |
| 6592 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6593 | /* |
| 6594 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 6595 | */ |
| 6596 | |
| 6597 | /* |
| 6598 | * set the path ways for 2 channel output |
| 6599 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 6600 | */ |
| 6601 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 6602 | /* set pin widget 1Ah (line in) for input */ |
| 6603 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6604 | /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */ |
| 6605 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6606 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6607 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 6608 | #if 0 |
| 6609 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 6610 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 6611 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6612 | { } /* end */ |
| 6613 | }; |
| 6614 | /* |
| 6615 | * 6ch mode |
| 6616 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 6617 | */ |
| 6618 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 6619 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 6620 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6621 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 6622 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6623 | |
| 6624 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6625 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6626 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6627 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 6628 | #if 0 |
| 6629 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 6630 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 6631 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6632 | { } /* end */ |
| 6633 | }; |
| 6634 | |
| 6635 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 6636 | { 2, alc861_threestack_ch2_init }, |
| 6637 | { 6, alc861_threestack_ch6_init }, |
| 6638 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 6639 | /* Set mic1 as input and unmute the mixer */ |
| 6640 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 6641 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6642 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 6643 | { } /* end */ |
| 6644 | }; |
| 6645 | /* Set mic1 as output and mute mixer */ |
| 6646 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 6647 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6648 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 6649 | { } /* end */ |
| 6650 | }; |
| 6651 | |
| 6652 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 6653 | { 2, alc861_uniwill_m31_ch2_init }, |
| 6654 | { 4, alc861_uniwill_m31_ch4_init }, |
| 6655 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6656 | |
| 6657 | /* patch-ALC861 */ |
| 6658 | |
| 6659 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 6660 | /* output mixer control */ |
| 6661 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 6662 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 6663 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 6664 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 6665 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 6666 | |
| 6667 | /*Input mixer control */ |
| 6668 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 6669 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 6670 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 6671 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 6672 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 6673 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 6674 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 6675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 6676 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 6677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
| 6678 | |
| 6679 | /* Capture mixer control */ |
| 6680 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6681 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6682 | { |
| 6683 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6684 | .name = "Capture Source", |
| 6685 | .count = 1, |
| 6686 | .info = alc_mux_enum_info, |
| 6687 | .get = alc_mux_enum_get, |
| 6688 | .put = alc_mux_enum_put, |
| 6689 | }, |
| 6690 | { } /* end */ |
| 6691 | }; |
| 6692 | |
| 6693 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 6694 | /* output mixer control */ |
| 6695 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 6696 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 6697 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 6698 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 6699 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 6700 | |
| 6701 | /* Input mixer control */ |
| 6702 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 6703 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 6704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 6705 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 6706 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 6707 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 6708 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 6709 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 6710 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 6711 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
| 6712 | |
| 6713 | /* Capture mixer control */ |
| 6714 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6715 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6716 | { |
| 6717 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6718 | .name = "Capture Source", |
| 6719 | .count = 1, |
| 6720 | .info = alc_mux_enum_info, |
| 6721 | .get = alc_mux_enum_get, |
| 6722 | .put = alc_mux_enum_put, |
| 6723 | }, |
| 6724 | { |
| 6725 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6726 | .name = "Channel Mode", |
| 6727 | .info = alc_ch_mode_info, |
| 6728 | .get = alc_ch_mode_get, |
| 6729 | .put = alc_ch_mode_put, |
| 6730 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 6731 | }, |
| 6732 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 6733 | }; |
| 6734 | |
| 6735 | static snd_kcontrol_new_t alc861_toshiba_mixer[] = { |
| 6736 | /* output mixer control */ |
| 6737 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 6738 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 6739 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 6740 | |
| 6741 | /*Capture mixer control */ |
| 6742 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6743 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6744 | { |
| 6745 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6746 | .name = "Capture Source", |
| 6747 | .count = 1, |
| 6748 | .info = alc_mux_enum_info, |
| 6749 | .get = alc_mux_enum_get, |
| 6750 | .put = alc_mux_enum_put, |
| 6751 | }, |
| 6752 | |
| 6753 | { } /* end */ |
| 6754 | }; |
| 6755 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 6756 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 6757 | /* output mixer control */ |
| 6758 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 6759 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 6760 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 6761 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 6762 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 6763 | |
| 6764 | /* Input mixer control */ |
| 6765 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 6766 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 6767 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 6768 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 6769 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 6770 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 6771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 6772 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 6773 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 6774 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
| 6775 | |
| 6776 | /* Capture mixer control */ |
| 6777 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6778 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6779 | { |
| 6780 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6781 | .name = "Capture Source", |
| 6782 | .count = 1, |
| 6783 | .info = alc_mux_enum_info, |
| 6784 | .get = alc_mux_enum_get, |
| 6785 | .put = alc_mux_enum_put, |
| 6786 | }, |
| 6787 | { |
| 6788 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6789 | .name = "Channel Mode", |
| 6790 | .info = alc_ch_mode_info, |
| 6791 | .get = alc_ch_mode_get, |
| 6792 | .put = alc_ch_mode_put, |
| 6793 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 6794 | }, |
| 6795 | { } /* end */ |
| 6796 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6797 | |
| 6798 | /* |
| 6799 | * generic initialization of ADC, input mixers and output mixers |
| 6800 | */ |
| 6801 | static struct hda_verb alc861_base_init_verbs[] = { |
| 6802 | /* |
| 6803 | * Unmute ADC0 and set the default input to mic-in |
| 6804 | */ |
| 6805 | /* port-A for surround (rear panel) */ |
| 6806 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6807 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6808 | /* port-B for mic-in (rear panel) with vref */ |
| 6809 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6810 | /* port-C for line-in (rear panel) */ |
| 6811 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6812 | /* port-D for Front */ |
| 6813 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6814 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6815 | /* port-E for HP out (front panel) */ |
| 6816 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 6817 | /* route front PCM to HP */ |
| 6818 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6819 | /* port-F for mic-in (front panel) with vref */ |
| 6820 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6821 | /* port-G for CLFE (rear panel) */ |
| 6822 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6823 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6824 | /* port-H for side (rear panel) */ |
| 6825 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6826 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6827 | /* CD-in */ |
| 6828 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6829 | /* route front mic to ADC1*/ |
| 6830 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6831 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6832 | |
| 6833 | /* Unmute DAC0~3 & spdif out*/ |
| 6834 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6835 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6836 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6837 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6838 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6839 | |
| 6840 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 6841 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6842 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6843 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6844 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6845 | |
| 6846 | /* Unmute Stereo Mixer 15 */ |
| 6847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6848 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6849 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6850 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step |
| 6851 | |
| 6852 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6853 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6854 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6855 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6856 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6857 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6858 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6859 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6860 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) |
| 6861 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6862 | |
| 6863 | { } |
| 6864 | }; |
| 6865 | |
| 6866 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 6867 | /* |
| 6868 | * Unmute ADC0 and set the default input to mic-in |
| 6869 | */ |
| 6870 | /* port-A for surround (rear panel) */ |
| 6871 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6872 | /* port-B for mic-in (rear panel) with vref */ |
| 6873 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6874 | /* port-C for line-in (rear panel) */ |
| 6875 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6876 | /* port-D for Front */ |
| 6877 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6878 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6879 | /* port-E for HP out (front panel) */ |
| 6880 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 6881 | /* route front PCM to HP */ |
| 6882 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6883 | /* port-F for mic-in (front panel) with vref */ |
| 6884 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6885 | /* port-G for CLFE (rear panel) */ |
| 6886 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6887 | /* port-H for side (rear panel) */ |
| 6888 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6889 | /* CD-in */ |
| 6890 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6891 | /* route front mic to ADC1*/ |
| 6892 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6893 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6894 | /* Unmute DAC0~3 & spdif out*/ |
| 6895 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6896 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6897 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6898 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6900 | |
| 6901 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 6902 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6903 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6904 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6905 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6906 | |
| 6907 | /* Unmute Stereo Mixer 15 */ |
| 6908 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6909 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6910 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6911 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step |
| 6912 | |
| 6913 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6914 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6915 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6916 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6917 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6918 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6919 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6920 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6921 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) |
| 6922 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6923 | { } |
| 6924 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 6925 | |
| 6926 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 6927 | /* |
| 6928 | * Unmute ADC0 and set the default input to mic-in |
| 6929 | */ |
| 6930 | /* port-A for surround (rear panel) */ |
| 6931 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6932 | /* port-B for mic-in (rear panel) with vref */ |
| 6933 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6934 | /* port-C for line-in (rear panel) */ |
| 6935 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6936 | /* port-D for Front */ |
| 6937 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6938 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6939 | /* port-E for HP out (front panel) */ |
| 6940 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, // this has to be set to VREF80 |
| 6941 | /* route front PCM to HP */ |
| 6942 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6943 | /* port-F for mic-in (front panel) with vref */ |
| 6944 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6945 | /* port-G for CLFE (rear panel) */ |
| 6946 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6947 | /* port-H for side (rear panel) */ |
| 6948 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6949 | /* CD-in */ |
| 6950 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6951 | /* route front mic to ADC1*/ |
| 6952 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6953 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6954 | /* Unmute DAC0~3 & spdif out*/ |
| 6955 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6956 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6957 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6958 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6959 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6960 | |
| 6961 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 6962 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6963 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6964 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6965 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6966 | |
| 6967 | /* Unmute Stereo Mixer 15 */ |
| 6968 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6970 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6971 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step |
| 6972 | |
| 6973 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6974 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6975 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6976 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6977 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6978 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6979 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6980 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6981 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) |
| 6982 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6983 | { } |
| 6984 | }; |
| 6985 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6986 | /* |
| 6987 | * generic initialization of ADC, input mixers and output mixers |
| 6988 | */ |
| 6989 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 6990 | /* |
| 6991 | * Unmute ADC0 and set the default input to mic-in |
| 6992 | */ |
| 6993 | // {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6994 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6995 | |
| 6996 | /* Unmute DAC0~3 & spdif out*/ |
| 6997 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6998 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6999 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7000 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7001 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7002 | |
| 7003 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 7004 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7005 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7006 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7007 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7008 | |
| 7009 | /* Unmute Stereo Mixer 15 */ |
| 7010 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7011 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7012 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7013 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 7014 | |
| 7015 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7016 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7017 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7018 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7019 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7020 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7021 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7022 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7023 | |
| 7024 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7025 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7026 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7027 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7028 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7029 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7030 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7031 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7032 | |
| 7033 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, // set Mic 1 |
| 7034 | |
| 7035 | { } |
| 7036 | }; |
| 7037 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 7038 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 7039 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7040 | |
| 7041 | { } |
| 7042 | }; |
| 7043 | |
| 7044 | /* toggle speaker-output according to the hp-jack state */ |
| 7045 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 7046 | { |
| 7047 | unsigned int present; |
| 7048 | |
| 7049 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 7050 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7051 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, |
| 7052 | 0x80, present ? 0x80 : 0); |
| 7053 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, |
| 7054 | 0x80, present ? 0x80 : 0); |
| 7055 | snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3, |
| 7056 | 0x80, present ? 0 : 0x80); |
| 7057 | snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3, |
| 7058 | 0x80, present ? 0 : 0x80); |
| 7059 | } |
| 7060 | |
| 7061 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 7062 | unsigned int res) |
| 7063 | { |
| 7064 | /* Looks like the unsol event is incompatible with the standard |
| 7065 | * definition. 6bit tag is placed at 26 bit! |
| 7066 | */ |
| 7067 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7068 | alc861_toshiba_automute(codec); |
| 7069 | } |
| 7070 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7071 | /* pcm configuration: identiacal with ALC880 */ |
| 7072 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 7073 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 7074 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 7075 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 7076 | |
| 7077 | |
| 7078 | #define ALC861_DIGOUT_NID 0x07 |
| 7079 | |
| 7080 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 7081 | { 8, NULL } |
| 7082 | }; |
| 7083 | |
| 7084 | static hda_nid_t alc861_dac_nids[4] = { |
| 7085 | /* front, surround, clfe, side */ |
| 7086 | 0x03, 0x06, 0x05, 0x04 |
| 7087 | }; |
| 7088 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7089 | static hda_nid_t alc660_dac_nids[3] = { |
| 7090 | /* front, clfe, surround */ |
| 7091 | 0x03, 0x05, 0x06 |
| 7092 | }; |
| 7093 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7094 | static hda_nid_t alc861_adc_nids[1] = { |
| 7095 | /* ADC0-2 */ |
| 7096 | 0x08, |
| 7097 | }; |
| 7098 | |
| 7099 | static struct hda_input_mux alc861_capture_source = { |
| 7100 | .num_items = 5, |
| 7101 | .items = { |
| 7102 | { "Mic", 0x0 }, |
| 7103 | { "Front Mic", 0x3 }, |
| 7104 | { "Line", 0x1 }, |
| 7105 | { "CD", 0x4 }, |
| 7106 | { "Mixer", 0x5 }, |
| 7107 | }, |
| 7108 | }; |
| 7109 | |
| 7110 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 7111 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pin_cfg *cfg) |
| 7112 | { |
| 7113 | int i; |
| 7114 | hda_nid_t nid; |
| 7115 | |
| 7116 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 7117 | for (i = 0; i < cfg->line_outs; i++) { |
| 7118 | nid = cfg->line_out_pins[i]; |
| 7119 | if (nid) { |
| 7120 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 7121 | continue; |
| 7122 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 7123 | } |
| 7124 | } |
| 7125 | spec->multiout.num_dacs = cfg->line_outs; |
| 7126 | return 0; |
| 7127 | } |
| 7128 | |
| 7129 | /* add playback controls from the parsed DAC table */ |
| 7130 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7131 | const struct auto_pin_cfg *cfg) |
| 7132 | { |
| 7133 | char name[32]; |
| 7134 | static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; |
| 7135 | hda_nid_t nid; |
| 7136 | int i, idx, err; |
| 7137 | |
| 7138 | for (i = 0; i < cfg->line_outs; i++) { |
| 7139 | nid = spec->multiout.dac_nids[i]; |
| 7140 | if (! nid) |
| 7141 | continue; |
| 7142 | if (nid == 0x05) { |
| 7143 | /* Center/LFE */ |
| 7144 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "Center Playback Switch", |
| 7145 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) |
| 7146 | return err; |
| 7147 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "LFE Playback Switch", |
| 7148 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 7149 | return err; |
| 7150 | } else { |
| 7151 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; idx++) |
| 7152 | if (nid == alc861_dac_nids[idx]) |
| 7153 | break; |
| 7154 | sprintf(name, "%s Playback Switch", chname[idx]); |
| 7155 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 7156 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 7157 | return err; |
| 7158 | } |
| 7159 | } |
| 7160 | return 0; |
| 7161 | } |
| 7162 | |
| 7163 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 7164 | { |
| 7165 | int err; |
| 7166 | hda_nid_t nid; |
| 7167 | |
| 7168 | if (! pin) |
| 7169 | return 0; |
| 7170 | |
| 7171 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 7172 | nid = 0x03; |
| 7173 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", |
| 7174 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 7175 | return err; |
| 7176 | spec->multiout.hp_nid = nid; |
| 7177 | } |
| 7178 | return 0; |
| 7179 | } |
| 7180 | |
| 7181 | /* create playback/capture controls for input pins */ |
| 7182 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) |
| 7183 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7184 | struct hda_input_mux *imux = &spec->private_imux; |
| 7185 | int i, err, idx, idx1; |
| 7186 | |
| 7187 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7188 | switch(cfg->input_pins[i]) { |
| 7189 | case 0x0c: |
| 7190 | idx1 = 1; |
| 7191 | idx = 2; // Line In |
| 7192 | break; |
| 7193 | case 0x0f: |
| 7194 | idx1 = 2; |
| 7195 | idx = 2; // Line In |
| 7196 | break; |
| 7197 | case 0x0d: |
| 7198 | idx1 = 0; |
| 7199 | idx = 1; // Mic In |
| 7200 | break; |
| 7201 | case 0x10: |
| 7202 | idx1 = 3; |
| 7203 | idx = 1; // Mic In |
| 7204 | break; |
| 7205 | case 0x11: |
| 7206 | idx1 = 4; |
| 7207 | idx = 0; // CD |
| 7208 | break; |
| 7209 | default: |
| 7210 | continue; |
| 7211 | } |
| 7212 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7213 | err = new_analog_input(spec, cfg->input_pins[i], |
| 7214 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7215 | if (err < 0) |
| 7216 | return err; |
| 7217 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7218 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7219 | imux->items[imux->num_items].index = idx1; |
| 7220 | imux->num_items++; |
| 7221 | } |
| 7222 | return 0; |
| 7223 | } |
| 7224 | |
| 7225 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 7226 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7227 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7228 | |
| 7229 | { |
| 7230 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7231 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7232 | * So call somewhat different.. |
| 7233 | *FIXME: the controls appear in the "playback" view! |
| 7234 | */ |
| 7235 | /* .name = "Capture Source", */ |
| 7236 | .name = "Input Source", |
| 7237 | .count = 1, |
| 7238 | .info = alc_mux_enum_info, |
| 7239 | .get = alc_mux_enum_get, |
| 7240 | .put = alc_mux_enum_put, |
| 7241 | }, |
| 7242 | { } /* end */ |
| 7243 | }; |
| 7244 | |
| 7245 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, hda_nid_t nid, |
| 7246 | int pin_type, int dac_idx) |
| 7247 | { |
| 7248 | /* set as output */ |
| 7249 | |
| 7250 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 7251 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 7252 | |
| 7253 | } |
| 7254 | |
| 7255 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 7256 | { |
| 7257 | struct alc_spec *spec = codec->spec; |
| 7258 | int i; |
| 7259 | |
| 7260 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 7261 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 7262 | if (nid) |
| 7263 | alc861_auto_set_output_and_unmute(codec, nid, PIN_OUT, spec->multiout.dac_nids[i]); |
| 7264 | } |
| 7265 | } |
| 7266 | |
| 7267 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 7268 | { |
| 7269 | struct alc_spec *spec = codec->spec; |
| 7270 | hda_nid_t pin; |
| 7271 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7272 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7273 | if (pin) /* connect to front */ |
| 7274 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, spec->multiout.dac_nids[0]); |
| 7275 | } |
| 7276 | |
| 7277 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 7278 | { |
| 7279 | struct alc_spec *spec = codec->spec; |
| 7280 | int i; |
| 7281 | |
| 7282 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7283 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 7284 | if ((nid>=0x0c) && (nid <=0x11)) { |
| 7285 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7286 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); |
| 7287 | } |
| 7288 | } |
| 7289 | } |
| 7290 | |
| 7291 | /* parse the BIOS configuration and set up the alc_spec */ |
| 7292 | /* return 1 if successful, 0 if the proper config is not found, or a negative error code */ |
| 7293 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 7294 | { |
| 7295 | struct alc_spec *spec = codec->spec; |
| 7296 | int err; |
| 7297 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 7298 | |
| 7299 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7300 | alc861_ignore)) < 0) |
| 7301 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7302 | if (! spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7303 | return 0; /* can't find valid BIOS pin config */ |
| 7304 | |
| 7305 | if ((err = alc861_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || |
| 7306 | (err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7307 | (err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0])) < 0 || |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7308 | (err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
| 7309 | return err; |
| 7310 | |
| 7311 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 7312 | |
| 7313 | if (spec->autocfg.dig_out_pin) |
| 7314 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 7315 | |
| 7316 | if (spec->kctl_alloc) |
| 7317 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 7318 | |
| 7319 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 7320 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7321 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7322 | spec->input_mux = &spec->private_imux; |
| 7323 | |
| 7324 | spec->adc_nids = alc861_adc_nids; |
| 7325 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 7326 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 7327 | spec->num_mixers++; |
| 7328 | |
| 7329 | return 1; |
| 7330 | } |
| 7331 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7332 | /* additional initialization for auto-configuration model */ |
| 7333 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7334 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7335 | alc861_auto_init_multi_out(codec); |
| 7336 | alc861_auto_init_hp_out(codec); |
| 7337 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7338 | } |
| 7339 | |
| 7340 | |
| 7341 | /* |
| 7342 | * configuration and preset |
| 7343 | */ |
| 7344 | static struct hda_board_config alc861_cfg_tbl[] = { |
| 7345 | { .modelname = "3stack", .config = ALC861_3ST }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7346 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd600, |
| 7347 | .config = ALC861_3ST }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7348 | { .modelname = "3stack-660", .config = ALC660_3ST }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7349 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x81e7, |
| 7350 | .config = ALC660_3ST }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7351 | { .modelname = "3stack-dig", .config = ALC861_3ST_DIG }, |
| 7352 | { .modelname = "6stack-dig", .config = ALC861_6ST_DIG }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 7353 | { .modelname = "uniwill-m31", .config = ALC861_UNIWILL_M31}, |
| 7354 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9072, |
| 7355 | .config = ALC861_UNIWILL_M31 }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 7356 | { .modelname = "toshiba", .config = ALC861_TOSHIBA }, |
| 7357 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1338, |
| 7358 | .config = ALC861_TOSHIBA }, |
| 7359 | { .pci_subvendor = 0x1179, .pci_subdevice = 0xff10, |
| 7360 | .config = ALC861_TOSHIBA }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7361 | { .modelname = "auto", .config = ALC861_AUTO }, |
| 7362 | {} |
| 7363 | }; |
| 7364 | |
| 7365 | static struct alc_config_preset alc861_presets[] = { |
| 7366 | [ALC861_3ST] = { |
| 7367 | .mixers = { alc861_3ST_mixer }, |
| 7368 | .init_verbs = { alc861_threestack_init_verbs }, |
| 7369 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7370 | .dac_nids = alc861_dac_nids, |
| 7371 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 7372 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7373 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7374 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7375 | .adc_nids = alc861_adc_nids, |
| 7376 | .input_mux = &alc861_capture_source, |
| 7377 | }, |
| 7378 | [ALC861_3ST_DIG] = { |
| 7379 | .mixers = { alc861_base_mixer }, |
| 7380 | .init_verbs = { alc861_threestack_init_verbs }, |
| 7381 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7382 | .dac_nids = alc861_dac_nids, |
| 7383 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 7384 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 7385 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7386 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7387 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7388 | .adc_nids = alc861_adc_nids, |
| 7389 | .input_mux = &alc861_capture_source, |
| 7390 | }, |
| 7391 | [ALC861_6ST_DIG] = { |
| 7392 | .mixers = { alc861_base_mixer }, |
| 7393 | .init_verbs = { alc861_base_init_verbs }, |
| 7394 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7395 | .dac_nids = alc861_dac_nids, |
| 7396 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 7397 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 7398 | .channel_mode = alc861_8ch_modes, |
| 7399 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7400 | .adc_nids = alc861_adc_nids, |
| 7401 | .input_mux = &alc861_capture_source, |
| 7402 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7403 | [ALC660_3ST] = { |
| 7404 | .mixers = { alc861_3ST_mixer }, |
| 7405 | .init_verbs = { alc861_threestack_init_verbs }, |
| 7406 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 7407 | .dac_nids = alc660_dac_nids, |
| 7408 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 7409 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7410 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7411 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7412 | .adc_nids = alc861_adc_nids, |
| 7413 | .input_mux = &alc861_capture_source, |
| 7414 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 7415 | [ALC861_UNIWILL_M31] = { |
| 7416 | .mixers = { alc861_uniwill_m31_mixer }, |
| 7417 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 7418 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7419 | .dac_nids = alc861_dac_nids, |
| 7420 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 7421 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 7422 | .channel_mode = alc861_uniwill_m31_modes, |
| 7423 | .need_dac_fix = 1, |
| 7424 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7425 | .adc_nids = alc861_adc_nids, |
| 7426 | .input_mux = &alc861_capture_source, |
| 7427 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 7428 | [ALC861_TOSHIBA] = { |
| 7429 | .mixers = { alc861_toshiba_mixer }, |
| 7430 | .init_verbs = { alc861_base_init_verbs, alc861_toshiba_init_verbs }, |
| 7431 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7432 | .dac_nids = alc861_dac_nids, |
| 7433 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7434 | .channel_mode = alc883_3ST_2ch_modes, |
| 7435 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7436 | .adc_nids = alc861_adc_nids, |
| 7437 | .input_mux = &alc861_capture_source, |
| 7438 | .unsol_event = alc861_toshiba_unsol_event, |
| 7439 | .init_hook = alc861_toshiba_automute, |
| 7440 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7441 | }; |
| 7442 | |
| 7443 | |
| 7444 | static int patch_alc861(struct hda_codec *codec) |
| 7445 | { |
| 7446 | struct alc_spec *spec; |
| 7447 | int board_config; |
| 7448 | int err; |
| 7449 | |
| 7450 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 7451 | if (spec == NULL) |
| 7452 | return -ENOMEM; |
| 7453 | |
| 7454 | codec->spec = spec; |
| 7455 | |
| 7456 | board_config = snd_hda_check_board_config(codec, alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7457 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7458 | if (board_config < 0 || board_config >= ALC861_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7459 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 7460 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7461 | board_config = ALC861_AUTO; |
| 7462 | } |
| 7463 | |
| 7464 | if (board_config == ALC861_AUTO) { |
| 7465 | /* automatic parse from the BIOS config */ |
| 7466 | err = alc861_parse_auto_config(codec); |
| 7467 | if (err < 0) { |
| 7468 | alc_free(codec); |
| 7469 | return err; |
| 7470 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7471 | printk(KERN_INFO |
| 7472 | "hda_codec: Cannot set up configuration " |
| 7473 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7474 | board_config = ALC861_3ST_DIG; |
| 7475 | } |
| 7476 | } |
| 7477 | |
| 7478 | if (board_config != ALC861_AUTO) |
| 7479 | setup_preset(spec, &alc861_presets[board_config]); |
| 7480 | |
| 7481 | spec->stream_name_analog = "ALC861 Analog"; |
| 7482 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 7483 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 7484 | |
| 7485 | spec->stream_name_digital = "ALC861 Digital"; |
| 7486 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 7487 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 7488 | |
| 7489 | codec->patch_ops = alc_patch_ops; |
| 7490 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7491 | spec->init_hook = alc861_auto_init; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7492 | |
| 7493 | return 0; |
| 7494 | } |
| 7495 | |
| 7496 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7497 | * patch entries |
| 7498 | */ |
| 7499 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 7500 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7501 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7502 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
| 7503 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7504 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7505 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7506 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
| 7507 | { .id = 0x10ec0861, .rev = 0x100300, .name = "ALC861", |
| 7508 | .patch = patch_alc861 }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 7509 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7510 | .patch = patch_alc861 }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame^] | 7511 | { .id = 0x10ec0660, .name = "ALC660", .patch = patch_alc861 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7512 | {} /* terminator */ |
| 7513 | }; |