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, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame^] | 103 | ALC861_ASUS, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 104 | ALC861_AUTO, |
| 105 | ALC861_MODEL_LAST, |
| 106 | }; |
| 107 | |
| 108 | /* ALC882 models */ |
| 109 | enum { |
| 110 | ALC882_3ST_DIG, |
| 111 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 112 | ALC882_ARIMA, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 113 | ALC882_AUTO, |
| 114 | ALC882_MODEL_LAST, |
| 115 | }; |
| 116 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 117 | /* ALC883 models */ |
| 118 | enum { |
| 119 | ALC883_3ST_2ch_DIG, |
| 120 | ALC883_3ST_6ch_DIG, |
| 121 | ALC883_3ST_6ch, |
| 122 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 123 | ALC883_TARGA_DIG, |
| 124 | ALC883_TARGA_2ch_DIG, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 125 | ALC888_DEMO_BOARD, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 126 | ALC883_ACER, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 127 | ALC883_MEDION, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 128 | ALC883_AUTO, |
| 129 | ALC883_MODEL_LAST, |
| 130 | }; |
| 131 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 132 | /* for GPIO Poll */ |
| 133 | #define GPIO_MASK 0x03 |
| 134 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | struct alc_spec { |
| 136 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 137 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | unsigned int num_mixers; |
| 139 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 140 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 141 | * don't forget NULL |
| 142 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 143 | */ |
| 144 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 146 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | struct hda_pcm_stream *stream_analog_playback; |
| 148 | struct hda_pcm_stream *stream_analog_capture; |
| 149 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 150 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | struct hda_pcm_stream *stream_digital_playback; |
| 152 | struct hda_pcm_stream *stream_digital_capture; |
| 153 | |
| 154 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 155 | struct hda_multi_out multiout; /* playback set-up |
| 156 | * max_channels, dacs must be set |
| 157 | * dig_out_nid and hp_nid are optional |
| 158 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | |
| 160 | /* capture */ |
| 161 | unsigned int num_adc_nids; |
| 162 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 163 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | |
| 165 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 166 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | const struct hda_input_mux *input_mux; |
| 168 | unsigned int cur_mux[3]; |
| 169 | |
| 170 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 171 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 173 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | |
| 175 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 176 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 177 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 178 | /* dynamic controls, init_verbs and input_mux */ |
| 179 | struct auto_pin_cfg autocfg; |
| 180 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 181 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 182 | struct hda_input_mux private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 183 | hda_nid_t private_dac_nids[5]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 184 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 185 | /* hooks */ |
| 186 | void (*init_hook)(struct hda_codec *codec); |
| 187 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 188 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 189 | /* for pin sensing */ |
| 190 | unsigned int sense_updated: 1; |
| 191 | unsigned int jack_present: 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 192 | }; |
| 193 | |
| 194 | /* |
| 195 | * configuration template - to be copied to the spec instance |
| 196 | */ |
| 197 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 198 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 199 | * with spec |
| 200 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 201 | const struct hda_verb *init_verbs[5]; |
| 202 | unsigned int num_dacs; |
| 203 | hda_nid_t *dac_nids; |
| 204 | hda_nid_t dig_out_nid; /* optional */ |
| 205 | hda_nid_t hp_nid; /* optional */ |
| 206 | unsigned int num_adc_nids; |
| 207 | hda_nid_t *adc_nids; |
| 208 | hda_nid_t dig_in_nid; |
| 209 | unsigned int num_channel_mode; |
| 210 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 211 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 212 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 213 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 214 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 215 | void (*init_hook)(struct hda_codec *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | }; |
| 217 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | |
| 219 | /* |
| 220 | * input MUX handling |
| 221 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 222 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 223 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | { |
| 225 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 226 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 227 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 228 | if (mux_idx >= spec->num_mux_defs) |
| 229 | mux_idx = 0; |
| 230 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | } |
| 232 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 233 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 234 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | { |
| 236 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 237 | struct alc_spec *spec = codec->spec; |
| 238 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 239 | |
| 240 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 241 | return 0; |
| 242 | } |
| 243 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 244 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 245 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | { |
| 247 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 248 | struct alc_spec *spec = codec->spec; |
| 249 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 250 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 251 | 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] | 252 | spec->adc_nids[adc_idx], |
| 253 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | } |
| 255 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 256 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | /* |
| 258 | * channel mode setting |
| 259 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 260 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 261 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | { |
| 263 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 264 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 265 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 266 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | } |
| 268 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 269 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 270 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | { |
| 272 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 273 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 274 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 275 | spec->num_channel_mode, |
| 276 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | } |
| 278 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 279 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 280 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | { |
| 282 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 283 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 284 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 285 | spec->num_channel_mode, |
| 286 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 287 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 288 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 289 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | } |
| 291 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 293 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 294 | * instead of "%" to avoid consequences of accidently treating the % as |
| 295 | * being part of a format specifier. Maximum allowed length of a value is |
| 296 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 297 | * |
| 298 | * Note: some retasking pin complexes seem to ignore requests for input |
| 299 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 300 | * are requested. Therefore order this list so that this behaviour will not |
| 301 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 302 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 303 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 304 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 305 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 306 | "Mic 50pc bias", "Mic 80pc bias", |
| 307 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 308 | }; |
| 309 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 310 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 311 | }; |
| 312 | /* 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] | 313 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 314 | * addition, "input" pins may or may not process the mic bias option |
| 315 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 316 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 317 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 318 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 319 | #define ALC_PIN_DIR_IN 0x00 |
| 320 | #define ALC_PIN_DIR_OUT 0x01 |
| 321 | #define ALC_PIN_DIR_INOUT 0x02 |
| 322 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 323 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 324 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 325 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 326 | * For each direction the minimum and maximum values are given. |
| 327 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 328 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 329 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 330 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 331 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 332 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 333 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 334 | }; |
| 335 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 336 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 337 | #define alc_pin_mode_n_items(_dir) \ |
| 338 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 339 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 340 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 341 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 342 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 343 | unsigned int item_num = uinfo->value.enumerated.item; |
| 344 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 345 | |
| 346 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 347 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 348 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 349 | |
| 350 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 351 | item_num = alc_pin_mode_min(dir); |
| 352 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 353 | return 0; |
| 354 | } |
| 355 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 356 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 357 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 358 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 359 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 360 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 361 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 362 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 363 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 364 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 365 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 366 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 367 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 368 | /* Find enumerated value for current pinctl setting */ |
| 369 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 370 | 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] | 371 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 372 | *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] | 373 | return 0; |
| 374 | } |
| 375 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 376 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 377 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 378 | { |
| 379 | signed int change; |
| 380 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 381 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 382 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 383 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 384 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 385 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 386 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 387 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 388 | 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] | 389 | val = alc_pin_mode_min(dir); |
| 390 | |
| 391 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 392 | if (change) { |
| 393 | /* Set pin mode to that requested */ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 394 | 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] | 395 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 396 | |
| 397 | /* Also enable the retasking pin's input/output as required |
| 398 | * for the requested pin mode. Enum values of 2 or less are |
| 399 | * input modes. |
| 400 | * |
| 401 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 402 | * reduces noise slightly (particularly on input) so we'll |
| 403 | * do it. However, having both input and output buffers |
| 404 | * enabled simultaneously doesn't seem to be problematic if |
| 405 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 406 | */ |
| 407 | if (val <= 2) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 408 | snd_hda_codec_write(codec, nid, 0, |
| 409 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 410 | AMP_OUT_MUTE); |
| 411 | snd_hda_codec_write(codec, nid, 0, |
| 412 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 413 | AMP_IN_UNMUTE(0)); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 414 | } else { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 415 | snd_hda_codec_write(codec, nid, 0, |
| 416 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 417 | AMP_IN_MUTE(0)); |
| 418 | snd_hda_codec_write(codec, nid, 0, |
| 419 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 420 | AMP_OUT_UNMUTE); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 421 | } |
| 422 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 423 | return change; |
| 424 | } |
| 425 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 426 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 427 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 428 | .info = alc_pin_mode_info, \ |
| 429 | .get = alc_pin_mode_get, \ |
| 430 | .put = alc_pin_mode_put, \ |
| 431 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 432 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 433 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 434 | * together using a mask with more than one bit set. This control is |
| 435 | * currently used only by the ALC260 test model. At this stage they are not |
| 436 | * needed for any "production" models. |
| 437 | */ |
| 438 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 439 | static int alc_gpio_data_info(struct snd_kcontrol *kcontrol, |
| 440 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 441 | { |
| 442 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 443 | uinfo->count = 1; |
| 444 | uinfo->value.integer.min = 0; |
| 445 | uinfo->value.integer.max = 1; |
| 446 | return 0; |
| 447 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 448 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 449 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 450 | { |
| 451 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 452 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 453 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 454 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 455 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 456 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 457 | |
| 458 | *valp = (val & mask) != 0; |
| 459 | return 0; |
| 460 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 461 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 462 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 463 | { |
| 464 | signed int change; |
| 465 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 466 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 467 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 468 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 469 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 470 | AC_VERB_GET_GPIO_DATA, |
| 471 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 472 | |
| 473 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 474 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 475 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 476 | gpio_data &= ~mask; |
| 477 | else |
| 478 | gpio_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 479 | 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] | 480 | |
| 481 | return change; |
| 482 | } |
| 483 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 484 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 485 | .info = alc_gpio_data_info, \ |
| 486 | .get = alc_gpio_data_get, \ |
| 487 | .put = alc_gpio_data_put, \ |
| 488 | .private_value = nid | (mask<<16) } |
| 489 | #endif /* CONFIG_SND_DEBUG */ |
| 490 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 491 | /* A switch control to allow the enabling of the digital IO pins on the |
| 492 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 493 | * to provide something in the test model allowing digital outputs to be |
| 494 | * identified if present. If models are found which can utilise these |
| 495 | * outputs a more complete mixer control can be devised for those models if |
| 496 | * necessary. |
| 497 | */ |
| 498 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 499 | static int alc_spdif_ctrl_info(struct snd_kcontrol *kcontrol, |
| 500 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 501 | { |
| 502 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 503 | uinfo->count = 1; |
| 504 | uinfo->value.integer.min = 0; |
| 505 | uinfo->value.integer.max = 1; |
| 506 | return 0; |
| 507 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 508 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 509 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 510 | { |
| 511 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 512 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 513 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 514 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 515 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 516 | AC_VERB_GET_DIGI_CONVERT, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 517 | |
| 518 | *valp = (val & mask) != 0; |
| 519 | return 0; |
| 520 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 521 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 522 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 523 | { |
| 524 | signed int change; |
| 525 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 526 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 527 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 528 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 529 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 530 | AC_VERB_GET_DIGI_CONVERT, |
| 531 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 532 | |
| 533 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 534 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 535 | if (val==0) |
| 536 | ctrl_data &= ~mask; |
| 537 | else |
| 538 | ctrl_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 539 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 540 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 541 | |
| 542 | return change; |
| 543 | } |
| 544 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 545 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 546 | .info = alc_spdif_ctrl_info, \ |
| 547 | .get = alc_spdif_ctrl_get, \ |
| 548 | .put = alc_spdif_ctrl_put, \ |
| 549 | .private_value = nid | (mask<<16) } |
| 550 | #endif /* CONFIG_SND_DEBUG */ |
| 551 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 552 | /* |
| 553 | * set up from the preset table |
| 554 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | static void setup_preset(struct alc_spec *spec, |
| 556 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 557 | { |
| 558 | int i; |
| 559 | |
| 560 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 561 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 562 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 563 | i++) |
| 564 | spec->init_verbs[spec->num_init_verbs++] = |
| 565 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 566 | |
| 567 | spec->channel_mode = preset->channel_mode; |
| 568 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 569 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 570 | |
| 571 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 572 | |
| 573 | spec->multiout.num_dacs = preset->num_dacs; |
| 574 | spec->multiout.dac_nids = preset->dac_nids; |
| 575 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 576 | spec->multiout.hp_nid = preset->hp_nid; |
| 577 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 578 | spec->num_mux_defs = preset->num_mux_defs; |
| 579 | if (! spec->num_mux_defs) |
| 580 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 581 | spec->input_mux = preset->input_mux; |
| 582 | |
| 583 | spec->num_adc_nids = preset->num_adc_nids; |
| 584 | spec->adc_nids = preset->adc_nids; |
| 585 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 586 | |
| 587 | spec->unsol_event = preset->unsol_event; |
| 588 | spec->init_hook = preset->init_hook; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 589 | } |
| 590 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 591 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 592 | * ALC880 3-stack model |
| 593 | * |
| 594 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 595 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 596 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | */ |
| 598 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 599 | static hda_nid_t alc880_dac_nids[4] = { |
| 600 | /* front, rear, clfe, rear_surr */ |
| 601 | 0x02, 0x05, 0x04, 0x03 |
| 602 | }; |
| 603 | |
| 604 | static hda_nid_t alc880_adc_nids[3] = { |
| 605 | /* ADC0-2 */ |
| 606 | 0x07, 0x08, 0x09, |
| 607 | }; |
| 608 | |
| 609 | /* The datasheet says the node 0x07 is connected from inputs, |
| 610 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 611 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 612 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 613 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 614 | /* ADC1-2 */ |
| 615 | 0x08, 0x09, |
| 616 | }; |
| 617 | |
| 618 | #define ALC880_DIGOUT_NID 0x06 |
| 619 | #define ALC880_DIGIN_NID 0x0a |
| 620 | |
| 621 | static struct hda_input_mux alc880_capture_source = { |
| 622 | .num_items = 4, |
| 623 | .items = { |
| 624 | { "Mic", 0x0 }, |
| 625 | { "Front Mic", 0x3 }, |
| 626 | { "Line", 0x2 }, |
| 627 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 629 | }; |
| 630 | |
| 631 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 632 | /* 2ch mode */ |
| 633 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 634 | /* set line-in to input, mute it */ |
| 635 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 636 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 637 | /* set mic-in to input vref 80%, mute it */ |
| 638 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 639 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | { } /* end */ |
| 641 | }; |
| 642 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 643 | /* 6ch mode */ |
| 644 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 645 | /* set line-in to output, unmute it */ |
| 646 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 647 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 648 | /* set mic-in to output, unmute it */ |
| 649 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 650 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 651 | { } /* end */ |
| 652 | }; |
| 653 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 654 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 655 | { 2, alc880_threestack_ch2_init }, |
| 656 | { 6, alc880_threestack_ch6_init }, |
| 657 | }; |
| 658 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 659 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 660 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 661 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 662 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 663 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 664 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 665 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 666 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 667 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 668 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 669 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 670 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 671 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 674 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 675 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 676 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 677 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 678 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 679 | { |
| 680 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 681 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 682 | .info = alc_ch_mode_info, |
| 683 | .get = alc_ch_mode_get, |
| 684 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 685 | }, |
| 686 | { } /* end */ |
| 687 | }; |
| 688 | |
| 689 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 690 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 691 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 692 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 693 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 694 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 695 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 696 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 697 | { |
| 698 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 699 | /* The multiple "Capture Source" controls confuse alsamixer |
| 700 | * So call somewhat different.. |
| 701 | * FIXME: the controls appear in the "playback" view! |
| 702 | */ |
| 703 | /* .name = "Capture Source", */ |
| 704 | .name = "Input Source", |
| 705 | .count = 3, |
| 706 | .info = alc_mux_enum_info, |
| 707 | .get = alc_mux_enum_get, |
| 708 | .put = alc_mux_enum_put, |
| 709 | }, |
| 710 | { } /* end */ |
| 711 | }; |
| 712 | |
| 713 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 714 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 715 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 716 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 717 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 718 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | { |
| 720 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 721 | /* The multiple "Capture Source" controls confuse alsamixer |
| 722 | * So call somewhat different.. |
| 723 | * FIXME: the controls appear in the "playback" view! |
| 724 | */ |
| 725 | /* .name = "Capture Source", */ |
| 726 | .name = "Input Source", |
| 727 | .count = 2, |
| 728 | .info = alc_mux_enum_info, |
| 729 | .get = alc_mux_enum_get, |
| 730 | .put = alc_mux_enum_put, |
| 731 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 732 | { } /* end */ |
| 733 | }; |
| 734 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 735 | |
| 736 | |
| 737 | /* |
| 738 | * ALC880 5-stack model |
| 739 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 740 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 741 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 742 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 743 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 744 | */ |
| 745 | |
| 746 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 747 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 748 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 749 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 750 | { } /* end */ |
| 751 | }; |
| 752 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 753 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 754 | /* 6ch mode */ |
| 755 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 756 | /* set line-in to input, mute it */ |
| 757 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 758 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 759 | { } /* end */ |
| 760 | }; |
| 761 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 762 | /* 8ch mode */ |
| 763 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 764 | /* set line-in to output, unmute it */ |
| 765 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 766 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 767 | { } /* end */ |
| 768 | }; |
| 769 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 770 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 771 | { 6, alc880_fivestack_ch6_init }, |
| 772 | { 8, alc880_fivestack_ch8_init }, |
| 773 | }; |
| 774 | |
| 775 | |
| 776 | /* |
| 777 | * ALC880 6-stack model |
| 778 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 779 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 780 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 781 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 782 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 783 | */ |
| 784 | |
| 785 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 786 | /* front, rear, clfe, rear_surr */ |
| 787 | 0x02, 0x03, 0x04, 0x05 |
| 788 | }; |
| 789 | |
| 790 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 791 | .num_items = 4, |
| 792 | .items = { |
| 793 | { "Mic", 0x0 }, |
| 794 | { "Front Mic", 0x1 }, |
| 795 | { "Line", 0x2 }, |
| 796 | { "CD", 0x4 }, |
| 797 | }, |
| 798 | }; |
| 799 | |
| 800 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 801 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 802 | { 8, NULL }, |
| 803 | }; |
| 804 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 805 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 806 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 807 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 808 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 809 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 810 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 811 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 812 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 813 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 814 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 815 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 816 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 817 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 819 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 820 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 822 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 823 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 824 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 825 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 826 | { |
| 827 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 828 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 829 | .info = alc_ch_mode_info, |
| 830 | .get = alc_ch_mode_get, |
| 831 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 832 | }, |
| 833 | { } /* end */ |
| 834 | }; |
| 835 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 836 | |
| 837 | /* |
| 838 | * ALC880 W810 model |
| 839 | * |
| 840 | * W810 has rear IO for: |
| 841 | * Front (DAC 02) |
| 842 | * Surround (DAC 03) |
| 843 | * Center/LFE (DAC 04) |
| 844 | * Digital out (06) |
| 845 | * |
| 846 | * The system also has a pair of internal speakers, and a headphone jack. |
| 847 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 848 | * |
| 849 | * There is a variable resistor to control the speaker or headphone |
| 850 | * volume. This is a hardware-only device without a software API. |
| 851 | * |
| 852 | * Plugging headphones in will disable the internal speakers. This is |
| 853 | * implemented in hardware, not via the driver using jack sense. In |
| 854 | * a similar fashion, plugging into the rear socket marked "front" will |
| 855 | * disable both the speakers and headphones. |
| 856 | * |
| 857 | * For input, there's a microphone jack, and an "audio in" jack. |
| 858 | * These may not do anything useful with this driver yet, because I |
| 859 | * haven't setup any initialization verbs for these yet... |
| 860 | */ |
| 861 | |
| 862 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 863 | /* front, rear/surround, clfe */ |
| 864 | 0x02, 0x03, 0x04 |
| 865 | }; |
| 866 | |
| 867 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 868 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 869 | { 6, NULL } |
| 870 | }; |
| 871 | |
| 872 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 873 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 874 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 875 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 876 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 877 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 878 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 879 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 880 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 881 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 882 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 883 | { } /* end */ |
| 884 | }; |
| 885 | |
| 886 | |
| 887 | /* |
| 888 | * Z710V model |
| 889 | * |
| 890 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 891 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 892 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 893 | */ |
| 894 | |
| 895 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 896 | 0x02 |
| 897 | }; |
| 898 | #define ALC880_Z71V_HP_DAC 0x03 |
| 899 | |
| 900 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 901 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 902 | { 2, NULL } |
| 903 | }; |
| 904 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 905 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 906 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 907 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 908 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 909 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 910 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 911 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 914 | { } /* end */ |
| 915 | }; |
| 916 | |
| 917 | |
| 918 | /* FIXME! */ |
| 919 | /* |
| 920 | * ALC880 F1734 model |
| 921 | * |
| 922 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 923 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 924 | */ |
| 925 | |
| 926 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 927 | 0x03 |
| 928 | }; |
| 929 | #define ALC880_F1734_HP_DAC 0x02 |
| 930 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 931 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 932 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 933 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 934 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 935 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 936 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 937 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 939 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 940 | { } /* end */ |
| 941 | }; |
| 942 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 943 | |
| 944 | /* FIXME! */ |
| 945 | /* |
| 946 | * ALC880 ASUS model |
| 947 | * |
| 948 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 949 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 950 | * Mic = 0x18, Line = 0x1a |
| 951 | */ |
| 952 | |
| 953 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 954 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 955 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 956 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 957 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 958 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 959 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 960 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 961 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 962 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 963 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 964 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 965 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 966 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 968 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 971 | { |
| 972 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 973 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 974 | .info = alc_ch_mode_info, |
| 975 | .get = alc_ch_mode_get, |
| 976 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 977 | }, |
| 978 | { } /* end */ |
| 979 | }; |
| 980 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 981 | /* FIXME! */ |
| 982 | /* |
| 983 | * ALC880 ASUS W1V model |
| 984 | * |
| 985 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 986 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 987 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 988 | */ |
| 989 | |
| 990 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 991 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 992 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 993 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 994 | { } /* end */ |
| 995 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 996 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 997 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 998 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 999 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1000 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1001 | { } /* end */ |
| 1002 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1003 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1004 | /* TCL S700 */ |
| 1005 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1007 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1008 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1009 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1010 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1013 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1014 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1015 | { |
| 1016 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1017 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1018 | * So call somewhat different.. |
| 1019 | * FIXME: the controls appear in the "playback" view! |
| 1020 | */ |
| 1021 | /* .name = "Capture Source", */ |
| 1022 | .name = "Input Source", |
| 1023 | .count = 1, |
| 1024 | .info = alc_mux_enum_info, |
| 1025 | .get = alc_mux_enum_get, |
| 1026 | .put = alc_mux_enum_put, |
| 1027 | }, |
| 1028 | { } /* end */ |
| 1029 | }; |
| 1030 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1031 | /* Uniwill */ |
| 1032 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
| 1033 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1034 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1035 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1036 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1037 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1038 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1039 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1040 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1041 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1042 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1043 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1044 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1047 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1048 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1049 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1050 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1051 | { |
| 1052 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1053 | .name = "Channel Mode", |
| 1054 | .info = alc_ch_mode_info, |
| 1055 | .get = alc_ch_mode_get, |
| 1056 | .put = alc_ch_mode_put, |
| 1057 | }, |
| 1058 | { } /* end */ |
| 1059 | }; |
| 1060 | |
| 1061 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
| 1062 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1063 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1064 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1065 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1066 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1067 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1068 | { } /* end */ |
| 1069 | }; |
| 1070 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1071 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1072 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1073 | */ |
| 1074 | static int alc_build_controls(struct hda_codec *codec) |
| 1075 | { |
| 1076 | struct alc_spec *spec = codec->spec; |
| 1077 | int err; |
| 1078 | int i; |
| 1079 | |
| 1080 | for (i = 0; i < spec->num_mixers; i++) { |
| 1081 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1082 | if (err < 0) |
| 1083 | return err; |
| 1084 | } |
| 1085 | |
| 1086 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1087 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1088 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1089 | if (err < 0) |
| 1090 | return err; |
| 1091 | } |
| 1092 | if (spec->dig_in_nid) { |
| 1093 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1094 | if (err < 0) |
| 1095 | return err; |
| 1096 | } |
| 1097 | return 0; |
| 1098 | } |
| 1099 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1100 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1101 | /* |
| 1102 | * initialize the codec volumes, etc |
| 1103 | */ |
| 1104 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1105 | /* |
| 1106 | * generic initialization of ADC, input mixers and output mixers |
| 1107 | */ |
| 1108 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1109 | /* |
| 1110 | * Unmute ADC0-2 and set the default input to mic-in |
| 1111 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1112 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1113 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1114 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1115 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1116 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1117 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1118 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1119 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1120 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1121 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1122 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1123 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1124 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1125 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1126 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1127 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 1128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 1129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1130 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1131 | /* |
| 1132 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1133 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1134 | /* set vol=0 to output mixers */ |
| 1135 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1136 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1137 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1138 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1139 | /* set up input amps for analog loopback */ |
| 1140 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1141 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1142 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1143 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1144 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1145 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1146 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1147 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1148 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1149 | |
| 1150 | { } |
| 1151 | }; |
| 1152 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1153 | /* |
| 1154 | * 3-stack pin configuration: |
| 1155 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1156 | */ |
| 1157 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1158 | /* |
| 1159 | * preset connection lists of input pins |
| 1160 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1161 | */ |
| 1162 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1163 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1164 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1165 | |
| 1166 | /* |
| 1167 | * Set pin mode and muting |
| 1168 | */ |
| 1169 | /* set front pin widgets 0x14 for output */ |
| 1170 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1171 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1172 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1173 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1174 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1175 | /* Mic2 (as headphone out) for HP output */ |
| 1176 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1177 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1178 | /* Line In pin widget for input */ |
| 1179 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1180 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1181 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1182 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1183 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1184 | /* CD pin widget for input */ |
| 1185 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1186 | |
| 1187 | { } |
| 1188 | }; |
| 1189 | |
| 1190 | /* |
| 1191 | * 5-stack pin configuration: |
| 1192 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1193 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1194 | */ |
| 1195 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1196 | /* |
| 1197 | * preset connection lists of input pins |
| 1198 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1199 | */ |
| 1200 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1201 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1202 | |
| 1203 | /* |
| 1204 | * Set pin mode and muting |
| 1205 | */ |
| 1206 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1207 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1208 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1209 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1210 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1211 | /* unmute pins for output (no gain on this amp) */ |
| 1212 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1213 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1214 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1215 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1216 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1217 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1218 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1219 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1220 | /* Mic2 (as headphone out) for HP output */ |
| 1221 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1222 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1223 | /* Line In pin widget for input */ |
| 1224 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1225 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1226 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1227 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1228 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1229 | /* CD pin widget for input */ |
| 1230 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1231 | |
| 1232 | { } |
| 1233 | }; |
| 1234 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1235 | /* |
| 1236 | * W810 pin configuration: |
| 1237 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1238 | */ |
| 1239 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1240 | /* hphone/speaker input selector: front DAC */ |
| 1241 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1242 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1243 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1244 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1245 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1246 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1247 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1248 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1249 | |
| 1250 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1251 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1252 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1253 | { } |
| 1254 | }; |
| 1255 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1256 | /* |
| 1257 | * Z71V pin configuration: |
| 1258 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1259 | */ |
| 1260 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1261 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1262 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1263 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1264 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1265 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1266 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1267 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1268 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1269 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1270 | |
| 1271 | { } |
| 1272 | }; |
| 1273 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1274 | /* |
| 1275 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1276 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1277 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1278 | */ |
| 1279 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1280 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1281 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1282 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1283 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1284 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1285 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1286 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1287 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1288 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1289 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1290 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1291 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1292 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1293 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1294 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1295 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1296 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1297 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1298 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1299 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1300 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1301 | { } |
| 1302 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1303 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1304 | /* |
| 1305 | * Uniwill pin configuration: |
| 1306 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1307 | * line = 0x1a |
| 1308 | */ |
| 1309 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1310 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1311 | |
| 1312 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1313 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1314 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1315 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1316 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1317 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1318 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1319 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1320 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1321 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1322 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1323 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1324 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1325 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1326 | |
| 1327 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1328 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1329 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1330 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1331 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1332 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1333 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1334 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1335 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1336 | |
| 1337 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1338 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1339 | |
| 1340 | { } |
| 1341 | }; |
| 1342 | |
| 1343 | /* |
| 1344 | * Uniwill P53 |
| 1345 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1346 | */ |
| 1347 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1348 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1349 | |
| 1350 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1351 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1352 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1353 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1354 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1355 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1356 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1357 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1358 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1359 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1360 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1361 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1362 | |
| 1363 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1364 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1365 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1366 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1367 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1368 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1369 | |
| 1370 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1371 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1372 | |
| 1373 | { } |
| 1374 | }; |
| 1375 | |
| 1376 | /* toggle speaker-output according to the hp-jack state */ |
| 1377 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1378 | { |
| 1379 | unsigned int present; |
| 1380 | |
| 1381 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1382 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1383 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 1384 | 0x80, present ? 0x80 : 0); |
| 1385 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 1386 | 0x80, present ? 0x80 : 0); |
| 1387 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0, |
| 1388 | 0x80, present ? 0x80 : 0); |
| 1389 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, |
| 1390 | 0x80, present ? 0x80 : 0); |
| 1391 | |
| 1392 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1393 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1394 | snd_hda_codec_write(codec, 0x0b, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 1395 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 1396 | } |
| 1397 | |
| 1398 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1399 | unsigned int res) |
| 1400 | { |
| 1401 | /* Looks like the unsol event is incompatible with the standard |
| 1402 | * definition. 4bit tag is placed at 28 bit! |
| 1403 | */ |
| 1404 | if ((res >> 28) == ALC880_HP_EVENT || |
| 1405 | (res >> 28) == ALC880_MIC_EVENT) |
| 1406 | alc880_uniwill_automute(codec); |
| 1407 | } |
| 1408 | |
| 1409 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1410 | { |
| 1411 | unsigned int present; |
| 1412 | |
| 1413 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1414 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1415 | |
| 1416 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, |
| 1417 | 0x80, present ? 0x80 : 0); |
| 1418 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0, |
| 1419 | 0x80, present ? 0x80 : 0); |
| 1420 | } |
| 1421 | |
| 1422 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1423 | { |
| 1424 | unsigned int present; |
| 1425 | |
| 1426 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 1427 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; |
| 1428 | |
| 1429 | snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 1430 | 0x7f, present); |
| 1431 | snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 1432 | 0x7f, present); |
| 1433 | |
| 1434 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 1435 | 0x7f, present); |
| 1436 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 1437 | 0x7f, present); |
| 1438 | |
| 1439 | } |
| 1440 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1441 | unsigned int res) |
| 1442 | { |
| 1443 | /* Looks like the unsol event is incompatible with the standard |
| 1444 | * definition. 4bit tag is placed at 28 bit! |
| 1445 | */ |
| 1446 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1447 | alc880_uniwill_p53_hp_automute(codec); |
| 1448 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
| 1449 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1450 | } |
| 1451 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1452 | /* FIXME! */ |
| 1453 | /* |
| 1454 | * F1734 pin configuration: |
| 1455 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1456 | */ |
| 1457 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1458 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1459 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1460 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1461 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1462 | |
| 1463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1466 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1467 | |
| 1468 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1469 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1470 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1471 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1472 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1473 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1474 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1475 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1476 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1477 | |
| 1478 | { } |
| 1479 | }; |
| 1480 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1481 | /* FIXME! */ |
| 1482 | /* |
| 1483 | * ASUS pin configuration: |
| 1484 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1485 | */ |
| 1486 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1487 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1488 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1489 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1490 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1491 | |
| 1492 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1493 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1494 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1495 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1496 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1497 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1498 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1499 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1500 | |
| 1501 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1502 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1503 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1504 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1505 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1507 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1509 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1510 | |
| 1511 | { } |
| 1512 | }; |
| 1513 | |
| 1514 | /* Enable GPIO mask and set output */ |
| 1515 | static struct hda_verb alc880_gpio1_init_verbs[] = { |
| 1516 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 1517 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 1518 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1519 | |
| 1520 | { } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1521 | }; |
| 1522 | |
| 1523 | /* Enable GPIO mask and set output */ |
| 1524 | static struct hda_verb alc880_gpio2_init_verbs[] = { |
| 1525 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 1526 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 1527 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1528 | |
| 1529 | { } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1530 | }; |
| 1531 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1532 | /* Clevo m520g init */ |
| 1533 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1534 | /* headphone output */ |
| 1535 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1536 | /* line-out */ |
| 1537 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1538 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1539 | /* Line-in */ |
| 1540 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1541 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1542 | /* CD */ |
| 1543 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1544 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1545 | /* Mic1 (rear panel) */ |
| 1546 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1547 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1548 | /* Mic2 (front panel) */ |
| 1549 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1550 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1551 | /* headphone */ |
| 1552 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1553 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1554 | /* change to EAPD mode */ |
| 1555 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1556 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1557 | |
| 1558 | { } |
| 1559 | }; |
| 1560 | |
| 1561 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 1562 | /* change to EAPD mode */ |
| 1563 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1564 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1565 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1566 | /* Headphone output */ |
| 1567 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1568 | /* Front output*/ |
| 1569 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1570 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1571 | |
| 1572 | /* Line In pin widget for input */ |
| 1573 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1574 | /* CD pin widget for input */ |
| 1575 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1576 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1577 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1578 | |
| 1579 | /* change to EAPD mode */ |
| 1580 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1581 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 1582 | |
| 1583 | { } |
| 1584 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1585 | |
| 1586 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1587 | * LG m1 express dual |
| 1588 | * |
| 1589 | * Pin assignment: |
| 1590 | * Rear Line-In/Out (blue): 0x14 |
| 1591 | * Build-in Mic-In: 0x15 |
| 1592 | * Speaker-out: 0x17 |
| 1593 | * HP-Out (green): 0x1b |
| 1594 | * Mic-In/Out (red): 0x19 |
| 1595 | * SPDIF-Out: 0x1e |
| 1596 | */ |
| 1597 | |
| 1598 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 1599 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 1600 | 0x05, 0x02, 0x03 |
| 1601 | }; |
| 1602 | |
| 1603 | /* seems analog CD is not working */ |
| 1604 | static struct hda_input_mux alc880_lg_capture_source = { |
| 1605 | .num_items = 3, |
| 1606 | .items = { |
| 1607 | { "Mic", 0x1 }, |
| 1608 | { "Line", 0x5 }, |
| 1609 | { "Internal Mic", 0x6 }, |
| 1610 | }, |
| 1611 | }; |
| 1612 | |
| 1613 | /* 2,4,6 channel modes */ |
| 1614 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 1615 | /* set line-in and mic-in to input */ |
| 1616 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1617 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1618 | { } |
| 1619 | }; |
| 1620 | |
| 1621 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 1622 | /* set line-in to out and mic-in to input */ |
| 1623 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1624 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1625 | { } |
| 1626 | }; |
| 1627 | |
| 1628 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 1629 | /* set line-in and mic-in to output */ |
| 1630 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1631 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1632 | { } |
| 1633 | }; |
| 1634 | |
| 1635 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 1636 | { 2, alc880_lg_ch2_init }, |
| 1637 | { 4, alc880_lg_ch4_init }, |
| 1638 | { 6, alc880_lg_ch6_init }, |
| 1639 | }; |
| 1640 | |
| 1641 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 1642 | /* FIXME: it's not really "master" but front channels */ |
| 1643 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1644 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1645 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1646 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1647 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 1648 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 1649 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 1650 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 1651 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1652 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1653 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 1654 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 1655 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 1656 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 1657 | { |
| 1658 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1659 | .name = "Channel Mode", |
| 1660 | .info = alc_ch_mode_info, |
| 1661 | .get = alc_ch_mode_get, |
| 1662 | .put = alc_ch_mode_put, |
| 1663 | }, |
| 1664 | { } /* end */ |
| 1665 | }; |
| 1666 | |
| 1667 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 1668 | /* set capture source to mic-in */ |
| 1669 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1670 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1671 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1672 | /* mute all amp mixer inputs */ |
| 1673 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 1674 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 1675 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1676 | /* line-in to input */ |
| 1677 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1678 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1679 | /* built-in mic */ |
| 1680 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1682 | /* speaker-out */ |
| 1683 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1684 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1685 | /* mic-in to input */ |
| 1686 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1687 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1688 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1689 | /* HP-out */ |
| 1690 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1691 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1692 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1693 | /* jack sense */ |
| 1694 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1695 | { } |
| 1696 | }; |
| 1697 | |
| 1698 | /* toggle speaker-output according to the hp-jack state */ |
| 1699 | static void alc880_lg_automute(struct hda_codec *codec) |
| 1700 | { |
| 1701 | unsigned int present; |
| 1702 | |
| 1703 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1704 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1705 | snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, |
| 1706 | 0x80, present ? 0x80 : 0); |
| 1707 | snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0, |
| 1708 | 0x80, present ? 0x80 : 0); |
| 1709 | } |
| 1710 | |
| 1711 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1712 | { |
| 1713 | /* Looks like the unsol event is incompatible with the standard |
| 1714 | * definition. 4bit tag is placed at 28 bit! |
| 1715 | */ |
| 1716 | if ((res >> 28) == 0x01) |
| 1717 | alc880_lg_automute(codec); |
| 1718 | } |
| 1719 | |
| 1720 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1721 | * LG LW20 |
| 1722 | * |
| 1723 | * Pin assignment: |
| 1724 | * Speaker-out: 0x14 |
| 1725 | * Mic-In: 0x18 |
| 1726 | * Built-in Mic-In: 0x19 (?) |
| 1727 | * HP-Out: 0x1b |
| 1728 | * SPDIF-Out: 0x1e |
| 1729 | */ |
| 1730 | |
| 1731 | /* seems analog CD is not working */ |
| 1732 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
| 1733 | .num_items = 2, |
| 1734 | .items = { |
| 1735 | { "Mic", 0x0 }, |
| 1736 | { "Internal Mic", 0x1 }, |
| 1737 | }, |
| 1738 | }; |
| 1739 | |
| 1740 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
| 1741 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1742 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1743 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1744 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1745 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 1746 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 1747 | { } /* end */ |
| 1748 | }; |
| 1749 | |
| 1750 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
| 1751 | /* set capture source to mic-in */ |
| 1752 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1753 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1754 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1755 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1756 | /* speaker-out */ |
| 1757 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1758 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1759 | /* HP-out */ |
| 1760 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1761 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1762 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1763 | /* mic-in to input */ |
| 1764 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1765 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1766 | /* built-in mic */ |
| 1767 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1768 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1769 | /* jack sense */ |
| 1770 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1771 | { } |
| 1772 | }; |
| 1773 | |
| 1774 | /* toggle speaker-output according to the hp-jack state */ |
| 1775 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 1776 | { |
| 1777 | unsigned int present; |
| 1778 | |
| 1779 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1780 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1781 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 1782 | 0x80, present ? 0x80 : 0); |
| 1783 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 1784 | 0x80, present ? 0x80 : 0); |
| 1785 | } |
| 1786 | |
| 1787 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1788 | { |
| 1789 | /* Looks like the unsol event is incompatible with the standard |
| 1790 | * definition. 4bit tag is placed at 28 bit! |
| 1791 | */ |
| 1792 | if ((res >> 28) == 0x01) |
| 1793 | alc880_lg_lw_automute(codec); |
| 1794 | } |
| 1795 | |
| 1796 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1797 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1798 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1799 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1800 | static int alc_init(struct hda_codec *codec) |
| 1801 | { |
| 1802 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1803 | unsigned int i; |
| 1804 | |
| 1805 | for (i = 0; i < spec->num_init_verbs; i++) |
| 1806 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1807 | |
| 1808 | if (spec->init_hook) |
| 1809 | spec->init_hook(codec); |
| 1810 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1811 | return 0; |
| 1812 | } |
| 1813 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1814 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1815 | { |
| 1816 | struct alc_spec *spec = codec->spec; |
| 1817 | |
| 1818 | if (spec->unsol_event) |
| 1819 | spec->unsol_event(codec, res); |
| 1820 | } |
| 1821 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1822 | #ifdef CONFIG_PM |
| 1823 | /* |
| 1824 | * resume |
| 1825 | */ |
| 1826 | static int alc_resume(struct hda_codec *codec) |
| 1827 | { |
| 1828 | struct alc_spec *spec = codec->spec; |
| 1829 | int i; |
| 1830 | |
| 1831 | alc_init(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1832 | for (i = 0; i < spec->num_mixers; i++) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1833 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1834 | if (spec->multiout.dig_out_nid) |
| 1835 | snd_hda_resume_spdif_out(codec); |
| 1836 | if (spec->dig_in_nid) |
| 1837 | snd_hda_resume_spdif_in(codec); |
| 1838 | |
| 1839 | return 0; |
| 1840 | } |
| 1841 | #endif |
| 1842 | |
| 1843 | /* |
| 1844 | * Analog playback callbacks |
| 1845 | */ |
| 1846 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 1847 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1848 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1849 | { |
| 1850 | struct alc_spec *spec = codec->spec; |
| 1851 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 1852 | } |
| 1853 | |
| 1854 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1855 | struct hda_codec *codec, |
| 1856 | unsigned int stream_tag, |
| 1857 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1858 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1859 | { |
| 1860 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1861 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 1862 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1863 | } |
| 1864 | |
| 1865 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 1866 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1867 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1868 | { |
| 1869 | struct alc_spec *spec = codec->spec; |
| 1870 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 1871 | } |
| 1872 | |
| 1873 | /* |
| 1874 | * Digital out |
| 1875 | */ |
| 1876 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 1877 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1878 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1879 | { |
| 1880 | struct alc_spec *spec = codec->spec; |
| 1881 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 1882 | } |
| 1883 | |
| 1884 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 1885 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1886 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1887 | { |
| 1888 | struct alc_spec *spec = codec->spec; |
| 1889 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 1890 | } |
| 1891 | |
| 1892 | /* |
| 1893 | * Analog capture |
| 1894 | */ |
| 1895 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 1896 | struct hda_codec *codec, |
| 1897 | unsigned int stream_tag, |
| 1898 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1899 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1900 | { |
| 1901 | struct alc_spec *spec = codec->spec; |
| 1902 | |
| 1903 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 1904 | stream_tag, 0, format); |
| 1905 | return 0; |
| 1906 | } |
| 1907 | |
| 1908 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 1909 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1910 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1911 | { |
| 1912 | struct alc_spec *spec = codec->spec; |
| 1913 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1914 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 1915 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1916 | return 0; |
| 1917 | } |
| 1918 | |
| 1919 | |
| 1920 | /* |
| 1921 | */ |
| 1922 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 1923 | .substreams = 1, |
| 1924 | .channels_min = 2, |
| 1925 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1926 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1927 | .ops = { |
| 1928 | .open = alc880_playback_pcm_open, |
| 1929 | .prepare = alc880_playback_pcm_prepare, |
| 1930 | .cleanup = alc880_playback_pcm_cleanup |
| 1931 | }, |
| 1932 | }; |
| 1933 | |
| 1934 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 1935 | .substreams = 2, |
| 1936 | .channels_min = 2, |
| 1937 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1938 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1939 | .ops = { |
| 1940 | .prepare = alc880_capture_pcm_prepare, |
| 1941 | .cleanup = alc880_capture_pcm_cleanup |
| 1942 | }, |
| 1943 | }; |
| 1944 | |
| 1945 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 1946 | .substreams = 1, |
| 1947 | .channels_min = 2, |
| 1948 | .channels_max = 2, |
| 1949 | /* NID is set in alc_build_pcms */ |
| 1950 | .ops = { |
| 1951 | .open = alc880_dig_playback_pcm_open, |
| 1952 | .close = alc880_dig_playback_pcm_close |
| 1953 | }, |
| 1954 | }; |
| 1955 | |
| 1956 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 1957 | .substreams = 1, |
| 1958 | .channels_min = 2, |
| 1959 | .channels_max = 2, |
| 1960 | /* NID is set in alc_build_pcms */ |
| 1961 | }; |
| 1962 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 1963 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 1964 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 1965 | .substreams = 0, |
| 1966 | .channels_min = 0, |
| 1967 | .channels_max = 0, |
| 1968 | }; |
| 1969 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1970 | static int alc_build_pcms(struct hda_codec *codec) |
| 1971 | { |
| 1972 | struct alc_spec *spec = codec->spec; |
| 1973 | struct hda_pcm *info = spec->pcm_rec; |
| 1974 | int i; |
| 1975 | |
| 1976 | codec->num_pcms = 1; |
| 1977 | codec->pcm_info = info; |
| 1978 | |
| 1979 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 1980 | if (spec->stream_analog_playback) { |
| 1981 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 1982 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 1983 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 1984 | } |
| 1985 | if (spec->stream_analog_capture) { |
| 1986 | snd_assert(spec->adc_nids, return -EINVAL); |
| 1987 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 1988 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 1989 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1990 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 1991 | if (spec->channel_mode) { |
| 1992 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 1993 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 1994 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 1995 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 1996 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1997 | } |
| 1998 | } |
| 1999 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2000 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2001 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2002 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2003 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2004 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2005 | if (spec->multiout.dig_out_nid && |
| 2006 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2007 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2008 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2009 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2010 | if (spec->dig_in_nid && |
| 2011 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2012 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2013 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2014 | } |
| 2015 | } |
| 2016 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2017 | /* If the use of more than one ADC is requested for the current |
| 2018 | * model, configure a second analog capture-only PCM. |
| 2019 | */ |
| 2020 | /* Additional Analaog capture for index #2 */ |
| 2021 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2022 | spec->adc_nids) { |
| 2023 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2024 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2025 | info->name = spec->stream_name_analog; |
| 2026 | /* No playback stream for second PCM */ |
| 2027 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2028 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2029 | if (spec->stream_analog_capture) { |
| 2030 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2031 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2032 | } |
| 2033 | } |
| 2034 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2035 | return 0; |
| 2036 | } |
| 2037 | |
| 2038 | static void alc_free(struct hda_codec *codec) |
| 2039 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2040 | struct alc_spec *spec = codec->spec; |
| 2041 | unsigned int i; |
| 2042 | |
| 2043 | if (! spec) |
| 2044 | return; |
| 2045 | |
| 2046 | if (spec->kctl_alloc) { |
| 2047 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2048 | kfree(spec->kctl_alloc[i].name); |
| 2049 | kfree(spec->kctl_alloc); |
| 2050 | } |
| 2051 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2052 | } |
| 2053 | |
| 2054 | /* |
| 2055 | */ |
| 2056 | static struct hda_codec_ops alc_patch_ops = { |
| 2057 | .build_controls = alc_build_controls, |
| 2058 | .build_pcms = alc_build_pcms, |
| 2059 | .init = alc_init, |
| 2060 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2061 | .unsol_event = alc_unsol_event, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2062 | #ifdef CONFIG_PM |
| 2063 | .resume = alc_resume, |
| 2064 | #endif |
| 2065 | }; |
| 2066 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2067 | |
| 2068 | /* |
| 2069 | * Test configuration for debugging |
| 2070 | * |
| 2071 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2072 | * enum controls. |
| 2073 | */ |
| 2074 | #ifdef CONFIG_SND_DEBUG |
| 2075 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2076 | 0x02, 0x03, 0x04, 0x05 |
| 2077 | }; |
| 2078 | |
| 2079 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2080 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2081 | .items = { |
| 2082 | { "In-1", 0x0 }, |
| 2083 | { "In-2", 0x1 }, |
| 2084 | { "In-3", 0x2 }, |
| 2085 | { "In-4", 0x3 }, |
| 2086 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2087 | { "Front", 0x5 }, |
| 2088 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2089 | }, |
| 2090 | }; |
| 2091 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2092 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2093 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2094 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2095 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2096 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2097 | }; |
| 2098 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2099 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2100 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2101 | { |
| 2102 | static char *texts[] = { |
| 2103 | "N/A", "Line Out", "HP Out", |
| 2104 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2105 | }; |
| 2106 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2107 | uinfo->count = 1; |
| 2108 | uinfo->value.enumerated.items = 8; |
| 2109 | if (uinfo->value.enumerated.item >= 8) |
| 2110 | uinfo->value.enumerated.item = 7; |
| 2111 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2112 | return 0; |
| 2113 | } |
| 2114 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2115 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2116 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2117 | { |
| 2118 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2119 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2120 | unsigned int pin_ctl, item = 0; |
| 2121 | |
| 2122 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2123 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2124 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2125 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2126 | item = 2; |
| 2127 | else |
| 2128 | item = 1; |
| 2129 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2130 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2131 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2132 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2133 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2134 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2135 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2136 | } |
| 2137 | } |
| 2138 | ucontrol->value.enumerated.item[0] = item; |
| 2139 | return 0; |
| 2140 | } |
| 2141 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2142 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2143 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2144 | { |
| 2145 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2146 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2147 | static unsigned int ctls[] = { |
| 2148 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2149 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2150 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2151 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2152 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2153 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2154 | }; |
| 2155 | unsigned int old_ctl, new_ctl; |
| 2156 | |
| 2157 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2158 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2159 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2160 | if (old_ctl != new_ctl) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2161 | snd_hda_codec_write(codec, nid, 0, |
| 2162 | AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2163 | 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] | 2164 | (ucontrol->value.enumerated.item[0] >= 3 ? |
| 2165 | 0xb080 : 0xb000)); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2166 | return 1; |
| 2167 | } |
| 2168 | return 0; |
| 2169 | } |
| 2170 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2171 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2172 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2173 | { |
| 2174 | static char *texts[] = { |
| 2175 | "Front", "Surround", "CLFE", "Side" |
| 2176 | }; |
| 2177 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2178 | uinfo->count = 1; |
| 2179 | uinfo->value.enumerated.items = 4; |
| 2180 | if (uinfo->value.enumerated.item >= 4) |
| 2181 | uinfo->value.enumerated.item = 3; |
| 2182 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2183 | return 0; |
| 2184 | } |
| 2185 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2186 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2187 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2188 | { |
| 2189 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2190 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2191 | unsigned int sel; |
| 2192 | |
| 2193 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2194 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2195 | return 0; |
| 2196 | } |
| 2197 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2198 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2199 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2200 | { |
| 2201 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2202 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2203 | unsigned int sel; |
| 2204 | |
| 2205 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2206 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2207 | sel = ucontrol->value.enumerated.item[0] & 3; |
| 2208 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel); |
| 2209 | return 1; |
| 2210 | } |
| 2211 | return 0; |
| 2212 | } |
| 2213 | |
| 2214 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2215 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2216 | .name = xname, \ |
| 2217 | .info = alc_test_pin_ctl_info, \ |
| 2218 | .get = alc_test_pin_ctl_get, \ |
| 2219 | .put = alc_test_pin_ctl_put, \ |
| 2220 | .private_value = nid \ |
| 2221 | } |
| 2222 | |
| 2223 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2224 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2225 | .name = xname, \ |
| 2226 | .info = alc_test_pin_src_info, \ |
| 2227 | .get = alc_test_pin_src_get, \ |
| 2228 | .put = alc_test_pin_src_put, \ |
| 2229 | .private_value = nid \ |
| 2230 | } |
| 2231 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2232 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2233 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2234 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2235 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2236 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2237 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2238 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2239 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2240 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2241 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2242 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2243 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2244 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2245 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2246 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2247 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2248 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2249 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2250 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2251 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2252 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2253 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2254 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2255 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2256 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2257 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2258 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2259 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2260 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2261 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2262 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2263 | { |
| 2264 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2265 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2266 | .info = alc_ch_mode_info, |
| 2267 | .get = alc_ch_mode_get, |
| 2268 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2269 | }, |
| 2270 | { } /* end */ |
| 2271 | }; |
| 2272 | |
| 2273 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2274 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2275 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2276 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2277 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2278 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2279 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2280 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2281 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2282 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2283 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2284 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2285 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2286 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2287 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2288 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2289 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2290 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2291 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2292 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2293 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2294 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2295 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2296 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2297 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2298 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2299 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2300 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2301 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2302 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2303 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2304 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2305 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2306 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2307 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2308 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2309 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2311 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2312 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2313 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2314 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2315 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2316 | /* Analog input/passthru */ |
| 2317 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2318 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2319 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2320 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2321 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2322 | { } |
| 2323 | }; |
| 2324 | #endif |
| 2325 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2326 | /* |
| 2327 | */ |
| 2328 | |
| 2329 | static struct hda_board_config alc880_cfg_tbl[] = { |
| 2330 | /* Back 3 jack, front 2 jack */ |
| 2331 | { .modelname = "3stack", .config = ALC880_3ST }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2332 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe200, .config = ALC880_3ST }, |
| 2333 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe201, .config = ALC880_3ST }, |
| 2334 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe202, .config = ALC880_3ST }, |
| 2335 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe203, .config = ALC880_3ST }, |
| 2336 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe204, .config = ALC880_3ST }, |
| 2337 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe205, .config = ALC880_3ST }, |
| 2338 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe206, .config = ALC880_3ST }, |
| 2339 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe207, .config = ALC880_3ST }, |
| 2340 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe208, .config = ALC880_3ST }, |
| 2341 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe209, .config = ALC880_3ST }, |
| 2342 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20a, .config = ALC880_3ST }, |
| 2343 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20b, .config = ALC880_3ST }, |
| 2344 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20c, .config = ALC880_3ST }, |
| 2345 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20d, .config = ALC880_3ST }, |
| 2346 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20e, .config = ALC880_3ST }, |
| 2347 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20f, .config = ALC880_3ST }, |
| 2348 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe210, .config = ALC880_3ST }, |
| 2349 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe211, .config = ALC880_3ST }, |
Tobin Davis | 2aaeee8 | 2006-08-21 19:01:12 +0200 | [diff] [blame] | 2350 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe212, .config = ALC880_3ST }, |
| 2351 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe213, .config = ALC880_3ST }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2352 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe214, .config = ALC880_3ST }, |
Tobin Davis | 2aaeee8 | 2006-08-21 19:01:12 +0200 | [diff] [blame] | 2353 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe234, .config = ALC880_3ST }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2354 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe302, .config = ALC880_3ST }, |
| 2355 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe303, .config = ALC880_3ST }, |
| 2356 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe304, .config = ALC880_3ST }, |
| 2357 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe306, .config = ALC880_3ST }, |
| 2358 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe307, .config = ALC880_3ST }, |
| 2359 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe404, .config = ALC880_3ST }, |
| 2360 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xa101, .config = ALC880_3ST }, |
| 2361 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x3031, .config = ALC880_3ST }, |
| 2362 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4036, .config = ALC880_3ST }, |
| 2363 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4037, .config = ALC880_3ST }, |
| 2364 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4038, .config = ALC880_3ST }, |
| 2365 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4040, .config = ALC880_3ST }, |
| 2366 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4041, .config = ALC880_3ST }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2367 | /* TCL S700 */ |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2368 | { .modelname = "tcl", .config = ALC880_TCL_S700 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2369 | { .pci_subvendor = 0x19db, .pci_subdevice = 0x4188, .config = ALC880_TCL_S700 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2370 | |
| 2371 | /* Back 3 jack, front 2 jack (Internal add Aux-In) */ |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2372 | { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2373 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST }, |
Davide Libenzi | 0ca2161 | 2005-09-05 11:56:47 +0200 | [diff] [blame] | 2374 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81a0, .config = ALC880_3ST }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2375 | |
| 2376 | /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */ |
| 2377 | { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2378 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe308, .config = ALC880_3ST_DIG }, |
Jaroslav Kysela | 5a47fe3c | 2005-08-15 20:01:40 +0200 | [diff] [blame] | 2379 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0070, .config = ALC880_3ST_DIG }, |
Takashi Iwai | 5a053d0 | 2006-07-25 14:51:15 +0200 | [diff] [blame] | 2380 | |
| 2381 | /* Clevo laptops */ |
| 2382 | { .modelname = "clevo", .config = ALC880_CLEVO }, |
| 2383 | { .pci_subvendor = 0x1558, .pci_subdevice = 0x0520, |
| 2384 | .config = ALC880_CLEVO }, /* Clevo m520G NB */ |
| 2385 | { .pci_subvendor = 0x1558, .pci_subdevice = 0x0660, |
| 2386 | .config = ALC880_CLEVO }, /* Clevo m665n */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2387 | |
| 2388 | /* 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] | 2389 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe305, .config = ALC880_3ST_DIG }, |
| 2390 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd402, .config = ALC880_3ST_DIG }, |
| 2391 | { .pci_subvendor = 0x1025, .pci_subdevice = 0xe309, .config = ALC880_3ST_DIG }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2392 | |
| 2393 | /* Back 5 jack, front 2 jack */ |
| 2394 | { .modelname = "5stack", .config = ALC880_5ST }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2395 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x3033, .config = ALC880_5ST }, |
| 2396 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x4039, .config = ALC880_5ST }, |
| 2397 | { .pci_subvendor = 0x107b, .pci_subdevice = 0x3032, .config = ALC880_5ST }, |
| 2398 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x2a09, .config = ALC880_5ST }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2399 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x814e, .config = ALC880_5ST }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2400 | |
| 2401 | /* Back 5 jack plus 1 SPDIF out jack, front 2 jack */ |
| 2402 | { .modelname = "5stack-digout", .config = ALC880_5ST_DIG }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2403 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe224, .config = ALC880_5ST_DIG }, |
| 2404 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe400, .config = ALC880_5ST_DIG }, |
| 2405 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe401, .config = ALC880_5ST_DIG }, |
| 2406 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe402, .config = ALC880_5ST_DIG }, |
| 2407 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd400, .config = ALC880_5ST_DIG }, |
| 2408 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd401, .config = ALC880_5ST_DIG }, |
| 2409 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xa100, .config = ALC880_5ST_DIG }, |
| 2410 | { .pci_subvendor = 0x1565, .pci_subdevice = 0x8202, .config = ALC880_5ST_DIG }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2411 | { .pci_subvendor = 0x1019, .pci_subdevice = 0xa880, .config = ALC880_5ST_DIG }, |
Takashi Iwai | ede3531 | 2006-03-13 14:21:16 +0100 | [diff] [blame] | 2412 | { .pci_subvendor = 0xa0a0, .pci_subdevice = 0x0560, |
| 2413 | .config = ALC880_5ST_DIG }, /* Aopen i915GMm-HFS */ |
Takashi Iwai | 7a318a7 | 2005-06-28 14:16:21 +0200 | [diff] [blame] | 2414 | /* { .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] | 2415 | { .pci_subvendor = 0x1695, .pci_subdevice = 0x400d, .config = ALC880_5ST_DIG }, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2416 | /* note subvendor = 0 below */ |
| 2417 | /* { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG }, */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2418 | |
| 2419 | { .modelname = "w810", .config = ALC880_W810 }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2420 | { .pci_subvendor = 0x161f, .pci_subdevice = 0x203d, .config = ALC880_W810 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2421 | |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2422 | { .modelname = "z71v", .config = ALC880_Z71V }, |
Takashi Iwai | 7291548 | 2005-05-12 16:49:45 +0200 | [diff] [blame] | 2423 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_Z71V }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2424 | |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2425 | { .modelname = "6stack", .config = ALC880_6ST }, |
Takashi Iwai | 7632c7b | 2005-12-07 18:25:47 +0100 | [diff] [blame] | 2426 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x8196, .config = ALC880_6ST }, /* ASUS P5GD1-HVM */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2427 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x81b4, .config = ALC880_6ST }, |
Takashi Iwai | 7a318a7 | 2005-06-28 14:16:21 +0200 | [diff] [blame] | 2428 | { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_6ST }, /* Acer APFV */ |
Arnaud Patard | bae2bdb | 2006-01-27 12:05:02 +0100 | [diff] [blame] | 2429 | { .pci_subvendor = 0x1458, .pci_subdevice = 0xa102, .config = ALC880_6ST }, /* Gigabyte K8N51 */ |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2430 | |
| 2431 | { .modelname = "6stack-digout", .config = ALC880_6ST_DIG }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2432 | { .pci_subvendor = 0x2668, .pci_subdevice = 0x8086, .config = ALC880_6ST_DIG }, |
| 2433 | { .pci_subvendor = 0x8086, .pci_subdevice = 0x2668, .config = ALC880_6ST_DIG }, |
| 2434 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x1150, .config = ALC880_6ST_DIG }, |
| 2435 | { .pci_subvendor = 0xe803, .pci_subdevice = 0x1019, .config = ALC880_6ST_DIG }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2436 | { .pci_subvendor = 0x1039, .pci_subdevice = 0x1234, .config = ALC880_6ST_DIG }, |
| 2437 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0077, .config = ALC880_6ST_DIG }, |
| 2438 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0078, .config = ALC880_6ST_DIG }, |
| 2439 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0087, .config = ALC880_6ST_DIG }, |
Takashi Iwai | 041dec0 | 2005-12-23 12:27:52 +0100 | [diff] [blame] | 2440 | { .pci_subvendor = 0x1297, .pci_subdevice = 0xc790, .config = ALC880_6ST_DIG }, /* Shuttle ST20G5 */ |
Takashi Iwai | a12606c | 2006-03-15 18:24:43 +0100 | [diff] [blame] | 2441 | { .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] | 2442 | { .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] | 2443 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2444 | { .modelname = "asus", .config = ALC880_ASUS }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2445 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_ASUS_DIG }, |
| 2446 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG }, |
| 2447 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG }, |
| 2448 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG }, |
Takashi Iwai | 8648811 | 2005-09-09 13:56:32 +0200 | [diff] [blame] | 2449 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1173, .config = ALC880_ASUS_DIG }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2450 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS }, |
Danny Tholen | f5a5ffa | 2006-08-08 18:59:07 +0200 | [diff] [blame] | 2451 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c2, .config = ALC880_ASUS_DIG }, /* Asus W6A */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2452 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG }, |
| 2453 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS }, |
| 2454 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1123, .config = ALC880_ASUS_DIG }, |
| 2455 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1143, .config = ALC880_ASUS }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2456 | { .modelname = "asus-w1v", .config = ALC880_ASUS_W1V }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2457 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x10b3, .config = ALC880_ASUS_W1V }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2458 | { .modelname = "asus-dig", .config = ALC880_ASUS_DIG }, |
Takashi Iwai | 84f3430 | 2006-03-21 19:12:53 +0100 | [diff] [blame] | 2459 | { .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] | 2460 | { .modelname = "asus-dig2", .config = ALC880_ASUS_DIG2 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2461 | { .pci_subvendor = 0x1558, .pci_subdevice = 0x5401, .config = ALC880_ASUS_DIG2 }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2462 | |
| 2463 | { .modelname = "uniwill", .config = ALC880_UNIWILL_DIG }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2464 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9050, .config = ALC880_UNIWILL_DIG }, |
| 2465 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9070, .config = ALC880_UNIWILL }, |
| 2466 | { .pci_subvendor = 0x1734, .pci_subdevice = 0x10ac, .config = ALC880_UNIWILL }, |
| 2467 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9077, .config = ALC880_UNIWILL_P53 }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2468 | |
| 2469 | { .modelname = "F1734", .config = ALC880_F1734 }, |
| 2470 | { .pci_subvendor = 0x1734, .pci_subdevice = 0x107c, .config = ALC880_F1734 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2471 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9054, .config = ALC880_F1734 }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2472 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2473 | { .modelname = "lg", .config = ALC880_LG }, |
| 2474 | { .pci_subvendor = 0x1854, .pci_subdevice = 0x003b, .config = ALC880_LG }, |
Takashi Iwai | 886da86 | 2006-05-02 18:17:57 +0200 | [diff] [blame] | 2475 | { .pci_subvendor = 0x1854, .pci_subdevice = 0x0068, .config = ALC880_LG }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2476 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2477 | { .modelname = "lg-lw", .config = ALC880_LG_LW }, |
| 2478 | { .pci_subvendor = 0x1854, .pci_subdevice = 0x0018, .config = ALC880_LG_LW }, |
Takashi Iwai | cd417d4 | 2006-09-06 16:03:11 +0200 | [diff] [blame] | 2479 | { .pci_subvendor = 0x1854, .pci_subdevice = 0x0077, .config = ALC880_LG_LW }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2480 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2481 | #ifdef CONFIG_SND_DEBUG |
| 2482 | { .modelname = "test", .config = ALC880_TEST }, |
| 2483 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2484 | { .modelname = "auto", .config = ALC880_AUTO }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2485 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2486 | {} |
| 2487 | }; |
| 2488 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2489 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2490 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2491 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2492 | static struct alc_config_preset alc880_presets[] = { |
| 2493 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2494 | .mixers = { alc880_three_stack_mixer }, |
| 2495 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2496 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2497 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2498 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2499 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2500 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2501 | .input_mux = &alc880_capture_source, |
| 2502 | }, |
| 2503 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2504 | .mixers = { alc880_three_stack_mixer }, |
| 2505 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2506 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2507 | .dac_nids = alc880_dac_nids, |
| 2508 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2509 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2510 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2511 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2512 | .input_mux = &alc880_capture_source, |
| 2513 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2514 | [ALC880_TCL_S700] = { |
| 2515 | .mixers = { alc880_tcl_s700_mixer }, |
| 2516 | .init_verbs = { alc880_volume_init_verbs, |
| 2517 | alc880_pin_tcl_S700_init_verbs, |
| 2518 | alc880_gpio2_init_verbs }, |
| 2519 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2520 | .dac_nids = alc880_dac_nids, |
| 2521 | .hp_nid = 0x03, |
| 2522 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2523 | .channel_mode = alc880_2_jack_modes, |
| 2524 | .input_mux = &alc880_capture_source, |
| 2525 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2526 | [ALC880_5ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2527 | .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer}, |
| 2528 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2529 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2530 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2531 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2532 | .channel_mode = alc880_fivestack_modes, |
| 2533 | .input_mux = &alc880_capture_source, |
| 2534 | }, |
| 2535 | [ALC880_5ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2536 | .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer }, |
| 2537 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2538 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2539 | .dac_nids = alc880_dac_nids, |
| 2540 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2541 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2542 | .channel_mode = alc880_fivestack_modes, |
| 2543 | .input_mux = &alc880_capture_source, |
| 2544 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2545 | [ALC880_6ST] = { |
| 2546 | .mixers = { alc880_six_stack_mixer }, |
| 2547 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, |
| 2548 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2549 | .dac_nids = alc880_6st_dac_nids, |
| 2550 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2551 | .channel_mode = alc880_sixstack_modes, |
| 2552 | .input_mux = &alc880_6stack_capture_source, |
| 2553 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2554 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2555 | .mixers = { alc880_six_stack_mixer }, |
| 2556 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2557 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2558 | .dac_nids = alc880_6st_dac_nids, |
| 2559 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2560 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2561 | .channel_mode = alc880_sixstack_modes, |
| 2562 | .input_mux = &alc880_6stack_capture_source, |
| 2563 | }, |
| 2564 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2565 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2566 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_w810_init_verbs, |
| 2567 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2568 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 2569 | .dac_nids = alc880_w810_dac_nids, |
| 2570 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2571 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2572 | .channel_mode = alc880_w810_modes, |
| 2573 | .input_mux = &alc880_capture_source, |
| 2574 | }, |
| 2575 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2576 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2577 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2578 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 2579 | .dac_nids = alc880_z71v_dac_nids, |
| 2580 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2581 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2582 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2583 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2584 | .input_mux = &alc880_capture_source, |
| 2585 | }, |
| 2586 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2587 | .mixers = { alc880_f1734_mixer }, |
| 2588 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_f1734_init_verbs }, |
| 2589 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 2590 | .dac_nids = alc880_f1734_dac_nids, |
| 2591 | .hp_nid = 0x02, |
| 2592 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2593 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2594 | .input_mux = &alc880_capture_source, |
| 2595 | }, |
| 2596 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2597 | .mixers = { alc880_asus_mixer }, |
| 2598 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, |
| 2599 | alc880_gpio1_init_verbs }, |
| 2600 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2601 | .dac_nids = alc880_asus_dac_nids, |
| 2602 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2603 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2604 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2605 | .input_mux = &alc880_capture_source, |
| 2606 | }, |
| 2607 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2608 | .mixers = { alc880_asus_mixer }, |
| 2609 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, |
| 2610 | alc880_gpio1_init_verbs }, |
| 2611 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2612 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2613 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2614 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2615 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2616 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2617 | .input_mux = &alc880_capture_source, |
| 2618 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2619 | [ALC880_ASUS_DIG2] = { |
| 2620 | .mixers = { alc880_asus_mixer }, |
| 2621 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, |
| 2622 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 2623 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2624 | .dac_nids = alc880_asus_dac_nids, |
| 2625 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2626 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2627 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2628 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2629 | .input_mux = &alc880_capture_source, |
| 2630 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2631 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2632 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
| 2633 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, |
| 2634 | alc880_gpio1_init_verbs }, |
| 2635 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2636 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2637 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2638 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2639 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2640 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2641 | .input_mux = &alc880_capture_source, |
| 2642 | }, |
| 2643 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 2644 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2645 | .init_verbs = { alc880_volume_init_verbs, |
| 2646 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2647 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2648 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2649 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2650 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2651 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2652 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2653 | .input_mux = &alc880_capture_source, |
| 2654 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2655 | [ALC880_UNIWILL] = { |
| 2656 | .mixers = { alc880_uniwill_mixer }, |
| 2657 | .init_verbs = { alc880_volume_init_verbs, |
| 2658 | alc880_uniwill_init_verbs }, |
| 2659 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2660 | .dac_nids = alc880_asus_dac_nids, |
| 2661 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2662 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2663 | .channel_mode = alc880_threestack_modes, |
| 2664 | .need_dac_fix = 1, |
| 2665 | .input_mux = &alc880_capture_source, |
| 2666 | .unsol_event = alc880_uniwill_unsol_event, |
| 2667 | .init_hook = alc880_uniwill_automute, |
| 2668 | }, |
| 2669 | [ALC880_UNIWILL_P53] = { |
| 2670 | .mixers = { alc880_uniwill_p53_mixer }, |
| 2671 | .init_verbs = { alc880_volume_init_verbs, |
| 2672 | alc880_uniwill_p53_init_verbs }, |
| 2673 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2674 | .dac_nids = alc880_asus_dac_nids, |
| 2675 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2676 | .channel_mode = alc880_w810_modes, |
| 2677 | .input_mux = &alc880_capture_source, |
| 2678 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2679 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2680 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2681 | [ALC880_CLEVO] = { |
| 2682 | .mixers = { alc880_three_stack_mixer }, |
| 2683 | .init_verbs = { alc880_volume_init_verbs, |
| 2684 | alc880_pin_clevo_init_verbs }, |
| 2685 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2686 | .dac_nids = alc880_dac_nids, |
| 2687 | .hp_nid = 0x03, |
| 2688 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2689 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2690 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2691 | .input_mux = &alc880_capture_source, |
| 2692 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2693 | [ALC880_LG] = { |
| 2694 | .mixers = { alc880_lg_mixer }, |
| 2695 | .init_verbs = { alc880_volume_init_verbs, |
| 2696 | alc880_lg_init_verbs }, |
| 2697 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 2698 | .dac_nids = alc880_lg_dac_nids, |
| 2699 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2700 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 2701 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2702 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2703 | .input_mux = &alc880_lg_capture_source, |
| 2704 | .unsol_event = alc880_lg_unsol_event, |
| 2705 | .init_hook = alc880_lg_automute, |
| 2706 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2707 | [ALC880_LG_LW] = { |
| 2708 | .mixers = { alc880_lg_lw_mixer }, |
| 2709 | .init_verbs = { alc880_volume_init_verbs, |
| 2710 | alc880_lg_lw_init_verbs }, |
| 2711 | .num_dacs = 1, |
| 2712 | .dac_nids = alc880_dac_nids, |
| 2713 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2714 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2715 | .channel_mode = alc880_2_jack_modes, |
| 2716 | .input_mux = &alc880_lg_lw_capture_source, |
| 2717 | .unsol_event = alc880_lg_lw_unsol_event, |
| 2718 | .init_hook = alc880_lg_lw_automute, |
| 2719 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2720 | #ifdef CONFIG_SND_DEBUG |
| 2721 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2722 | .mixers = { alc880_test_mixer }, |
| 2723 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2724 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 2725 | .dac_nids = alc880_test_dac_nids, |
| 2726 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2727 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 2728 | .channel_mode = alc880_test_modes, |
| 2729 | .input_mux = &alc880_test_capture_source, |
| 2730 | }, |
| 2731 | #endif |
| 2732 | }; |
| 2733 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2734 | /* |
| 2735 | * Automatic parse of I/O pins from the BIOS configuration |
| 2736 | */ |
| 2737 | |
| 2738 | #define NUM_CONTROL_ALLOC 32 |
| 2739 | #define NUM_VERB_ALLOC 32 |
| 2740 | |
| 2741 | enum { |
| 2742 | ALC_CTL_WIDGET_VOL, |
| 2743 | ALC_CTL_WIDGET_MUTE, |
| 2744 | ALC_CTL_BIND_MUTE, |
| 2745 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2746 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2747 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2748 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2749 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2750 | }; |
| 2751 | |
| 2752 | /* add dynamic controls */ |
| 2753 | static int add_control(struct alc_spec *spec, int type, const char *name, unsigned long val) |
| 2754 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2755 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2756 | |
| 2757 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 2758 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 2759 | |
| 2760 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ |
| 2761 | if (! knew) |
| 2762 | return -ENOMEM; |
| 2763 | if (spec->kctl_alloc) { |
| 2764 | memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); |
| 2765 | kfree(spec->kctl_alloc); |
| 2766 | } |
| 2767 | spec->kctl_alloc = knew; |
| 2768 | spec->num_kctl_alloc = num; |
| 2769 | } |
| 2770 | |
| 2771 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 2772 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 2773 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2774 | if (! knew->name) |
| 2775 | return -ENOMEM; |
| 2776 | knew->private_value = val; |
| 2777 | spec->num_kctl_used++; |
| 2778 | return 0; |
| 2779 | } |
| 2780 | |
| 2781 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 2782 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 2783 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 2784 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 2785 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 2786 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 2787 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 2788 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 2789 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 2790 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 2791 | #define ALC880_PIN_CD_NID 0x1c |
| 2792 | |
| 2793 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 2794 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pin_cfg *cfg) |
| 2795 | { |
| 2796 | hda_nid_t nid; |
| 2797 | int assigned[4]; |
| 2798 | int i, j; |
| 2799 | |
| 2800 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2801 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2802 | |
| 2803 | /* check the pins hardwired to audio widget */ |
| 2804 | for (i = 0; i < cfg->line_outs; i++) { |
| 2805 | nid = cfg->line_out_pins[i]; |
| 2806 | if (alc880_is_fixed_pin(nid)) { |
| 2807 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 2808 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2809 | assigned[idx] = 1; |
| 2810 | } |
| 2811 | } |
| 2812 | /* left pins can be connect to any audio widget */ |
| 2813 | for (i = 0; i < cfg->line_outs; i++) { |
| 2814 | nid = cfg->line_out_pins[i]; |
| 2815 | if (alc880_is_fixed_pin(nid)) |
| 2816 | continue; |
| 2817 | /* search for an empty channel */ |
| 2818 | for (j = 0; j < cfg->line_outs; j++) { |
| 2819 | if (! assigned[j]) { |
| 2820 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(j); |
| 2821 | assigned[j] = 1; |
| 2822 | break; |
| 2823 | } |
| 2824 | } |
| 2825 | } |
| 2826 | spec->multiout.num_dacs = cfg->line_outs; |
| 2827 | return 0; |
| 2828 | } |
| 2829 | |
| 2830 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2831 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 2832 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2833 | { |
| 2834 | char name[32]; |
| 2835 | static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; |
| 2836 | hda_nid_t nid; |
| 2837 | int i, err; |
| 2838 | |
| 2839 | for (i = 0; i < cfg->line_outs; i++) { |
| 2840 | if (! spec->multiout.dac_nids[i]) |
| 2841 | continue; |
| 2842 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 2843 | if (i == 2) { |
| 2844 | /* Center/LFE */ |
| 2845 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Center Playback Volume", |
| 2846 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) |
| 2847 | return err; |
| 2848 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "LFE Playback Volume", |
| 2849 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 2850 | return err; |
| 2851 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "Center Playback Switch", |
| 2852 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, HDA_INPUT))) < 0) |
| 2853 | return err; |
| 2854 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "LFE Playback Switch", |
| 2855 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, HDA_INPUT))) < 0) |
| 2856 | return err; |
| 2857 | } else { |
| 2858 | sprintf(name, "%s Playback Volume", chname[i]); |
| 2859 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 2860 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 2861 | return err; |
| 2862 | sprintf(name, "%s Playback Switch", chname[i]); |
| 2863 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 2864 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0) |
| 2865 | return err; |
| 2866 | } |
| 2867 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2868 | return 0; |
| 2869 | } |
| 2870 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2871 | /* add playback controls for speaker and HP outputs */ |
| 2872 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 2873 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2874 | { |
| 2875 | hda_nid_t nid; |
| 2876 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2877 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2878 | |
| 2879 | if (! pin) |
| 2880 | return 0; |
| 2881 | |
| 2882 | if (alc880_is_fixed_pin(pin)) { |
| 2883 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2884 | /* specify the DAC as the extra output */ |
| 2885 | if (! spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2886 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2887 | else |
| 2888 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2889 | /* control HP volume/switch on the output mixer amp */ |
| 2890 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2891 | sprintf(name, "%s Playback Volume", pfx); |
| 2892 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2893 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 2894 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2895 | sprintf(name, "%s Playback Switch", pfx); |
| 2896 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2897 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0) |
| 2898 | return err; |
| 2899 | } else if (alc880_is_multi_pin(pin)) { |
| 2900 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2901 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2902 | sprintf(name, "%s Playback Switch", pfx); |
| 2903 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2904 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT))) < 0) |
| 2905 | return err; |
| 2906 | } |
| 2907 | return 0; |
| 2908 | } |
| 2909 | |
| 2910 | /* create input playback/capture controls for the given pin */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2911 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, const char *ctlname, |
| 2912 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2913 | { |
| 2914 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2915 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2916 | |
| 2917 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2918 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2919 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT))) < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2920 | return err; |
| 2921 | sprintf(name, "%s Playback Switch", ctlname); |
| 2922 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2923 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT))) < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2924 | return err; |
| 2925 | return 0; |
| 2926 | } |
| 2927 | |
| 2928 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2929 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 2930 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2931 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2932 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2933 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2934 | |
| 2935 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 2936 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2937 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2938 | err = new_analog_input(spec, cfg->input_pins[i], |
| 2939 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2940 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2941 | if (err < 0) |
| 2942 | return err; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2943 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2944 | imux->items[imux->num_items].index = alc880_input_pin_idx(cfg->input_pins[i]); |
| 2945 | imux->num_items++; |
| 2946 | } |
| 2947 | } |
| 2948 | return 0; |
| 2949 | } |
| 2950 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2951 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 2952 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2953 | int dac_idx) |
| 2954 | { |
| 2955 | /* set as output */ |
| 2956 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 2957 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 2958 | /* need the manual connection? */ |
| 2959 | if (alc880_is_multi_pin(nid)) { |
| 2960 | struct alc_spec *spec = codec->spec; |
| 2961 | int idx = alc880_multi_pin_idx(nid); |
| 2962 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 2963 | AC_VERB_SET_CONNECT_SEL, |
| 2964 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 2965 | } |
| 2966 | } |
| 2967 | |
| 2968 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 2969 | { |
| 2970 | struct alc_spec *spec = codec->spec; |
| 2971 | int i; |
| 2972 | |
| 2973 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 2974 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 2975 | alc880_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); |
| 2976 | } |
| 2977 | } |
| 2978 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2979 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2980 | { |
| 2981 | struct alc_spec *spec = codec->spec; |
| 2982 | hda_nid_t pin; |
| 2983 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 2984 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 2985 | if (pin) /* connect to front */ |
| 2986 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2987 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2988 | if (pin) /* connect to front */ |
| 2989 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 2990 | } |
| 2991 | |
| 2992 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 2993 | { |
| 2994 | struct alc_spec *spec = codec->spec; |
| 2995 | int i; |
| 2996 | |
| 2997 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 2998 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 2999 | if (alc880_is_input_pin(nid)) { |
| 3000 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3001 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); |
| 3002 | if (nid != ALC880_PIN_CD_NID) |
| 3003 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3004 | AMP_OUT_MUTE); |
| 3005 | } |
| 3006 | } |
| 3007 | } |
| 3008 | |
| 3009 | /* parse the BIOS configuration and set up the alc_spec */ |
| 3010 | /* return 1 if successful, 0 if the proper config is not found, or a negative error code */ |
| 3011 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3012 | { |
| 3013 | struct alc_spec *spec = codec->spec; |
| 3014 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3015 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3016 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3017 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3018 | alc880_ignore)) < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3019 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3020 | if (! spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3021 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3022 | |
| 3023 | if ((err = alc880_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || |
| 3024 | (err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3025 | (err = alc880_auto_create_extra_out(spec, |
| 3026 | spec->autocfg.speaker_pins[0], |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3027 | "Speaker")) < 0 || |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3028 | (err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3029 | "Headphone")) < 0 || |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3030 | (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
| 3031 | return err; |
| 3032 | |
| 3033 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3034 | |
| 3035 | if (spec->autocfg.dig_out_pin) |
| 3036 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3037 | if (spec->autocfg.dig_in_pin) |
| 3038 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3039 | |
| 3040 | if (spec->kctl_alloc) |
| 3041 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3042 | |
| 3043 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3044 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3045 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3046 | spec->input_mux = &spec->private_imux; |
| 3047 | |
| 3048 | return 1; |
| 3049 | } |
| 3050 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3051 | /* additional initialization for auto-configuration model */ |
| 3052 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3053 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3054 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3055 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3056 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3057 | } |
| 3058 | |
| 3059 | /* |
| 3060 | * OK, here we have finally the patch for ALC880 |
| 3061 | */ |
| 3062 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3063 | static int patch_alc880(struct hda_codec *codec) |
| 3064 | { |
| 3065 | struct alc_spec *spec; |
| 3066 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3067 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3068 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3069 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3070 | if (spec == NULL) |
| 3071 | return -ENOMEM; |
| 3072 | |
| 3073 | codec->spec = spec; |
| 3074 | |
| 3075 | board_config = snd_hda_check_board_config(codec, alc880_cfg_tbl); |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3076 | if (board_config < 0 || board_config >= ALC880_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3077 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3078 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3079 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3080 | } |
| 3081 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3082 | if (board_config == ALC880_AUTO) { |
| 3083 | /* automatic parse from the BIOS config */ |
| 3084 | err = alc880_parse_auto_config(codec); |
| 3085 | if (err < 0) { |
| 3086 | alc_free(codec); |
| 3087 | return err; |
| 3088 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3089 | printk(KERN_INFO |
| 3090 | "hda_codec: Cannot set up configuration " |
| 3091 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3092 | board_config = ALC880_3ST; |
| 3093 | } |
| 3094 | } |
| 3095 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3096 | if (board_config != ALC880_AUTO) |
| 3097 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3098 | |
| 3099 | spec->stream_name_analog = "ALC880 Analog"; |
| 3100 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3101 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3102 | |
| 3103 | spec->stream_name_digital = "ALC880 Digital"; |
| 3104 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3105 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3106 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3107 | if (! spec->adc_nids && spec->input_mux) { |
| 3108 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3109 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3110 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 3111 | if (wcap != AC_WID_AUD_IN) { |
| 3112 | spec->adc_nids = alc880_adc_nids_alt; |
| 3113 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
| 3114 | spec->mixers[spec->num_mixers] = alc880_capture_alt_mixer; |
| 3115 | spec->num_mixers++; |
| 3116 | } else { |
| 3117 | spec->adc_nids = alc880_adc_nids; |
| 3118 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3119 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3120 | spec->num_mixers++; |
| 3121 | } |
| 3122 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3123 | |
| 3124 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3125 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3126 | spec->init_hook = alc880_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3127 | |
| 3128 | return 0; |
| 3129 | } |
| 3130 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3131 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3132 | /* |
| 3133 | * ALC260 support |
| 3134 | */ |
| 3135 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3136 | static hda_nid_t alc260_dac_nids[1] = { |
| 3137 | /* front */ |
| 3138 | 0x02, |
| 3139 | }; |
| 3140 | |
| 3141 | static hda_nid_t alc260_adc_nids[1] = { |
| 3142 | /* ADC0 */ |
| 3143 | 0x04, |
| 3144 | }; |
| 3145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3146 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3147 | /* ADC1 */ |
| 3148 | 0x05, |
| 3149 | }; |
| 3150 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3151 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3152 | /* ADC1, 0 */ |
| 3153 | 0x05, 0x04 |
| 3154 | }; |
| 3155 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3156 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3157 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3158 | */ |
| 3159 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3160 | /* ADC0, ADC1 */ |
| 3161 | 0x04, 0x05 |
| 3162 | }; |
| 3163 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3164 | #define ALC260_DIGOUT_NID 0x03 |
| 3165 | #define ALC260_DIGIN_NID 0x06 |
| 3166 | |
| 3167 | static struct hda_input_mux alc260_capture_source = { |
| 3168 | .num_items = 4, |
| 3169 | .items = { |
| 3170 | { "Mic", 0x0 }, |
| 3171 | { "Front Mic", 0x1 }, |
| 3172 | { "Line", 0x2 }, |
| 3173 | { "CD", 0x4 }, |
| 3174 | }, |
| 3175 | }; |
| 3176 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3177 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3178 | * headphone jack and the internal CD lines since these are the only pins at |
| 3179 | * which audio can appear. For flexibility, also allow the option of |
| 3180 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3181 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3182 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3183 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3184 | { |
| 3185 | .num_items = 3, |
| 3186 | .items = { |
| 3187 | { "Mic/Line", 0x0 }, |
| 3188 | { "CD", 0x4 }, |
| 3189 | { "Headphone", 0x2 }, |
| 3190 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3191 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3192 | { |
| 3193 | .num_items = 4, |
| 3194 | .items = { |
| 3195 | { "Mic/Line", 0x0 }, |
| 3196 | { "CD", 0x4 }, |
| 3197 | { "Headphone", 0x2 }, |
| 3198 | { "Mixer", 0x5 }, |
| 3199 | }, |
| 3200 | }, |
| 3201 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3202 | }; |
| 3203 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3204 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3205 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3206 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3207 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3208 | { |
| 3209 | .num_items = 4, |
| 3210 | .items = { |
| 3211 | { "Mic", 0x0 }, |
| 3212 | { "Line", 0x2 }, |
| 3213 | { "CD", 0x4 }, |
| 3214 | { "Headphone", 0x5 }, |
| 3215 | }, |
| 3216 | }, |
| 3217 | { |
| 3218 | .num_items = 5, |
| 3219 | .items = { |
| 3220 | { "Mic", 0x0 }, |
| 3221 | { "Line", 0x2 }, |
| 3222 | { "CD", 0x4 }, |
| 3223 | { "Headphone", 0x6 }, |
| 3224 | { "Mixer", 0x5 }, |
| 3225 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3226 | }, |
| 3227 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3228 | /* |
| 3229 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3230 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3231 | * element which allows changing the channel mode, so the verb list is |
| 3232 | * never used. |
| 3233 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3234 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3235 | { 2, NULL }, |
| 3236 | }; |
| 3237 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3238 | |
| 3239 | /* Mixer combinations |
| 3240 | * |
| 3241 | * basic: base_output + input + pc_beep + capture |
| 3242 | * HP: base_output + input + capture_alt |
| 3243 | * HP_3013: hp_3013 + input + capture |
| 3244 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3245 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3246 | */ |
| 3247 | |
| 3248 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3249 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3250 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3251 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3252 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3253 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3254 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3255 | { } /* end */ |
| 3256 | }; |
| 3257 | |
| 3258 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3259 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3260 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3261 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3262 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3265 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3266 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3267 | { } /* end */ |
| 3268 | }; |
| 3269 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3270 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3271 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3272 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3273 | { } /* end */ |
| 3274 | }; |
| 3275 | |
| 3276 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3277 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3278 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3279 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3280 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3281 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3282 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3283 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3284 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3285 | { } /* end */ |
| 3286 | }; |
| 3287 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3288 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3289 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3290 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3291 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3292 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3293 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3294 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3295 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3296 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3297 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3298 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3299 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3300 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3301 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3302 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3303 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3304 | { } /* end */ |
| 3305 | }; |
| 3306 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3307 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3308 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3309 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3310 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3311 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3312 | * revisions available in early 2006. Therefore for now allow the |
| 3313 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3314 | * that the lack of mic bias for this NID is intentional we could change the |
| 3315 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3316 | * |
| 3317 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3318 | * don't appear to make the mic bias available from the "line" jack, even |
| 3319 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3320 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3321 | * and the output jack. If this turns out to be the case for all such |
| 3322 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3323 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3324 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3325 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3326 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3327 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3328 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3329 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3330 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3331 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3332 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3333 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3334 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3335 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3336 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3337 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3338 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3339 | { } /* end */ |
| 3340 | }; |
| 3341 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3342 | /* capture mixer elements */ |
| 3343 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3344 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3345 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3346 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3347 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3348 | { |
| 3349 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3350 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3351 | * So call somewhat different.. |
| 3352 | * FIXME: the controls appear in the "playback" view! |
| 3353 | */ |
| 3354 | /* .name = "Capture Source", */ |
| 3355 | .name = "Input Source", |
| 3356 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3357 | .info = alc_mux_enum_info, |
| 3358 | .get = alc_mux_enum_get, |
| 3359 | .put = alc_mux_enum_put, |
| 3360 | }, |
| 3361 | { } /* end */ |
| 3362 | }; |
| 3363 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3364 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3365 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3366 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3367 | { |
| 3368 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3369 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3370 | * So call somewhat different.. |
| 3371 | * FIXME: the controls appear in the "playback" view! |
| 3372 | */ |
| 3373 | /* .name = "Capture Source", */ |
| 3374 | .name = "Input Source", |
| 3375 | .count = 1, |
| 3376 | .info = alc_mux_enum_info, |
| 3377 | .get = alc_mux_enum_get, |
| 3378 | .put = alc_mux_enum_put, |
| 3379 | }, |
| 3380 | { } /* end */ |
| 3381 | }; |
| 3382 | |
| 3383 | /* |
| 3384 | * initialization verbs |
| 3385 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3386 | static struct hda_verb alc260_init_verbs[] = { |
| 3387 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3388 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3389 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3390 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3391 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3392 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3393 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3394 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3395 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3396 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3397 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3398 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3399 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3400 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3401 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3402 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3403 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3404 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3405 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3406 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3407 | /* set connection select to line in (default select for this ADC) */ |
| 3408 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3409 | /* mute capture amp left and right */ |
| 3410 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3411 | /* set connection select to line in (default select for this ADC) */ |
| 3412 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3413 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3414 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3415 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3416 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3417 | /* set vol=0 HP mixer amp left and right */ |
| 3418 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3419 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3420 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3421 | /* set vol=0 Mono mixer amp left and right */ |
| 3422 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3423 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3424 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3425 | /* unmute LINE-2 out pin */ |
| 3426 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3427 | /* 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] | 3428 | /* mute CD */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3429 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3430 | /* mute Line In */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3431 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3432 | /* mute Mic */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3433 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3434 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3435 | /* mute Front out path */ |
| 3436 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3437 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3438 | /* mute Headphone out path */ |
| 3439 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3440 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3441 | /* mute Mono out path */ |
| 3442 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3443 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3444 | { } |
| 3445 | }; |
| 3446 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3447 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3448 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 3449 | /* Headphone and output */ |
| 3450 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3451 | /* mono output */ |
| 3452 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3453 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3454 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3455 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3456 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3457 | /* Line In pin widget for input */ |
| 3458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3459 | /* Line-2 pin widget for output */ |
| 3460 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3461 | /* CD pin widget for input */ |
| 3462 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3463 | /* unmute amp left and right */ |
| 3464 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3465 | /* set connection select to line in (default select for this ADC) */ |
| 3466 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3467 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3468 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3469 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3470 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3471 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3472 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3473 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3474 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3475 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ |
| 3476 | /* unmute CD */ |
| 3477 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3478 | /* unmute Line In */ |
| 3479 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3480 | /* unmute Mic */ |
| 3481 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3482 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3483 | /* Unmute Front out path */ |
| 3484 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3485 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3486 | /* Unmute Headphone out path */ |
| 3487 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3488 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3489 | /* Unmute Mono out path */ |
| 3490 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3491 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3492 | { } |
| 3493 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3494 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3495 | |
| 3496 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 3497 | /* Line out and output */ |
| 3498 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3499 | /* mono output */ |
| 3500 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3501 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3502 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3503 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3504 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3505 | /* Line In pin widget for input */ |
| 3506 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3507 | /* Headphone pin widget for output */ |
| 3508 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3509 | /* CD pin widget for input */ |
| 3510 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3511 | /* unmute amp left and right */ |
| 3512 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3513 | /* set connection select to line in (default select for this ADC) */ |
| 3514 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3515 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3516 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3517 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3518 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3519 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3520 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3521 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3522 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3523 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ |
| 3524 | /* unmute CD */ |
| 3525 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3526 | /* unmute Line In */ |
| 3527 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3528 | /* unmute Mic */ |
| 3529 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3530 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3531 | /* Unmute Front out path */ |
| 3532 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3533 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3534 | /* Unmute Headphone out path */ |
| 3535 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3536 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3537 | /* Unmute Mono out path */ |
| 3538 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3539 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3540 | { } |
| 3541 | }; |
| 3542 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3543 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3544 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 3545 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3546 | */ |
| 3547 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 3548 | /* Disable all GPIOs */ |
| 3549 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 3550 | /* Internal speaker is connected to headphone pin */ |
| 3551 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3552 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 3553 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3554 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 3555 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3556 | /* Ensure all other unused pins are disabled and muted. */ |
| 3557 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3558 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3559 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3560 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3561 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3562 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3563 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3564 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3565 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3566 | /* Disable digital (SPDIF) pins */ |
| 3567 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3568 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3569 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3570 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 3571 | * when acting as an output. |
| 3572 | */ |
| 3573 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3574 | |
| 3575 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 3576 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3577 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3578 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3579 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3580 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3581 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3582 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3583 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3584 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3585 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3586 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 3587 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3588 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 3589 | * If the pin mode is changed by the user the pin mode control will |
| 3590 | * take care of enabling the pin's input/output buffers as needed. |
| 3591 | * Therefore there's no need to enable the input buffer at this |
| 3592 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3593 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3594 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3595 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 3596 | * mixer ctrl) |
| 3597 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3598 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3599 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3600 | /* Mute capture amp left and right */ |
| 3601 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3602 | /* Set ADC connection select to match default mixer setting - line |
| 3603 | * in (on mic1 pin) |
| 3604 | */ |
| 3605 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3606 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3607 | /* Do the same for the second ADC: mute capture input amp and |
| 3608 | * set ADC connection to line in (on mic1 pin) |
| 3609 | */ |
| 3610 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3611 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3612 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3613 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3614 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3615 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3616 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3617 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3618 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3619 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3620 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3621 | {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] | 3622 | |
| 3623 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3624 | }; |
| 3625 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3626 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 3627 | * similar laptops (adapted from Fujitsu init verbs). |
| 3628 | */ |
| 3629 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 3630 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 3631 | * the headphone jack. Turn this on and rely on the standard mute |
| 3632 | * methods whenever the user wants to turn these outputs off. |
| 3633 | */ |
| 3634 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 3635 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3636 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 3637 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 3638 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3639 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 3640 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 3641 | /* Line In jack is connected to Line1 pin */ |
| 3642 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3643 | /* Ensure all other unused pins are disabled and muted. */ |
| 3644 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3645 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3646 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3647 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3648 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3649 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3650 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3651 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3652 | /* Disable digital (SPDIF) pins */ |
| 3653 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3654 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3655 | |
| 3656 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 3657 | * bus when acting as outputs. |
| 3658 | */ |
| 3659 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3660 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3661 | |
| 3662 | /* Start with output sum widgets muted and their output gains at min */ |
| 3663 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3664 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3665 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3666 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3667 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3668 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3669 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3670 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3671 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3672 | |
| 3673 | /* Unmute Line-out pin widget amp left and right (no equiv mixer ctrl) */ |
| 3674 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3675 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 3676 | * inputs. If the pin mode is changed by the user the pin mode control |
| 3677 | * will take care of enabling the pin's input/output buffers as needed. |
| 3678 | * Therefore there's no need to enable the input buffer at this |
| 3679 | * stage. |
| 3680 | */ |
| 3681 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3682 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3683 | |
| 3684 | /* Mute capture amp left and right */ |
| 3685 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3686 | /* Set ADC connection select to match default mixer setting - mic |
| 3687 | * (on mic1 pin) |
| 3688 | */ |
| 3689 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3690 | |
| 3691 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3692 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3693 | */ |
| 3694 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3695 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3696 | |
| 3697 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3700 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3701 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3702 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3704 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3705 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 3706 | |
| 3707 | { } |
| 3708 | }; |
| 3709 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3710 | /* Test configuration for debugging, modelled after the ALC880 test |
| 3711 | * configuration. |
| 3712 | */ |
| 3713 | #ifdef CONFIG_SND_DEBUG |
| 3714 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 3715 | 0x02, |
| 3716 | }; |
| 3717 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 3718 | 0x04, 0x05, |
| 3719 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3720 | /* For testing the ALC260, each input MUX needs its own definition since |
| 3721 | * the signal assignments are different. This assumes that the first ADC |
| 3722 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3723 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3724 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 3725 | { |
| 3726 | .num_items = 7, |
| 3727 | .items = { |
| 3728 | { "MIC1 pin", 0x0 }, |
| 3729 | { "MIC2 pin", 0x1 }, |
| 3730 | { "LINE1 pin", 0x2 }, |
| 3731 | { "LINE2 pin", 0x3 }, |
| 3732 | { "CD pin", 0x4 }, |
| 3733 | { "LINE-OUT pin", 0x5 }, |
| 3734 | { "HP-OUT pin", 0x6 }, |
| 3735 | }, |
| 3736 | }, |
| 3737 | { |
| 3738 | .num_items = 8, |
| 3739 | .items = { |
| 3740 | { "MIC1 pin", 0x0 }, |
| 3741 | { "MIC2 pin", 0x1 }, |
| 3742 | { "LINE1 pin", 0x2 }, |
| 3743 | { "LINE2 pin", 0x3 }, |
| 3744 | { "CD pin", 0x4 }, |
| 3745 | { "Mixer", 0x5 }, |
| 3746 | { "LINE-OUT pin", 0x6 }, |
| 3747 | { "HP-OUT pin", 0x7 }, |
| 3748 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3749 | }, |
| 3750 | }; |
| 3751 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 3752 | /* Output driver widgets */ |
| 3753 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3754 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3755 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3756 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 3757 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3758 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 3759 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3760 | /* Modes for retasking pin widgets |
| 3761 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 3762 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 3763 | * mention this restriction. At this stage it's not clear whether |
| 3764 | * this behaviour is intentional or is a hardware bug in chip |
| 3765 | * revisions available at least up until early 2006. Therefore for |
| 3766 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 3767 | * choices, but if it turns out that the lack of mic bias for these |
| 3768 | * NIDs is intentional we could change their modes from |
| 3769 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3770 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3771 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 3772 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 3773 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 3774 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3775 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 3776 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 3777 | |
| 3778 | /* Loopback mixer controls */ |
| 3779 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 3780 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 3781 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3782 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 3783 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3784 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3785 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 3786 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 3787 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3788 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3789 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3790 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3791 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3792 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3793 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 3794 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 3795 | |
| 3796 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 3797 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 3798 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 3799 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 3800 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 3801 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 3802 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 3803 | * is ambigious as to which NID is which; testing on laptops which |
| 3804 | * make this output available should provide clarification. |
| 3805 | */ |
| 3806 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 3807 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 3808 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3809 | { } /* end */ |
| 3810 | }; |
| 3811 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 3812 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 3813 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 3814 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 3815 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 3816 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3817 | /* Enable retasking pins as output, initially without power amp */ |
| 3818 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3819 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3820 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3821 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3822 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3823 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3824 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 3825 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 3826 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 3827 | * payload also sets the generation to 0, output to be in "consumer" |
| 3828 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 3829 | * control. |
| 3830 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3831 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3832 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3833 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3834 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3835 | * OUT1 sum bus when acting as an output. |
| 3836 | */ |
| 3837 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3838 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3839 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3840 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3841 | |
| 3842 | /* Start with output sum widgets muted and their output gains at min */ |
| 3843 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3844 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3845 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3846 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3847 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3848 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3849 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3850 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3851 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3852 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3853 | /* Unmute retasking pin widget output buffers since the default |
| 3854 | * state appears to be output. As the pin mode is changed by the |
| 3855 | * user the pin mode control will take care of enabling the pin's |
| 3856 | * input/output buffers as needed. |
| 3857 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3858 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3859 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3860 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3861 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3862 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3863 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3864 | /* Also unmute the mono-out pin widget */ |
| 3865 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3866 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3867 | /* Mute capture amp left and right */ |
| 3868 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3869 | /* Set ADC connection select to match default mixer setting (mic1 |
| 3870 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3871 | */ |
| 3872 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3873 | |
| 3874 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3875 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 3876 | */ |
| 3877 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3878 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3879 | |
| 3880 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3881 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3882 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3883 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3884 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3885 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3886 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3887 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3888 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 3889 | |
| 3890 | { } |
| 3891 | }; |
| 3892 | #endif |
| 3893 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3894 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 3895 | .substreams = 1, |
| 3896 | .channels_min = 2, |
| 3897 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3898 | }; |
| 3899 | |
| 3900 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 3901 | .substreams = 1, |
| 3902 | .channels_min = 2, |
| 3903 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3904 | }; |
| 3905 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 3906 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 3907 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 3908 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3909 | /* |
| 3910 | * for BIOS auto-configuration |
| 3911 | */ |
| 3912 | |
| 3913 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 3914 | const char *pfx) |
| 3915 | { |
| 3916 | hda_nid_t nid_vol; |
| 3917 | unsigned long vol_val, sw_val; |
| 3918 | char name[32]; |
| 3919 | int err; |
| 3920 | |
| 3921 | if (nid >= 0x0f && nid < 0x11) { |
| 3922 | nid_vol = nid - 0x7; |
| 3923 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 3924 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 3925 | } else if (nid == 0x11) { |
| 3926 | nid_vol = nid - 0x7; |
| 3927 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 3928 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 3929 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 3930 | nid_vol = 0x08; |
| 3931 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 3932 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 3933 | } else |
| 3934 | return 0; /* N/A */ |
| 3935 | |
| 3936 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 3937 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val)) < 0) |
| 3938 | return err; |
| 3939 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 3940 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val)) < 0) |
| 3941 | return err; |
| 3942 | return 1; |
| 3943 | } |
| 3944 | |
| 3945 | /* add playback controls from the parsed DAC table */ |
| 3946 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3947 | const struct auto_pin_cfg *cfg) |
| 3948 | { |
| 3949 | hda_nid_t nid; |
| 3950 | int err; |
| 3951 | |
| 3952 | spec->multiout.num_dacs = 1; |
| 3953 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 3954 | spec->multiout.dac_nids[0] = 0x02; |
| 3955 | |
| 3956 | nid = cfg->line_out_pins[0]; |
| 3957 | if (nid) { |
| 3958 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 3959 | if (err < 0) |
| 3960 | return err; |
| 3961 | } |
| 3962 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3963 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3964 | if (nid) { |
| 3965 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 3966 | if (err < 0) |
| 3967 | return err; |
| 3968 | } |
| 3969 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3970 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3971 | if (nid) { |
| 3972 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 3973 | if (err < 0) |
| 3974 | return err; |
| 3975 | } |
| 3976 | return 0; |
| 3977 | } |
| 3978 | |
| 3979 | /* create playback/capture controls for input pins */ |
| 3980 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3981 | const struct auto_pin_cfg *cfg) |
| 3982 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3983 | struct hda_input_mux *imux = &spec->private_imux; |
| 3984 | int i, err, idx; |
| 3985 | |
| 3986 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3987 | if (cfg->input_pins[i] >= 0x12) { |
| 3988 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3989 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3990 | auto_pin_cfg_labels[i], idx, 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3991 | if (err < 0) |
| 3992 | return err; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3993 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3994 | imux->items[imux->num_items].index = idx; |
| 3995 | imux->num_items++; |
| 3996 | } |
| 3997 | if ((cfg->input_pins[i] >= 0x0f) && (cfg->input_pins[i] <= 0x10)){ |
| 3998 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3999 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4000 | auto_pin_cfg_labels[i], idx, 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4001 | if (err < 0) |
| 4002 | return err; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4003 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4004 | imux->items[imux->num_items].index = idx; |
| 4005 | imux->num_items++; |
| 4006 | } |
| 4007 | } |
| 4008 | return 0; |
| 4009 | } |
| 4010 | |
| 4011 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4012 | hda_nid_t nid, int pin_type, |
| 4013 | int sel_idx) |
| 4014 | { |
| 4015 | /* set as output */ |
| 4016 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 4017 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 4018 | /* need the manual connection? */ |
| 4019 | if (nid >= 0x12) { |
| 4020 | int idx = nid - 0x12; |
| 4021 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4022 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
| 4023 | |
| 4024 | } |
| 4025 | } |
| 4026 | |
| 4027 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4028 | { |
| 4029 | struct alc_spec *spec = codec->spec; |
| 4030 | hda_nid_t nid; |
| 4031 | |
| 4032 | nid = spec->autocfg.line_out_pins[0]; |
| 4033 | if (nid) |
| 4034 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4035 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4036 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4037 | if (nid) |
| 4038 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4039 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4040 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4041 | if (nid) |
| 4042 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4043 | } |
| 4044 | |
| 4045 | #define ALC260_PIN_CD_NID 0x16 |
| 4046 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4047 | { |
| 4048 | struct alc_spec *spec = codec->spec; |
| 4049 | int i; |
| 4050 | |
| 4051 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4052 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4053 | if (nid >= 0x12) { |
| 4054 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4055 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); |
| 4056 | if (nid != ALC260_PIN_CD_NID) |
| 4057 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4058 | AMP_OUT_MUTE); |
| 4059 | } |
| 4060 | } |
| 4061 | } |
| 4062 | |
| 4063 | /* |
| 4064 | * generic initialization of ADC, input mixers and output mixers |
| 4065 | */ |
| 4066 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4067 | /* |
| 4068 | * Unmute ADC0-1 and set the default input to mic-in |
| 4069 | */ |
| 4070 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4071 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4072 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4073 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4074 | |
| 4075 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4076 | * mixer widget |
| 4077 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 4078 | * mic (mic 2) |
| 4079 | */ |
| 4080 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 4081 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4082 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4083 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 4084 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 4085 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 4086 | |
| 4087 | /* |
| 4088 | * Set up output mixers (0x08 - 0x0a) |
| 4089 | */ |
| 4090 | /* set vol=0 to output mixers */ |
| 4091 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4092 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4093 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4094 | /* set up input amps for analog loopback */ |
| 4095 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4096 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4097 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4098 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4099 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4100 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4101 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4102 | |
| 4103 | { } |
| 4104 | }; |
| 4105 | |
| 4106 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4107 | { |
| 4108 | struct alc_spec *spec = codec->spec; |
| 4109 | unsigned int wcap; |
| 4110 | int err; |
| 4111 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4112 | |
| 4113 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4114 | alc260_ignore)) < 0) |
| 4115 | return err; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4116 | if ((err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0) |
| 4117 | return err; |
| 4118 | if (! spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4119 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4120 | if ((err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4121 | return err; |
| 4122 | |
| 4123 | spec->multiout.max_channels = 2; |
| 4124 | |
| 4125 | if (spec->autocfg.dig_out_pin) |
| 4126 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4127 | if (spec->kctl_alloc) |
| 4128 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4129 | |
| 4130 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4131 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4132 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4133 | spec->input_mux = &spec->private_imux; |
| 4134 | |
| 4135 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4136 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4137 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4138 | if (wcap != AC_WID_AUD_IN) { |
| 4139 | spec->adc_nids = alc260_adc_nids_alt; |
| 4140 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4141 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4142 | } else { |
| 4143 | spec->adc_nids = alc260_adc_nids; |
| 4144 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4145 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4146 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4147 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4148 | |
| 4149 | return 1; |
| 4150 | } |
| 4151 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4152 | /* additional initialization for auto-configuration model */ |
| 4153 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4154 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4155 | alc260_auto_init_multi_out(codec); |
| 4156 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4157 | } |
| 4158 | |
| 4159 | /* |
| 4160 | * ALC260 configurations |
| 4161 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4162 | static struct hda_board_config alc260_cfg_tbl[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4163 | { .modelname = "basic", .config = ALC260_BASIC }, |
Takashi Iwai | b14e77e | 2006-01-11 18:10:50 +0100 | [diff] [blame] | 4164 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81bb, |
| 4165 | .config = ALC260_BASIC }, /* Sony VAIO */ |
Takashi Iwai | 3206b9c | 2006-05-10 16:33:11 +0200 | [diff] [blame] | 4166 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81cc, |
| 4167 | .config = ALC260_BASIC }, /* Sony VAIO VGN-S3HP */ |
Kenneth Crudup | 5e1b151 | 2006-04-28 13:03:48 +0200 | [diff] [blame] | 4168 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81cd, |
| 4169 | .config = ALC260_BASIC }, /* Sony VAIO */ |
Takashi Iwai | c1fc804 | 2006-03-06 14:17:31 +0100 | [diff] [blame] | 4170 | { .pci_subvendor = 0x152d, .pci_subdevice = 0x0729, |
| 4171 | .config = ALC260_BASIC }, /* CTL Travel Master U553W */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4172 | { .modelname = "hp", .config = ALC260_HP }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4173 | { .modelname = "hp-3013", .config = ALC260_HP_3013 }, |
Takashi Iwai | 25b6c43 | 2006-08-08 13:01:14 +0200 | [diff] [blame] | 4174 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3010, .config = ALC260_HP_3013 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4175 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3011, .config = ALC260_HP }, |
Takashi Iwai | 766a6c3 | 2006-05-26 14:58:29 +0200 | [diff] [blame] | 4176 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3012, .config = ALC260_HP_3013 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4177 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3013, .config = ALC260_HP_3013 }, |
| 4178 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, .config = ALC260_HP }, |
| 4179 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3015, .config = ALC260_HP }, |
| 4180 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3016, .config = ALC260_HP }, |
| 4181 | { .modelname = "fujitsu", .config = ALC260_FUJITSU_S702X }, |
| 4182 | { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1326, .config = ALC260_FUJITSU_S702X }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4183 | { .modelname = "acer", .config = ALC260_ACER }, |
| 4184 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x008f, .config = ALC260_ACER }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4185 | #ifdef CONFIG_SND_DEBUG |
| 4186 | { .modelname = "test", .config = ALC260_TEST }, |
| 4187 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4188 | { .modelname = "auto", .config = ALC260_AUTO }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4189 | {} |
| 4190 | }; |
| 4191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4192 | static struct alc_config_preset alc260_presets[] = { |
| 4193 | [ALC260_BASIC] = { |
| 4194 | .mixers = { alc260_base_output_mixer, |
| 4195 | alc260_input_mixer, |
| 4196 | alc260_pc_beep_mixer, |
| 4197 | alc260_capture_mixer }, |
| 4198 | .init_verbs = { alc260_init_verbs }, |
| 4199 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4200 | .dac_nids = alc260_dac_nids, |
| 4201 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4202 | .adc_nids = alc260_adc_nids, |
| 4203 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4204 | .channel_mode = alc260_modes, |
| 4205 | .input_mux = &alc260_capture_source, |
| 4206 | }, |
| 4207 | [ALC260_HP] = { |
| 4208 | .mixers = { alc260_base_output_mixer, |
| 4209 | alc260_input_mixer, |
| 4210 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4211 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4212 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4213 | .dac_nids = alc260_dac_nids, |
| 4214 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4215 | .adc_nids = alc260_hp_adc_nids, |
| 4216 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4217 | .channel_mode = alc260_modes, |
| 4218 | .input_mux = &alc260_capture_source, |
| 4219 | }, |
| 4220 | [ALC260_HP_3013] = { |
| 4221 | .mixers = { alc260_hp_3013_mixer, |
| 4222 | alc260_input_mixer, |
| 4223 | alc260_capture_alt_mixer }, |
| 4224 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4225 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4226 | .dac_nids = alc260_dac_nids, |
| 4227 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4228 | .adc_nids = alc260_hp_adc_nids, |
| 4229 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4230 | .channel_mode = alc260_modes, |
| 4231 | .input_mux = &alc260_capture_source, |
| 4232 | }, |
| 4233 | [ALC260_FUJITSU_S702X] = { |
| 4234 | .mixers = { alc260_fujitsu_mixer, |
| 4235 | alc260_capture_mixer }, |
| 4236 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4237 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4238 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4239 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4240 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4241 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4242 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4243 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4244 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4245 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4246 | [ALC260_ACER] = { |
| 4247 | .mixers = { alc260_acer_mixer, |
| 4248 | alc260_capture_mixer }, |
| 4249 | .init_verbs = { alc260_acer_init_verbs }, |
| 4250 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4251 | .dac_nids = alc260_dac_nids, |
| 4252 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4253 | .adc_nids = alc260_dual_adc_nids, |
| 4254 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4255 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4256 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4257 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4258 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4259 | #ifdef CONFIG_SND_DEBUG |
| 4260 | [ALC260_TEST] = { |
| 4261 | .mixers = { alc260_test_mixer, |
| 4262 | alc260_capture_mixer }, |
| 4263 | .init_verbs = { alc260_test_init_verbs }, |
| 4264 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4265 | .dac_nids = alc260_test_dac_nids, |
| 4266 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4267 | .adc_nids = alc260_test_adc_nids, |
| 4268 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4269 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4270 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4271 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4272 | }, |
| 4273 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4274 | }; |
| 4275 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4276 | static int patch_alc260(struct hda_codec *codec) |
| 4277 | { |
| 4278 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4279 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4280 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4281 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4282 | if (spec == NULL) |
| 4283 | return -ENOMEM; |
| 4284 | |
| 4285 | codec->spec = spec; |
| 4286 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4287 | board_config = snd_hda_check_board_config(codec, alc260_cfg_tbl); |
| 4288 | if (board_config < 0 || board_config >= ALC260_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4289 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4290 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4291 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4292 | } |
| 4293 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4294 | if (board_config == ALC260_AUTO) { |
| 4295 | /* automatic parse from the BIOS config */ |
| 4296 | err = alc260_parse_auto_config(codec); |
| 4297 | if (err < 0) { |
| 4298 | alc_free(codec); |
| 4299 | return err; |
| 4300 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4301 | printk(KERN_INFO |
| 4302 | "hda_codec: Cannot set up configuration " |
| 4303 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4304 | board_config = ALC260_BASIC; |
| 4305 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4306 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4307 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4308 | if (board_config != ALC260_AUTO) |
| 4309 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4310 | |
| 4311 | spec->stream_name_analog = "ALC260 Analog"; |
| 4312 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 4313 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 4314 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4315 | spec->stream_name_digital = "ALC260 Digital"; |
| 4316 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 4317 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 4318 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4319 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4320 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4321 | spec->init_hook = alc260_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4322 | |
| 4323 | return 0; |
| 4324 | } |
| 4325 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4326 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4327 | /* |
| 4328 | * ALC882 support |
| 4329 | * |
| 4330 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 4331 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4332 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4333 | * 6-channel independent captures. |
| 4334 | * |
| 4335 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4336 | * driver yet). |
| 4337 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4338 | #define ALC882_DIGOUT_NID 0x06 |
| 4339 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4340 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4341 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4342 | { 8, NULL } |
| 4343 | }; |
| 4344 | |
| 4345 | static hda_nid_t alc882_dac_nids[4] = { |
| 4346 | /* front, rear, clfe, rear_surr */ |
| 4347 | 0x02, 0x03, 0x04, 0x05 |
| 4348 | }; |
| 4349 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4350 | /* identical with ALC880 */ |
| 4351 | #define alc882_adc_nids alc880_adc_nids |
| 4352 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4353 | |
| 4354 | /* input MUX */ |
| 4355 | /* FIXME: should be a matrix-type input source selection */ |
| 4356 | |
| 4357 | static struct hda_input_mux alc882_capture_source = { |
| 4358 | .num_items = 4, |
| 4359 | .items = { |
| 4360 | { "Mic", 0x0 }, |
| 4361 | { "Front Mic", 0x1 }, |
| 4362 | { "Line", 0x2 }, |
| 4363 | { "CD", 0x4 }, |
| 4364 | }, |
| 4365 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4366 | #define alc882_mux_enum_info alc_mux_enum_info |
| 4367 | #define alc882_mux_enum_get alc_mux_enum_get |
| 4368 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4369 | 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] | 4370 | { |
| 4371 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4372 | struct alc_spec *spec = codec->spec; |
| 4373 | const struct hda_input_mux *imux = spec->input_mux; |
| 4374 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4375 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4376 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4377 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4378 | unsigned int i, idx; |
| 4379 | |
| 4380 | idx = ucontrol->value.enumerated.item[0]; |
| 4381 | if (idx >= imux->num_items) |
| 4382 | idx = imux->num_items - 1; |
| 4383 | if (*cur_val == idx && ! codec->in_resume) |
| 4384 | return 0; |
| 4385 | for (i = 0; i < imux->num_items; i++) { |
| 4386 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 4387 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4388 | v | (imux->items[i].index << 8)); |
| 4389 | } |
| 4390 | *cur_val = idx; |
| 4391 | return 1; |
| 4392 | } |
| 4393 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4394 | /* |
| 4395 | * 6ch mode |
| 4396 | */ |
| 4397 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 4398 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4399 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4400 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4401 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4402 | { } /* end */ |
| 4403 | }; |
| 4404 | |
| 4405 | /* |
| 4406 | * 8ch mode |
| 4407 | */ |
| 4408 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 4409 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4410 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4411 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4412 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4413 | { } /* end */ |
| 4414 | }; |
| 4415 | |
| 4416 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 4417 | { 6, alc882_sixstack_ch6_init }, |
| 4418 | { 8, alc882_sixstack_ch8_init }, |
| 4419 | }; |
| 4420 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4421 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 4422 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 4423 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4424 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4425 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4426 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4427 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4428 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4429 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 4430 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4431 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 4432 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4433 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4434 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4435 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4436 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4437 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4438 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4439 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4440 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4441 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4442 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4443 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4444 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4445 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4446 | { } /* end */ |
| 4447 | }; |
| 4448 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4449 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 4450 | { |
| 4451 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4452 | .name = "Channel Mode", |
| 4453 | .info = alc_ch_mode_info, |
| 4454 | .get = alc_ch_mode_get, |
| 4455 | .put = alc_ch_mode_put, |
| 4456 | }, |
| 4457 | { } /* end */ |
| 4458 | }; |
| 4459 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4460 | static struct hda_verb alc882_init_verbs[] = { |
| 4461 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4464 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4465 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4466 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4467 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4468 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4469 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4470 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4471 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4472 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4473 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4474 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4475 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4476 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4477 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4478 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4479 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4480 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4481 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4482 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4483 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4484 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4485 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4486 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4487 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4488 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4489 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4490 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4491 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4492 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4493 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4494 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4495 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4496 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4497 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4498 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4499 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4500 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4501 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4502 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4503 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 4504 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4505 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4506 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4507 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4508 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4509 | |
| 4510 | /* FIXME: use matrix-type input source selection */ |
| 4511 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 4512 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4513 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4514 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4515 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4516 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4517 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4518 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4519 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4520 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4521 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4522 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 4527 | /* ADC1: mute amp left and right */ |
| 4528 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4529 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4530 | /* ADC2: mute amp left and right */ |
| 4531 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4532 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4533 | /* ADC3: mute amp left and right */ |
| 4534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4535 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4536 | |
| 4537 | { } |
| 4538 | }; |
| 4539 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4540 | static struct hda_verb alc882_eapd_verbs[] = { |
| 4541 | /* change to EAPD mode */ |
| 4542 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 4543 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4544 | { } |
| 4545 | }; |
| 4546 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4547 | /* |
| 4548 | * generic initialization of ADC, input mixers and output mixers |
| 4549 | */ |
| 4550 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 4551 | /* |
| 4552 | * Unmute ADC0-2 and set the default input to mic-in |
| 4553 | */ |
| 4554 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4555 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4556 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4557 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4558 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4559 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4560 | |
| 4561 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4562 | * mixer widget |
| 4563 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 4564 | * mic (mic 2) |
| 4565 | */ |
| 4566 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 4567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 4570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 4571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 4572 | |
| 4573 | /* |
| 4574 | * Set up output mixers (0x0c - 0x0f) |
| 4575 | */ |
| 4576 | /* set vol=0 to output mixers */ |
| 4577 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4578 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4579 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4580 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4581 | /* set up input amps for analog loopback */ |
| 4582 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4583 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4584 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4585 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4587 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4588 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4589 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4590 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4591 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4592 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4593 | |
| 4594 | /* FIXME: use matrix-type input source selection */ |
| 4595 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 4596 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 4597 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4598 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 4599 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 4600 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 4601 | /* Input mixer2 */ |
| 4602 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4603 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 4604 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 4605 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 4606 | /* Input mixer3 */ |
| 4607 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4608 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 4609 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 4610 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 4611 | |
| 4612 | { } |
| 4613 | }; |
| 4614 | |
| 4615 | /* capture mixer elements */ |
| 4616 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 4617 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 4618 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 4619 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 4620 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 4621 | { |
| 4622 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4623 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4624 | * So call somewhat different.. |
| 4625 | * FIXME: the controls appear in the "playback" view! |
| 4626 | */ |
| 4627 | /* .name = "Capture Source", */ |
| 4628 | .name = "Input Source", |
| 4629 | .count = 2, |
| 4630 | .info = alc882_mux_enum_info, |
| 4631 | .get = alc882_mux_enum_get, |
| 4632 | .put = alc882_mux_enum_put, |
| 4633 | }, |
| 4634 | { } /* end */ |
| 4635 | }; |
| 4636 | |
| 4637 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 4638 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 4639 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 4640 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 4641 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 4642 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 4643 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 4644 | { |
| 4645 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4646 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4647 | * So call somewhat different.. |
| 4648 | * FIXME: the controls appear in the "playback" view! |
| 4649 | */ |
| 4650 | /* .name = "Capture Source", */ |
| 4651 | .name = "Input Source", |
| 4652 | .count = 3, |
| 4653 | .info = alc882_mux_enum_info, |
| 4654 | .get = alc882_mux_enum_get, |
| 4655 | .put = alc882_mux_enum_put, |
| 4656 | }, |
| 4657 | { } /* end */ |
| 4658 | }; |
| 4659 | |
| 4660 | /* pcm configuration: identiacal with ALC880 */ |
| 4661 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 4662 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 4663 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 4664 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 4665 | |
| 4666 | /* |
| 4667 | * configuration and preset |
| 4668 | */ |
| 4669 | static struct hda_board_config alc882_cfg_tbl[] = { |
Takashi Iwai | 1494a92 | 2006-01-31 10:58:46 +0100 | [diff] [blame] | 4670 | { .modelname = "3stack-dig", .config = ALC882_3ST_DIG }, |
| 4671 | { .modelname = "6stack-dig", .config = ALC882_6ST_DIG }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4672 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668, |
| 4673 | .config = ALC882_6ST_DIG }, /* MSI */ |
| 4674 | { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668, |
| 4675 | .config = ALC882_6ST_DIG }, /* Foxconn */ |
| 4676 | { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668, |
| 4677 | .config = ALC882_6ST_DIG }, /* ECS to Intel*/ |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4678 | { .modelname = "arima", .config = ALC882_ARIMA }, |
| 4679 | { .pci_subvendor = 0x161f, .pci_subdevice = 0x2054, |
| 4680 | .config = ALC882_ARIMA }, /* Arima W820Di1 */ |
Takashi Iwai | 1494a92 | 2006-01-31 10:58:46 +0100 | [diff] [blame] | 4681 | { .modelname = "auto", .config = ALC882_AUTO }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4682 | {} |
| 4683 | }; |
| 4684 | |
| 4685 | static struct alc_config_preset alc882_presets[] = { |
| 4686 | [ALC882_3ST_DIG] = { |
| 4687 | .mixers = { alc882_base_mixer }, |
| 4688 | .init_verbs = { alc882_init_verbs }, |
| 4689 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 4690 | .dac_nids = alc882_dac_nids, |
| 4691 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4692 | .dig_in_nid = ALC882_DIGIN_NID, |
| 4693 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 4694 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4695 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4696 | .input_mux = &alc882_capture_source, |
| 4697 | }, |
| 4698 | [ALC882_6ST_DIG] = { |
| 4699 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 4700 | .init_verbs = { alc882_init_verbs }, |
| 4701 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 4702 | .dac_nids = alc882_dac_nids, |
| 4703 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4704 | .dig_in_nid = ALC882_DIGIN_NID, |
| 4705 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 4706 | .channel_mode = alc882_sixstack_modes, |
| 4707 | .input_mux = &alc882_capture_source, |
| 4708 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4709 | [ALC882_ARIMA] = { |
| 4710 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 4711 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 4712 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 4713 | .dac_nids = alc882_dac_nids, |
| 4714 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 4715 | .channel_mode = alc882_sixstack_modes, |
| 4716 | .input_mux = &alc882_capture_source, |
| 4717 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4718 | }; |
| 4719 | |
| 4720 | |
| 4721 | /* |
| 4722 | * BIOS auto configuration |
| 4723 | */ |
| 4724 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4725 | hda_nid_t nid, int pin_type, |
| 4726 | int dac_idx) |
| 4727 | { |
| 4728 | /* set as output */ |
| 4729 | struct alc_spec *spec = codec->spec; |
| 4730 | int idx; |
| 4731 | |
| 4732 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 4733 | idx = 4; |
| 4734 | else |
| 4735 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 4736 | |
| 4737 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 4738 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 4739 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 4740 | |
| 4741 | } |
| 4742 | |
| 4743 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 4744 | { |
| 4745 | struct alc_spec *spec = codec->spec; |
| 4746 | int i; |
| 4747 | |
| 4748 | for (i = 0; i <= HDA_SIDE; i++) { |
| 4749 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 4750 | if (nid) |
| 4751 | alc882_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); |
| 4752 | } |
| 4753 | } |
| 4754 | |
| 4755 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 4756 | { |
| 4757 | struct alc_spec *spec = codec->spec; |
| 4758 | hda_nid_t pin; |
| 4759 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4760 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4761 | if (pin) /* connect to front */ |
| 4762 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); /* use dac 0 */ |
| 4763 | } |
| 4764 | |
| 4765 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 4766 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 4767 | |
| 4768 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 4769 | { |
| 4770 | struct alc_spec *spec = codec->spec; |
| 4771 | int i; |
| 4772 | |
| 4773 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4774 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4775 | if (alc882_is_input_pin(nid)) { |
| 4776 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4777 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); |
| 4778 | if (nid != ALC882_PIN_CD_NID) |
| 4779 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4780 | AMP_OUT_MUTE); |
| 4781 | } |
| 4782 | } |
| 4783 | } |
| 4784 | |
| 4785 | /* almost identical with ALC880 parser... */ |
| 4786 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 4787 | { |
| 4788 | struct alc_spec *spec = codec->spec; |
| 4789 | int err = alc880_parse_auto_config(codec); |
| 4790 | |
| 4791 | if (err < 0) |
| 4792 | return err; |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 4793 | else if (err > 0) |
| 4794 | /* hack - override the init verbs */ |
| 4795 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 4796 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4797 | } |
| 4798 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4799 | /* additional initialization for auto-configuration model */ |
| 4800 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4801 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4802 | alc882_auto_init_multi_out(codec); |
| 4803 | alc882_auto_init_hp_out(codec); |
| 4804 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4805 | } |
| 4806 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4807 | static int patch_alc882(struct hda_codec *codec) |
| 4808 | { |
| 4809 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4810 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4811 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4812 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4813 | if (spec == NULL) |
| 4814 | return -ENOMEM; |
| 4815 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4816 | codec->spec = spec; |
| 4817 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4818 | board_config = snd_hda_check_board_config(codec, alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4819 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4820 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4821 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 4822 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4823 | board_config = ALC882_AUTO; |
| 4824 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4826 | if (board_config == ALC882_AUTO) { |
| 4827 | /* automatic parse from the BIOS config */ |
| 4828 | err = alc882_parse_auto_config(codec); |
| 4829 | if (err < 0) { |
| 4830 | alc_free(codec); |
| 4831 | return err; |
| 4832 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4833 | printk(KERN_INFO |
| 4834 | "hda_codec: Cannot set up configuration " |
| 4835 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4836 | board_config = ALC882_3ST_DIG; |
| 4837 | } |
| 4838 | } |
| 4839 | |
| 4840 | if (board_config != ALC882_AUTO) |
| 4841 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4842 | |
| 4843 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4844 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 4845 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4846 | |
| 4847 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4848 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 4849 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4850 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4851 | if (! spec->adc_nids && spec->input_mux) { |
| 4852 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4853 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4854 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4855 | if (wcap != AC_WID_AUD_IN) { |
| 4856 | spec->adc_nids = alc882_adc_nids_alt; |
| 4857 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
| 4858 | spec->mixers[spec->num_mixers] = alc882_capture_alt_mixer; |
| 4859 | spec->num_mixers++; |
| 4860 | } else { |
| 4861 | spec->adc_nids = alc882_adc_nids; |
| 4862 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 4863 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 4864 | spec->num_mixers++; |
| 4865 | } |
| 4866 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4867 | |
| 4868 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4869 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4870 | spec->init_hook = alc882_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4871 | |
| 4872 | return 0; |
| 4873 | } |
| 4874 | |
| 4875 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4876 | * ALC883 support |
| 4877 | * |
| 4878 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 4879 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4880 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4881 | * 6-channel independent captures. |
| 4882 | * |
| 4883 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4884 | * driver yet). |
| 4885 | */ |
| 4886 | #define ALC883_DIGOUT_NID 0x06 |
| 4887 | #define ALC883_DIGIN_NID 0x0a |
| 4888 | |
| 4889 | static hda_nid_t alc883_dac_nids[4] = { |
| 4890 | /* front, rear, clfe, rear_surr */ |
| 4891 | 0x02, 0x04, 0x03, 0x05 |
| 4892 | }; |
| 4893 | |
| 4894 | static hda_nid_t alc883_adc_nids[2] = { |
| 4895 | /* ADC1-2 */ |
| 4896 | 0x08, 0x09, |
| 4897 | }; |
| 4898 | /* input MUX */ |
| 4899 | /* FIXME: should be a matrix-type input source selection */ |
| 4900 | |
| 4901 | static struct hda_input_mux alc883_capture_source = { |
| 4902 | .num_items = 4, |
| 4903 | .items = { |
| 4904 | { "Mic", 0x0 }, |
| 4905 | { "Front Mic", 0x1 }, |
| 4906 | { "Line", 0x2 }, |
| 4907 | { "CD", 0x4 }, |
| 4908 | }, |
| 4909 | }; |
| 4910 | #define alc883_mux_enum_info alc_mux_enum_info |
| 4911 | #define alc883_mux_enum_get alc_mux_enum_get |
| 4912 | |
| 4913 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 4914 | struct snd_ctl_elem_value *ucontrol) |
| 4915 | { |
| 4916 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4917 | struct alc_spec *spec = codec->spec; |
| 4918 | const struct hda_input_mux *imux = spec->input_mux; |
| 4919 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4920 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4921 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4922 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4923 | unsigned int i, idx; |
| 4924 | |
| 4925 | idx = ucontrol->value.enumerated.item[0]; |
| 4926 | if (idx >= imux->num_items) |
| 4927 | idx = imux->num_items - 1; |
| 4928 | if (*cur_val == idx && ! codec->in_resume) |
| 4929 | return 0; |
| 4930 | for (i = 0; i < imux->num_items; i++) { |
| 4931 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 4932 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4933 | v | (imux->items[i].index << 8)); |
| 4934 | } |
| 4935 | *cur_val = idx; |
| 4936 | return 1; |
| 4937 | } |
| 4938 | /* |
| 4939 | * 2ch mode |
| 4940 | */ |
| 4941 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 4942 | { 2, NULL } |
| 4943 | }; |
| 4944 | |
| 4945 | /* |
| 4946 | * 2ch mode |
| 4947 | */ |
| 4948 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 4949 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 4950 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4951 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 4952 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4953 | { } /* end */ |
| 4954 | }; |
| 4955 | |
| 4956 | /* |
| 4957 | * 6ch mode |
| 4958 | */ |
| 4959 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 4960 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4961 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4962 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 4963 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4964 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4965 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 4966 | { } /* end */ |
| 4967 | }; |
| 4968 | |
| 4969 | static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { |
| 4970 | { 2, alc883_3ST_ch2_init }, |
| 4971 | { 6, alc883_3ST_ch6_init }, |
| 4972 | }; |
| 4973 | |
| 4974 | /* |
| 4975 | * 6ch mode |
| 4976 | */ |
| 4977 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 4978 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4979 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4980 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4981 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4982 | { } /* end */ |
| 4983 | }; |
| 4984 | |
| 4985 | /* |
| 4986 | * 8ch mode |
| 4987 | */ |
| 4988 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 4989 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4990 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4991 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4992 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4993 | { } /* end */ |
| 4994 | }; |
| 4995 | |
| 4996 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 4997 | { 6, alc883_sixstack_ch6_init }, |
| 4998 | { 8, alc883_sixstack_ch8_init }, |
| 4999 | }; |
| 5000 | |
| 5001 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5002 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5003 | */ |
| 5004 | |
| 5005 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 5006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5007 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5008 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5009 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5010 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5011 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5012 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5013 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5014 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 5015 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 5016 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5017 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5018 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5019 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5020 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5021 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5022 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5023 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5024 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5025 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5026 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5027 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5028 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5029 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5030 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5031 | { |
| 5032 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5033 | /* .name = "Capture Source", */ |
| 5034 | .name = "Input Source", |
| 5035 | .count = 2, |
| 5036 | .info = alc883_mux_enum_info, |
| 5037 | .get = alc883_mux_enum_get, |
| 5038 | .put = alc883_mux_enum_put, |
| 5039 | }, |
| 5040 | { } /* end */ |
| 5041 | }; |
| 5042 | |
| 5043 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 5044 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5045 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5046 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5047 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5048 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5050 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5051 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5052 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5053 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5054 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5055 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5056 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5057 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5058 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5059 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5060 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5061 | { |
| 5062 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5063 | /* .name = "Capture Source", */ |
| 5064 | .name = "Input Source", |
| 5065 | .count = 2, |
| 5066 | .info = alc883_mux_enum_info, |
| 5067 | .get = alc883_mux_enum_get, |
| 5068 | .put = alc883_mux_enum_put, |
| 5069 | }, |
| 5070 | { } /* end */ |
| 5071 | }; |
| 5072 | |
| 5073 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 5074 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5075 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5076 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5077 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5078 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5079 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5080 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5081 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5082 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5083 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5084 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5085 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5086 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5087 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5088 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5089 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5090 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5091 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5092 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5093 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5094 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5095 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5096 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5097 | { |
| 5098 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5099 | /* .name = "Capture Source", */ |
| 5100 | .name = "Input Source", |
| 5101 | .count = 2, |
| 5102 | .info = alc883_mux_enum_info, |
| 5103 | .get = alc883_mux_enum_get, |
| 5104 | .put = alc883_mux_enum_put, |
| 5105 | }, |
| 5106 | { } /* end */ |
| 5107 | }; |
| 5108 | |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5109 | static snd_kcontrol_new_t alc883_fivestack_mixer[] = { |
| 5110 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5111 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5112 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5113 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5114 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5115 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5116 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 5117 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 5118 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5119 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5120 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5121 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5122 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5123 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5125 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5126 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5127 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5128 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5129 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5130 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5131 | |
| 5132 | { |
| 5133 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5134 | /* .name = "Capture Source", */ |
| 5135 | .name = "Input Source", |
| 5136 | .count = 1, |
| 5137 | .info = alc883_mux_enum_info, |
| 5138 | .get = alc883_mux_enum_get, |
| 5139 | .put = alc883_mux_enum_put, |
| 5140 | }, |
| 5141 | { } /* end */ |
| 5142 | }; |
| 5143 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5144 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 5145 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5146 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5147 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5148 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5149 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5150 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5151 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5152 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5153 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5154 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5155 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5156 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5157 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5158 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5159 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5160 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5161 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5162 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5163 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5164 | { |
| 5165 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5166 | /* .name = "Capture Source", */ |
| 5167 | .name = "Input Source", |
| 5168 | .count = 2, |
| 5169 | .info = alc883_mux_enum_info, |
| 5170 | .get = alc883_mux_enum_get, |
| 5171 | .put = alc883_mux_enum_put, |
| 5172 | }, |
| 5173 | { } /* end */ |
| 5174 | }; |
| 5175 | |
| 5176 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 5177 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5178 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5179 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5180 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5181 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5182 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5183 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5184 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5185 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5186 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5187 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5188 | { |
| 5189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5190 | /* .name = "Capture Source", */ |
| 5191 | .name = "Input Source", |
| 5192 | .count = 2, |
| 5193 | .info = alc883_mux_enum_info, |
| 5194 | .get = alc883_mux_enum_get, |
| 5195 | .put = alc883_mux_enum_put, |
| 5196 | }, |
| 5197 | { } /* end */ |
| 5198 | }; |
| 5199 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5200 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 5201 | { |
| 5202 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5203 | .name = "Channel Mode", |
| 5204 | .info = alc_ch_mode_info, |
| 5205 | .get = alc_ch_mode_get, |
| 5206 | .put = alc_ch_mode_put, |
| 5207 | }, |
| 5208 | { } /* end */ |
| 5209 | }; |
| 5210 | |
| 5211 | static struct hda_verb alc883_init_verbs[] = { |
| 5212 | /* ADC1: mute amp left and right */ |
| 5213 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5214 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5215 | /* ADC2: mute amp left and right */ |
| 5216 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5217 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5218 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5220 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5221 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5222 | /* Rear mixer */ |
| 5223 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5224 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5225 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5226 | /* CLFE mixer */ |
| 5227 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5228 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5229 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5230 | /* Side mixer */ |
| 5231 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5232 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5233 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5234 | |
| 5235 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5236 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5237 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5238 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5239 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5240 | |
| 5241 | /* Front Pin: output 0 (0x0c) */ |
| 5242 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5243 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5244 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5245 | /* Rear Pin: output 1 (0x0d) */ |
| 5246 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5248 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5249 | /* CLFE Pin: output 2 (0x0e) */ |
| 5250 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5251 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5252 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5253 | /* Side Pin: output 3 (0x0f) */ |
| 5254 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5255 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5256 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 5257 | /* Mic (rear) pin: input vref at 80% */ |
| 5258 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5259 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5260 | /* Front Mic pin: input vref at 80% */ |
| 5261 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5262 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5263 | /* Line In pin: input */ |
| 5264 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5265 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5266 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5267 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5268 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5269 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5270 | /* CD pin widget for input */ |
| 5271 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5272 | |
| 5273 | /* FIXME: use matrix-type input source selection */ |
| 5274 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5275 | /* Input mixer2 */ |
| 5276 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5277 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5278 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5279 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5280 | /* Input mixer3 */ |
| 5281 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5282 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5283 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5284 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5285 | { } |
| 5286 | }; |
| 5287 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5288 | static struct hda_verb alc883_tagra_verbs[] = { |
| 5289 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5290 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5291 | |
| 5292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5293 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5294 | |
| 5295 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5296 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5297 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5298 | |
| 5299 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5300 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5301 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5302 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5303 | |
| 5304 | { } /* end */ |
| 5305 | }; |
| 5306 | |
| 5307 | /* toggle speaker-output according to the hp-jack state */ |
| 5308 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 5309 | { |
| 5310 | unsigned int present; |
| 5311 | |
| 5312 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5313 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5314 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 5315 | 0x80, present ? 0x80 : 0); |
| 5316 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 5317 | 0x80, present ? 0x80 : 0); |
| 5318 | snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3); |
| 5319 | } |
| 5320 | |
| 5321 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5322 | { |
| 5323 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5324 | alc883_tagra_automute(codec); |
| 5325 | } |
| 5326 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5327 | /* |
| 5328 | * generic initialization of ADC, input mixers and output mixers |
| 5329 | */ |
| 5330 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 5331 | /* |
| 5332 | * Unmute ADC0-2 and set the default input to mic-in |
| 5333 | */ |
| 5334 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5335 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5336 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5337 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5338 | |
| 5339 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5340 | * mixer widget |
| 5341 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 5342 | * mic (mic 2) |
| 5343 | */ |
| 5344 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 5345 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5346 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5347 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5348 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5349 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5350 | |
| 5351 | /* |
| 5352 | * Set up output mixers (0x0c - 0x0f) |
| 5353 | */ |
| 5354 | /* set vol=0 to output mixers */ |
| 5355 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5356 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5357 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5358 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5359 | /* set up input amps for analog loopback */ |
| 5360 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5361 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5363 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5364 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5365 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5366 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5367 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5368 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5369 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5370 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5371 | |
| 5372 | /* FIXME: use matrix-type input source selection */ |
| 5373 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5374 | /* Input mixer1 */ |
| 5375 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5376 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5377 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5378 | //{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5379 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5380 | /* Input mixer2 */ |
| 5381 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5382 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5383 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5384 | //{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5385 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5386 | |
| 5387 | { } |
| 5388 | }; |
| 5389 | |
| 5390 | /* capture mixer elements */ |
| 5391 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 5392 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5393 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5394 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5395 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5396 | { |
| 5397 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5398 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5399 | * So call somewhat different.. |
| 5400 | * FIXME: the controls appear in the "playback" view! |
| 5401 | */ |
| 5402 | /* .name = "Capture Source", */ |
| 5403 | .name = "Input Source", |
| 5404 | .count = 2, |
| 5405 | .info = alc882_mux_enum_info, |
| 5406 | .get = alc882_mux_enum_get, |
| 5407 | .put = alc882_mux_enum_put, |
| 5408 | }, |
| 5409 | { } /* end */ |
| 5410 | }; |
| 5411 | |
| 5412 | /* pcm configuration: identiacal with ALC880 */ |
| 5413 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 5414 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 5415 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 5416 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 5417 | |
| 5418 | /* |
| 5419 | * configuration and preset |
| 5420 | */ |
| 5421 | static struct hda_board_config alc883_cfg_tbl[] = { |
| 5422 | { .modelname = "3stack-dig", .config = ALC883_3ST_2ch_DIG }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5423 | { .modelname = "3stack-6ch-dig", .config = ALC883_3ST_6ch_DIG }, |
| 5424 | { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668, |
| 5425 | .config = ALC883_3ST_6ch_DIG }, /* ECS to Intel*/ |
| 5426 | { .modelname = "3stack-6ch", .config = ALC883_3ST_6ch }, |
| 5427 | { .pci_subvendor = 0x108e, .pci_subdevice = 0x534d, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5428 | .config = ALC883_3ST_6ch }, |
| 5429 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd601, |
| 5430 | .config = ALC883_3ST_6ch }, /* D102GGC */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5431 | { .modelname = "6stack-dig", .config = ALC883_6ST_DIG }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5432 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668, |
| 5433 | .config = ALC883_6ST_DIG }, /* MSI */ |
Leonard Norrgård | e22a9a8 | 2007-01-01 19:00:54 +0200 | [diff] [blame] | 5434 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x7280, |
| 5435 | .config = ALC883_6ST_DIG }, /* MSI K9A Platinum (MS-7280) */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5436 | { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668, |
| 5437 | .config = ALC883_6ST_DIG }, /* Foxconn */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5438 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x7187, |
| 5439 | .config = ALC883_6ST_DIG }, /* MSI */ |
| 5440 | { .modelname = "targa-dig", .config = ALC883_TARGA_DIG }, |
| 5441 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x4314, |
| 5442 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5443 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3fcc, |
| 5444 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5445 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3fc1, |
| 5446 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5447 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3fc3, |
| 5448 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5449 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x4314, |
| 5450 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5451 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x4319, |
| 5452 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5453 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3ef9, |
| 5454 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5455 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x4324, |
| 5456 | .config = ALC883_TARGA_DIG }, /* MSI */ |
| 5457 | { .modelname = "targa-2ch-dig", .config = ALC883_TARGA_2ch_DIG }, |
| 5458 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x0579, |
| 5459 | .config = ALC883_TARGA_2ch_DIG }, /* MSI */ |
| 5460 | { .pci_subvendor = 0x1462, .pci_subdevice = 0xa422, |
| 5461 | .config = ALC883_TARGA_2ch_DIG }, /* MSI */ |
| 5462 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x3b7f, |
| 5463 | .config = ALC883_TARGA_2ch_DIG }, /* MSI */ |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5464 | { .modelname = "6stack-dig-demo", .config = ALC888_DEMO_BOARD }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 5465 | { .modelname = "acer", .config = ALC883_ACER }, |
| 5466 | { .pci_subvendor = 0x1025, .pci_subdevice = 0/*0x0102*/, |
| 5467 | .config = ALC883_ACER }, |
Tobin Davis | 7a99795 | 2006-09-26 15:30:10 +0200 | [diff] [blame] | 5468 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0102, |
| 5469 | .config = ALC883_ACER }, |
| 5470 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x009f, |
| 5471 | .config = ALC883_ACER }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5472 | { .pci_subvendor = 0x161f, .pci_subdevice = 0x2054, |
Takashi Iwai | 35f6083 | 2006-10-13 12:46:10 +0200 | [diff] [blame] | 5473 | .modelname = "medion", .config = ALC883_MEDION }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5474 | { .modelname = "auto", .config = ALC883_AUTO }, |
| 5475 | {} |
| 5476 | }; |
| 5477 | |
| 5478 | static struct alc_config_preset alc883_presets[] = { |
| 5479 | [ALC883_3ST_2ch_DIG] = { |
| 5480 | .mixers = { alc883_3ST_2ch_mixer }, |
| 5481 | .init_verbs = { alc883_init_verbs }, |
| 5482 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5483 | .dac_nids = alc883_dac_nids, |
| 5484 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5485 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5486 | .adc_nids = alc883_adc_nids, |
| 5487 | .dig_in_nid = ALC883_DIGIN_NID, |
| 5488 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 5489 | .channel_mode = alc883_3ST_2ch_modes, |
| 5490 | .input_mux = &alc883_capture_source, |
| 5491 | }, |
| 5492 | [ALC883_3ST_6ch_DIG] = { |
| 5493 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 5494 | .init_verbs = { alc883_init_verbs }, |
| 5495 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5496 | .dac_nids = alc883_dac_nids, |
| 5497 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5498 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5499 | .adc_nids = alc883_adc_nids, |
| 5500 | .dig_in_nid = ALC883_DIGIN_NID, |
| 5501 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 5502 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5503 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5504 | .input_mux = &alc883_capture_source, |
| 5505 | }, |
| 5506 | [ALC883_3ST_6ch] = { |
| 5507 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 5508 | .init_verbs = { alc883_init_verbs }, |
| 5509 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5510 | .dac_nids = alc883_dac_nids, |
| 5511 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5512 | .adc_nids = alc883_adc_nids, |
| 5513 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 5514 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5515 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5516 | .input_mux = &alc883_capture_source, |
| 5517 | }, |
| 5518 | [ALC883_6ST_DIG] = { |
| 5519 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 5520 | .init_verbs = { alc883_init_verbs }, |
| 5521 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5522 | .dac_nids = alc883_dac_nids, |
| 5523 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5524 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5525 | .adc_nids = alc883_adc_nids, |
| 5526 | .dig_in_nid = ALC883_DIGIN_NID, |
| 5527 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 5528 | .channel_mode = alc883_sixstack_modes, |
| 5529 | .input_mux = &alc883_capture_source, |
| 5530 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5531 | [ALC883_TARGA_DIG] = { |
| 5532 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 5533 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 5534 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5535 | .dac_nids = alc883_dac_nids, |
| 5536 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5537 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5538 | .adc_nids = alc883_adc_nids, |
| 5539 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 5540 | .channel_mode = alc883_3ST_6ch_modes, |
| 5541 | .need_dac_fix = 1, |
| 5542 | .input_mux = &alc883_capture_source, |
| 5543 | .unsol_event = alc883_tagra_unsol_event, |
| 5544 | .init_hook = alc883_tagra_automute, |
| 5545 | }, |
| 5546 | [ALC883_TARGA_2ch_DIG] = { |
| 5547 | .mixers = { alc883_tagra_2ch_mixer}, |
| 5548 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 5549 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5550 | .dac_nids = alc883_dac_nids, |
| 5551 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5552 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5553 | .adc_nids = alc883_adc_nids, |
| 5554 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 5555 | .channel_mode = alc883_3ST_2ch_modes, |
| 5556 | .input_mux = &alc883_capture_source, |
| 5557 | .unsol_event = alc883_tagra_unsol_event, |
| 5558 | .init_hook = alc883_tagra_automute, |
| 5559 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5560 | [ALC888_DEMO_BOARD] = { |
| 5561 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 5562 | .init_verbs = { alc883_init_verbs }, |
| 5563 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5564 | .dac_nids = alc883_dac_nids, |
| 5565 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 5566 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5567 | .adc_nids = alc883_adc_nids, |
| 5568 | .dig_in_nid = ALC883_DIGIN_NID, |
| 5569 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 5570 | .channel_mode = alc883_sixstack_modes, |
| 5571 | .input_mux = &alc883_capture_source, |
| 5572 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 5573 | [ALC883_ACER] = { |
| 5574 | .mixers = { alc883_base_mixer, |
| 5575 | alc883_chmode_mixer }, |
| 5576 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 5577 | * and the headphone jack. Turn this on and rely on the |
| 5578 | * standard mute methods whenever the user wants to turn |
| 5579 | * these outputs off. |
| 5580 | */ |
| 5581 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 5582 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5583 | .dac_nids = alc883_dac_nids, |
| 5584 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5585 | .adc_nids = alc883_adc_nids, |
| 5586 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 5587 | .channel_mode = alc883_3ST_2ch_modes, |
| 5588 | .input_mux = &alc883_capture_source, |
| 5589 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5590 | [ALC883_MEDION] = { |
| 5591 | .mixers = { alc883_fivestack_mixer, |
| 5592 | alc883_chmode_mixer }, |
| 5593 | .init_verbs = { alc883_init_verbs, |
| 5594 | alc882_eapd_verbs }, |
| 5595 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 5596 | .dac_nids = alc883_dac_nids, |
| 5597 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 5598 | .adc_nids = alc883_adc_nids, |
| 5599 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 5600 | .channel_mode = alc883_sixstack_modes, |
| 5601 | .input_mux = &alc883_capture_source, |
| 5602 | } |
| 5603 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5604 | }; |
| 5605 | |
| 5606 | |
| 5607 | /* |
| 5608 | * BIOS auto configuration |
| 5609 | */ |
| 5610 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5611 | hda_nid_t nid, int pin_type, |
| 5612 | int dac_idx) |
| 5613 | { |
| 5614 | /* set as output */ |
| 5615 | struct alc_spec *spec = codec->spec; |
| 5616 | int idx; |
| 5617 | |
| 5618 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 5619 | idx = 4; |
| 5620 | else |
| 5621 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 5622 | |
| 5623 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5624 | pin_type); |
| 5625 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5626 | AMP_OUT_UNMUTE); |
| 5627 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 5628 | |
| 5629 | } |
| 5630 | |
| 5631 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 5632 | { |
| 5633 | struct alc_spec *spec = codec->spec; |
| 5634 | int i; |
| 5635 | |
| 5636 | for (i = 0; i <= HDA_SIDE; i++) { |
| 5637 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 5638 | if (nid) |
| 5639 | alc883_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); |
| 5640 | } |
| 5641 | } |
| 5642 | |
| 5643 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 5644 | { |
| 5645 | struct alc_spec *spec = codec->spec; |
| 5646 | hda_nid_t pin; |
| 5647 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5648 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5649 | if (pin) /* connect to front */ |
| 5650 | /* use dac 0 */ |
| 5651 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5652 | } |
| 5653 | |
| 5654 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 5655 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 5656 | |
| 5657 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 5658 | { |
| 5659 | struct alc_spec *spec = codec->spec; |
| 5660 | int i; |
| 5661 | |
| 5662 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5663 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5664 | if (alc883_is_input_pin(nid)) { |
| 5665 | snd_hda_codec_write(codec, nid, 0, |
| 5666 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5667 | (i <= AUTO_PIN_FRONT_MIC ? |
| 5668 | PIN_VREF80 : PIN_IN)); |
| 5669 | if (nid != ALC883_PIN_CD_NID) |
| 5670 | snd_hda_codec_write(codec, nid, 0, |
| 5671 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 5672 | AMP_OUT_MUTE); |
| 5673 | } |
| 5674 | } |
| 5675 | } |
| 5676 | |
| 5677 | /* almost identical with ALC880 parser... */ |
| 5678 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 5679 | { |
| 5680 | struct alc_spec *spec = codec->spec; |
| 5681 | int err = alc880_parse_auto_config(codec); |
| 5682 | |
| 5683 | if (err < 0) |
| 5684 | return err; |
| 5685 | else if (err > 0) |
| 5686 | /* hack - override the init verbs */ |
| 5687 | spec->init_verbs[0] = alc883_auto_init_verbs; |
| 5688 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 5689 | spec->num_mixers++; |
| 5690 | return err; |
| 5691 | } |
| 5692 | |
| 5693 | /* additional initialization for auto-configuration model */ |
| 5694 | static void alc883_auto_init(struct hda_codec *codec) |
| 5695 | { |
| 5696 | alc883_auto_init_multi_out(codec); |
| 5697 | alc883_auto_init_hp_out(codec); |
| 5698 | alc883_auto_init_analog_input(codec); |
| 5699 | } |
| 5700 | |
| 5701 | static int patch_alc883(struct hda_codec *codec) |
| 5702 | { |
| 5703 | struct alc_spec *spec; |
| 5704 | int err, board_config; |
| 5705 | |
| 5706 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5707 | if (spec == NULL) |
| 5708 | return -ENOMEM; |
| 5709 | |
| 5710 | codec->spec = spec; |
| 5711 | |
| 5712 | board_config = snd_hda_check_board_config(codec, alc883_cfg_tbl); |
| 5713 | if (board_config < 0 || board_config >= ALC883_MODEL_LAST) { |
| 5714 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 5715 | "trying auto-probe from BIOS...\n"); |
| 5716 | board_config = ALC883_AUTO; |
| 5717 | } |
| 5718 | |
| 5719 | if (board_config == ALC883_AUTO) { |
| 5720 | /* automatic parse from the BIOS config */ |
| 5721 | err = alc883_parse_auto_config(codec); |
| 5722 | if (err < 0) { |
| 5723 | alc_free(codec); |
| 5724 | return err; |
| 5725 | } else if (! err) { |
| 5726 | printk(KERN_INFO |
| 5727 | "hda_codec: Cannot set up configuration " |
| 5728 | "from BIOS. Using base mode...\n"); |
| 5729 | board_config = ALC883_3ST_2ch_DIG; |
| 5730 | } |
| 5731 | } |
| 5732 | |
| 5733 | if (board_config != ALC883_AUTO) |
| 5734 | setup_preset(spec, &alc883_presets[board_config]); |
| 5735 | |
| 5736 | spec->stream_name_analog = "ALC883 Analog"; |
| 5737 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 5738 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 5739 | |
| 5740 | spec->stream_name_digital = "ALC883 Digital"; |
| 5741 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 5742 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 5743 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5744 | if (! spec->adc_nids && spec->input_mux) { |
| 5745 | spec->adc_nids = alc883_adc_nids; |
| 5746 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 5747 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5748 | |
| 5749 | codec->patch_ops = alc_patch_ops; |
| 5750 | if (board_config == ALC883_AUTO) |
| 5751 | spec->init_hook = alc883_auto_init; |
| 5752 | |
| 5753 | return 0; |
| 5754 | } |
| 5755 | |
| 5756 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5757 | * ALC262 support |
| 5758 | */ |
| 5759 | |
| 5760 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 5761 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 5762 | |
| 5763 | #define alc262_dac_nids alc260_dac_nids |
| 5764 | #define alc262_adc_nids alc882_adc_nids |
| 5765 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 5766 | |
| 5767 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 5768 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5769 | |
| 5770 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 5771 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5772 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5773 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5774 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5775 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5776 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5777 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5778 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5779 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5780 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5781 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5782 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 5783 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 5784 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5785 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5786 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5787 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 5788 | }; |
| 5789 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5790 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 5791 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5792 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5793 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5794 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5795 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5796 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5797 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5798 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5799 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5801 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5802 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 5803 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 5804 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5805 | { } /* end */ |
| 5806 | }; |
| 5807 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5808 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 5809 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5810 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5811 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5812 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5813 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 5814 | |
| 5815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5816 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5817 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5818 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5819 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5820 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5821 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5822 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5823 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5824 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5825 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 5826 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 5827 | { } /* end */ |
| 5828 | }; |
| 5829 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5830 | #define alc262_capture_mixer alc882_capture_mixer |
| 5831 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 5832 | |
| 5833 | /* |
| 5834 | * generic initialization of ADC, input mixers and output mixers |
| 5835 | */ |
| 5836 | static struct hda_verb alc262_init_verbs[] = { |
| 5837 | /* |
| 5838 | * Unmute ADC0-2 and set the default input to mic-in |
| 5839 | */ |
| 5840 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5841 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5842 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5843 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5844 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5845 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5846 | |
| 5847 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5848 | * mixer widget |
| 5849 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 5850 | * mic (mic 2) |
| 5851 | */ |
| 5852 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 5853 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5854 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5855 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5856 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5857 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5858 | |
| 5859 | /* |
| 5860 | * Set up output mixers (0x0c - 0x0e) |
| 5861 | */ |
| 5862 | /* set vol=0 to output mixers */ |
| 5863 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5864 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5865 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5866 | /* set up input amps for analog loopback */ |
| 5867 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5868 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5869 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5870 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5871 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5872 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5873 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5874 | |
| 5875 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5876 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5877 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5878 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5879 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5880 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5881 | |
| 5882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5883 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5884 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5885 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5886 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5887 | |
| 5888 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5889 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5890 | |
| 5891 | /* FIXME: use matrix-type input source selection */ |
| 5892 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5893 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5894 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5895 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5896 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5897 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5898 | /* Input mixer2 */ |
| 5899 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5900 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5901 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5902 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5903 | /* Input mixer3 */ |
| 5904 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5905 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5906 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5907 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5908 | |
| 5909 | { } |
| 5910 | }; |
| 5911 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5912 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 5913 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5914 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5915 | {} |
| 5916 | }; |
| 5917 | |
| 5918 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 5919 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5920 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5921 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5922 | |
| 5923 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5924 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5925 | {} |
| 5926 | }; |
| 5927 | |
| 5928 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 5929 | static void alc262_hippo_automute(struct hda_codec *codec, int force) |
| 5930 | { |
| 5931 | struct alc_spec *spec = codec->spec; |
| 5932 | unsigned int mute; |
| 5933 | |
| 5934 | if (force || ! spec->sense_updated) { |
| 5935 | unsigned int present; |
| 5936 | /* need to execute and sync at first */ |
| 5937 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 5938 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5939 | AC_VERB_GET_PIN_SENSE, 0); |
| 5940 | spec->jack_present = (present & 0x80000000) != 0; |
| 5941 | spec->sense_updated = 1; |
| 5942 | } |
| 5943 | if (spec->jack_present) { |
| 5944 | /* mute internal speaker */ |
| 5945 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 5946 | 0x80, 0x80); |
| 5947 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 5948 | 0x80, 0x80); |
| 5949 | } else { |
| 5950 | /* unmute internal speaker if necessary */ |
| 5951 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 5952 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 5953 | 0x80, mute & 0x80); |
| 5954 | mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0); |
| 5955 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 5956 | 0x80, mute & 0x80); |
| 5957 | } |
| 5958 | } |
| 5959 | |
| 5960 | /* unsolicited event for HP jack sensing */ |
| 5961 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 5962 | unsigned int res) |
| 5963 | { |
| 5964 | if ((res >> 26) != ALC880_HP_EVENT) |
| 5965 | return; |
| 5966 | alc262_hippo_automute(codec, 1); |
| 5967 | } |
| 5968 | |
| 5969 | static void alc262_hippo1_automute(struct hda_codec *codec, int force) |
| 5970 | { |
| 5971 | struct alc_spec *spec = codec->spec; |
| 5972 | unsigned int mute; |
| 5973 | |
| 5974 | if (force || ! spec->sense_updated) { |
| 5975 | unsigned int present; |
| 5976 | /* need to execute and sync at first */ |
| 5977 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 5978 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 5979 | AC_VERB_GET_PIN_SENSE, 0); |
| 5980 | spec->jack_present = (present & 0x80000000) != 0; |
| 5981 | spec->sense_updated = 1; |
| 5982 | } |
| 5983 | if (spec->jack_present) { |
| 5984 | /* mute internal speaker */ |
| 5985 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 5986 | 0x80, 0x80); |
| 5987 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 5988 | 0x80, 0x80); |
| 5989 | } else { |
| 5990 | /* unmute internal speaker if necessary */ |
| 5991 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 5992 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 5993 | 0x80, mute & 0x80); |
| 5994 | mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0); |
| 5995 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 5996 | 0x80, mute & 0x80); |
| 5997 | } |
| 5998 | } |
| 5999 | |
| 6000 | /* unsolicited event for HP jack sensing */ |
| 6001 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 6002 | unsigned int res) |
| 6003 | { |
| 6004 | if ((res >> 26) != ALC880_HP_EVENT) |
| 6005 | return; |
| 6006 | alc262_hippo1_automute(codec, 1); |
| 6007 | } |
| 6008 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6009 | /* |
| 6010 | * fujitsu model |
| 6011 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 6012 | */ |
| 6013 | |
| 6014 | #define ALC_HP_EVENT 0x37 |
| 6015 | |
| 6016 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 6017 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 6018 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6019 | {} |
| 6020 | }; |
| 6021 | |
| 6022 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
| 6023 | .num_items = 2, |
| 6024 | .items = { |
| 6025 | { "Mic", 0x0 }, |
| 6026 | { "CD", 0x4 }, |
| 6027 | }, |
| 6028 | }; |
| 6029 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6030 | static struct hda_input_mux alc262_HP_capture_source = { |
| 6031 | .num_items = 5, |
| 6032 | .items = { |
| 6033 | { "Mic", 0x0 }, |
| 6034 | { "Front Mic", 0x3 }, |
| 6035 | { "Line", 0x2 }, |
| 6036 | { "CD", 0x4 }, |
| 6037 | { "AUX IN", 0x6 }, |
| 6038 | }, |
| 6039 | }; |
| 6040 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6041 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 6042 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 6043 | { |
| 6044 | struct alc_spec *spec = codec->spec; |
| 6045 | unsigned int mute; |
| 6046 | |
| 6047 | if (force || ! spec->sense_updated) { |
| 6048 | unsigned int present; |
| 6049 | /* need to execute and sync at first */ |
| 6050 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 6051 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6052 | AC_VERB_GET_PIN_SENSE, 0); |
| 6053 | spec->jack_present = (present & 0x80000000) != 0; |
| 6054 | spec->sense_updated = 1; |
| 6055 | } |
| 6056 | if (spec->jack_present) { |
| 6057 | /* mute internal speaker */ |
| 6058 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6059 | 0x80, 0x80); |
| 6060 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6061 | 0x80, 0x80); |
| 6062 | } else { |
| 6063 | /* unmute internal speaker if necessary */ |
| 6064 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 6065 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6066 | 0x80, mute & 0x80); |
| 6067 | mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0); |
| 6068 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6069 | 0x80, mute & 0x80); |
| 6070 | } |
| 6071 | } |
| 6072 | |
| 6073 | /* unsolicited event for HP jack sensing */ |
| 6074 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 6075 | unsigned int res) |
| 6076 | { |
| 6077 | if ((res >> 26) != ALC_HP_EVENT) |
| 6078 | return; |
| 6079 | alc262_fujitsu_automute(codec, 1); |
| 6080 | } |
| 6081 | |
| 6082 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 6083 | static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol, |
| 6084 | struct snd_ctl_elem_value *ucontrol) |
| 6085 | { |
| 6086 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6087 | long *valp = ucontrol->value.integer.value; |
| 6088 | int change; |
| 6089 | |
| 6090 | change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 6091 | 0x7f, valp[0] & 0x7f); |
| 6092 | change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 6093 | 0x7f, valp[1] & 0x7f); |
| 6094 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 6095 | 0x7f, valp[0] & 0x7f); |
| 6096 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 6097 | 0x7f, valp[1] & 0x7f); |
| 6098 | return change; |
| 6099 | } |
| 6100 | |
| 6101 | /* bind hp and internal speaker mute (with plug check) */ |
| 6102 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 6103 | struct snd_ctl_elem_value *ucontrol) |
| 6104 | { |
| 6105 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6106 | long *valp = ucontrol->value.integer.value; |
| 6107 | int change; |
| 6108 | |
| 6109 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 6110 | 0x80, valp[0] ? 0 : 0x80); |
| 6111 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 6112 | 0x80, valp[1] ? 0 : 0x80); |
| 6113 | if (change || codec->in_resume) |
| 6114 | alc262_fujitsu_automute(codec, codec->in_resume); |
| 6115 | return change; |
| 6116 | } |
| 6117 | |
| 6118 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
| 6119 | { |
| 6120 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6121 | .name = "Master Playback Volume", |
| 6122 | .info = snd_hda_mixer_amp_volume_info, |
| 6123 | .get = snd_hda_mixer_amp_volume_get, |
| 6124 | .put = alc262_fujitsu_master_vol_put, |
Takashi Iwai | c256652 | 2006-08-17 18:21:36 +0200 | [diff] [blame] | 6125 | .tlv = { .c = snd_hda_mixer_amp_tlv }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6126 | .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 6127 | }, |
| 6128 | { |
| 6129 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6130 | .name = "Master Playback Switch", |
| 6131 | .info = snd_hda_mixer_amp_switch_info, |
| 6132 | .get = snd_hda_mixer_amp_switch_get, |
| 6133 | .put = alc262_fujitsu_master_sw_put, |
| 6134 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 6135 | }, |
| 6136 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6137 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6138 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6139 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6140 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6141 | { } /* end */ |
| 6142 | }; |
| 6143 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 6144 | /* additional init verbs for Benq laptops */ |
| 6145 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 6146 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6147 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6148 | {} |
| 6149 | }; |
| 6150 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6151 | /* add playback controls from the parsed DAC table */ |
| 6152 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) |
| 6153 | { |
| 6154 | hda_nid_t nid; |
| 6155 | int err; |
| 6156 | |
| 6157 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 6158 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6159 | spec->multiout.dac_nids[0] = 2; |
| 6160 | |
| 6161 | nid = cfg->line_out_pins[0]; |
| 6162 | if (nid) { |
| 6163 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Front Playback Volume", |
| 6164 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT))) < 0) |
| 6165 | return err; |
| 6166 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Front Playback Switch", |
| 6167 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 6168 | return err; |
| 6169 | } |
| 6170 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6171 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6172 | if (nid) { |
| 6173 | if (nid == 0x16) { |
| 6174 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Speaker Playback Volume", |
| 6175 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT))) < 0) |
| 6176 | return err; |
| 6177 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", |
| 6178 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 6179 | return err; |
| 6180 | } else { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6181 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", |
| 6182 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 6183 | return err; |
| 6184 | } |
| 6185 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6186 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6187 | if (nid) { |
| 6188 | /* spec->multiout.hp_nid = 2; */ |
| 6189 | if (nid == 0x16) { |
| 6190 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Headphone Playback Volume", |
| 6191 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT))) < 0) |
| 6192 | return err; |
| 6193 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", |
| 6194 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 6195 | return err; |
| 6196 | } else { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6197 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", |
| 6198 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 6199 | return err; |
| 6200 | } |
| 6201 | } |
| 6202 | return 0; |
| 6203 | } |
| 6204 | |
| 6205 | /* identical with ALC880 */ |
| 6206 | #define alc262_auto_create_analog_input_ctls alc880_auto_create_analog_input_ctls |
| 6207 | |
| 6208 | /* |
| 6209 | * generic initialization of ADC, input mixers and output mixers |
| 6210 | */ |
| 6211 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 6212 | /* |
| 6213 | * Unmute ADC0-2 and set the default input to mic-in |
| 6214 | */ |
| 6215 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6217 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6218 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6219 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6220 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6221 | |
| 6222 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6223 | * mixer widget |
| 6224 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 6225 | * mic (mic 2) |
| 6226 | */ |
| 6227 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6228 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6229 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6230 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6231 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6232 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6233 | |
| 6234 | /* |
| 6235 | * Set up output mixers (0x0c - 0x0f) |
| 6236 | */ |
| 6237 | /* set vol=0 to output mixers */ |
| 6238 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6239 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6240 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6241 | |
| 6242 | /* set up input amps for analog loopback */ |
| 6243 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6244 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6245 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6246 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6247 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6248 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6249 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6250 | |
| 6251 | /* FIXME: use matrix-type input source selection */ |
| 6252 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6253 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6256 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6257 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6258 | /* Input mixer2 */ |
| 6259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6261 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6262 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6263 | /* Input mixer3 */ |
| 6264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6266 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6267 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6268 | |
| 6269 | { } |
| 6270 | }; |
| 6271 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6272 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 6273 | /* |
| 6274 | * Unmute ADC0-2 and set the default input to mic-in |
| 6275 | */ |
| 6276 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6277 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6278 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6279 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6280 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6281 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6282 | |
| 6283 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6284 | * mixer widget |
| 6285 | * Note: PASD motherboards uses the Line In 2 as the input for front panel |
| 6286 | * mic (mic 2) |
| 6287 | */ |
| 6288 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 6295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 6296 | |
| 6297 | /* |
| 6298 | * Set up output mixers (0x0c - 0x0e) |
| 6299 | */ |
| 6300 | /* set vol=0 to output mixers */ |
| 6301 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6302 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6303 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6304 | |
| 6305 | /* set up input amps for analog loopback */ |
| 6306 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6312 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6313 | |
| 6314 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6315 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6316 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6317 | |
| 6318 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6319 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6320 | |
| 6321 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6322 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6323 | |
| 6324 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6325 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6326 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6327 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6328 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6329 | |
| 6330 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 6331 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 6332 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 6333 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 6334 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 6335 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 6336 | |
| 6337 | |
| 6338 | /* FIXME: use matrix-type input source selection */ |
| 6339 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6340 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6341 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6342 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 6343 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 6344 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 6345 | /* Input mixer2 */ |
| 6346 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6347 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 6348 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 6349 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 6350 | /* Input mixer3 */ |
| 6351 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6352 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 6353 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 6354 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 6355 | |
| 6356 | { } |
| 6357 | }; |
| 6358 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6359 | /* pcm configuration: identiacal with ALC880 */ |
| 6360 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 6361 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 6362 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 6363 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 6364 | |
| 6365 | /* |
| 6366 | * BIOS auto configuration |
| 6367 | */ |
| 6368 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 6369 | { |
| 6370 | struct alc_spec *spec = codec->spec; |
| 6371 | int err; |
| 6372 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 6373 | |
| 6374 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6375 | alc262_ignore)) < 0) |
| 6376 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6377 | if (! spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6378 | return 0; /* can't find valid BIOS pin config */ |
| 6379 | if ((err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || |
| 6380 | (err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
| 6381 | return err; |
| 6382 | |
| 6383 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 6384 | |
| 6385 | if (spec->autocfg.dig_out_pin) |
| 6386 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 6387 | if (spec->autocfg.dig_in_pin) |
| 6388 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 6389 | |
| 6390 | if (spec->kctl_alloc) |
| 6391 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 6392 | |
| 6393 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6394 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6395 | spec->input_mux = &spec->private_imux; |
| 6396 | |
| 6397 | return 1; |
| 6398 | } |
| 6399 | |
| 6400 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 6401 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 6402 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 6403 | |
| 6404 | |
| 6405 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6406 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6407 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6408 | alc262_auto_init_multi_out(codec); |
| 6409 | alc262_auto_init_hp_out(codec); |
| 6410 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6411 | } |
| 6412 | |
| 6413 | /* |
| 6414 | * configuration and preset |
| 6415 | */ |
| 6416 | static struct hda_board_config alc262_cfg_tbl[] = { |
| 6417 | { .modelname = "basic", .config = ALC262_BASIC }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6418 | { .modelname = "hippo", |
| 6419 | .pci_subvendor =0x1002, .pci_subdevice = 0x437b, |
| 6420 | .config = ALC262_HIPPO}, |
| 6421 | { .modelname = "hippo_1", |
| 6422 | .pci_subvendor =0x17ff, .pci_subdevice = 0x058f, |
| 6423 | .config = ALC262_HIPPO_1}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6424 | { .modelname = "fujitsu", .config = ALC262_FUJITSU }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6425 | { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1397, |
| 6426 | .config = ALC262_FUJITSU }, |
Takashi Iwai | 6d177ba7 | 2006-07-25 14:51:15 +0200 | [diff] [blame] | 6427 | { .modelname = "hp-bpc", .config = ALC262_HP_BPC }, |
John W. Linville | 282e0c8 | 2006-11-06 12:01:53 +0100 | [diff] [blame] | 6428 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x280c, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6429 | .config = ALC262_HP_BPC }, /* xw4400 */ |
Takashi Iwai | efeccac | 2006-10-24 14:57:52 +0200 | [diff] [blame] | 6430 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x2801, |
| 6431 | .config = ALC262_HP_BPC }, /* q965 */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6432 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, |
| 6433 | .config = ALC262_HP_BPC }, /* xw6400 */ |
| 6434 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x3015, |
| 6435 | .config = ALC262_HP_BPC }, /* xw8400 */ |
| 6436 | { .pci_subvendor = 0x103c, .pci_subdevice = 0x12fe, |
| 6437 | .config = ALC262_HP_BPC }, /* xw9400 */ |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 6438 | { .modelname = "benq", .config = ALC262_BENQ_ED8 }, |
| 6439 | { .pci_subvendor = 0x17ff, .pci_subdevice = 0x0560, |
| 6440 | .config = ALC262_BENQ_ED8 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6441 | { .modelname = "auto", .config = ALC262_AUTO }, |
| 6442 | {} |
| 6443 | }; |
| 6444 | |
| 6445 | static struct alc_config_preset alc262_presets[] = { |
| 6446 | [ALC262_BASIC] = { |
| 6447 | .mixers = { alc262_base_mixer }, |
| 6448 | .init_verbs = { alc262_init_verbs }, |
| 6449 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6450 | .dac_nids = alc262_dac_nids, |
| 6451 | .hp_nid = 0x03, |
| 6452 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6453 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6454 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6455 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6456 | [ALC262_HIPPO] = { |
| 6457 | .mixers = { alc262_base_mixer }, |
| 6458 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 6459 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6460 | .dac_nids = alc262_dac_nids, |
| 6461 | .hp_nid = 0x03, |
| 6462 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 6463 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6464 | .channel_mode = alc262_modes, |
| 6465 | .input_mux = &alc262_capture_source, |
| 6466 | .unsol_event = alc262_hippo_unsol_event, |
| 6467 | }, |
| 6468 | [ALC262_HIPPO_1] = { |
| 6469 | .mixers = { alc262_hippo1_mixer }, |
| 6470 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 6471 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6472 | .dac_nids = alc262_dac_nids, |
| 6473 | .hp_nid = 0x02, |
| 6474 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 6475 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6476 | .channel_mode = alc262_modes, |
| 6477 | .input_mux = &alc262_capture_source, |
| 6478 | .unsol_event = alc262_hippo1_unsol_event, |
| 6479 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6480 | [ALC262_FUJITSU] = { |
| 6481 | .mixers = { alc262_fujitsu_mixer }, |
| 6482 | .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, |
| 6483 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6484 | .dac_nids = alc262_dac_nids, |
| 6485 | .hp_nid = 0x03, |
| 6486 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 6487 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6488 | .channel_mode = alc262_modes, |
| 6489 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6490 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6491 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6492 | [ALC262_HP_BPC] = { |
| 6493 | .mixers = { alc262_HP_BPC_mixer }, |
| 6494 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 6495 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6496 | .dac_nids = alc262_dac_nids, |
| 6497 | .hp_nid = 0x03, |
| 6498 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6499 | .channel_mode = alc262_modes, |
| 6500 | .input_mux = &alc262_HP_capture_source, |
| 6501 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 6502 | [ALC262_BENQ_ED8] = { |
| 6503 | .mixers = { alc262_base_mixer }, |
| 6504 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 6505 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 6506 | .dac_nids = alc262_dac_nids, |
| 6507 | .hp_nid = 0x03, |
| 6508 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 6509 | .channel_mode = alc262_modes, |
| 6510 | .input_mux = &alc262_capture_source, |
| 6511 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6512 | }; |
| 6513 | |
| 6514 | static int patch_alc262(struct hda_codec *codec) |
| 6515 | { |
| 6516 | struct alc_spec *spec; |
| 6517 | int board_config; |
| 6518 | int err; |
| 6519 | |
| 6520 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 6521 | if (spec == NULL) |
| 6522 | return -ENOMEM; |
| 6523 | |
| 6524 | codec->spec = spec; |
| 6525 | #if 0 |
| 6526 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is under-run */ |
| 6527 | { |
| 6528 | int tmp; |
| 6529 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 6530 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 6531 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 6532 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 6533 | } |
| 6534 | #endif |
| 6535 | |
| 6536 | board_config = snd_hda_check_board_config(codec, alc262_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6537 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6538 | if (board_config < 0 || board_config >= ALC262_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6539 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 6540 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6541 | board_config = ALC262_AUTO; |
| 6542 | } |
| 6543 | |
| 6544 | if (board_config == ALC262_AUTO) { |
| 6545 | /* automatic parse from the BIOS config */ |
| 6546 | err = alc262_parse_auto_config(codec); |
| 6547 | if (err < 0) { |
| 6548 | alc_free(codec); |
| 6549 | return err; |
| 6550 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6551 | printk(KERN_INFO |
| 6552 | "hda_codec: Cannot set up configuration " |
| 6553 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6554 | board_config = ALC262_BASIC; |
| 6555 | } |
| 6556 | } |
| 6557 | |
| 6558 | if (board_config != ALC262_AUTO) |
| 6559 | setup_preset(spec, &alc262_presets[board_config]); |
| 6560 | |
| 6561 | spec->stream_name_analog = "ALC262 Analog"; |
| 6562 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 6563 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 6564 | |
| 6565 | spec->stream_name_digital = "ALC262 Digital"; |
| 6566 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 6567 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 6568 | |
| 6569 | if (! spec->adc_nids && spec->input_mux) { |
| 6570 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6571 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 6572 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6573 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 6574 | if (wcap != AC_WID_AUD_IN) { |
| 6575 | spec->adc_nids = alc262_adc_nids_alt; |
| 6576 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
| 6577 | spec->mixers[spec->num_mixers] = alc262_capture_alt_mixer; |
| 6578 | spec->num_mixers++; |
| 6579 | } else { |
| 6580 | spec->adc_nids = alc262_adc_nids; |
| 6581 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 6582 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 6583 | spec->num_mixers++; |
| 6584 | } |
| 6585 | } |
| 6586 | |
| 6587 | codec->patch_ops = alc_patch_ops; |
| 6588 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6589 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6590 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6591 | return 0; |
| 6592 | } |
| 6593 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6594 | /* |
| 6595 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 6596 | */ |
| 6597 | |
| 6598 | /* |
| 6599 | * set the path ways for 2 channel output |
| 6600 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 6601 | */ |
| 6602 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 6603 | /* set pin widget 1Ah (line in) for input */ |
| 6604 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6605 | /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */ |
| 6606 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6607 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6608 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 6609 | #if 0 |
| 6610 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 6611 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 6612 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6613 | { } /* end */ |
| 6614 | }; |
| 6615 | /* |
| 6616 | * 6ch mode |
| 6617 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 6618 | */ |
| 6619 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 6620 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 6621 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6622 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 6623 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6624 | |
| 6625 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6626 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6627 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6628 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 6629 | #if 0 |
| 6630 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 6631 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 6632 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6633 | { } /* end */ |
| 6634 | }; |
| 6635 | |
| 6636 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 6637 | { 2, alc861_threestack_ch2_init }, |
| 6638 | { 6, alc861_threestack_ch6_init }, |
| 6639 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 6640 | /* Set mic1 as input and unmute the mixer */ |
| 6641 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 6642 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6643 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 6644 | { } /* end */ |
| 6645 | }; |
| 6646 | /* Set mic1 as output and mute mixer */ |
| 6647 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 6648 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6649 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 6650 | { } /* end */ |
| 6651 | }; |
| 6652 | |
| 6653 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 6654 | { 2, alc861_uniwill_m31_ch2_init }, |
| 6655 | { 4, alc861_uniwill_m31_ch4_init }, |
| 6656 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6657 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame^] | 6658 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 6659 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 6660 | /* set pin widget 1Ah (line in) for input */ |
| 6661 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6662 | /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */ |
| 6663 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6664 | |
| 6665 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 6666 | #if 0 |
| 6667 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 6668 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 6669 | #endif |
| 6670 | { } /* end */ |
| 6671 | }; |
| 6672 | /* Set mic1 nad line-in as output and mute mixer */ |
| 6673 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 6674 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 6675 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6676 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 6677 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 6678 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6679 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 6680 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6681 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6682 | |
| 6683 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 6684 | #if 0 |
| 6685 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 6686 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 6687 | #endif |
| 6688 | { } /* end */ |
| 6689 | }; |
| 6690 | |
| 6691 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 6692 | { 2, alc861_asus_ch2_init }, |
| 6693 | { 6, alc861_asus_ch6_init }, |
| 6694 | }; |
| 6695 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6696 | /* patch-ALC861 */ |
| 6697 | |
| 6698 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 6699 | /* output mixer control */ |
| 6700 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 6701 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 6702 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 6703 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 6704 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 6705 | |
| 6706 | /*Input mixer control */ |
| 6707 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 6708 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 6709 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 6710 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 6711 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 6712 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 6713 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 6714 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 6715 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 6716 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
| 6717 | |
| 6718 | /* Capture mixer control */ |
| 6719 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6720 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6721 | { |
| 6722 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6723 | .name = "Capture Source", |
| 6724 | .count = 1, |
| 6725 | .info = alc_mux_enum_info, |
| 6726 | .get = alc_mux_enum_get, |
| 6727 | .put = alc_mux_enum_put, |
| 6728 | }, |
| 6729 | { } /* end */ |
| 6730 | }; |
| 6731 | |
| 6732 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 6733 | /* output mixer control */ |
| 6734 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 6735 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 6736 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 6737 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 6738 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 6739 | |
| 6740 | /* Input mixer control */ |
| 6741 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 6742 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 6743 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 6744 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 6745 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 6746 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 6747 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 6748 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 6749 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 6750 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
| 6751 | |
| 6752 | /* Capture mixer control */ |
| 6753 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6754 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6755 | { |
| 6756 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6757 | .name = "Capture Source", |
| 6758 | .count = 1, |
| 6759 | .info = alc_mux_enum_info, |
| 6760 | .get = alc_mux_enum_get, |
| 6761 | .put = alc_mux_enum_put, |
| 6762 | }, |
| 6763 | { |
| 6764 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6765 | .name = "Channel Mode", |
| 6766 | .info = alc_ch_mode_info, |
| 6767 | .get = alc_ch_mode_get, |
| 6768 | .put = alc_ch_mode_put, |
| 6769 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 6770 | }, |
| 6771 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 6772 | }; |
| 6773 | |
| 6774 | static snd_kcontrol_new_t alc861_toshiba_mixer[] = { |
| 6775 | /* output mixer control */ |
| 6776 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 6777 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 6778 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 6779 | |
| 6780 | /*Capture mixer control */ |
| 6781 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6782 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6783 | { |
| 6784 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6785 | .name = "Capture Source", |
| 6786 | .count = 1, |
| 6787 | .info = alc_mux_enum_info, |
| 6788 | .get = alc_mux_enum_get, |
| 6789 | .put = alc_mux_enum_put, |
| 6790 | }, |
| 6791 | |
| 6792 | { } /* end */ |
| 6793 | }; |
| 6794 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 6795 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 6796 | /* output mixer control */ |
| 6797 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 6798 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 6799 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 6800 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 6801 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 6802 | |
| 6803 | /* Input mixer control */ |
| 6804 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 6805 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 6806 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 6807 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 6808 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 6809 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 6810 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 6811 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 6812 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 6813 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
| 6814 | |
| 6815 | /* Capture mixer control */ |
| 6816 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6817 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6818 | { |
| 6819 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6820 | .name = "Capture Source", |
| 6821 | .count = 1, |
| 6822 | .info = alc_mux_enum_info, |
| 6823 | .get = alc_mux_enum_get, |
| 6824 | .put = alc_mux_enum_put, |
| 6825 | }, |
| 6826 | { |
| 6827 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6828 | .name = "Channel Mode", |
| 6829 | .info = alc_ch_mode_info, |
| 6830 | .get = alc_ch_mode_get, |
| 6831 | .put = alc_ch_mode_put, |
| 6832 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 6833 | }, |
| 6834 | { } /* end */ |
| 6835 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame^] | 6836 | |
| 6837 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 6838 | /* output mixer control */ |
| 6839 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 6840 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 6841 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 6842 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 6843 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 6844 | |
| 6845 | /* Input mixer control */ |
| 6846 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 6847 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6848 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 6849 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 6850 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 6851 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 6852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 6853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 6854 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 6855 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), /* was HDA_INPUT (why?) */ |
| 6856 | |
| 6857 | /* Capture mixer control */ |
| 6858 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6859 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6860 | { |
| 6861 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6862 | .name = "Capture Source", |
| 6863 | .count = 1, |
| 6864 | .info = alc_mux_enum_info, |
| 6865 | .get = alc_mux_enum_get, |
| 6866 | .put = alc_mux_enum_put, |
| 6867 | }, |
| 6868 | { |
| 6869 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6870 | .name = "Channel Mode", |
| 6871 | .info = alc_ch_mode_info, |
| 6872 | .get = alc_ch_mode_get, |
| 6873 | .put = alc_ch_mode_put, |
| 6874 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 6875 | }, |
| 6876 | { } |
| 6877 | }; |
| 6878 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6879 | |
| 6880 | /* |
| 6881 | * generic initialization of ADC, input mixers and output mixers |
| 6882 | */ |
| 6883 | static struct hda_verb alc861_base_init_verbs[] = { |
| 6884 | /* |
| 6885 | * Unmute ADC0 and set the default input to mic-in |
| 6886 | */ |
| 6887 | /* port-A for surround (rear panel) */ |
| 6888 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6889 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6890 | /* port-B for mic-in (rear panel) with vref */ |
| 6891 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6892 | /* port-C for line-in (rear panel) */ |
| 6893 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6894 | /* port-D for Front */ |
| 6895 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6896 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6897 | /* port-E for HP out (front panel) */ |
| 6898 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 6899 | /* route front PCM to HP */ |
| 6900 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6901 | /* port-F for mic-in (front panel) with vref */ |
| 6902 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6903 | /* port-G for CLFE (rear panel) */ |
| 6904 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6905 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6906 | /* port-H for side (rear panel) */ |
| 6907 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6908 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6909 | /* CD-in */ |
| 6910 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6911 | /* route front mic to ADC1*/ |
| 6912 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6913 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6914 | |
| 6915 | /* Unmute DAC0~3 & spdif out*/ |
| 6916 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6917 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6918 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6919 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6921 | |
| 6922 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 6923 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6924 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6925 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6926 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6927 | |
| 6928 | /* Unmute Stereo Mixer 15 */ |
| 6929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6930 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6931 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6932 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step |
| 6933 | |
| 6934 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6935 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6936 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6937 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6938 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6939 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6940 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6941 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6942 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) |
| 6943 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6944 | |
| 6945 | { } |
| 6946 | }; |
| 6947 | |
| 6948 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 6949 | /* |
| 6950 | * Unmute ADC0 and set the default input to mic-in |
| 6951 | */ |
| 6952 | /* port-A for surround (rear panel) */ |
| 6953 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6954 | /* port-B for mic-in (rear panel) with vref */ |
| 6955 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6956 | /* port-C for line-in (rear panel) */ |
| 6957 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6958 | /* port-D for Front */ |
| 6959 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 6960 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6961 | /* port-E for HP out (front panel) */ |
| 6962 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 6963 | /* route front PCM to HP */ |
| 6964 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6965 | /* port-F for mic-in (front panel) with vref */ |
| 6966 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 6967 | /* port-G for CLFE (rear panel) */ |
| 6968 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6969 | /* port-H for side (rear panel) */ |
| 6970 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6971 | /* CD-in */ |
| 6972 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 6973 | /* route front mic to ADC1*/ |
| 6974 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6975 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6976 | /* Unmute DAC0~3 & spdif out*/ |
| 6977 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6978 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6979 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6980 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6981 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6982 | |
| 6983 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 6984 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6985 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6986 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6987 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6988 | |
| 6989 | /* Unmute Stereo Mixer 15 */ |
| 6990 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6991 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6992 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6993 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step |
| 6994 | |
| 6995 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6996 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6997 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6998 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6999 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7000 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7001 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7002 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7003 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) |
| 7004 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7005 | { } |
| 7006 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 7007 | |
| 7008 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 7009 | /* |
| 7010 | * Unmute ADC0 and set the default input to mic-in |
| 7011 | */ |
| 7012 | /* port-A for surround (rear panel) */ |
| 7013 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7014 | /* port-B for mic-in (rear panel) with vref */ |
| 7015 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 7016 | /* port-C for line-in (rear panel) */ |
| 7017 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 7018 | /* port-D for Front */ |
| 7019 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 7020 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7021 | /* port-E for HP out (front panel) */ |
| 7022 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, // this has to be set to VREF80 |
| 7023 | /* route front PCM to HP */ |
| 7024 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7025 | /* port-F for mic-in (front panel) with vref */ |
| 7026 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 7027 | /* port-G for CLFE (rear panel) */ |
| 7028 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7029 | /* port-H for side (rear panel) */ |
| 7030 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7031 | /* CD-in */ |
| 7032 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 7033 | /* route front mic to ADC1*/ |
| 7034 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7035 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7036 | /* Unmute DAC0~3 & spdif out*/ |
| 7037 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7038 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7039 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7040 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7041 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7042 | |
| 7043 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 7044 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7045 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7046 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7047 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7048 | |
| 7049 | /* Unmute Stereo Mixer 15 */ |
| 7050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7051 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7052 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7053 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step |
| 7054 | |
| 7055 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7056 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7057 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7058 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7059 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7060 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7061 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7062 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7063 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) |
| 7064 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7065 | { } |
| 7066 | }; |
| 7067 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame^] | 7068 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 7069 | /* |
| 7070 | * Unmute ADC0 and set the default input to mic-in |
| 7071 | */ |
| 7072 | /* port-A for surround (rear panel) | according to codec#0 this is the HP jack*/ |
| 7073 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 7074 | /* route front PCM to HP */ |
| 7075 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7076 | /* port-B for mic-in (rear panel) with vref */ |
| 7077 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 7078 | /* port-C for line-in (rear panel) */ |
| 7079 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 7080 | /* port-D for Front */ |
| 7081 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 7082 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7083 | /* port-E for HP out (front panel) */ |
| 7084 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, /* this has to be set to VREF80 */ |
| 7085 | /* route front PCM to HP */ |
| 7086 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7087 | /* port-F for mic-in (front panel) with vref */ |
| 7088 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 7089 | /* port-G for CLFE (rear panel) */ |
| 7090 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 7091 | /* port-H for side (rear panel) */ |
| 7092 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 7093 | /* CD-in */ |
| 7094 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 7095 | /* route front mic to ADC1*/ |
| 7096 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7097 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7098 | /* Unmute DAC0~3 & spdif out*/ |
| 7099 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7100 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7101 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7102 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7103 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7104 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 7105 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7106 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7107 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7108 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7109 | |
| 7110 | /* Unmute Stereo Mixer 15 */ |
| 7111 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7112 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7113 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7114 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, /* Output 0~12 step */ |
| 7115 | |
| 7116 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7117 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7118 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7119 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7120 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7121 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7122 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7123 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7124 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, /* hp used DAC 3 (Front) */ |
| 7125 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7126 | { } |
| 7127 | }; |
| 7128 | |
| 7129 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7130 | /* |
| 7131 | * generic initialization of ADC, input mixers and output mixers |
| 7132 | */ |
| 7133 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 7134 | /* |
| 7135 | * Unmute ADC0 and set the default input to mic-in |
| 7136 | */ |
| 7137 | // {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7138 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7139 | |
| 7140 | /* Unmute DAC0~3 & spdif out*/ |
| 7141 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7142 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7143 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7144 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7145 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7146 | |
| 7147 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 7148 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7149 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7150 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7151 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7152 | |
| 7153 | /* Unmute Stereo Mixer 15 */ |
| 7154 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7155 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7156 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7157 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 7158 | |
| 7159 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7160 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7161 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7162 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7163 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7164 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7165 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7166 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7167 | |
| 7168 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7169 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7170 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7171 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7172 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7173 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7174 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7175 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7176 | |
| 7177 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, // set Mic 1 |
| 7178 | |
| 7179 | { } |
| 7180 | }; |
| 7181 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 7182 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 7183 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7184 | |
| 7185 | { } |
| 7186 | }; |
| 7187 | |
| 7188 | /* toggle speaker-output according to the hp-jack state */ |
| 7189 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 7190 | { |
| 7191 | unsigned int present; |
| 7192 | |
| 7193 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 7194 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7195 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, |
| 7196 | 0x80, present ? 0x80 : 0); |
| 7197 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, |
| 7198 | 0x80, present ? 0x80 : 0); |
| 7199 | snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3, |
| 7200 | 0x80, present ? 0 : 0x80); |
| 7201 | snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3, |
| 7202 | 0x80, present ? 0 : 0x80); |
| 7203 | } |
| 7204 | |
| 7205 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 7206 | unsigned int res) |
| 7207 | { |
| 7208 | /* Looks like the unsol event is incompatible with the standard |
| 7209 | * definition. 6bit tag is placed at 26 bit! |
| 7210 | */ |
| 7211 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7212 | alc861_toshiba_automute(codec); |
| 7213 | } |
| 7214 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7215 | /* pcm configuration: identiacal with ALC880 */ |
| 7216 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 7217 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 7218 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 7219 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 7220 | |
| 7221 | |
| 7222 | #define ALC861_DIGOUT_NID 0x07 |
| 7223 | |
| 7224 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 7225 | { 8, NULL } |
| 7226 | }; |
| 7227 | |
| 7228 | static hda_nid_t alc861_dac_nids[4] = { |
| 7229 | /* front, surround, clfe, side */ |
| 7230 | 0x03, 0x06, 0x05, 0x04 |
| 7231 | }; |
| 7232 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7233 | static hda_nid_t alc660_dac_nids[3] = { |
| 7234 | /* front, clfe, surround */ |
| 7235 | 0x03, 0x05, 0x06 |
| 7236 | }; |
| 7237 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7238 | static hda_nid_t alc861_adc_nids[1] = { |
| 7239 | /* ADC0-2 */ |
| 7240 | 0x08, |
| 7241 | }; |
| 7242 | |
| 7243 | static struct hda_input_mux alc861_capture_source = { |
| 7244 | .num_items = 5, |
| 7245 | .items = { |
| 7246 | { "Mic", 0x0 }, |
| 7247 | { "Front Mic", 0x3 }, |
| 7248 | { "Line", 0x1 }, |
| 7249 | { "CD", 0x4 }, |
| 7250 | { "Mixer", 0x5 }, |
| 7251 | }, |
| 7252 | }; |
| 7253 | |
| 7254 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 7255 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pin_cfg *cfg) |
| 7256 | { |
| 7257 | int i; |
| 7258 | hda_nid_t nid; |
| 7259 | |
| 7260 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 7261 | for (i = 0; i < cfg->line_outs; i++) { |
| 7262 | nid = cfg->line_out_pins[i]; |
| 7263 | if (nid) { |
| 7264 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 7265 | continue; |
| 7266 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 7267 | } |
| 7268 | } |
| 7269 | spec->multiout.num_dacs = cfg->line_outs; |
| 7270 | return 0; |
| 7271 | } |
| 7272 | |
| 7273 | /* add playback controls from the parsed DAC table */ |
| 7274 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7275 | const struct auto_pin_cfg *cfg) |
| 7276 | { |
| 7277 | char name[32]; |
| 7278 | static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; |
| 7279 | hda_nid_t nid; |
| 7280 | int i, idx, err; |
| 7281 | |
| 7282 | for (i = 0; i < cfg->line_outs; i++) { |
| 7283 | nid = spec->multiout.dac_nids[i]; |
| 7284 | if (! nid) |
| 7285 | continue; |
| 7286 | if (nid == 0x05) { |
| 7287 | /* Center/LFE */ |
| 7288 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "Center Playback Switch", |
| 7289 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) |
| 7290 | return err; |
| 7291 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "LFE Playback Switch", |
| 7292 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) |
| 7293 | return err; |
| 7294 | } else { |
| 7295 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; idx++) |
| 7296 | if (nid == alc861_dac_nids[idx]) |
| 7297 | break; |
| 7298 | sprintf(name, "%s Playback Switch", chname[idx]); |
| 7299 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 7300 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 7301 | return err; |
| 7302 | } |
| 7303 | } |
| 7304 | return 0; |
| 7305 | } |
| 7306 | |
| 7307 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 7308 | { |
| 7309 | int err; |
| 7310 | hda_nid_t nid; |
| 7311 | |
| 7312 | if (! pin) |
| 7313 | return 0; |
| 7314 | |
| 7315 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 7316 | nid = 0x03; |
| 7317 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", |
| 7318 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
| 7319 | return err; |
| 7320 | spec->multiout.hp_nid = nid; |
| 7321 | } |
| 7322 | return 0; |
| 7323 | } |
| 7324 | |
| 7325 | /* create playback/capture controls for input pins */ |
| 7326 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) |
| 7327 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7328 | struct hda_input_mux *imux = &spec->private_imux; |
| 7329 | int i, err, idx, idx1; |
| 7330 | |
| 7331 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7332 | switch(cfg->input_pins[i]) { |
| 7333 | case 0x0c: |
| 7334 | idx1 = 1; |
| 7335 | idx = 2; // Line In |
| 7336 | break; |
| 7337 | case 0x0f: |
| 7338 | idx1 = 2; |
| 7339 | idx = 2; // Line In |
| 7340 | break; |
| 7341 | case 0x0d: |
| 7342 | idx1 = 0; |
| 7343 | idx = 1; // Mic In |
| 7344 | break; |
| 7345 | case 0x10: |
| 7346 | idx1 = 3; |
| 7347 | idx = 1; // Mic In |
| 7348 | break; |
| 7349 | case 0x11: |
| 7350 | idx1 = 4; |
| 7351 | idx = 0; // CD |
| 7352 | break; |
| 7353 | default: |
| 7354 | continue; |
| 7355 | } |
| 7356 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7357 | err = new_analog_input(spec, cfg->input_pins[i], |
| 7358 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7359 | if (err < 0) |
| 7360 | return err; |
| 7361 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7362 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7363 | imux->items[imux->num_items].index = idx1; |
| 7364 | imux->num_items++; |
| 7365 | } |
| 7366 | return 0; |
| 7367 | } |
| 7368 | |
| 7369 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 7370 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7371 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7372 | |
| 7373 | { |
| 7374 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7375 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7376 | * So call somewhat different.. |
| 7377 | *FIXME: the controls appear in the "playback" view! |
| 7378 | */ |
| 7379 | /* .name = "Capture Source", */ |
| 7380 | .name = "Input Source", |
| 7381 | .count = 1, |
| 7382 | .info = alc_mux_enum_info, |
| 7383 | .get = alc_mux_enum_get, |
| 7384 | .put = alc_mux_enum_put, |
| 7385 | }, |
| 7386 | { } /* end */ |
| 7387 | }; |
| 7388 | |
| 7389 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, hda_nid_t nid, |
| 7390 | int pin_type, int dac_idx) |
| 7391 | { |
| 7392 | /* set as output */ |
| 7393 | |
| 7394 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 7395 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 7396 | |
| 7397 | } |
| 7398 | |
| 7399 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 7400 | { |
| 7401 | struct alc_spec *spec = codec->spec; |
| 7402 | int i; |
| 7403 | |
| 7404 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 7405 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 7406 | if (nid) |
| 7407 | alc861_auto_set_output_and_unmute(codec, nid, PIN_OUT, spec->multiout.dac_nids[i]); |
| 7408 | } |
| 7409 | } |
| 7410 | |
| 7411 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 7412 | { |
| 7413 | struct alc_spec *spec = codec->spec; |
| 7414 | hda_nid_t pin; |
| 7415 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7416 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7417 | if (pin) /* connect to front */ |
| 7418 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, spec->multiout.dac_nids[0]); |
| 7419 | } |
| 7420 | |
| 7421 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 7422 | { |
| 7423 | struct alc_spec *spec = codec->spec; |
| 7424 | int i; |
| 7425 | |
| 7426 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7427 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 7428 | if ((nid>=0x0c) && (nid <=0x11)) { |
| 7429 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7430 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); |
| 7431 | } |
| 7432 | } |
| 7433 | } |
| 7434 | |
| 7435 | /* parse the BIOS configuration and set up the alc_spec */ |
| 7436 | /* return 1 if successful, 0 if the proper config is not found, or a negative error code */ |
| 7437 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 7438 | { |
| 7439 | struct alc_spec *spec = codec->spec; |
| 7440 | int err; |
| 7441 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 7442 | |
| 7443 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7444 | alc861_ignore)) < 0) |
| 7445 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7446 | if (! spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7447 | return 0; /* can't find valid BIOS pin config */ |
| 7448 | |
| 7449 | if ((err = alc861_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || |
| 7450 | (err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7451 | (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] | 7452 | (err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
| 7453 | return err; |
| 7454 | |
| 7455 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 7456 | |
| 7457 | if (spec->autocfg.dig_out_pin) |
| 7458 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 7459 | |
| 7460 | if (spec->kctl_alloc) |
| 7461 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 7462 | |
| 7463 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 7464 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7465 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7466 | spec->input_mux = &spec->private_imux; |
| 7467 | |
| 7468 | spec->adc_nids = alc861_adc_nids; |
| 7469 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 7470 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 7471 | spec->num_mixers++; |
| 7472 | |
| 7473 | return 1; |
| 7474 | } |
| 7475 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7476 | /* additional initialization for auto-configuration model */ |
| 7477 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7478 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7479 | alc861_auto_init_multi_out(codec); |
| 7480 | alc861_auto_init_hp_out(codec); |
| 7481 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7482 | } |
| 7483 | |
| 7484 | |
| 7485 | /* |
| 7486 | * configuration and preset |
| 7487 | */ |
| 7488 | static struct hda_board_config alc861_cfg_tbl[] = { |
| 7489 | { .modelname = "3stack", .config = ALC861_3ST }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7490 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xd600, |
| 7491 | .config = ALC861_3ST }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7492 | { .modelname = "3stack-660", .config = ALC660_3ST }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7493 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x81e7, |
| 7494 | .config = ALC660_3ST }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7495 | { .modelname = "3stack-dig", .config = ALC861_3ST_DIG }, |
| 7496 | { .modelname = "6stack-dig", .config = ALC861_6ST_DIG }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 7497 | { .modelname = "uniwill-m31", .config = ALC861_UNIWILL_M31}, |
| 7498 | { .pci_subvendor = 0x1584, .pci_subdevice = 0x9072, |
| 7499 | .config = ALC861_UNIWILL_M31 }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 7500 | { .modelname = "toshiba", .config = ALC861_TOSHIBA }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 7501 | { .pci_subvendor = 0x1179, .pci_subdevice = 0xff10, |
| 7502 | .config = ALC861_TOSHIBA }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame^] | 7503 | { .modelname = "asus", .config = ALC861_ASUS}, |
| 7504 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1393, |
| 7505 | .config = ALC861_ASUS }, |
| 7506 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1338, |
| 7507 | .config = ALC861_ASUS }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7508 | { .modelname = "auto", .config = ALC861_AUTO }, |
| 7509 | {} |
| 7510 | }; |
| 7511 | |
| 7512 | static struct alc_config_preset alc861_presets[] = { |
| 7513 | [ALC861_3ST] = { |
| 7514 | .mixers = { alc861_3ST_mixer }, |
| 7515 | .init_verbs = { alc861_threestack_init_verbs }, |
| 7516 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7517 | .dac_nids = alc861_dac_nids, |
| 7518 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 7519 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7520 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7521 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7522 | .adc_nids = alc861_adc_nids, |
| 7523 | .input_mux = &alc861_capture_source, |
| 7524 | }, |
| 7525 | [ALC861_3ST_DIG] = { |
| 7526 | .mixers = { alc861_base_mixer }, |
| 7527 | .init_verbs = { alc861_threestack_init_verbs }, |
| 7528 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7529 | .dac_nids = alc861_dac_nids, |
| 7530 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 7531 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 7532 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7533 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7534 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7535 | .adc_nids = alc861_adc_nids, |
| 7536 | .input_mux = &alc861_capture_source, |
| 7537 | }, |
| 7538 | [ALC861_6ST_DIG] = { |
| 7539 | .mixers = { alc861_base_mixer }, |
| 7540 | .init_verbs = { alc861_base_init_verbs }, |
| 7541 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7542 | .dac_nids = alc861_dac_nids, |
| 7543 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 7544 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 7545 | .channel_mode = alc861_8ch_modes, |
| 7546 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7547 | .adc_nids = alc861_adc_nids, |
| 7548 | .input_mux = &alc861_capture_source, |
| 7549 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7550 | [ALC660_3ST] = { |
| 7551 | .mixers = { alc861_3ST_mixer }, |
| 7552 | .init_verbs = { alc861_threestack_init_verbs }, |
| 7553 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 7554 | .dac_nids = alc660_dac_nids, |
| 7555 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 7556 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7557 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7558 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7559 | .adc_nids = alc861_adc_nids, |
| 7560 | .input_mux = &alc861_capture_source, |
| 7561 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 7562 | [ALC861_UNIWILL_M31] = { |
| 7563 | .mixers = { alc861_uniwill_m31_mixer }, |
| 7564 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 7565 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7566 | .dac_nids = alc861_dac_nids, |
| 7567 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 7568 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 7569 | .channel_mode = alc861_uniwill_m31_modes, |
| 7570 | .need_dac_fix = 1, |
| 7571 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7572 | .adc_nids = alc861_adc_nids, |
| 7573 | .input_mux = &alc861_capture_source, |
| 7574 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 7575 | [ALC861_TOSHIBA] = { |
| 7576 | .mixers = { alc861_toshiba_mixer }, |
| 7577 | .init_verbs = { alc861_base_init_verbs, alc861_toshiba_init_verbs }, |
| 7578 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7579 | .dac_nids = alc861_dac_nids, |
| 7580 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7581 | .channel_mode = alc883_3ST_2ch_modes, |
| 7582 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7583 | .adc_nids = alc861_adc_nids, |
| 7584 | .input_mux = &alc861_capture_source, |
| 7585 | .unsol_event = alc861_toshiba_unsol_event, |
| 7586 | .init_hook = alc861_toshiba_automute, |
| 7587 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame^] | 7588 | [ALC861_ASUS] = { |
| 7589 | .mixers = { alc861_asus_mixer }, |
| 7590 | .init_verbs = { alc861_asus_init_verbs }, |
| 7591 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 7592 | .dac_nids = alc861_dac_nids, |
| 7593 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 7594 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 7595 | .channel_mode = alc861_asus_modes, |
| 7596 | .need_dac_fix = 1, |
| 7597 | .hp_nid = 0x06, |
| 7598 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 7599 | .adc_nids = alc861_adc_nids, |
| 7600 | .input_mux = &alc861_capture_source, |
| 7601 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7602 | }; |
| 7603 | |
| 7604 | |
| 7605 | static int patch_alc861(struct hda_codec *codec) |
| 7606 | { |
| 7607 | struct alc_spec *spec; |
| 7608 | int board_config; |
| 7609 | int err; |
| 7610 | |
| 7611 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 7612 | if (spec == NULL) |
| 7613 | return -ENOMEM; |
| 7614 | |
| 7615 | codec->spec = spec; |
| 7616 | |
| 7617 | board_config = snd_hda_check_board_config(codec, alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7619 | if (board_config < 0 || board_config >= ALC861_MODEL_LAST) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7620 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 7621 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7622 | board_config = ALC861_AUTO; |
| 7623 | } |
| 7624 | |
| 7625 | if (board_config == ALC861_AUTO) { |
| 7626 | /* automatic parse from the BIOS config */ |
| 7627 | err = alc861_parse_auto_config(codec); |
| 7628 | if (err < 0) { |
| 7629 | alc_free(codec); |
| 7630 | return err; |
| 7631 | } else if (! err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7632 | printk(KERN_INFO |
| 7633 | "hda_codec: Cannot set up configuration " |
| 7634 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7635 | board_config = ALC861_3ST_DIG; |
| 7636 | } |
| 7637 | } |
| 7638 | |
| 7639 | if (board_config != ALC861_AUTO) |
| 7640 | setup_preset(spec, &alc861_presets[board_config]); |
| 7641 | |
| 7642 | spec->stream_name_analog = "ALC861 Analog"; |
| 7643 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 7644 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 7645 | |
| 7646 | spec->stream_name_digital = "ALC861 Digital"; |
| 7647 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 7648 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 7649 | |
| 7650 | codec->patch_ops = alc_patch_ops; |
| 7651 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7652 | spec->init_hook = alc861_auto_init; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7653 | |
| 7654 | return 0; |
| 7655 | } |
| 7656 | |
| 7657 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7658 | * patch entries |
| 7659 | */ |
| 7660 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 7661 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7662 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7663 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
| 7664 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7665 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7666 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7667 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
| 7668 | { .id = 0x10ec0861, .rev = 0x100300, .name = "ALC861", |
| 7669 | .patch = patch_alc861 }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7670 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7671 | .patch = patch_alc861 }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7672 | { .id = 0x10ec0660, .name = "ALC660", .patch = patch_alc861 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7673 | {} /* terminator */ |
| 7674 | }; |