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, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 63 | #ifdef CONFIG_SND_DEBUG |
| 64 | ALC880_TEST, |
| 65 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 66 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 67 | ALC880_MODEL_LAST /* last tag */ |
| 68 | }; |
| 69 | |
| 70 | /* ALC260 models */ |
| 71 | enum { |
| 72 | ALC260_BASIC, |
| 73 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 74 | ALC260_HP_3013, |
| 75 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 76 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 77 | ALC260_WILL, |
| 78 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 79 | #ifdef CONFIG_SND_DEBUG |
| 80 | ALC260_TEST, |
| 81 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 82 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 83 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | }; |
| 85 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | /* ALC262 models */ |
| 87 | enum { |
| 88 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 89 | ALC262_HIPPO, |
| 90 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 91 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 92 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 93 | ALC262_HP_BPC_D7000_WL, |
| 94 | ALC262_HP_BPC_D7000_WF, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 95 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 96 | ALC262_SONY_ASSAMD, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 97 | ALC262_AUTO, |
| 98 | ALC262_MODEL_LAST /* last tag */ |
| 99 | }; |
| 100 | |
| 101 | /* ALC861 models */ |
| 102 | enum { |
| 103 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 104 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 105 | ALC861_3ST_DIG, |
| 106 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 107 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 108 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 109 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 110 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 111 | ALC861_AUTO, |
| 112 | ALC861_MODEL_LAST, |
| 113 | }; |
| 114 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 115 | /* ALC861-VD models */ |
| 116 | enum { |
| 117 | ALC660VD_3ST, |
| 118 | ALC861VD_3ST, |
| 119 | ALC861VD_3ST_DIG, |
| 120 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 121 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 122 | ALC861VD_DALLAS, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 123 | ALC861VD_AUTO, |
| 124 | ALC861VD_MODEL_LAST, |
| 125 | }; |
| 126 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 127 | /* ALC662 models */ |
| 128 | enum { |
| 129 | ALC662_3ST_2ch_DIG, |
| 130 | ALC662_3ST_6ch_DIG, |
| 131 | ALC662_3ST_6ch, |
| 132 | ALC662_5ST_DIG, |
| 133 | ALC662_LENOVO_101E, |
| 134 | ALC662_AUTO, |
| 135 | ALC662_MODEL_LAST, |
| 136 | }; |
| 137 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 138 | /* ALC882 models */ |
| 139 | enum { |
| 140 | ALC882_3ST_DIG, |
| 141 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 142 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 143 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 144 | ALC882_TARGA, |
| 145 | ALC882_ASUS_A7J, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 146 | ALC885_MACPRO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 147 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 148 | ALC882_MODEL_LAST, |
| 149 | }; |
| 150 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 151 | /* ALC883 models */ |
| 152 | enum { |
| 153 | ALC883_3ST_2ch_DIG, |
| 154 | ALC883_3ST_6ch_DIG, |
| 155 | ALC883_3ST_6ch, |
| 156 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 157 | ALC883_TARGA_DIG, |
| 158 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 159 | ALC883_ACER, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 160 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 161 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 162 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 163 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 164 | ALC883_LENOVO_NB0763, |
| 165 | ALC888_LENOVO_MS7195_DIG, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 166 | ALC883_AUTO, |
| 167 | ALC883_MODEL_LAST, |
| 168 | }; |
| 169 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 170 | /* for GPIO Poll */ |
| 171 | #define GPIO_MASK 0x03 |
| 172 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | struct alc_spec { |
| 174 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 175 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | unsigned int num_mixers; |
| 177 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 178 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 179 | * don't forget NULL |
| 180 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 181 | */ |
| 182 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 184 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | struct hda_pcm_stream *stream_analog_playback; |
| 186 | struct hda_pcm_stream *stream_analog_capture; |
| 187 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 188 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | struct hda_pcm_stream *stream_digital_playback; |
| 190 | struct hda_pcm_stream *stream_digital_capture; |
| 191 | |
| 192 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 193 | struct hda_multi_out multiout; /* playback set-up |
| 194 | * max_channels, dacs must be set |
| 195 | * dig_out_nid and hp_nid are optional |
| 196 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | |
| 198 | /* capture */ |
| 199 | unsigned int num_adc_nids; |
| 200 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 201 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | |
| 203 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 204 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | const struct hda_input_mux *input_mux; |
| 206 | unsigned int cur_mux[3]; |
| 207 | |
| 208 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 209 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 211 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | |
| 213 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 214 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 215 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 216 | /* dynamic controls, init_verbs and input_mux */ |
| 217 | struct auto_pin_cfg autocfg; |
| 218 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 219 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 220 | struct hda_input_mux private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 221 | hda_nid_t private_dac_nids[5]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 222 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 223 | /* hooks */ |
| 224 | void (*init_hook)(struct hda_codec *codec); |
| 225 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 226 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 227 | /* for pin sensing */ |
| 228 | unsigned int sense_updated: 1; |
| 229 | unsigned int jack_present: 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 230 | }; |
| 231 | |
| 232 | /* |
| 233 | * configuration template - to be copied to the spec instance |
| 234 | */ |
| 235 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 236 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 237 | * with spec |
| 238 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 239 | const struct hda_verb *init_verbs[5]; |
| 240 | unsigned int num_dacs; |
| 241 | hda_nid_t *dac_nids; |
| 242 | hda_nid_t dig_out_nid; /* optional */ |
| 243 | hda_nid_t hp_nid; /* optional */ |
| 244 | unsigned int num_adc_nids; |
| 245 | hda_nid_t *adc_nids; |
| 246 | hda_nid_t dig_in_nid; |
| 247 | unsigned int num_channel_mode; |
| 248 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 249 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 250 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 251 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 252 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 253 | void (*init_hook)(struct hda_codec *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | }; |
| 255 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | |
| 257 | /* |
| 258 | * input MUX handling |
| 259 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 260 | static int alc_mux_enum_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; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 265 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 266 | if (mux_idx >= spec->num_mux_defs) |
| 267 | mux_idx = 0; |
| 268 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | } |
| 270 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 271 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 272 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | { |
| 274 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 275 | struct alc_spec *spec = codec->spec; |
| 276 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 277 | |
| 278 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 279 | return 0; |
| 280 | } |
| 281 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 282 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 283 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | { |
| 285 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 286 | struct alc_spec *spec = codec->spec; |
| 287 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 288 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 289 | 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] | 290 | spec->adc_nids[adc_idx], |
| 291 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | } |
| 293 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 294 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | /* |
| 296 | * channel mode setting |
| 297 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 298 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 299 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | { |
| 301 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 302 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 303 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 304 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | } |
| 306 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 307 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 308 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | { |
| 310 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 311 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 312 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 313 | spec->num_channel_mode, |
| 314 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | } |
| 316 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 317 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 318 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | { |
| 320 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 321 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 322 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 323 | spec->num_channel_mode, |
| 324 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 325 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 326 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 327 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | } |
| 329 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 331 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 332 | * instead of "%" to avoid consequences of accidently treating the % as |
| 333 | * being part of a format specifier. Maximum allowed length of a value is |
| 334 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 335 | * |
| 336 | * Note: some retasking pin complexes seem to ignore requests for input |
| 337 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 338 | * are requested. Therefore order this list so that this behaviour will not |
| 339 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 340 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 341 | * March 2006. |
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 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 344 | "Mic 50pc bias", "Mic 80pc bias", |
| 345 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 346 | }; |
| 347 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 348 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 349 | }; |
| 350 | /* 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] | 351 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 352 | * addition, "input" pins may or may not process the mic bias option |
| 353 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 354 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 355 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 356 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 357 | #define ALC_PIN_DIR_IN 0x00 |
| 358 | #define ALC_PIN_DIR_OUT 0x01 |
| 359 | #define ALC_PIN_DIR_INOUT 0x02 |
| 360 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 361 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 362 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 363 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 364 | * For each direction the minimum and maximum values are given. |
| 365 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 366 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 367 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 368 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 369 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 370 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 371 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 372 | }; |
| 373 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 374 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 375 | #define alc_pin_mode_n_items(_dir) \ |
| 376 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 377 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 378 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 379 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 380 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 381 | unsigned int item_num = uinfo->value.enumerated.item; |
| 382 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 383 | |
| 384 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 385 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 386 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 387 | |
| 388 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 389 | item_num = alc_pin_mode_min(dir); |
| 390 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 391 | return 0; |
| 392 | } |
| 393 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 394 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 395 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 396 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 397 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 398 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 399 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 400 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 401 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 402 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 403 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 404 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 405 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 406 | /* Find enumerated value for current pinctl setting */ |
| 407 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 408 | 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] | 409 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 410 | *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] | 411 | return 0; |
| 412 | } |
| 413 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 414 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 415 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 416 | { |
| 417 | signed int change; |
| 418 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 419 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 420 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 421 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 422 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 423 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 424 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 425 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 426 | 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] | 427 | val = alc_pin_mode_min(dir); |
| 428 | |
| 429 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 430 | if (change) { |
| 431 | /* Set pin mode to that requested */ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 432 | 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] | 433 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 434 | |
| 435 | /* Also enable the retasking pin's input/output as required |
| 436 | * for the requested pin mode. Enum values of 2 or less are |
| 437 | * input modes. |
| 438 | * |
| 439 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 440 | * reduces noise slightly (particularly on input) so we'll |
| 441 | * do it. However, having both input and output buffers |
| 442 | * enabled simultaneously doesn't seem to be problematic if |
| 443 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 444 | */ |
| 445 | if (val <= 2) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 446 | snd_hda_codec_write(codec, nid, 0, |
| 447 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 448 | AMP_OUT_MUTE); |
| 449 | snd_hda_codec_write(codec, nid, 0, |
| 450 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 451 | AMP_IN_UNMUTE(0)); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 452 | } else { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 453 | snd_hda_codec_write(codec, nid, 0, |
| 454 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 455 | AMP_IN_MUTE(0)); |
| 456 | snd_hda_codec_write(codec, nid, 0, |
| 457 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 458 | AMP_OUT_UNMUTE); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 459 | } |
| 460 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 461 | return change; |
| 462 | } |
| 463 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 464 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 465 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 466 | .info = alc_pin_mode_info, \ |
| 467 | .get = alc_pin_mode_get, \ |
| 468 | .put = alc_pin_mode_put, \ |
| 469 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 470 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 471 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 472 | * together using a mask with more than one bit set. This control is |
| 473 | * currently used only by the ALC260 test model. At this stage they are not |
| 474 | * needed for any "production" models. |
| 475 | */ |
| 476 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 477 | static int alc_gpio_data_info(struct snd_kcontrol *kcontrol, |
| 478 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 479 | { |
| 480 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 481 | uinfo->count = 1; |
| 482 | uinfo->value.integer.min = 0; |
| 483 | uinfo->value.integer.max = 1; |
| 484 | return 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 485 | } |
| 486 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 487 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 488 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 489 | { |
| 490 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 491 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 492 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 493 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 494 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 495 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 496 | |
| 497 | *valp = (val & mask) != 0; |
| 498 | return 0; |
| 499 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 500 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 501 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 502 | { |
| 503 | signed int change; |
| 504 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 505 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 506 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 507 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 508 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 509 | AC_VERB_GET_GPIO_DATA, |
| 510 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 511 | |
| 512 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 513 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 514 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 515 | gpio_data &= ~mask; |
| 516 | else |
| 517 | gpio_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 518 | 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] | 519 | |
| 520 | return change; |
| 521 | } |
| 522 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 523 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 524 | .info = alc_gpio_data_info, \ |
| 525 | .get = alc_gpio_data_get, \ |
| 526 | .put = alc_gpio_data_put, \ |
| 527 | .private_value = nid | (mask<<16) } |
| 528 | #endif /* CONFIG_SND_DEBUG */ |
| 529 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 530 | /* A switch control to allow the enabling of the digital IO pins on the |
| 531 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 532 | * to provide something in the test model allowing digital outputs to be |
| 533 | * identified if present. If models are found which can utilise these |
| 534 | * outputs a more complete mixer control can be devised for those models if |
| 535 | * necessary. |
| 536 | */ |
| 537 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | static int alc_spdif_ctrl_info(struct snd_kcontrol *kcontrol, |
| 539 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 540 | { |
| 541 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 542 | uinfo->count = 1; |
| 543 | uinfo->value.integer.min = 0; |
| 544 | uinfo->value.integer.max = 1; |
| 545 | return 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 546 | } |
| 547 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 548 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 549 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 550 | { |
| 551 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 552 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 553 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 554 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 556 | AC_VERB_GET_DIGI_CONVERT, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 557 | |
| 558 | *valp = (val & mask) != 0; |
| 559 | return 0; |
| 560 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 561 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 562 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 563 | { |
| 564 | signed int change; |
| 565 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 566 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 567 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 568 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 569 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 570 | AC_VERB_GET_DIGI_CONVERT, |
| 571 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 572 | |
| 573 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 574 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 575 | if (val==0) |
| 576 | ctrl_data &= ~mask; |
| 577 | else |
| 578 | ctrl_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 579 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 580 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 581 | |
| 582 | return change; |
| 583 | } |
| 584 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 585 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 586 | .info = alc_spdif_ctrl_info, \ |
| 587 | .get = alc_spdif_ctrl_get, \ |
| 588 | .put = alc_spdif_ctrl_put, \ |
| 589 | .private_value = nid | (mask<<16) } |
| 590 | #endif /* CONFIG_SND_DEBUG */ |
| 591 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 592 | /* |
| 593 | * set up from the preset table |
| 594 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 595 | static void setup_preset(struct alc_spec *spec, |
| 596 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 597 | { |
| 598 | int i; |
| 599 | |
| 600 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 601 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 602 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 603 | i++) |
| 604 | spec->init_verbs[spec->num_init_verbs++] = |
| 605 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 606 | |
| 607 | spec->channel_mode = preset->channel_mode; |
| 608 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 609 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 610 | |
| 611 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 612 | |
| 613 | spec->multiout.num_dacs = preset->num_dacs; |
| 614 | spec->multiout.dac_nids = preset->dac_nids; |
| 615 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 616 | spec->multiout.hp_nid = preset->hp_nid; |
| 617 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 618 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 619 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 620 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 621 | spec->input_mux = preset->input_mux; |
| 622 | |
| 623 | spec->num_adc_nids = preset->num_adc_nids; |
| 624 | spec->adc_nids = preset->adc_nids; |
| 625 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 626 | |
| 627 | spec->unsol_event = preset->unsol_event; |
| 628 | spec->init_hook = preset->init_hook; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 629 | } |
| 630 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 631 | /* Enable GPIO mask and set output */ |
| 632 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 633 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 634 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 635 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 636 | { } |
| 637 | }; |
| 638 | |
| 639 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 640 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 641 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 642 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 643 | { } |
| 644 | }; |
| 645 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 646 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 647 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 648 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 649 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 650 | { } |
| 651 | }; |
| 652 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 653 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 654 | * 31 ~ 16 : Manufacture ID |
| 655 | * 15 ~ 8 : SKU ID |
| 656 | * 7 ~ 0 : Assembly ID |
| 657 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 658 | */ |
| 659 | static void alc_subsystem_id(struct hda_codec *codec, |
| 660 | unsigned int porta, unsigned int porte, |
| 661 | unsigned int portd) |
| 662 | { |
| 663 | unsigned int ass, tmp; |
| 664 | |
| 665 | ass = codec->subsystem_id; |
| 666 | if (!(ass & 1)) |
| 667 | return; |
| 668 | |
| 669 | /* Override */ |
| 670 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 671 | switch (tmp) { |
| 672 | case 1: |
| 673 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 674 | break; |
| 675 | case 3: |
| 676 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 677 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 678 | case 7: |
| 679 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 680 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 681 | case 5: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 682 | switch (codec->vendor_id) { |
| 683 | case 0x10ec0862: |
| 684 | case 0x10ec0660: |
| 685 | case 0x10ec0662: |
| 686 | case 0x10ec0267: |
| 687 | case 0x10ec0268: |
| 688 | snd_hda_codec_write(codec, 0x14, 0, |
| 689 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 690 | snd_hda_codec_write(codec, 0x15, 0, |
| 691 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 692 | return; |
| 693 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 694 | case 6: |
| 695 | if (ass & 4) { /* bit 2 : 0 = Desktop, 1 = Laptop */ |
| 696 | hda_nid_t port = 0; |
| 697 | tmp = (ass & 0x1800) >> 11; |
| 698 | switch (tmp) { |
| 699 | case 0: port = porta; break; |
| 700 | case 1: port = porte; break; |
| 701 | case 2: port = portd; break; |
| 702 | } |
| 703 | if (port) |
| 704 | snd_hda_codec_write(codec, port, 0, |
| 705 | AC_VERB_SET_EAPD_BTLENABLE, |
| 706 | 2); |
| 707 | } |
| 708 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 709 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, |
| 710 | (tmp == 5 ? 0x3040 : 0x3050)); |
| 711 | break; |
| 712 | } |
| 713 | } |
| 714 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 715 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 716 | * ALC880 3-stack model |
| 717 | * |
| 718 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 719 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 720 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 721 | */ |
| 722 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 723 | static hda_nid_t alc880_dac_nids[4] = { |
| 724 | /* front, rear, clfe, rear_surr */ |
| 725 | 0x02, 0x05, 0x04, 0x03 |
| 726 | }; |
| 727 | |
| 728 | static hda_nid_t alc880_adc_nids[3] = { |
| 729 | /* ADC0-2 */ |
| 730 | 0x07, 0x08, 0x09, |
| 731 | }; |
| 732 | |
| 733 | /* The datasheet says the node 0x07 is connected from inputs, |
| 734 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 735 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 736 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 737 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 738 | /* ADC1-2 */ |
| 739 | 0x08, 0x09, |
| 740 | }; |
| 741 | |
| 742 | #define ALC880_DIGOUT_NID 0x06 |
| 743 | #define ALC880_DIGIN_NID 0x0a |
| 744 | |
| 745 | static struct hda_input_mux alc880_capture_source = { |
| 746 | .num_items = 4, |
| 747 | .items = { |
| 748 | { "Mic", 0x0 }, |
| 749 | { "Front Mic", 0x3 }, |
| 750 | { "Line", 0x2 }, |
| 751 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 752 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 753 | }; |
| 754 | |
| 755 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 756 | /* 2ch mode */ |
| 757 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 758 | /* set line-in to input, mute it */ |
| 759 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 760 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 761 | /* set mic-in to input vref 80%, mute it */ |
| 762 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 763 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 764 | { } /* end */ |
| 765 | }; |
| 766 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 767 | /* 6ch mode */ |
| 768 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 769 | /* set line-in to output, unmute it */ |
| 770 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 771 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 772 | /* set mic-in to output, unmute it */ |
| 773 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 774 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 775 | { } /* end */ |
| 776 | }; |
| 777 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 778 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 779 | { 2, alc880_threestack_ch2_init }, |
| 780 | { 6, alc880_threestack_ch6_init }, |
| 781 | }; |
| 782 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 783 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 784 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 785 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 786 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 787 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 788 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 789 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 790 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 791 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 793 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 794 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 795 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 798 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 799 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 800 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 801 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 802 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 803 | { |
| 804 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 805 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 806 | .info = alc_ch_mode_info, |
| 807 | .get = alc_ch_mode_get, |
| 808 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 809 | }, |
| 810 | { } /* end */ |
| 811 | }; |
| 812 | |
| 813 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 814 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 815 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 816 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 817 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 818 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 819 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 820 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 821 | { |
| 822 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 823 | /* The multiple "Capture Source" controls confuse alsamixer |
| 824 | * So call somewhat different.. |
| 825 | * FIXME: the controls appear in the "playback" view! |
| 826 | */ |
| 827 | /* .name = "Capture Source", */ |
| 828 | .name = "Input Source", |
| 829 | .count = 3, |
| 830 | .info = alc_mux_enum_info, |
| 831 | .get = alc_mux_enum_get, |
| 832 | .put = alc_mux_enum_put, |
| 833 | }, |
| 834 | { } /* end */ |
| 835 | }; |
| 836 | |
| 837 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 838 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 839 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 840 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 841 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 842 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 843 | { |
| 844 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 845 | /* The multiple "Capture Source" controls confuse alsamixer |
| 846 | * So call somewhat different.. |
| 847 | * FIXME: the controls appear in the "playback" view! |
| 848 | */ |
| 849 | /* .name = "Capture Source", */ |
| 850 | .name = "Input Source", |
| 851 | .count = 2, |
| 852 | .info = alc_mux_enum_info, |
| 853 | .get = alc_mux_enum_get, |
| 854 | .put = alc_mux_enum_put, |
| 855 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 856 | { } /* end */ |
| 857 | }; |
| 858 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 859 | |
| 860 | |
| 861 | /* |
| 862 | * ALC880 5-stack model |
| 863 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 864 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 865 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 866 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 867 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 868 | */ |
| 869 | |
| 870 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 871 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 872 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 873 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 874 | { } /* end */ |
| 875 | }; |
| 876 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 877 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 878 | /* 6ch mode */ |
| 879 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 880 | /* set line-in to input, mute it */ |
| 881 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 882 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 883 | { } /* end */ |
| 884 | }; |
| 885 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 886 | /* 8ch mode */ |
| 887 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 888 | /* set line-in to output, unmute it */ |
| 889 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 890 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 891 | { } /* end */ |
| 892 | }; |
| 893 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 894 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 895 | { 6, alc880_fivestack_ch6_init }, |
| 896 | { 8, alc880_fivestack_ch8_init }, |
| 897 | }; |
| 898 | |
| 899 | |
| 900 | /* |
| 901 | * ALC880 6-stack model |
| 902 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 903 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 904 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 905 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 906 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 907 | */ |
| 908 | |
| 909 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 910 | /* front, rear, clfe, rear_surr */ |
| 911 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 912 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 913 | |
| 914 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 915 | .num_items = 4, |
| 916 | .items = { |
| 917 | { "Mic", 0x0 }, |
| 918 | { "Front Mic", 0x1 }, |
| 919 | { "Line", 0x2 }, |
| 920 | { "CD", 0x4 }, |
| 921 | }, |
| 922 | }; |
| 923 | |
| 924 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 925 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 926 | { 8, NULL }, |
| 927 | }; |
| 928 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 929 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 930 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 931 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 932 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 933 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 934 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 935 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 936 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 937 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 938 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 939 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 940 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 941 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 942 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 943 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 944 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 945 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 946 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 947 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 948 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 949 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 950 | { |
| 951 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 952 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 953 | .info = alc_ch_mode_info, |
| 954 | .get = alc_ch_mode_get, |
| 955 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 956 | }, |
| 957 | { } /* end */ |
| 958 | }; |
| 959 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 960 | |
| 961 | /* |
| 962 | * ALC880 W810 model |
| 963 | * |
| 964 | * W810 has rear IO for: |
| 965 | * Front (DAC 02) |
| 966 | * Surround (DAC 03) |
| 967 | * Center/LFE (DAC 04) |
| 968 | * Digital out (06) |
| 969 | * |
| 970 | * The system also has a pair of internal speakers, and a headphone jack. |
| 971 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 972 | * |
| 973 | * There is a variable resistor to control the speaker or headphone |
| 974 | * volume. This is a hardware-only device without a software API. |
| 975 | * |
| 976 | * Plugging headphones in will disable the internal speakers. This is |
| 977 | * implemented in hardware, not via the driver using jack sense. In |
| 978 | * a similar fashion, plugging into the rear socket marked "front" will |
| 979 | * disable both the speakers and headphones. |
| 980 | * |
| 981 | * For input, there's a microphone jack, and an "audio in" jack. |
| 982 | * These may not do anything useful with this driver yet, because I |
| 983 | * haven't setup any initialization verbs for these yet... |
| 984 | */ |
| 985 | |
| 986 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 987 | /* front, rear/surround, clfe */ |
| 988 | 0x02, 0x03, 0x04 |
| 989 | }; |
| 990 | |
| 991 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 992 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 993 | { 6, NULL } |
| 994 | }; |
| 995 | |
| 996 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 997 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 998 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 999 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1000 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1001 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1002 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1003 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1004 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1005 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1006 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1007 | { } /* end */ |
| 1008 | }; |
| 1009 | |
| 1010 | |
| 1011 | /* |
| 1012 | * Z710V model |
| 1013 | * |
| 1014 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1015 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1016 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1017 | */ |
| 1018 | |
| 1019 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1020 | 0x02 |
| 1021 | }; |
| 1022 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1023 | |
| 1024 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1025 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1026 | { 2, NULL } |
| 1027 | }; |
| 1028 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1029 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1030 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1031 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1032 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1033 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1034 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1035 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1036 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1037 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1038 | { } /* end */ |
| 1039 | }; |
| 1040 | |
| 1041 | |
| 1042 | /* FIXME! */ |
| 1043 | /* |
| 1044 | * ALC880 F1734 model |
| 1045 | * |
| 1046 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1047 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1048 | */ |
| 1049 | |
| 1050 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1051 | 0x03 |
| 1052 | }; |
| 1053 | #define ALC880_F1734_HP_DAC 0x02 |
| 1054 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1055 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1056 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1057 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1058 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1059 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1060 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1061 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1064 | { } /* end */ |
| 1065 | }; |
| 1066 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1067 | |
| 1068 | /* FIXME! */ |
| 1069 | /* |
| 1070 | * ALC880 ASUS model |
| 1071 | * |
| 1072 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1073 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1074 | * Mic = 0x18, Line = 0x1a |
| 1075 | */ |
| 1076 | |
| 1077 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1078 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1079 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1080 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1081 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1082 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1083 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1084 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1085 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1086 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1087 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1088 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1089 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1090 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1091 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1092 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1095 | { |
| 1096 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1097 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1098 | .info = alc_ch_mode_info, |
| 1099 | .get = alc_ch_mode_get, |
| 1100 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1101 | }, |
| 1102 | { } /* end */ |
| 1103 | }; |
| 1104 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1105 | /* FIXME! */ |
| 1106 | /* |
| 1107 | * ALC880 ASUS W1V model |
| 1108 | * |
| 1109 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1110 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1111 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1112 | */ |
| 1113 | |
| 1114 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1115 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1116 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1117 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1118 | { } /* end */ |
| 1119 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1120 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1121 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1122 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1123 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1124 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1125 | { } /* end */ |
| 1126 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1127 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1128 | /* TCL S700 */ |
| 1129 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1131 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1132 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1133 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1134 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1137 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1138 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1139 | { |
| 1140 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1141 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1142 | * So call somewhat different.. |
| 1143 | * FIXME: the controls appear in the "playback" view! |
| 1144 | */ |
| 1145 | /* .name = "Capture Source", */ |
| 1146 | .name = "Input Source", |
| 1147 | .count = 1, |
| 1148 | .info = alc_mux_enum_info, |
| 1149 | .get = alc_mux_enum_get, |
| 1150 | .put = alc_mux_enum_put, |
| 1151 | }, |
| 1152 | { } /* end */ |
| 1153 | }; |
| 1154 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1155 | /* Uniwill */ |
| 1156 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
| 1157 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1158 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1159 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1160 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1161 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1162 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1163 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1164 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1165 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1166 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1167 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1168 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1170 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1171 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1172 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1173 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1174 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1175 | { |
| 1176 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1177 | .name = "Channel Mode", |
| 1178 | .info = alc_ch_mode_info, |
| 1179 | .get = alc_ch_mode_get, |
| 1180 | .put = alc_ch_mode_put, |
| 1181 | }, |
| 1182 | { } /* end */ |
| 1183 | }; |
| 1184 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1185 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1186 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1187 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1188 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1189 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1190 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1191 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1192 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1193 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1194 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1195 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1196 | { } /* end */ |
| 1197 | }; |
| 1198 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1199 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
| 1200 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1201 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1202 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1203 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1204 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1205 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1206 | { } /* end */ |
| 1207 | }; |
| 1208 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1209 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1210 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1211 | */ |
| 1212 | static int alc_build_controls(struct hda_codec *codec) |
| 1213 | { |
| 1214 | struct alc_spec *spec = codec->spec; |
| 1215 | int err; |
| 1216 | int i; |
| 1217 | |
| 1218 | for (i = 0; i < spec->num_mixers; i++) { |
| 1219 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1220 | if (err < 0) |
| 1221 | return err; |
| 1222 | } |
| 1223 | |
| 1224 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1225 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1226 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1227 | if (err < 0) |
| 1228 | return err; |
| 1229 | } |
| 1230 | if (spec->dig_in_nid) { |
| 1231 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1232 | if (err < 0) |
| 1233 | return err; |
| 1234 | } |
| 1235 | return 0; |
| 1236 | } |
| 1237 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1239 | /* |
| 1240 | * initialize the codec volumes, etc |
| 1241 | */ |
| 1242 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1243 | /* |
| 1244 | * generic initialization of ADC, input mixers and output mixers |
| 1245 | */ |
| 1246 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1247 | /* |
| 1248 | * Unmute ADC0-2 and set the default input to mic-in |
| 1249 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1250 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1251 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1252 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1253 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1254 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1255 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1256 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1257 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1258 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1259 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1260 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1261 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1262 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1263 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1264 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 1266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 1267 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1268 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1269 | /* |
| 1270 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1271 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1272 | /* set vol=0 to output mixers */ |
| 1273 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1274 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1275 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1276 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1277 | /* set up input amps for analog loopback */ |
| 1278 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1281 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1282 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1283 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1284 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1285 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1286 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1287 | |
| 1288 | { } |
| 1289 | }; |
| 1290 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1291 | /* |
| 1292 | * 3-stack pin configuration: |
| 1293 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1294 | */ |
| 1295 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1296 | /* |
| 1297 | * preset connection lists of input pins |
| 1298 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1299 | */ |
| 1300 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1301 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1302 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1303 | |
| 1304 | /* |
| 1305 | * Set pin mode and muting |
| 1306 | */ |
| 1307 | /* set front pin widgets 0x14 for output */ |
| 1308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1309 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1310 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1311 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1312 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1313 | /* Mic2 (as headphone out) for HP output */ |
| 1314 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1315 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1316 | /* Line In pin widget for input */ |
| 1317 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1318 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1319 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1320 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1321 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1322 | /* CD pin widget for input */ |
| 1323 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1324 | |
| 1325 | { } |
| 1326 | }; |
| 1327 | |
| 1328 | /* |
| 1329 | * 5-stack pin configuration: |
| 1330 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1331 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1332 | */ |
| 1333 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1334 | /* |
| 1335 | * preset connection lists of input pins |
| 1336 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1337 | */ |
| 1338 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1339 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1340 | |
| 1341 | /* |
| 1342 | * Set pin mode and muting |
| 1343 | */ |
| 1344 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1345 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1346 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1347 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1348 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1349 | /* unmute pins for output (no gain on this amp) */ |
| 1350 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1351 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1352 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1353 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1354 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1355 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1356 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1357 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1358 | /* Mic2 (as headphone out) for HP output */ |
| 1359 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1360 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1361 | /* Line In pin widget for input */ |
| 1362 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1363 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1364 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1365 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1366 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1367 | /* CD pin widget for input */ |
| 1368 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1369 | |
| 1370 | { } |
| 1371 | }; |
| 1372 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1373 | /* |
| 1374 | * W810 pin configuration: |
| 1375 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1376 | */ |
| 1377 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1378 | /* hphone/speaker input selector: front DAC */ |
| 1379 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1380 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1381 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1382 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1383 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1384 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1385 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1386 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1387 | |
| 1388 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1389 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1390 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1391 | { } |
| 1392 | }; |
| 1393 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1394 | /* |
| 1395 | * Z71V pin configuration: |
| 1396 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1397 | */ |
| 1398 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1399 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1400 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1401 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1402 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1403 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1404 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1405 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1406 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1407 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1408 | |
| 1409 | { } |
| 1410 | }; |
| 1411 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1412 | /* |
| 1413 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1414 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1415 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1416 | */ |
| 1417 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1418 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1419 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1420 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1421 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1424 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1425 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1426 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1427 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1428 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1429 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1430 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1431 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1432 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1433 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1434 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1435 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1436 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1437 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1438 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1439 | { } |
| 1440 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1441 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1442 | /* |
| 1443 | * Uniwill pin configuration: |
| 1444 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1445 | * line = 0x1a |
| 1446 | */ |
| 1447 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1448 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1449 | |
| 1450 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1451 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1452 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1453 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1454 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1455 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1456 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1457 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1459 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1461 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1462 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1463 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1464 | |
| 1465 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1466 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1467 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1468 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1469 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1470 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1471 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1472 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1473 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1474 | |
| 1475 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1476 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1477 | |
| 1478 | { } |
| 1479 | }; |
| 1480 | |
| 1481 | /* |
| 1482 | * Uniwill P53 |
| 1483 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1484 | */ |
| 1485 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1486 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1487 | |
| 1488 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1489 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1490 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1491 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1492 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1493 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1494 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1495 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1496 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1497 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1498 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1499 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1500 | |
| 1501 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1502 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1503 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1504 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1505 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1506 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1507 | |
| 1508 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1509 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1510 | |
| 1511 | { } |
| 1512 | }; |
| 1513 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1514 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1515 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1516 | { } |
| 1517 | }; |
| 1518 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1519 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1520 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1521 | { |
| 1522 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1523 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1524 | |
| 1525 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1526 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1527 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1528 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1529 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1530 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1531 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1532 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1533 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1534 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1535 | 0x80, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1536 | } |
| 1537 | |
| 1538 | /* auto-toggle front mic */ |
| 1539 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1540 | { |
| 1541 | unsigned int present; |
| 1542 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1543 | |
| 1544 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1545 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1546 | bits = present ? 0x80 : 0; |
| 1547 | snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, |
| 1548 | 0x80, bits); |
| 1549 | snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1, |
| 1550 | 0x80, bits); |
| 1551 | } |
| 1552 | |
| 1553 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1554 | { |
| 1555 | alc880_uniwill_hp_automute(codec); |
| 1556 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1557 | } |
| 1558 | |
| 1559 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1560 | unsigned int res) |
| 1561 | { |
| 1562 | /* Looks like the unsol event is incompatible with the standard |
| 1563 | * definition. 4bit tag is placed at 28 bit! |
| 1564 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1565 | switch (res >> 28) { |
| 1566 | case ALC880_HP_EVENT: |
| 1567 | alc880_uniwill_hp_automute(codec); |
| 1568 | break; |
| 1569 | case ALC880_MIC_EVENT: |
| 1570 | alc880_uniwill_mic_automute(codec); |
| 1571 | break; |
| 1572 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1573 | } |
| 1574 | |
| 1575 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1576 | { |
| 1577 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1578 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1579 | |
| 1580 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1581 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1582 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1583 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1584 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1585 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1586 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1587 | } |
| 1588 | |
| 1589 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1590 | { |
| 1591 | unsigned int present; |
| 1592 | |
| 1593 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 1594 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; |
| 1595 | |
| 1596 | snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 1597 | 0x7f, present); |
| 1598 | snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 1599 | 0x7f, present); |
| 1600 | |
| 1601 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 1602 | 0x7f, present); |
| 1603 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 1604 | 0x7f, present); |
| 1605 | |
| 1606 | } |
| 1607 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1608 | unsigned int res) |
| 1609 | { |
| 1610 | /* Looks like the unsol event is incompatible with the standard |
| 1611 | * definition. 4bit tag is placed at 28 bit! |
| 1612 | */ |
| 1613 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1614 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1615 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1616 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1617 | } |
| 1618 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1619 | /* FIXME! */ |
| 1620 | /* |
| 1621 | * F1734 pin configuration: |
| 1622 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1623 | */ |
| 1624 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1625 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1626 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1627 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1628 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1629 | |
| 1630 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1631 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1632 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1633 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1634 | |
| 1635 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1636 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1637 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1638 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1639 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1640 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1641 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1642 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1643 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1644 | |
| 1645 | { } |
| 1646 | }; |
| 1647 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1648 | /* FIXME! */ |
| 1649 | /* |
| 1650 | * ASUS pin configuration: |
| 1651 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1652 | */ |
| 1653 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1654 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1655 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1656 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1657 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1658 | |
| 1659 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1660 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1661 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1662 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1663 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1664 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1665 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1666 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1667 | |
| 1668 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1669 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1670 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1671 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1672 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1673 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1674 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1675 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1676 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1677 | |
| 1678 | { } |
| 1679 | }; |
| 1680 | |
| 1681 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1682 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1683 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1685 | /* Clevo m520g init */ |
| 1686 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1687 | /* headphone output */ |
| 1688 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1689 | /* line-out */ |
| 1690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1691 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1692 | /* Line-in */ |
| 1693 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1694 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1695 | /* CD */ |
| 1696 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1697 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1698 | /* Mic1 (rear panel) */ |
| 1699 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1700 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1701 | /* Mic2 (front panel) */ |
| 1702 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1703 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1704 | /* headphone */ |
| 1705 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1706 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1707 | /* change to EAPD mode */ |
| 1708 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1709 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1710 | |
| 1711 | { } |
| 1712 | }; |
| 1713 | |
| 1714 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 1715 | /* change to EAPD mode */ |
| 1716 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1717 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1718 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1719 | /* Headphone output */ |
| 1720 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1721 | /* Front output*/ |
| 1722 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1723 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1724 | |
| 1725 | /* Line In pin widget for input */ |
| 1726 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1727 | /* CD pin widget for input */ |
| 1728 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1729 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1730 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1731 | |
| 1732 | /* change to EAPD mode */ |
| 1733 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1734 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 1735 | |
| 1736 | { } |
| 1737 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1738 | |
| 1739 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1740 | * LG m1 express dual |
| 1741 | * |
| 1742 | * Pin assignment: |
| 1743 | * Rear Line-In/Out (blue): 0x14 |
| 1744 | * Build-in Mic-In: 0x15 |
| 1745 | * Speaker-out: 0x17 |
| 1746 | * HP-Out (green): 0x1b |
| 1747 | * Mic-In/Out (red): 0x19 |
| 1748 | * SPDIF-Out: 0x1e |
| 1749 | */ |
| 1750 | |
| 1751 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 1752 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 1753 | 0x05, 0x02, 0x03 |
| 1754 | }; |
| 1755 | |
| 1756 | /* seems analog CD is not working */ |
| 1757 | static struct hda_input_mux alc880_lg_capture_source = { |
| 1758 | .num_items = 3, |
| 1759 | .items = { |
| 1760 | { "Mic", 0x1 }, |
| 1761 | { "Line", 0x5 }, |
| 1762 | { "Internal Mic", 0x6 }, |
| 1763 | }, |
| 1764 | }; |
| 1765 | |
| 1766 | /* 2,4,6 channel modes */ |
| 1767 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 1768 | /* set line-in and mic-in to input */ |
| 1769 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1770 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1771 | { } |
| 1772 | }; |
| 1773 | |
| 1774 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 1775 | /* set line-in to out and mic-in to input */ |
| 1776 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1777 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1778 | { } |
| 1779 | }; |
| 1780 | |
| 1781 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 1782 | /* set line-in and mic-in to output */ |
| 1783 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1784 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1785 | { } |
| 1786 | }; |
| 1787 | |
| 1788 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 1789 | { 2, alc880_lg_ch2_init }, |
| 1790 | { 4, alc880_lg_ch4_init }, |
| 1791 | { 6, alc880_lg_ch6_init }, |
| 1792 | }; |
| 1793 | |
| 1794 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 1795 | /* FIXME: it's not really "master" but front channels */ |
| 1796 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1797 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1798 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1799 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1800 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 1801 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 1802 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 1803 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 1804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1806 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 1807 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 1808 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 1809 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 1810 | { |
| 1811 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1812 | .name = "Channel Mode", |
| 1813 | .info = alc_ch_mode_info, |
| 1814 | .get = alc_ch_mode_get, |
| 1815 | .put = alc_ch_mode_put, |
| 1816 | }, |
| 1817 | { } /* end */ |
| 1818 | }; |
| 1819 | |
| 1820 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 1821 | /* set capture source to mic-in */ |
| 1822 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1824 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1825 | /* mute all amp mixer inputs */ |
| 1826 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 1827 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 1828 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1829 | /* line-in to input */ |
| 1830 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1831 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1832 | /* built-in mic */ |
| 1833 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1834 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1835 | /* speaker-out */ |
| 1836 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1837 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1838 | /* mic-in to input */ |
| 1839 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1840 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1841 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1842 | /* HP-out */ |
| 1843 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1844 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1845 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1846 | /* jack sense */ |
| 1847 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1848 | { } |
| 1849 | }; |
| 1850 | |
| 1851 | /* toggle speaker-output according to the hp-jack state */ |
| 1852 | static void alc880_lg_automute(struct hda_codec *codec) |
| 1853 | { |
| 1854 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1855 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1856 | |
| 1857 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1858 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1859 | bits = present ? 0x80 : 0; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1860 | snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1861 | 0x80, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1862 | snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1863 | 0x80, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1864 | } |
| 1865 | |
| 1866 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1867 | { |
| 1868 | /* Looks like the unsol event is incompatible with the standard |
| 1869 | * definition. 4bit tag is placed at 28 bit! |
| 1870 | */ |
| 1871 | if ((res >> 28) == 0x01) |
| 1872 | alc880_lg_automute(codec); |
| 1873 | } |
| 1874 | |
| 1875 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1876 | * LG LW20 |
| 1877 | * |
| 1878 | * Pin assignment: |
| 1879 | * Speaker-out: 0x14 |
| 1880 | * Mic-In: 0x18 |
| 1881 | * Built-in Mic-In: 0x19 (?) |
| 1882 | * HP-Out: 0x1b |
| 1883 | * SPDIF-Out: 0x1e |
| 1884 | */ |
| 1885 | |
| 1886 | /* seems analog CD is not working */ |
| 1887 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
| 1888 | .num_items = 2, |
| 1889 | .items = { |
| 1890 | { "Mic", 0x0 }, |
| 1891 | { "Internal Mic", 0x1 }, |
| 1892 | }, |
| 1893 | }; |
| 1894 | |
| 1895 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
| 1896 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1897 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1900 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 1901 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 1902 | { } /* end */ |
| 1903 | }; |
| 1904 | |
| 1905 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
| 1906 | /* set capture source to mic-in */ |
| 1907 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1908 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1909 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1910 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1911 | /* speaker-out */ |
| 1912 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1913 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1914 | /* HP-out */ |
| 1915 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1916 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1917 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1918 | /* mic-in to input */ |
| 1919 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1920 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1921 | /* built-in mic */ |
| 1922 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1923 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1924 | /* jack sense */ |
| 1925 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1926 | { } |
| 1927 | }; |
| 1928 | |
| 1929 | /* toggle speaker-output according to the hp-jack state */ |
| 1930 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 1931 | { |
| 1932 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1933 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1934 | |
| 1935 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1936 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1937 | bits = present ? 0x80 : 0; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1938 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1939 | 0x80, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1940 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1941 | 0x80, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1942 | } |
| 1943 | |
| 1944 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1945 | { |
| 1946 | /* Looks like the unsol event is incompatible with the standard |
| 1947 | * definition. 4bit tag is placed at 28 bit! |
| 1948 | */ |
| 1949 | if ((res >> 28) == 0x01) |
| 1950 | alc880_lg_lw_automute(codec); |
| 1951 | } |
| 1952 | |
| 1953 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1954 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1955 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1956 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1957 | static int alc_init(struct hda_codec *codec) |
| 1958 | { |
| 1959 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1960 | unsigned int i; |
| 1961 | |
| 1962 | for (i = 0; i < spec->num_init_verbs; i++) |
| 1963 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1964 | |
| 1965 | if (spec->init_hook) |
| 1966 | spec->init_hook(codec); |
| 1967 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1968 | return 0; |
| 1969 | } |
| 1970 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1971 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1972 | { |
| 1973 | struct alc_spec *spec = codec->spec; |
| 1974 | |
| 1975 | if (spec->unsol_event) |
| 1976 | spec->unsol_event(codec, res); |
| 1977 | } |
| 1978 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1979 | #ifdef CONFIG_PM |
| 1980 | /* |
| 1981 | * resume |
| 1982 | */ |
| 1983 | static int alc_resume(struct hda_codec *codec) |
| 1984 | { |
| 1985 | struct alc_spec *spec = codec->spec; |
| 1986 | int i; |
| 1987 | |
| 1988 | alc_init(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1989 | for (i = 0; i < spec->num_mixers; i++) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1990 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1991 | if (spec->multiout.dig_out_nid) |
| 1992 | snd_hda_resume_spdif_out(codec); |
| 1993 | if (spec->dig_in_nid) |
| 1994 | snd_hda_resume_spdif_in(codec); |
| 1995 | |
| 1996 | return 0; |
| 1997 | } |
| 1998 | #endif |
| 1999 | |
| 2000 | /* |
| 2001 | * Analog playback callbacks |
| 2002 | */ |
| 2003 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2004 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2005 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2006 | { |
| 2007 | struct alc_spec *spec = codec->spec; |
| 2008 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2009 | } |
| 2010 | |
| 2011 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2012 | struct hda_codec *codec, |
| 2013 | unsigned int stream_tag, |
| 2014 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2015 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2016 | { |
| 2017 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2018 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2019 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2020 | } |
| 2021 | |
| 2022 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2023 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2024 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2025 | { |
| 2026 | struct alc_spec *spec = codec->spec; |
| 2027 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2028 | } |
| 2029 | |
| 2030 | /* |
| 2031 | * Digital out |
| 2032 | */ |
| 2033 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2034 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2035 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2036 | { |
| 2037 | struct alc_spec *spec = codec->spec; |
| 2038 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2039 | } |
| 2040 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2041 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2042 | struct hda_codec *codec, |
| 2043 | unsigned int stream_tag, |
| 2044 | unsigned int format, |
| 2045 | struct snd_pcm_substream *substream) |
| 2046 | { |
| 2047 | struct alc_spec *spec = codec->spec; |
| 2048 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2049 | stream_tag, format, substream); |
| 2050 | } |
| 2051 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2052 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2053 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2054 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2055 | { |
| 2056 | struct alc_spec *spec = codec->spec; |
| 2057 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2058 | } |
| 2059 | |
| 2060 | /* |
| 2061 | * Analog capture |
| 2062 | */ |
| 2063 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2064 | struct hda_codec *codec, |
| 2065 | unsigned int stream_tag, |
| 2066 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2067 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2068 | { |
| 2069 | struct alc_spec *spec = codec->spec; |
| 2070 | |
| 2071 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2072 | stream_tag, 0, format); |
| 2073 | return 0; |
| 2074 | } |
| 2075 | |
| 2076 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2077 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2078 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2079 | { |
| 2080 | struct alc_spec *spec = codec->spec; |
| 2081 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2082 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2083 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2084 | return 0; |
| 2085 | } |
| 2086 | |
| 2087 | |
| 2088 | /* |
| 2089 | */ |
| 2090 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2091 | .substreams = 1, |
| 2092 | .channels_min = 2, |
| 2093 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2094 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2095 | .ops = { |
| 2096 | .open = alc880_playback_pcm_open, |
| 2097 | .prepare = alc880_playback_pcm_prepare, |
| 2098 | .cleanup = alc880_playback_pcm_cleanup |
| 2099 | }, |
| 2100 | }; |
| 2101 | |
| 2102 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 2103 | .substreams = 2, |
| 2104 | .channels_min = 2, |
| 2105 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2106 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2107 | .ops = { |
| 2108 | .prepare = alc880_capture_pcm_prepare, |
| 2109 | .cleanup = alc880_capture_pcm_cleanup |
| 2110 | }, |
| 2111 | }; |
| 2112 | |
| 2113 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2114 | .substreams = 1, |
| 2115 | .channels_min = 2, |
| 2116 | .channels_max = 2, |
| 2117 | /* NID is set in alc_build_pcms */ |
| 2118 | .ops = { |
| 2119 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2120 | .close = alc880_dig_playback_pcm_close, |
| 2121 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2122 | }, |
| 2123 | }; |
| 2124 | |
| 2125 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2126 | .substreams = 1, |
| 2127 | .channels_min = 2, |
| 2128 | .channels_max = 2, |
| 2129 | /* NID is set in alc_build_pcms */ |
| 2130 | }; |
| 2131 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2132 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 2133 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 2134 | .substreams = 0, |
| 2135 | .channels_min = 0, |
| 2136 | .channels_max = 0, |
| 2137 | }; |
| 2138 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2139 | static int alc_build_pcms(struct hda_codec *codec) |
| 2140 | { |
| 2141 | struct alc_spec *spec = codec->spec; |
| 2142 | struct hda_pcm *info = spec->pcm_rec; |
| 2143 | int i; |
| 2144 | |
| 2145 | codec->num_pcms = 1; |
| 2146 | codec->pcm_info = info; |
| 2147 | |
| 2148 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2149 | if (spec->stream_analog_playback) { |
| 2150 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2151 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2152 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2153 | } |
| 2154 | if (spec->stream_analog_capture) { |
| 2155 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2156 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2157 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2158 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2159 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2160 | if (spec->channel_mode) { |
| 2161 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2162 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2163 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2164 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2165 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2166 | } |
| 2167 | } |
| 2168 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2169 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2170 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2171 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2172 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2173 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2174 | if (spec->multiout.dig_out_nid && |
| 2175 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2176 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2177 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2178 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2179 | if (spec->dig_in_nid && |
| 2180 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2181 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2182 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2183 | } |
| 2184 | } |
| 2185 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2186 | /* If the use of more than one ADC is requested for the current |
| 2187 | * model, configure a second analog capture-only PCM. |
| 2188 | */ |
| 2189 | /* Additional Analaog capture for index #2 */ |
| 2190 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2191 | spec->adc_nids) { |
| 2192 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2193 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2194 | info->name = spec->stream_name_analog; |
| 2195 | /* No playback stream for second PCM */ |
| 2196 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2197 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2198 | if (spec->stream_analog_capture) { |
| 2199 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2200 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2201 | } |
| 2202 | } |
| 2203 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2204 | return 0; |
| 2205 | } |
| 2206 | |
| 2207 | static void alc_free(struct hda_codec *codec) |
| 2208 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2209 | struct alc_spec *spec = codec->spec; |
| 2210 | unsigned int i; |
| 2211 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2212 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2213 | return; |
| 2214 | |
| 2215 | if (spec->kctl_alloc) { |
| 2216 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2217 | kfree(spec->kctl_alloc[i].name); |
| 2218 | kfree(spec->kctl_alloc); |
| 2219 | } |
| 2220 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2221 | } |
| 2222 | |
| 2223 | /* |
| 2224 | */ |
| 2225 | static struct hda_codec_ops alc_patch_ops = { |
| 2226 | .build_controls = alc_build_controls, |
| 2227 | .build_pcms = alc_build_pcms, |
| 2228 | .init = alc_init, |
| 2229 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2230 | .unsol_event = alc_unsol_event, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2231 | #ifdef CONFIG_PM |
| 2232 | .resume = alc_resume, |
| 2233 | #endif |
| 2234 | }; |
| 2235 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2236 | |
| 2237 | /* |
| 2238 | * Test configuration for debugging |
| 2239 | * |
| 2240 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2241 | * enum controls. |
| 2242 | */ |
| 2243 | #ifdef CONFIG_SND_DEBUG |
| 2244 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2245 | 0x02, 0x03, 0x04, 0x05 |
| 2246 | }; |
| 2247 | |
| 2248 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2249 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2250 | .items = { |
| 2251 | { "In-1", 0x0 }, |
| 2252 | { "In-2", 0x1 }, |
| 2253 | { "In-3", 0x2 }, |
| 2254 | { "In-4", 0x3 }, |
| 2255 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2256 | { "Front", 0x5 }, |
| 2257 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2258 | }, |
| 2259 | }; |
| 2260 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2261 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2262 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2263 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2264 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2265 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2266 | }; |
| 2267 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2268 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2269 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2270 | { |
| 2271 | static char *texts[] = { |
| 2272 | "N/A", "Line Out", "HP Out", |
| 2273 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2274 | }; |
| 2275 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2276 | uinfo->count = 1; |
| 2277 | uinfo->value.enumerated.items = 8; |
| 2278 | if (uinfo->value.enumerated.item >= 8) |
| 2279 | uinfo->value.enumerated.item = 7; |
| 2280 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2281 | return 0; |
| 2282 | } |
| 2283 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2284 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2285 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2286 | { |
| 2287 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2288 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2289 | unsigned int pin_ctl, item = 0; |
| 2290 | |
| 2291 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2292 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2293 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2294 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2295 | item = 2; |
| 2296 | else |
| 2297 | item = 1; |
| 2298 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2299 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2300 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2301 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2302 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2303 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2304 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2305 | } |
| 2306 | } |
| 2307 | ucontrol->value.enumerated.item[0] = item; |
| 2308 | return 0; |
| 2309 | } |
| 2310 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2311 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2312 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2313 | { |
| 2314 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2315 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2316 | static unsigned int ctls[] = { |
| 2317 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2318 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2319 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2320 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2321 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2322 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2323 | }; |
| 2324 | unsigned int old_ctl, new_ctl; |
| 2325 | |
| 2326 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2327 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2328 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2329 | if (old_ctl != new_ctl) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2330 | snd_hda_codec_write(codec, nid, 0, |
| 2331 | AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2332 | 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] | 2333 | (ucontrol->value.enumerated.item[0] >= 3 ? |
| 2334 | 0xb080 : 0xb000)); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2335 | return 1; |
| 2336 | } |
| 2337 | return 0; |
| 2338 | } |
| 2339 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2340 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2341 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2342 | { |
| 2343 | static char *texts[] = { |
| 2344 | "Front", "Surround", "CLFE", "Side" |
| 2345 | }; |
| 2346 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2347 | uinfo->count = 1; |
| 2348 | uinfo->value.enumerated.items = 4; |
| 2349 | if (uinfo->value.enumerated.item >= 4) |
| 2350 | uinfo->value.enumerated.item = 3; |
| 2351 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2352 | return 0; |
| 2353 | } |
| 2354 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2355 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2356 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2357 | { |
| 2358 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2359 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2360 | unsigned int sel; |
| 2361 | |
| 2362 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2363 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2364 | return 0; |
| 2365 | } |
| 2366 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2367 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2368 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2369 | { |
| 2370 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2371 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2372 | unsigned int sel; |
| 2373 | |
| 2374 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2375 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2376 | sel = ucontrol->value.enumerated.item[0] & 3; |
| 2377 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel); |
| 2378 | return 1; |
| 2379 | } |
| 2380 | return 0; |
| 2381 | } |
| 2382 | |
| 2383 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2384 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2385 | .name = xname, \ |
| 2386 | .info = alc_test_pin_ctl_info, \ |
| 2387 | .get = alc_test_pin_ctl_get, \ |
| 2388 | .put = alc_test_pin_ctl_put, \ |
| 2389 | .private_value = nid \ |
| 2390 | } |
| 2391 | |
| 2392 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2393 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2394 | .name = xname, \ |
| 2395 | .info = alc_test_pin_src_info, \ |
| 2396 | .get = alc_test_pin_src_get, \ |
| 2397 | .put = alc_test_pin_src_put, \ |
| 2398 | .private_value = nid \ |
| 2399 | } |
| 2400 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2401 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2402 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2403 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2404 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2405 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2406 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2407 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2408 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2409 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2410 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2411 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2412 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2413 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2414 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2415 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2416 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2417 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2418 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2419 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2420 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2421 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2422 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2423 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2424 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2425 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2426 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2427 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2428 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2429 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2430 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2431 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2432 | { |
| 2433 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2434 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2435 | .info = alc_ch_mode_info, |
| 2436 | .get = alc_ch_mode_get, |
| 2437 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2438 | }, |
| 2439 | { } /* end */ |
| 2440 | }; |
| 2441 | |
| 2442 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2443 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2444 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2446 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2447 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2448 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2449 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2450 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2451 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2452 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2453 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2454 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2455 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2456 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2457 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2459 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2460 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2461 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2462 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2463 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2464 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2465 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2466 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2467 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2468 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2469 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2470 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2471 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2472 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2473 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2474 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2475 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2476 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2477 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2478 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2479 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2480 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2481 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2482 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2483 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2484 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2485 | /* Analog input/passthru */ |
| 2486 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2487 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2488 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2489 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2490 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2491 | { } |
| 2492 | }; |
| 2493 | #endif |
| 2494 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2495 | /* |
| 2496 | */ |
| 2497 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2498 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2499 | [ALC880_3ST] = "3stack", |
| 2500 | [ALC880_TCL_S700] = "tcl", |
| 2501 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2502 | [ALC880_CLEVO] = "clevo", |
| 2503 | [ALC880_5ST] = "5stack", |
| 2504 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2505 | [ALC880_W810] = "w810", |
| 2506 | [ALC880_Z71V] = "z71v", |
| 2507 | [ALC880_6ST] = "6stack", |
| 2508 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2509 | [ALC880_ASUS] = "asus", |
| 2510 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2511 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2512 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2513 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2514 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2515 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2516 | [ALC880_F1734] = "F1734", |
| 2517 | [ALC880_LG] = "lg", |
| 2518 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2519 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2520 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2521 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2522 | [ALC880_AUTO] = "auto", |
| 2523 | }; |
| 2524 | |
| 2525 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
| 2526 | /* Broken BIOS configuration */ |
| 2527 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), |
| 2528 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2529 | |
| 2530 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2531 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
Tobin Davis | 4dc53e2 | 2006-12-18 13:24:37 +0100 | [diff] [blame] | 2532 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2533 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2534 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2535 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2536 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2537 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2538 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
| 2539 | |
| 2540 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2541 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
| 2542 | |
| 2543 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2544 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2545 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2546 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2547 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2548 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2549 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2550 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2551 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2552 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2553 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2554 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2555 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2556 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
| 2557 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), |
| 2558 | |
| 2559 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2560 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
| 2561 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2562 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
| 2563 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
| 2564 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2565 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
| 2566 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
| 2567 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2568 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
| 2569 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2570 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2571 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
| 2572 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2573 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2574 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2575 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
| 2576 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
| 2577 | |
| 2578 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
| 2579 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2580 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
| 2581 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
| 2582 | |
| 2583 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
| 2584 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
| 2585 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2586 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2587 | |
| 2588 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2589 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
| 2590 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
| 2591 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
| 2592 | |
| 2593 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
| 2594 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2595 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
| 2596 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2597 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
| 2598 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
| 2599 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2600 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2601 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
| 2602 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
| 2603 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2604 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2605 | {} |
| 2606 | }; |
| 2607 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2608 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2609 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2610 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2611 | static struct alc_config_preset alc880_presets[] = { |
| 2612 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2613 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2614 | .init_verbs = { alc880_volume_init_verbs, |
| 2615 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2616 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2617 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2618 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2619 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2620 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2621 | .input_mux = &alc880_capture_source, |
| 2622 | }, |
| 2623 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2624 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2625 | .init_verbs = { alc880_volume_init_verbs, |
| 2626 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2627 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2628 | .dac_nids = alc880_dac_nids, |
| 2629 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2630 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2631 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2632 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2633 | .input_mux = &alc880_capture_source, |
| 2634 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2635 | [ALC880_TCL_S700] = { |
| 2636 | .mixers = { alc880_tcl_s700_mixer }, |
| 2637 | .init_verbs = { alc880_volume_init_verbs, |
| 2638 | alc880_pin_tcl_S700_init_verbs, |
| 2639 | alc880_gpio2_init_verbs }, |
| 2640 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2641 | .dac_nids = alc880_dac_nids, |
| 2642 | .hp_nid = 0x03, |
| 2643 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2644 | .channel_mode = alc880_2_jack_modes, |
| 2645 | .input_mux = &alc880_capture_source, |
| 2646 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2647 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2648 | .mixers = { alc880_three_stack_mixer, |
| 2649 | alc880_five_stack_mixer}, |
| 2650 | .init_verbs = { alc880_volume_init_verbs, |
| 2651 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2652 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2653 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2654 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2655 | .channel_mode = alc880_fivestack_modes, |
| 2656 | .input_mux = &alc880_capture_source, |
| 2657 | }, |
| 2658 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2659 | .mixers = { alc880_three_stack_mixer, |
| 2660 | alc880_five_stack_mixer }, |
| 2661 | .init_verbs = { alc880_volume_init_verbs, |
| 2662 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2663 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2664 | .dac_nids = alc880_dac_nids, |
| 2665 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2666 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2667 | .channel_mode = alc880_fivestack_modes, |
| 2668 | .input_mux = &alc880_capture_source, |
| 2669 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2670 | [ALC880_6ST] = { |
| 2671 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2672 | .init_verbs = { alc880_volume_init_verbs, |
| 2673 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2674 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2675 | .dac_nids = alc880_6st_dac_nids, |
| 2676 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2677 | .channel_mode = alc880_sixstack_modes, |
| 2678 | .input_mux = &alc880_6stack_capture_source, |
| 2679 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2680 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2681 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2682 | .init_verbs = { alc880_volume_init_verbs, |
| 2683 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2684 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2685 | .dac_nids = alc880_6st_dac_nids, |
| 2686 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2687 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2688 | .channel_mode = alc880_sixstack_modes, |
| 2689 | .input_mux = &alc880_6stack_capture_source, |
| 2690 | }, |
| 2691 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2692 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2693 | .init_verbs = { alc880_volume_init_verbs, |
| 2694 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2695 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2696 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 2697 | .dac_nids = alc880_w810_dac_nids, |
| 2698 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2699 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2700 | .channel_mode = alc880_w810_modes, |
| 2701 | .input_mux = &alc880_capture_source, |
| 2702 | }, |
| 2703 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2704 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2705 | .init_verbs = { alc880_volume_init_verbs, |
| 2706 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2707 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 2708 | .dac_nids = alc880_z71v_dac_nids, |
| 2709 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2710 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2711 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2712 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2713 | .input_mux = &alc880_capture_source, |
| 2714 | }, |
| 2715 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2716 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2717 | .init_verbs = { alc880_volume_init_verbs, |
| 2718 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2719 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 2720 | .dac_nids = alc880_f1734_dac_nids, |
| 2721 | .hp_nid = 0x02, |
| 2722 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2723 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2724 | .input_mux = &alc880_capture_source, |
| 2725 | }, |
| 2726 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2727 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2728 | .init_verbs = { alc880_volume_init_verbs, |
| 2729 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2730 | alc880_gpio1_init_verbs }, |
| 2731 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2732 | .dac_nids = alc880_asus_dac_nids, |
| 2733 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2734 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2735 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2736 | .input_mux = &alc880_capture_source, |
| 2737 | }, |
| 2738 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2739 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2740 | .init_verbs = { alc880_volume_init_verbs, |
| 2741 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2742 | alc880_gpio1_init_verbs }, |
| 2743 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2744 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2745 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2746 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2747 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2748 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2749 | .input_mux = &alc880_capture_source, |
| 2750 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2751 | [ALC880_ASUS_DIG2] = { |
| 2752 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2753 | .init_verbs = { alc880_volume_init_verbs, |
| 2754 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2755 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 2756 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2757 | .dac_nids = alc880_asus_dac_nids, |
| 2758 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2759 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2760 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2761 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2762 | .input_mux = &alc880_capture_source, |
| 2763 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2764 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2765 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2766 | .init_verbs = { alc880_volume_init_verbs, |
| 2767 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2768 | alc880_gpio1_init_verbs }, |
| 2769 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2770 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2771 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2772 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2773 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2774 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2775 | .input_mux = &alc880_capture_source, |
| 2776 | }, |
| 2777 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 2778 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2779 | .init_verbs = { alc880_volume_init_verbs, |
| 2780 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2781 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2782 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2783 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2784 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2785 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2786 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2787 | .input_mux = &alc880_capture_source, |
| 2788 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2789 | [ALC880_UNIWILL] = { |
| 2790 | .mixers = { alc880_uniwill_mixer }, |
| 2791 | .init_verbs = { alc880_volume_init_verbs, |
| 2792 | alc880_uniwill_init_verbs }, |
| 2793 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2794 | .dac_nids = alc880_asus_dac_nids, |
| 2795 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2796 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2797 | .channel_mode = alc880_threestack_modes, |
| 2798 | .need_dac_fix = 1, |
| 2799 | .input_mux = &alc880_capture_source, |
| 2800 | .unsol_event = alc880_uniwill_unsol_event, |
| 2801 | .init_hook = alc880_uniwill_automute, |
| 2802 | }, |
| 2803 | [ALC880_UNIWILL_P53] = { |
| 2804 | .mixers = { alc880_uniwill_p53_mixer }, |
| 2805 | .init_verbs = { alc880_volume_init_verbs, |
| 2806 | alc880_uniwill_p53_init_verbs }, |
| 2807 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2808 | .dac_nids = alc880_asus_dac_nids, |
| 2809 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2810 | .channel_mode = alc880_threestack_modes, |
| 2811 | .input_mux = &alc880_capture_source, |
| 2812 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2813 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2814 | }, |
| 2815 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2816 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2817 | alc880_pcbeep_mixer, }, |
| 2818 | .init_verbs = { alc880_volume_init_verbs, |
| 2819 | alc880_uniwill_p53_init_verbs, |
| 2820 | alc880_beep_init_verbs }, |
| 2821 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2822 | .dac_nids = alc880_dac_nids, |
| 2823 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2824 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2825 | .input_mux = &alc880_capture_source, |
| 2826 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2827 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2828 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2829 | [ALC880_CLEVO] = { |
| 2830 | .mixers = { alc880_three_stack_mixer }, |
| 2831 | .init_verbs = { alc880_volume_init_verbs, |
| 2832 | alc880_pin_clevo_init_verbs }, |
| 2833 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2834 | .dac_nids = alc880_dac_nids, |
| 2835 | .hp_nid = 0x03, |
| 2836 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2837 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2838 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2839 | .input_mux = &alc880_capture_source, |
| 2840 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2841 | [ALC880_LG] = { |
| 2842 | .mixers = { alc880_lg_mixer }, |
| 2843 | .init_verbs = { alc880_volume_init_verbs, |
| 2844 | alc880_lg_init_verbs }, |
| 2845 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 2846 | .dac_nids = alc880_lg_dac_nids, |
| 2847 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2848 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 2849 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2850 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2851 | .input_mux = &alc880_lg_capture_source, |
| 2852 | .unsol_event = alc880_lg_unsol_event, |
| 2853 | .init_hook = alc880_lg_automute, |
| 2854 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2855 | [ALC880_LG_LW] = { |
| 2856 | .mixers = { alc880_lg_lw_mixer }, |
| 2857 | .init_verbs = { alc880_volume_init_verbs, |
| 2858 | alc880_lg_lw_init_verbs }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2859 | .num_dacs = 1, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2860 | .dac_nids = alc880_dac_nids, |
| 2861 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2862 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2863 | .channel_mode = alc880_2_jack_modes, |
| 2864 | .input_mux = &alc880_lg_lw_capture_source, |
| 2865 | .unsol_event = alc880_lg_lw_unsol_event, |
| 2866 | .init_hook = alc880_lg_lw_automute, |
| 2867 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2868 | #ifdef CONFIG_SND_DEBUG |
| 2869 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2870 | .mixers = { alc880_test_mixer }, |
| 2871 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2872 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 2873 | .dac_nids = alc880_test_dac_nids, |
| 2874 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2875 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 2876 | .channel_mode = alc880_test_modes, |
| 2877 | .input_mux = &alc880_test_capture_source, |
| 2878 | }, |
| 2879 | #endif |
| 2880 | }; |
| 2881 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2882 | /* |
| 2883 | * Automatic parse of I/O pins from the BIOS configuration |
| 2884 | */ |
| 2885 | |
| 2886 | #define NUM_CONTROL_ALLOC 32 |
| 2887 | #define NUM_VERB_ALLOC 32 |
| 2888 | |
| 2889 | enum { |
| 2890 | ALC_CTL_WIDGET_VOL, |
| 2891 | ALC_CTL_WIDGET_MUTE, |
| 2892 | ALC_CTL_BIND_MUTE, |
| 2893 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2894 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2895 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2896 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2897 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2898 | }; |
| 2899 | |
| 2900 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2901 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 2902 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2903 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2904 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2905 | |
| 2906 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 2907 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 2908 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2909 | /* array + terminator */ |
| 2910 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 2911 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2912 | return -ENOMEM; |
| 2913 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2914 | memcpy(knew, spec->kctl_alloc, |
| 2915 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2916 | kfree(spec->kctl_alloc); |
| 2917 | } |
| 2918 | spec->kctl_alloc = knew; |
| 2919 | spec->num_kctl_alloc = num; |
| 2920 | } |
| 2921 | |
| 2922 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 2923 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 2924 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2925 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2926 | return -ENOMEM; |
| 2927 | knew->private_value = val; |
| 2928 | spec->num_kctl_used++; |
| 2929 | return 0; |
| 2930 | } |
| 2931 | |
| 2932 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 2933 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 2934 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 2935 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 2936 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 2937 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 2938 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 2939 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 2940 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 2941 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 2942 | #define ALC880_PIN_CD_NID 0x1c |
| 2943 | |
| 2944 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2945 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 2946 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2947 | { |
| 2948 | hda_nid_t nid; |
| 2949 | int assigned[4]; |
| 2950 | int i, j; |
| 2951 | |
| 2952 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2953 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2954 | |
| 2955 | /* check the pins hardwired to audio widget */ |
| 2956 | for (i = 0; i < cfg->line_outs; i++) { |
| 2957 | nid = cfg->line_out_pins[i]; |
| 2958 | if (alc880_is_fixed_pin(nid)) { |
| 2959 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 2960 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2961 | assigned[idx] = 1; |
| 2962 | } |
| 2963 | } |
| 2964 | /* left pins can be connect to any audio widget */ |
| 2965 | for (i = 0; i < cfg->line_outs; i++) { |
| 2966 | nid = cfg->line_out_pins[i]; |
| 2967 | if (alc880_is_fixed_pin(nid)) |
| 2968 | continue; |
| 2969 | /* search for an empty channel */ |
| 2970 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2971 | if (!assigned[j]) { |
| 2972 | spec->multiout.dac_nids[i] = |
| 2973 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2974 | assigned[j] = 1; |
| 2975 | break; |
| 2976 | } |
| 2977 | } |
| 2978 | } |
| 2979 | spec->multiout.num_dacs = cfg->line_outs; |
| 2980 | return 0; |
| 2981 | } |
| 2982 | |
| 2983 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2984 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 2985 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2986 | { |
| 2987 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2988 | static const char *chname[4] = { |
| 2989 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 2990 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2991 | hda_nid_t nid; |
| 2992 | int i, err; |
| 2993 | |
| 2994 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2995 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2996 | continue; |
| 2997 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 2998 | if (i == 2) { |
| 2999 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3000 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3001 | "Center Playback Volume", |
| 3002 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3003 | HDA_OUTPUT)); |
| 3004 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3005 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3006 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3007 | "LFE Playback Volume", |
| 3008 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3009 | HDA_OUTPUT)); |
| 3010 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3011 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3012 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3013 | "Center Playback Switch", |
| 3014 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3015 | HDA_INPUT)); |
| 3016 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3017 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3018 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3019 | "LFE Playback Switch", |
| 3020 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3021 | HDA_INPUT)); |
| 3022 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3023 | return err; |
| 3024 | } else { |
| 3025 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3026 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3027 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3028 | HDA_OUTPUT)); |
| 3029 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3030 | return err; |
| 3031 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3032 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3033 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3034 | HDA_INPUT)); |
| 3035 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3036 | return err; |
| 3037 | } |
| 3038 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3039 | return 0; |
| 3040 | } |
| 3041 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3042 | /* add playback controls for speaker and HP outputs */ |
| 3043 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3044 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3045 | { |
| 3046 | hda_nid_t nid; |
| 3047 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3048 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3049 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3050 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3051 | return 0; |
| 3052 | |
| 3053 | if (alc880_is_fixed_pin(pin)) { |
| 3054 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3055 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3056 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3057 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3058 | else |
| 3059 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3060 | /* control HP volume/switch on the output mixer amp */ |
| 3061 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3062 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3063 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3064 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3065 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3066 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3067 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3068 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3069 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3070 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3071 | return err; |
| 3072 | } else if (alc880_is_multi_pin(pin)) { |
| 3073 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3074 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3075 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3076 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3077 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3078 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3079 | return err; |
| 3080 | } |
| 3081 | return 0; |
| 3082 | } |
| 3083 | |
| 3084 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3085 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3086 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3087 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3088 | { |
| 3089 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3090 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3091 | |
| 3092 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3093 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3094 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3095 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3096 | return err; |
| 3097 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3098 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3099 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3100 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3101 | return err; |
| 3102 | return 0; |
| 3103 | } |
| 3104 | |
| 3105 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3106 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3107 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3108 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3109 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3110 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3111 | |
| 3112 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3113 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3114 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3115 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3116 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3117 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3118 | if (err < 0) |
| 3119 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3120 | imux->items[imux->num_items].label = |
| 3121 | auto_pin_cfg_labels[i]; |
| 3122 | imux->items[imux->num_items].index = |
| 3123 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3124 | imux->num_items++; |
| 3125 | } |
| 3126 | } |
| 3127 | return 0; |
| 3128 | } |
| 3129 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3130 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3131 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3132 | int dac_idx) |
| 3133 | { |
| 3134 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3135 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3136 | pin_type); |
| 3137 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3138 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3139 | /* need the manual connection? */ |
| 3140 | if (alc880_is_multi_pin(nid)) { |
| 3141 | struct alc_spec *spec = codec->spec; |
| 3142 | int idx = alc880_multi_pin_idx(nid); |
| 3143 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3144 | AC_VERB_SET_CONNECT_SEL, |
| 3145 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3146 | } |
| 3147 | } |
| 3148 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3149 | static int get_pin_type(int line_out_type) |
| 3150 | { |
| 3151 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3152 | return PIN_HP; |
| 3153 | else |
| 3154 | return PIN_OUT; |
| 3155 | } |
| 3156 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3157 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3158 | { |
| 3159 | struct alc_spec *spec = codec->spec; |
| 3160 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3161 | |
| 3162 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3163 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3164 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3165 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3166 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3167 | } |
| 3168 | } |
| 3169 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3170 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3171 | { |
| 3172 | struct alc_spec *spec = codec->spec; |
| 3173 | hda_nid_t pin; |
| 3174 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3175 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3176 | if (pin) /* connect to front */ |
| 3177 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3178 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3179 | if (pin) /* connect to front */ |
| 3180 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3181 | } |
| 3182 | |
| 3183 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3184 | { |
| 3185 | struct alc_spec *spec = codec->spec; |
| 3186 | int i; |
| 3187 | |
| 3188 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3189 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3190 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3191 | snd_hda_codec_write(codec, nid, 0, |
| 3192 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3193 | i <= AUTO_PIN_FRONT_MIC ? |
| 3194 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3195 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3196 | snd_hda_codec_write(codec, nid, 0, |
| 3197 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3198 | AMP_OUT_MUTE); |
| 3199 | } |
| 3200 | } |
| 3201 | } |
| 3202 | |
| 3203 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3204 | /* return 1 if successful, 0 if the proper config is not found, |
| 3205 | * or a negative error code |
| 3206 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3207 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3208 | { |
| 3209 | struct alc_spec *spec = codec->spec; |
| 3210 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3211 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3212 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3213 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3214 | alc880_ignore); |
| 3215 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3216 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3217 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3218 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3219 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3220 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3221 | if (err < 0) |
| 3222 | return err; |
| 3223 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3224 | if (err < 0) |
| 3225 | return err; |
| 3226 | err = alc880_auto_create_extra_out(spec, |
| 3227 | spec->autocfg.speaker_pins[0], |
| 3228 | "Speaker"); |
| 3229 | if (err < 0) |
| 3230 | return err; |
| 3231 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3232 | "Headphone"); |
| 3233 | if (err < 0) |
| 3234 | return err; |
| 3235 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3236 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3237 | return err; |
| 3238 | |
| 3239 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3240 | |
| 3241 | if (spec->autocfg.dig_out_pin) |
| 3242 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3243 | if (spec->autocfg.dig_in_pin) |
| 3244 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3245 | |
| 3246 | if (spec->kctl_alloc) |
| 3247 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3248 | |
| 3249 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3250 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3251 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3252 | spec->input_mux = &spec->private_imux; |
| 3253 | |
| 3254 | return 1; |
| 3255 | } |
| 3256 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3257 | /* additional initialization for auto-configuration model */ |
| 3258 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3259 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3260 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3261 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3262 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3263 | } |
| 3264 | |
| 3265 | /* |
| 3266 | * OK, here we have finally the patch for ALC880 |
| 3267 | */ |
| 3268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3269 | static int patch_alc880(struct hda_codec *codec) |
| 3270 | { |
| 3271 | struct alc_spec *spec; |
| 3272 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3273 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3274 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3275 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3276 | if (spec == NULL) |
| 3277 | return -ENOMEM; |
| 3278 | |
| 3279 | codec->spec = spec; |
| 3280 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3281 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3282 | alc880_models, |
| 3283 | alc880_cfg_tbl); |
| 3284 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3285 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3286 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3287 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3288 | } |
| 3289 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3290 | if (board_config == ALC880_AUTO) { |
| 3291 | /* automatic parse from the BIOS config */ |
| 3292 | err = alc880_parse_auto_config(codec); |
| 3293 | if (err < 0) { |
| 3294 | alc_free(codec); |
| 3295 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3296 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3297 | printk(KERN_INFO |
| 3298 | "hda_codec: Cannot set up configuration " |
| 3299 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3300 | board_config = ALC880_3ST; |
| 3301 | } |
| 3302 | } |
| 3303 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3304 | if (board_config != ALC880_AUTO) |
| 3305 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3306 | |
| 3307 | spec->stream_name_analog = "ALC880 Analog"; |
| 3308 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3309 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3310 | |
| 3311 | spec->stream_name_digital = "ALC880 Digital"; |
| 3312 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3313 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3314 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3315 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3316 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3317 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3318 | /* get type */ |
| 3319 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3320 | if (wcap != AC_WID_AUD_IN) { |
| 3321 | spec->adc_nids = alc880_adc_nids_alt; |
| 3322 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3323 | spec->mixers[spec->num_mixers] = |
| 3324 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3325 | spec->num_mixers++; |
| 3326 | } else { |
| 3327 | spec->adc_nids = alc880_adc_nids; |
| 3328 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3329 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3330 | spec->num_mixers++; |
| 3331 | } |
| 3332 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3333 | |
| 3334 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3335 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3336 | spec->init_hook = alc880_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3337 | |
| 3338 | return 0; |
| 3339 | } |
| 3340 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3341 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3342 | /* |
| 3343 | * ALC260 support |
| 3344 | */ |
| 3345 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3346 | static hda_nid_t alc260_dac_nids[1] = { |
| 3347 | /* front */ |
| 3348 | 0x02, |
| 3349 | }; |
| 3350 | |
| 3351 | static hda_nid_t alc260_adc_nids[1] = { |
| 3352 | /* ADC0 */ |
| 3353 | 0x04, |
| 3354 | }; |
| 3355 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3356 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3357 | /* ADC1 */ |
| 3358 | 0x05, |
| 3359 | }; |
| 3360 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3361 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3362 | /* ADC1, 0 */ |
| 3363 | 0x05, 0x04 |
| 3364 | }; |
| 3365 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3366 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3367 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3368 | */ |
| 3369 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3370 | /* ADC0, ADC1 */ |
| 3371 | 0x04, 0x05 |
| 3372 | }; |
| 3373 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3374 | #define ALC260_DIGOUT_NID 0x03 |
| 3375 | #define ALC260_DIGIN_NID 0x06 |
| 3376 | |
| 3377 | static struct hda_input_mux alc260_capture_source = { |
| 3378 | .num_items = 4, |
| 3379 | .items = { |
| 3380 | { "Mic", 0x0 }, |
| 3381 | { "Front Mic", 0x1 }, |
| 3382 | { "Line", 0x2 }, |
| 3383 | { "CD", 0x4 }, |
| 3384 | }, |
| 3385 | }; |
| 3386 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3387 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3388 | * headphone jack and the internal CD lines since these are the only pins at |
| 3389 | * which audio can appear. For flexibility, also allow the option of |
| 3390 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3391 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3392 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3393 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3394 | { |
| 3395 | .num_items = 3, |
| 3396 | .items = { |
| 3397 | { "Mic/Line", 0x0 }, |
| 3398 | { "CD", 0x4 }, |
| 3399 | { "Headphone", 0x2 }, |
| 3400 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3401 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3402 | { |
| 3403 | .num_items = 4, |
| 3404 | .items = { |
| 3405 | { "Mic/Line", 0x0 }, |
| 3406 | { "CD", 0x4 }, |
| 3407 | { "Headphone", 0x2 }, |
| 3408 | { "Mixer", 0x5 }, |
| 3409 | }, |
| 3410 | }, |
| 3411 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3412 | }; |
| 3413 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3414 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3415 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3416 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3417 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3418 | { |
| 3419 | .num_items = 4, |
| 3420 | .items = { |
| 3421 | { "Mic", 0x0 }, |
| 3422 | { "Line", 0x2 }, |
| 3423 | { "CD", 0x4 }, |
| 3424 | { "Headphone", 0x5 }, |
| 3425 | }, |
| 3426 | }, |
| 3427 | { |
| 3428 | .num_items = 5, |
| 3429 | .items = { |
| 3430 | { "Mic", 0x0 }, |
| 3431 | { "Line", 0x2 }, |
| 3432 | { "CD", 0x4 }, |
| 3433 | { "Headphone", 0x6 }, |
| 3434 | { "Mixer", 0x5 }, |
| 3435 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3436 | }, |
| 3437 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3438 | /* |
| 3439 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3440 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3441 | * element which allows changing the channel mode, so the verb list is |
| 3442 | * never used. |
| 3443 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3444 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3445 | { 2, NULL }, |
| 3446 | }; |
| 3447 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3448 | |
| 3449 | /* Mixer combinations |
| 3450 | * |
| 3451 | * basic: base_output + input + pc_beep + capture |
| 3452 | * HP: base_output + input + capture_alt |
| 3453 | * HP_3013: hp_3013 + input + capture |
| 3454 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3455 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3456 | */ |
| 3457 | |
| 3458 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3459 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3460 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3461 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3462 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3463 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3464 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3465 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3466 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3467 | |
| 3468 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3469 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3470 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3471 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3472 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3473 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3474 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3475 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3476 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3477 | { } /* end */ |
| 3478 | }; |
| 3479 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3480 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3481 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3482 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3483 | { } /* end */ |
| 3484 | }; |
| 3485 | |
| 3486 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3487 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3488 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3489 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3490 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3491 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3492 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3493 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3494 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3495 | { } /* end */ |
| 3496 | }; |
| 3497 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3498 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3499 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3500 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3501 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3502 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3503 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3504 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3505 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3506 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3507 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3508 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3509 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3510 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3511 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3512 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3513 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3514 | { } /* end */ |
| 3515 | }; |
| 3516 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3517 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3518 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3519 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3520 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3521 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3522 | * revisions available in early 2006. Therefore for now allow the |
| 3523 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3524 | * that the lack of mic bias for this NID is intentional we could change the |
| 3525 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3526 | * |
| 3527 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3528 | * don't appear to make the mic bias available from the "line" jack, even |
| 3529 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3530 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3531 | * and the output jack. If this turns out to be the case for all such |
| 3532 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3533 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3534 | * |
| 3535 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3536 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 3537 | * controls for such models. On models without a "mono speaker" the control |
| 3538 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3539 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3540 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3541 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3542 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3543 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3544 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3545 | HDA_OUTPUT), |
| 3546 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 3547 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3548 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3549 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3552 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3553 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3554 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3555 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3556 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3557 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3558 | { } /* end */ |
| 3559 | }; |
| 3560 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3561 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 3562 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 3563 | */ |
| 3564 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 3565 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3566 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3567 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3568 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3569 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3570 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3571 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3572 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3573 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3574 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3575 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3576 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3577 | { } /* end */ |
| 3578 | }; |
| 3579 | |
| 3580 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 3581 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 3582 | */ |
| 3583 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 3584 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3585 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3586 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3587 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3588 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3589 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 3590 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 3591 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3592 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3593 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3594 | { } /* end */ |
| 3595 | }; |
| 3596 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3597 | /* capture mixer elements */ |
| 3598 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3599 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3600 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3601 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3602 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3603 | { |
| 3604 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3605 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3606 | * So call somewhat different.. |
| 3607 | * FIXME: the controls appear in the "playback" view! |
| 3608 | */ |
| 3609 | /* .name = "Capture Source", */ |
| 3610 | .name = "Input Source", |
| 3611 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3612 | .info = alc_mux_enum_info, |
| 3613 | .get = alc_mux_enum_get, |
| 3614 | .put = alc_mux_enum_put, |
| 3615 | }, |
| 3616 | { } /* end */ |
| 3617 | }; |
| 3618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3619 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3620 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3621 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3622 | { |
| 3623 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3624 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3625 | * So call somewhat different.. |
| 3626 | * FIXME: the controls appear in the "playback" view! |
| 3627 | */ |
| 3628 | /* .name = "Capture Source", */ |
| 3629 | .name = "Input Source", |
| 3630 | .count = 1, |
| 3631 | .info = alc_mux_enum_info, |
| 3632 | .get = alc_mux_enum_get, |
| 3633 | .put = alc_mux_enum_put, |
| 3634 | }, |
| 3635 | { } /* end */ |
| 3636 | }; |
| 3637 | |
| 3638 | /* |
| 3639 | * initialization verbs |
| 3640 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3641 | static struct hda_verb alc260_init_verbs[] = { |
| 3642 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3643 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3644 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3645 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3646 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3647 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3648 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3649 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3650 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3651 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3652 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3653 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3654 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3655 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3656 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3657 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3658 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3659 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3660 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3661 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3662 | /* set connection select to line in (default select for this ADC) */ |
| 3663 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3664 | /* mute capture amp left and right */ |
| 3665 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3666 | /* set connection select to line in (default select for this ADC) */ |
| 3667 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3668 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3669 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3670 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3671 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3672 | /* set vol=0 HP mixer amp left and right */ |
| 3673 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3674 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3675 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3676 | /* set vol=0 Mono mixer amp left and right */ |
| 3677 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3678 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3679 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3680 | /* unmute LINE-2 out pin */ |
| 3681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3682 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3683 | * Line In 2 = 0x03 |
| 3684 | */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3685 | /* mute CD */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3686 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3687 | /* mute Line In */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3689 | /* mute Mic */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3690 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3691 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3692 | /* mute Front out path */ |
| 3693 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3694 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3695 | /* mute Headphone out path */ |
| 3696 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3697 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3698 | /* mute Mono out path */ |
| 3699 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3700 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3701 | { } |
| 3702 | }; |
| 3703 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3704 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3705 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 3706 | /* Headphone and output */ |
| 3707 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3708 | /* mono output */ |
| 3709 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3710 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3711 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3712 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3713 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3714 | /* Line In pin widget for input */ |
| 3715 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3716 | /* Line-2 pin widget for output */ |
| 3717 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3718 | /* CD pin widget for input */ |
| 3719 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3720 | /* unmute amp left and right */ |
| 3721 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3722 | /* set connection select to line in (default select for this ADC) */ |
| 3723 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3724 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3725 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3726 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3727 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3728 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3729 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3730 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3731 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3732 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3733 | * Line In 2 = 0x03 |
| 3734 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3735 | /* unmute CD */ |
| 3736 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3737 | /* unmute Line In */ |
| 3738 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3739 | /* unmute Mic */ |
| 3740 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3741 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3742 | /* Unmute Front out path */ |
| 3743 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3744 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3745 | /* Unmute Headphone out path */ |
| 3746 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3747 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3748 | /* Unmute Mono out path */ |
| 3749 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3750 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3751 | { } |
| 3752 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3753 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3754 | |
| 3755 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 3756 | /* Line out and output */ |
| 3757 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3758 | /* mono output */ |
| 3759 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3760 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3761 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3762 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3763 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3764 | /* Line In pin widget for input */ |
| 3765 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3766 | /* Headphone pin widget for output */ |
| 3767 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3768 | /* CD pin widget for input */ |
| 3769 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3770 | /* unmute amp left and right */ |
| 3771 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3772 | /* set connection select to line in (default select for this ADC) */ |
| 3773 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3774 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3775 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3776 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3777 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3778 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3779 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3780 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3781 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3782 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3783 | * Line In 2 = 0x03 |
| 3784 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3785 | /* unmute CD */ |
| 3786 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3787 | /* unmute Line In */ |
| 3788 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3789 | /* unmute Mic */ |
| 3790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3791 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3792 | /* Unmute Front out path */ |
| 3793 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3794 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3795 | /* Unmute Headphone out path */ |
| 3796 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3797 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3798 | /* Unmute Mono out path */ |
| 3799 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3800 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3801 | { } |
| 3802 | }; |
| 3803 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3804 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3805 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 3806 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3807 | */ |
| 3808 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 3809 | /* Disable all GPIOs */ |
| 3810 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 3811 | /* Internal speaker is connected to headphone pin */ |
| 3812 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3813 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 3814 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3815 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 3816 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3817 | /* Ensure all other unused pins are disabled and muted. */ |
| 3818 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3819 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3820 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3821 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3822 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3823 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3824 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3825 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3826 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3827 | /* Disable digital (SPDIF) pins */ |
| 3828 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3829 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3830 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3831 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 3832 | * when acting as an output. |
| 3833 | */ |
| 3834 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3835 | |
| 3836 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 3837 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3838 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3839 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3840 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3841 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3842 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3843 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3844 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3845 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3846 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3847 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 3848 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3849 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 3850 | * If the pin mode is changed by the user the pin mode control will |
| 3851 | * take care of enabling the pin's input/output buffers as needed. |
| 3852 | * Therefore there's no need to enable the input buffer at this |
| 3853 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3854 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3855 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3856 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 3857 | * mixer ctrl) |
| 3858 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3859 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3860 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3861 | /* Mute capture amp left and right */ |
| 3862 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3863 | /* Set ADC connection select to match default mixer setting - line |
| 3864 | * in (on mic1 pin) |
| 3865 | */ |
| 3866 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3867 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3868 | /* Do the same for the second ADC: mute capture input amp and |
| 3869 | * set ADC connection to line in (on mic1 pin) |
| 3870 | */ |
| 3871 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3872 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3873 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3874 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3875 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3876 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3877 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3878 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3879 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3880 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3881 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3882 | {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] | 3883 | |
| 3884 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3885 | }; |
| 3886 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3887 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 3888 | * similar laptops (adapted from Fujitsu init verbs). |
| 3889 | */ |
| 3890 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 3891 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 3892 | * the headphone jack. Turn this on and rely on the standard mute |
| 3893 | * methods whenever the user wants to turn these outputs off. |
| 3894 | */ |
| 3895 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 3896 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3897 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 3898 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 3899 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3900 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 3901 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 3902 | /* Line In jack is connected to Line1 pin */ |
| 3903 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3904 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 3905 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3906 | /* Ensure all other unused pins are disabled and muted. */ |
| 3907 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3908 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3909 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3910 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3911 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3912 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3913 | /* Disable digital (SPDIF) pins */ |
| 3914 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3915 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3916 | |
| 3917 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 3918 | * bus when acting as outputs. |
| 3919 | */ |
| 3920 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3921 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3922 | |
| 3923 | /* Start with output sum widgets muted and their output gains at min */ |
| 3924 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3925 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3926 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3927 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3928 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3929 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3930 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3931 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3932 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3933 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3934 | /* Unmute Line-out pin widget amp left and right |
| 3935 | * (no equiv mixer ctrl) |
| 3936 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3937 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3938 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 3939 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3940 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 3941 | * inputs. If the pin mode is changed by the user the pin mode control |
| 3942 | * will take care of enabling the pin's input/output buffers as needed. |
| 3943 | * Therefore there's no need to enable the input buffer at this |
| 3944 | * stage. |
| 3945 | */ |
| 3946 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3947 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3948 | |
| 3949 | /* Mute capture amp left and right */ |
| 3950 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3951 | /* Set ADC connection select to match default mixer setting - mic |
| 3952 | * (on mic1 pin) |
| 3953 | */ |
| 3954 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3955 | |
| 3956 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3957 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3958 | */ |
| 3959 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3960 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3961 | |
| 3962 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3963 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3964 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3965 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3966 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3967 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3968 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3969 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3970 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 3971 | |
| 3972 | { } |
| 3973 | }; |
| 3974 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3975 | static struct hda_verb alc260_will_verbs[] = { |
| 3976 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3977 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3978 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3979 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 3980 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3981 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 3982 | {} |
| 3983 | }; |
| 3984 | |
| 3985 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 3986 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 3987 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3988 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 3989 | |
| 3990 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 3991 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3992 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 3993 | |
| 3994 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3995 | {} |
| 3996 | }; |
| 3997 | |
| 3998 | /* toggle speaker-output according to the hp-jack state */ |
| 3999 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4000 | { |
| 4001 | unsigned int present; |
| 4002 | |
| 4003 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4004 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4005 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4006 | if (present) { |
| 4007 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 1); |
| 4008 | snd_hda_codec_write(codec, 0x0f, 0, |
| 4009 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); |
| 4010 | } else { |
| 4011 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 4012 | snd_hda_codec_write(codec, 0x0f, 0, |
| 4013 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 4014 | } |
| 4015 | } |
| 4016 | |
| 4017 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4018 | unsigned int res) |
| 4019 | { |
| 4020 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4021 | alc260_replacer_672v_automute(codec); |
| 4022 | } |
| 4023 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4024 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4025 | * configuration. |
| 4026 | */ |
| 4027 | #ifdef CONFIG_SND_DEBUG |
| 4028 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4029 | 0x02, |
| 4030 | }; |
| 4031 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4032 | 0x04, 0x05, |
| 4033 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4034 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4035 | * the signal assignments are different. This assumes that the first ADC |
| 4036 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4037 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4038 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4039 | { |
| 4040 | .num_items = 7, |
| 4041 | .items = { |
| 4042 | { "MIC1 pin", 0x0 }, |
| 4043 | { "MIC2 pin", 0x1 }, |
| 4044 | { "LINE1 pin", 0x2 }, |
| 4045 | { "LINE2 pin", 0x3 }, |
| 4046 | { "CD pin", 0x4 }, |
| 4047 | { "LINE-OUT pin", 0x5 }, |
| 4048 | { "HP-OUT pin", 0x6 }, |
| 4049 | }, |
| 4050 | }, |
| 4051 | { |
| 4052 | .num_items = 8, |
| 4053 | .items = { |
| 4054 | { "MIC1 pin", 0x0 }, |
| 4055 | { "MIC2 pin", 0x1 }, |
| 4056 | { "LINE1 pin", 0x2 }, |
| 4057 | { "LINE2 pin", 0x3 }, |
| 4058 | { "CD pin", 0x4 }, |
| 4059 | { "Mixer", 0x5 }, |
| 4060 | { "LINE-OUT pin", 0x6 }, |
| 4061 | { "HP-OUT pin", 0x7 }, |
| 4062 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4063 | }, |
| 4064 | }; |
| 4065 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4066 | /* Output driver widgets */ |
| 4067 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4068 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4069 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4070 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4071 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4072 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4073 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4074 | /* Modes for retasking pin widgets |
| 4075 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4076 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4077 | * mention this restriction. At this stage it's not clear whether |
| 4078 | * this behaviour is intentional or is a hardware bug in chip |
| 4079 | * revisions available at least up until early 2006. Therefore for |
| 4080 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4081 | * choices, but if it turns out that the lack of mic bias for these |
| 4082 | * NIDs is intentional we could change their modes from |
| 4083 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4084 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4085 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4086 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4087 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4088 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4089 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4090 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4091 | |
| 4092 | /* Loopback mixer controls */ |
| 4093 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4094 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4095 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4096 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4097 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4098 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4099 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4100 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4101 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4102 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4103 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4104 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4105 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4106 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4107 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4108 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4109 | |
| 4110 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4111 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4112 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4113 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4114 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4115 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4116 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4117 | * is ambigious as to which NID is which; testing on laptops which |
| 4118 | * make this output available should provide clarification. |
| 4119 | */ |
| 4120 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4121 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4122 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4123 | { } /* end */ |
| 4124 | }; |
| 4125 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4126 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4127 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4128 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4129 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4130 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4131 | /* Enable retasking pins as output, initially without power amp */ |
| 4132 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4133 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4134 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4135 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4136 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4137 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4138 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4139 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4140 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4141 | * payload also sets the generation to 0, output to be in "consumer" |
| 4142 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4143 | * control. |
| 4144 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4145 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4146 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4147 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4148 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4149 | * OUT1 sum bus when acting as an output. |
| 4150 | */ |
| 4151 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4152 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4153 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4154 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4155 | |
| 4156 | /* Start with output sum widgets muted and their output gains at min */ |
| 4157 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4158 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4159 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4160 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4161 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4162 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4163 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4164 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4165 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4166 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4167 | /* Unmute retasking pin widget output buffers since the default |
| 4168 | * state appears to be output. As the pin mode is changed by the |
| 4169 | * user the pin mode control will take care of enabling the pin's |
| 4170 | * input/output buffers as needed. |
| 4171 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4172 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4173 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4174 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4175 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4176 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4177 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4178 | /* Also unmute the mono-out pin widget */ |
| 4179 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4180 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4181 | /* Mute capture amp left and right */ |
| 4182 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4183 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4184 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4185 | */ |
| 4186 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4187 | |
| 4188 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4189 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4190 | */ |
| 4191 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4192 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4193 | |
| 4194 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4195 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4196 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4197 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4201 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4202 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4203 | |
| 4204 | { } |
| 4205 | }; |
| 4206 | #endif |
| 4207 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4208 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 4209 | .substreams = 1, |
| 4210 | .channels_min = 2, |
| 4211 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4212 | }; |
| 4213 | |
| 4214 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 4215 | .substreams = 1, |
| 4216 | .channels_min = 2, |
| 4217 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4218 | }; |
| 4219 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4220 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4221 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4222 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4223 | /* |
| 4224 | * for BIOS auto-configuration |
| 4225 | */ |
| 4226 | |
| 4227 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4228 | const char *pfx) |
| 4229 | { |
| 4230 | hda_nid_t nid_vol; |
| 4231 | unsigned long vol_val, sw_val; |
| 4232 | char name[32]; |
| 4233 | int err; |
| 4234 | |
| 4235 | if (nid >= 0x0f && nid < 0x11) { |
| 4236 | nid_vol = nid - 0x7; |
| 4237 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4238 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4239 | } else if (nid == 0x11) { |
| 4240 | nid_vol = nid - 0x7; |
| 4241 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4242 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4243 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4244 | nid_vol = 0x08; |
| 4245 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4246 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4247 | } else |
| 4248 | return 0; /* N/A */ |
| 4249 | |
| 4250 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4251 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4252 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4253 | return err; |
| 4254 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4255 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4256 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4257 | return err; |
| 4258 | return 1; |
| 4259 | } |
| 4260 | |
| 4261 | /* add playback controls from the parsed DAC table */ |
| 4262 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4263 | const struct auto_pin_cfg *cfg) |
| 4264 | { |
| 4265 | hda_nid_t nid; |
| 4266 | int err; |
| 4267 | |
| 4268 | spec->multiout.num_dacs = 1; |
| 4269 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4270 | spec->multiout.dac_nids[0] = 0x02; |
| 4271 | |
| 4272 | nid = cfg->line_out_pins[0]; |
| 4273 | if (nid) { |
| 4274 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4275 | if (err < 0) |
| 4276 | return err; |
| 4277 | } |
| 4278 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4279 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4280 | if (nid) { |
| 4281 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4282 | if (err < 0) |
| 4283 | return err; |
| 4284 | } |
| 4285 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4286 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4287 | if (nid) { |
| 4288 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4289 | if (err < 0) |
| 4290 | return err; |
| 4291 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4292 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4293 | } |
| 4294 | |
| 4295 | /* create playback/capture controls for input pins */ |
| 4296 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4297 | const struct auto_pin_cfg *cfg) |
| 4298 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4299 | struct hda_input_mux *imux = &spec->private_imux; |
| 4300 | int i, err, idx; |
| 4301 | |
| 4302 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4303 | if (cfg->input_pins[i] >= 0x12) { |
| 4304 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4305 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4306 | auto_pin_cfg_labels[i], idx, |
| 4307 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4308 | if (err < 0) |
| 4309 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4310 | imux->items[imux->num_items].label = |
| 4311 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4312 | imux->items[imux->num_items].index = idx; |
| 4313 | imux->num_items++; |
| 4314 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4315 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4316 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4317 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4318 | auto_pin_cfg_labels[i], idx, |
| 4319 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4320 | if (err < 0) |
| 4321 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4322 | imux->items[imux->num_items].label = |
| 4323 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4324 | imux->items[imux->num_items].index = idx; |
| 4325 | imux->num_items++; |
| 4326 | } |
| 4327 | } |
| 4328 | return 0; |
| 4329 | } |
| 4330 | |
| 4331 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4332 | hda_nid_t nid, int pin_type, |
| 4333 | int sel_idx) |
| 4334 | { |
| 4335 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4336 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4337 | pin_type); |
| 4338 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4339 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4340 | /* need the manual connection? */ |
| 4341 | if (nid >= 0x12) { |
| 4342 | int idx = nid - 0x12; |
| 4343 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4344 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4345 | } |
| 4346 | } |
| 4347 | |
| 4348 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4349 | { |
| 4350 | struct alc_spec *spec = codec->spec; |
| 4351 | hda_nid_t nid; |
| 4352 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4353 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4354 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4355 | if (nid) { |
| 4356 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4357 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4358 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4359 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4360 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4361 | if (nid) |
| 4362 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4363 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4364 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4365 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4366 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4367 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4368 | |
| 4369 | #define ALC260_PIN_CD_NID 0x16 |
| 4370 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4371 | { |
| 4372 | struct alc_spec *spec = codec->spec; |
| 4373 | int i; |
| 4374 | |
| 4375 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4376 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4377 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4378 | snd_hda_codec_write(codec, nid, 0, |
| 4379 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4380 | i <= AUTO_PIN_FRONT_MIC ? |
| 4381 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4382 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4383 | snd_hda_codec_write(codec, nid, 0, |
| 4384 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4385 | AMP_OUT_MUTE); |
| 4386 | } |
| 4387 | } |
| 4388 | } |
| 4389 | |
| 4390 | /* |
| 4391 | * generic initialization of ADC, input mixers and output mixers |
| 4392 | */ |
| 4393 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4394 | /* |
| 4395 | * Unmute ADC0-1 and set the default input to mic-in |
| 4396 | */ |
| 4397 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4398 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4399 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4400 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4401 | |
| 4402 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4403 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4404 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4405 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4406 | */ |
| 4407 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 4408 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4409 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4410 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 4411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 4412 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 4413 | |
| 4414 | /* |
| 4415 | * Set up output mixers (0x08 - 0x0a) |
| 4416 | */ |
| 4417 | /* set vol=0 to output mixers */ |
| 4418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4420 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4421 | /* set up input amps for analog loopback */ |
| 4422 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4423 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4424 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4426 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4427 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4428 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4429 | |
| 4430 | { } |
| 4431 | }; |
| 4432 | |
| 4433 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4434 | { |
| 4435 | struct alc_spec *spec = codec->spec; |
| 4436 | unsigned int wcap; |
| 4437 | int err; |
| 4438 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4439 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4440 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4441 | alc260_ignore); |
| 4442 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4443 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4444 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4445 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4446 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4447 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4448 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4449 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4450 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4451 | return err; |
| 4452 | |
| 4453 | spec->multiout.max_channels = 2; |
| 4454 | |
| 4455 | if (spec->autocfg.dig_out_pin) |
| 4456 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4457 | if (spec->kctl_alloc) |
| 4458 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4459 | |
| 4460 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4461 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4462 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4463 | spec->input_mux = &spec->private_imux; |
| 4464 | |
| 4465 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4466 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4467 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4468 | if (wcap != AC_WID_AUD_IN) { |
| 4469 | spec->adc_nids = alc260_adc_nids_alt; |
| 4470 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4471 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4472 | } else { |
| 4473 | spec->adc_nids = alc260_adc_nids; |
| 4474 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4475 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4476 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4477 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4478 | |
| 4479 | return 1; |
| 4480 | } |
| 4481 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4482 | /* additional initialization for auto-configuration model */ |
| 4483 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4484 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4485 | alc260_auto_init_multi_out(codec); |
| 4486 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4487 | } |
| 4488 | |
| 4489 | /* |
| 4490 | * ALC260 configurations |
| 4491 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4492 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4493 | [ALC260_BASIC] = "basic", |
| 4494 | [ALC260_HP] = "hp", |
| 4495 | [ALC260_HP_3013] = "hp-3013", |
| 4496 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4497 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4498 | [ALC260_WILL] = "will", |
| 4499 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4500 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4501 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4502 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4503 | [ALC260_AUTO] = "auto", |
| 4504 | }; |
| 4505 | |
| 4506 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4507 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4508 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4509 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4510 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4511 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4512 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4513 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4514 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4515 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4516 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4517 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4518 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4519 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4520 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4521 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4522 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4523 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
| 4524 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4525 | {} |
| 4526 | }; |
| 4527 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4528 | static struct alc_config_preset alc260_presets[] = { |
| 4529 | [ALC260_BASIC] = { |
| 4530 | .mixers = { alc260_base_output_mixer, |
| 4531 | alc260_input_mixer, |
| 4532 | alc260_pc_beep_mixer, |
| 4533 | alc260_capture_mixer }, |
| 4534 | .init_verbs = { alc260_init_verbs }, |
| 4535 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4536 | .dac_nids = alc260_dac_nids, |
| 4537 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4538 | .adc_nids = alc260_adc_nids, |
| 4539 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4540 | .channel_mode = alc260_modes, |
| 4541 | .input_mux = &alc260_capture_source, |
| 4542 | }, |
| 4543 | [ALC260_HP] = { |
| 4544 | .mixers = { alc260_base_output_mixer, |
| 4545 | alc260_input_mixer, |
| 4546 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4547 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4548 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4549 | .dac_nids = alc260_dac_nids, |
| 4550 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4551 | .adc_nids = alc260_hp_adc_nids, |
| 4552 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4553 | .channel_mode = alc260_modes, |
| 4554 | .input_mux = &alc260_capture_source, |
| 4555 | }, |
| 4556 | [ALC260_HP_3013] = { |
| 4557 | .mixers = { alc260_hp_3013_mixer, |
| 4558 | alc260_input_mixer, |
| 4559 | alc260_capture_alt_mixer }, |
| 4560 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4561 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4562 | .dac_nids = alc260_dac_nids, |
| 4563 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4564 | .adc_nids = alc260_hp_adc_nids, |
| 4565 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4566 | .channel_mode = alc260_modes, |
| 4567 | .input_mux = &alc260_capture_source, |
| 4568 | }, |
| 4569 | [ALC260_FUJITSU_S702X] = { |
| 4570 | .mixers = { alc260_fujitsu_mixer, |
| 4571 | alc260_capture_mixer }, |
| 4572 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4573 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4574 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4575 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4576 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4577 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4578 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4579 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4580 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4581 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4582 | [ALC260_ACER] = { |
| 4583 | .mixers = { alc260_acer_mixer, |
| 4584 | alc260_capture_mixer }, |
| 4585 | .init_verbs = { alc260_acer_init_verbs }, |
| 4586 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4587 | .dac_nids = alc260_dac_nids, |
| 4588 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4589 | .adc_nids = alc260_dual_adc_nids, |
| 4590 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4591 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4592 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4593 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4594 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4595 | [ALC260_WILL] = { |
| 4596 | .mixers = { alc260_will_mixer, |
| 4597 | alc260_capture_mixer }, |
| 4598 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 4599 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4600 | .dac_nids = alc260_dac_nids, |
| 4601 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4602 | .adc_nids = alc260_adc_nids, |
| 4603 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4604 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4605 | .channel_mode = alc260_modes, |
| 4606 | .input_mux = &alc260_capture_source, |
| 4607 | }, |
| 4608 | [ALC260_REPLACER_672V] = { |
| 4609 | .mixers = { alc260_replacer_672v_mixer, |
| 4610 | alc260_capture_mixer }, |
| 4611 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 4612 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4613 | .dac_nids = alc260_dac_nids, |
| 4614 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4615 | .adc_nids = alc260_adc_nids, |
| 4616 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4617 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4618 | .channel_mode = alc260_modes, |
| 4619 | .input_mux = &alc260_capture_source, |
| 4620 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 4621 | .init_hook = alc260_replacer_672v_automute, |
| 4622 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4623 | #ifdef CONFIG_SND_DEBUG |
| 4624 | [ALC260_TEST] = { |
| 4625 | .mixers = { alc260_test_mixer, |
| 4626 | alc260_capture_mixer }, |
| 4627 | .init_verbs = { alc260_test_init_verbs }, |
| 4628 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4629 | .dac_nids = alc260_test_dac_nids, |
| 4630 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4631 | .adc_nids = alc260_test_adc_nids, |
| 4632 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4633 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4634 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4635 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4636 | }, |
| 4637 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4638 | }; |
| 4639 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4640 | static int patch_alc260(struct hda_codec *codec) |
| 4641 | { |
| 4642 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4643 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4644 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4645 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4646 | if (spec == NULL) |
| 4647 | return -ENOMEM; |
| 4648 | |
| 4649 | codec->spec = spec; |
| 4650 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4651 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 4652 | alc260_models, |
| 4653 | alc260_cfg_tbl); |
| 4654 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4655 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4656 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4657 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4658 | } |
| 4659 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4660 | if (board_config == ALC260_AUTO) { |
| 4661 | /* automatic parse from the BIOS config */ |
| 4662 | err = alc260_parse_auto_config(codec); |
| 4663 | if (err < 0) { |
| 4664 | alc_free(codec); |
| 4665 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4666 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4667 | printk(KERN_INFO |
| 4668 | "hda_codec: Cannot set up configuration " |
| 4669 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4670 | board_config = ALC260_BASIC; |
| 4671 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4672 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4673 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4674 | if (board_config != ALC260_AUTO) |
| 4675 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4676 | |
| 4677 | spec->stream_name_analog = "ALC260 Analog"; |
| 4678 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 4679 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 4680 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4681 | spec->stream_name_digital = "ALC260 Digital"; |
| 4682 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 4683 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 4684 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4685 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4686 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4687 | spec->init_hook = alc260_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4688 | |
| 4689 | return 0; |
| 4690 | } |
| 4691 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4692 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4693 | /* |
| 4694 | * ALC882 support |
| 4695 | * |
| 4696 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 4697 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4698 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4699 | * 6-channel independent captures. |
| 4700 | * |
| 4701 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4702 | * driver yet). |
| 4703 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4704 | #define ALC882_DIGOUT_NID 0x06 |
| 4705 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4706 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4707 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4708 | { 8, NULL } |
| 4709 | }; |
| 4710 | |
| 4711 | static hda_nid_t alc882_dac_nids[4] = { |
| 4712 | /* front, rear, clfe, rear_surr */ |
| 4713 | 0x02, 0x03, 0x04, 0x05 |
| 4714 | }; |
| 4715 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4716 | /* identical with ALC880 */ |
| 4717 | #define alc882_adc_nids alc880_adc_nids |
| 4718 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4719 | |
| 4720 | /* input MUX */ |
| 4721 | /* FIXME: should be a matrix-type input source selection */ |
| 4722 | |
| 4723 | static struct hda_input_mux alc882_capture_source = { |
| 4724 | .num_items = 4, |
| 4725 | .items = { |
| 4726 | { "Mic", 0x0 }, |
| 4727 | { "Front Mic", 0x1 }, |
| 4728 | { "Line", 0x2 }, |
| 4729 | { "CD", 0x4 }, |
| 4730 | }, |
| 4731 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4732 | #define alc882_mux_enum_info alc_mux_enum_info |
| 4733 | #define alc882_mux_enum_get alc_mux_enum_get |
| 4734 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4735 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 4736 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4737 | { |
| 4738 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4739 | struct alc_spec *spec = codec->spec; |
| 4740 | const struct hda_input_mux *imux = spec->input_mux; |
| 4741 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4742 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4743 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4744 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4745 | unsigned int i, idx; |
| 4746 | |
| 4747 | idx = ucontrol->value.enumerated.item[0]; |
| 4748 | if (idx >= imux->num_items) |
| 4749 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4750 | if (*cur_val == idx && !codec->in_resume) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4751 | return 0; |
| 4752 | for (i = 0; i < imux->num_items; i++) { |
| 4753 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 4754 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4755 | v | (imux->items[i].index << 8)); |
| 4756 | } |
| 4757 | *cur_val = idx; |
| 4758 | return 1; |
| 4759 | } |
| 4760 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4761 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 4762 | * 2ch mode |
| 4763 | */ |
| 4764 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 4765 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 4766 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4767 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 4768 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4769 | { } /* end */ |
| 4770 | }; |
| 4771 | |
| 4772 | /* |
| 4773 | * 6ch mode |
| 4774 | */ |
| 4775 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 4776 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4777 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4778 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 4779 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4780 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4781 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 4782 | { } /* end */ |
| 4783 | }; |
| 4784 | |
| 4785 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 4786 | { 2, alc882_3ST_ch2_init }, |
| 4787 | { 6, alc882_3ST_ch6_init }, |
| 4788 | }; |
| 4789 | |
| 4790 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4791 | * 6ch mode |
| 4792 | */ |
| 4793 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 4794 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4795 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4796 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4797 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4798 | { } /* end */ |
| 4799 | }; |
| 4800 | |
| 4801 | /* |
| 4802 | * 8ch mode |
| 4803 | */ |
| 4804 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 4805 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4806 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4807 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4808 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4809 | { } /* end */ |
| 4810 | }; |
| 4811 | |
| 4812 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 4813 | { 6, alc882_sixstack_ch6_init }, |
| 4814 | { 8, alc882_sixstack_ch8_init }, |
| 4815 | }; |
| 4816 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4817 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 4818 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 4819 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4820 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4822 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4823 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4824 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4825 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 4826 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4827 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 4828 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4829 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4830 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4831 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4832 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4833 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4834 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4835 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4836 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4837 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4839 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4840 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4841 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4842 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4843 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4844 | { } /* end */ |
| 4845 | }; |
| 4846 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 4847 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 4848 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4849 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4850 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4851 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4852 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4853 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4854 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4855 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 4856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4857 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4858 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 4859 | { } /* end */ |
| 4860 | }; |
| 4861 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 4862 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 4863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4864 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4866 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4867 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4868 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4869 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4870 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4871 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4872 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4873 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4874 | { } /* end */ |
| 4875 | }; |
| 4876 | |
| 4877 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 4878 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 4879 | */ |
| 4880 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 4881 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4882 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 4883 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 4884 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 4885 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4886 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4887 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4888 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4889 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 4890 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 4891 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4893 | { } /* end */ |
| 4894 | }; |
| 4895 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4896 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 4897 | { |
| 4898 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4899 | .name = "Channel Mode", |
| 4900 | .info = alc_ch_mode_info, |
| 4901 | .get = alc_ch_mode_get, |
| 4902 | .put = alc_ch_mode_put, |
| 4903 | }, |
| 4904 | { } /* end */ |
| 4905 | }; |
| 4906 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4907 | static struct hda_verb alc882_init_verbs[] = { |
| 4908 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4910 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4912 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4913 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4914 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4915 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4916 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4917 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4918 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4920 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4921 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4922 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4924 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4925 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4926 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4927 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4928 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4929 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4930 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4931 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4932 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4933 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4934 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4935 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4936 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4937 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4938 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4939 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4940 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4941 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4942 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4943 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4944 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4945 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4946 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4947 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4948 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4950 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 4951 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4952 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4953 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4954 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4955 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4956 | |
| 4957 | /* FIXME: use matrix-type input source selection */ |
| 4958 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 4959 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4960 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4961 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4962 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4963 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4964 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4965 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4966 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4967 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4968 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4969 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4970 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4971 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4972 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4973 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 4974 | /* ADC1: mute amp left and right */ |
| 4975 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4976 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4977 | /* ADC2: mute amp left and right */ |
| 4978 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4979 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4980 | /* ADC3: mute amp left and right */ |
| 4981 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4982 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4983 | |
| 4984 | { } |
| 4985 | }; |
| 4986 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4987 | static struct hda_verb alc882_eapd_verbs[] = { |
| 4988 | /* change to EAPD mode */ |
| 4989 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 4990 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4991 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 4992 | }; |
| 4993 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 4994 | /* Mac Pro test */ |
| 4995 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 4996 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4997 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 4999 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5000 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5001 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5002 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5003 | { } /* end */ |
| 5004 | }; |
| 5005 | |
| 5006 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5007 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5008 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5009 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5010 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5011 | /* Front Pin: output 0 (0x0c) */ |
| 5012 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5013 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5014 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5015 | /* Front Mic pin: input vref at 80% */ |
| 5016 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5017 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5018 | /* Speaker: output */ |
| 5019 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5020 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5021 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5022 | /* Headphone output (output 0 - 0x0c) */ |
| 5023 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5024 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5025 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5026 | |
| 5027 | /* FIXME: use matrix-type input source selection */ |
| 5028 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5029 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5030 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5031 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5032 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5033 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5034 | /* Input mixer2 */ |
| 5035 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5036 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5037 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5038 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5039 | /* Input mixer3 */ |
| 5040 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5041 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5042 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5043 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5044 | /* ADC1: mute amp left and right */ |
| 5045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5046 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5047 | /* ADC2: mute amp left and right */ |
| 5048 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5049 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5050 | /* ADC3: mute amp left and right */ |
| 5051 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5052 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5053 | |
| 5054 | { } |
| 5055 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5056 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 5057 | static struct hda_verb alc882_targa_verbs[] = { |
| 5058 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5059 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5060 | |
| 5061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5062 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5063 | |
| 5064 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5065 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5066 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5067 | |
| 5068 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5069 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5070 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5071 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5072 | { } /* end */ |
| 5073 | }; |
| 5074 | |
| 5075 | /* toggle speaker-output according to the hp-jack state */ |
| 5076 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5077 | { |
| 5078 | unsigned int present; |
| 5079 | |
| 5080 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5081 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5082 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 5083 | 0x80, present ? 0x80 : 0); |
| 5084 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 5085 | 0x80, present ? 0x80 : 0); |
| 5086 | snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3); |
| 5087 | } |
| 5088 | |
| 5089 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5090 | { |
| 5091 | /* Looks like the unsol event is incompatible with the standard |
| 5092 | * definition. 4bit tag is placed at 26 bit! |
| 5093 | */ |
| 5094 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5095 | alc882_targa_automute(codec); |
| 5096 | } |
| 5097 | } |
| 5098 | |
| 5099 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5100 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5102 | |
| 5103 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5105 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5106 | |
| 5107 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5108 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5109 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5110 | |
| 5111 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5112 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5113 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5114 | { } /* end */ |
| 5115 | }; |
| 5116 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5117 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5118 | { |
| 5119 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5120 | |
| 5121 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5122 | AC_VERB_GET_GPIO_DATA, 0); |
| 5123 | |
| 5124 | if (!muted) |
| 5125 | gpiostate |= (1 << pin); |
| 5126 | else |
| 5127 | gpiostate &= ~(1 << pin); |
| 5128 | |
| 5129 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5130 | AC_VERB_GET_GPIO_MASK, 0); |
| 5131 | gpiomask |= (1 << pin); |
| 5132 | |
| 5133 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5134 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5135 | gpiodir |= (1 << pin); |
| 5136 | |
| 5137 | |
| 5138 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5139 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5140 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5141 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5142 | |
| 5143 | msleep(1); |
| 5144 | |
| 5145 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5146 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5147 | } |
| 5148 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5149 | /* |
| 5150 | * generic initialization of ADC, input mixers and output mixers |
| 5151 | */ |
| 5152 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5153 | /* |
| 5154 | * Unmute ADC0-2 and set the default input to mic-in |
| 5155 | */ |
| 5156 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5158 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5159 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5160 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5161 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5162 | |
| 5163 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5164 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5165 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5166 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5167 | */ |
| 5168 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 5169 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5170 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5171 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5172 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5174 | |
| 5175 | /* |
| 5176 | * Set up output mixers (0x0c - 0x0f) |
| 5177 | */ |
| 5178 | /* set vol=0 to output mixers */ |
| 5179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5180 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5181 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5182 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5183 | /* set up input amps for analog loopback */ |
| 5184 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5185 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5186 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5187 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5188 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5189 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5190 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5191 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5192 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5193 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5194 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5195 | |
| 5196 | /* FIXME: use matrix-type input source selection */ |
| 5197 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5198 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5199 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5200 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5201 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5202 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5203 | /* Input mixer2 */ |
| 5204 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5205 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5206 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5207 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5208 | /* Input mixer3 */ |
| 5209 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5210 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5211 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5212 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5213 | |
| 5214 | { } |
| 5215 | }; |
| 5216 | |
| 5217 | /* capture mixer elements */ |
| 5218 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5219 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5220 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5221 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5222 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5223 | { |
| 5224 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5225 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5226 | * So call somewhat different.. |
| 5227 | * FIXME: the controls appear in the "playback" view! |
| 5228 | */ |
| 5229 | /* .name = "Capture Source", */ |
| 5230 | .name = "Input Source", |
| 5231 | .count = 2, |
| 5232 | .info = alc882_mux_enum_info, |
| 5233 | .get = alc882_mux_enum_get, |
| 5234 | .put = alc882_mux_enum_put, |
| 5235 | }, |
| 5236 | { } /* end */ |
| 5237 | }; |
| 5238 | |
| 5239 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5240 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5241 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5242 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5243 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5244 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5245 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5246 | { |
| 5247 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5248 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5249 | * So call somewhat different.. |
| 5250 | * FIXME: the controls appear in the "playback" view! |
| 5251 | */ |
| 5252 | /* .name = "Capture Source", */ |
| 5253 | .name = "Input Source", |
| 5254 | .count = 3, |
| 5255 | .info = alc882_mux_enum_info, |
| 5256 | .get = alc882_mux_enum_get, |
| 5257 | .put = alc882_mux_enum_put, |
| 5258 | }, |
| 5259 | { } /* end */ |
| 5260 | }; |
| 5261 | |
| 5262 | /* pcm configuration: identiacal with ALC880 */ |
| 5263 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5264 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5265 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5266 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5267 | |
| 5268 | /* |
| 5269 | * configuration and preset |
| 5270 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5271 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5272 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5273 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5274 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5275 | [ALC882_W2JC] = "w2jc", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5276 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5277 | [ALC882_AUTO] = "auto", |
| 5278 | }; |
| 5279 | |
| 5280 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 5281 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 5282 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
| 5283 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 5284 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5285 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 5286 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 5287 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5288 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5289 | {} |
| 5290 | }; |
| 5291 | |
| 5292 | static struct alc_config_preset alc882_presets[] = { |
| 5293 | [ALC882_3ST_DIG] = { |
| 5294 | .mixers = { alc882_base_mixer }, |
| 5295 | .init_verbs = { alc882_init_verbs }, |
| 5296 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5297 | .dac_nids = alc882_dac_nids, |
| 5298 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5299 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5300 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5301 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5302 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5303 | .input_mux = &alc882_capture_source, |
| 5304 | }, |
| 5305 | [ALC882_6ST_DIG] = { |
| 5306 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5307 | .init_verbs = { alc882_init_verbs }, |
| 5308 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5309 | .dac_nids = alc882_dac_nids, |
| 5310 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5311 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5312 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5313 | .channel_mode = alc882_sixstack_modes, |
| 5314 | .input_mux = &alc882_capture_source, |
| 5315 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5316 | [ALC882_ARIMA] = { |
| 5317 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5318 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 5319 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5320 | .dac_nids = alc882_dac_nids, |
| 5321 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5322 | .channel_mode = alc882_sixstack_modes, |
| 5323 | .input_mux = &alc882_capture_source, |
| 5324 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5325 | [ALC882_W2JC] = { |
| 5326 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 5327 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5328 | alc880_gpio1_init_verbs }, |
| 5329 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5330 | .dac_nids = alc882_dac_nids, |
| 5331 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5332 | .channel_mode = alc880_threestack_modes, |
| 5333 | .need_dac_fix = 1, |
| 5334 | .input_mux = &alc882_capture_source, |
| 5335 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5336 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5337 | [ALC885_MACPRO] = { |
| 5338 | .mixers = { alc882_macpro_mixer }, |
| 5339 | .init_verbs = { alc882_macpro_init_verbs }, |
| 5340 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5341 | .dac_nids = alc882_dac_nids, |
| 5342 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5343 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5344 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5345 | .channel_mode = alc882_ch_modes, |
| 5346 | .input_mux = &alc882_capture_source, |
| 5347 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 5348 | [ALC882_TARGA] = { |
| 5349 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 5350 | alc882_capture_mixer }, |
| 5351 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 5352 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5353 | .dac_nids = alc882_dac_nids, |
| 5354 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5355 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5356 | .adc_nids = alc882_adc_nids, |
| 5357 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5358 | .channel_mode = alc882_3ST_6ch_modes, |
| 5359 | .need_dac_fix = 1, |
| 5360 | .input_mux = &alc882_capture_source, |
| 5361 | .unsol_event = alc882_targa_unsol_event, |
| 5362 | .init_hook = alc882_targa_automute, |
| 5363 | }, |
| 5364 | [ALC882_ASUS_A7J] = { |
| 5365 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 5366 | alc882_capture_mixer }, |
| 5367 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 5368 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5369 | .dac_nids = alc882_dac_nids, |
| 5370 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5371 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5372 | .adc_nids = alc882_adc_nids, |
| 5373 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5374 | .channel_mode = alc882_3ST_6ch_modes, |
| 5375 | .need_dac_fix = 1, |
| 5376 | .input_mux = &alc882_capture_source, |
| 5377 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5378 | }; |
| 5379 | |
| 5380 | |
| 5381 | /* |
| 5382 | * BIOS auto configuration |
| 5383 | */ |
| 5384 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5385 | hda_nid_t nid, int pin_type, |
| 5386 | int dac_idx) |
| 5387 | { |
| 5388 | /* set as output */ |
| 5389 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5390 | int idx; |
| 5391 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5392 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 5393 | idx = 4; |
| 5394 | else |
| 5395 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 5396 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5397 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5398 | pin_type); |
| 5399 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5400 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5401 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 5402 | |
| 5403 | } |
| 5404 | |
| 5405 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 5406 | { |
| 5407 | struct alc_spec *spec = codec->spec; |
| 5408 | int i; |
| 5409 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5410 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5411 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5412 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5413 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5414 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5415 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5416 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5417 | } |
| 5418 | } |
| 5419 | |
| 5420 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 5421 | { |
| 5422 | struct alc_spec *spec = codec->spec; |
| 5423 | hda_nid_t pin; |
| 5424 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5425 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5426 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5427 | /* use dac 0 */ |
| 5428 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5429 | } |
| 5430 | |
| 5431 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 5432 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 5433 | |
| 5434 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 5435 | { |
| 5436 | struct alc_spec *spec = codec->spec; |
| 5437 | int i; |
| 5438 | |
| 5439 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5440 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5441 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5442 | snd_hda_codec_write(codec, nid, 0, |
| 5443 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5444 | i <= AUTO_PIN_FRONT_MIC ? |
| 5445 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5446 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5447 | snd_hda_codec_write(codec, nid, 0, |
| 5448 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5449 | AMP_OUT_MUTE); |
| 5450 | } |
| 5451 | } |
| 5452 | } |
| 5453 | |
| 5454 | /* almost identical with ALC880 parser... */ |
| 5455 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 5456 | { |
| 5457 | struct alc_spec *spec = codec->spec; |
| 5458 | int err = alc880_parse_auto_config(codec); |
| 5459 | |
| 5460 | if (err < 0) |
| 5461 | return err; |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 5462 | else if (err > 0) |
| 5463 | /* hack - override the init verbs */ |
| 5464 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 5465 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5466 | } |
| 5467 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5468 | /* additional initialization for auto-configuration model */ |
| 5469 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5470 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5471 | alc882_auto_init_multi_out(codec); |
| 5472 | alc882_auto_init_hp_out(codec); |
| 5473 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5474 | } |
| 5475 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5476 | static int patch_alc882(struct hda_codec *codec) |
| 5477 | { |
| 5478 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5479 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5480 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5481 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5482 | if (spec == NULL) |
| 5483 | return -ENOMEM; |
| 5484 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5485 | codec->spec = spec; |
| 5486 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5487 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 5488 | alc882_models, |
| 5489 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5490 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5491 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5492 | /* Pick up systems that don't supply PCI SSID */ |
| 5493 | switch (codec->subsystem_id) { |
| 5494 | case 0x106b0c00: /* Mac Pro */ |
| 5495 | board_config = ALC885_MACPRO; |
| 5496 | break; |
| 5497 | default: |
| 5498 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 5499 | "trying auto-probe from BIOS...\n"); |
| 5500 | board_config = ALC882_AUTO; |
| 5501 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5502 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5503 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5504 | if (board_config == ALC882_AUTO) { |
| 5505 | /* automatic parse from the BIOS config */ |
| 5506 | err = alc882_parse_auto_config(codec); |
| 5507 | if (err < 0) { |
| 5508 | alc_free(codec); |
| 5509 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5510 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5511 | printk(KERN_INFO |
| 5512 | "hda_codec: Cannot set up configuration " |
| 5513 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5514 | board_config = ALC882_3ST_DIG; |
| 5515 | } |
| 5516 | } |
| 5517 | |
| 5518 | if (board_config != ALC882_AUTO) |
| 5519 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5520 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5521 | if (board_config == ALC885_MACPRO) { |
| 5522 | alc882_gpio_mute(codec, 0, 0); |
| 5523 | alc882_gpio_mute(codec, 1, 0); |
| 5524 | } |
| 5525 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5526 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5527 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 5528 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5529 | |
| 5530 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5531 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 5532 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5533 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5534 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5535 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5536 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5537 | /* get type */ |
| 5538 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5539 | if (wcap != AC_WID_AUD_IN) { |
| 5540 | spec->adc_nids = alc882_adc_nids_alt; |
| 5541 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5542 | spec->mixers[spec->num_mixers] = |
| 5543 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5544 | spec->num_mixers++; |
| 5545 | } else { |
| 5546 | spec->adc_nids = alc882_adc_nids; |
| 5547 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 5548 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 5549 | spec->num_mixers++; |
| 5550 | } |
| 5551 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5552 | |
| 5553 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5554 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5555 | spec->init_hook = alc882_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5556 | |
| 5557 | return 0; |
| 5558 | } |
| 5559 | |
| 5560 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5561 | * ALC883 support |
| 5562 | * |
| 5563 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 5564 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5565 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5566 | * 6-channel independent captures. |
| 5567 | * |
| 5568 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5569 | * driver yet). |
| 5570 | */ |
| 5571 | #define ALC883_DIGOUT_NID 0x06 |
| 5572 | #define ALC883_DIGIN_NID 0x0a |
| 5573 | |
| 5574 | static hda_nid_t alc883_dac_nids[4] = { |
| 5575 | /* front, rear, clfe, rear_surr */ |
| 5576 | 0x02, 0x04, 0x03, 0x05 |
| 5577 | }; |
| 5578 | |
| 5579 | static hda_nid_t alc883_adc_nids[2] = { |
| 5580 | /* ADC1-2 */ |
| 5581 | 0x08, 0x09, |
| 5582 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5583 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5584 | /* input MUX */ |
| 5585 | /* FIXME: should be a matrix-type input source selection */ |
| 5586 | |
| 5587 | static struct hda_input_mux alc883_capture_source = { |
| 5588 | .num_items = 4, |
| 5589 | .items = { |
| 5590 | { "Mic", 0x0 }, |
| 5591 | { "Front Mic", 0x1 }, |
| 5592 | { "Line", 0x2 }, |
| 5593 | { "CD", 0x4 }, |
| 5594 | }, |
| 5595 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5596 | |
| 5597 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 5598 | .num_items = 2, |
| 5599 | .items = { |
| 5600 | { "Mic", 0x1 }, |
| 5601 | { "Line", 0x2 }, |
| 5602 | }, |
| 5603 | }; |
| 5604 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 5605 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 5606 | .num_items = 4, |
| 5607 | .items = { |
| 5608 | { "Mic", 0x0 }, |
| 5609 | { "iMic", 0x1 }, |
| 5610 | { "Line", 0x2 }, |
| 5611 | { "CD", 0x4 }, |
| 5612 | }, |
| 5613 | }; |
| 5614 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5615 | #define alc883_mux_enum_info alc_mux_enum_info |
| 5616 | #define alc883_mux_enum_get alc_mux_enum_get |
| 5617 | |
| 5618 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5619 | struct snd_ctl_elem_value *ucontrol) |
| 5620 | { |
| 5621 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5622 | struct alc_spec *spec = codec->spec; |
| 5623 | const struct hda_input_mux *imux = spec->input_mux; |
| 5624 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5625 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 5626 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 5627 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5628 | unsigned int i, idx; |
| 5629 | |
| 5630 | idx = ucontrol->value.enumerated.item[0]; |
| 5631 | if (idx >= imux->num_items) |
| 5632 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5633 | if (*cur_val == idx && !codec->in_resume) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5634 | return 0; |
| 5635 | for (i = 0; i < imux->num_items; i++) { |
| 5636 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 5637 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5638 | v | (imux->items[i].index << 8)); |
| 5639 | } |
| 5640 | *cur_val = idx; |
| 5641 | return 1; |
| 5642 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5643 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5644 | /* |
| 5645 | * 2ch mode |
| 5646 | */ |
| 5647 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 5648 | { 2, NULL } |
| 5649 | }; |
| 5650 | |
| 5651 | /* |
| 5652 | * 2ch mode |
| 5653 | */ |
| 5654 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 5655 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5656 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5657 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5658 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5659 | { } /* end */ |
| 5660 | }; |
| 5661 | |
| 5662 | /* |
| 5663 | * 6ch mode |
| 5664 | */ |
| 5665 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 5666 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5667 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5668 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5669 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5670 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5671 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5672 | { } /* end */ |
| 5673 | }; |
| 5674 | |
| 5675 | static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { |
| 5676 | { 2, alc883_3ST_ch2_init }, |
| 5677 | { 6, alc883_3ST_ch6_init }, |
| 5678 | }; |
| 5679 | |
| 5680 | /* |
| 5681 | * 6ch mode |
| 5682 | */ |
| 5683 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 5684 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5685 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5686 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5687 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5688 | { } /* end */ |
| 5689 | }; |
| 5690 | |
| 5691 | /* |
| 5692 | * 8ch mode |
| 5693 | */ |
| 5694 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 5695 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5696 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5697 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5698 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5699 | { } /* end */ |
| 5700 | }; |
| 5701 | |
| 5702 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 5703 | { 6, alc883_sixstack_ch6_init }, |
| 5704 | { 8, alc883_sixstack_ch8_init }, |
| 5705 | }; |
| 5706 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5707 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 5708 | /* eanable EAPD on medion laptop */ |
| 5709 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5710 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 5711 | { } |
| 5712 | }; |
| 5713 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5714 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5715 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5716 | */ |
| 5717 | |
| 5718 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 5719 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5720 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5721 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5722 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5723 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5724 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5725 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5726 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5727 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 5728 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 5729 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5730 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5731 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5732 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5733 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5734 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5735 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5736 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5737 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5738 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5739 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5740 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5741 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5742 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5743 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5744 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5745 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5746 | { |
| 5747 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5748 | /* .name = "Capture Source", */ |
| 5749 | .name = "Input Source", |
| 5750 | .count = 2, |
| 5751 | .info = alc883_mux_enum_info, |
| 5752 | .get = alc883_mux_enum_get, |
| 5753 | .put = alc883_mux_enum_put, |
| 5754 | }, |
| 5755 | { } /* end */ |
| 5756 | }; |
| 5757 | |
| 5758 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 5759 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5760 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5761 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5762 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5763 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5764 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5765 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5766 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5767 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5769 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5770 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5771 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5772 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5773 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5774 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5775 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5776 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5777 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5778 | { |
| 5779 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5780 | /* .name = "Capture Source", */ |
| 5781 | .name = "Input Source", |
| 5782 | .count = 2, |
| 5783 | .info = alc883_mux_enum_info, |
| 5784 | .get = alc883_mux_enum_get, |
| 5785 | .put = alc883_mux_enum_put, |
| 5786 | }, |
| 5787 | { } /* end */ |
| 5788 | }; |
| 5789 | |
| 5790 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 5791 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5792 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5793 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5794 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5795 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5796 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5797 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5798 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5799 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5800 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5801 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5802 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5803 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5805 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5807 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5808 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5809 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5810 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5811 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5812 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5813 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5814 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5815 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5816 | { |
| 5817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5818 | /* .name = "Capture Source", */ |
| 5819 | .name = "Input Source", |
| 5820 | .count = 2, |
| 5821 | .info = alc883_mux_enum_info, |
| 5822 | .get = alc883_mux_enum_get, |
| 5823 | .put = alc883_mux_enum_put, |
| 5824 | }, |
| 5825 | { } /* end */ |
| 5826 | }; |
| 5827 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 5828 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5829 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5830 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5831 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5832 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5833 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5834 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5835 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 5836 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 5837 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5838 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5839 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5840 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5841 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5842 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5843 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5844 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5845 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5846 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5847 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5848 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5849 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5850 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5851 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5852 | |
| 5853 | { |
| 5854 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5855 | /* .name = "Capture Source", */ |
| 5856 | .name = "Input Source", |
| 5857 | .count = 1, |
| 5858 | .info = alc883_mux_enum_info, |
| 5859 | .get = alc883_mux_enum_get, |
| 5860 | .put = alc883_mux_enum_put, |
| 5861 | }, |
| 5862 | { } /* end */ |
| 5863 | }; |
| 5864 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5865 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 5866 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5867 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5868 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5869 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5870 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5871 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5872 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5873 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5874 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5875 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5876 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5877 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5878 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5879 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5880 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5882 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5883 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5884 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5885 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5886 | { |
| 5887 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5888 | /* .name = "Capture Source", */ |
| 5889 | .name = "Input Source", |
| 5890 | .count = 2, |
| 5891 | .info = alc883_mux_enum_info, |
| 5892 | .get = alc883_mux_enum_get, |
| 5893 | .put = alc883_mux_enum_put, |
| 5894 | }, |
| 5895 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5896 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5897 | |
| 5898 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 5899 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5900 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5901 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5902 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5903 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5904 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5905 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5906 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5907 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5908 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5909 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5910 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5911 | { |
| 5912 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5913 | /* .name = "Capture Source", */ |
| 5914 | .name = "Input Source", |
| 5915 | .count = 2, |
| 5916 | .info = alc883_mux_enum_info, |
| 5917 | .get = alc883_mux_enum_get, |
| 5918 | .put = alc883_mux_enum_put, |
| 5919 | }, |
| 5920 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5921 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5922 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5923 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 5924 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5925 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5926 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5927 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5928 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5929 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5930 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5931 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5932 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5933 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5934 | { |
| 5935 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5936 | /* .name = "Capture Source", */ |
| 5937 | .name = "Input Source", |
| 5938 | .count = 1, |
| 5939 | .info = alc883_mux_enum_info, |
| 5940 | .get = alc883_mux_enum_get, |
| 5941 | .put = alc883_mux_enum_put, |
| 5942 | }, |
| 5943 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5944 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5945 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 5946 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 5947 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5948 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5949 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5950 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5951 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5952 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5953 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5954 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5955 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5956 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5957 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5958 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5959 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5960 | { |
| 5961 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5962 | /* .name = "Capture Source", */ |
| 5963 | .name = "Input Source", |
| 5964 | .count = 2, |
| 5965 | .info = alc883_mux_enum_info, |
| 5966 | .get = alc883_mux_enum_get, |
| 5967 | .put = alc883_mux_enum_put, |
| 5968 | }, |
| 5969 | { } /* end */ |
| 5970 | }; |
| 5971 | |
| 5972 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 5973 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5974 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5975 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5976 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5977 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5978 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5979 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5980 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5981 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5982 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5983 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5984 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5985 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5986 | { |
| 5987 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5988 | /* .name = "Capture Source", */ |
| 5989 | .name = "Input Source", |
| 5990 | .count = 2, |
| 5991 | .info = alc883_mux_enum_info, |
| 5992 | .get = alc883_mux_enum_get, |
| 5993 | .put = alc883_mux_enum_put, |
| 5994 | }, |
| 5995 | { } /* end */ |
| 5996 | }; |
| 5997 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5998 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 5999 | { |
| 6000 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6001 | .name = "Channel Mode", |
| 6002 | .info = alc_ch_mode_info, |
| 6003 | .get = alc_ch_mode_get, |
| 6004 | .put = alc_ch_mode_put, |
| 6005 | }, |
| 6006 | { } /* end */ |
| 6007 | }; |
| 6008 | |
| 6009 | static struct hda_verb alc883_init_verbs[] = { |
| 6010 | /* ADC1: mute amp left and right */ |
| 6011 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6012 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6013 | /* ADC2: mute amp left and right */ |
| 6014 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6015 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6016 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6018 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6020 | /* Rear mixer */ |
| 6021 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6022 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6023 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6024 | /* CLFE mixer */ |
| 6025 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6026 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6027 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6028 | /* Side mixer */ |
| 6029 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6030 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6031 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6032 | |
| 6033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6035 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6036 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6037 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6038 | |
| 6039 | /* Front Pin: output 0 (0x0c) */ |
| 6040 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6041 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6042 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6043 | /* Rear Pin: output 1 (0x0d) */ |
| 6044 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6045 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6046 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6047 | /* CLFE Pin: output 2 (0x0e) */ |
| 6048 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6049 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6050 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6051 | /* Side Pin: output 3 (0x0f) */ |
| 6052 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6053 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6054 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 6055 | /* Mic (rear) pin: input vref at 80% */ |
| 6056 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6057 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6058 | /* Front Mic pin: input vref at 80% */ |
| 6059 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6060 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6061 | /* Line In pin: input */ |
| 6062 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6063 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6064 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6065 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6066 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6067 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6068 | /* CD pin widget for input */ |
| 6069 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6070 | |
| 6071 | /* FIXME: use matrix-type input source selection */ |
| 6072 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6073 | /* Input mixer2 */ |
| 6074 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6075 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6076 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6077 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6078 | /* Input mixer3 */ |
| 6079 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6082 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6083 | { } |
| 6084 | }; |
| 6085 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6086 | static struct hda_verb alc883_tagra_verbs[] = { |
| 6087 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6088 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6089 | |
| 6090 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6091 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6092 | |
| 6093 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6094 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6095 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6096 | |
| 6097 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6098 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6099 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6100 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6101 | |
| 6102 | { } /* end */ |
| 6103 | }; |
| 6104 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6105 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 6106 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6107 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 6108 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 6109 | { } /* end */ |
| 6110 | }; |
| 6111 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 6112 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 6113 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6114 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6115 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6116 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6117 | { } /* end */ |
| 6118 | }; |
| 6119 | |
| 6120 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 6121 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6122 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6123 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6124 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 6125 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6126 | { } /* end */ |
| 6127 | }; |
| 6128 | |
| 6129 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 6130 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 6131 | { |
| 6132 | unsigned int present; |
| 6133 | |
| 6134 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6135 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6136 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 6137 | 0x80, present ? 0x80 : 0); |
| 6138 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 6139 | 0x80, present ? 0x80 : 0); |
| 6140 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6141 | 0x80, present ? 0x80 : 0); |
| 6142 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6143 | 0x80, present ? 0x80 : 0); |
| 6144 | |
| 6145 | } |
| 6146 | |
| 6147 | /* toggle RCA according to the front-jack state */ |
| 6148 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 6149 | { |
| 6150 | unsigned int present; |
| 6151 | |
| 6152 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6153 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6154 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6155 | 0x80, present ? 0x80 : 0); |
| 6156 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6157 | 0x80, present ? 0x80 : 0); |
| 6158 | |
| 6159 | } |
| 6160 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 6161 | unsigned int res) |
| 6162 | { |
| 6163 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6164 | alc888_lenovo_ms7195_front_automute(codec); |
| 6165 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6166 | alc888_lenovo_ms7195_rca_automute(codec); |
| 6167 | } |
| 6168 | |
| 6169 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 6170 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6171 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6172 | |
| 6173 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6174 | |
| 6175 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6176 | { } /* end */ |
| 6177 | }; |
| 6178 | |
| 6179 | /* toggle speaker-output according to the hp-jack state */ |
| 6180 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 6181 | { |
| 6182 | unsigned int present; |
| 6183 | |
| 6184 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6185 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6186 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6187 | 0x80, present ? 0x80 : 0); |
| 6188 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6189 | 0x80, present ? 0x80 : 0); |
| 6190 | } |
| 6191 | |
| 6192 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 6193 | unsigned int res) |
| 6194 | { |
| 6195 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6196 | alc883_medion_md2_automute(codec); |
| 6197 | } |
| 6198 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6199 | /* toggle speaker-output according to the hp-jack state */ |
| 6200 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 6201 | { |
| 6202 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6203 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6204 | |
| 6205 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6206 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6207 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6208 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6209 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6210 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6211 | 0x80, bits); |
| 6212 | snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6213 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6214 | } |
| 6215 | |
| 6216 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6217 | { |
| 6218 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6219 | alc883_tagra_automute(codec); |
| 6220 | } |
| 6221 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6222 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 6223 | { |
| 6224 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6225 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6226 | |
| 6227 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6228 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6229 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6230 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6231 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6232 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6233 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6234 | } |
| 6235 | |
| 6236 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 6237 | { |
| 6238 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6239 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6240 | |
| 6241 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6242 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6243 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6244 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6245 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6246 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6247 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6248 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6249 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6250 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6251 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6252 | } |
| 6253 | |
| 6254 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 6255 | unsigned int res) |
| 6256 | { |
| 6257 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6258 | alc883_lenovo_101e_all_automute(codec); |
| 6259 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6260 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 6261 | } |
| 6262 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6263 | /* |
| 6264 | * generic initialization of ADC, input mixers and output mixers |
| 6265 | */ |
| 6266 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 6267 | /* |
| 6268 | * Unmute ADC0-2 and set the default input to mic-in |
| 6269 | */ |
| 6270 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6271 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6272 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6273 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6274 | |
| 6275 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6276 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6277 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6278 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6279 | */ |
| 6280 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6281 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6282 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6283 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6284 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6285 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6286 | |
| 6287 | /* |
| 6288 | * Set up output mixers (0x0c - 0x0f) |
| 6289 | */ |
| 6290 | /* set vol=0 to output mixers */ |
| 6291 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6292 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6293 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6294 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6295 | /* set up input amps for analog loopback */ |
| 6296 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6297 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6298 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6299 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6300 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6301 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6302 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6303 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6304 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6305 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6306 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6307 | |
| 6308 | /* FIXME: use matrix-type input source selection */ |
| 6309 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6310 | /* Input mixer1 */ |
| 6311 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6312 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6313 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6314 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6315 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6316 | /* Input mixer2 */ |
| 6317 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6318 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6319 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6320 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6321 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6322 | |
| 6323 | { } |
| 6324 | }; |
| 6325 | |
| 6326 | /* capture mixer elements */ |
| 6327 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 6328 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6329 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6330 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6331 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6332 | { |
| 6333 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6334 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6335 | * So call somewhat different.. |
| 6336 | * FIXME: the controls appear in the "playback" view! |
| 6337 | */ |
| 6338 | /* .name = "Capture Source", */ |
| 6339 | .name = "Input Source", |
| 6340 | .count = 2, |
| 6341 | .info = alc882_mux_enum_info, |
| 6342 | .get = alc882_mux_enum_get, |
| 6343 | .put = alc882_mux_enum_put, |
| 6344 | }, |
| 6345 | { } /* end */ |
| 6346 | }; |
| 6347 | |
| 6348 | /* pcm configuration: identiacal with ALC880 */ |
| 6349 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 6350 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 6351 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 6352 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 6353 | |
| 6354 | /* |
| 6355 | * configuration and preset |
| 6356 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6357 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 6358 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 6359 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 6360 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 6361 | [ALC883_6ST_DIG] = "6stack-dig", |
| 6362 | [ALC883_TARGA_DIG] = "targa-dig", |
| 6363 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6364 | [ALC883_ACER] = "acer", |
| 6365 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 6366 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6367 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6368 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 6369 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 6370 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6371 | [ALC883_AUTO] = "auto", |
| 6372 | }; |
| 6373 | |
| 6374 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 6375 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
| 6376 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
| 6377 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
| 6378 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 6379 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6380 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 6381 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 6382 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6383 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 6384 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 6385 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 6386 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 6387 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 6388 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 6389 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 6390 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 6391 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
| 6392 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
| 6393 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), |
| 6394 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
| 6395 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 6396 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 6397 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
| 6398 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 6399 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 6400 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6401 | {} |
| 6402 | }; |
| 6403 | |
| 6404 | static struct alc_config_preset alc883_presets[] = { |
| 6405 | [ALC883_3ST_2ch_DIG] = { |
| 6406 | .mixers = { alc883_3ST_2ch_mixer }, |
| 6407 | .init_verbs = { alc883_init_verbs }, |
| 6408 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6409 | .dac_nids = alc883_dac_nids, |
| 6410 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6411 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6412 | .adc_nids = alc883_adc_nids, |
| 6413 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6414 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6415 | .channel_mode = alc883_3ST_2ch_modes, |
| 6416 | .input_mux = &alc883_capture_source, |
| 6417 | }, |
| 6418 | [ALC883_3ST_6ch_DIG] = { |
| 6419 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6420 | .init_verbs = { alc883_init_verbs }, |
| 6421 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6422 | .dac_nids = alc883_dac_nids, |
| 6423 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6424 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6425 | .adc_nids = alc883_adc_nids, |
| 6426 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6427 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6428 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6429 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6430 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6431 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6432 | [ALC883_3ST_6ch] = { |
| 6433 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6434 | .init_verbs = { alc883_init_verbs }, |
| 6435 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6436 | .dac_nids = alc883_dac_nids, |
| 6437 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6438 | .adc_nids = alc883_adc_nids, |
| 6439 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6440 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6441 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6442 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6443 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6444 | [ALC883_6ST_DIG] = { |
| 6445 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 6446 | .init_verbs = { alc883_init_verbs }, |
| 6447 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6448 | .dac_nids = alc883_dac_nids, |
| 6449 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6450 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6451 | .adc_nids = alc883_adc_nids, |
| 6452 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6453 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6454 | .channel_mode = alc883_sixstack_modes, |
| 6455 | .input_mux = &alc883_capture_source, |
| 6456 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6457 | [ALC883_TARGA_DIG] = { |
| 6458 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 6459 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6460 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6461 | .dac_nids = alc883_dac_nids, |
| 6462 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6463 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6464 | .adc_nids = alc883_adc_nids, |
| 6465 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6466 | .channel_mode = alc883_3ST_6ch_modes, |
| 6467 | .need_dac_fix = 1, |
| 6468 | .input_mux = &alc883_capture_source, |
| 6469 | .unsol_event = alc883_tagra_unsol_event, |
| 6470 | .init_hook = alc883_tagra_automute, |
| 6471 | }, |
| 6472 | [ALC883_TARGA_2ch_DIG] = { |
| 6473 | .mixers = { alc883_tagra_2ch_mixer}, |
| 6474 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6475 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6476 | .dac_nids = alc883_dac_nids, |
| 6477 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6478 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6479 | .adc_nids = alc883_adc_nids, |
| 6480 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6481 | .channel_mode = alc883_3ST_2ch_modes, |
| 6482 | .input_mux = &alc883_capture_source, |
| 6483 | .unsol_event = alc883_tagra_unsol_event, |
| 6484 | .init_hook = alc883_tagra_automute, |
| 6485 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 6486 | [ALC883_ACER] = { |
| 6487 | .mixers = { alc883_base_mixer, |
| 6488 | alc883_chmode_mixer }, |
| 6489 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 6490 | * and the headphone jack. Turn this on and rely on the |
| 6491 | * standard mute methods whenever the user wants to turn |
| 6492 | * these outputs off. |
| 6493 | */ |
| 6494 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 6495 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6496 | .dac_nids = alc883_dac_nids, |
| 6497 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6498 | .adc_nids = alc883_adc_nids, |
| 6499 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6500 | .channel_mode = alc883_3ST_2ch_modes, |
| 6501 | .input_mux = &alc883_capture_source, |
| 6502 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6503 | [ALC883_MEDION] = { |
| 6504 | .mixers = { alc883_fivestack_mixer, |
| 6505 | alc883_chmode_mixer }, |
| 6506 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6507 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6508 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6509 | .dac_nids = alc883_dac_nids, |
| 6510 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6511 | .adc_nids = alc883_adc_nids, |
| 6512 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6513 | .channel_mode = alc883_sixstack_modes, |
| 6514 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6515 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 6516 | [ALC883_MEDION_MD2] = { |
| 6517 | .mixers = { alc883_medion_md2_mixer}, |
| 6518 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 6519 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6520 | .dac_nids = alc883_dac_nids, |
| 6521 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6522 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6523 | .adc_nids = alc883_adc_nids, |
| 6524 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6525 | .channel_mode = alc883_3ST_2ch_modes, |
| 6526 | .input_mux = &alc883_capture_source, |
| 6527 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6528 | .init_hook = alc883_medion_md2_automute, |
| 6529 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6530 | [ALC883_LAPTOP_EAPD] = { |
| 6531 | .mixers = { alc883_base_mixer, |
| 6532 | alc883_chmode_mixer }, |
| 6533 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 6534 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6535 | .dac_nids = alc883_dac_nids, |
| 6536 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6537 | .adc_nids = alc883_adc_nids, |
| 6538 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6539 | .channel_mode = alc883_3ST_2ch_modes, |
| 6540 | .input_mux = &alc883_capture_source, |
| 6541 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6542 | [ALC883_LENOVO_101E_2ch] = { |
| 6543 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 6544 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 6545 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6546 | .dac_nids = alc883_dac_nids, |
| 6547 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6548 | .adc_nids = alc883_adc_nids, |
| 6549 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6550 | .channel_mode = alc883_3ST_2ch_modes, |
| 6551 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 6552 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 6553 | .init_hook = alc883_lenovo_101e_all_automute, |
| 6554 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 6555 | [ALC883_LENOVO_NB0763] = { |
| 6556 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 6557 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 6558 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6559 | .dac_nids = alc883_dac_nids, |
| 6560 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6561 | .adc_nids = alc883_adc_nids, |
| 6562 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6563 | .channel_mode = alc883_3ST_2ch_modes, |
| 6564 | .need_dac_fix = 1, |
| 6565 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 6566 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6567 | .init_hook = alc883_medion_md2_automute, |
| 6568 | }, |
| 6569 | [ALC888_LENOVO_MS7195_DIG] = { |
| 6570 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6571 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 6572 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6573 | .dac_nids = alc883_dac_nids, |
| 6574 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6575 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6576 | .adc_nids = alc883_adc_nids, |
| 6577 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6578 | .channel_mode = alc883_3ST_6ch_modes, |
| 6579 | .need_dac_fix = 1, |
| 6580 | .input_mux = &alc883_capture_source, |
| 6581 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 6582 | .init_hook = alc888_lenovo_ms7195_front_automute, |
| 6583 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6584 | }; |
| 6585 | |
| 6586 | |
| 6587 | /* |
| 6588 | * BIOS auto configuration |
| 6589 | */ |
| 6590 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6591 | hda_nid_t nid, int pin_type, |
| 6592 | int dac_idx) |
| 6593 | { |
| 6594 | /* set as output */ |
| 6595 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6596 | int idx; |
| 6597 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6598 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6599 | idx = 4; |
| 6600 | else |
| 6601 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 6602 | |
| 6603 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6604 | pin_type); |
| 6605 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 6606 | AMP_OUT_UNMUTE); |
| 6607 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6608 | |
| 6609 | } |
| 6610 | |
| 6611 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 6612 | { |
| 6613 | struct alc_spec *spec = codec->spec; |
| 6614 | int i; |
| 6615 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6616 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6617 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6618 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6619 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6620 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6621 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6622 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6623 | } |
| 6624 | } |
| 6625 | |
| 6626 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 6627 | { |
| 6628 | struct alc_spec *spec = codec->spec; |
| 6629 | hda_nid_t pin; |
| 6630 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6631 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6632 | if (pin) /* connect to front */ |
| 6633 | /* use dac 0 */ |
| 6634 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 6635 | } |
| 6636 | |
| 6637 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6638 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 6639 | |
| 6640 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 6641 | { |
| 6642 | struct alc_spec *spec = codec->spec; |
| 6643 | int i; |
| 6644 | |
| 6645 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6646 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6647 | if (alc883_is_input_pin(nid)) { |
| 6648 | snd_hda_codec_write(codec, nid, 0, |
| 6649 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6650 | (i <= AUTO_PIN_FRONT_MIC ? |
| 6651 | PIN_VREF80 : PIN_IN)); |
| 6652 | if (nid != ALC883_PIN_CD_NID) |
| 6653 | snd_hda_codec_write(codec, nid, 0, |
| 6654 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6655 | AMP_OUT_MUTE); |
| 6656 | } |
| 6657 | } |
| 6658 | } |
| 6659 | |
| 6660 | /* almost identical with ALC880 parser... */ |
| 6661 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 6662 | { |
| 6663 | struct alc_spec *spec = codec->spec; |
| 6664 | int err = alc880_parse_auto_config(codec); |
| 6665 | |
| 6666 | if (err < 0) |
| 6667 | return err; |
| 6668 | else if (err > 0) |
| 6669 | /* hack - override the init verbs */ |
| 6670 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6671 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 6672 | spec->num_mixers++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6673 | return err; |
| 6674 | } |
| 6675 | |
| 6676 | /* additional initialization for auto-configuration model */ |
| 6677 | static void alc883_auto_init(struct hda_codec *codec) |
| 6678 | { |
| 6679 | alc883_auto_init_multi_out(codec); |
| 6680 | alc883_auto_init_hp_out(codec); |
| 6681 | alc883_auto_init_analog_input(codec); |
| 6682 | } |
| 6683 | |
| 6684 | static int patch_alc883(struct hda_codec *codec) |
| 6685 | { |
| 6686 | struct alc_spec *spec; |
| 6687 | int err, board_config; |
| 6688 | |
| 6689 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6690 | if (spec == NULL) |
| 6691 | return -ENOMEM; |
| 6692 | |
| 6693 | codec->spec = spec; |
| 6694 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6695 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 6696 | alc883_models, |
| 6697 | alc883_cfg_tbl); |
| 6698 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6699 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 6700 | "trying auto-probe from BIOS...\n"); |
| 6701 | board_config = ALC883_AUTO; |
| 6702 | } |
| 6703 | |
| 6704 | if (board_config == ALC883_AUTO) { |
| 6705 | /* automatic parse from the BIOS config */ |
| 6706 | err = alc883_parse_auto_config(codec); |
| 6707 | if (err < 0) { |
| 6708 | alc_free(codec); |
| 6709 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6710 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6711 | printk(KERN_INFO |
| 6712 | "hda_codec: Cannot set up configuration " |
| 6713 | "from BIOS. Using base mode...\n"); |
| 6714 | board_config = ALC883_3ST_2ch_DIG; |
| 6715 | } |
| 6716 | } |
| 6717 | |
| 6718 | if (board_config != ALC883_AUTO) |
| 6719 | setup_preset(spec, &alc883_presets[board_config]); |
| 6720 | |
| 6721 | spec->stream_name_analog = "ALC883 Analog"; |
| 6722 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 6723 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 6724 | |
| 6725 | spec->stream_name_digital = "ALC883 Digital"; |
| 6726 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 6727 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 6728 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6729 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6730 | spec->adc_nids = alc883_adc_nids; |
| 6731 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 6732 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6733 | |
| 6734 | codec->patch_ops = alc_patch_ops; |
| 6735 | if (board_config == ALC883_AUTO) |
| 6736 | spec->init_hook = alc883_auto_init; |
| 6737 | |
| 6738 | return 0; |
| 6739 | } |
| 6740 | |
| 6741 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6742 | * ALC262 support |
| 6743 | */ |
| 6744 | |
| 6745 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 6746 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 6747 | |
| 6748 | #define alc262_dac_nids alc260_dac_nids |
| 6749 | #define alc262_adc_nids alc882_adc_nids |
| 6750 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 6751 | |
| 6752 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 6753 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6754 | |
| 6755 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 6756 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6757 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6758 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6759 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6760 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6761 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6762 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6763 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6764 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6765 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6766 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6767 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6768 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6769 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 6770 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 6771 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6772 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6773 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6774 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6775 | }; |
| 6776 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6777 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 6778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6779 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6780 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6781 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6782 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6783 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6784 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6785 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6786 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6787 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6788 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6789 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6790 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6791 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 6792 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 6793 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6794 | { } /* end */ |
| 6795 | }; |
| 6796 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6797 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 6798 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6799 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6800 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6801 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6802 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6803 | |
| 6804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6806 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6807 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6808 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6809 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6810 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6811 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6812 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6813 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6814 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6815 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6816 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 6817 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 6818 | { } /* end */ |
| 6819 | }; |
| 6820 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 6821 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
| 6822 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6823 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6824 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6825 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6826 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6827 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6828 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6829 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6830 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 6831 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6832 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6833 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6834 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6835 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6836 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6837 | { } /* end */ |
| 6838 | }; |
| 6839 | |
| 6840 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 6841 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6842 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6843 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 6844 | { } /* end */ |
| 6845 | }; |
| 6846 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 6847 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
| 6848 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6849 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6852 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6853 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6854 | { } /* end */ |
| 6855 | }; |
| 6856 | |
| 6857 | |
| 6858 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6859 | #define alc262_capture_mixer alc882_capture_mixer |
| 6860 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 6861 | |
| 6862 | /* |
| 6863 | * generic initialization of ADC, input mixers and output mixers |
| 6864 | */ |
| 6865 | static struct hda_verb alc262_init_verbs[] = { |
| 6866 | /* |
| 6867 | * Unmute ADC0-2 and set the default input to mic-in |
| 6868 | */ |
| 6869 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6870 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6871 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6872 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6873 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6874 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6875 | |
| 6876 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6877 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6878 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6879 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6880 | */ |
| 6881 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6884 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6885 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6886 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6887 | |
| 6888 | /* |
| 6889 | * Set up output mixers (0x0c - 0x0e) |
| 6890 | */ |
| 6891 | /* set vol=0 to output mixers */ |
| 6892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6893 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6894 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6895 | /* set up input amps for analog loopback */ |
| 6896 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6897 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6898 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6899 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6900 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6901 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6902 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6903 | |
| 6904 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6905 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6906 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6907 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6908 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6909 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6910 | |
| 6911 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6912 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6913 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6914 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6915 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6916 | |
| 6917 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6918 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6919 | |
| 6920 | /* FIXME: use matrix-type input source selection */ |
| 6921 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6922 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6923 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6924 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6925 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6926 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6927 | /* Input mixer2 */ |
| 6928 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6929 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6930 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6931 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6932 | /* Input mixer3 */ |
| 6933 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6934 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6935 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6936 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6937 | |
| 6938 | { } |
| 6939 | }; |
| 6940 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6941 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 6942 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6943 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6944 | {} |
| 6945 | }; |
| 6946 | |
| 6947 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 6948 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6949 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6950 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6951 | |
| 6952 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6953 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6954 | {} |
| 6955 | }; |
| 6956 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 6957 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 6958 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6959 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6960 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 6961 | |
| 6962 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6963 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6964 | }; |
| 6965 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6966 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 6967 | static void alc262_hippo_automute(struct hda_codec *codec, int force) |
| 6968 | { |
| 6969 | struct alc_spec *spec = codec->spec; |
| 6970 | unsigned int mute; |
| 6971 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6972 | if (force || !spec->sense_updated) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6973 | unsigned int present; |
| 6974 | /* need to execute and sync at first */ |
| 6975 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 6976 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6977 | AC_VERB_GET_PIN_SENSE, 0); |
| 6978 | spec->jack_present = (present & 0x80000000) != 0; |
| 6979 | spec->sense_updated = 1; |
| 6980 | } |
| 6981 | if (spec->jack_present) { |
| 6982 | /* mute internal speaker */ |
| 6983 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 6984 | 0x80, 0x80); |
| 6985 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 6986 | 0x80, 0x80); |
| 6987 | } else { |
| 6988 | /* unmute internal speaker if necessary */ |
| 6989 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 6990 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 6991 | 0x80, mute & 0x80); |
| 6992 | mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0); |
| 6993 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 6994 | 0x80, mute & 0x80); |
| 6995 | } |
| 6996 | } |
| 6997 | |
| 6998 | /* unsolicited event for HP jack sensing */ |
| 6999 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 7000 | unsigned int res) |
| 7001 | { |
| 7002 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7003 | return; |
| 7004 | alc262_hippo_automute(codec, 1); |
| 7005 | } |
| 7006 | |
| 7007 | static void alc262_hippo1_automute(struct hda_codec *codec, int force) |
| 7008 | { |
| 7009 | struct alc_spec *spec = codec->spec; |
| 7010 | unsigned int mute; |
| 7011 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7012 | if (force || !spec->sense_updated) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7013 | unsigned int present; |
| 7014 | /* need to execute and sync at first */ |
| 7015 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7016 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7017 | AC_VERB_GET_PIN_SENSE, 0); |
| 7018 | spec->jack_present = (present & 0x80000000) != 0; |
| 7019 | spec->sense_updated = 1; |
| 7020 | } |
| 7021 | if (spec->jack_present) { |
| 7022 | /* mute internal speaker */ |
| 7023 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7024 | 0x80, 0x80); |
| 7025 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7026 | 0x80, 0x80); |
| 7027 | } else { |
| 7028 | /* unmute internal speaker if necessary */ |
| 7029 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 7030 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7031 | 0x80, mute & 0x80); |
| 7032 | mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0); |
| 7033 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7034 | 0x80, mute & 0x80); |
| 7035 | } |
| 7036 | } |
| 7037 | |
| 7038 | /* unsolicited event for HP jack sensing */ |
| 7039 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 7040 | unsigned int res) |
| 7041 | { |
| 7042 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7043 | return; |
| 7044 | alc262_hippo1_automute(codec, 1); |
| 7045 | } |
| 7046 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7047 | /* |
| 7048 | * fujitsu model |
| 7049 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 7050 | */ |
| 7051 | |
| 7052 | #define ALC_HP_EVENT 0x37 |
| 7053 | |
| 7054 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 7055 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 7056 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7057 | {} |
| 7058 | }; |
| 7059 | |
| 7060 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
| 7061 | .num_items = 2, |
| 7062 | .items = { |
| 7063 | { "Mic", 0x0 }, |
| 7064 | { "CD", 0x4 }, |
| 7065 | }, |
| 7066 | }; |
| 7067 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7068 | static struct hda_input_mux alc262_HP_capture_source = { |
| 7069 | .num_items = 5, |
| 7070 | .items = { |
| 7071 | { "Mic", 0x0 }, |
| 7072 | { "Front Mic", 0x3 }, |
| 7073 | { "Line", 0x2 }, |
| 7074 | { "CD", 0x4 }, |
| 7075 | { "AUX IN", 0x6 }, |
| 7076 | }, |
| 7077 | }; |
| 7078 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7079 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 7080 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 7081 | { |
| 7082 | struct alc_spec *spec = codec->spec; |
| 7083 | unsigned int mute; |
| 7084 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7085 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7086 | unsigned int present; |
| 7087 | /* need to execute and sync at first */ |
| 7088 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7089 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7090 | AC_VERB_GET_PIN_SENSE, 0); |
| 7091 | spec->jack_present = (present & 0x80000000) != 0; |
| 7092 | spec->sense_updated = 1; |
| 7093 | } |
| 7094 | if (spec->jack_present) { |
| 7095 | /* mute internal speaker */ |
| 7096 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 7097 | 0x80, 0x80); |
| 7098 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 7099 | 0x80, 0x80); |
| 7100 | } else { |
| 7101 | /* unmute internal speaker if necessary */ |
| 7102 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 7103 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 7104 | 0x80, mute & 0x80); |
| 7105 | mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0); |
| 7106 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 7107 | 0x80, mute & 0x80); |
| 7108 | } |
| 7109 | } |
| 7110 | |
| 7111 | /* unsolicited event for HP jack sensing */ |
| 7112 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 7113 | unsigned int res) |
| 7114 | { |
| 7115 | if ((res >> 26) != ALC_HP_EVENT) |
| 7116 | return; |
| 7117 | alc262_fujitsu_automute(codec, 1); |
| 7118 | } |
| 7119 | |
| 7120 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 7121 | static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol, |
| 7122 | struct snd_ctl_elem_value *ucontrol) |
| 7123 | { |
| 7124 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7125 | long *valp = ucontrol->value.integer.value; |
| 7126 | int change; |
| 7127 | |
| 7128 | change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 7129 | 0x7f, valp[0] & 0x7f); |
| 7130 | change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 7131 | 0x7f, valp[1] & 0x7f); |
| 7132 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 7133 | 0x7f, valp[0] & 0x7f); |
| 7134 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 7135 | 0x7f, valp[1] & 0x7f); |
| 7136 | return change; |
| 7137 | } |
| 7138 | |
| 7139 | /* bind hp and internal speaker mute (with plug check) */ |
| 7140 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 7141 | struct snd_ctl_elem_value *ucontrol) |
| 7142 | { |
| 7143 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7144 | long *valp = ucontrol->value.integer.value; |
| 7145 | int change; |
| 7146 | |
| 7147 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7148 | 0x80, valp[0] ? 0 : 0x80); |
| 7149 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7150 | 0x80, valp[1] ? 0 : 0x80); |
| 7151 | if (change || codec->in_resume) |
| 7152 | alc262_fujitsu_automute(codec, codec->in_resume); |
| 7153 | return change; |
| 7154 | } |
| 7155 | |
| 7156 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
| 7157 | { |
| 7158 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7159 | .name = "Master Playback Volume", |
| 7160 | .info = snd_hda_mixer_amp_volume_info, |
| 7161 | .get = snd_hda_mixer_amp_volume_get, |
| 7162 | .put = alc262_fujitsu_master_vol_put, |
Takashi Iwai | c256652 | 2006-08-17 18:21:36 +0200 | [diff] [blame] | 7163 | .tlv = { .c = snd_hda_mixer_amp_tlv }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7164 | .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 7165 | }, |
| 7166 | { |
| 7167 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7168 | .name = "Master Playback Switch", |
| 7169 | .info = snd_hda_mixer_amp_switch_info, |
| 7170 | .get = snd_hda_mixer_amp_switch_get, |
| 7171 | .put = alc262_fujitsu_master_sw_put, |
| 7172 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7173 | }, |
| 7174 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7175 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7176 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7179 | { } /* end */ |
| 7180 | }; |
| 7181 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 7182 | /* additional init verbs for Benq laptops */ |
| 7183 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 7184 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7185 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7186 | {} |
| 7187 | }; |
| 7188 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7189 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7190 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7191 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7192 | { |
| 7193 | hda_nid_t nid; |
| 7194 | int err; |
| 7195 | |
| 7196 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 7197 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 7198 | spec->multiout.dac_nids[0] = 2; |
| 7199 | |
| 7200 | nid = cfg->line_out_pins[0]; |
| 7201 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7202 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7203 | "Front Playback Volume", |
| 7204 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 7205 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7206 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7207 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7208 | "Front Playback Switch", |
| 7209 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 7210 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7211 | return err; |
| 7212 | } |
| 7213 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7214 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7215 | if (nid) { |
| 7216 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7217 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7218 | "Speaker Playback Volume", |
| 7219 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7220 | HDA_OUTPUT)); |
| 7221 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7222 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7223 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7224 | "Speaker Playback Switch", |
| 7225 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7226 | HDA_OUTPUT)); |
| 7227 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7228 | return err; |
| 7229 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7230 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7231 | "Speaker Playback Switch", |
| 7232 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7233 | HDA_OUTPUT)); |
| 7234 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7235 | return err; |
| 7236 | } |
| 7237 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7238 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7239 | if (nid) { |
| 7240 | /* spec->multiout.hp_nid = 2; */ |
| 7241 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7242 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7243 | "Headphone Playback Volume", |
| 7244 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7245 | HDA_OUTPUT)); |
| 7246 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7247 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7248 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7249 | "Headphone Playback Switch", |
| 7250 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7251 | HDA_OUTPUT)); |
| 7252 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7253 | return err; |
| 7254 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7255 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7256 | "Headphone Playback Switch", |
| 7257 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7258 | HDA_OUTPUT)); |
| 7259 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7260 | return err; |
| 7261 | } |
| 7262 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7263 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7264 | } |
| 7265 | |
| 7266 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7267 | #define alc262_auto_create_analog_input_ctls \ |
| 7268 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7269 | |
| 7270 | /* |
| 7271 | * generic initialization of ADC, input mixers and output mixers |
| 7272 | */ |
| 7273 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 7274 | /* |
| 7275 | * Unmute ADC0-2 and set the default input to mic-in |
| 7276 | */ |
| 7277 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7279 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7280 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7281 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7282 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7283 | |
| 7284 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7285 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7286 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7287 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7288 | */ |
| 7289 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7295 | |
| 7296 | /* |
| 7297 | * Set up output mixers (0x0c - 0x0f) |
| 7298 | */ |
| 7299 | /* set vol=0 to output mixers */ |
| 7300 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7301 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7302 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7303 | |
| 7304 | /* set up input amps for analog loopback */ |
| 7305 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7308 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7312 | |
| 7313 | /* FIXME: use matrix-type input source selection */ |
| 7314 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7315 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7316 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7317 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7320 | /* Input mixer2 */ |
| 7321 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7322 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7323 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7324 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7325 | /* Input mixer3 */ |
| 7326 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7327 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7328 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7329 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7330 | |
| 7331 | { } |
| 7332 | }; |
| 7333 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7334 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 7335 | /* |
| 7336 | * Unmute ADC0-2 and set the default input to mic-in |
| 7337 | */ |
| 7338 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7339 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7340 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7341 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7342 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7343 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7344 | |
| 7345 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7346 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7347 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7348 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7349 | */ |
| 7350 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7351 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7352 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7353 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7354 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7355 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7356 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 7357 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 7358 | |
| 7359 | /* |
| 7360 | * Set up output mixers (0x0c - 0x0e) |
| 7361 | */ |
| 7362 | /* set vol=0 to output mixers */ |
| 7363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7364 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7365 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7366 | |
| 7367 | /* set up input amps for analog loopback */ |
| 7368 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7369 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7371 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7372 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7373 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7375 | |
| 7376 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7377 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7378 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7379 | |
| 7380 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7381 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7382 | |
| 7383 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7384 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7385 | |
| 7386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7387 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7388 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7389 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7390 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7391 | |
| 7392 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7393 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7394 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7395 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7396 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7397 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7398 | |
| 7399 | |
| 7400 | /* FIXME: use matrix-type input source selection */ |
| 7401 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7402 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7403 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7404 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7405 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7406 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7407 | /* Input mixer2 */ |
| 7408 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7409 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7410 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7411 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7412 | /* Input mixer3 */ |
| 7413 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7414 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7415 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7417 | |
| 7418 | { } |
| 7419 | }; |
| 7420 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7421 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 7422 | /* |
| 7423 | * Unmute ADC0-2 and set the default input to mic-in |
| 7424 | */ |
| 7425 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7426 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7427 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7428 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7429 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7430 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7431 | |
| 7432 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7433 | * mixer widget |
| 7434 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 7435 | * panel mic (mic 2) |
| 7436 | */ |
| 7437 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7438 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7439 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7440 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7441 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7442 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7443 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 7444 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 7445 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 7446 | /* |
| 7447 | * Set up output mixers (0x0c - 0x0e) |
| 7448 | */ |
| 7449 | /* set vol=0 to output mixers */ |
| 7450 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7451 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7452 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7453 | |
| 7454 | /* set up input amps for analog loopback */ |
| 7455 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7456 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7458 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7459 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7460 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7462 | |
| 7463 | |
| 7464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 7465 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 7466 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 7467 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 7468 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 7469 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 7470 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 7471 | |
| 7472 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7473 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7474 | |
| 7475 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7476 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7477 | |
| 7478 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 7479 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7480 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7481 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7482 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7483 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7484 | |
| 7485 | /* FIXME: use matrix-type input source selection */ |
| 7486 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7487 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7488 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 7489 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 7490 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 7491 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 7492 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 7493 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7494 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 7495 | /* Input mixer2 */ |
| 7496 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7497 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7498 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7499 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7500 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7501 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7502 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7503 | /* Input mixer3 */ |
| 7504 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7505 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7506 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7507 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7508 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7509 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7510 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7511 | |
| 7512 | { } |
| 7513 | }; |
| 7514 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7515 | /* pcm configuration: identiacal with ALC880 */ |
| 7516 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 7517 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 7518 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 7519 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 7520 | |
| 7521 | /* |
| 7522 | * BIOS auto configuration |
| 7523 | */ |
| 7524 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 7525 | { |
| 7526 | struct alc_spec *spec = codec->spec; |
| 7527 | int err; |
| 7528 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 7529 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7530 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7531 | alc262_ignore); |
| 7532 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7533 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7534 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7535 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7536 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7537 | if (err < 0) |
| 7538 | return err; |
| 7539 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 7540 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7541 | return err; |
| 7542 | |
| 7543 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 7544 | |
| 7545 | if (spec->autocfg.dig_out_pin) |
| 7546 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 7547 | if (spec->autocfg.dig_in_pin) |
| 7548 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 7549 | |
| 7550 | if (spec->kctl_alloc) |
| 7551 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 7552 | |
| 7553 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7554 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7555 | spec->input_mux = &spec->private_imux; |
| 7556 | |
| 7557 | return 1; |
| 7558 | } |
| 7559 | |
| 7560 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 7561 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 7562 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 7563 | |
| 7564 | |
| 7565 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7566 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7567 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7568 | alc262_auto_init_multi_out(codec); |
| 7569 | alc262_auto_init_hp_out(codec); |
| 7570 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7571 | } |
| 7572 | |
| 7573 | /* |
| 7574 | * configuration and preset |
| 7575 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7576 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 7577 | [ALC262_BASIC] = "basic", |
| 7578 | [ALC262_HIPPO] = "hippo", |
| 7579 | [ALC262_HIPPO_1] = "hippo_1", |
| 7580 | [ALC262_FUJITSU] = "fujitsu", |
| 7581 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7582 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7583 | [ALC262_BENQ_ED8] = "benq", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 7584 | [ALC262_BENQ_ED8] = "sony-assamd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7585 | [ALC262_AUTO] = "auto", |
| 7586 | }; |
| 7587 | |
| 7588 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 7589 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 7590 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
| 7591 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7592 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 7593 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7594 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7595 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7596 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7597 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7598 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7599 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7600 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7601 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7602 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
| 7603 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
| 7604 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
| 7605 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 7606 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
| 7607 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 7608 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7609 | {} |
| 7610 | }; |
| 7611 | |
| 7612 | static struct alc_config_preset alc262_presets[] = { |
| 7613 | [ALC262_BASIC] = { |
| 7614 | .mixers = { alc262_base_mixer }, |
| 7615 | .init_verbs = { alc262_init_verbs }, |
| 7616 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7617 | .dac_nids = alc262_dac_nids, |
| 7618 | .hp_nid = 0x03, |
| 7619 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7620 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7621 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7622 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7623 | [ALC262_HIPPO] = { |
| 7624 | .mixers = { alc262_base_mixer }, |
| 7625 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 7626 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7627 | .dac_nids = alc262_dac_nids, |
| 7628 | .hp_nid = 0x03, |
| 7629 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 7630 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7631 | .channel_mode = alc262_modes, |
| 7632 | .input_mux = &alc262_capture_source, |
| 7633 | .unsol_event = alc262_hippo_unsol_event, |
| 7634 | }, |
| 7635 | [ALC262_HIPPO_1] = { |
| 7636 | .mixers = { alc262_hippo1_mixer }, |
| 7637 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 7638 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7639 | .dac_nids = alc262_dac_nids, |
| 7640 | .hp_nid = 0x02, |
| 7641 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 7642 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7643 | .channel_mode = alc262_modes, |
| 7644 | .input_mux = &alc262_capture_source, |
| 7645 | .unsol_event = alc262_hippo1_unsol_event, |
| 7646 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7647 | [ALC262_FUJITSU] = { |
| 7648 | .mixers = { alc262_fujitsu_mixer }, |
| 7649 | .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, |
| 7650 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7651 | .dac_nids = alc262_dac_nids, |
| 7652 | .hp_nid = 0x03, |
| 7653 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 7654 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7655 | .channel_mode = alc262_modes, |
| 7656 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7657 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7658 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7659 | [ALC262_HP_BPC] = { |
| 7660 | .mixers = { alc262_HP_BPC_mixer }, |
| 7661 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 7662 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7663 | .dac_nids = alc262_dac_nids, |
| 7664 | .hp_nid = 0x03, |
| 7665 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7666 | .channel_mode = alc262_modes, |
| 7667 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7668 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7669 | [ALC262_HP_BPC_D7000_WF] = { |
| 7670 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 7671 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 7672 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7673 | .dac_nids = alc262_dac_nids, |
| 7674 | .hp_nid = 0x03, |
| 7675 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7676 | .channel_mode = alc262_modes, |
| 7677 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7678 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7679 | [ALC262_HP_BPC_D7000_WL] = { |
| 7680 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 7681 | alc262_HP_BPC_WildWest_option_mixer }, |
| 7682 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 7683 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7684 | .dac_nids = alc262_dac_nids, |
| 7685 | .hp_nid = 0x03, |
| 7686 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7687 | .channel_mode = alc262_modes, |
| 7688 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7689 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 7690 | [ALC262_BENQ_ED8] = { |
| 7691 | .mixers = { alc262_base_mixer }, |
| 7692 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 7693 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7694 | .dac_nids = alc262_dac_nids, |
| 7695 | .hp_nid = 0x03, |
| 7696 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7697 | .channel_mode = alc262_modes, |
| 7698 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7699 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 7700 | [ALC262_SONY_ASSAMD] = { |
| 7701 | .mixers = { alc262_sony_mixer }, |
| 7702 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 7703 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7704 | .dac_nids = alc262_dac_nids, |
| 7705 | .hp_nid = 0x02, |
| 7706 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7707 | .channel_mode = alc262_modes, |
| 7708 | .input_mux = &alc262_capture_source, |
| 7709 | .unsol_event = alc262_hippo_unsol_event, |
| 7710 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7711 | }; |
| 7712 | |
| 7713 | static int patch_alc262(struct hda_codec *codec) |
| 7714 | { |
| 7715 | struct alc_spec *spec; |
| 7716 | int board_config; |
| 7717 | int err; |
| 7718 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 7719 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7720 | if (spec == NULL) |
| 7721 | return -ENOMEM; |
| 7722 | |
| 7723 | codec->spec = spec; |
| 7724 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7725 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 7726 | * under-run |
| 7727 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7728 | { |
| 7729 | int tmp; |
| 7730 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 7731 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 7732 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 7733 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 7734 | } |
| 7735 | #endif |
| 7736 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7737 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 7738 | alc262_models, |
| 7739 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7740 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7741 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7742 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 7743 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7744 | board_config = ALC262_AUTO; |
| 7745 | } |
| 7746 | |
| 7747 | if (board_config == ALC262_AUTO) { |
| 7748 | /* automatic parse from the BIOS config */ |
| 7749 | err = alc262_parse_auto_config(codec); |
| 7750 | if (err < 0) { |
| 7751 | alc_free(codec); |
| 7752 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7753 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7754 | printk(KERN_INFO |
| 7755 | "hda_codec: Cannot set up configuration " |
| 7756 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7757 | board_config = ALC262_BASIC; |
| 7758 | } |
| 7759 | } |
| 7760 | |
| 7761 | if (board_config != ALC262_AUTO) |
| 7762 | setup_preset(spec, &alc262_presets[board_config]); |
| 7763 | |
| 7764 | spec->stream_name_analog = "ALC262 Analog"; |
| 7765 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 7766 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 7767 | |
| 7768 | spec->stream_name_digital = "ALC262 Digital"; |
| 7769 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 7770 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 7771 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7772 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7773 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7774 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 7775 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7776 | /* get type */ |
| 7777 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7778 | if (wcap != AC_WID_AUD_IN) { |
| 7779 | spec->adc_nids = alc262_adc_nids_alt; |
| 7780 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7781 | spec->mixers[spec->num_mixers] = |
| 7782 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7783 | spec->num_mixers++; |
| 7784 | } else { |
| 7785 | spec->adc_nids = alc262_adc_nids; |
| 7786 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 7787 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 7788 | spec->num_mixers++; |
| 7789 | } |
| 7790 | } |
| 7791 | |
| 7792 | codec->patch_ops = alc_patch_ops; |
| 7793 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7794 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7795 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7796 | return 0; |
| 7797 | } |
| 7798 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7799 | /* |
| 7800 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 7801 | */ |
| 7802 | |
| 7803 | /* |
| 7804 | * set the path ways for 2 channel output |
| 7805 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 7806 | */ |
| 7807 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 7808 | /* set pin widget 1Ah (line in) for input */ |
| 7809 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7810 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 7811 | * the vref |
| 7812 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7813 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 7814 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7815 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 7816 | #if 0 |
| 7817 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 7818 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 7819 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7820 | { } /* end */ |
| 7821 | }; |
| 7822 | /* |
| 7823 | * 6ch mode |
| 7824 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 7825 | */ |
| 7826 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 7827 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 7828 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 7829 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 7830 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 7831 | |
| 7832 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7833 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7834 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7835 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 7836 | #if 0 |
| 7837 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 7838 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 7839 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7840 | { } /* end */ |
| 7841 | }; |
| 7842 | |
| 7843 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 7844 | { 2, alc861_threestack_ch2_init }, |
| 7845 | { 6, alc861_threestack_ch6_init }, |
| 7846 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 7847 | /* Set mic1 as input and unmute the mixer */ |
| 7848 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 7849 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 7850 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 7851 | { } /* end */ |
| 7852 | }; |
| 7853 | /* Set mic1 as output and mute mixer */ |
| 7854 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 7855 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 7856 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 7857 | { } /* end */ |
| 7858 | }; |
| 7859 | |
| 7860 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 7861 | { 2, alc861_uniwill_m31_ch2_init }, |
| 7862 | { 4, alc861_uniwill_m31_ch4_init }, |
| 7863 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7864 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 7865 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 7866 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 7867 | /* set pin widget 1Ah (line in) for input */ |
| 7868 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7869 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 7870 | * the vref |
| 7871 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 7872 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 7873 | |
| 7874 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 7875 | #if 0 |
| 7876 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 7877 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 7878 | #endif |
| 7879 | { } /* end */ |
| 7880 | }; |
| 7881 | /* Set mic1 nad line-in as output and mute mixer */ |
| 7882 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 7883 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 7884 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 7885 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 7886 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 7887 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 7888 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 7889 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7890 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7891 | |
| 7892 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 7893 | #if 0 |
| 7894 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 7895 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 7896 | #endif |
| 7897 | { } /* end */ |
| 7898 | }; |
| 7899 | |
| 7900 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 7901 | { 2, alc861_asus_ch2_init }, |
| 7902 | { 6, alc861_asus_ch6_init }, |
| 7903 | }; |
| 7904 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7905 | /* patch-ALC861 */ |
| 7906 | |
| 7907 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 7908 | /* output mixer control */ |
| 7909 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 7910 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 7911 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 7912 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 7913 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 7914 | |
| 7915 | /*Input mixer control */ |
| 7916 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 7917 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 7918 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 7919 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 7920 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 7921 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 7922 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 7923 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 7924 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 7925 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7926 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7927 | /* Capture mixer control */ |
| 7928 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7929 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7930 | { |
| 7931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7932 | .name = "Capture Source", |
| 7933 | .count = 1, |
| 7934 | .info = alc_mux_enum_info, |
| 7935 | .get = alc_mux_enum_get, |
| 7936 | .put = alc_mux_enum_put, |
| 7937 | }, |
| 7938 | { } /* end */ |
| 7939 | }; |
| 7940 | |
| 7941 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 7942 | /* output mixer control */ |
| 7943 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 7944 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 7945 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 7946 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 7947 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 7948 | |
| 7949 | /* Input mixer control */ |
| 7950 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 7951 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 7952 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 7953 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 7954 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 7955 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 7956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 7957 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 7958 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 7959 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7961 | /* Capture mixer control */ |
| 7962 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7963 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7964 | { |
| 7965 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7966 | .name = "Capture Source", |
| 7967 | .count = 1, |
| 7968 | .info = alc_mux_enum_info, |
| 7969 | .get = alc_mux_enum_get, |
| 7970 | .put = alc_mux_enum_put, |
| 7971 | }, |
| 7972 | { |
| 7973 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7974 | .name = "Channel Mode", |
| 7975 | .info = alc_ch_mode_info, |
| 7976 | .get = alc_ch_mode_get, |
| 7977 | .put = alc_ch_mode_put, |
| 7978 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 7979 | }, |
| 7980 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 7981 | }; |
| 7982 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7983 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 7984 | /* output mixer control */ |
| 7985 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 7986 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 7987 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 7988 | |
| 7989 | /*Capture mixer control */ |
| 7990 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7991 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7992 | { |
| 7993 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7994 | .name = "Capture Source", |
| 7995 | .count = 1, |
| 7996 | .info = alc_mux_enum_info, |
| 7997 | .get = alc_mux_enum_get, |
| 7998 | .put = alc_mux_enum_put, |
| 7999 | }, |
| 8000 | |
| 8001 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8002 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8003 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8004 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 8005 | /* output mixer control */ |
| 8006 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8007 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8008 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8009 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8010 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 8011 | |
| 8012 | /* Input mixer control */ |
| 8013 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8014 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8015 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8016 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8017 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8018 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8021 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8022 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8023 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8024 | /* Capture mixer control */ |
| 8025 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8026 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8027 | { |
| 8028 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8029 | .name = "Capture Source", |
| 8030 | .count = 1, |
| 8031 | .info = alc_mux_enum_info, |
| 8032 | .get = alc_mux_enum_get, |
| 8033 | .put = alc_mux_enum_put, |
| 8034 | }, |
| 8035 | { |
| 8036 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8037 | .name = "Channel Mode", |
| 8038 | .info = alc_ch_mode_info, |
| 8039 | .get = alc_ch_mode_get, |
| 8040 | .put = alc_ch_mode_put, |
| 8041 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 8042 | }, |
| 8043 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8044 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8045 | |
| 8046 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 8047 | /* output mixer control */ |
| 8048 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8049 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8050 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8051 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8052 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 8053 | |
| 8054 | /* Input mixer control */ |
| 8055 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8056 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8057 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8058 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8059 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8060 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8061 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8062 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8063 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8064 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 8065 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8066 | /* Capture mixer control */ |
| 8067 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8068 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8069 | { |
| 8070 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8071 | .name = "Capture Source", |
| 8072 | .count = 1, |
| 8073 | .info = alc_mux_enum_info, |
| 8074 | .get = alc_mux_enum_get, |
| 8075 | .put = alc_mux_enum_put, |
| 8076 | }, |
| 8077 | { |
| 8078 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8079 | .name = "Channel Mode", |
| 8080 | .info = alc_ch_mode_info, |
| 8081 | .get = alc_ch_mode_get, |
| 8082 | .put = alc_ch_mode_put, |
| 8083 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 8084 | }, |
| 8085 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8086 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8087 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8088 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8089 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8090 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8091 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8092 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8093 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8094 | { } |
| 8095 | }; |
| 8096 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8097 | /* |
| 8098 | * generic initialization of ADC, input mixers and output mixers |
| 8099 | */ |
| 8100 | static struct hda_verb alc861_base_init_verbs[] = { |
| 8101 | /* |
| 8102 | * Unmute ADC0 and set the default input to mic-in |
| 8103 | */ |
| 8104 | /* port-A for surround (rear panel) */ |
| 8105 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8106 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8107 | /* port-B for mic-in (rear panel) with vref */ |
| 8108 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8109 | /* port-C for line-in (rear panel) */ |
| 8110 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8111 | /* port-D for Front */ |
| 8112 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8113 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8114 | /* port-E for HP out (front panel) */ |
| 8115 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 8116 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8117 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8118 | /* port-F for mic-in (front panel) with vref */ |
| 8119 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8120 | /* port-G for CLFE (rear panel) */ |
| 8121 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8122 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8123 | /* port-H for side (rear panel) */ |
| 8124 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8125 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8126 | /* CD-in */ |
| 8127 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8128 | /* route front mic to ADC1*/ |
| 8129 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8130 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8131 | |
| 8132 | /* Unmute DAC0~3 & spdif out*/ |
| 8133 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8134 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8135 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8136 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8137 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8138 | |
| 8139 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8140 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8141 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8142 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8143 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8144 | |
| 8145 | /* Unmute Stereo Mixer 15 */ |
| 8146 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8147 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8148 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8149 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8150 | |
| 8151 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8152 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8153 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8154 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8155 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8156 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8157 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8158 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8159 | /* hp used DAC 3 (Front) */ |
| 8160 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8161 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8162 | |
| 8163 | { } |
| 8164 | }; |
| 8165 | |
| 8166 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 8167 | /* |
| 8168 | * Unmute ADC0 and set the default input to mic-in |
| 8169 | */ |
| 8170 | /* port-A for surround (rear panel) */ |
| 8171 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8172 | /* port-B for mic-in (rear panel) with vref */ |
| 8173 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8174 | /* port-C for line-in (rear panel) */ |
| 8175 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8176 | /* port-D for Front */ |
| 8177 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8178 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8179 | /* port-E for HP out (front panel) */ |
| 8180 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 8181 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8182 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8183 | /* port-F for mic-in (front panel) with vref */ |
| 8184 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8185 | /* port-G for CLFE (rear panel) */ |
| 8186 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8187 | /* port-H for side (rear panel) */ |
| 8188 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8189 | /* CD-in */ |
| 8190 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8191 | /* route front mic to ADC1*/ |
| 8192 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8193 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8194 | /* Unmute DAC0~3 & spdif out*/ |
| 8195 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8196 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8197 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8198 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8200 | |
| 8201 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8202 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8203 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8204 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8205 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8206 | |
| 8207 | /* Unmute Stereo Mixer 15 */ |
| 8208 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8209 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8210 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8211 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8212 | |
| 8213 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8214 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8215 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8216 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8217 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8218 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8219 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8220 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8221 | /* hp used DAC 3 (Front) */ |
| 8222 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8223 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8224 | { } |
| 8225 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8226 | |
| 8227 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 8228 | /* |
| 8229 | * Unmute ADC0 and set the default input to mic-in |
| 8230 | */ |
| 8231 | /* port-A for surround (rear panel) */ |
| 8232 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8233 | /* port-B for mic-in (rear panel) with vref */ |
| 8234 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8235 | /* port-C for line-in (rear panel) */ |
| 8236 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8237 | /* port-D for Front */ |
| 8238 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8239 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8240 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8241 | /* this has to be set to VREF80 */ |
| 8242 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8243 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8244 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8245 | /* port-F for mic-in (front panel) with vref */ |
| 8246 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8247 | /* port-G for CLFE (rear panel) */ |
| 8248 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8249 | /* port-H for side (rear panel) */ |
| 8250 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8251 | /* CD-in */ |
| 8252 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8253 | /* route front mic to ADC1*/ |
| 8254 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8255 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8256 | /* Unmute DAC0~3 & spdif out*/ |
| 8257 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8258 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8259 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8260 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8261 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8262 | |
| 8263 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8264 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8265 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8266 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8267 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8268 | |
| 8269 | /* Unmute Stereo Mixer 15 */ |
| 8270 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8271 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8272 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8273 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8274 | |
| 8275 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8276 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8277 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8278 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8279 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8280 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8281 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8282 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8283 | /* hp used DAC 3 (Front) */ |
| 8284 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8285 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8286 | { } |
| 8287 | }; |
| 8288 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8289 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 8290 | /* |
| 8291 | * Unmute ADC0 and set the default input to mic-in |
| 8292 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8293 | /* port-A for surround (rear panel) |
| 8294 | * according to codec#0 this is the HP jack |
| 8295 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8296 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 8297 | /* route front PCM to HP */ |
| 8298 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8299 | /* port-B for mic-in (rear panel) with vref */ |
| 8300 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8301 | /* port-C for line-in (rear panel) */ |
| 8302 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8303 | /* port-D for Front */ |
| 8304 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8305 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8306 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8307 | /* this has to be set to VREF80 */ |
| 8308 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8309 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8310 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8311 | /* port-F for mic-in (front panel) with vref */ |
| 8312 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8313 | /* port-G for CLFE (rear panel) */ |
| 8314 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8315 | /* port-H for side (rear panel) */ |
| 8316 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8317 | /* CD-in */ |
| 8318 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8319 | /* route front mic to ADC1*/ |
| 8320 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8321 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8322 | /* Unmute DAC0~3 & spdif out*/ |
| 8323 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8324 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8325 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8326 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8328 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8329 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8330 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8331 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8332 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8333 | |
| 8334 | /* Unmute Stereo Mixer 15 */ |
| 8335 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8336 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8337 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8338 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8339 | |
| 8340 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8341 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8342 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8343 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8344 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8345 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8346 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8347 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8348 | /* hp used DAC 3 (Front) */ |
| 8349 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8350 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8351 | { } |
| 8352 | }; |
| 8353 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8354 | /* additional init verbs for ASUS laptops */ |
| 8355 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 8356 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 8357 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 8358 | { } |
| 8359 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8360 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8361 | /* |
| 8362 | * generic initialization of ADC, input mixers and output mixers |
| 8363 | */ |
| 8364 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 8365 | /* |
| 8366 | * Unmute ADC0 and set the default input to mic-in |
| 8367 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8368 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8369 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8370 | |
| 8371 | /* Unmute DAC0~3 & spdif out*/ |
| 8372 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8373 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8374 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8375 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8376 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8377 | |
| 8378 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8379 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8380 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8381 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8382 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8383 | |
| 8384 | /* Unmute Stereo Mixer 15 */ |
| 8385 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8386 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8387 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8388 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 8389 | |
| 8390 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8391 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8392 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8393 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8394 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8395 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8396 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8397 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8398 | |
| 8399 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8400 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8401 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8402 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8403 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8404 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8405 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8406 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8407 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8408 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8409 | |
| 8410 | { } |
| 8411 | }; |
| 8412 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8413 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 8414 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8415 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8416 | { } |
| 8417 | }; |
| 8418 | |
| 8419 | /* toggle speaker-output according to the hp-jack state */ |
| 8420 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 8421 | { |
| 8422 | unsigned int present; |
| 8423 | |
| 8424 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 8425 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8426 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, |
| 8427 | 0x80, present ? 0x80 : 0); |
| 8428 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, |
| 8429 | 0x80, present ? 0x80 : 0); |
| 8430 | snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3, |
| 8431 | 0x80, present ? 0 : 0x80); |
| 8432 | snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3, |
| 8433 | 0x80, present ? 0 : 0x80); |
| 8434 | } |
| 8435 | |
| 8436 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 8437 | unsigned int res) |
| 8438 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8439 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8440 | alc861_toshiba_automute(codec); |
| 8441 | } |
| 8442 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8443 | /* pcm configuration: identiacal with ALC880 */ |
| 8444 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 8445 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 8446 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 8447 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 8448 | |
| 8449 | |
| 8450 | #define ALC861_DIGOUT_NID 0x07 |
| 8451 | |
| 8452 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 8453 | { 8, NULL } |
| 8454 | }; |
| 8455 | |
| 8456 | static hda_nid_t alc861_dac_nids[4] = { |
| 8457 | /* front, surround, clfe, side */ |
| 8458 | 0x03, 0x06, 0x05, 0x04 |
| 8459 | }; |
| 8460 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8461 | static hda_nid_t alc660_dac_nids[3] = { |
| 8462 | /* front, clfe, surround */ |
| 8463 | 0x03, 0x05, 0x06 |
| 8464 | }; |
| 8465 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8466 | static hda_nid_t alc861_adc_nids[1] = { |
| 8467 | /* ADC0-2 */ |
| 8468 | 0x08, |
| 8469 | }; |
| 8470 | |
| 8471 | static struct hda_input_mux alc861_capture_source = { |
| 8472 | .num_items = 5, |
| 8473 | .items = { |
| 8474 | { "Mic", 0x0 }, |
| 8475 | { "Front Mic", 0x3 }, |
| 8476 | { "Line", 0x1 }, |
| 8477 | { "CD", 0x4 }, |
| 8478 | { "Mixer", 0x5 }, |
| 8479 | }, |
| 8480 | }; |
| 8481 | |
| 8482 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8483 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 8484 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8485 | { |
| 8486 | int i; |
| 8487 | hda_nid_t nid; |
| 8488 | |
| 8489 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8490 | for (i = 0; i < cfg->line_outs; i++) { |
| 8491 | nid = cfg->line_out_pins[i]; |
| 8492 | if (nid) { |
| 8493 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 8494 | continue; |
| 8495 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 8496 | } |
| 8497 | } |
| 8498 | spec->multiout.num_dacs = cfg->line_outs; |
| 8499 | return 0; |
| 8500 | } |
| 8501 | |
| 8502 | /* add playback controls from the parsed DAC table */ |
| 8503 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8504 | const struct auto_pin_cfg *cfg) |
| 8505 | { |
| 8506 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8507 | static const char *chname[4] = { |
| 8508 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 8509 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8510 | hda_nid_t nid; |
| 8511 | int i, idx, err; |
| 8512 | |
| 8513 | for (i = 0; i < cfg->line_outs; i++) { |
| 8514 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8515 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8516 | continue; |
| 8517 | if (nid == 0x05) { |
| 8518 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8519 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 8520 | "Center Playback Switch", |
| 8521 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 8522 | HDA_OUTPUT)); |
| 8523 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8524 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8525 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 8526 | "LFE Playback Switch", |
| 8527 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8528 | HDA_OUTPUT)); |
| 8529 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8530 | return err; |
| 8531 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8532 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 8533 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8534 | if (nid == alc861_dac_nids[idx]) |
| 8535 | break; |
| 8536 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8537 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 8538 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8539 | HDA_OUTPUT)); |
| 8540 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8541 | return err; |
| 8542 | } |
| 8543 | } |
| 8544 | return 0; |
| 8545 | } |
| 8546 | |
| 8547 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 8548 | { |
| 8549 | int err; |
| 8550 | hda_nid_t nid; |
| 8551 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8552 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8553 | return 0; |
| 8554 | |
| 8555 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 8556 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8557 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8558 | "Headphone Playback Switch", |
| 8559 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 8560 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8561 | return err; |
| 8562 | spec->multiout.hp_nid = nid; |
| 8563 | } |
| 8564 | return 0; |
| 8565 | } |
| 8566 | |
| 8567 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8568 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 8569 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8570 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8571 | struct hda_input_mux *imux = &spec->private_imux; |
| 8572 | int i, err, idx, idx1; |
| 8573 | |
| 8574 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8575 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8576 | case 0x0c: |
| 8577 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8578 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8579 | break; |
| 8580 | case 0x0f: |
| 8581 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8582 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8583 | break; |
| 8584 | case 0x0d: |
| 8585 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8586 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8587 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8588 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8589 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8590 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8591 | break; |
| 8592 | case 0x11: |
| 8593 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8594 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8595 | break; |
| 8596 | default: |
| 8597 | continue; |
| 8598 | } |
| 8599 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 8600 | err = new_analog_input(spec, cfg->input_pins[i], |
| 8601 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8602 | if (err < 0) |
| 8603 | return err; |
| 8604 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 8605 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8606 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8607 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8608 | } |
| 8609 | return 0; |
| 8610 | } |
| 8611 | |
| 8612 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 8613 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8614 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8615 | |
| 8616 | { |
| 8617 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8618 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8619 | * So call somewhat different.. |
| 8620 | *FIXME: the controls appear in the "playback" view! |
| 8621 | */ |
| 8622 | /* .name = "Capture Source", */ |
| 8623 | .name = "Input Source", |
| 8624 | .count = 1, |
| 8625 | .info = alc_mux_enum_info, |
| 8626 | .get = alc_mux_enum_get, |
| 8627 | .put = alc_mux_enum_put, |
| 8628 | }, |
| 8629 | { } /* end */ |
| 8630 | }; |
| 8631 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8632 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8633 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8634 | int pin_type, int dac_idx) |
| 8635 | { |
| 8636 | /* set as output */ |
| 8637 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8638 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8639 | pin_type); |
| 8640 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8641 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8642 | |
| 8643 | } |
| 8644 | |
| 8645 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 8646 | { |
| 8647 | struct alc_spec *spec = codec->spec; |
| 8648 | int i; |
| 8649 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8650 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8651 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 8652 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8653 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8654 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8655 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8656 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8657 | } |
| 8658 | } |
| 8659 | |
| 8660 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 8661 | { |
| 8662 | struct alc_spec *spec = codec->spec; |
| 8663 | hda_nid_t pin; |
| 8664 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8665 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8666 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8667 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 8668 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8669 | } |
| 8670 | |
| 8671 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 8672 | { |
| 8673 | struct alc_spec *spec = codec->spec; |
| 8674 | int i; |
| 8675 | |
| 8676 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8677 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8678 | if (nid >= 0x0c && nid <= 0x11) { |
| 8679 | snd_hda_codec_write(codec, nid, 0, |
| 8680 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8681 | i <= AUTO_PIN_FRONT_MIC ? |
| 8682 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8683 | } |
| 8684 | } |
| 8685 | } |
| 8686 | |
| 8687 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8688 | /* return 1 if successful, 0 if the proper config is not found, |
| 8689 | * or a negative error code |
| 8690 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8691 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 8692 | { |
| 8693 | struct alc_spec *spec = codec->spec; |
| 8694 | int err; |
| 8695 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 8696 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8697 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 8698 | alc861_ignore); |
| 8699 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8700 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8701 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8702 | return 0; /* can't find valid BIOS pin config */ |
| 8703 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8704 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 8705 | if (err < 0) |
| 8706 | return err; |
| 8707 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 8708 | if (err < 0) |
| 8709 | return err; |
| 8710 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 8711 | if (err < 0) |
| 8712 | return err; |
| 8713 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 8714 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8715 | return err; |
| 8716 | |
| 8717 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 8718 | |
| 8719 | if (spec->autocfg.dig_out_pin) |
| 8720 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 8721 | |
| 8722 | if (spec->kctl_alloc) |
| 8723 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 8724 | |
| 8725 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 8726 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 8727 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8728 | spec->input_mux = &spec->private_imux; |
| 8729 | |
| 8730 | spec->adc_nids = alc861_adc_nids; |
| 8731 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 8732 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 8733 | spec->num_mixers++; |
| 8734 | |
| 8735 | return 1; |
| 8736 | } |
| 8737 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8738 | /* additional initialization for auto-configuration model */ |
| 8739 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8740 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8741 | alc861_auto_init_multi_out(codec); |
| 8742 | alc861_auto_init_hp_out(codec); |
| 8743 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8744 | } |
| 8745 | |
| 8746 | |
| 8747 | /* |
| 8748 | * configuration and preset |
| 8749 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8750 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 8751 | [ALC861_3ST] = "3stack", |
| 8752 | [ALC660_3ST] = "3stack-660", |
| 8753 | [ALC861_3ST_DIG] = "3stack-dig", |
| 8754 | [ALC861_6ST_DIG] = "6stack-dig", |
| 8755 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 8756 | [ALC861_TOSHIBA] = "toshiba", |
| 8757 | [ALC861_ASUS] = "asus", |
| 8758 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 8759 | [ALC861_AUTO] = "auto", |
| 8760 | }; |
| 8761 | |
| 8762 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 8763 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8764 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 8765 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f223a9f | 2007-04-25 13:38:31 +0200 | [diff] [blame] | 8766 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8767 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
| 8768 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660_3ST), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 8769 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8770 | SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), |
| 8771 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
Takashi Iwai | 4147dab | 2007-01-31 10:35:19 +0100 | [diff] [blame] | 8772 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 8773 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8774 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8775 | {} |
| 8776 | }; |
| 8777 | |
| 8778 | static struct alc_config_preset alc861_presets[] = { |
| 8779 | [ALC861_3ST] = { |
| 8780 | .mixers = { alc861_3ST_mixer }, |
| 8781 | .init_verbs = { alc861_threestack_init_verbs }, |
| 8782 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 8783 | .dac_nids = alc861_dac_nids, |
| 8784 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 8785 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8786 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8787 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 8788 | .adc_nids = alc861_adc_nids, |
| 8789 | .input_mux = &alc861_capture_source, |
| 8790 | }, |
| 8791 | [ALC861_3ST_DIG] = { |
| 8792 | .mixers = { alc861_base_mixer }, |
| 8793 | .init_verbs = { alc861_threestack_init_verbs }, |
| 8794 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 8795 | .dac_nids = alc861_dac_nids, |
| 8796 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 8797 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 8798 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8799 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8800 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 8801 | .adc_nids = alc861_adc_nids, |
| 8802 | .input_mux = &alc861_capture_source, |
| 8803 | }, |
| 8804 | [ALC861_6ST_DIG] = { |
| 8805 | .mixers = { alc861_base_mixer }, |
| 8806 | .init_verbs = { alc861_base_init_verbs }, |
| 8807 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 8808 | .dac_nids = alc861_dac_nids, |
| 8809 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 8810 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 8811 | .channel_mode = alc861_8ch_modes, |
| 8812 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 8813 | .adc_nids = alc861_adc_nids, |
| 8814 | .input_mux = &alc861_capture_source, |
| 8815 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8816 | [ALC660_3ST] = { |
| 8817 | .mixers = { alc861_3ST_mixer }, |
| 8818 | .init_verbs = { alc861_threestack_init_verbs }, |
| 8819 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 8820 | .dac_nids = alc660_dac_nids, |
| 8821 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 8822 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8823 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8824 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 8825 | .adc_nids = alc861_adc_nids, |
| 8826 | .input_mux = &alc861_capture_source, |
| 8827 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8828 | [ALC861_UNIWILL_M31] = { |
| 8829 | .mixers = { alc861_uniwill_m31_mixer }, |
| 8830 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 8831 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 8832 | .dac_nids = alc861_dac_nids, |
| 8833 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 8834 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 8835 | .channel_mode = alc861_uniwill_m31_modes, |
| 8836 | .need_dac_fix = 1, |
| 8837 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 8838 | .adc_nids = alc861_adc_nids, |
| 8839 | .input_mux = &alc861_capture_source, |
| 8840 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8841 | [ALC861_TOSHIBA] = { |
| 8842 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8843 | .init_verbs = { alc861_base_init_verbs, |
| 8844 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8845 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 8846 | .dac_nids = alc861_dac_nids, |
| 8847 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8848 | .channel_mode = alc883_3ST_2ch_modes, |
| 8849 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 8850 | .adc_nids = alc861_adc_nids, |
| 8851 | .input_mux = &alc861_capture_source, |
| 8852 | .unsol_event = alc861_toshiba_unsol_event, |
| 8853 | .init_hook = alc861_toshiba_automute, |
| 8854 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8855 | [ALC861_ASUS] = { |
| 8856 | .mixers = { alc861_asus_mixer }, |
| 8857 | .init_verbs = { alc861_asus_init_verbs }, |
| 8858 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 8859 | .dac_nids = alc861_dac_nids, |
| 8860 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 8861 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 8862 | .channel_mode = alc861_asus_modes, |
| 8863 | .need_dac_fix = 1, |
| 8864 | .hp_nid = 0x06, |
| 8865 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 8866 | .adc_nids = alc861_adc_nids, |
| 8867 | .input_mux = &alc861_capture_source, |
| 8868 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8869 | [ALC861_ASUS_LAPTOP] = { |
| 8870 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 8871 | .init_verbs = { alc861_asus_init_verbs, |
| 8872 | alc861_asus_laptop_init_verbs }, |
| 8873 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 8874 | .dac_nids = alc861_dac_nids, |
| 8875 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 8876 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8877 | .channel_mode = alc883_3ST_2ch_modes, |
| 8878 | .need_dac_fix = 1, |
| 8879 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 8880 | .adc_nids = alc861_adc_nids, |
| 8881 | .input_mux = &alc861_capture_source, |
| 8882 | }, |
| 8883 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8884 | |
| 8885 | |
| 8886 | static int patch_alc861(struct hda_codec *codec) |
| 8887 | { |
| 8888 | struct alc_spec *spec; |
| 8889 | int board_config; |
| 8890 | int err; |
| 8891 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 8892 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8893 | if (spec == NULL) |
| 8894 | return -ENOMEM; |
| 8895 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8896 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8897 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8898 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 8899 | alc861_models, |
| 8900 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8901 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8902 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8903 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 8904 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8905 | board_config = ALC861_AUTO; |
| 8906 | } |
| 8907 | |
| 8908 | if (board_config == ALC861_AUTO) { |
| 8909 | /* automatic parse from the BIOS config */ |
| 8910 | err = alc861_parse_auto_config(codec); |
| 8911 | if (err < 0) { |
| 8912 | alc_free(codec); |
| 8913 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8914 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8915 | printk(KERN_INFO |
| 8916 | "hda_codec: Cannot set up configuration " |
| 8917 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8918 | board_config = ALC861_3ST_DIG; |
| 8919 | } |
| 8920 | } |
| 8921 | |
| 8922 | if (board_config != ALC861_AUTO) |
| 8923 | setup_preset(spec, &alc861_presets[board_config]); |
| 8924 | |
| 8925 | spec->stream_name_analog = "ALC861 Analog"; |
| 8926 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 8927 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 8928 | |
| 8929 | spec->stream_name_digital = "ALC861 Digital"; |
| 8930 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 8931 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 8932 | |
| 8933 | codec->patch_ops = alc_patch_ops; |
| 8934 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8935 | spec->init_hook = alc861_auto_init; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8936 | |
| 8937 | return 0; |
| 8938 | } |
| 8939 | |
| 8940 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 8941 | * ALC861-VD support |
| 8942 | * |
| 8943 | * Based on ALC882 |
| 8944 | * |
| 8945 | * In addition, an independent DAC |
| 8946 | */ |
| 8947 | #define ALC861VD_DIGOUT_NID 0x06 |
| 8948 | |
| 8949 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 8950 | /* front, surr, clfe, side surr */ |
| 8951 | 0x02, 0x03, 0x04, 0x05 |
| 8952 | }; |
| 8953 | |
| 8954 | /* dac_nids for ALC660vd are in a different order - according to |
| 8955 | * Realtek's driver. |
| 8956 | * This should probably tesult in a different mixer for 6stack models |
| 8957 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 8958 | * - and it is the same as in 861vd. |
| 8959 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 8960 | */ |
| 8961 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 8962 | /* front, rear, clfe, rear_surr */ |
| 8963 | 0x02, 0x04, 0x03 |
| 8964 | }; |
| 8965 | |
| 8966 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 8967 | /* ADC0 */ |
| 8968 | 0x09, |
| 8969 | }; |
| 8970 | |
| 8971 | /* input MUX */ |
| 8972 | /* FIXME: should be a matrix-type input source selection */ |
| 8973 | static struct hda_input_mux alc861vd_capture_source = { |
| 8974 | .num_items = 4, |
| 8975 | .items = { |
| 8976 | { "Mic", 0x0 }, |
| 8977 | { "Front Mic", 0x1 }, |
| 8978 | { "Line", 0x2 }, |
| 8979 | { "CD", 0x4 }, |
| 8980 | }, |
| 8981 | }; |
| 8982 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 8983 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 8984 | .num_items = 3, |
| 8985 | .items = { |
| 8986 | { "Front Mic", 0x0 }, |
| 8987 | { "ATAPI Mic", 0x1 }, |
| 8988 | { "Line In", 0x5 }, |
| 8989 | }, |
| 8990 | }; |
| 8991 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 8992 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 8993 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 8994 | |
| 8995 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 8996 | struct snd_ctl_elem_value *ucontrol) |
| 8997 | { |
| 8998 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8999 | struct alc_spec *spec = codec->spec; |
| 9000 | const struct hda_input_mux *imux = spec->input_mux; |
| 9001 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9002 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 9003 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 9004 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 9005 | unsigned int i, idx; |
| 9006 | |
| 9007 | idx = ucontrol->value.enumerated.item[0]; |
| 9008 | if (idx >= imux->num_items) |
| 9009 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9010 | if (*cur_val == idx && !codec->in_resume) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9011 | return 0; |
| 9012 | for (i = 0; i < imux->num_items; i++) { |
| 9013 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 9014 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 9015 | v | (imux->items[i].index << 8)); |
| 9016 | } |
| 9017 | *cur_val = idx; |
| 9018 | return 1; |
| 9019 | } |
| 9020 | |
| 9021 | /* |
| 9022 | * 2ch mode |
| 9023 | */ |
| 9024 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 9025 | { 2, NULL } |
| 9026 | }; |
| 9027 | |
| 9028 | /* |
| 9029 | * 6ch mode |
| 9030 | */ |
| 9031 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 9032 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9033 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9034 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9035 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9036 | { } /* end */ |
| 9037 | }; |
| 9038 | |
| 9039 | /* |
| 9040 | * 8ch mode |
| 9041 | */ |
| 9042 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 9043 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9044 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9045 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9046 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9047 | { } /* end */ |
| 9048 | }; |
| 9049 | |
| 9050 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 9051 | { 6, alc861vd_6stack_ch6_init }, |
| 9052 | { 8, alc861vd_6stack_ch8_init }, |
| 9053 | }; |
| 9054 | |
| 9055 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 9056 | { |
| 9057 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9058 | .name = "Channel Mode", |
| 9059 | .info = alc_ch_mode_info, |
| 9060 | .get = alc_ch_mode_get, |
| 9061 | .put = alc_ch_mode_put, |
| 9062 | }, |
| 9063 | { } /* end */ |
| 9064 | }; |
| 9065 | |
| 9066 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 9067 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9068 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9069 | |
| 9070 | { |
| 9071 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9072 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9073 | * So call somewhat different.. |
| 9074 | *FIXME: the controls appear in the "playback" view! |
| 9075 | */ |
| 9076 | /* .name = "Capture Source", */ |
| 9077 | .name = "Input Source", |
| 9078 | .count = 1, |
| 9079 | .info = alc861vd_mux_enum_info, |
| 9080 | .get = alc861vd_mux_enum_get, |
| 9081 | .put = alc861vd_mux_enum_put, |
| 9082 | }, |
| 9083 | { } /* end */ |
| 9084 | }; |
| 9085 | |
| 9086 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 9087 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 9088 | */ |
| 9089 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 9090 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9091 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9092 | |
| 9093 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9094 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9095 | |
| 9096 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 9097 | HDA_OUTPUT), |
| 9098 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 9099 | HDA_OUTPUT), |
| 9100 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9101 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9102 | |
| 9103 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 9104 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9105 | |
| 9106 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9107 | |
| 9108 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9109 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9110 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9111 | |
| 9112 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9113 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9114 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9115 | |
| 9116 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9117 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9118 | |
| 9119 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9120 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9121 | |
| 9122 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9123 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9124 | |
| 9125 | { } /* end */ |
| 9126 | }; |
| 9127 | |
| 9128 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 9129 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9130 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9131 | |
| 9132 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9133 | |
| 9134 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9137 | |
| 9138 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9139 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9140 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9141 | |
| 9142 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9143 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9144 | |
| 9145 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9146 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9147 | |
| 9148 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9149 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9150 | |
| 9151 | { } /* end */ |
| 9152 | }; |
| 9153 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9154 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 9155 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9156 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 9157 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9158 | |
| 9159 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9160 | |
| 9161 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9164 | |
| 9165 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9166 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9167 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9168 | |
| 9169 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9170 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9171 | |
| 9172 | { } /* end */ |
| 9173 | }; |
| 9174 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 9175 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 9176 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 9177 | */ |
| 9178 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 9179 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9180 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9181 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9182 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9183 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9184 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9185 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9186 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9187 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9188 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9189 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9190 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9191 | { |
| 9192 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9193 | /* .name = "Capture Source", */ |
| 9194 | .name = "Input Source", |
| 9195 | .count = 1, |
| 9196 | .info = alc882_mux_enum_info, |
| 9197 | .get = alc882_mux_enum_get, |
| 9198 | .put = alc882_mux_enum_put, |
| 9199 | }, |
| 9200 | { } /* end */ |
| 9201 | }; |
| 9202 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9203 | /* |
| 9204 | * generic initialization of ADC, input mixers and output mixers |
| 9205 | */ |
| 9206 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 9207 | /* |
| 9208 | * Unmute ADC0 and set the default input to mic-in |
| 9209 | */ |
| 9210 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9211 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9212 | |
| 9213 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 9214 | * the analog-loopback mixer widget |
| 9215 | */ |
| 9216 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 9217 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9219 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 9221 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 9222 | |
| 9223 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9224 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9225 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9226 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9227 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9228 | |
| 9229 | /* |
| 9230 | * Set up output mixers (0x02 - 0x05) |
| 9231 | */ |
| 9232 | /* set vol=0 to output mixers */ |
| 9233 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9234 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9235 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9236 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9237 | |
| 9238 | /* set up input amps for analog loopback */ |
| 9239 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9240 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9241 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9242 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9243 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9244 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9245 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9246 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9247 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9248 | |
| 9249 | { } |
| 9250 | }; |
| 9251 | |
| 9252 | /* |
| 9253 | * 3-stack pin configuration: |
| 9254 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 9255 | */ |
| 9256 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 9257 | /* |
| 9258 | * Set pin mode and muting |
| 9259 | */ |
| 9260 | /* set front pin widgets 0x14 for output */ |
| 9261 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9262 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9263 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9264 | |
| 9265 | /* Mic (rear) pin: input vref at 80% */ |
| 9266 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9267 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9268 | /* Front Mic pin: input vref at 80% */ |
| 9269 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9270 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9271 | /* Line In pin: input */ |
| 9272 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9273 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9274 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 9275 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9276 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9277 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9278 | /* CD pin widget for input */ |
| 9279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9280 | |
| 9281 | { } |
| 9282 | }; |
| 9283 | |
| 9284 | /* |
| 9285 | * 6-stack pin configuration: |
| 9286 | */ |
| 9287 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 9288 | /* |
| 9289 | * Set pin mode and muting |
| 9290 | */ |
| 9291 | /* set front pin widgets 0x14 for output */ |
| 9292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9293 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9294 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9295 | |
| 9296 | /* Rear Pin: output 1 (0x0d) */ |
| 9297 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9298 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9299 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9300 | /* CLFE Pin: output 2 (0x0e) */ |
| 9301 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9302 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9303 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9304 | /* Side Pin: output 3 (0x0f) */ |
| 9305 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9306 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9307 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9308 | |
| 9309 | /* Mic (rear) pin: input vref at 80% */ |
| 9310 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9311 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9312 | /* Front Mic pin: input vref at 80% */ |
| 9313 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9314 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9315 | /* Line In pin: input */ |
| 9316 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9317 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9318 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 9319 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9320 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9321 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9322 | /* CD pin widget for input */ |
| 9323 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9324 | |
| 9325 | { } |
| 9326 | }; |
| 9327 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9328 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 9329 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9330 | { } |
| 9331 | }; |
| 9332 | |
| 9333 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 9334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9336 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9337 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9338 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9339 | {} |
| 9340 | }; |
| 9341 | |
| 9342 | /* toggle speaker-output according to the hp-jack state */ |
| 9343 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 9344 | { |
| 9345 | unsigned int present; |
| 9346 | unsigned char bits; |
| 9347 | |
| 9348 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9349 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9350 | bits = present ? 0x80 : 0; |
| 9351 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9352 | 0x80, bits); |
| 9353 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9354 | 0x80, bits); |
| 9355 | } |
| 9356 | |
| 9357 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 9358 | { |
| 9359 | unsigned int present; |
| 9360 | unsigned char bits; |
| 9361 | |
| 9362 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9363 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9364 | bits = present ? 0x80 : 0; |
| 9365 | snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, |
| 9366 | 0x80, bits); |
| 9367 | snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1, |
| 9368 | 0x80, bits); |
| 9369 | } |
| 9370 | |
| 9371 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 9372 | { |
| 9373 | alc861vd_lenovo_hp_automute(codec); |
| 9374 | alc861vd_lenovo_mic_automute(codec); |
| 9375 | } |
| 9376 | |
| 9377 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 9378 | unsigned int res) |
| 9379 | { |
| 9380 | switch (res >> 26) { |
| 9381 | case ALC880_HP_EVENT: |
| 9382 | alc861vd_lenovo_hp_automute(codec); |
| 9383 | break; |
| 9384 | case ALC880_MIC_EVENT: |
| 9385 | alc861vd_lenovo_mic_automute(codec); |
| 9386 | break; |
| 9387 | } |
| 9388 | } |
| 9389 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 9390 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 9391 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9392 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9393 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9394 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9395 | |
| 9396 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9397 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9398 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9399 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9400 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9401 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9402 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9403 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9404 | |
| 9405 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9406 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9407 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9408 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9409 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9410 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9411 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9412 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9413 | |
| 9414 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 9415 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9416 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 9417 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9418 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9419 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9420 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9421 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9422 | |
| 9423 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9424 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9425 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9426 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9427 | |
| 9428 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9429 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9430 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9431 | |
| 9432 | { } /* end */ |
| 9433 | }; |
| 9434 | |
| 9435 | /* toggle speaker-output according to the hp-jack state */ |
| 9436 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 9437 | { |
| 9438 | unsigned int present; |
| 9439 | |
| 9440 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9441 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9442 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9443 | 0x80, present ? 0x80 : 0); |
| 9444 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9445 | 0x80, present ? 0x80 : 0); |
| 9446 | } |
| 9447 | |
| 9448 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9449 | { |
| 9450 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9451 | alc861vd_dallas_automute(codec); |
| 9452 | } |
| 9453 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9454 | /* pcm configuration: identiacal with ALC880 */ |
| 9455 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 9456 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 9457 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 9458 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 9459 | |
| 9460 | /* |
| 9461 | * configuration and preset |
| 9462 | */ |
| 9463 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 9464 | [ALC660VD_3ST] = "3stack-660", |
| 9465 | [ALC861VD_3ST] = "3stack", |
| 9466 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 9467 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9468 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 9469 | [ALC861VD_DALLAS] = "dallas", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9470 | [ALC861VD_AUTO] = "auto", |
| 9471 | }; |
| 9472 | |
| 9473 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 9474 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9475 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
| 9476 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
| 9477 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 9478 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 9479 | SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS), |
| 9480 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9481 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
| 9482 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9483 | {} |
| 9484 | }; |
| 9485 | |
| 9486 | static struct alc_config_preset alc861vd_presets[] = { |
| 9487 | [ALC660VD_3ST] = { |
| 9488 | .mixers = { alc861vd_3st_mixer }, |
| 9489 | .init_verbs = { alc861vd_volume_init_verbs, |
| 9490 | alc861vd_3stack_init_verbs }, |
| 9491 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 9492 | .dac_nids = alc660vd_dac_nids, |
| 9493 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 9494 | .adc_nids = alc861vd_adc_nids, |
| 9495 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 9496 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 9497 | .input_mux = &alc861vd_capture_source, |
| 9498 | }, |
| 9499 | [ALC861VD_3ST] = { |
| 9500 | .mixers = { alc861vd_3st_mixer }, |
| 9501 | .init_verbs = { alc861vd_volume_init_verbs, |
| 9502 | alc861vd_3stack_init_verbs }, |
| 9503 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 9504 | .dac_nids = alc861vd_dac_nids, |
| 9505 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 9506 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 9507 | .input_mux = &alc861vd_capture_source, |
| 9508 | }, |
| 9509 | [ALC861VD_3ST_DIG] = { |
| 9510 | .mixers = { alc861vd_3st_mixer }, |
| 9511 | .init_verbs = { alc861vd_volume_init_verbs, |
| 9512 | alc861vd_3stack_init_verbs }, |
| 9513 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 9514 | .dac_nids = alc861vd_dac_nids, |
| 9515 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 9516 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 9517 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 9518 | .input_mux = &alc861vd_capture_source, |
| 9519 | }, |
| 9520 | [ALC861VD_6ST_DIG] = { |
| 9521 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 9522 | .init_verbs = { alc861vd_volume_init_verbs, |
| 9523 | alc861vd_6stack_init_verbs }, |
| 9524 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 9525 | .dac_nids = alc861vd_dac_nids, |
| 9526 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 9527 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 9528 | .channel_mode = alc861vd_6stack_modes, |
| 9529 | .input_mux = &alc861vd_capture_source, |
| 9530 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9531 | [ALC861VD_LENOVO] = { |
| 9532 | .mixers = { alc861vd_lenovo_mixer }, |
| 9533 | .init_verbs = { alc861vd_volume_init_verbs, |
| 9534 | alc861vd_3stack_init_verbs, |
| 9535 | alc861vd_eapd_verbs, |
| 9536 | alc861vd_lenovo_unsol_verbs }, |
| 9537 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 9538 | .dac_nids = alc660vd_dac_nids, |
| 9539 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 9540 | .adc_nids = alc861vd_adc_nids, |
| 9541 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 9542 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 9543 | .input_mux = &alc861vd_capture_source, |
| 9544 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 9545 | .init_hook = alc861vd_lenovo_automute, |
| 9546 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame^] | 9547 | [ALC861VD_DALLAS] = { |
| 9548 | .mixers = { alc861vd_dallas_mixer }, |
| 9549 | .init_verbs = { alc861vd_dallas_verbs }, |
| 9550 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 9551 | .dac_nids = alc861vd_dac_nids, |
| 9552 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 9553 | .adc_nids = alc861vd_adc_nids, |
| 9554 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 9555 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 9556 | .input_mux = &alc861vd_dallas_capture_source, |
| 9557 | .unsol_event = alc861vd_dallas_unsol_event, |
| 9558 | .init_hook = alc861vd_dallas_automute, |
| 9559 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9560 | }; |
| 9561 | |
| 9562 | /* |
| 9563 | * BIOS auto configuration |
| 9564 | */ |
| 9565 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9566 | hda_nid_t nid, int pin_type, int dac_idx) |
| 9567 | { |
| 9568 | /* set as output */ |
| 9569 | snd_hda_codec_write(codec, nid, 0, |
| 9570 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 9571 | snd_hda_codec_write(codec, nid, 0, |
| 9572 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 9573 | } |
| 9574 | |
| 9575 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 9576 | { |
| 9577 | struct alc_spec *spec = codec->spec; |
| 9578 | int i; |
| 9579 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9580 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9581 | for (i = 0; i <= HDA_SIDE; i++) { |
| 9582 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9583 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9584 | if (nid) |
| 9585 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9586 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9587 | } |
| 9588 | } |
| 9589 | |
| 9590 | |
| 9591 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 9592 | { |
| 9593 | struct alc_spec *spec = codec->spec; |
| 9594 | hda_nid_t pin; |
| 9595 | |
| 9596 | pin = spec->autocfg.hp_pins[0]; |
| 9597 | if (pin) /* connect to front and use dac 0 */ |
| 9598 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 9599 | } |
| 9600 | |
| 9601 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9602 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 9603 | |
| 9604 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 9605 | { |
| 9606 | struct alc_spec *spec = codec->spec; |
| 9607 | int i; |
| 9608 | |
| 9609 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9610 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9611 | if (alc861vd_is_input_pin(nid)) { |
| 9612 | snd_hda_codec_write(codec, nid, 0, |
| 9613 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9614 | i <= AUTO_PIN_FRONT_MIC ? |
| 9615 | PIN_VREF80 : PIN_IN); |
| 9616 | if (nid != ALC861VD_PIN_CD_NID) |
| 9617 | snd_hda_codec_write(codec, nid, 0, |
| 9618 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9619 | AMP_OUT_MUTE); |
| 9620 | } |
| 9621 | } |
| 9622 | } |
| 9623 | |
| 9624 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 9625 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 9626 | |
| 9627 | /* add playback controls from the parsed DAC table */ |
| 9628 | /* Based on ALC880 version. But ALC861VD has separate, |
| 9629 | * different NIDs for mute/unmute switch and volume control */ |
| 9630 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9631 | const struct auto_pin_cfg *cfg) |
| 9632 | { |
| 9633 | char name[32]; |
| 9634 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 9635 | hda_nid_t nid_v, nid_s; |
| 9636 | int i, err; |
| 9637 | |
| 9638 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9639 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9640 | continue; |
| 9641 | nid_v = alc861vd_idx_to_mixer_vol( |
| 9642 | alc880_dac_to_idx( |
| 9643 | spec->multiout.dac_nids[i])); |
| 9644 | nid_s = alc861vd_idx_to_mixer_switch( |
| 9645 | alc880_dac_to_idx( |
| 9646 | spec->multiout.dac_nids[i])); |
| 9647 | |
| 9648 | if (i == 2) { |
| 9649 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9650 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9651 | "Center Playback Volume", |
| 9652 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 9653 | HDA_OUTPUT)); |
| 9654 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9655 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9656 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9657 | "LFE Playback Volume", |
| 9658 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 9659 | HDA_OUTPUT)); |
| 9660 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9661 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9662 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9663 | "Center Playback Switch", |
| 9664 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 9665 | HDA_INPUT)); |
| 9666 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9667 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9668 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9669 | "LFE Playback Switch", |
| 9670 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 9671 | HDA_INPUT)); |
| 9672 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9673 | return err; |
| 9674 | } else { |
| 9675 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9676 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9677 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 9678 | HDA_OUTPUT)); |
| 9679 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9680 | return err; |
| 9681 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9682 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9683 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9684 | HDA_INPUT)); |
| 9685 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9686 | return err; |
| 9687 | } |
| 9688 | } |
| 9689 | return 0; |
| 9690 | } |
| 9691 | |
| 9692 | /* add playback controls for speaker and HP outputs */ |
| 9693 | /* Based on ALC880 version. But ALC861VD has separate, |
| 9694 | * different NIDs for mute/unmute switch and volume control */ |
| 9695 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 9696 | hda_nid_t pin, const char *pfx) |
| 9697 | { |
| 9698 | hda_nid_t nid_v, nid_s; |
| 9699 | int err; |
| 9700 | char name[32]; |
| 9701 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9702 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9703 | return 0; |
| 9704 | |
| 9705 | if (alc880_is_fixed_pin(pin)) { |
| 9706 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 9707 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9708 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9709 | spec->multiout.hp_nid = nid_v; |
| 9710 | else |
| 9711 | spec->multiout.extra_out_nid[0] = nid_v; |
| 9712 | /* control HP volume/switch on the output mixer amp */ |
| 9713 | nid_v = alc861vd_idx_to_mixer_vol( |
| 9714 | alc880_fixed_pin_idx(pin)); |
| 9715 | nid_s = alc861vd_idx_to_mixer_switch( |
| 9716 | alc880_fixed_pin_idx(pin)); |
| 9717 | |
| 9718 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9719 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9720 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 9721 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9722 | return err; |
| 9723 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9724 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 9725 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 9726 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9727 | return err; |
| 9728 | } else if (alc880_is_multi_pin(pin)) { |
| 9729 | /* set manual connection */ |
| 9730 | /* we have only a switch on HP-out PIN */ |
| 9731 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9732 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 9733 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 9734 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9735 | return err; |
| 9736 | } |
| 9737 | return 0; |
| 9738 | } |
| 9739 | |
| 9740 | /* parse the BIOS configuration and set up the alc_spec |
| 9741 | * return 1 if successful, 0 if the proper config is not found, |
| 9742 | * or a negative error code |
| 9743 | * Based on ALC880 version - had to change it to override |
| 9744 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 9745 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 9746 | { |
| 9747 | struct alc_spec *spec = codec->spec; |
| 9748 | int err; |
| 9749 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 9750 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9751 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9752 | alc861vd_ignore); |
| 9753 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9754 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9755 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9756 | return 0; /* can't find valid BIOS pin config */ |
| 9757 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9758 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9759 | if (err < 0) |
| 9760 | return err; |
| 9761 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9762 | if (err < 0) |
| 9763 | return err; |
| 9764 | err = alc861vd_auto_create_extra_out(spec, |
| 9765 | spec->autocfg.speaker_pins[0], |
| 9766 | "Speaker"); |
| 9767 | if (err < 0) |
| 9768 | return err; |
| 9769 | err = alc861vd_auto_create_extra_out(spec, |
| 9770 | spec->autocfg.hp_pins[0], |
| 9771 | "Headphone"); |
| 9772 | if (err < 0) |
| 9773 | return err; |
| 9774 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9775 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9776 | return err; |
| 9777 | |
| 9778 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9779 | |
| 9780 | if (spec->autocfg.dig_out_pin) |
| 9781 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 9782 | |
| 9783 | if (spec->kctl_alloc) |
| 9784 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9785 | |
| 9786 | spec->init_verbs[spec->num_init_verbs++] |
| 9787 | = alc861vd_volume_init_verbs; |
| 9788 | |
| 9789 | spec->num_mux_defs = 1; |
| 9790 | spec->input_mux = &spec->private_imux; |
| 9791 | |
| 9792 | return 1; |
| 9793 | } |
| 9794 | |
| 9795 | /* additional initialization for auto-configuration model */ |
| 9796 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 9797 | { |
| 9798 | alc861vd_auto_init_multi_out(codec); |
| 9799 | alc861vd_auto_init_hp_out(codec); |
| 9800 | alc861vd_auto_init_analog_input(codec); |
| 9801 | } |
| 9802 | |
| 9803 | static int patch_alc861vd(struct hda_codec *codec) |
| 9804 | { |
| 9805 | struct alc_spec *spec; |
| 9806 | int err, board_config; |
| 9807 | |
| 9808 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9809 | if (spec == NULL) |
| 9810 | return -ENOMEM; |
| 9811 | |
| 9812 | codec->spec = spec; |
| 9813 | |
| 9814 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 9815 | alc861vd_models, |
| 9816 | alc861vd_cfg_tbl); |
| 9817 | |
| 9818 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 9819 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 9820 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 9821 | board_config = ALC861VD_AUTO; |
| 9822 | } |
| 9823 | |
| 9824 | if (board_config == ALC861VD_AUTO) { |
| 9825 | /* automatic parse from the BIOS config */ |
| 9826 | err = alc861vd_parse_auto_config(codec); |
| 9827 | if (err < 0) { |
| 9828 | alc_free(codec); |
| 9829 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9830 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9831 | printk(KERN_INFO |
| 9832 | "hda_codec: Cannot set up configuration " |
| 9833 | "from BIOS. Using base mode...\n"); |
| 9834 | board_config = ALC861VD_3ST; |
| 9835 | } |
| 9836 | } |
| 9837 | |
| 9838 | if (board_config != ALC861VD_AUTO) |
| 9839 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 9840 | |
| 9841 | spec->stream_name_analog = "ALC861VD Analog"; |
| 9842 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 9843 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 9844 | |
| 9845 | spec->stream_name_digital = "ALC861VD Digital"; |
| 9846 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 9847 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 9848 | |
| 9849 | spec->adc_nids = alc861vd_adc_nids; |
| 9850 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 9851 | |
| 9852 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 9853 | spec->num_mixers++; |
| 9854 | |
| 9855 | codec->patch_ops = alc_patch_ops; |
| 9856 | |
| 9857 | if (board_config == ALC861VD_AUTO) |
| 9858 | spec->init_hook = alc861vd_auto_init; |
| 9859 | |
| 9860 | return 0; |
| 9861 | } |
| 9862 | |
| 9863 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9864 | * ALC662 support |
| 9865 | * |
| 9866 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 9867 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 9868 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 9869 | * 6-channel independent captures. |
| 9870 | * |
| 9871 | * In addition, an independent DAC for the multi-playback (not used in this |
| 9872 | * driver yet). |
| 9873 | */ |
| 9874 | #define ALC662_DIGOUT_NID 0x06 |
| 9875 | #define ALC662_DIGIN_NID 0x0a |
| 9876 | |
| 9877 | static hda_nid_t alc662_dac_nids[4] = { |
| 9878 | /* front, rear, clfe, rear_surr */ |
| 9879 | 0x02, 0x03, 0x04 |
| 9880 | }; |
| 9881 | |
| 9882 | static hda_nid_t alc662_adc_nids[1] = { |
| 9883 | /* ADC1-2 */ |
| 9884 | 0x09, |
| 9885 | }; |
| 9886 | /* input MUX */ |
| 9887 | /* FIXME: should be a matrix-type input source selection */ |
| 9888 | |
| 9889 | static struct hda_input_mux alc662_capture_source = { |
| 9890 | .num_items = 4, |
| 9891 | .items = { |
| 9892 | { "Mic", 0x0 }, |
| 9893 | { "Front Mic", 0x1 }, |
| 9894 | { "Line", 0x2 }, |
| 9895 | { "CD", 0x4 }, |
| 9896 | }, |
| 9897 | }; |
| 9898 | |
| 9899 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 9900 | .num_items = 2, |
| 9901 | .items = { |
| 9902 | { "Mic", 0x1 }, |
| 9903 | { "Line", 0x2 }, |
| 9904 | }, |
| 9905 | }; |
| 9906 | #define alc662_mux_enum_info alc_mux_enum_info |
| 9907 | #define alc662_mux_enum_get alc_mux_enum_get |
| 9908 | |
| 9909 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9910 | struct snd_ctl_elem_value *ucontrol) |
| 9911 | { |
| 9912 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9913 | struct alc_spec *spec = codec->spec; |
| 9914 | const struct hda_input_mux *imux = spec->input_mux; |
| 9915 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9916 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 9917 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 9918 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 9919 | unsigned int i, idx; |
| 9920 | |
| 9921 | idx = ucontrol->value.enumerated.item[0]; |
| 9922 | if (idx >= imux->num_items) |
| 9923 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9924 | if (*cur_val == idx && !codec->in_resume) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9925 | return 0; |
| 9926 | for (i = 0; i < imux->num_items; i++) { |
| 9927 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 9928 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 9929 | v | (imux->items[i].index << 8)); |
| 9930 | } |
| 9931 | *cur_val = idx; |
| 9932 | return 1; |
| 9933 | } |
| 9934 | /* |
| 9935 | * 2ch mode |
| 9936 | */ |
| 9937 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 9938 | { 2, NULL } |
| 9939 | }; |
| 9940 | |
| 9941 | /* |
| 9942 | * 2ch mode |
| 9943 | */ |
| 9944 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 9945 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9946 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9947 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9948 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9949 | { } /* end */ |
| 9950 | }; |
| 9951 | |
| 9952 | /* |
| 9953 | * 6ch mode |
| 9954 | */ |
| 9955 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 9956 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9957 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9958 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 9959 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9960 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9961 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9962 | { } /* end */ |
| 9963 | }; |
| 9964 | |
| 9965 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 9966 | { 2, alc662_3ST_ch2_init }, |
| 9967 | { 6, alc662_3ST_ch6_init }, |
| 9968 | }; |
| 9969 | |
| 9970 | /* |
| 9971 | * 2ch mode |
| 9972 | */ |
| 9973 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 9974 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9975 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9976 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9977 | { } /* end */ |
| 9978 | }; |
| 9979 | |
| 9980 | /* |
| 9981 | * 6ch mode |
| 9982 | */ |
| 9983 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 9984 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9985 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9986 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9987 | { } /* end */ |
| 9988 | }; |
| 9989 | |
| 9990 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 9991 | { 2, alc662_sixstack_ch6_init }, |
| 9992 | { 6, alc662_sixstack_ch8_init }, |
| 9993 | }; |
| 9994 | |
| 9995 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 9996 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 9997 | */ |
| 9998 | |
| 9999 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 10000 | /* output mixer control */ |
| 10001 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10002 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 10003 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10004 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10005 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 10006 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 10007 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 10008 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 10009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10010 | |
| 10011 | /*Input mixer control */ |
| 10012 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 10013 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 10014 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 10015 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 10016 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 10017 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 10018 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 10019 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
| 10020 | |
| 10021 | /* Capture mixer control */ |
| 10022 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10023 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10024 | { |
| 10025 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10026 | .name = "Capture Source", |
| 10027 | .count = 1, |
| 10028 | .info = alc_mux_enum_info, |
| 10029 | .get = alc_mux_enum_get, |
| 10030 | .put = alc_mux_enum_put, |
| 10031 | }, |
| 10032 | { } /* end */ |
| 10033 | }; |
| 10034 | |
| 10035 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 10036 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10037 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10038 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10039 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10040 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10041 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10042 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10043 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10044 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10045 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10046 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10047 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10048 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10049 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10050 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10051 | { |
| 10052 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10053 | /* .name = "Capture Source", */ |
| 10054 | .name = "Input Source", |
| 10055 | .count = 1, |
| 10056 | .info = alc662_mux_enum_info, |
| 10057 | .get = alc662_mux_enum_get, |
| 10058 | .put = alc662_mux_enum_put, |
| 10059 | }, |
| 10060 | { } /* end */ |
| 10061 | }; |
| 10062 | |
| 10063 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 10064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10065 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10066 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10067 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 10068 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 10069 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 10070 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 10071 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 10072 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10073 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10074 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10075 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10076 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10077 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10078 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10079 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10080 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10081 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10082 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10083 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10084 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10085 | { |
| 10086 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10087 | /* .name = "Capture Source", */ |
| 10088 | .name = "Input Source", |
| 10089 | .count = 1, |
| 10090 | .info = alc662_mux_enum_info, |
| 10091 | .get = alc662_mux_enum_get, |
| 10092 | .put = alc662_mux_enum_put, |
| 10093 | }, |
| 10094 | { } /* end */ |
| 10095 | }; |
| 10096 | |
| 10097 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 10098 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10099 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10100 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10101 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT), |
| 10102 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10103 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10104 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10106 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10107 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10108 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10109 | { |
| 10110 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10111 | /* .name = "Capture Source", */ |
| 10112 | .name = "Input Source", |
| 10113 | .count = 1, |
| 10114 | .info = alc662_mux_enum_info, |
| 10115 | .get = alc662_mux_enum_get, |
| 10116 | .put = alc662_mux_enum_put, |
| 10117 | }, |
| 10118 | { } /* end */ |
| 10119 | }; |
| 10120 | |
| 10121 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 10122 | { |
| 10123 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10124 | .name = "Channel Mode", |
| 10125 | .info = alc_ch_mode_info, |
| 10126 | .get = alc_ch_mode_get, |
| 10127 | .put = alc_ch_mode_put, |
| 10128 | }, |
| 10129 | { } /* end */ |
| 10130 | }; |
| 10131 | |
| 10132 | static struct hda_verb alc662_init_verbs[] = { |
| 10133 | /* ADC: mute amp left and right */ |
| 10134 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10135 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10136 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 10137 | |
| 10138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10139 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10140 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10141 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 10142 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10143 | |
| 10144 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10145 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10146 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10147 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10148 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10149 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10150 | |
| 10151 | /* Front Pin: output 0 (0x0c) */ |
| 10152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10153 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10154 | |
| 10155 | /* Rear Pin: output 1 (0x0d) */ |
| 10156 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10157 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10158 | |
| 10159 | /* CLFE Pin: output 2 (0x0e) */ |
| 10160 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10161 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10162 | |
| 10163 | /* Mic (rear) pin: input vref at 80% */ |
| 10164 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10165 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10166 | /* Front Mic pin: input vref at 80% */ |
| 10167 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10168 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10169 | /* Line In pin: input */ |
| 10170 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10171 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10172 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10173 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10174 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10175 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10176 | /* CD pin widget for input */ |
| 10177 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10178 | |
| 10179 | /* FIXME: use matrix-type input source selection */ |
| 10180 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10181 | /* Input mixer */ |
| 10182 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10183 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10186 | { } |
| 10187 | }; |
| 10188 | |
| 10189 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 10190 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 10191 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 10192 | {} |
| 10193 | }; |
| 10194 | |
| 10195 | /* |
| 10196 | * generic initialization of ADC, input mixers and output mixers |
| 10197 | */ |
| 10198 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 10199 | /* |
| 10200 | * Unmute ADC and set the default input to mic-in |
| 10201 | */ |
| 10202 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10204 | |
| 10205 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 10206 | * mixer widget |
| 10207 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10208 | * panel mic (mic 2) |
| 10209 | */ |
| 10210 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10211 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10212 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10213 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10214 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 10215 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10216 | |
| 10217 | /* |
| 10218 | * Set up output mixers (0x0c - 0x0f) |
| 10219 | */ |
| 10220 | /* set vol=0 to output mixers */ |
| 10221 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10222 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10223 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10224 | |
| 10225 | /* set up input amps for analog loopback */ |
| 10226 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10227 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10228 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10229 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10230 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10231 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10232 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10233 | |
| 10234 | |
| 10235 | /* FIXME: use matrix-type input source selection */ |
| 10236 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10237 | /* Input mixer */ |
| 10238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10241 | /*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/ |
| 10242 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10243 | |
| 10244 | { } |
| 10245 | }; |
| 10246 | |
| 10247 | /* capture mixer elements */ |
| 10248 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 10249 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10250 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10251 | { |
| 10252 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10253 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10254 | * So call somewhat different.. |
| 10255 | * FIXME: the controls appear in the "playback" view! |
| 10256 | */ |
| 10257 | /* .name = "Capture Source", */ |
| 10258 | .name = "Input Source", |
| 10259 | .count = 1, |
| 10260 | .info = alc882_mux_enum_info, |
| 10261 | .get = alc882_mux_enum_get, |
| 10262 | .put = alc882_mux_enum_put, |
| 10263 | }, |
| 10264 | { } /* end */ |
| 10265 | }; |
| 10266 | |
| 10267 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 10268 | { |
| 10269 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10270 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10271 | |
| 10272 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10273 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10274 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10275 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10276 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10277 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10278 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10279 | } |
| 10280 | |
| 10281 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 10282 | { |
| 10283 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10284 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10285 | |
| 10286 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 10287 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10288 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10289 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10290 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10291 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10292 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10293 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10294 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10295 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10296 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10297 | } |
| 10298 | |
| 10299 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 10300 | unsigned int res) |
| 10301 | { |
| 10302 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10303 | alc662_lenovo_101e_all_automute(codec); |
| 10304 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 10305 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 10306 | } |
| 10307 | |
| 10308 | |
| 10309 | /* pcm configuration: identiacal with ALC880 */ |
| 10310 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 10311 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 10312 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 10313 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 10314 | |
| 10315 | /* |
| 10316 | * configuration and preset |
| 10317 | */ |
| 10318 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 10319 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 10320 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 10321 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 10322 | [ALC662_5ST_DIG] = "6stack-dig", |
| 10323 | [ALC662_LENOVO_101E] = "lenovo-101e", |
| 10324 | [ALC662_AUTO] = "auto", |
| 10325 | }; |
| 10326 | |
| 10327 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
| 10328 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
| 10329 | {} |
| 10330 | }; |
| 10331 | |
| 10332 | static struct alc_config_preset alc662_presets[] = { |
| 10333 | [ALC662_3ST_2ch_DIG] = { |
| 10334 | .mixers = { alc662_3ST_2ch_mixer }, |
| 10335 | .init_verbs = { alc662_init_verbs }, |
| 10336 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10337 | .dac_nids = alc662_dac_nids, |
| 10338 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 10339 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10340 | .adc_nids = alc662_adc_nids, |
| 10341 | .dig_in_nid = ALC662_DIGIN_NID, |
| 10342 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 10343 | .channel_mode = alc662_3ST_2ch_modes, |
| 10344 | .input_mux = &alc662_capture_source, |
| 10345 | }, |
| 10346 | [ALC662_3ST_6ch_DIG] = { |
| 10347 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 10348 | .init_verbs = { alc662_init_verbs }, |
| 10349 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10350 | .dac_nids = alc662_dac_nids, |
| 10351 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 10352 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10353 | .adc_nids = alc662_adc_nids, |
| 10354 | .dig_in_nid = ALC662_DIGIN_NID, |
| 10355 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 10356 | .channel_mode = alc662_3ST_6ch_modes, |
| 10357 | .need_dac_fix = 1, |
| 10358 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10359 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10360 | [ALC662_3ST_6ch] = { |
| 10361 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 10362 | .init_verbs = { alc662_init_verbs }, |
| 10363 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10364 | .dac_nids = alc662_dac_nids, |
| 10365 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10366 | .adc_nids = alc662_adc_nids, |
| 10367 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 10368 | .channel_mode = alc662_3ST_6ch_modes, |
| 10369 | .need_dac_fix = 1, |
| 10370 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10371 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10372 | [ALC662_5ST_DIG] = { |
| 10373 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
| 10374 | .init_verbs = { alc662_init_verbs }, |
| 10375 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10376 | .dac_nids = alc662_dac_nids, |
| 10377 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 10378 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10379 | .adc_nids = alc662_adc_nids, |
| 10380 | .dig_in_nid = ALC662_DIGIN_NID, |
| 10381 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 10382 | .channel_mode = alc662_5stack_modes, |
| 10383 | .input_mux = &alc662_capture_source, |
| 10384 | }, |
| 10385 | [ALC662_LENOVO_101E] = { |
| 10386 | .mixers = { alc662_lenovo_101e_mixer }, |
| 10387 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 10388 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10389 | .dac_nids = alc662_dac_nids, |
| 10390 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10391 | .adc_nids = alc662_adc_nids, |
| 10392 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 10393 | .channel_mode = alc662_3ST_2ch_modes, |
| 10394 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 10395 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 10396 | .init_hook = alc662_lenovo_101e_all_automute, |
| 10397 | }, |
| 10398 | |
| 10399 | }; |
| 10400 | |
| 10401 | |
| 10402 | /* |
| 10403 | * BIOS auto configuration |
| 10404 | */ |
| 10405 | |
| 10406 | /* add playback controls from the parsed DAC table */ |
| 10407 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10408 | const struct auto_pin_cfg *cfg) |
| 10409 | { |
| 10410 | char name[32]; |
| 10411 | static const char *chname[4] = { |
| 10412 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 10413 | }; |
| 10414 | hda_nid_t nid; |
| 10415 | int i, err; |
| 10416 | |
| 10417 | for (i = 0; i < cfg->line_outs; i++) { |
| 10418 | if (!spec->multiout.dac_nids[i]) |
| 10419 | continue; |
| 10420 | nid = alc880_idx_to_dac(i); |
| 10421 | if (i == 2) { |
| 10422 | /* Center/LFE */ |
| 10423 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10424 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10425 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 10426 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10427 | if (err < 0) |
| 10428 | return err; |
| 10429 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10430 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10431 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10432 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10433 | if (err < 0) |
| 10434 | return err; |
| 10435 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10436 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10437 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 10438 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10439 | if (err < 0) |
| 10440 | return err; |
| 10441 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10442 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10443 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 10444 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10445 | if (err < 0) |
| 10446 | return err; |
| 10447 | } else { |
| 10448 | sprintf(name, "%s Playback Volume", chname[i]); |
| 10449 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10450 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10451 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10452 | if (err < 0) |
| 10453 | return err; |
| 10454 | sprintf(name, "%s Playback Switch", chname[i]); |
| 10455 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10456 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 10457 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10458 | if (err < 0) |
| 10459 | return err; |
| 10460 | } |
| 10461 | } |
| 10462 | return 0; |
| 10463 | } |
| 10464 | |
| 10465 | /* add playback controls for speaker and HP outputs */ |
| 10466 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 10467 | const char *pfx) |
| 10468 | { |
| 10469 | hda_nid_t nid; |
| 10470 | int err; |
| 10471 | char name[32]; |
| 10472 | |
| 10473 | if (!pin) |
| 10474 | return 0; |
| 10475 | |
| 10476 | if (alc880_is_fixed_pin(pin)) { |
| 10477 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 10478 | /* printk("DAC nid=%x\n",nid); */ |
| 10479 | /* specify the DAC as the extra output */ |
| 10480 | if (!spec->multiout.hp_nid) |
| 10481 | spec->multiout.hp_nid = nid; |
| 10482 | else |
| 10483 | spec->multiout.extra_out_nid[0] = nid; |
| 10484 | /* control HP volume/switch on the output mixer amp */ |
| 10485 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 10486 | sprintf(name, "%s Playback Volume", pfx); |
| 10487 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10488 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10489 | if (err < 0) |
| 10490 | return err; |
| 10491 | sprintf(name, "%s Playback Switch", pfx); |
| 10492 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 10493 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 10494 | if (err < 0) |
| 10495 | return err; |
| 10496 | } else if (alc880_is_multi_pin(pin)) { |
| 10497 | /* set manual connection */ |
| 10498 | /* we have only a switch on HP-out PIN */ |
| 10499 | sprintf(name, "%s Playback Switch", pfx); |
| 10500 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10501 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 10502 | if (err < 0) |
| 10503 | return err; |
| 10504 | } |
| 10505 | return 0; |
| 10506 | } |
| 10507 | |
| 10508 | /* create playback/capture controls for input pins */ |
| 10509 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10510 | const struct auto_pin_cfg *cfg) |
| 10511 | { |
| 10512 | struct hda_input_mux *imux = &spec->private_imux; |
| 10513 | int i, err, idx; |
| 10514 | |
| 10515 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10516 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 10517 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 10518 | err = new_analog_input(spec, cfg->input_pins[i], |
| 10519 | auto_pin_cfg_labels[i], |
| 10520 | idx, 0x0b); |
| 10521 | if (err < 0) |
| 10522 | return err; |
| 10523 | imux->items[imux->num_items].label = |
| 10524 | auto_pin_cfg_labels[i]; |
| 10525 | imux->items[imux->num_items].index = |
| 10526 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 10527 | imux->num_items++; |
| 10528 | } |
| 10529 | } |
| 10530 | return 0; |
| 10531 | } |
| 10532 | |
| 10533 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 10534 | hda_nid_t nid, int pin_type, |
| 10535 | int dac_idx) |
| 10536 | { |
| 10537 | /* set as output */ |
| 10538 | snd_hda_codec_write(codec, nid, 0, |
| 10539 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 10540 | snd_hda_codec_write(codec, nid, 0, |
| 10541 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 10542 | /* need the manual connection? */ |
| 10543 | if (alc880_is_multi_pin(nid)) { |
| 10544 | struct alc_spec *spec = codec->spec; |
| 10545 | int idx = alc880_multi_pin_idx(nid); |
| 10546 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 10547 | AC_VERB_SET_CONNECT_SEL, |
| 10548 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 10549 | } |
| 10550 | } |
| 10551 | |
| 10552 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 10553 | { |
| 10554 | struct alc_spec *spec = codec->spec; |
| 10555 | int i; |
| 10556 | |
| 10557 | for (i = 0; i <= HDA_SIDE; i++) { |
| 10558 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10559 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10560 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10561 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10562 | i); |
| 10563 | } |
| 10564 | } |
| 10565 | |
| 10566 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 10567 | { |
| 10568 | struct alc_spec *spec = codec->spec; |
| 10569 | hda_nid_t pin; |
| 10570 | |
| 10571 | pin = spec->autocfg.hp_pins[0]; |
| 10572 | if (pin) /* connect to front */ |
| 10573 | /* use dac 0 */ |
| 10574 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 10575 | } |
| 10576 | |
| 10577 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 10578 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 10579 | |
| 10580 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 10581 | { |
| 10582 | struct alc_spec *spec = codec->spec; |
| 10583 | int i; |
| 10584 | |
| 10585 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10586 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 10587 | if (alc662_is_input_pin(nid)) { |
| 10588 | snd_hda_codec_write(codec, nid, 0, |
| 10589 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10590 | (i <= AUTO_PIN_FRONT_MIC ? |
| 10591 | PIN_VREF80 : PIN_IN)); |
| 10592 | if (nid != ALC662_PIN_CD_NID) |
| 10593 | snd_hda_codec_write(codec, nid, 0, |
| 10594 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10595 | AMP_OUT_MUTE); |
| 10596 | } |
| 10597 | } |
| 10598 | } |
| 10599 | |
| 10600 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 10601 | { |
| 10602 | struct alc_spec *spec = codec->spec; |
| 10603 | int err; |
| 10604 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 10605 | |
| 10606 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10607 | alc662_ignore); |
| 10608 | if (err < 0) |
| 10609 | return err; |
| 10610 | if (!spec->autocfg.line_outs) |
| 10611 | return 0; /* can't find valid BIOS pin config */ |
| 10612 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10613 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10614 | if (err < 0) |
| 10615 | return err; |
| 10616 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10617 | if (err < 0) |
| 10618 | return err; |
| 10619 | err = alc662_auto_create_extra_out(spec, |
| 10620 | spec->autocfg.speaker_pins[0], |
| 10621 | "Speaker"); |
| 10622 | if (err < 0) |
| 10623 | return err; |
| 10624 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10625 | "Headphone"); |
| 10626 | if (err < 0) |
| 10627 | return err; |
| 10628 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10629 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10630 | return err; |
| 10631 | |
| 10632 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10633 | |
| 10634 | if (spec->autocfg.dig_out_pin) |
| 10635 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 10636 | |
| 10637 | if (spec->kctl_alloc) |
| 10638 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10639 | |
| 10640 | spec->num_mux_defs = 1; |
| 10641 | spec->input_mux = &spec->private_imux; |
| 10642 | |
| 10643 | if (err < 0) |
| 10644 | return err; |
| 10645 | else if (err > 0) |
| 10646 | /* hack - override the init verbs */ |
| 10647 | spec->init_verbs[0] = alc662_auto_init_verbs; |
| 10648 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 10649 | spec->num_mixers++; |
| 10650 | return err; |
| 10651 | } |
| 10652 | |
| 10653 | /* additional initialization for auto-configuration model */ |
| 10654 | static void alc662_auto_init(struct hda_codec *codec) |
| 10655 | { |
| 10656 | alc662_auto_init_multi_out(codec); |
| 10657 | alc662_auto_init_hp_out(codec); |
| 10658 | alc662_auto_init_analog_input(codec); |
| 10659 | } |
| 10660 | |
| 10661 | static int patch_alc662(struct hda_codec *codec) |
| 10662 | { |
| 10663 | struct alc_spec *spec; |
| 10664 | int err, board_config; |
| 10665 | |
| 10666 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10667 | if (!spec) |
| 10668 | return -ENOMEM; |
| 10669 | |
| 10670 | codec->spec = spec; |
| 10671 | |
| 10672 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 10673 | alc662_models, |
| 10674 | alc662_cfg_tbl); |
| 10675 | if (board_config < 0) { |
| 10676 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 10677 | "trying auto-probe from BIOS...\n"); |
| 10678 | board_config = ALC662_AUTO; |
| 10679 | } |
| 10680 | |
| 10681 | if (board_config == ALC662_AUTO) { |
| 10682 | /* automatic parse from the BIOS config */ |
| 10683 | err = alc662_parse_auto_config(codec); |
| 10684 | if (err < 0) { |
| 10685 | alc_free(codec); |
| 10686 | return err; |
| 10687 | } else if (err) { |
| 10688 | printk(KERN_INFO |
| 10689 | "hda_codec: Cannot set up configuration " |
| 10690 | "from BIOS. Using base mode...\n"); |
| 10691 | board_config = ALC662_3ST_2ch_DIG; |
| 10692 | } |
| 10693 | } |
| 10694 | |
| 10695 | if (board_config != ALC662_AUTO) |
| 10696 | setup_preset(spec, &alc662_presets[board_config]); |
| 10697 | |
| 10698 | spec->stream_name_analog = "ALC662 Analog"; |
| 10699 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 10700 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 10701 | |
| 10702 | spec->stream_name_digital = "ALC662 Digital"; |
| 10703 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 10704 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 10705 | |
| 10706 | if (!spec->adc_nids && spec->input_mux) { |
| 10707 | spec->adc_nids = alc662_adc_nids; |
| 10708 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 10709 | } |
| 10710 | |
| 10711 | codec->patch_ops = alc_patch_ops; |
| 10712 | if (board_config == ALC662_AUTO) |
| 10713 | spec->init_hook = alc662_auto_init; |
| 10714 | |
| 10715 | return 0; |
| 10716 | } |
| 10717 | |
| 10718 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10719 | * patch entries |
| 10720 | */ |
| 10721 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 10722 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10723 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10724 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10725 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10726 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 10727 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 10728 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10729 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 10730 | .patch = patch_alc883 }, |
| 10731 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 10732 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10733 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10734 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10735 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10736 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10737 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10738 | {} /* terminator */ |
| 10739 | }; |