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 | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 97 | ALC262_BENQ_T31, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 98 | ALC262_AUTO, |
| 99 | ALC262_MODEL_LAST /* last tag */ |
| 100 | }; |
| 101 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 102 | /* ALC268 models */ |
| 103 | enum { |
| 104 | ALC268_3ST, |
| 105 | ALC268_AUTO, |
| 106 | ALC268_MODEL_LAST /* last tag */ |
| 107 | }; |
| 108 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | /* ALC861 models */ |
| 110 | enum { |
| 111 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 112 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 113 | ALC861_3ST_DIG, |
| 114 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 115 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 116 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 117 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 118 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 119 | ALC861_AUTO, |
| 120 | ALC861_MODEL_LAST, |
| 121 | }; |
| 122 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 123 | /* ALC861-VD models */ |
| 124 | enum { |
| 125 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 126 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 127 | ALC861VD_3ST, |
| 128 | ALC861VD_3ST_DIG, |
| 129 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 130 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 131 | ALC861VD_DALLAS, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 132 | ALC861VD_AUTO, |
| 133 | ALC861VD_MODEL_LAST, |
| 134 | }; |
| 135 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 136 | /* ALC662 models */ |
| 137 | enum { |
| 138 | ALC662_3ST_2ch_DIG, |
| 139 | ALC662_3ST_6ch_DIG, |
| 140 | ALC662_3ST_6ch, |
| 141 | ALC662_5ST_DIG, |
| 142 | ALC662_LENOVO_101E, |
| 143 | ALC662_AUTO, |
| 144 | ALC662_MODEL_LAST, |
| 145 | }; |
| 146 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 147 | /* ALC882 models */ |
| 148 | enum { |
| 149 | ALC882_3ST_DIG, |
| 150 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 151 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 152 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 153 | ALC882_TARGA, |
| 154 | ALC882_ASUS_A7J, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 155 | ALC885_MACPRO, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 156 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 157 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 158 | ALC882_MODEL_LAST, |
| 159 | }; |
| 160 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 161 | /* ALC883 models */ |
| 162 | enum { |
| 163 | ALC883_3ST_2ch_DIG, |
| 164 | ALC883_3ST_6ch_DIG, |
| 165 | ALC883_3ST_6ch, |
| 166 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 167 | ALC883_TARGA_DIG, |
| 168 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 169 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame^] | 170 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 171 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 172 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 173 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 174 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 175 | ALC883_LENOVO_NB0763, |
| 176 | ALC888_LENOVO_MS7195_DIG, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 177 | ALC888_6ST_HP, |
| 178 | ALC888_3ST_HP, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 179 | ALC883_AUTO, |
| 180 | ALC883_MODEL_LAST, |
| 181 | }; |
| 182 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 183 | /* for GPIO Poll */ |
| 184 | #define GPIO_MASK 0x03 |
| 185 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | struct alc_spec { |
| 187 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 188 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | unsigned int num_mixers; |
| 190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 191 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 192 | * don't forget NULL |
| 193 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 194 | */ |
| 195 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 197 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | struct hda_pcm_stream *stream_analog_playback; |
| 199 | struct hda_pcm_stream *stream_analog_capture; |
| 200 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 201 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | struct hda_pcm_stream *stream_digital_playback; |
| 203 | struct hda_pcm_stream *stream_digital_capture; |
| 204 | |
| 205 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 206 | struct hda_multi_out multiout; /* playback set-up |
| 207 | * max_channels, dacs must be set |
| 208 | * dig_out_nid and hp_nid are optional |
| 209 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | |
| 211 | /* capture */ |
| 212 | unsigned int num_adc_nids; |
| 213 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 214 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | |
| 216 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 217 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | const struct hda_input_mux *input_mux; |
| 219 | unsigned int cur_mux[3]; |
| 220 | |
| 221 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 222 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 224 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | |
| 226 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 227 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 228 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 229 | /* dynamic controls, init_verbs and input_mux */ |
| 230 | struct auto_pin_cfg autocfg; |
| 231 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 232 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 233 | struct hda_input_mux private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 234 | hda_nid_t private_dac_nids[5]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 235 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 236 | /* hooks */ |
| 237 | void (*init_hook)(struct hda_codec *codec); |
| 238 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 239 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 240 | /* for pin sensing */ |
| 241 | unsigned int sense_updated: 1; |
| 242 | unsigned int jack_present: 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 243 | }; |
| 244 | |
| 245 | /* |
| 246 | * configuration template - to be copied to the spec instance |
| 247 | */ |
| 248 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 249 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 250 | * with spec |
| 251 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 252 | const struct hda_verb *init_verbs[5]; |
| 253 | unsigned int num_dacs; |
| 254 | hda_nid_t *dac_nids; |
| 255 | hda_nid_t dig_out_nid; /* optional */ |
| 256 | hda_nid_t hp_nid; /* optional */ |
| 257 | unsigned int num_adc_nids; |
| 258 | hda_nid_t *adc_nids; |
| 259 | hda_nid_t dig_in_nid; |
| 260 | unsigned int num_channel_mode; |
| 261 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 262 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 263 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 264 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 265 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 266 | void (*init_hook)(struct hda_codec *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | }; |
| 268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | |
| 270 | /* |
| 271 | * input MUX handling |
| 272 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 273 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 274 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | { |
| 276 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 277 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 278 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 279 | if (mux_idx >= spec->num_mux_defs) |
| 280 | mux_idx = 0; |
| 281 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | } |
| 283 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 284 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 285 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | { |
| 287 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 288 | struct alc_spec *spec = codec->spec; |
| 289 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 290 | |
| 291 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 292 | return 0; |
| 293 | } |
| 294 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 295 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 296 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | { |
| 298 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 299 | struct alc_spec *spec = codec->spec; |
| 300 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 301 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 302 | 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] | 303 | spec->adc_nids[adc_idx], |
| 304 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | } |
| 306 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 307 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | /* |
| 309 | * channel mode setting |
| 310 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 311 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 312 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | { |
| 314 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 315 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 316 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 317 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | } |
| 319 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 320 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 321 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | { |
| 323 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 324 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 325 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 326 | spec->num_channel_mode, |
| 327 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | } |
| 329 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 330 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 331 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | { |
| 333 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 334 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 335 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 336 | spec->num_channel_mode, |
| 337 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 338 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 339 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 340 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | } |
| 342 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 344 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 345 | * instead of "%" to avoid consequences of accidently treating the % as |
| 346 | * being part of a format specifier. Maximum allowed length of a value is |
| 347 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 348 | * |
| 349 | * Note: some retasking pin complexes seem to ignore requests for input |
| 350 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 351 | * are requested. Therefore order this list so that this behaviour will not |
| 352 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 353 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 354 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 355 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 356 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 357 | "Mic 50pc bias", "Mic 80pc bias", |
| 358 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 359 | }; |
| 360 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 361 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 362 | }; |
| 363 | /* 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] | 364 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 365 | * addition, "input" pins may or may not process the mic bias option |
| 366 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 367 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 368 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 369 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 370 | #define ALC_PIN_DIR_IN 0x00 |
| 371 | #define ALC_PIN_DIR_OUT 0x01 |
| 372 | #define ALC_PIN_DIR_INOUT 0x02 |
| 373 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 374 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 375 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 376 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 377 | * For each direction the minimum and maximum values are given. |
| 378 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 379 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 380 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 381 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 382 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 383 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 384 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 385 | }; |
| 386 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 387 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 388 | #define alc_pin_mode_n_items(_dir) \ |
| 389 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 390 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 391 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 392 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 393 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 394 | unsigned int item_num = uinfo->value.enumerated.item; |
| 395 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 396 | |
| 397 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 398 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 399 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 400 | |
| 401 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 402 | item_num = alc_pin_mode_min(dir); |
| 403 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 404 | return 0; |
| 405 | } |
| 406 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 407 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 408 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 409 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 410 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 411 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 412 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 413 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 414 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 415 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 416 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 417 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 418 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 419 | /* Find enumerated value for current pinctl setting */ |
| 420 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 421 | 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] | 422 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 423 | *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] | 424 | return 0; |
| 425 | } |
| 426 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 427 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 428 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 429 | { |
| 430 | signed int change; |
| 431 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 432 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 433 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 434 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 435 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 436 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 437 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 438 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 439 | 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] | 440 | val = alc_pin_mode_min(dir); |
| 441 | |
| 442 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 443 | if (change) { |
| 444 | /* Set pin mode to that requested */ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 445 | 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] | 446 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 447 | |
| 448 | /* Also enable the retasking pin's input/output as required |
| 449 | * for the requested pin mode. Enum values of 2 or less are |
| 450 | * input modes. |
| 451 | * |
| 452 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 453 | * reduces noise slightly (particularly on input) so we'll |
| 454 | * do it. However, having both input and output buffers |
| 455 | * enabled simultaneously doesn't seem to be problematic if |
| 456 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 457 | */ |
| 458 | if (val <= 2) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | snd_hda_codec_write(codec, nid, 0, |
| 460 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 461 | AMP_OUT_MUTE); |
| 462 | snd_hda_codec_write(codec, nid, 0, |
| 463 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 464 | AMP_IN_UNMUTE(0)); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 465 | } else { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | snd_hda_codec_write(codec, nid, 0, |
| 467 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 468 | AMP_IN_MUTE(0)); |
| 469 | snd_hda_codec_write(codec, nid, 0, |
| 470 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 471 | AMP_OUT_UNMUTE); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 472 | } |
| 473 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 474 | return change; |
| 475 | } |
| 476 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 477 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 478 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 479 | .info = alc_pin_mode_info, \ |
| 480 | .get = alc_pin_mode_get, \ |
| 481 | .put = alc_pin_mode_put, \ |
| 482 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 483 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 484 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 485 | * together using a mask with more than one bit set. This control is |
| 486 | * currently used only by the ALC260 test model. At this stage they are not |
| 487 | * needed for any "production" models. |
| 488 | */ |
| 489 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 490 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 491 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 492 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 493 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 494 | { |
| 495 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 496 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 497 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 498 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 499 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 500 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 501 | |
| 502 | *valp = (val & mask) != 0; |
| 503 | return 0; |
| 504 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 505 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 506 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 507 | { |
| 508 | signed int change; |
| 509 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 510 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 511 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 512 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 513 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 514 | AC_VERB_GET_GPIO_DATA, |
| 515 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 516 | |
| 517 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 518 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 519 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 520 | gpio_data &= ~mask; |
| 521 | else |
| 522 | gpio_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 523 | 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] | 524 | |
| 525 | return change; |
| 526 | } |
| 527 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 528 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 529 | .info = alc_gpio_data_info, \ |
| 530 | .get = alc_gpio_data_get, \ |
| 531 | .put = alc_gpio_data_put, \ |
| 532 | .private_value = nid | (mask<<16) } |
| 533 | #endif /* CONFIG_SND_DEBUG */ |
| 534 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 535 | /* A switch control to allow the enabling of the digital IO pins on the |
| 536 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 537 | * to provide something in the test model allowing digital outputs to be |
| 538 | * identified if present. If models are found which can utilise these |
| 539 | * outputs a more complete mixer control can be devised for those models if |
| 540 | * necessary. |
| 541 | */ |
| 542 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 543 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 544 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 545 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 546 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 547 | { |
| 548 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 549 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 550 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 551 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 552 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 553 | AC_VERB_GET_DIGI_CONVERT, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 554 | |
| 555 | *valp = (val & mask) != 0; |
| 556 | return 0; |
| 557 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 559 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 560 | { |
| 561 | signed int change; |
| 562 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 563 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 564 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 565 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 566 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 567 | AC_VERB_GET_DIGI_CONVERT, |
| 568 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 569 | |
| 570 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 571 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 572 | if (val==0) |
| 573 | ctrl_data &= ~mask; |
| 574 | else |
| 575 | ctrl_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 576 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 577 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 578 | |
| 579 | return change; |
| 580 | } |
| 581 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 582 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 583 | .info = alc_spdif_ctrl_info, \ |
| 584 | .get = alc_spdif_ctrl_get, \ |
| 585 | .put = alc_spdif_ctrl_put, \ |
| 586 | .private_value = nid | (mask<<16) } |
| 587 | #endif /* CONFIG_SND_DEBUG */ |
| 588 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 589 | /* |
| 590 | * set up from the preset table |
| 591 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 592 | static void setup_preset(struct alc_spec *spec, |
| 593 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 594 | { |
| 595 | int i; |
| 596 | |
| 597 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 598 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 599 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 600 | i++) |
| 601 | spec->init_verbs[spec->num_init_verbs++] = |
| 602 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 603 | |
| 604 | spec->channel_mode = preset->channel_mode; |
| 605 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 606 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 607 | |
| 608 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 609 | |
| 610 | spec->multiout.num_dacs = preset->num_dacs; |
| 611 | spec->multiout.dac_nids = preset->dac_nids; |
| 612 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 613 | spec->multiout.hp_nid = preset->hp_nid; |
| 614 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 615 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 616 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 617 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 618 | spec->input_mux = preset->input_mux; |
| 619 | |
| 620 | spec->num_adc_nids = preset->num_adc_nids; |
| 621 | spec->adc_nids = preset->adc_nids; |
| 622 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 623 | |
| 624 | spec->unsol_event = preset->unsol_event; |
| 625 | spec->init_hook = preset->init_hook; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 626 | } |
| 627 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 628 | /* Enable GPIO mask and set output */ |
| 629 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 630 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 631 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 632 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 633 | { } |
| 634 | }; |
| 635 | |
| 636 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 637 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 638 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 639 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 640 | { } |
| 641 | }; |
| 642 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 643 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 644 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 645 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 646 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 647 | { } |
| 648 | }; |
| 649 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 650 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 651 | * 31 ~ 16 : Manufacture ID |
| 652 | * 15 ~ 8 : SKU ID |
| 653 | * 7 ~ 0 : Assembly ID |
| 654 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 655 | */ |
| 656 | static void alc_subsystem_id(struct hda_codec *codec, |
| 657 | unsigned int porta, unsigned int porte, |
| 658 | unsigned int portd) |
| 659 | { |
| 660 | unsigned int ass, tmp; |
| 661 | |
| 662 | ass = codec->subsystem_id; |
| 663 | if (!(ass & 1)) |
| 664 | return; |
| 665 | |
| 666 | /* Override */ |
| 667 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 668 | switch (tmp) { |
| 669 | case 1: |
| 670 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 671 | break; |
| 672 | case 3: |
| 673 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 674 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 675 | case 7: |
| 676 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 677 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 678 | case 5: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 679 | switch (codec->vendor_id) { |
| 680 | case 0x10ec0862: |
| 681 | case 0x10ec0660: |
| 682 | case 0x10ec0662: |
| 683 | case 0x10ec0267: |
| 684 | case 0x10ec0268: |
| 685 | snd_hda_codec_write(codec, 0x14, 0, |
| 686 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 687 | snd_hda_codec_write(codec, 0x15, 0, |
| 688 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 689 | return; |
| 690 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 691 | case 6: |
| 692 | if (ass & 4) { /* bit 2 : 0 = Desktop, 1 = Laptop */ |
| 693 | hda_nid_t port = 0; |
| 694 | tmp = (ass & 0x1800) >> 11; |
| 695 | switch (tmp) { |
| 696 | case 0: port = porta; break; |
| 697 | case 1: port = porte; break; |
| 698 | case 2: port = portd; break; |
| 699 | } |
| 700 | if (port) |
| 701 | snd_hda_codec_write(codec, port, 0, |
| 702 | AC_VERB_SET_EAPD_BTLENABLE, |
| 703 | 2); |
| 704 | } |
| 705 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 706 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, |
| 707 | (tmp == 5 ? 0x3040 : 0x3050)); |
| 708 | break; |
| 709 | } |
| 710 | } |
| 711 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 712 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 713 | * Fix-up pin default configurations |
| 714 | */ |
| 715 | |
| 716 | struct alc_pincfg { |
| 717 | hda_nid_t nid; |
| 718 | u32 val; |
| 719 | }; |
| 720 | |
| 721 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 722 | const struct snd_pci_quirk *quirk, |
| 723 | const struct alc_pincfg **pinfix) |
| 724 | { |
| 725 | const struct alc_pincfg *cfg; |
| 726 | |
| 727 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 728 | if (!quirk) |
| 729 | return; |
| 730 | |
| 731 | cfg = pinfix[quirk->value]; |
| 732 | for (; cfg->nid; cfg++) { |
| 733 | int i; |
| 734 | u32 val = cfg->val; |
| 735 | for (i = 0; i < 4; i++) { |
| 736 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 737 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 738 | val & 0xff); |
| 739 | val >>= 8; |
| 740 | } |
| 741 | } |
| 742 | } |
| 743 | |
| 744 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 745 | * ALC880 3-stack model |
| 746 | * |
| 747 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 748 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 749 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 750 | */ |
| 751 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 752 | static hda_nid_t alc880_dac_nids[4] = { |
| 753 | /* front, rear, clfe, rear_surr */ |
| 754 | 0x02, 0x05, 0x04, 0x03 |
| 755 | }; |
| 756 | |
| 757 | static hda_nid_t alc880_adc_nids[3] = { |
| 758 | /* ADC0-2 */ |
| 759 | 0x07, 0x08, 0x09, |
| 760 | }; |
| 761 | |
| 762 | /* The datasheet says the node 0x07 is connected from inputs, |
| 763 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 764 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 765 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 766 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 767 | /* ADC1-2 */ |
| 768 | 0x08, 0x09, |
| 769 | }; |
| 770 | |
| 771 | #define ALC880_DIGOUT_NID 0x06 |
| 772 | #define ALC880_DIGIN_NID 0x0a |
| 773 | |
| 774 | static struct hda_input_mux alc880_capture_source = { |
| 775 | .num_items = 4, |
| 776 | .items = { |
| 777 | { "Mic", 0x0 }, |
| 778 | { "Front Mic", 0x3 }, |
| 779 | { "Line", 0x2 }, |
| 780 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 781 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 782 | }; |
| 783 | |
| 784 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 785 | /* 2ch mode */ |
| 786 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 787 | /* set line-in to input, mute it */ |
| 788 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 789 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 790 | /* set mic-in to input vref 80%, mute it */ |
| 791 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 792 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 793 | { } /* end */ |
| 794 | }; |
| 795 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 796 | /* 6ch mode */ |
| 797 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 798 | /* set line-in to output, unmute it */ |
| 799 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 800 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 801 | /* set mic-in to output, unmute it */ |
| 802 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 803 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 804 | { } /* end */ |
| 805 | }; |
| 806 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 807 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 808 | { 2, alc880_threestack_ch2_init }, |
| 809 | { 6, alc880_threestack_ch6_init }, |
| 810 | }; |
| 811 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 812 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 813 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 814 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 815 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 816 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 817 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 818 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 819 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 820 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 821 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 822 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 823 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 824 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 827 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 828 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 829 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 830 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 831 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 832 | { |
| 833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 834 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 835 | .info = alc_ch_mode_info, |
| 836 | .get = alc_ch_mode_get, |
| 837 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 838 | }, |
| 839 | { } /* end */ |
| 840 | }; |
| 841 | |
| 842 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 843 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 844 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 845 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 846 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 847 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 848 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 849 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 850 | { |
| 851 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 852 | /* The multiple "Capture Source" controls confuse alsamixer |
| 853 | * So call somewhat different.. |
| 854 | * FIXME: the controls appear in the "playback" view! |
| 855 | */ |
| 856 | /* .name = "Capture Source", */ |
| 857 | .name = "Input Source", |
| 858 | .count = 3, |
| 859 | .info = alc_mux_enum_info, |
| 860 | .get = alc_mux_enum_get, |
| 861 | .put = alc_mux_enum_put, |
| 862 | }, |
| 863 | { } /* end */ |
| 864 | }; |
| 865 | |
| 866 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 867 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 868 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 869 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 870 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 871 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 872 | { |
| 873 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 874 | /* The multiple "Capture Source" controls confuse alsamixer |
| 875 | * So call somewhat different.. |
| 876 | * FIXME: the controls appear in the "playback" view! |
| 877 | */ |
| 878 | /* .name = "Capture Source", */ |
| 879 | .name = "Input Source", |
| 880 | .count = 2, |
| 881 | .info = alc_mux_enum_info, |
| 882 | .get = alc_mux_enum_get, |
| 883 | .put = alc_mux_enum_put, |
| 884 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 885 | { } /* end */ |
| 886 | }; |
| 887 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 888 | |
| 889 | |
| 890 | /* |
| 891 | * ALC880 5-stack model |
| 892 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 893 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 894 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 895 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 896 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 897 | */ |
| 898 | |
| 899 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 900 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 901 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 902 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 903 | { } /* end */ |
| 904 | }; |
| 905 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 906 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 907 | /* 6ch mode */ |
| 908 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 909 | /* set line-in to input, mute it */ |
| 910 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 911 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 912 | { } /* end */ |
| 913 | }; |
| 914 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 915 | /* 8ch mode */ |
| 916 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 917 | /* set line-in to output, unmute it */ |
| 918 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 919 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 920 | { } /* end */ |
| 921 | }; |
| 922 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 923 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 924 | { 6, alc880_fivestack_ch6_init }, |
| 925 | { 8, alc880_fivestack_ch8_init }, |
| 926 | }; |
| 927 | |
| 928 | |
| 929 | /* |
| 930 | * ALC880 6-stack model |
| 931 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 932 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 933 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 934 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 935 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 936 | */ |
| 937 | |
| 938 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 939 | /* front, rear, clfe, rear_surr */ |
| 940 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 941 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 942 | |
| 943 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 944 | .num_items = 4, |
| 945 | .items = { |
| 946 | { "Mic", 0x0 }, |
| 947 | { "Front Mic", 0x1 }, |
| 948 | { "Line", 0x2 }, |
| 949 | { "CD", 0x4 }, |
| 950 | }, |
| 951 | }; |
| 952 | |
| 953 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 954 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 955 | { 8, NULL }, |
| 956 | }; |
| 957 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 958 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 960 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 961 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 962 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 963 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 964 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 965 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 966 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 967 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 968 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 969 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 970 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 971 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 972 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 974 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 975 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 976 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 977 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 978 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 979 | { |
| 980 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 981 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 982 | .info = alc_ch_mode_info, |
| 983 | .get = alc_ch_mode_get, |
| 984 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 985 | }, |
| 986 | { } /* end */ |
| 987 | }; |
| 988 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 989 | |
| 990 | /* |
| 991 | * ALC880 W810 model |
| 992 | * |
| 993 | * W810 has rear IO for: |
| 994 | * Front (DAC 02) |
| 995 | * Surround (DAC 03) |
| 996 | * Center/LFE (DAC 04) |
| 997 | * Digital out (06) |
| 998 | * |
| 999 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1000 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1001 | * |
| 1002 | * There is a variable resistor to control the speaker or headphone |
| 1003 | * volume. This is a hardware-only device without a software API. |
| 1004 | * |
| 1005 | * Plugging headphones in will disable the internal speakers. This is |
| 1006 | * implemented in hardware, not via the driver using jack sense. In |
| 1007 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1008 | * disable both the speakers and headphones. |
| 1009 | * |
| 1010 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1011 | * These may not do anything useful with this driver yet, because I |
| 1012 | * haven't setup any initialization verbs for these yet... |
| 1013 | */ |
| 1014 | |
| 1015 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1016 | /* front, rear/surround, clfe */ |
| 1017 | 0x02, 0x03, 0x04 |
| 1018 | }; |
| 1019 | |
| 1020 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1021 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1022 | { 6, NULL } |
| 1023 | }; |
| 1024 | |
| 1025 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1026 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1027 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1028 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1029 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1030 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1031 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1032 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1033 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1034 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1035 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1036 | { } /* end */ |
| 1037 | }; |
| 1038 | |
| 1039 | |
| 1040 | /* |
| 1041 | * Z710V model |
| 1042 | * |
| 1043 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1044 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1045 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1046 | */ |
| 1047 | |
| 1048 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1049 | 0x02 |
| 1050 | }; |
| 1051 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1052 | |
| 1053 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1054 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1055 | { 2, NULL } |
| 1056 | }; |
| 1057 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1058 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1059 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1060 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1061 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1062 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1063 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1064 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1065 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1066 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1067 | { } /* end */ |
| 1068 | }; |
| 1069 | |
| 1070 | |
| 1071 | /* FIXME! */ |
| 1072 | /* |
| 1073 | * ALC880 F1734 model |
| 1074 | * |
| 1075 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1076 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1077 | */ |
| 1078 | |
| 1079 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1080 | 0x03 |
| 1081 | }; |
| 1082 | #define ALC880_F1734_HP_DAC 0x02 |
| 1083 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1084 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1085 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1086 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1087 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1088 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1092 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1093 | { } /* end */ |
| 1094 | }; |
| 1095 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1096 | |
| 1097 | /* FIXME! */ |
| 1098 | /* |
| 1099 | * ALC880 ASUS model |
| 1100 | * |
| 1101 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1102 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1103 | * Mic = 0x18, Line = 0x1a |
| 1104 | */ |
| 1105 | |
| 1106 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1107 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1108 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1109 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1110 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1111 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1112 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1113 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1114 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1115 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1116 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1117 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1118 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1119 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1120 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1121 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1124 | { |
| 1125 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1126 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1127 | .info = alc_ch_mode_info, |
| 1128 | .get = alc_ch_mode_get, |
| 1129 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1130 | }, |
| 1131 | { } /* end */ |
| 1132 | }; |
| 1133 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1134 | /* FIXME! */ |
| 1135 | /* |
| 1136 | * ALC880 ASUS W1V model |
| 1137 | * |
| 1138 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1139 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1140 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1141 | */ |
| 1142 | |
| 1143 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1144 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1145 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1146 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1147 | { } /* end */ |
| 1148 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1149 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1150 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1151 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1152 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1153 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1154 | { } /* end */ |
| 1155 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1156 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1157 | /* TCL S700 */ |
| 1158 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1159 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1160 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1161 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1162 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1163 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1164 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1165 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1166 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1167 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1168 | { |
| 1169 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1170 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1171 | * So call somewhat different.. |
| 1172 | * FIXME: the controls appear in the "playback" view! |
| 1173 | */ |
| 1174 | /* .name = "Capture Source", */ |
| 1175 | .name = "Input Source", |
| 1176 | .count = 1, |
| 1177 | .info = alc_mux_enum_info, |
| 1178 | .get = alc_mux_enum_get, |
| 1179 | .put = alc_mux_enum_put, |
| 1180 | }, |
| 1181 | { } /* end */ |
| 1182 | }; |
| 1183 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1184 | /* Uniwill */ |
| 1185 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
| 1186 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1187 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1188 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1189 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1190 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1191 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1192 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1193 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1194 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1195 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1196 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1197 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1200 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1201 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1202 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1203 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1204 | { |
| 1205 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1206 | .name = "Channel Mode", |
| 1207 | .info = alc_ch_mode_info, |
| 1208 | .get = alc_ch_mode_get, |
| 1209 | .put = alc_ch_mode_put, |
| 1210 | }, |
| 1211 | { } /* end */ |
| 1212 | }; |
| 1213 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1214 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1215 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1216 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1217 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1218 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1219 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1220 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1221 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1222 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1223 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1224 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1225 | { } /* end */ |
| 1226 | }; |
| 1227 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1228 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
| 1229 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1230 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1231 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1232 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1233 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1234 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1235 | { } /* end */ |
| 1236 | }; |
| 1237 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1238 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1239 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1240 | */ |
| 1241 | static int alc_build_controls(struct hda_codec *codec) |
| 1242 | { |
| 1243 | struct alc_spec *spec = codec->spec; |
| 1244 | int err; |
| 1245 | int i; |
| 1246 | |
| 1247 | for (i = 0; i < spec->num_mixers; i++) { |
| 1248 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1249 | if (err < 0) |
| 1250 | return err; |
| 1251 | } |
| 1252 | |
| 1253 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1254 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1255 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1256 | if (err < 0) |
| 1257 | return err; |
| 1258 | } |
| 1259 | if (spec->dig_in_nid) { |
| 1260 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1261 | if (err < 0) |
| 1262 | return err; |
| 1263 | } |
| 1264 | return 0; |
| 1265 | } |
| 1266 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1267 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1268 | /* |
| 1269 | * initialize the codec volumes, etc |
| 1270 | */ |
| 1271 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1272 | /* |
| 1273 | * generic initialization of ADC, input mixers and output mixers |
| 1274 | */ |
| 1275 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1276 | /* |
| 1277 | * Unmute ADC0-2 and set the default input to mic-in |
| 1278 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1279 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1281 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1282 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1283 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1284 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1285 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1286 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1287 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1288 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1289 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1290 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1291 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 1295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 1296 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1297 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1298 | /* |
| 1299 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1300 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1301 | /* set vol=0 to output mixers */ |
| 1302 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1303 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1304 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1305 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1306 | /* set up input amps for analog loopback */ |
| 1307 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1311 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1312 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1313 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1314 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1315 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1316 | |
| 1317 | { } |
| 1318 | }; |
| 1319 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1320 | /* |
| 1321 | * 3-stack pin configuration: |
| 1322 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1323 | */ |
| 1324 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1325 | /* |
| 1326 | * preset connection lists of input pins |
| 1327 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1328 | */ |
| 1329 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1330 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1331 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1332 | |
| 1333 | /* |
| 1334 | * Set pin mode and muting |
| 1335 | */ |
| 1336 | /* set front pin widgets 0x14 for output */ |
| 1337 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1338 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1339 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1340 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1341 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1342 | /* Mic2 (as headphone out) for HP output */ |
| 1343 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1344 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1345 | /* Line In pin widget for input */ |
| 1346 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1347 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1348 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1349 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1350 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1351 | /* CD pin widget for input */ |
| 1352 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1353 | |
| 1354 | { } |
| 1355 | }; |
| 1356 | |
| 1357 | /* |
| 1358 | * 5-stack pin configuration: |
| 1359 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1360 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1361 | */ |
| 1362 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1363 | /* |
| 1364 | * preset connection lists of input pins |
| 1365 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1366 | */ |
| 1367 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1368 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1369 | |
| 1370 | /* |
| 1371 | * Set pin mode and muting |
| 1372 | */ |
| 1373 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1376 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1377 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1378 | /* unmute pins for output (no gain on this amp) */ |
| 1379 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1380 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1381 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1382 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1383 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1384 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1385 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1386 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1387 | /* Mic2 (as headphone out) for HP output */ |
| 1388 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1389 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1390 | /* Line In pin widget for input */ |
| 1391 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1392 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1393 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1394 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1395 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1396 | /* CD pin widget for input */ |
| 1397 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1398 | |
| 1399 | { } |
| 1400 | }; |
| 1401 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1402 | /* |
| 1403 | * W810 pin configuration: |
| 1404 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1405 | */ |
| 1406 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1407 | /* hphone/speaker input selector: front DAC */ |
| 1408 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1409 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1411 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1412 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1413 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1414 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1415 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1416 | |
| 1417 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1418 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1419 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1420 | { } |
| 1421 | }; |
| 1422 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1423 | /* |
| 1424 | * Z71V pin configuration: |
| 1425 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1426 | */ |
| 1427 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1428 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1429 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1430 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1431 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1432 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1433 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1434 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1435 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1436 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1437 | |
| 1438 | { } |
| 1439 | }; |
| 1440 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1441 | /* |
| 1442 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1443 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1444 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1445 | */ |
| 1446 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1447 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1448 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1449 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1450 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1451 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1452 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1453 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1454 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1455 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1456 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1457 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1458 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1459 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1460 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1461 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1462 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1463 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1464 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1465 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1466 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1467 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1468 | { } |
| 1469 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1470 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1471 | /* |
| 1472 | * Uniwill pin configuration: |
| 1473 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1474 | * line = 0x1a |
| 1475 | */ |
| 1476 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1477 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1478 | |
| 1479 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1480 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1481 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1482 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1483 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1484 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1485 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1486 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1487 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1488 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1489 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1490 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1491 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1492 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1493 | |
| 1494 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1495 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1496 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1497 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1498 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1499 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1500 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1501 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1502 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1503 | |
| 1504 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1505 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1506 | |
| 1507 | { } |
| 1508 | }; |
| 1509 | |
| 1510 | /* |
| 1511 | * Uniwill P53 |
| 1512 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1513 | */ |
| 1514 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1515 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1516 | |
| 1517 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1518 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1521 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1522 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1523 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1524 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1525 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1526 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1527 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1528 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1529 | |
| 1530 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1531 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1532 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1533 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1534 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1535 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1536 | |
| 1537 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1538 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1539 | |
| 1540 | { } |
| 1541 | }; |
| 1542 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1543 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1544 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1545 | { } |
| 1546 | }; |
| 1547 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1548 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1549 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1550 | { |
| 1551 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1552 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1553 | |
| 1554 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1555 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1556 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1557 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1558 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1559 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1560 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1561 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1562 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1563 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1564 | 0x80, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1565 | } |
| 1566 | |
| 1567 | /* auto-toggle front mic */ |
| 1568 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1569 | { |
| 1570 | unsigned int present; |
| 1571 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1572 | |
| 1573 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1574 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1575 | bits = present ? 0x80 : 0; |
| 1576 | snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, |
| 1577 | 0x80, bits); |
| 1578 | snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1, |
| 1579 | 0x80, bits); |
| 1580 | } |
| 1581 | |
| 1582 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1583 | { |
| 1584 | alc880_uniwill_hp_automute(codec); |
| 1585 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1586 | } |
| 1587 | |
| 1588 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1589 | unsigned int res) |
| 1590 | { |
| 1591 | /* Looks like the unsol event is incompatible with the standard |
| 1592 | * definition. 4bit tag is placed at 28 bit! |
| 1593 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1594 | switch (res >> 28) { |
| 1595 | case ALC880_HP_EVENT: |
| 1596 | alc880_uniwill_hp_automute(codec); |
| 1597 | break; |
| 1598 | case ALC880_MIC_EVENT: |
| 1599 | alc880_uniwill_mic_automute(codec); |
| 1600 | break; |
| 1601 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1602 | } |
| 1603 | |
| 1604 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1605 | { |
| 1606 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1607 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1608 | |
| 1609 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1610 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1611 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1612 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1613 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1614 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1615 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1616 | } |
| 1617 | |
| 1618 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1619 | { |
| 1620 | unsigned int present; |
| 1621 | |
| 1622 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 1623 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; |
| 1624 | |
| 1625 | snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 1626 | 0x7f, present); |
| 1627 | snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 1628 | 0x7f, present); |
| 1629 | |
| 1630 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 1631 | 0x7f, present); |
| 1632 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 1633 | 0x7f, present); |
| 1634 | |
| 1635 | } |
| 1636 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1637 | unsigned int res) |
| 1638 | { |
| 1639 | /* Looks like the unsol event is incompatible with the standard |
| 1640 | * definition. 4bit tag is placed at 28 bit! |
| 1641 | */ |
| 1642 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1643 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1644 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1645 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1646 | } |
| 1647 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1648 | /* FIXME! */ |
| 1649 | /* |
| 1650 | * F1734 pin configuration: |
| 1651 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1652 | */ |
| 1653 | static struct hda_verb alc880_pin_f1734_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 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1663 | |
| 1664 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1665 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1666 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1667 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1668 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1669 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1670 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1671 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1672 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1673 | |
| 1674 | { } |
| 1675 | }; |
| 1676 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1677 | /* FIXME! */ |
| 1678 | /* |
| 1679 | * ASUS pin configuration: |
| 1680 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1681 | */ |
| 1682 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1683 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1684 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1685 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1686 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1687 | |
| 1688 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1689 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1690 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1691 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1692 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1693 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1694 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1695 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1696 | |
| 1697 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1698 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1699 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1700 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1701 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1702 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1703 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1704 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1705 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1706 | |
| 1707 | { } |
| 1708 | }; |
| 1709 | |
| 1710 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1711 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1712 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1713 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1714 | /* Clevo m520g init */ |
| 1715 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1716 | /* headphone output */ |
| 1717 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1718 | /* line-out */ |
| 1719 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1720 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1721 | /* Line-in */ |
| 1722 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1723 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1724 | /* CD */ |
| 1725 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1726 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1727 | /* Mic1 (rear panel) */ |
| 1728 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1729 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1730 | /* Mic2 (front panel) */ |
| 1731 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1732 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1733 | /* headphone */ |
| 1734 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1735 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1736 | /* change to EAPD mode */ |
| 1737 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1738 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1739 | |
| 1740 | { } |
| 1741 | }; |
| 1742 | |
| 1743 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 1744 | /* change to EAPD mode */ |
| 1745 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1746 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1747 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1748 | /* Headphone output */ |
| 1749 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1750 | /* Front output*/ |
| 1751 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1752 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1753 | |
| 1754 | /* Line In pin widget for input */ |
| 1755 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1756 | /* CD pin widget for input */ |
| 1757 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1758 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1759 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1760 | |
| 1761 | /* change to EAPD mode */ |
| 1762 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1763 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 1764 | |
| 1765 | { } |
| 1766 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1767 | |
| 1768 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1769 | * LG m1 express dual |
| 1770 | * |
| 1771 | * Pin assignment: |
| 1772 | * Rear Line-In/Out (blue): 0x14 |
| 1773 | * Build-in Mic-In: 0x15 |
| 1774 | * Speaker-out: 0x17 |
| 1775 | * HP-Out (green): 0x1b |
| 1776 | * Mic-In/Out (red): 0x19 |
| 1777 | * SPDIF-Out: 0x1e |
| 1778 | */ |
| 1779 | |
| 1780 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 1781 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 1782 | 0x05, 0x02, 0x03 |
| 1783 | }; |
| 1784 | |
| 1785 | /* seems analog CD is not working */ |
| 1786 | static struct hda_input_mux alc880_lg_capture_source = { |
| 1787 | .num_items = 3, |
| 1788 | .items = { |
| 1789 | { "Mic", 0x1 }, |
| 1790 | { "Line", 0x5 }, |
| 1791 | { "Internal Mic", 0x6 }, |
| 1792 | }, |
| 1793 | }; |
| 1794 | |
| 1795 | /* 2,4,6 channel modes */ |
| 1796 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 1797 | /* set line-in and mic-in to input */ |
| 1798 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1799 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1800 | { } |
| 1801 | }; |
| 1802 | |
| 1803 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 1804 | /* set line-in to out and mic-in to input */ |
| 1805 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1806 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1807 | { } |
| 1808 | }; |
| 1809 | |
| 1810 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 1811 | /* set line-in and mic-in to output */ |
| 1812 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1813 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1814 | { } |
| 1815 | }; |
| 1816 | |
| 1817 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 1818 | { 2, alc880_lg_ch2_init }, |
| 1819 | { 4, alc880_lg_ch4_init }, |
| 1820 | { 6, alc880_lg_ch6_init }, |
| 1821 | }; |
| 1822 | |
| 1823 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 1824 | /* FIXME: it's not really "master" but front channels */ |
| 1825 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1826 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1827 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1828 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1829 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 1830 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 1831 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 1832 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 1833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1835 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 1836 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 1837 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 1838 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 1839 | { |
| 1840 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1841 | .name = "Channel Mode", |
| 1842 | .info = alc_ch_mode_info, |
| 1843 | .get = alc_ch_mode_get, |
| 1844 | .put = alc_ch_mode_put, |
| 1845 | }, |
| 1846 | { } /* end */ |
| 1847 | }; |
| 1848 | |
| 1849 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 1850 | /* set capture source to mic-in */ |
| 1851 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1852 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1853 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1854 | /* mute all amp mixer inputs */ |
| 1855 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 1856 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 1857 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1858 | /* line-in to input */ |
| 1859 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1860 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1861 | /* built-in mic */ |
| 1862 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1863 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1864 | /* speaker-out */ |
| 1865 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1866 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1867 | /* mic-in to input */ |
| 1868 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1869 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1870 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1871 | /* HP-out */ |
| 1872 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1873 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1874 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1875 | /* jack sense */ |
| 1876 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1877 | { } |
| 1878 | }; |
| 1879 | |
| 1880 | /* toggle speaker-output according to the hp-jack state */ |
| 1881 | static void alc880_lg_automute(struct hda_codec *codec) |
| 1882 | { |
| 1883 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1884 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1885 | |
| 1886 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1887 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1888 | bits = present ? 0x80 : 0; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1889 | snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1890 | 0x80, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1891 | snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1892 | 0x80, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1893 | } |
| 1894 | |
| 1895 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1896 | { |
| 1897 | /* Looks like the unsol event is incompatible with the standard |
| 1898 | * definition. 4bit tag is placed at 28 bit! |
| 1899 | */ |
| 1900 | if ((res >> 28) == 0x01) |
| 1901 | alc880_lg_automute(codec); |
| 1902 | } |
| 1903 | |
| 1904 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1905 | * LG LW20 |
| 1906 | * |
| 1907 | * Pin assignment: |
| 1908 | * Speaker-out: 0x14 |
| 1909 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1910 | * Built-in Mic-In: 0x19 |
| 1911 | * Line-In: 0x1b |
| 1912 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1913 | * SPDIF-Out: 0x1e |
| 1914 | */ |
| 1915 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1916 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1917 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1918 | .items = { |
| 1919 | { "Mic", 0x0 }, |
| 1920 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1921 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1922 | }, |
| 1923 | }; |
| 1924 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1925 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 1926 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1927 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1928 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1929 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1930 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1931 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1932 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1933 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1934 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1935 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1936 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1937 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1939 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1940 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 1941 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1942 | { |
| 1943 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1944 | .name = "Channel Mode", |
| 1945 | .info = alc_ch_mode_info, |
| 1946 | .get = alc_ch_mode_get, |
| 1947 | .put = alc_ch_mode_put, |
| 1948 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1949 | { } /* end */ |
| 1950 | }; |
| 1951 | |
| 1952 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1953 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1954 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1955 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1956 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1957 | /* set capture source to mic-in */ |
| 1958 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1959 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1960 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1961 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1962 | /* speaker-out */ |
| 1963 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1964 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1965 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1966 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1967 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1968 | /* mic-in to input */ |
| 1969 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1970 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1971 | /* built-in mic */ |
| 1972 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1973 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1974 | /* jack sense */ |
| 1975 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1976 | { } |
| 1977 | }; |
| 1978 | |
| 1979 | /* toggle speaker-output according to the hp-jack state */ |
| 1980 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 1981 | { |
| 1982 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1983 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1984 | |
| 1985 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1986 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1987 | bits = present ? 0x80 : 0; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1988 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1989 | 0x80, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1990 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1991 | 0x80, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1992 | } |
| 1993 | |
| 1994 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1995 | { |
| 1996 | /* Looks like the unsol event is incompatible with the standard |
| 1997 | * definition. 4bit tag is placed at 28 bit! |
| 1998 | */ |
| 1999 | if ((res >> 28) == 0x01) |
| 2000 | alc880_lg_lw_automute(codec); |
| 2001 | } |
| 2002 | |
| 2003 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2004 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2005 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2006 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2007 | static int alc_init(struct hda_codec *codec) |
| 2008 | { |
| 2009 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2010 | unsigned int i; |
| 2011 | |
| 2012 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2013 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2014 | |
| 2015 | if (spec->init_hook) |
| 2016 | spec->init_hook(codec); |
| 2017 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2018 | return 0; |
| 2019 | } |
| 2020 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2021 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2022 | { |
| 2023 | struct alc_spec *spec = codec->spec; |
| 2024 | |
| 2025 | if (spec->unsol_event) |
| 2026 | spec->unsol_event(codec, res); |
| 2027 | } |
| 2028 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2029 | #ifdef CONFIG_PM |
| 2030 | /* |
| 2031 | * resume |
| 2032 | */ |
| 2033 | static int alc_resume(struct hda_codec *codec) |
| 2034 | { |
| 2035 | struct alc_spec *spec = codec->spec; |
| 2036 | int i; |
| 2037 | |
| 2038 | alc_init(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2039 | for (i = 0; i < spec->num_mixers; i++) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2040 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2041 | if (spec->multiout.dig_out_nid) |
| 2042 | snd_hda_resume_spdif_out(codec); |
| 2043 | if (spec->dig_in_nid) |
| 2044 | snd_hda_resume_spdif_in(codec); |
| 2045 | |
| 2046 | return 0; |
| 2047 | } |
| 2048 | #endif |
| 2049 | |
| 2050 | /* |
| 2051 | * Analog playback callbacks |
| 2052 | */ |
| 2053 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2054 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2055 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2056 | { |
| 2057 | struct alc_spec *spec = codec->spec; |
| 2058 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2059 | } |
| 2060 | |
| 2061 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2062 | struct hda_codec *codec, |
| 2063 | unsigned int stream_tag, |
| 2064 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2065 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2066 | { |
| 2067 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2068 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2069 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2070 | } |
| 2071 | |
| 2072 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2073 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2074 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2075 | { |
| 2076 | struct alc_spec *spec = codec->spec; |
| 2077 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2078 | } |
| 2079 | |
| 2080 | /* |
| 2081 | * Digital out |
| 2082 | */ |
| 2083 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2084 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2085 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2086 | { |
| 2087 | struct alc_spec *spec = codec->spec; |
| 2088 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2089 | } |
| 2090 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2091 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2092 | struct hda_codec *codec, |
| 2093 | unsigned int stream_tag, |
| 2094 | unsigned int format, |
| 2095 | struct snd_pcm_substream *substream) |
| 2096 | { |
| 2097 | struct alc_spec *spec = codec->spec; |
| 2098 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2099 | stream_tag, format, substream); |
| 2100 | } |
| 2101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2102 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2103 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2104 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2105 | { |
| 2106 | struct alc_spec *spec = codec->spec; |
| 2107 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2108 | } |
| 2109 | |
| 2110 | /* |
| 2111 | * Analog capture |
| 2112 | */ |
| 2113 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2114 | struct hda_codec *codec, |
| 2115 | unsigned int stream_tag, |
| 2116 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2117 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2118 | { |
| 2119 | struct alc_spec *spec = codec->spec; |
| 2120 | |
| 2121 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2122 | stream_tag, 0, format); |
| 2123 | return 0; |
| 2124 | } |
| 2125 | |
| 2126 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2127 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2128 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2129 | { |
| 2130 | struct alc_spec *spec = codec->spec; |
| 2131 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2132 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2133 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2134 | return 0; |
| 2135 | } |
| 2136 | |
| 2137 | |
| 2138 | /* |
| 2139 | */ |
| 2140 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2141 | .substreams = 1, |
| 2142 | .channels_min = 2, |
| 2143 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2144 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2145 | .ops = { |
| 2146 | .open = alc880_playback_pcm_open, |
| 2147 | .prepare = alc880_playback_pcm_prepare, |
| 2148 | .cleanup = alc880_playback_pcm_cleanup |
| 2149 | }, |
| 2150 | }; |
| 2151 | |
| 2152 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 2153 | .substreams = 2, |
| 2154 | .channels_min = 2, |
| 2155 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2156 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2157 | .ops = { |
| 2158 | .prepare = alc880_capture_pcm_prepare, |
| 2159 | .cleanup = alc880_capture_pcm_cleanup |
| 2160 | }, |
| 2161 | }; |
| 2162 | |
| 2163 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2164 | .substreams = 1, |
| 2165 | .channels_min = 2, |
| 2166 | .channels_max = 2, |
| 2167 | /* NID is set in alc_build_pcms */ |
| 2168 | .ops = { |
| 2169 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2170 | .close = alc880_dig_playback_pcm_close, |
| 2171 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2172 | }, |
| 2173 | }; |
| 2174 | |
| 2175 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2176 | .substreams = 1, |
| 2177 | .channels_min = 2, |
| 2178 | .channels_max = 2, |
| 2179 | /* NID is set in alc_build_pcms */ |
| 2180 | }; |
| 2181 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2182 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 2183 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 2184 | .substreams = 0, |
| 2185 | .channels_min = 0, |
| 2186 | .channels_max = 0, |
| 2187 | }; |
| 2188 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2189 | static int alc_build_pcms(struct hda_codec *codec) |
| 2190 | { |
| 2191 | struct alc_spec *spec = codec->spec; |
| 2192 | struct hda_pcm *info = spec->pcm_rec; |
| 2193 | int i; |
| 2194 | |
| 2195 | codec->num_pcms = 1; |
| 2196 | codec->pcm_info = info; |
| 2197 | |
| 2198 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2199 | if (spec->stream_analog_playback) { |
| 2200 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2201 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2202 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2203 | } |
| 2204 | if (spec->stream_analog_capture) { |
| 2205 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2206 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2207 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2208 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2209 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2210 | if (spec->channel_mode) { |
| 2211 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2212 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2213 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2214 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2215 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2216 | } |
| 2217 | } |
| 2218 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2219 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2220 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2221 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2222 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2223 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2224 | if (spec->multiout.dig_out_nid && |
| 2225 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2226 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2227 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2228 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2229 | if (spec->dig_in_nid && |
| 2230 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2231 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2232 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2233 | } |
| 2234 | } |
| 2235 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2236 | /* If the use of more than one ADC is requested for the current |
| 2237 | * model, configure a second analog capture-only PCM. |
| 2238 | */ |
| 2239 | /* Additional Analaog capture for index #2 */ |
| 2240 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2241 | spec->adc_nids) { |
| 2242 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2243 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2244 | info->name = spec->stream_name_analog; |
| 2245 | /* No playback stream for second PCM */ |
| 2246 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2247 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2248 | if (spec->stream_analog_capture) { |
| 2249 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2250 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2251 | } |
| 2252 | } |
| 2253 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2254 | return 0; |
| 2255 | } |
| 2256 | |
| 2257 | static void alc_free(struct hda_codec *codec) |
| 2258 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2259 | struct alc_spec *spec = codec->spec; |
| 2260 | unsigned int i; |
| 2261 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2262 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2263 | return; |
| 2264 | |
| 2265 | if (spec->kctl_alloc) { |
| 2266 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2267 | kfree(spec->kctl_alloc[i].name); |
| 2268 | kfree(spec->kctl_alloc); |
| 2269 | } |
| 2270 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2271 | } |
| 2272 | |
| 2273 | /* |
| 2274 | */ |
| 2275 | static struct hda_codec_ops alc_patch_ops = { |
| 2276 | .build_controls = alc_build_controls, |
| 2277 | .build_pcms = alc_build_pcms, |
| 2278 | .init = alc_init, |
| 2279 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2280 | .unsol_event = alc_unsol_event, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2281 | #ifdef CONFIG_PM |
| 2282 | .resume = alc_resume, |
| 2283 | #endif |
| 2284 | }; |
| 2285 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2286 | |
| 2287 | /* |
| 2288 | * Test configuration for debugging |
| 2289 | * |
| 2290 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2291 | * enum controls. |
| 2292 | */ |
| 2293 | #ifdef CONFIG_SND_DEBUG |
| 2294 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2295 | 0x02, 0x03, 0x04, 0x05 |
| 2296 | }; |
| 2297 | |
| 2298 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2299 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2300 | .items = { |
| 2301 | { "In-1", 0x0 }, |
| 2302 | { "In-2", 0x1 }, |
| 2303 | { "In-3", 0x2 }, |
| 2304 | { "In-4", 0x3 }, |
| 2305 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2306 | { "Front", 0x5 }, |
| 2307 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2308 | }, |
| 2309 | }; |
| 2310 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2311 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2312 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2313 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2314 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2315 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2316 | }; |
| 2317 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2318 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2319 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2320 | { |
| 2321 | static char *texts[] = { |
| 2322 | "N/A", "Line Out", "HP Out", |
| 2323 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2324 | }; |
| 2325 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2326 | uinfo->count = 1; |
| 2327 | uinfo->value.enumerated.items = 8; |
| 2328 | if (uinfo->value.enumerated.item >= 8) |
| 2329 | uinfo->value.enumerated.item = 7; |
| 2330 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2331 | return 0; |
| 2332 | } |
| 2333 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2334 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2335 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2336 | { |
| 2337 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2338 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2339 | unsigned int pin_ctl, item = 0; |
| 2340 | |
| 2341 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2342 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2343 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2344 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2345 | item = 2; |
| 2346 | else |
| 2347 | item = 1; |
| 2348 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2349 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2350 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2351 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2352 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2353 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2354 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2355 | } |
| 2356 | } |
| 2357 | ucontrol->value.enumerated.item[0] = item; |
| 2358 | return 0; |
| 2359 | } |
| 2360 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2361 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2362 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2363 | { |
| 2364 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2365 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2366 | static unsigned int ctls[] = { |
| 2367 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2368 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2369 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2370 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2371 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2372 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2373 | }; |
| 2374 | unsigned int old_ctl, new_ctl; |
| 2375 | |
| 2376 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2377 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2378 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2379 | if (old_ctl != new_ctl) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2380 | snd_hda_codec_write(codec, nid, 0, |
| 2381 | AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2382 | 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] | 2383 | (ucontrol->value.enumerated.item[0] >= 3 ? |
| 2384 | 0xb080 : 0xb000)); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2385 | return 1; |
| 2386 | } |
| 2387 | return 0; |
| 2388 | } |
| 2389 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2390 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2391 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2392 | { |
| 2393 | static char *texts[] = { |
| 2394 | "Front", "Surround", "CLFE", "Side" |
| 2395 | }; |
| 2396 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2397 | uinfo->count = 1; |
| 2398 | uinfo->value.enumerated.items = 4; |
| 2399 | if (uinfo->value.enumerated.item >= 4) |
| 2400 | uinfo->value.enumerated.item = 3; |
| 2401 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2402 | return 0; |
| 2403 | } |
| 2404 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2405 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2406 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2407 | { |
| 2408 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2409 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2410 | unsigned int sel; |
| 2411 | |
| 2412 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2413 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2414 | return 0; |
| 2415 | } |
| 2416 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2417 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2418 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2419 | { |
| 2420 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2421 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2422 | unsigned int sel; |
| 2423 | |
| 2424 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2425 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2426 | sel = ucontrol->value.enumerated.item[0] & 3; |
| 2427 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel); |
| 2428 | return 1; |
| 2429 | } |
| 2430 | return 0; |
| 2431 | } |
| 2432 | |
| 2433 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2434 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2435 | .name = xname, \ |
| 2436 | .info = alc_test_pin_ctl_info, \ |
| 2437 | .get = alc_test_pin_ctl_get, \ |
| 2438 | .put = alc_test_pin_ctl_put, \ |
| 2439 | .private_value = nid \ |
| 2440 | } |
| 2441 | |
| 2442 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2444 | .name = xname, \ |
| 2445 | .info = alc_test_pin_src_info, \ |
| 2446 | .get = alc_test_pin_src_get, \ |
| 2447 | .put = alc_test_pin_src_put, \ |
| 2448 | .private_value = nid \ |
| 2449 | } |
| 2450 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2451 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2452 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2453 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2454 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2455 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2456 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2457 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2458 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2459 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2460 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2461 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2462 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2463 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2464 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2465 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2466 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2467 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2468 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2469 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2470 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2471 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2472 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2473 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2474 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2475 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2476 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2477 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2478 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2479 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2480 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2481 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2482 | { |
| 2483 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2484 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2485 | .info = alc_ch_mode_info, |
| 2486 | .get = alc_ch_mode_get, |
| 2487 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2488 | }, |
| 2489 | { } /* end */ |
| 2490 | }; |
| 2491 | |
| 2492 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2493 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2494 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2495 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2496 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2497 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2498 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2499 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2500 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2501 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2502 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2504 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2505 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2506 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2507 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2508 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2509 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2510 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2511 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2512 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2513 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2514 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2515 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2516 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2517 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2518 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2519 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2520 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2521 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2522 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2523 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2524 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2525 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2526 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2527 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2528 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2529 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2530 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2531 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2532 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2533 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2534 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2535 | /* Analog input/passthru */ |
| 2536 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2537 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2538 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2539 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2540 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2541 | { } |
| 2542 | }; |
| 2543 | #endif |
| 2544 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2545 | /* |
| 2546 | */ |
| 2547 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2548 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2549 | [ALC880_3ST] = "3stack", |
| 2550 | [ALC880_TCL_S700] = "tcl", |
| 2551 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2552 | [ALC880_CLEVO] = "clevo", |
| 2553 | [ALC880_5ST] = "5stack", |
| 2554 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2555 | [ALC880_W810] = "w810", |
| 2556 | [ALC880_Z71V] = "z71v", |
| 2557 | [ALC880_6ST] = "6stack", |
| 2558 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2559 | [ALC880_ASUS] = "asus", |
| 2560 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2561 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2562 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2563 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2564 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2565 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2566 | [ALC880_F1734] = "F1734", |
| 2567 | [ALC880_LG] = "lg", |
| 2568 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2569 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2570 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2571 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2572 | [ALC880_AUTO] = "auto", |
| 2573 | }; |
| 2574 | |
| 2575 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
| 2576 | /* Broken BIOS configuration */ |
| 2577 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), |
| 2578 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2579 | |
| 2580 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2581 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
Tobin Davis | 4dc53e2 | 2006-12-18 13:24:37 +0100 | [diff] [blame] | 2582 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2583 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2584 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2585 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2586 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2587 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2588 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
| 2589 | |
| 2590 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2591 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
| 2592 | |
| 2593 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2594 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2595 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2596 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2597 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2598 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2599 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2600 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2601 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2602 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2603 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2604 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2605 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2606 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
| 2607 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), |
| 2608 | |
| 2609 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2610 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
| 2611 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2612 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
| 2613 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
| 2614 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2615 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
| 2616 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
| 2617 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2618 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
| 2619 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2620 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2621 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
| 2622 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2623 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2624 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2625 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
| 2626 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
| 2627 | |
| 2628 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
| 2629 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2630 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
| 2631 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
| 2632 | |
| 2633 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
| 2634 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
| 2635 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2636 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2637 | |
| 2638 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2639 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
| 2640 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
| 2641 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
| 2642 | |
| 2643 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
| 2644 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2645 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
| 2646 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2647 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
| 2648 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
| 2649 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2650 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2651 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
| 2652 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
| 2653 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2654 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2655 | {} |
| 2656 | }; |
| 2657 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2658 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2659 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2660 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2661 | static struct alc_config_preset alc880_presets[] = { |
| 2662 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2663 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2664 | .init_verbs = { alc880_volume_init_verbs, |
| 2665 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2666 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2667 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2668 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2669 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2670 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2671 | .input_mux = &alc880_capture_source, |
| 2672 | }, |
| 2673 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2674 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2675 | .init_verbs = { alc880_volume_init_verbs, |
| 2676 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2677 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2678 | .dac_nids = alc880_dac_nids, |
| 2679 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2680 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2681 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2682 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2683 | .input_mux = &alc880_capture_source, |
| 2684 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2685 | [ALC880_TCL_S700] = { |
| 2686 | .mixers = { alc880_tcl_s700_mixer }, |
| 2687 | .init_verbs = { alc880_volume_init_verbs, |
| 2688 | alc880_pin_tcl_S700_init_verbs, |
| 2689 | alc880_gpio2_init_verbs }, |
| 2690 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2691 | .dac_nids = alc880_dac_nids, |
| 2692 | .hp_nid = 0x03, |
| 2693 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2694 | .channel_mode = alc880_2_jack_modes, |
| 2695 | .input_mux = &alc880_capture_source, |
| 2696 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2697 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2698 | .mixers = { alc880_three_stack_mixer, |
| 2699 | alc880_five_stack_mixer}, |
| 2700 | .init_verbs = { alc880_volume_init_verbs, |
| 2701 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2702 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2703 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2704 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2705 | .channel_mode = alc880_fivestack_modes, |
| 2706 | .input_mux = &alc880_capture_source, |
| 2707 | }, |
| 2708 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2709 | .mixers = { alc880_three_stack_mixer, |
| 2710 | alc880_five_stack_mixer }, |
| 2711 | .init_verbs = { alc880_volume_init_verbs, |
| 2712 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2713 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2714 | .dac_nids = alc880_dac_nids, |
| 2715 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2716 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2717 | .channel_mode = alc880_fivestack_modes, |
| 2718 | .input_mux = &alc880_capture_source, |
| 2719 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2720 | [ALC880_6ST] = { |
| 2721 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2722 | .init_verbs = { alc880_volume_init_verbs, |
| 2723 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2724 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2725 | .dac_nids = alc880_6st_dac_nids, |
| 2726 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2727 | .channel_mode = alc880_sixstack_modes, |
| 2728 | .input_mux = &alc880_6stack_capture_source, |
| 2729 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2730 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2731 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2732 | .init_verbs = { alc880_volume_init_verbs, |
| 2733 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2734 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2735 | .dac_nids = alc880_6st_dac_nids, |
| 2736 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2737 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2738 | .channel_mode = alc880_sixstack_modes, |
| 2739 | .input_mux = &alc880_6stack_capture_source, |
| 2740 | }, |
| 2741 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2742 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2743 | .init_verbs = { alc880_volume_init_verbs, |
| 2744 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2745 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2746 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 2747 | .dac_nids = alc880_w810_dac_nids, |
| 2748 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2749 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2750 | .channel_mode = alc880_w810_modes, |
| 2751 | .input_mux = &alc880_capture_source, |
| 2752 | }, |
| 2753 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2754 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2755 | .init_verbs = { alc880_volume_init_verbs, |
| 2756 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2757 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 2758 | .dac_nids = alc880_z71v_dac_nids, |
| 2759 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2760 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2761 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2762 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2763 | .input_mux = &alc880_capture_source, |
| 2764 | }, |
| 2765 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2766 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2767 | .init_verbs = { alc880_volume_init_verbs, |
| 2768 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2769 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 2770 | .dac_nids = alc880_f1734_dac_nids, |
| 2771 | .hp_nid = 0x02, |
| 2772 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2773 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2774 | .input_mux = &alc880_capture_source, |
| 2775 | }, |
| 2776 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2777 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2778 | .init_verbs = { alc880_volume_init_verbs, |
| 2779 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2780 | alc880_gpio1_init_verbs }, |
| 2781 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2782 | .dac_nids = alc880_asus_dac_nids, |
| 2783 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2784 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2785 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2786 | .input_mux = &alc880_capture_source, |
| 2787 | }, |
| 2788 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2789 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2790 | .init_verbs = { alc880_volume_init_verbs, |
| 2791 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2792 | alc880_gpio1_init_verbs }, |
| 2793 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2794 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2795 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2796 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2797 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2798 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2799 | .input_mux = &alc880_capture_source, |
| 2800 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2801 | [ALC880_ASUS_DIG2] = { |
| 2802 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2803 | .init_verbs = { alc880_volume_init_verbs, |
| 2804 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2805 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 2806 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2807 | .dac_nids = alc880_asus_dac_nids, |
| 2808 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2809 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2810 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2811 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2812 | .input_mux = &alc880_capture_source, |
| 2813 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2814 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2815 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2816 | .init_verbs = { alc880_volume_init_verbs, |
| 2817 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2818 | alc880_gpio1_init_verbs }, |
| 2819 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2820 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2821 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2822 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2823 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2824 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2825 | .input_mux = &alc880_capture_source, |
| 2826 | }, |
| 2827 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 2828 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2829 | .init_verbs = { alc880_volume_init_verbs, |
| 2830 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2831 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2832 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2833 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2834 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2835 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2836 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2837 | .input_mux = &alc880_capture_source, |
| 2838 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2839 | [ALC880_UNIWILL] = { |
| 2840 | .mixers = { alc880_uniwill_mixer }, |
| 2841 | .init_verbs = { alc880_volume_init_verbs, |
| 2842 | alc880_uniwill_init_verbs }, |
| 2843 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2844 | .dac_nids = alc880_asus_dac_nids, |
| 2845 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2846 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2847 | .channel_mode = alc880_threestack_modes, |
| 2848 | .need_dac_fix = 1, |
| 2849 | .input_mux = &alc880_capture_source, |
| 2850 | .unsol_event = alc880_uniwill_unsol_event, |
| 2851 | .init_hook = alc880_uniwill_automute, |
| 2852 | }, |
| 2853 | [ALC880_UNIWILL_P53] = { |
| 2854 | .mixers = { alc880_uniwill_p53_mixer }, |
| 2855 | .init_verbs = { alc880_volume_init_verbs, |
| 2856 | alc880_uniwill_p53_init_verbs }, |
| 2857 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2858 | .dac_nids = alc880_asus_dac_nids, |
| 2859 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2860 | .channel_mode = alc880_threestack_modes, |
| 2861 | .input_mux = &alc880_capture_source, |
| 2862 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2863 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2864 | }, |
| 2865 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2866 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2867 | alc880_pcbeep_mixer, }, |
| 2868 | .init_verbs = { alc880_volume_init_verbs, |
| 2869 | alc880_uniwill_p53_init_verbs, |
| 2870 | alc880_beep_init_verbs }, |
| 2871 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2872 | .dac_nids = alc880_dac_nids, |
| 2873 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2874 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2875 | .input_mux = &alc880_capture_source, |
| 2876 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2877 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2878 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2879 | [ALC880_CLEVO] = { |
| 2880 | .mixers = { alc880_three_stack_mixer }, |
| 2881 | .init_verbs = { alc880_volume_init_verbs, |
| 2882 | alc880_pin_clevo_init_verbs }, |
| 2883 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2884 | .dac_nids = alc880_dac_nids, |
| 2885 | .hp_nid = 0x03, |
| 2886 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2887 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2888 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2889 | .input_mux = &alc880_capture_source, |
| 2890 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2891 | [ALC880_LG] = { |
| 2892 | .mixers = { alc880_lg_mixer }, |
| 2893 | .init_verbs = { alc880_volume_init_verbs, |
| 2894 | alc880_lg_init_verbs }, |
| 2895 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 2896 | .dac_nids = alc880_lg_dac_nids, |
| 2897 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2898 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 2899 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2900 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2901 | .input_mux = &alc880_lg_capture_source, |
| 2902 | .unsol_event = alc880_lg_unsol_event, |
| 2903 | .init_hook = alc880_lg_automute, |
| 2904 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2905 | [ALC880_LG_LW] = { |
| 2906 | .mixers = { alc880_lg_lw_mixer }, |
| 2907 | .init_verbs = { alc880_volume_init_verbs, |
| 2908 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2909 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2910 | .dac_nids = alc880_dac_nids, |
| 2911 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2912 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 2913 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2914 | .input_mux = &alc880_lg_lw_capture_source, |
| 2915 | .unsol_event = alc880_lg_lw_unsol_event, |
| 2916 | .init_hook = alc880_lg_lw_automute, |
| 2917 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2918 | #ifdef CONFIG_SND_DEBUG |
| 2919 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2920 | .mixers = { alc880_test_mixer }, |
| 2921 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2922 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 2923 | .dac_nids = alc880_test_dac_nids, |
| 2924 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2925 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 2926 | .channel_mode = alc880_test_modes, |
| 2927 | .input_mux = &alc880_test_capture_source, |
| 2928 | }, |
| 2929 | #endif |
| 2930 | }; |
| 2931 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2932 | /* |
| 2933 | * Automatic parse of I/O pins from the BIOS configuration |
| 2934 | */ |
| 2935 | |
| 2936 | #define NUM_CONTROL_ALLOC 32 |
| 2937 | #define NUM_VERB_ALLOC 32 |
| 2938 | |
| 2939 | enum { |
| 2940 | ALC_CTL_WIDGET_VOL, |
| 2941 | ALC_CTL_WIDGET_MUTE, |
| 2942 | ALC_CTL_BIND_MUTE, |
| 2943 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2944 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2945 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2946 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2947 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2948 | }; |
| 2949 | |
| 2950 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2951 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 2952 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2953 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2954 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2955 | |
| 2956 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 2957 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 2958 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2959 | /* array + terminator */ |
| 2960 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 2961 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2962 | return -ENOMEM; |
| 2963 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2964 | memcpy(knew, spec->kctl_alloc, |
| 2965 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2966 | kfree(spec->kctl_alloc); |
| 2967 | } |
| 2968 | spec->kctl_alloc = knew; |
| 2969 | spec->num_kctl_alloc = num; |
| 2970 | } |
| 2971 | |
| 2972 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 2973 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 2974 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2975 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2976 | return -ENOMEM; |
| 2977 | knew->private_value = val; |
| 2978 | spec->num_kctl_used++; |
| 2979 | return 0; |
| 2980 | } |
| 2981 | |
| 2982 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 2983 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 2984 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 2985 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 2986 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 2987 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 2988 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 2989 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 2990 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 2991 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 2992 | #define ALC880_PIN_CD_NID 0x1c |
| 2993 | |
| 2994 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2995 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 2996 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2997 | { |
| 2998 | hda_nid_t nid; |
| 2999 | int assigned[4]; |
| 3000 | int i, j; |
| 3001 | |
| 3002 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3003 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3004 | |
| 3005 | /* check the pins hardwired to audio widget */ |
| 3006 | for (i = 0; i < cfg->line_outs; i++) { |
| 3007 | nid = cfg->line_out_pins[i]; |
| 3008 | if (alc880_is_fixed_pin(nid)) { |
| 3009 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3010 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3011 | assigned[idx] = 1; |
| 3012 | } |
| 3013 | } |
| 3014 | /* left pins can be connect to any audio widget */ |
| 3015 | for (i = 0; i < cfg->line_outs; i++) { |
| 3016 | nid = cfg->line_out_pins[i]; |
| 3017 | if (alc880_is_fixed_pin(nid)) |
| 3018 | continue; |
| 3019 | /* search for an empty channel */ |
| 3020 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3021 | if (!assigned[j]) { |
| 3022 | spec->multiout.dac_nids[i] = |
| 3023 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3024 | assigned[j] = 1; |
| 3025 | break; |
| 3026 | } |
| 3027 | } |
| 3028 | } |
| 3029 | spec->multiout.num_dacs = cfg->line_outs; |
| 3030 | return 0; |
| 3031 | } |
| 3032 | |
| 3033 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3034 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3035 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3036 | { |
| 3037 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3038 | static const char *chname[4] = { |
| 3039 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3040 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3041 | hda_nid_t nid; |
| 3042 | int i, err; |
| 3043 | |
| 3044 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3045 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3046 | continue; |
| 3047 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3048 | if (i == 2) { |
| 3049 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3050 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3051 | "Center Playback Volume", |
| 3052 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3053 | HDA_OUTPUT)); |
| 3054 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3055 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3056 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3057 | "LFE Playback Volume", |
| 3058 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3059 | HDA_OUTPUT)); |
| 3060 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3061 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3062 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3063 | "Center Playback Switch", |
| 3064 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3065 | HDA_INPUT)); |
| 3066 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3067 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3068 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3069 | "LFE Playback Switch", |
| 3070 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3071 | HDA_INPUT)); |
| 3072 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3073 | return err; |
| 3074 | } else { |
| 3075 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3076 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3077 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3078 | HDA_OUTPUT)); |
| 3079 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3080 | return err; |
| 3081 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3082 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3083 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3084 | HDA_INPUT)); |
| 3085 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3086 | return err; |
| 3087 | } |
| 3088 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3089 | return 0; |
| 3090 | } |
| 3091 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3092 | /* add playback controls for speaker and HP outputs */ |
| 3093 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3094 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3095 | { |
| 3096 | hda_nid_t nid; |
| 3097 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3098 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3099 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3100 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3101 | return 0; |
| 3102 | |
| 3103 | if (alc880_is_fixed_pin(pin)) { |
| 3104 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3105 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3106 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3107 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3108 | else |
| 3109 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3110 | /* control HP volume/switch on the output mixer amp */ |
| 3111 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3112 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3113 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3114 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3115 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3116 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3117 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3118 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3119 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3120 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3121 | return err; |
| 3122 | } else if (alc880_is_multi_pin(pin)) { |
| 3123 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3124 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3125 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3126 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3127 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3128 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3129 | return err; |
| 3130 | } |
| 3131 | return 0; |
| 3132 | } |
| 3133 | |
| 3134 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3135 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3136 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3137 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3138 | { |
| 3139 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3140 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3141 | |
| 3142 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3143 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3144 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3145 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | return err; |
| 3147 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3148 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3149 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3150 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3151 | return err; |
| 3152 | return 0; |
| 3153 | } |
| 3154 | |
| 3155 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3156 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3157 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3158 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3159 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3160 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3161 | |
| 3162 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3163 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3164 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3165 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3166 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3167 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3168 | if (err < 0) |
| 3169 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3170 | imux->items[imux->num_items].label = |
| 3171 | auto_pin_cfg_labels[i]; |
| 3172 | imux->items[imux->num_items].index = |
| 3173 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3174 | imux->num_items++; |
| 3175 | } |
| 3176 | } |
| 3177 | return 0; |
| 3178 | } |
| 3179 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3180 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3181 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3182 | int dac_idx) |
| 3183 | { |
| 3184 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3185 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3186 | pin_type); |
| 3187 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3188 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3189 | /* need the manual connection? */ |
| 3190 | if (alc880_is_multi_pin(nid)) { |
| 3191 | struct alc_spec *spec = codec->spec; |
| 3192 | int idx = alc880_multi_pin_idx(nid); |
| 3193 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3194 | AC_VERB_SET_CONNECT_SEL, |
| 3195 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3196 | } |
| 3197 | } |
| 3198 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3199 | static int get_pin_type(int line_out_type) |
| 3200 | { |
| 3201 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3202 | return PIN_HP; |
| 3203 | else |
| 3204 | return PIN_OUT; |
| 3205 | } |
| 3206 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3207 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3208 | { |
| 3209 | struct alc_spec *spec = codec->spec; |
| 3210 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3211 | |
| 3212 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3213 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3214 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3215 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3216 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3217 | } |
| 3218 | } |
| 3219 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3220 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3221 | { |
| 3222 | struct alc_spec *spec = codec->spec; |
| 3223 | hda_nid_t pin; |
| 3224 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3225 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3226 | if (pin) /* connect to front */ |
| 3227 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3228 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3229 | if (pin) /* connect to front */ |
| 3230 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3231 | } |
| 3232 | |
| 3233 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3234 | { |
| 3235 | struct alc_spec *spec = codec->spec; |
| 3236 | int i; |
| 3237 | |
| 3238 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3239 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3240 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3241 | snd_hda_codec_write(codec, nid, 0, |
| 3242 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3243 | i <= AUTO_PIN_FRONT_MIC ? |
| 3244 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3245 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3246 | snd_hda_codec_write(codec, nid, 0, |
| 3247 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3248 | AMP_OUT_MUTE); |
| 3249 | } |
| 3250 | } |
| 3251 | } |
| 3252 | |
| 3253 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3254 | /* return 1 if successful, 0 if the proper config is not found, |
| 3255 | * or a negative error code |
| 3256 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3257 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3258 | { |
| 3259 | struct alc_spec *spec = codec->spec; |
| 3260 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3261 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3262 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3263 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3264 | alc880_ignore); |
| 3265 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3266 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3267 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3268 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3269 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3270 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3271 | if (err < 0) |
| 3272 | return err; |
| 3273 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3274 | if (err < 0) |
| 3275 | return err; |
| 3276 | err = alc880_auto_create_extra_out(spec, |
| 3277 | spec->autocfg.speaker_pins[0], |
| 3278 | "Speaker"); |
| 3279 | if (err < 0) |
| 3280 | return err; |
| 3281 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3282 | "Headphone"); |
| 3283 | if (err < 0) |
| 3284 | return err; |
| 3285 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3286 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3287 | return err; |
| 3288 | |
| 3289 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3290 | |
| 3291 | if (spec->autocfg.dig_out_pin) |
| 3292 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3293 | if (spec->autocfg.dig_in_pin) |
| 3294 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3295 | |
| 3296 | if (spec->kctl_alloc) |
| 3297 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3298 | |
| 3299 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3300 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3301 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3302 | spec->input_mux = &spec->private_imux; |
| 3303 | |
| 3304 | return 1; |
| 3305 | } |
| 3306 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3307 | /* additional initialization for auto-configuration model */ |
| 3308 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3309 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3310 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3311 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3312 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3313 | } |
| 3314 | |
| 3315 | /* |
| 3316 | * OK, here we have finally the patch for ALC880 |
| 3317 | */ |
| 3318 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3319 | static int patch_alc880(struct hda_codec *codec) |
| 3320 | { |
| 3321 | struct alc_spec *spec; |
| 3322 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3323 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3324 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3325 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3326 | if (spec == NULL) |
| 3327 | return -ENOMEM; |
| 3328 | |
| 3329 | codec->spec = spec; |
| 3330 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3331 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3332 | alc880_models, |
| 3333 | alc880_cfg_tbl); |
| 3334 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3335 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3336 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3337 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3338 | } |
| 3339 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3340 | if (board_config == ALC880_AUTO) { |
| 3341 | /* automatic parse from the BIOS config */ |
| 3342 | err = alc880_parse_auto_config(codec); |
| 3343 | if (err < 0) { |
| 3344 | alc_free(codec); |
| 3345 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3346 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3347 | printk(KERN_INFO |
| 3348 | "hda_codec: Cannot set up configuration " |
| 3349 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3350 | board_config = ALC880_3ST; |
| 3351 | } |
| 3352 | } |
| 3353 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3354 | if (board_config != ALC880_AUTO) |
| 3355 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3356 | |
| 3357 | spec->stream_name_analog = "ALC880 Analog"; |
| 3358 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3359 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3360 | |
| 3361 | spec->stream_name_digital = "ALC880 Digital"; |
| 3362 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3363 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3364 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3365 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3366 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3367 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3368 | /* get type */ |
| 3369 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3370 | if (wcap != AC_WID_AUD_IN) { |
| 3371 | spec->adc_nids = alc880_adc_nids_alt; |
| 3372 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3373 | spec->mixers[spec->num_mixers] = |
| 3374 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3375 | spec->num_mixers++; |
| 3376 | } else { |
| 3377 | spec->adc_nids = alc880_adc_nids; |
| 3378 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3379 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3380 | spec->num_mixers++; |
| 3381 | } |
| 3382 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3383 | |
| 3384 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3385 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3386 | spec->init_hook = alc880_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3387 | |
| 3388 | return 0; |
| 3389 | } |
| 3390 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3391 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3392 | /* |
| 3393 | * ALC260 support |
| 3394 | */ |
| 3395 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3396 | static hda_nid_t alc260_dac_nids[1] = { |
| 3397 | /* front */ |
| 3398 | 0x02, |
| 3399 | }; |
| 3400 | |
| 3401 | static hda_nid_t alc260_adc_nids[1] = { |
| 3402 | /* ADC0 */ |
| 3403 | 0x04, |
| 3404 | }; |
| 3405 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3406 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3407 | /* ADC1 */ |
| 3408 | 0x05, |
| 3409 | }; |
| 3410 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3411 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3412 | /* ADC1, 0 */ |
| 3413 | 0x05, 0x04 |
| 3414 | }; |
| 3415 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3416 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3417 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3418 | */ |
| 3419 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3420 | /* ADC0, ADC1 */ |
| 3421 | 0x04, 0x05 |
| 3422 | }; |
| 3423 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3424 | #define ALC260_DIGOUT_NID 0x03 |
| 3425 | #define ALC260_DIGIN_NID 0x06 |
| 3426 | |
| 3427 | static struct hda_input_mux alc260_capture_source = { |
| 3428 | .num_items = 4, |
| 3429 | .items = { |
| 3430 | { "Mic", 0x0 }, |
| 3431 | { "Front Mic", 0x1 }, |
| 3432 | { "Line", 0x2 }, |
| 3433 | { "CD", 0x4 }, |
| 3434 | }, |
| 3435 | }; |
| 3436 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3437 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3438 | * headphone jack and the internal CD lines since these are the only pins at |
| 3439 | * which audio can appear. For flexibility, also allow the option of |
| 3440 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3441 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3442 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3443 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3444 | { |
| 3445 | .num_items = 3, |
| 3446 | .items = { |
| 3447 | { "Mic/Line", 0x0 }, |
| 3448 | { "CD", 0x4 }, |
| 3449 | { "Headphone", 0x2 }, |
| 3450 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3451 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3452 | { |
| 3453 | .num_items = 4, |
| 3454 | .items = { |
| 3455 | { "Mic/Line", 0x0 }, |
| 3456 | { "CD", 0x4 }, |
| 3457 | { "Headphone", 0x2 }, |
| 3458 | { "Mixer", 0x5 }, |
| 3459 | }, |
| 3460 | }, |
| 3461 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3462 | }; |
| 3463 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3464 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3465 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3466 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3467 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3468 | { |
| 3469 | .num_items = 4, |
| 3470 | .items = { |
| 3471 | { "Mic", 0x0 }, |
| 3472 | { "Line", 0x2 }, |
| 3473 | { "CD", 0x4 }, |
| 3474 | { "Headphone", 0x5 }, |
| 3475 | }, |
| 3476 | }, |
| 3477 | { |
| 3478 | .num_items = 5, |
| 3479 | .items = { |
| 3480 | { "Mic", 0x0 }, |
| 3481 | { "Line", 0x2 }, |
| 3482 | { "CD", 0x4 }, |
| 3483 | { "Headphone", 0x6 }, |
| 3484 | { "Mixer", 0x5 }, |
| 3485 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3486 | }, |
| 3487 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3488 | /* |
| 3489 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3490 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3491 | * element which allows changing the channel mode, so the verb list is |
| 3492 | * never used. |
| 3493 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3494 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3495 | { 2, NULL }, |
| 3496 | }; |
| 3497 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3498 | |
| 3499 | /* Mixer combinations |
| 3500 | * |
| 3501 | * basic: base_output + input + pc_beep + capture |
| 3502 | * HP: base_output + input + capture_alt |
| 3503 | * HP_3013: hp_3013 + input + capture |
| 3504 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3505 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3506 | */ |
| 3507 | |
| 3508 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3509 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3510 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3511 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3512 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3513 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3514 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3515 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3516 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3517 | |
| 3518 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3519 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3520 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3521 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3522 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3523 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3524 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3525 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3526 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3527 | { } /* end */ |
| 3528 | }; |
| 3529 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3530 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3531 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3532 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3533 | { } /* end */ |
| 3534 | }; |
| 3535 | |
| 3536 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3538 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3539 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3540 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3541 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3542 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3543 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3544 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3545 | { } /* end */ |
| 3546 | }; |
| 3547 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3548 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3549 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3550 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3551 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3552 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3553 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3554 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3555 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3556 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3557 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3558 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3559 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3560 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3561 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3562 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3563 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3564 | { } /* end */ |
| 3565 | }; |
| 3566 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3567 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3568 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3569 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3570 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3571 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3572 | * revisions available in early 2006. Therefore for now allow the |
| 3573 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3574 | * that the lack of mic bias for this NID is intentional we could change the |
| 3575 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3576 | * |
| 3577 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3578 | * don't appear to make the mic bias available from the "line" jack, even |
| 3579 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3580 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3581 | * and the output jack. If this turns out to be the case for all such |
| 3582 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3583 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3584 | * |
| 3585 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3586 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 3587 | * controls for such models. On models without a "mono speaker" the control |
| 3588 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3589 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3590 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3591 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3592 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3593 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3594 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3595 | HDA_OUTPUT), |
| 3596 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 3597 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3598 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3599 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3600 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3601 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3602 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3603 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3604 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3605 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3606 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3607 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3608 | { } /* end */ |
| 3609 | }; |
| 3610 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3611 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 3612 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 3613 | */ |
| 3614 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 3615 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3616 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3618 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3619 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3620 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3621 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3622 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3623 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3624 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3625 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3626 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3627 | { } /* end */ |
| 3628 | }; |
| 3629 | |
| 3630 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 3631 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 3632 | */ |
| 3633 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 3634 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3635 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3636 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3637 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3638 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3639 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 3640 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 3641 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3642 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3643 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3644 | { } /* end */ |
| 3645 | }; |
| 3646 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3647 | /* capture mixer elements */ |
| 3648 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3649 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3650 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3651 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3652 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3653 | { |
| 3654 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3655 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3656 | * So call somewhat different.. |
| 3657 | * FIXME: the controls appear in the "playback" view! |
| 3658 | */ |
| 3659 | /* .name = "Capture Source", */ |
| 3660 | .name = "Input Source", |
| 3661 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3662 | .info = alc_mux_enum_info, |
| 3663 | .get = alc_mux_enum_get, |
| 3664 | .put = alc_mux_enum_put, |
| 3665 | }, |
| 3666 | { } /* end */ |
| 3667 | }; |
| 3668 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3669 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3670 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3671 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3672 | { |
| 3673 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3674 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3675 | * So call somewhat different.. |
| 3676 | * FIXME: the controls appear in the "playback" view! |
| 3677 | */ |
| 3678 | /* .name = "Capture Source", */ |
| 3679 | .name = "Input Source", |
| 3680 | .count = 1, |
| 3681 | .info = alc_mux_enum_info, |
| 3682 | .get = alc_mux_enum_get, |
| 3683 | .put = alc_mux_enum_put, |
| 3684 | }, |
| 3685 | { } /* end */ |
| 3686 | }; |
| 3687 | |
| 3688 | /* |
| 3689 | * initialization verbs |
| 3690 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3691 | static struct hda_verb alc260_init_verbs[] = { |
| 3692 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3693 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3694 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3695 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3696 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3697 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3698 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3699 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3700 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3701 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3702 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3703 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3704 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3705 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3706 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3707 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3708 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3709 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3710 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3711 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3712 | /* set connection select to line in (default select for this ADC) */ |
| 3713 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3714 | /* mute capture amp left and right */ |
| 3715 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3716 | /* set connection select to line in (default select for this ADC) */ |
| 3717 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3718 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3719 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3720 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3721 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3722 | /* set vol=0 HP mixer amp left and right */ |
| 3723 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3724 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3725 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3726 | /* set vol=0 Mono mixer amp left and right */ |
| 3727 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3728 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3729 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3730 | /* unmute LINE-2 out pin */ |
| 3731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
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 | */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3735 | /* mute CD */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3736 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3737 | /* mute Line In */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3738 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3739 | /* mute Mic */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3740 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3741 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3742 | /* mute Front out path */ |
| 3743 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3744 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3745 | /* mute Headphone out path */ |
| 3746 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3747 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3748 | /* mute Mono out path */ |
| 3749 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3750 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3751 | { } |
| 3752 | }; |
| 3753 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3754 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3755 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 3756 | /* Headphone and output */ |
| 3757 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 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 | /* Line-2 pin widget for output */ |
| 3767 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 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 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3803 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3804 | |
| 3805 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 3806 | /* Line out and output */ |
| 3807 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3808 | /* mono output */ |
| 3809 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3810 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3811 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3812 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3813 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3814 | /* Line In pin widget for input */ |
| 3815 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3816 | /* Headphone pin widget for output */ |
| 3817 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3818 | /* CD pin widget for input */ |
| 3819 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3820 | /* unmute amp left and right */ |
| 3821 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3822 | /* set connection select to line in (default select for this ADC) */ |
| 3823 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3824 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3825 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3826 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3827 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3828 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3829 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3830 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3831 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3832 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3833 | * Line In 2 = 0x03 |
| 3834 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3835 | /* unmute CD */ |
| 3836 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3837 | /* unmute Line In */ |
| 3838 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3839 | /* unmute Mic */ |
| 3840 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3841 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3842 | /* Unmute Front out path */ |
| 3843 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3844 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3845 | /* Unmute Headphone out path */ |
| 3846 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3847 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3848 | /* Unmute Mono out path */ |
| 3849 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3850 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3851 | { } |
| 3852 | }; |
| 3853 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3854 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3855 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 3856 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3857 | */ |
| 3858 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 3859 | /* Disable all GPIOs */ |
| 3860 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 3861 | /* Internal speaker is connected to headphone pin */ |
| 3862 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3863 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 3864 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3865 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 3866 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3867 | /* Ensure all other unused pins are disabled and muted. */ |
| 3868 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3869 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3870 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3871 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3872 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3873 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3874 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3875 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3876 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3877 | /* Disable digital (SPDIF) pins */ |
| 3878 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3879 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3880 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3881 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 3882 | * when acting as an output. |
| 3883 | */ |
| 3884 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3885 | |
| 3886 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 3887 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3888 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3889 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3890 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3891 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3892 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3893 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3894 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3895 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3896 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3897 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 3898 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3899 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 3900 | * If the pin mode is changed by the user the pin mode control will |
| 3901 | * take care of enabling the pin's input/output buffers as needed. |
| 3902 | * Therefore there's no need to enable the input buffer at this |
| 3903 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3904 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3905 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3906 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 3907 | * mixer ctrl) |
| 3908 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3909 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3910 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3911 | /* Mute capture amp left and right */ |
| 3912 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3913 | /* Set ADC connection select to match default mixer setting - line |
| 3914 | * in (on mic1 pin) |
| 3915 | */ |
| 3916 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3917 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3918 | /* Do the same for the second ADC: mute capture input amp and |
| 3919 | * set ADC connection to line in (on mic1 pin) |
| 3920 | */ |
| 3921 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3922 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3923 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3924 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3925 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3926 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3927 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3930 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3931 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3932 | {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] | 3933 | |
| 3934 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3935 | }; |
| 3936 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3937 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 3938 | * similar laptops (adapted from Fujitsu init verbs). |
| 3939 | */ |
| 3940 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 3941 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 3942 | * the headphone jack. Turn this on and rely on the standard mute |
| 3943 | * methods whenever the user wants to turn these outputs off. |
| 3944 | */ |
| 3945 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 3946 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3947 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 3948 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 3949 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3950 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 3951 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 3952 | /* Line In jack is connected to Line1 pin */ |
| 3953 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3954 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 3955 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3956 | /* Ensure all other unused pins are disabled and muted. */ |
| 3957 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3958 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3959 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3960 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3961 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3962 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3963 | /* Disable digital (SPDIF) pins */ |
| 3964 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3965 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3966 | |
| 3967 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 3968 | * bus when acting as outputs. |
| 3969 | */ |
| 3970 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3971 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3972 | |
| 3973 | /* Start with output sum widgets muted and their output gains at min */ |
| 3974 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3975 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3976 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3977 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3978 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3979 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3980 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3981 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3982 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3983 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3984 | /* Unmute Line-out pin widget amp left and right |
| 3985 | * (no equiv mixer ctrl) |
| 3986 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3987 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3988 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 3989 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3990 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 3991 | * inputs. If the pin mode is changed by the user the pin mode control |
| 3992 | * will take care of enabling the pin's input/output buffers as needed. |
| 3993 | * Therefore there's no need to enable the input buffer at this |
| 3994 | * stage. |
| 3995 | */ |
| 3996 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3997 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3998 | |
| 3999 | /* Mute capture amp left and right */ |
| 4000 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4001 | /* Set ADC connection select to match default mixer setting - mic |
| 4002 | * (on mic1 pin) |
| 4003 | */ |
| 4004 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4005 | |
| 4006 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4007 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4008 | */ |
| 4009 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4010 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4011 | |
| 4012 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4013 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4014 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4015 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4016 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4017 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4018 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4019 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4020 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4021 | |
| 4022 | { } |
| 4023 | }; |
| 4024 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4025 | static struct hda_verb alc260_will_verbs[] = { |
| 4026 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4027 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4028 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4029 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4030 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4031 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4032 | {} |
| 4033 | }; |
| 4034 | |
| 4035 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4036 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4037 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4038 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4039 | |
| 4040 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4041 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4042 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4043 | |
| 4044 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4045 | {} |
| 4046 | }; |
| 4047 | |
| 4048 | /* toggle speaker-output according to the hp-jack state */ |
| 4049 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4050 | { |
| 4051 | unsigned int present; |
| 4052 | |
| 4053 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4054 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4055 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4056 | if (present) { |
| 4057 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 1); |
| 4058 | snd_hda_codec_write(codec, 0x0f, 0, |
| 4059 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); |
| 4060 | } else { |
| 4061 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 4062 | snd_hda_codec_write(codec, 0x0f, 0, |
| 4063 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 4064 | } |
| 4065 | } |
| 4066 | |
| 4067 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4068 | unsigned int res) |
| 4069 | { |
| 4070 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4071 | alc260_replacer_672v_automute(codec); |
| 4072 | } |
| 4073 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4074 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4075 | * configuration. |
| 4076 | */ |
| 4077 | #ifdef CONFIG_SND_DEBUG |
| 4078 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4079 | 0x02, |
| 4080 | }; |
| 4081 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4082 | 0x04, 0x05, |
| 4083 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4084 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4085 | * the signal assignments are different. This assumes that the first ADC |
| 4086 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4087 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4088 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4089 | { |
| 4090 | .num_items = 7, |
| 4091 | .items = { |
| 4092 | { "MIC1 pin", 0x0 }, |
| 4093 | { "MIC2 pin", 0x1 }, |
| 4094 | { "LINE1 pin", 0x2 }, |
| 4095 | { "LINE2 pin", 0x3 }, |
| 4096 | { "CD pin", 0x4 }, |
| 4097 | { "LINE-OUT pin", 0x5 }, |
| 4098 | { "HP-OUT pin", 0x6 }, |
| 4099 | }, |
| 4100 | }, |
| 4101 | { |
| 4102 | .num_items = 8, |
| 4103 | .items = { |
| 4104 | { "MIC1 pin", 0x0 }, |
| 4105 | { "MIC2 pin", 0x1 }, |
| 4106 | { "LINE1 pin", 0x2 }, |
| 4107 | { "LINE2 pin", 0x3 }, |
| 4108 | { "CD pin", 0x4 }, |
| 4109 | { "Mixer", 0x5 }, |
| 4110 | { "LINE-OUT pin", 0x6 }, |
| 4111 | { "HP-OUT pin", 0x7 }, |
| 4112 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4113 | }, |
| 4114 | }; |
| 4115 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4116 | /* Output driver widgets */ |
| 4117 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4118 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4119 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4120 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4121 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4122 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4123 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4124 | /* Modes for retasking pin widgets |
| 4125 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4126 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4127 | * mention this restriction. At this stage it's not clear whether |
| 4128 | * this behaviour is intentional or is a hardware bug in chip |
| 4129 | * revisions available at least up until early 2006. Therefore for |
| 4130 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4131 | * choices, but if it turns out that the lack of mic bias for these |
| 4132 | * NIDs is intentional we could change their modes from |
| 4133 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4134 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4135 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4136 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4137 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4138 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4139 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4140 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4141 | |
| 4142 | /* Loopback mixer controls */ |
| 4143 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4144 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4145 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4146 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4147 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4148 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4149 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4150 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4151 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4152 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4153 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4154 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4155 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4156 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4157 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4158 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4159 | |
| 4160 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4161 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4162 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4163 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4164 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4165 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4166 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4167 | * is ambigious as to which NID is which; testing on laptops which |
| 4168 | * make this output available should provide clarification. |
| 4169 | */ |
| 4170 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4171 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4172 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4173 | { } /* end */ |
| 4174 | }; |
| 4175 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4176 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4177 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4178 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4179 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4180 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4181 | /* Enable retasking pins as output, initially without power amp */ |
| 4182 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4183 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4184 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4185 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4186 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4187 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4188 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4189 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4190 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4191 | * payload also sets the generation to 0, output to be in "consumer" |
| 4192 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4193 | * control. |
| 4194 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4195 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4196 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4197 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4198 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4199 | * OUT1 sum bus when acting as an output. |
| 4200 | */ |
| 4201 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4202 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4203 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4204 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4205 | |
| 4206 | /* Start with output sum widgets muted and their output gains at min */ |
| 4207 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4208 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4209 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4210 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4211 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4212 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4213 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4214 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4215 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4216 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4217 | /* Unmute retasking pin widget output buffers since the default |
| 4218 | * state appears to be output. As the pin mode is changed by the |
| 4219 | * user the pin mode control will take care of enabling the pin's |
| 4220 | * input/output buffers as needed. |
| 4221 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4222 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4223 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4224 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4225 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4226 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4227 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4228 | /* Also unmute the mono-out pin widget */ |
| 4229 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4230 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4231 | /* Mute capture amp left and right */ |
| 4232 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4233 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4234 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4235 | */ |
| 4236 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4237 | |
| 4238 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4239 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4240 | */ |
| 4241 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4242 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4243 | |
| 4244 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4245 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4246 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4247 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4249 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4250 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4251 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4252 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4253 | |
| 4254 | { } |
| 4255 | }; |
| 4256 | #endif |
| 4257 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4258 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 4259 | .substreams = 1, |
| 4260 | .channels_min = 2, |
| 4261 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4262 | }; |
| 4263 | |
| 4264 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 4265 | .substreams = 1, |
| 4266 | .channels_min = 2, |
| 4267 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4268 | }; |
| 4269 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4270 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4271 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4272 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4273 | /* |
| 4274 | * for BIOS auto-configuration |
| 4275 | */ |
| 4276 | |
| 4277 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4278 | const char *pfx) |
| 4279 | { |
| 4280 | hda_nid_t nid_vol; |
| 4281 | unsigned long vol_val, sw_val; |
| 4282 | char name[32]; |
| 4283 | int err; |
| 4284 | |
| 4285 | if (nid >= 0x0f && nid < 0x11) { |
| 4286 | nid_vol = nid - 0x7; |
| 4287 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4288 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4289 | } else if (nid == 0x11) { |
| 4290 | nid_vol = nid - 0x7; |
| 4291 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4292 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4293 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4294 | nid_vol = 0x08; |
| 4295 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4296 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4297 | } else |
| 4298 | return 0; /* N/A */ |
| 4299 | |
| 4300 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4301 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4302 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4303 | return err; |
| 4304 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4305 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4306 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4307 | return err; |
| 4308 | return 1; |
| 4309 | } |
| 4310 | |
| 4311 | /* add playback controls from the parsed DAC table */ |
| 4312 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4313 | const struct auto_pin_cfg *cfg) |
| 4314 | { |
| 4315 | hda_nid_t nid; |
| 4316 | int err; |
| 4317 | |
| 4318 | spec->multiout.num_dacs = 1; |
| 4319 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4320 | spec->multiout.dac_nids[0] = 0x02; |
| 4321 | |
| 4322 | nid = cfg->line_out_pins[0]; |
| 4323 | if (nid) { |
| 4324 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4325 | if (err < 0) |
| 4326 | return err; |
| 4327 | } |
| 4328 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4329 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4330 | if (nid) { |
| 4331 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4332 | if (err < 0) |
| 4333 | return err; |
| 4334 | } |
| 4335 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4336 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4337 | if (nid) { |
| 4338 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4339 | if (err < 0) |
| 4340 | return err; |
| 4341 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4342 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4343 | } |
| 4344 | |
| 4345 | /* create playback/capture controls for input pins */ |
| 4346 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4347 | const struct auto_pin_cfg *cfg) |
| 4348 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4349 | struct hda_input_mux *imux = &spec->private_imux; |
| 4350 | int i, err, idx; |
| 4351 | |
| 4352 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4353 | if (cfg->input_pins[i] >= 0x12) { |
| 4354 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4355 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4356 | auto_pin_cfg_labels[i], idx, |
| 4357 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4358 | if (err < 0) |
| 4359 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4360 | imux->items[imux->num_items].label = |
| 4361 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4362 | imux->items[imux->num_items].index = idx; |
| 4363 | imux->num_items++; |
| 4364 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4365 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4366 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4367 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4368 | auto_pin_cfg_labels[i], idx, |
| 4369 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4370 | if (err < 0) |
| 4371 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4372 | imux->items[imux->num_items].label = |
| 4373 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4374 | imux->items[imux->num_items].index = idx; |
| 4375 | imux->num_items++; |
| 4376 | } |
| 4377 | } |
| 4378 | return 0; |
| 4379 | } |
| 4380 | |
| 4381 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4382 | hda_nid_t nid, int pin_type, |
| 4383 | int sel_idx) |
| 4384 | { |
| 4385 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4386 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4387 | pin_type); |
| 4388 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4389 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4390 | /* need the manual connection? */ |
| 4391 | if (nid >= 0x12) { |
| 4392 | int idx = nid - 0x12; |
| 4393 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4394 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4395 | } |
| 4396 | } |
| 4397 | |
| 4398 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4399 | { |
| 4400 | struct alc_spec *spec = codec->spec; |
| 4401 | hda_nid_t nid; |
| 4402 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4403 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4404 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4405 | if (nid) { |
| 4406 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4407 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4408 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4409 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4410 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4411 | if (nid) |
| 4412 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4413 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4414 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4415 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4416 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4417 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4418 | |
| 4419 | #define ALC260_PIN_CD_NID 0x16 |
| 4420 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4421 | { |
| 4422 | struct alc_spec *spec = codec->spec; |
| 4423 | int i; |
| 4424 | |
| 4425 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4426 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4427 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4428 | snd_hda_codec_write(codec, nid, 0, |
| 4429 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4430 | i <= AUTO_PIN_FRONT_MIC ? |
| 4431 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4432 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4433 | snd_hda_codec_write(codec, nid, 0, |
| 4434 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4435 | AMP_OUT_MUTE); |
| 4436 | } |
| 4437 | } |
| 4438 | } |
| 4439 | |
| 4440 | /* |
| 4441 | * generic initialization of ADC, input mixers and output mixers |
| 4442 | */ |
| 4443 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4444 | /* |
| 4445 | * Unmute ADC0-1 and set the default input to mic-in |
| 4446 | */ |
| 4447 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4448 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4449 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4450 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4451 | |
| 4452 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4453 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4454 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4455 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4456 | */ |
| 4457 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 4458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 4461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 4462 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 4463 | |
| 4464 | /* |
| 4465 | * Set up output mixers (0x08 - 0x0a) |
| 4466 | */ |
| 4467 | /* set vol=0 to output mixers */ |
| 4468 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4469 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4470 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4471 | /* set up input amps for analog loopback */ |
| 4472 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4473 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4474 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4475 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4476 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4477 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4478 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4479 | |
| 4480 | { } |
| 4481 | }; |
| 4482 | |
| 4483 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4484 | { |
| 4485 | struct alc_spec *spec = codec->spec; |
| 4486 | unsigned int wcap; |
| 4487 | int err; |
| 4488 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4489 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4490 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4491 | alc260_ignore); |
| 4492 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4493 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4494 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4495 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4496 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4497 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4498 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4499 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4500 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4501 | return err; |
| 4502 | |
| 4503 | spec->multiout.max_channels = 2; |
| 4504 | |
| 4505 | if (spec->autocfg.dig_out_pin) |
| 4506 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4507 | if (spec->kctl_alloc) |
| 4508 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4509 | |
| 4510 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4511 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4512 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4513 | spec->input_mux = &spec->private_imux; |
| 4514 | |
| 4515 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4516 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4517 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4518 | if (wcap != AC_WID_AUD_IN) { |
| 4519 | spec->adc_nids = alc260_adc_nids_alt; |
| 4520 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4521 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4522 | } else { |
| 4523 | spec->adc_nids = alc260_adc_nids; |
| 4524 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4525 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4526 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4527 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4528 | |
| 4529 | return 1; |
| 4530 | } |
| 4531 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4532 | /* additional initialization for auto-configuration model */ |
| 4533 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4534 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4535 | alc260_auto_init_multi_out(codec); |
| 4536 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4537 | } |
| 4538 | |
| 4539 | /* |
| 4540 | * ALC260 configurations |
| 4541 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4542 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4543 | [ALC260_BASIC] = "basic", |
| 4544 | [ALC260_HP] = "hp", |
| 4545 | [ALC260_HP_3013] = "hp-3013", |
| 4546 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4547 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4548 | [ALC260_WILL] = "will", |
| 4549 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4550 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4551 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4552 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4553 | [ALC260_AUTO] = "auto", |
| 4554 | }; |
| 4555 | |
| 4556 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4557 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4558 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4559 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4560 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4561 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4562 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4563 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4564 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4565 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4566 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4567 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4568 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4569 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4570 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4571 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4572 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4573 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
| 4574 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4575 | {} |
| 4576 | }; |
| 4577 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4578 | static struct alc_config_preset alc260_presets[] = { |
| 4579 | [ALC260_BASIC] = { |
| 4580 | .mixers = { alc260_base_output_mixer, |
| 4581 | alc260_input_mixer, |
| 4582 | alc260_pc_beep_mixer, |
| 4583 | alc260_capture_mixer }, |
| 4584 | .init_verbs = { alc260_init_verbs }, |
| 4585 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4586 | .dac_nids = alc260_dac_nids, |
| 4587 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4588 | .adc_nids = alc260_adc_nids, |
| 4589 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4590 | .channel_mode = alc260_modes, |
| 4591 | .input_mux = &alc260_capture_source, |
| 4592 | }, |
| 4593 | [ALC260_HP] = { |
| 4594 | .mixers = { alc260_base_output_mixer, |
| 4595 | alc260_input_mixer, |
| 4596 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4597 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4598 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4599 | .dac_nids = alc260_dac_nids, |
| 4600 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4601 | .adc_nids = alc260_hp_adc_nids, |
| 4602 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4603 | .channel_mode = alc260_modes, |
| 4604 | .input_mux = &alc260_capture_source, |
| 4605 | }, |
| 4606 | [ALC260_HP_3013] = { |
| 4607 | .mixers = { alc260_hp_3013_mixer, |
| 4608 | alc260_input_mixer, |
| 4609 | alc260_capture_alt_mixer }, |
| 4610 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4611 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4612 | .dac_nids = alc260_dac_nids, |
| 4613 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4614 | .adc_nids = alc260_hp_adc_nids, |
| 4615 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4616 | .channel_mode = alc260_modes, |
| 4617 | .input_mux = &alc260_capture_source, |
| 4618 | }, |
| 4619 | [ALC260_FUJITSU_S702X] = { |
| 4620 | .mixers = { alc260_fujitsu_mixer, |
| 4621 | alc260_capture_mixer }, |
| 4622 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4623 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4624 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4625 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4626 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4627 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4628 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4629 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4630 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4631 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4632 | [ALC260_ACER] = { |
| 4633 | .mixers = { alc260_acer_mixer, |
| 4634 | alc260_capture_mixer }, |
| 4635 | .init_verbs = { alc260_acer_init_verbs }, |
| 4636 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4637 | .dac_nids = alc260_dac_nids, |
| 4638 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4639 | .adc_nids = alc260_dual_adc_nids, |
| 4640 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4641 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4642 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4643 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4644 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4645 | [ALC260_WILL] = { |
| 4646 | .mixers = { alc260_will_mixer, |
| 4647 | alc260_capture_mixer }, |
| 4648 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 4649 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4650 | .dac_nids = alc260_dac_nids, |
| 4651 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4652 | .adc_nids = alc260_adc_nids, |
| 4653 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4654 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4655 | .channel_mode = alc260_modes, |
| 4656 | .input_mux = &alc260_capture_source, |
| 4657 | }, |
| 4658 | [ALC260_REPLACER_672V] = { |
| 4659 | .mixers = { alc260_replacer_672v_mixer, |
| 4660 | alc260_capture_mixer }, |
| 4661 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 4662 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4663 | .dac_nids = alc260_dac_nids, |
| 4664 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4665 | .adc_nids = alc260_adc_nids, |
| 4666 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4667 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4668 | .channel_mode = alc260_modes, |
| 4669 | .input_mux = &alc260_capture_source, |
| 4670 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 4671 | .init_hook = alc260_replacer_672v_automute, |
| 4672 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4673 | #ifdef CONFIG_SND_DEBUG |
| 4674 | [ALC260_TEST] = { |
| 4675 | .mixers = { alc260_test_mixer, |
| 4676 | alc260_capture_mixer }, |
| 4677 | .init_verbs = { alc260_test_init_verbs }, |
| 4678 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4679 | .dac_nids = alc260_test_dac_nids, |
| 4680 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4681 | .adc_nids = alc260_test_adc_nids, |
| 4682 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4683 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4684 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4685 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4686 | }, |
| 4687 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4688 | }; |
| 4689 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4690 | static int patch_alc260(struct hda_codec *codec) |
| 4691 | { |
| 4692 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4693 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4694 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4695 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4696 | if (spec == NULL) |
| 4697 | return -ENOMEM; |
| 4698 | |
| 4699 | codec->spec = spec; |
| 4700 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4701 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 4702 | alc260_models, |
| 4703 | alc260_cfg_tbl); |
| 4704 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4705 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4706 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4707 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4708 | } |
| 4709 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4710 | if (board_config == ALC260_AUTO) { |
| 4711 | /* automatic parse from the BIOS config */ |
| 4712 | err = alc260_parse_auto_config(codec); |
| 4713 | if (err < 0) { |
| 4714 | alc_free(codec); |
| 4715 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4716 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4717 | printk(KERN_INFO |
| 4718 | "hda_codec: Cannot set up configuration " |
| 4719 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4720 | board_config = ALC260_BASIC; |
| 4721 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4722 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4723 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4724 | if (board_config != ALC260_AUTO) |
| 4725 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4726 | |
| 4727 | spec->stream_name_analog = "ALC260 Analog"; |
| 4728 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 4729 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 4730 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4731 | spec->stream_name_digital = "ALC260 Digital"; |
| 4732 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 4733 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 4734 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4735 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4736 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4737 | spec->init_hook = alc260_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4738 | |
| 4739 | return 0; |
| 4740 | } |
| 4741 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4742 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4743 | /* |
| 4744 | * ALC882 support |
| 4745 | * |
| 4746 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 4747 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4748 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4749 | * 6-channel independent captures. |
| 4750 | * |
| 4751 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4752 | * driver yet). |
| 4753 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4754 | #define ALC882_DIGOUT_NID 0x06 |
| 4755 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4756 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4757 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4758 | { 8, NULL } |
| 4759 | }; |
| 4760 | |
| 4761 | static hda_nid_t alc882_dac_nids[4] = { |
| 4762 | /* front, rear, clfe, rear_surr */ |
| 4763 | 0x02, 0x03, 0x04, 0x05 |
| 4764 | }; |
| 4765 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4766 | /* identical with ALC880 */ |
| 4767 | #define alc882_adc_nids alc880_adc_nids |
| 4768 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4769 | |
| 4770 | /* input MUX */ |
| 4771 | /* FIXME: should be a matrix-type input source selection */ |
| 4772 | |
| 4773 | static struct hda_input_mux alc882_capture_source = { |
| 4774 | .num_items = 4, |
| 4775 | .items = { |
| 4776 | { "Mic", 0x0 }, |
| 4777 | { "Front Mic", 0x1 }, |
| 4778 | { "Line", 0x2 }, |
| 4779 | { "CD", 0x4 }, |
| 4780 | }, |
| 4781 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4782 | #define alc882_mux_enum_info alc_mux_enum_info |
| 4783 | #define alc882_mux_enum_get alc_mux_enum_get |
| 4784 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4785 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 4786 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4787 | { |
| 4788 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4789 | struct alc_spec *spec = codec->spec; |
| 4790 | const struct hda_input_mux *imux = spec->input_mux; |
| 4791 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4792 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4793 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4794 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4795 | unsigned int i, idx; |
| 4796 | |
| 4797 | idx = ucontrol->value.enumerated.item[0]; |
| 4798 | if (idx >= imux->num_items) |
| 4799 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4800 | if (*cur_val == idx && !codec->in_resume) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4801 | return 0; |
| 4802 | for (i = 0; i < imux->num_items; i++) { |
| 4803 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 4804 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4805 | v | (imux->items[i].index << 8)); |
| 4806 | } |
| 4807 | *cur_val = idx; |
| 4808 | return 1; |
| 4809 | } |
| 4810 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4811 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4812 | * 2ch mode |
| 4813 | */ |
| 4814 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 4815 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 4816 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4817 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 4818 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4819 | { } /* end */ |
| 4820 | }; |
| 4821 | |
| 4822 | /* |
| 4823 | * 6ch mode |
| 4824 | */ |
| 4825 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 4826 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4827 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4828 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 4829 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4830 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4831 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 4832 | { } /* end */ |
| 4833 | }; |
| 4834 | |
| 4835 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 4836 | { 2, alc882_3ST_ch2_init }, |
| 4837 | { 6, alc882_3ST_ch6_init }, |
| 4838 | }; |
| 4839 | |
| 4840 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4841 | * 6ch mode |
| 4842 | */ |
| 4843 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 4844 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4845 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4846 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4847 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4848 | { } /* end */ |
| 4849 | }; |
| 4850 | |
| 4851 | /* |
| 4852 | * 8ch mode |
| 4853 | */ |
| 4854 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 4855 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4856 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4857 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4858 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4859 | { } /* end */ |
| 4860 | }; |
| 4861 | |
| 4862 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 4863 | { 6, alc882_sixstack_ch6_init }, |
| 4864 | { 8, alc882_sixstack_ch8_init }, |
| 4865 | }; |
| 4866 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4867 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 4868 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 4869 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4870 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4871 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4872 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4873 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4874 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4875 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 4876 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4877 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 4878 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4879 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4880 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4881 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4882 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4883 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4884 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4885 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4886 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4887 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4888 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4889 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4890 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4891 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4892 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4893 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4894 | { } /* end */ |
| 4895 | }; |
| 4896 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 4897 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 4898 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4899 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4900 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4901 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4902 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4903 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4904 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4905 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 4906 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4907 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4908 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 4909 | { } /* end */ |
| 4910 | }; |
| 4911 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4912 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 4913 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4914 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4915 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4916 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4917 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4918 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4919 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4920 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4921 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4922 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4923 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4924 | { } /* end */ |
| 4925 | }; |
| 4926 | |
| 4927 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 4928 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 4929 | */ |
| 4930 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 4931 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4932 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 4933 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 4934 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 4935 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4936 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4937 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4938 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4939 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 4940 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 4941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4942 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4943 | { } /* end */ |
| 4944 | }; |
| 4945 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 4947 | { |
| 4948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4949 | .name = "Channel Mode", |
| 4950 | .info = alc_ch_mode_info, |
| 4951 | .get = alc_ch_mode_get, |
| 4952 | .put = alc_ch_mode_put, |
| 4953 | }, |
| 4954 | { } /* end */ |
| 4955 | }; |
| 4956 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4957 | static struct hda_verb alc882_init_verbs[] = { |
| 4958 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4959 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4960 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4961 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4962 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4963 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4964 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4966 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4967 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4968 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4969 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4970 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4971 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4972 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4973 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4974 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4975 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4976 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4978 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4979 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4980 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4981 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4982 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4983 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4984 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4985 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4986 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4987 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4988 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4989 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4990 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4991 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4992 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4993 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4994 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4995 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4996 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4997 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4998 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4999 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5000 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5001 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5002 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5003 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5004 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5005 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5006 | |
| 5007 | /* FIXME: use matrix-type input source selection */ |
| 5008 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5009 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5010 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5011 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5012 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5013 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5014 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5015 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5016 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5017 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5018 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5019 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5020 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5021 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5022 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5023 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5024 | /* ADC1: mute amp left and right */ |
| 5025 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5026 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5027 | /* ADC2: mute amp left and right */ |
| 5028 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5029 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5030 | /* ADC3: mute amp left and right */ |
| 5031 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5032 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5033 | |
| 5034 | { } |
| 5035 | }; |
| 5036 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5037 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5038 | /* change to EAPD mode */ |
| 5039 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5040 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5041 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5042 | }; |
| 5043 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5044 | /* Mac Pro test */ |
| 5045 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5046 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5047 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5048 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5050 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5051 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5052 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5053 | { } /* end */ |
| 5054 | }; |
| 5055 | |
| 5056 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5057 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5058 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5059 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5061 | /* Front Pin: output 0 (0x0c) */ |
| 5062 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5063 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5064 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5065 | /* Front Mic pin: input vref at 80% */ |
| 5066 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5067 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5068 | /* Speaker: output */ |
| 5069 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5070 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5071 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5072 | /* Headphone output (output 0 - 0x0c) */ |
| 5073 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5075 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5076 | |
| 5077 | /* FIXME: use matrix-type input source selection */ |
| 5078 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5079 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5080 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5081 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5082 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5083 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5084 | /* Input mixer2 */ |
| 5085 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5086 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5087 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5088 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5089 | /* Input mixer3 */ |
| 5090 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5092 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5093 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5094 | /* ADC1: mute amp left and right */ |
| 5095 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5096 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5097 | /* ADC2: mute amp left and right */ |
| 5098 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5099 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5100 | /* ADC3: mute amp left and right */ |
| 5101 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5102 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5103 | |
| 5104 | { } |
| 5105 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5106 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5107 | /* iMac 24 mixer. */ |
| 5108 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5109 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5110 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5111 | { } /* end */ |
| 5112 | }; |
| 5113 | |
| 5114 | /* iMac 24 init verbs. */ |
| 5115 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5116 | /* Internal speakers: output 0 (0x0c) */ |
| 5117 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5118 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5119 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5120 | /* Internal speakers: output 0 (0x0c) */ |
| 5121 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5122 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5123 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5124 | /* Headphone: output 0 (0x0c) */ |
| 5125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5126 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5127 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5128 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5129 | /* Front Mic: input vref at 80% */ |
| 5130 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5131 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5132 | { } |
| 5133 | }; |
| 5134 | |
| 5135 | /* Toggle speaker-output according to the hp-jack state */ |
| 5136 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5137 | { |
| 5138 | unsigned int present; |
| 5139 | |
| 5140 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5141 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5142 | snd_hda_codec_amp_update(codec, 0x18, 0, HDA_OUTPUT, 0, |
| 5143 | 0x80, present ? 0x80 : 0); |
| 5144 | snd_hda_codec_amp_update(codec, 0x18, 1, HDA_OUTPUT, 0, |
| 5145 | 0x80, present ? 0x80 : 0); |
| 5146 | snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_OUTPUT, 0, |
| 5147 | 0x80, present ? 0x80 : 0); |
| 5148 | snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_OUTPUT, 0, |
| 5149 | 0x80, present ? 0x80 : 0); |
| 5150 | } |
| 5151 | |
| 5152 | /* Processes unsolicited events. */ |
| 5153 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5154 | unsigned int res) |
| 5155 | { |
| 5156 | /* Headphone insertion or removal. */ |
| 5157 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5158 | alc885_imac24_automute(codec); |
| 5159 | } |
| 5160 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5161 | static struct hda_verb alc882_targa_verbs[] = { |
| 5162 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5163 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5164 | |
| 5165 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5166 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5167 | |
| 5168 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5169 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5170 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5171 | |
| 5172 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5173 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5174 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5175 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5176 | { } /* end */ |
| 5177 | }; |
| 5178 | |
| 5179 | /* toggle speaker-output according to the hp-jack state */ |
| 5180 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5181 | { |
| 5182 | unsigned int present; |
| 5183 | |
| 5184 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5185 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5186 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 5187 | 0x80, present ? 0x80 : 0); |
| 5188 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 5189 | 0x80, present ? 0x80 : 0); |
| 5190 | snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3); |
| 5191 | } |
| 5192 | |
| 5193 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5194 | { |
| 5195 | /* Looks like the unsol event is incompatible with the standard |
| 5196 | * definition. 4bit tag is placed at 26 bit! |
| 5197 | */ |
| 5198 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5199 | alc882_targa_automute(codec); |
| 5200 | } |
| 5201 | } |
| 5202 | |
| 5203 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5204 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5205 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5206 | |
| 5207 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5208 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5209 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5210 | |
| 5211 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5212 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5213 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5214 | |
| 5215 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5216 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5217 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5218 | { } /* end */ |
| 5219 | }; |
| 5220 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5221 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5222 | { |
| 5223 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5224 | |
| 5225 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5226 | AC_VERB_GET_GPIO_DATA, 0); |
| 5227 | |
| 5228 | if (!muted) |
| 5229 | gpiostate |= (1 << pin); |
| 5230 | else |
| 5231 | gpiostate &= ~(1 << pin); |
| 5232 | |
| 5233 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5234 | AC_VERB_GET_GPIO_MASK, 0); |
| 5235 | gpiomask |= (1 << pin); |
| 5236 | |
| 5237 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5238 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5239 | gpiodir |= (1 << pin); |
| 5240 | |
| 5241 | |
| 5242 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5243 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5244 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5245 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5246 | |
| 5247 | msleep(1); |
| 5248 | |
| 5249 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5250 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5251 | } |
| 5252 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5253 | /* |
| 5254 | * generic initialization of ADC, input mixers and output mixers |
| 5255 | */ |
| 5256 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5257 | /* |
| 5258 | * Unmute ADC0-2 and set the default input to mic-in |
| 5259 | */ |
| 5260 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5261 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5262 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5263 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5264 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5265 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5266 | |
| 5267 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5268 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5269 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5270 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5271 | */ |
| 5272 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 5273 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5274 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5275 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5276 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5277 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5278 | |
| 5279 | /* |
| 5280 | * Set up output mixers (0x0c - 0x0f) |
| 5281 | */ |
| 5282 | /* set vol=0 to output mixers */ |
| 5283 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5284 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5285 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5286 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5287 | /* set up input amps for analog loopback */ |
| 5288 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5289 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5290 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5291 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5292 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5293 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5294 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5295 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5296 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5297 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5298 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5299 | |
| 5300 | /* FIXME: use matrix-type input source selection */ |
| 5301 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5302 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5303 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5304 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5305 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5306 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5307 | /* Input mixer2 */ |
| 5308 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5309 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5310 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5311 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5312 | /* Input mixer3 */ |
| 5313 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5315 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5316 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5317 | |
| 5318 | { } |
| 5319 | }; |
| 5320 | |
| 5321 | /* capture mixer elements */ |
| 5322 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5323 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5324 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5325 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5326 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5327 | { |
| 5328 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5329 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5330 | * So call somewhat different.. |
| 5331 | * FIXME: the controls appear in the "playback" view! |
| 5332 | */ |
| 5333 | /* .name = "Capture Source", */ |
| 5334 | .name = "Input Source", |
| 5335 | .count = 2, |
| 5336 | .info = alc882_mux_enum_info, |
| 5337 | .get = alc882_mux_enum_get, |
| 5338 | .put = alc882_mux_enum_put, |
| 5339 | }, |
| 5340 | { } /* end */ |
| 5341 | }; |
| 5342 | |
| 5343 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5344 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5345 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5346 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5347 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5348 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5349 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5350 | { |
| 5351 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5352 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5353 | * So call somewhat different.. |
| 5354 | * FIXME: the controls appear in the "playback" view! |
| 5355 | */ |
| 5356 | /* .name = "Capture Source", */ |
| 5357 | .name = "Input Source", |
| 5358 | .count = 3, |
| 5359 | .info = alc882_mux_enum_info, |
| 5360 | .get = alc882_mux_enum_get, |
| 5361 | .put = alc882_mux_enum_put, |
| 5362 | }, |
| 5363 | { } /* end */ |
| 5364 | }; |
| 5365 | |
| 5366 | /* pcm configuration: identiacal with ALC880 */ |
| 5367 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5368 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5369 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5370 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5371 | |
| 5372 | /* |
| 5373 | * configuration and preset |
| 5374 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5375 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5376 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5377 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5378 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5379 | [ALC882_W2JC] = "w2jc", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5380 | [ALC885_MACPRO] = "macpro", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5381 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5382 | [ALC882_AUTO] = "auto", |
| 5383 | }; |
| 5384 | |
| 5385 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 5386 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 5387 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
| 5388 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5389 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5390 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5391 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 5392 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 5393 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5394 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5395 | {} |
| 5396 | }; |
| 5397 | |
| 5398 | static struct alc_config_preset alc882_presets[] = { |
| 5399 | [ALC882_3ST_DIG] = { |
| 5400 | .mixers = { alc882_base_mixer }, |
| 5401 | .init_verbs = { alc882_init_verbs }, |
| 5402 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5403 | .dac_nids = alc882_dac_nids, |
| 5404 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5405 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5406 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5407 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5408 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5409 | .input_mux = &alc882_capture_source, |
| 5410 | }, |
| 5411 | [ALC882_6ST_DIG] = { |
| 5412 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5413 | .init_verbs = { alc882_init_verbs }, |
| 5414 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5415 | .dac_nids = alc882_dac_nids, |
| 5416 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5417 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5418 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5419 | .channel_mode = alc882_sixstack_modes, |
| 5420 | .input_mux = &alc882_capture_source, |
| 5421 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5422 | [ALC882_ARIMA] = { |
| 5423 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5424 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 5425 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5426 | .dac_nids = alc882_dac_nids, |
| 5427 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5428 | .channel_mode = alc882_sixstack_modes, |
| 5429 | .input_mux = &alc882_capture_source, |
| 5430 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5431 | [ALC882_W2JC] = { |
| 5432 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 5433 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5434 | alc880_gpio1_init_verbs }, |
| 5435 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5436 | .dac_nids = alc882_dac_nids, |
| 5437 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5438 | .channel_mode = alc880_threestack_modes, |
| 5439 | .need_dac_fix = 1, |
| 5440 | .input_mux = &alc882_capture_source, |
| 5441 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5442 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5443 | [ALC885_MACPRO] = { |
| 5444 | .mixers = { alc882_macpro_mixer }, |
| 5445 | .init_verbs = { alc882_macpro_init_verbs }, |
| 5446 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5447 | .dac_nids = alc882_dac_nids, |
| 5448 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5449 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5450 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5451 | .channel_mode = alc882_ch_modes, |
| 5452 | .input_mux = &alc882_capture_source, |
| 5453 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5454 | [ALC885_IMAC24] = { |
| 5455 | .mixers = { alc885_imac24_mixer }, |
| 5456 | .init_verbs = { alc885_imac24_init_verbs }, |
| 5457 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5458 | .dac_nids = alc882_dac_nids, |
| 5459 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5460 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5461 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5462 | .channel_mode = alc882_ch_modes, |
| 5463 | .input_mux = &alc882_capture_source, |
| 5464 | .unsol_event = alc885_imac24_unsol_event, |
| 5465 | .init_hook = alc885_imac24_automute, |
| 5466 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5467 | [ALC882_TARGA] = { |
| 5468 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 5469 | alc882_capture_mixer }, |
| 5470 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 5471 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5472 | .dac_nids = alc882_dac_nids, |
| 5473 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5474 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5475 | .adc_nids = alc882_adc_nids, |
| 5476 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5477 | .channel_mode = alc882_3ST_6ch_modes, |
| 5478 | .need_dac_fix = 1, |
| 5479 | .input_mux = &alc882_capture_source, |
| 5480 | .unsol_event = alc882_targa_unsol_event, |
| 5481 | .init_hook = alc882_targa_automute, |
| 5482 | }, |
| 5483 | [ALC882_ASUS_A7J] = { |
| 5484 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 5485 | alc882_capture_mixer }, |
| 5486 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 5487 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5488 | .dac_nids = alc882_dac_nids, |
| 5489 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5490 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5491 | .adc_nids = alc882_adc_nids, |
| 5492 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5493 | .channel_mode = alc882_3ST_6ch_modes, |
| 5494 | .need_dac_fix = 1, |
| 5495 | .input_mux = &alc882_capture_source, |
| 5496 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5497 | }; |
| 5498 | |
| 5499 | |
| 5500 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 5501 | * Pin config fixes |
| 5502 | */ |
| 5503 | enum { |
| 5504 | PINFIX_ABIT_AW9D_MAX |
| 5505 | }; |
| 5506 | |
| 5507 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 5508 | { 0x15, 0x01080104 }, /* side */ |
| 5509 | { 0x16, 0x01011012 }, /* rear */ |
| 5510 | { 0x17, 0x01016011 }, /* clfe */ |
| 5511 | { } |
| 5512 | }; |
| 5513 | |
| 5514 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 5515 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 5516 | }; |
| 5517 | |
| 5518 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 5519 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 5520 | {} |
| 5521 | }; |
| 5522 | |
| 5523 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5524 | * BIOS auto configuration |
| 5525 | */ |
| 5526 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5527 | hda_nid_t nid, int pin_type, |
| 5528 | int dac_idx) |
| 5529 | { |
| 5530 | /* set as output */ |
| 5531 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5532 | int idx; |
| 5533 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5534 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 5535 | idx = 4; |
| 5536 | else |
| 5537 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 5538 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5539 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5540 | pin_type); |
| 5541 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5542 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5543 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 5544 | |
| 5545 | } |
| 5546 | |
| 5547 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 5548 | { |
| 5549 | struct alc_spec *spec = codec->spec; |
| 5550 | int i; |
| 5551 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5552 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5553 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5554 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5555 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5556 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5557 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5558 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5559 | } |
| 5560 | } |
| 5561 | |
| 5562 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 5563 | { |
| 5564 | struct alc_spec *spec = codec->spec; |
| 5565 | hda_nid_t pin; |
| 5566 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5567 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5568 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5569 | /* use dac 0 */ |
| 5570 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5571 | } |
| 5572 | |
| 5573 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 5574 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 5575 | |
| 5576 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 5577 | { |
| 5578 | struct alc_spec *spec = codec->spec; |
| 5579 | int i; |
| 5580 | |
| 5581 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5582 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5583 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5584 | snd_hda_codec_write(codec, nid, 0, |
| 5585 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5586 | i <= AUTO_PIN_FRONT_MIC ? |
| 5587 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5588 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5589 | snd_hda_codec_write(codec, nid, 0, |
| 5590 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5591 | AMP_OUT_MUTE); |
| 5592 | } |
| 5593 | } |
| 5594 | } |
| 5595 | |
| 5596 | /* almost identical with ALC880 parser... */ |
| 5597 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 5598 | { |
| 5599 | struct alc_spec *spec = codec->spec; |
| 5600 | int err = alc880_parse_auto_config(codec); |
| 5601 | |
| 5602 | if (err < 0) |
| 5603 | return err; |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 5604 | else if (err > 0) |
| 5605 | /* hack - override the init verbs */ |
| 5606 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 5607 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5608 | } |
| 5609 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5610 | /* additional initialization for auto-configuration model */ |
| 5611 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5612 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5613 | alc882_auto_init_multi_out(codec); |
| 5614 | alc882_auto_init_hp_out(codec); |
| 5615 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5616 | } |
| 5617 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5618 | static int patch_alc882(struct hda_codec *codec) |
| 5619 | { |
| 5620 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5621 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5622 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5623 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5624 | if (spec == NULL) |
| 5625 | return -ENOMEM; |
| 5626 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5627 | codec->spec = spec; |
| 5628 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5629 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 5630 | alc882_models, |
| 5631 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5632 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5633 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5634 | /* Pick up systems that don't supply PCI SSID */ |
| 5635 | switch (codec->subsystem_id) { |
| 5636 | case 0x106b0c00: /* Mac Pro */ |
| 5637 | board_config = ALC885_MACPRO; |
| 5638 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5639 | case 0x106b1000: /* iMac 24 */ |
| 5640 | board_config = ALC885_IMAC24; |
| 5641 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5642 | default: |
| 5643 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 5644 | "trying auto-probe from BIOS...\n"); |
| 5645 | board_config = ALC882_AUTO; |
| 5646 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5647 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5648 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 5649 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 5650 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5651 | if (board_config == ALC882_AUTO) { |
| 5652 | /* automatic parse from the BIOS config */ |
| 5653 | err = alc882_parse_auto_config(codec); |
| 5654 | if (err < 0) { |
| 5655 | alc_free(codec); |
| 5656 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5657 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5658 | printk(KERN_INFO |
| 5659 | "hda_codec: Cannot set up configuration " |
| 5660 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5661 | board_config = ALC882_3ST_DIG; |
| 5662 | } |
| 5663 | } |
| 5664 | |
| 5665 | if (board_config != ALC882_AUTO) |
| 5666 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5667 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5668 | if (board_config == ALC885_MACPRO || board_config == ALC885_IMAC24) { |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5669 | alc882_gpio_mute(codec, 0, 0); |
| 5670 | alc882_gpio_mute(codec, 1, 0); |
| 5671 | } |
| 5672 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5673 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5674 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 5675 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5676 | |
| 5677 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5678 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 5679 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5680 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5681 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5682 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5683 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5684 | /* get type */ |
| 5685 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5686 | if (wcap != AC_WID_AUD_IN) { |
| 5687 | spec->adc_nids = alc882_adc_nids_alt; |
| 5688 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5689 | spec->mixers[spec->num_mixers] = |
| 5690 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5691 | spec->num_mixers++; |
| 5692 | } else { |
| 5693 | spec->adc_nids = alc882_adc_nids; |
| 5694 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 5695 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 5696 | spec->num_mixers++; |
| 5697 | } |
| 5698 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5699 | |
| 5700 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5701 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5702 | spec->init_hook = alc882_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5703 | |
| 5704 | return 0; |
| 5705 | } |
| 5706 | |
| 5707 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5708 | * ALC883 support |
| 5709 | * |
| 5710 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 5711 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5712 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5713 | * 6-channel independent captures. |
| 5714 | * |
| 5715 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5716 | * driver yet). |
| 5717 | */ |
| 5718 | #define ALC883_DIGOUT_NID 0x06 |
| 5719 | #define ALC883_DIGIN_NID 0x0a |
| 5720 | |
| 5721 | static hda_nid_t alc883_dac_nids[4] = { |
| 5722 | /* front, rear, clfe, rear_surr */ |
| 5723 | 0x02, 0x04, 0x03, 0x05 |
| 5724 | }; |
| 5725 | |
| 5726 | static hda_nid_t alc883_adc_nids[2] = { |
| 5727 | /* ADC1-2 */ |
| 5728 | 0x08, 0x09, |
| 5729 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5730 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5731 | /* input MUX */ |
| 5732 | /* FIXME: should be a matrix-type input source selection */ |
| 5733 | |
| 5734 | static struct hda_input_mux alc883_capture_source = { |
| 5735 | .num_items = 4, |
| 5736 | .items = { |
| 5737 | { "Mic", 0x0 }, |
| 5738 | { "Front Mic", 0x1 }, |
| 5739 | { "Line", 0x2 }, |
| 5740 | { "CD", 0x4 }, |
| 5741 | }, |
| 5742 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5743 | |
| 5744 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 5745 | .num_items = 2, |
| 5746 | .items = { |
| 5747 | { "Mic", 0x1 }, |
| 5748 | { "Line", 0x2 }, |
| 5749 | }, |
| 5750 | }; |
| 5751 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5752 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 5753 | .num_items = 4, |
| 5754 | .items = { |
| 5755 | { "Mic", 0x0 }, |
| 5756 | { "iMic", 0x1 }, |
| 5757 | { "Line", 0x2 }, |
| 5758 | { "CD", 0x4 }, |
| 5759 | }, |
| 5760 | }; |
| 5761 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5762 | #define alc883_mux_enum_info alc_mux_enum_info |
| 5763 | #define alc883_mux_enum_get alc_mux_enum_get |
| 5764 | |
| 5765 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5766 | struct snd_ctl_elem_value *ucontrol) |
| 5767 | { |
| 5768 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5769 | struct alc_spec *spec = codec->spec; |
| 5770 | const struct hda_input_mux *imux = spec->input_mux; |
| 5771 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5772 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 5773 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 5774 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5775 | unsigned int i, idx; |
| 5776 | |
| 5777 | idx = ucontrol->value.enumerated.item[0]; |
| 5778 | if (idx >= imux->num_items) |
| 5779 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5780 | if (*cur_val == idx && !codec->in_resume) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5781 | return 0; |
| 5782 | for (i = 0; i < imux->num_items; i++) { |
| 5783 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 5784 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5785 | v | (imux->items[i].index << 8)); |
| 5786 | } |
| 5787 | *cur_val = idx; |
| 5788 | return 1; |
| 5789 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5790 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5791 | /* |
| 5792 | * 2ch mode |
| 5793 | */ |
| 5794 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 5795 | { 2, NULL } |
| 5796 | }; |
| 5797 | |
| 5798 | /* |
| 5799 | * 2ch mode |
| 5800 | */ |
| 5801 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 5802 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5803 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5804 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5805 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5806 | { } /* end */ |
| 5807 | }; |
| 5808 | |
| 5809 | /* |
| 5810 | * 6ch mode |
| 5811 | */ |
| 5812 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 5813 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5814 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5815 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5816 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5817 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5818 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5819 | { } /* end */ |
| 5820 | }; |
| 5821 | |
| 5822 | static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { |
| 5823 | { 2, alc883_3ST_ch2_init }, |
| 5824 | { 6, alc883_3ST_ch6_init }, |
| 5825 | }; |
| 5826 | |
| 5827 | /* |
| 5828 | * 6ch mode |
| 5829 | */ |
| 5830 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 5831 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5832 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5833 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5834 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5835 | { } /* end */ |
| 5836 | }; |
| 5837 | |
| 5838 | /* |
| 5839 | * 8ch mode |
| 5840 | */ |
| 5841 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 5842 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5843 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5844 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5845 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5846 | { } /* end */ |
| 5847 | }; |
| 5848 | |
| 5849 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 5850 | { 6, alc883_sixstack_ch6_init }, |
| 5851 | { 8, alc883_sixstack_ch8_init }, |
| 5852 | }; |
| 5853 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5854 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 5855 | /* eanable EAPD on medion laptop */ |
| 5856 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5857 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 5858 | { } |
| 5859 | }; |
| 5860 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5861 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5862 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5863 | */ |
| 5864 | |
| 5865 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 5866 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5867 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5868 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5869 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5870 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5871 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5872 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5873 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5874 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 5875 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 5876 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5877 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5878 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5879 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5880 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5881 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5882 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5884 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5885 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5886 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5887 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5888 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5889 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5890 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5891 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5892 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5893 | { |
| 5894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5895 | /* .name = "Capture Source", */ |
| 5896 | .name = "Input Source", |
| 5897 | .count = 2, |
| 5898 | .info = alc883_mux_enum_info, |
| 5899 | .get = alc883_mux_enum_get, |
| 5900 | .put = alc883_mux_enum_put, |
| 5901 | }, |
| 5902 | { } /* end */ |
| 5903 | }; |
| 5904 | |
| 5905 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 5906 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5907 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5908 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5909 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5910 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5911 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5912 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5913 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5914 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5915 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5916 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5917 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5918 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5919 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5920 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5921 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5922 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5923 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5924 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5925 | { |
| 5926 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5927 | /* .name = "Capture Source", */ |
| 5928 | .name = "Input Source", |
| 5929 | .count = 2, |
| 5930 | .info = alc883_mux_enum_info, |
| 5931 | .get = alc883_mux_enum_get, |
| 5932 | .put = alc883_mux_enum_put, |
| 5933 | }, |
| 5934 | { } /* end */ |
| 5935 | }; |
| 5936 | |
| 5937 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 5938 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5939 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5940 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5941 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5942 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5943 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5944 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5945 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5946 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5948 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5950 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5952 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5953 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5954 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5955 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5956 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5957 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5958 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5959 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5960 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5961 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5962 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5963 | { |
| 5964 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5965 | /* .name = "Capture Source", */ |
| 5966 | .name = "Input Source", |
| 5967 | .count = 2, |
| 5968 | .info = alc883_mux_enum_info, |
| 5969 | .get = alc883_mux_enum_get, |
| 5970 | .put = alc883_mux_enum_put, |
| 5971 | }, |
| 5972 | { } /* end */ |
| 5973 | }; |
| 5974 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 5975 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5976 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5977 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5978 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5979 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5980 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5981 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5982 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 5983 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 5984 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5985 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5986 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5987 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5988 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5990 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5991 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5992 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5993 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5994 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5995 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5996 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5997 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5998 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5999 | |
| 6000 | { |
| 6001 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6002 | /* .name = "Capture Source", */ |
| 6003 | .name = "Input Source", |
| 6004 | .count = 1, |
| 6005 | .info = alc883_mux_enum_info, |
| 6006 | .get = alc883_mux_enum_get, |
| 6007 | .put = alc883_mux_enum_put, |
| 6008 | }, |
| 6009 | { } /* end */ |
| 6010 | }; |
| 6011 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6012 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6014 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6015 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6016 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6017 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6018 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6019 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6020 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6021 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6022 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6023 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6024 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6025 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6026 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6027 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6028 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6029 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6030 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6031 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6032 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6033 | { |
| 6034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6035 | /* .name = "Capture Source", */ |
| 6036 | .name = "Input Source", |
| 6037 | .count = 2, |
| 6038 | .info = alc883_mux_enum_info, |
| 6039 | .get = alc883_mux_enum_get, |
| 6040 | .put = alc883_mux_enum_put, |
| 6041 | }, |
| 6042 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6043 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6044 | |
| 6045 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6046 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6047 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6048 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6049 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6050 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6051 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6052 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6053 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6054 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6055 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6056 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6057 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6058 | { |
| 6059 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6060 | /* .name = "Capture Source", */ |
| 6061 | .name = "Input Source", |
| 6062 | .count = 2, |
| 6063 | .info = alc883_mux_enum_info, |
| 6064 | .get = alc883_mux_enum_get, |
| 6065 | .put = alc883_mux_enum_put, |
| 6066 | }, |
| 6067 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6068 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6069 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6070 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6071 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6072 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6073 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6074 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6075 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6076 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6077 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6078 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6079 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6080 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6081 | { |
| 6082 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6083 | /* .name = "Capture Source", */ |
| 6084 | .name = "Input Source", |
| 6085 | .count = 1, |
| 6086 | .info = alc883_mux_enum_info, |
| 6087 | .get = alc883_mux_enum_get, |
| 6088 | .put = alc883_mux_enum_put, |
| 6089 | }, |
| 6090 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6091 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6092 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6093 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6094 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6095 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6096 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6097 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6098 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6099 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6100 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6101 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6102 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6103 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6104 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6105 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6106 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6107 | { |
| 6108 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6109 | /* .name = "Capture Source", */ |
| 6110 | .name = "Input Source", |
| 6111 | .count = 2, |
| 6112 | .info = alc883_mux_enum_info, |
| 6113 | .get = alc883_mux_enum_get, |
| 6114 | .put = alc883_mux_enum_put, |
| 6115 | }, |
| 6116 | { } /* end */ |
| 6117 | }; |
| 6118 | |
| 6119 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6120 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6121 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6122 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6123 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6124 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6125 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6126 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6129 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6130 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6131 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6132 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6133 | { |
| 6134 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6135 | /* .name = "Capture Source", */ |
| 6136 | .name = "Input Source", |
| 6137 | .count = 2, |
| 6138 | .info = alc883_mux_enum_info, |
| 6139 | .get = alc883_mux_enum_get, |
| 6140 | .put = alc883_mux_enum_put, |
| 6141 | }, |
| 6142 | { } /* end */ |
| 6143 | }; |
| 6144 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6145 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6146 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6147 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6148 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6149 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6150 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6151 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6152 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6153 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6154 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6155 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6156 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6157 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6158 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6159 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6160 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6161 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6162 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6164 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6165 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6166 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6167 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6168 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6169 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6170 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6171 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6172 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6173 | { |
| 6174 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6175 | /* .name = "Capture Source", */ |
| 6176 | .name = "Input Source", |
| 6177 | .count = 2, |
| 6178 | .info = alc883_mux_enum_info, |
| 6179 | .get = alc883_mux_enum_get, |
| 6180 | .put = alc883_mux_enum_put, |
| 6181 | }, |
| 6182 | { } /* end */ |
| 6183 | }; |
| 6184 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6185 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6186 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6187 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6188 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6189 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6190 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6191 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6192 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6193 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6194 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6195 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6196 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6197 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6198 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6199 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6200 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6201 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6202 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6203 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6204 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6205 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6206 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6207 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6208 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6209 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6210 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6211 | { |
| 6212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6213 | /* .name = "Capture Source", */ |
| 6214 | .name = "Input Source", |
| 6215 | .count = 2, |
| 6216 | .info = alc883_mux_enum_info, |
| 6217 | .get = alc883_mux_enum_get, |
| 6218 | .put = alc883_mux_enum_put, |
| 6219 | }, |
| 6220 | { } /* end */ |
| 6221 | }; |
| 6222 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame^] | 6223 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
| 6224 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6225 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6226 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6227 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6228 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6229 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6232 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6233 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6234 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6235 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6236 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6237 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6238 | { |
| 6239 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6240 | /* .name = "Capture Source", */ |
| 6241 | .name = "Input Source", |
| 6242 | .count = 2, |
| 6243 | .info = alc883_mux_enum_info, |
| 6244 | .get = alc883_mux_enum_get, |
| 6245 | .put = alc883_mux_enum_put, |
| 6246 | }, |
| 6247 | { } /* end */ |
| 6248 | }; |
| 6249 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6250 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 6251 | { |
| 6252 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6253 | .name = "Channel Mode", |
| 6254 | .info = alc_ch_mode_info, |
| 6255 | .get = alc_ch_mode_get, |
| 6256 | .put = alc_ch_mode_put, |
| 6257 | }, |
| 6258 | { } /* end */ |
| 6259 | }; |
| 6260 | |
| 6261 | static struct hda_verb alc883_init_verbs[] = { |
| 6262 | /* ADC1: mute amp left and right */ |
| 6263 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6264 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6265 | /* ADC2: mute amp left and right */ |
| 6266 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6267 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6268 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6269 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6270 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6271 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6272 | /* Rear mixer */ |
| 6273 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6274 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6275 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6276 | /* CLFE mixer */ |
| 6277 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6278 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6279 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6280 | /* Side mixer */ |
| 6281 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6282 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6283 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6284 | |
| 6285 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6286 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6287 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6290 | |
| 6291 | /* Front Pin: output 0 (0x0c) */ |
| 6292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6293 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6294 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6295 | /* Rear Pin: output 1 (0x0d) */ |
| 6296 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6297 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6299 | /* CLFE Pin: output 2 (0x0e) */ |
| 6300 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6301 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6302 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6303 | /* Side Pin: output 3 (0x0f) */ |
| 6304 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6305 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6306 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 6307 | /* Mic (rear) pin: input vref at 80% */ |
| 6308 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6309 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6310 | /* Front Mic pin: input vref at 80% */ |
| 6311 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6312 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6313 | /* Line In pin: input */ |
| 6314 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6315 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6316 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6317 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6318 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6319 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6320 | /* CD pin widget for input */ |
| 6321 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6322 | |
| 6323 | /* FIXME: use matrix-type input source selection */ |
| 6324 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6325 | /* Input mixer2 */ |
| 6326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6330 | /* Input mixer3 */ |
| 6331 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6335 | { } |
| 6336 | }; |
| 6337 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6338 | static struct hda_verb alc883_tagra_verbs[] = { |
| 6339 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6340 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6341 | |
| 6342 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6343 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6344 | |
| 6345 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6346 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6347 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6348 | |
| 6349 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6350 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6351 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6352 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6353 | |
| 6354 | { } /* end */ |
| 6355 | }; |
| 6356 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6357 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 6358 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6359 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 6360 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 6361 | { } /* end */ |
| 6362 | }; |
| 6363 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6364 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 6365 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6367 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6368 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6369 | { } /* end */ |
| 6370 | }; |
| 6371 | |
| 6372 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 6373 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6374 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6375 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6376 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 6377 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6378 | { } /* end */ |
| 6379 | }; |
| 6380 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6381 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6382 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6383 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 6384 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 6385 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 6386 | { } |
| 6387 | }; |
| 6388 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6389 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6390 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6391 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 6392 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 6393 | { } |
| 6394 | }; |
| 6395 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6396 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6397 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6398 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6399 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6400 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6401 | { } |
| 6402 | }; |
| 6403 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6404 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6405 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6406 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6407 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6408 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6409 | { } |
| 6410 | }; |
| 6411 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6412 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 6413 | { 2, alc888_3st_hp_2ch_init }, |
| 6414 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6415 | }; |
| 6416 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6417 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 6418 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 6419 | { |
| 6420 | unsigned int present; |
| 6421 | |
| 6422 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6423 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6424 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 6425 | 0x80, present ? 0x80 : 0); |
| 6426 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 6427 | 0x80, present ? 0x80 : 0); |
| 6428 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6429 | 0x80, present ? 0x80 : 0); |
| 6430 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6431 | 0x80, present ? 0x80 : 0); |
| 6432 | |
| 6433 | } |
| 6434 | |
| 6435 | /* toggle RCA according to the front-jack state */ |
| 6436 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 6437 | { |
| 6438 | unsigned int present; |
| 6439 | |
| 6440 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6441 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6442 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6443 | 0x80, present ? 0x80 : 0); |
| 6444 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6445 | 0x80, present ? 0x80 : 0); |
| 6446 | |
| 6447 | } |
| 6448 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 6449 | unsigned int res) |
| 6450 | { |
| 6451 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6452 | alc888_lenovo_ms7195_front_automute(codec); |
| 6453 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6454 | alc888_lenovo_ms7195_rca_automute(codec); |
| 6455 | } |
| 6456 | |
| 6457 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 6458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6459 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6460 | |
| 6461 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6462 | |
| 6463 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6464 | { } /* end */ |
| 6465 | }; |
| 6466 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame^] | 6467 | static struct hda_verb alc883_acer_aspire_verbs[] = { |
| 6468 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6470 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6471 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6472 | |
| 6473 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6474 | |
| 6475 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6476 | { } /* end */ |
| 6477 | }; |
| 6478 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6479 | /* toggle speaker-output according to the hp-jack state */ |
| 6480 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 6481 | { |
| 6482 | unsigned int present; |
| 6483 | |
| 6484 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6485 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6486 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6487 | 0x80, present ? 0x80 : 0); |
| 6488 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6489 | 0x80, present ? 0x80 : 0); |
| 6490 | } |
| 6491 | |
| 6492 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 6493 | unsigned int res) |
| 6494 | { |
| 6495 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6496 | alc883_medion_md2_automute(codec); |
| 6497 | } |
| 6498 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6499 | /* toggle speaker-output according to the hp-jack state */ |
| 6500 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 6501 | { |
| 6502 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6503 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6504 | |
| 6505 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6506 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6507 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6508 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6509 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6510 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6511 | 0x80, bits); |
| 6512 | snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6513 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6514 | } |
| 6515 | |
| 6516 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6517 | { |
| 6518 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6519 | alc883_tagra_automute(codec); |
| 6520 | } |
| 6521 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6522 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 6523 | { |
| 6524 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6525 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6526 | |
| 6527 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6528 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6529 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6530 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6531 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6532 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6533 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6534 | } |
| 6535 | |
| 6536 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 6537 | { |
| 6538 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6539 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6540 | |
| 6541 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6542 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6543 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6544 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6545 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6546 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6547 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6548 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6549 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6550 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6551 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6552 | } |
| 6553 | |
| 6554 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 6555 | unsigned int res) |
| 6556 | { |
| 6557 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6558 | alc883_lenovo_101e_all_automute(codec); |
| 6559 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6560 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 6561 | } |
| 6562 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6563 | /* |
| 6564 | * generic initialization of ADC, input mixers and output mixers |
| 6565 | */ |
| 6566 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 6567 | /* |
| 6568 | * Unmute ADC0-2 and set the default input to mic-in |
| 6569 | */ |
| 6570 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6571 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6572 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6573 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6574 | |
| 6575 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6576 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6577 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6578 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6579 | */ |
| 6580 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6581 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6582 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6583 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6584 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6586 | |
| 6587 | /* |
| 6588 | * Set up output mixers (0x0c - 0x0f) |
| 6589 | */ |
| 6590 | /* set vol=0 to output mixers */ |
| 6591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6592 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6593 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6595 | /* set up input amps for analog loopback */ |
| 6596 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6600 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6601 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6602 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6603 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6604 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6605 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6606 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6607 | |
| 6608 | /* FIXME: use matrix-type input source selection */ |
| 6609 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6610 | /* Input mixer1 */ |
| 6611 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6612 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6613 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6614 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6616 | /* Input mixer2 */ |
| 6617 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6618 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6620 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6622 | |
| 6623 | { } |
| 6624 | }; |
| 6625 | |
| 6626 | /* capture mixer elements */ |
| 6627 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 6628 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6629 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6630 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6631 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6632 | { |
| 6633 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6634 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6635 | * So call somewhat different.. |
| 6636 | * FIXME: the controls appear in the "playback" view! |
| 6637 | */ |
| 6638 | /* .name = "Capture Source", */ |
| 6639 | .name = "Input Source", |
| 6640 | .count = 2, |
| 6641 | .info = alc882_mux_enum_info, |
| 6642 | .get = alc882_mux_enum_get, |
| 6643 | .put = alc882_mux_enum_put, |
| 6644 | }, |
| 6645 | { } /* end */ |
| 6646 | }; |
| 6647 | |
| 6648 | /* pcm configuration: identiacal with ALC880 */ |
| 6649 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 6650 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 6651 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 6652 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 6653 | |
| 6654 | /* |
| 6655 | * configuration and preset |
| 6656 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6657 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 6658 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 6659 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 6660 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 6661 | [ALC883_6ST_DIG] = "6stack-dig", |
| 6662 | [ALC883_TARGA_DIG] = "targa-dig", |
| 6663 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6664 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame^] | 6665 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6666 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6667 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6668 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6669 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6670 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 6671 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6672 | [ALC888_6ST_HP] = "6stack-hp", |
| 6673 | [ALC888_3ST_HP] = "3stack-hp", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6674 | [ALC883_AUTO] = "auto", |
| 6675 | }; |
| 6676 | |
| 6677 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 6678 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 6679 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6680 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
| 6681 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
| 6682 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 6683 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6684 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 6685 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 6686 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 6687 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 6688 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Daniel T Chen | 6f3bf65 | 2007-06-08 11:39:35 +0200 | [diff] [blame] | 6689 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6690 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Baruch Even | dd146a6 | 2007-05-25 12:18:49 +0200 | [diff] [blame] | 6691 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6692 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 6693 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 6694 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 6695 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 6696 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 6697 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 6698 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 6699 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
| 6700 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame^] | 6701 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6702 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 6703 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6704 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
| 6705 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 6706 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6707 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
| 6708 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 6709 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6710 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 6711 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 6712 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6713 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6714 | {} |
| 6715 | }; |
| 6716 | |
| 6717 | static struct alc_config_preset alc883_presets[] = { |
| 6718 | [ALC883_3ST_2ch_DIG] = { |
| 6719 | .mixers = { alc883_3ST_2ch_mixer }, |
| 6720 | .init_verbs = { alc883_init_verbs }, |
| 6721 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6722 | .dac_nids = alc883_dac_nids, |
| 6723 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6724 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6725 | .adc_nids = alc883_adc_nids, |
| 6726 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6727 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6728 | .channel_mode = alc883_3ST_2ch_modes, |
| 6729 | .input_mux = &alc883_capture_source, |
| 6730 | }, |
| 6731 | [ALC883_3ST_6ch_DIG] = { |
| 6732 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6733 | .init_verbs = { alc883_init_verbs }, |
| 6734 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6735 | .dac_nids = alc883_dac_nids, |
| 6736 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6737 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6738 | .adc_nids = alc883_adc_nids, |
| 6739 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6740 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6741 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6742 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6743 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6744 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6745 | [ALC883_3ST_6ch] = { |
| 6746 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6747 | .init_verbs = { alc883_init_verbs }, |
| 6748 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6749 | .dac_nids = alc883_dac_nids, |
| 6750 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6751 | .adc_nids = alc883_adc_nids, |
| 6752 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6753 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6754 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6755 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6756 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6757 | [ALC883_6ST_DIG] = { |
| 6758 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 6759 | .init_verbs = { alc883_init_verbs }, |
| 6760 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6761 | .dac_nids = alc883_dac_nids, |
| 6762 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6763 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6764 | .adc_nids = alc883_adc_nids, |
| 6765 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6766 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6767 | .channel_mode = alc883_sixstack_modes, |
| 6768 | .input_mux = &alc883_capture_source, |
| 6769 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6770 | [ALC883_TARGA_DIG] = { |
| 6771 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 6772 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6773 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6774 | .dac_nids = alc883_dac_nids, |
| 6775 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6776 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6777 | .adc_nids = alc883_adc_nids, |
| 6778 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6779 | .channel_mode = alc883_3ST_6ch_modes, |
| 6780 | .need_dac_fix = 1, |
| 6781 | .input_mux = &alc883_capture_source, |
| 6782 | .unsol_event = alc883_tagra_unsol_event, |
| 6783 | .init_hook = alc883_tagra_automute, |
| 6784 | }, |
| 6785 | [ALC883_TARGA_2ch_DIG] = { |
| 6786 | .mixers = { alc883_tagra_2ch_mixer}, |
| 6787 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6788 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6789 | .dac_nids = alc883_dac_nids, |
| 6790 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6791 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6792 | .adc_nids = alc883_adc_nids, |
| 6793 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6794 | .channel_mode = alc883_3ST_2ch_modes, |
| 6795 | .input_mux = &alc883_capture_source, |
| 6796 | .unsol_event = alc883_tagra_unsol_event, |
| 6797 | .init_hook = alc883_tagra_automute, |
| 6798 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 6799 | [ALC883_ACER] = { |
| 6800 | .mixers = { alc883_base_mixer, |
| 6801 | alc883_chmode_mixer }, |
| 6802 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 6803 | * and the headphone jack. Turn this on and rely on the |
| 6804 | * standard mute methods whenever the user wants to turn |
| 6805 | * these outputs off. |
| 6806 | */ |
| 6807 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 6808 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6809 | .dac_nids = alc883_dac_nids, |
| 6810 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6811 | .adc_nids = alc883_adc_nids, |
| 6812 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6813 | .channel_mode = alc883_3ST_2ch_modes, |
| 6814 | .input_mux = &alc883_capture_source, |
| 6815 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame^] | 6816 | [ALC883_ACER_ASPIRE] = { |
| 6817 | .mixers = { alc883_acer_aspire_mixer}, |
| 6818 | .init_verbs = { alc883_init_verbs, alc883_acer_aspire_verbs}, |
| 6819 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6820 | .dac_nids = alc883_dac_nids, |
| 6821 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6822 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6823 | .adc_nids = alc883_adc_nids, |
| 6824 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6825 | .channel_mode = alc883_3ST_2ch_modes, |
| 6826 | .input_mux = &alc883_capture_source, |
| 6827 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6828 | .init_hook = alc883_medion_md2_automute, |
| 6829 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6830 | [ALC883_MEDION] = { |
| 6831 | .mixers = { alc883_fivestack_mixer, |
| 6832 | alc883_chmode_mixer }, |
| 6833 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6834 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6835 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6836 | .dac_nids = alc883_dac_nids, |
| 6837 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6838 | .adc_nids = alc883_adc_nids, |
| 6839 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6840 | .channel_mode = alc883_sixstack_modes, |
| 6841 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6842 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6843 | [ALC883_MEDION_MD2] = { |
| 6844 | .mixers = { alc883_medion_md2_mixer}, |
| 6845 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 6846 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6847 | .dac_nids = alc883_dac_nids, |
| 6848 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6849 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6850 | .adc_nids = alc883_adc_nids, |
| 6851 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6852 | .channel_mode = alc883_3ST_2ch_modes, |
| 6853 | .input_mux = &alc883_capture_source, |
| 6854 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6855 | .init_hook = alc883_medion_md2_automute, |
| 6856 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6857 | [ALC883_LAPTOP_EAPD] = { |
| 6858 | .mixers = { alc883_base_mixer, |
| 6859 | alc883_chmode_mixer }, |
| 6860 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 6861 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6862 | .dac_nids = alc883_dac_nids, |
| 6863 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6864 | .adc_nids = alc883_adc_nids, |
| 6865 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6866 | .channel_mode = alc883_3ST_2ch_modes, |
| 6867 | .input_mux = &alc883_capture_source, |
| 6868 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6869 | [ALC883_LENOVO_101E_2ch] = { |
| 6870 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 6871 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 6872 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6873 | .dac_nids = alc883_dac_nids, |
| 6874 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6875 | .adc_nids = alc883_adc_nids, |
| 6876 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6877 | .channel_mode = alc883_3ST_2ch_modes, |
| 6878 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 6879 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 6880 | .init_hook = alc883_lenovo_101e_all_automute, |
| 6881 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6882 | [ALC883_LENOVO_NB0763] = { |
| 6883 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 6884 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 6885 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6886 | .dac_nids = alc883_dac_nids, |
| 6887 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6888 | .adc_nids = alc883_adc_nids, |
| 6889 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6890 | .channel_mode = alc883_3ST_2ch_modes, |
| 6891 | .need_dac_fix = 1, |
| 6892 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 6893 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6894 | .init_hook = alc883_medion_md2_automute, |
| 6895 | }, |
| 6896 | [ALC888_LENOVO_MS7195_DIG] = { |
| 6897 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6898 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 6899 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6900 | .dac_nids = alc883_dac_nids, |
| 6901 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6902 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6903 | .adc_nids = alc883_adc_nids, |
| 6904 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6905 | .channel_mode = alc883_3ST_6ch_modes, |
| 6906 | .need_dac_fix = 1, |
| 6907 | .input_mux = &alc883_capture_source, |
| 6908 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 6909 | .init_hook = alc888_lenovo_ms7195_front_automute, |
| 6910 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6911 | [ALC888_6ST_HP] = { |
| 6912 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 6913 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6914 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6915 | .dac_nids = alc883_dac_nids, |
| 6916 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6917 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6918 | .adc_nids = alc883_adc_nids, |
| 6919 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6920 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6921 | .channel_mode = alc883_sixstack_modes, |
| 6922 | .input_mux = &alc883_capture_source, |
| 6923 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6924 | [ALC888_3ST_HP] = { |
| 6925 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 6926 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6927 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6928 | .dac_nids = alc883_dac_nids, |
| 6929 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6930 | .adc_nids = alc883_adc_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6931 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 6932 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6933 | .need_dac_fix = 1, |
| 6934 | .input_mux = &alc883_capture_source, |
| 6935 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6936 | }; |
| 6937 | |
| 6938 | |
| 6939 | /* |
| 6940 | * BIOS auto configuration |
| 6941 | */ |
| 6942 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6943 | hda_nid_t nid, int pin_type, |
| 6944 | int dac_idx) |
| 6945 | { |
| 6946 | /* set as output */ |
| 6947 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6948 | int idx; |
| 6949 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6950 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6951 | idx = 4; |
| 6952 | else |
| 6953 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 6954 | |
| 6955 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6956 | pin_type); |
| 6957 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 6958 | AMP_OUT_UNMUTE); |
| 6959 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6960 | |
| 6961 | } |
| 6962 | |
| 6963 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 6964 | { |
| 6965 | struct alc_spec *spec = codec->spec; |
| 6966 | int i; |
| 6967 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6968 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6969 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6970 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6971 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6972 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6973 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6974 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6975 | } |
| 6976 | } |
| 6977 | |
| 6978 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 6979 | { |
| 6980 | struct alc_spec *spec = codec->spec; |
| 6981 | hda_nid_t pin; |
| 6982 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6983 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6984 | if (pin) /* connect to front */ |
| 6985 | /* use dac 0 */ |
| 6986 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 6987 | } |
| 6988 | |
| 6989 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6990 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 6991 | |
| 6992 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 6993 | { |
| 6994 | struct alc_spec *spec = codec->spec; |
| 6995 | int i; |
| 6996 | |
| 6997 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6998 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6999 | if (alc883_is_input_pin(nid)) { |
| 7000 | snd_hda_codec_write(codec, nid, 0, |
| 7001 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7002 | (i <= AUTO_PIN_FRONT_MIC ? |
| 7003 | PIN_VREF80 : PIN_IN)); |
| 7004 | if (nid != ALC883_PIN_CD_NID) |
| 7005 | snd_hda_codec_write(codec, nid, 0, |
| 7006 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7007 | AMP_OUT_MUTE); |
| 7008 | } |
| 7009 | } |
| 7010 | } |
| 7011 | |
| 7012 | /* almost identical with ALC880 parser... */ |
| 7013 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 7014 | { |
| 7015 | struct alc_spec *spec = codec->spec; |
| 7016 | int err = alc880_parse_auto_config(codec); |
| 7017 | |
| 7018 | if (err < 0) |
| 7019 | return err; |
| 7020 | else if (err > 0) |
| 7021 | /* hack - override the init verbs */ |
| 7022 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7023 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 7024 | spec->num_mixers++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7025 | return err; |
| 7026 | } |
| 7027 | |
| 7028 | /* additional initialization for auto-configuration model */ |
| 7029 | static void alc883_auto_init(struct hda_codec *codec) |
| 7030 | { |
| 7031 | alc883_auto_init_multi_out(codec); |
| 7032 | alc883_auto_init_hp_out(codec); |
| 7033 | alc883_auto_init_analog_input(codec); |
| 7034 | } |
| 7035 | |
| 7036 | static int patch_alc883(struct hda_codec *codec) |
| 7037 | { |
| 7038 | struct alc_spec *spec; |
| 7039 | int err, board_config; |
| 7040 | |
| 7041 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 7042 | if (spec == NULL) |
| 7043 | return -ENOMEM; |
| 7044 | |
| 7045 | codec->spec = spec; |
| 7046 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7047 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 7048 | alc883_models, |
| 7049 | alc883_cfg_tbl); |
| 7050 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7051 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 7052 | "trying auto-probe from BIOS...\n"); |
| 7053 | board_config = ALC883_AUTO; |
| 7054 | } |
| 7055 | |
| 7056 | if (board_config == ALC883_AUTO) { |
| 7057 | /* automatic parse from the BIOS config */ |
| 7058 | err = alc883_parse_auto_config(codec); |
| 7059 | if (err < 0) { |
| 7060 | alc_free(codec); |
| 7061 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7062 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7063 | printk(KERN_INFO |
| 7064 | "hda_codec: Cannot set up configuration " |
| 7065 | "from BIOS. Using base mode...\n"); |
| 7066 | board_config = ALC883_3ST_2ch_DIG; |
| 7067 | } |
| 7068 | } |
| 7069 | |
| 7070 | if (board_config != ALC883_AUTO) |
| 7071 | setup_preset(spec, &alc883_presets[board_config]); |
| 7072 | |
| 7073 | spec->stream_name_analog = "ALC883 Analog"; |
| 7074 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 7075 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 7076 | |
| 7077 | spec->stream_name_digital = "ALC883 Digital"; |
| 7078 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 7079 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 7080 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7081 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7082 | spec->adc_nids = alc883_adc_nids; |
| 7083 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 7084 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7085 | |
| 7086 | codec->patch_ops = alc_patch_ops; |
| 7087 | if (board_config == ALC883_AUTO) |
| 7088 | spec->init_hook = alc883_auto_init; |
| 7089 | |
| 7090 | return 0; |
| 7091 | } |
| 7092 | |
| 7093 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7094 | * ALC262 support |
| 7095 | */ |
| 7096 | |
| 7097 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 7098 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 7099 | |
| 7100 | #define alc262_dac_nids alc260_dac_nids |
| 7101 | #define alc262_adc_nids alc882_adc_nids |
| 7102 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 7103 | |
| 7104 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 7105 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7106 | |
| 7107 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 7108 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7109 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7111 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7112 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7113 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7114 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7115 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7116 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7117 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7118 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7119 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7120 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7121 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7122 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 7123 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7124 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7125 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7126 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7127 | }; |
| 7128 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7129 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 7130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7131 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7132 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7133 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7134 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7135 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7138 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7139 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7140 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7141 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7142 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7143 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7144 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 7145 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7146 | { } /* end */ |
| 7147 | }; |
| 7148 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7149 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 7150 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7151 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7152 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7153 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7154 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7155 | |
| 7156 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7157 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7158 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7159 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7160 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7161 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7162 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7163 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7164 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7165 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7166 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7167 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7168 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 7169 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 7170 | { } /* end */ |
| 7171 | }; |
| 7172 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7173 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
| 7174 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7175 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7176 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7178 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7179 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7180 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7181 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7182 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7183 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7184 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7185 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7186 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7187 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7188 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7189 | { } /* end */ |
| 7190 | }; |
| 7191 | |
| 7192 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 7193 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7194 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7195 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7196 | { } /* end */ |
| 7197 | }; |
| 7198 | |
Takashi Iwai | 532d538 | 2007-07-27 19:02:40 +0200 | [diff] [blame] | 7199 | static struct hda_bind_ctls alc262_sony_bind_sw = { |
| 7200 | .ops = &snd_hda_bind_sw, |
| 7201 | .values = { |
| 7202 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 7203 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7204 | 0, |
| 7205 | }, |
| 7206 | }; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7207 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7208 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
| 7209 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 532d538 | 2007-07-27 19:02:40 +0200 | [diff] [blame] | 7210 | HDA_BIND_SW("Front Playback Switch", &alc262_sony_bind_sw), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7211 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7213 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7214 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7215 | { } /* end */ |
| 7216 | }; |
| 7217 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7218 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 7219 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7220 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7221 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7222 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7223 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7224 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7225 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7226 | { } /* end */ |
| 7227 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7228 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7229 | #define alc262_capture_mixer alc882_capture_mixer |
| 7230 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 7231 | |
| 7232 | /* |
| 7233 | * generic initialization of ADC, input mixers and output mixers |
| 7234 | */ |
| 7235 | static struct hda_verb alc262_init_verbs[] = { |
| 7236 | /* |
| 7237 | * Unmute ADC0-2 and set the default input to mic-in |
| 7238 | */ |
| 7239 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7240 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7241 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7242 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7243 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7245 | |
| 7246 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7247 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7248 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7249 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7250 | */ |
| 7251 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7252 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7253 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7254 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7255 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7256 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7257 | |
| 7258 | /* |
| 7259 | * Set up output mixers (0x0c - 0x0e) |
| 7260 | */ |
| 7261 | /* set vol=0 to output mixers */ |
| 7262 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7263 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7264 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7265 | /* set up input amps for analog loopback */ |
| 7266 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7267 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7268 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7269 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7270 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7271 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7272 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7273 | |
| 7274 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7275 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7276 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7277 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7278 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7280 | |
| 7281 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7282 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7283 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7284 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7285 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7286 | |
| 7287 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7289 | |
| 7290 | /* FIXME: use matrix-type input source selection */ |
| 7291 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7292 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7294 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7295 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7296 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7297 | /* Input mixer2 */ |
| 7298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7299 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7300 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7301 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7302 | /* Input mixer3 */ |
| 7303 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7304 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7305 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7306 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7307 | |
| 7308 | { } |
| 7309 | }; |
| 7310 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7311 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 7312 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7313 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7314 | {} |
| 7315 | }; |
| 7316 | |
| 7317 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 7318 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7319 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7320 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7321 | |
| 7322 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7323 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7324 | {} |
| 7325 | }; |
| 7326 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7327 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 7328 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7329 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7330 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 7331 | |
| 7332 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7333 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7334 | }; |
| 7335 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7336 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7337 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7338 | { |
| 7339 | struct alc_spec *spec = codec->spec; |
| 7340 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7341 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7342 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7343 | /* need to execute and sync at first */ |
| 7344 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7345 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7346 | AC_VERB_GET_PIN_SENSE, 0); |
| 7347 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7348 | if (spec->jack_present) { |
| 7349 | /* mute internal speaker */ |
| 7350 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7351 | 0x80, 0x80); |
| 7352 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7353 | 0x80, 0x80); |
| 7354 | } else { |
| 7355 | /* unmute internal speaker if necessary */ |
| 7356 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 7357 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7358 | 0x80, mute & 0x80); |
| 7359 | mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0); |
| 7360 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7361 | 0x80, mute & 0x80); |
| 7362 | } |
| 7363 | } |
| 7364 | |
| 7365 | /* unsolicited event for HP jack sensing */ |
| 7366 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 7367 | unsigned int res) |
| 7368 | { |
| 7369 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7370 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7371 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7372 | } |
| 7373 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7374 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7375 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7376 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7377 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7378 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7379 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7380 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7381 | AC_VERB_GET_PIN_SENSE, 0); |
| 7382 | present = (present & 0x80000000) != 0; |
| 7383 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7384 | /* mute internal speaker */ |
| 7385 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7386 | 0x80, 0x80); |
| 7387 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7388 | 0x80, 0x80); |
| 7389 | } else { |
| 7390 | /* unmute internal speaker if necessary */ |
| 7391 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 7392 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7393 | 0x80, mute & 0x80); |
| 7394 | mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0); |
| 7395 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7396 | 0x80, mute & 0x80); |
| 7397 | } |
| 7398 | } |
| 7399 | |
| 7400 | /* unsolicited event for HP jack sensing */ |
| 7401 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 7402 | unsigned int res) |
| 7403 | { |
| 7404 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7405 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7406 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7407 | } |
| 7408 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7409 | /* |
| 7410 | * fujitsu model |
| 7411 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 7412 | */ |
| 7413 | |
| 7414 | #define ALC_HP_EVENT 0x37 |
| 7415 | |
| 7416 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 7417 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 7418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7419 | {} |
| 7420 | }; |
| 7421 | |
| 7422 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
| 7423 | .num_items = 2, |
| 7424 | .items = { |
| 7425 | { "Mic", 0x0 }, |
| 7426 | { "CD", 0x4 }, |
| 7427 | }, |
| 7428 | }; |
| 7429 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7430 | static struct hda_input_mux alc262_HP_capture_source = { |
| 7431 | .num_items = 5, |
| 7432 | .items = { |
| 7433 | { "Mic", 0x0 }, |
| 7434 | { "Front Mic", 0x3 }, |
| 7435 | { "Line", 0x2 }, |
| 7436 | { "CD", 0x4 }, |
| 7437 | { "AUX IN", 0x6 }, |
| 7438 | }, |
| 7439 | }; |
| 7440 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7441 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 7442 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 7443 | { |
| 7444 | struct alc_spec *spec = codec->spec; |
| 7445 | unsigned int mute; |
| 7446 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7447 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7448 | unsigned int present; |
| 7449 | /* need to execute and sync at first */ |
| 7450 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7451 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7452 | AC_VERB_GET_PIN_SENSE, 0); |
| 7453 | spec->jack_present = (present & 0x80000000) != 0; |
| 7454 | spec->sense_updated = 1; |
| 7455 | } |
| 7456 | if (spec->jack_present) { |
| 7457 | /* mute internal speaker */ |
| 7458 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 7459 | 0x80, 0x80); |
| 7460 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 7461 | 0x80, 0x80); |
| 7462 | } else { |
| 7463 | /* unmute internal speaker if necessary */ |
| 7464 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 7465 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 7466 | 0x80, mute & 0x80); |
| 7467 | mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0); |
| 7468 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 7469 | 0x80, mute & 0x80); |
| 7470 | } |
| 7471 | } |
| 7472 | |
| 7473 | /* unsolicited event for HP jack sensing */ |
| 7474 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 7475 | unsigned int res) |
| 7476 | { |
| 7477 | if ((res >> 26) != ALC_HP_EVENT) |
| 7478 | return; |
| 7479 | alc262_fujitsu_automute(codec, 1); |
| 7480 | } |
| 7481 | |
| 7482 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 7483 | static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol, |
| 7484 | struct snd_ctl_elem_value *ucontrol) |
| 7485 | { |
| 7486 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7487 | long *valp = ucontrol->value.integer.value; |
| 7488 | int change; |
| 7489 | |
| 7490 | change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 7491 | 0x7f, valp[0] & 0x7f); |
| 7492 | change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 7493 | 0x7f, valp[1] & 0x7f); |
| 7494 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 7495 | 0x7f, valp[0] & 0x7f); |
| 7496 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 7497 | 0x7f, valp[1] & 0x7f); |
| 7498 | return change; |
| 7499 | } |
| 7500 | |
| 7501 | /* bind hp and internal speaker mute (with plug check) */ |
| 7502 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 7503 | struct snd_ctl_elem_value *ucontrol) |
| 7504 | { |
| 7505 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7506 | long *valp = ucontrol->value.integer.value; |
| 7507 | int change; |
| 7508 | |
| 7509 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7510 | 0x80, valp[0] ? 0 : 0x80); |
| 7511 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7512 | 0x80, valp[1] ? 0 : 0x80); |
| 7513 | if (change || codec->in_resume) |
| 7514 | alc262_fujitsu_automute(codec, codec->in_resume); |
| 7515 | return change; |
| 7516 | } |
| 7517 | |
| 7518 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
| 7519 | { |
| 7520 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7521 | .name = "Master Playback Volume", |
| 7522 | .info = snd_hda_mixer_amp_volume_info, |
| 7523 | .get = snd_hda_mixer_amp_volume_get, |
| 7524 | .put = alc262_fujitsu_master_vol_put, |
Takashi Iwai | c256652 | 2006-08-17 18:21:36 +0200 | [diff] [blame] | 7525 | .tlv = { .c = snd_hda_mixer_amp_tlv }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7526 | .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 7527 | }, |
| 7528 | { |
| 7529 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7530 | .name = "Master Playback Switch", |
| 7531 | .info = snd_hda_mixer_amp_switch_info, |
| 7532 | .get = snd_hda_mixer_amp_switch_get, |
| 7533 | .put = alc262_fujitsu_master_sw_put, |
| 7534 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7535 | }, |
| 7536 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7537 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7538 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7539 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7540 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7541 | { } /* end */ |
| 7542 | }; |
| 7543 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 7544 | /* additional init verbs for Benq laptops */ |
| 7545 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 7546 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7547 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7548 | {} |
| 7549 | }; |
| 7550 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7551 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 7552 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7553 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7554 | |
| 7555 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7556 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 7557 | {} |
| 7558 | }; |
| 7559 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7560 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7561 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7562 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7563 | { |
| 7564 | hda_nid_t nid; |
| 7565 | int err; |
| 7566 | |
| 7567 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 7568 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 7569 | spec->multiout.dac_nids[0] = 2; |
| 7570 | |
| 7571 | nid = cfg->line_out_pins[0]; |
| 7572 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7573 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7574 | "Front Playback Volume", |
| 7575 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 7576 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7577 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7578 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7579 | "Front Playback Switch", |
| 7580 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 7581 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7582 | return err; |
| 7583 | } |
| 7584 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7585 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7586 | if (nid) { |
| 7587 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7588 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7589 | "Speaker Playback Volume", |
| 7590 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7591 | HDA_OUTPUT)); |
| 7592 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7593 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7594 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7595 | "Speaker Playback Switch", |
| 7596 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7597 | HDA_OUTPUT)); |
| 7598 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7599 | return err; |
| 7600 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7601 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7602 | "Speaker Playback Switch", |
| 7603 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7604 | HDA_OUTPUT)); |
| 7605 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7606 | return err; |
| 7607 | } |
| 7608 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7609 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7610 | if (nid) { |
| 7611 | /* spec->multiout.hp_nid = 2; */ |
| 7612 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7613 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7614 | "Headphone Playback Volume", |
| 7615 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7616 | HDA_OUTPUT)); |
| 7617 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7618 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7619 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7620 | "Headphone Playback Switch", |
| 7621 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7622 | HDA_OUTPUT)); |
| 7623 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7624 | return err; |
| 7625 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7626 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7627 | "Headphone Playback Switch", |
| 7628 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7629 | HDA_OUTPUT)); |
| 7630 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7631 | return err; |
| 7632 | } |
| 7633 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7634 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7635 | } |
| 7636 | |
| 7637 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7638 | #define alc262_auto_create_analog_input_ctls \ |
| 7639 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7640 | |
| 7641 | /* |
| 7642 | * generic initialization of ADC, input mixers and output mixers |
| 7643 | */ |
| 7644 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 7645 | /* |
| 7646 | * Unmute ADC0-2 and set the default input to mic-in |
| 7647 | */ |
| 7648 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7650 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7651 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7652 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7653 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7654 | |
| 7655 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7656 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7657 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7658 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7659 | */ |
| 7660 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7661 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7662 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7663 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7664 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7665 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7666 | |
| 7667 | /* |
| 7668 | * Set up output mixers (0x0c - 0x0f) |
| 7669 | */ |
| 7670 | /* set vol=0 to output mixers */ |
| 7671 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7672 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7673 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7674 | |
| 7675 | /* set up input amps for analog loopback */ |
| 7676 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7677 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7678 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7679 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7680 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7681 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7682 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7683 | |
| 7684 | /* FIXME: use matrix-type input source selection */ |
| 7685 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7686 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7687 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7688 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7689 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7690 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7691 | /* Input mixer2 */ |
| 7692 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7693 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7694 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7695 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7696 | /* Input mixer3 */ |
| 7697 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7698 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7699 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7700 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7701 | |
| 7702 | { } |
| 7703 | }; |
| 7704 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7705 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 7706 | /* |
| 7707 | * Unmute ADC0-2 and set the default input to mic-in |
| 7708 | */ |
| 7709 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7710 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7711 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7712 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7713 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7714 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7715 | |
| 7716 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7717 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7718 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7719 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7720 | */ |
| 7721 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7725 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7726 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7727 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 7728 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 7729 | |
| 7730 | /* |
| 7731 | * Set up output mixers (0x0c - 0x0e) |
| 7732 | */ |
| 7733 | /* set vol=0 to output mixers */ |
| 7734 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7735 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7736 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7737 | |
| 7738 | /* set up input amps for analog loopback */ |
| 7739 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7740 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7741 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7742 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7743 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7744 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7745 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7746 | |
| 7747 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7748 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7749 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7750 | |
| 7751 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7752 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7753 | |
| 7754 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7755 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7756 | |
| 7757 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7758 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7759 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7760 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7761 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7762 | |
| 7763 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7764 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7766 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7767 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7768 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7769 | |
| 7770 | |
| 7771 | /* FIXME: use matrix-type input source selection */ |
| 7772 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7773 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7774 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7775 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7776 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7777 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7778 | /* Input mixer2 */ |
| 7779 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7780 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7781 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7782 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7783 | /* Input mixer3 */ |
| 7784 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7785 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7786 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7787 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7788 | |
| 7789 | { } |
| 7790 | }; |
| 7791 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7792 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 7793 | /* |
| 7794 | * Unmute ADC0-2 and set the default input to mic-in |
| 7795 | */ |
| 7796 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7797 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7798 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7799 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7800 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7801 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7802 | |
| 7803 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7804 | * mixer widget |
| 7805 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 7806 | * panel mic (mic 2) |
| 7807 | */ |
| 7808 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7809 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7810 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7811 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7812 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7813 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7814 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 7815 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 7816 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 7817 | /* |
| 7818 | * Set up output mixers (0x0c - 0x0e) |
| 7819 | */ |
| 7820 | /* set vol=0 to output mixers */ |
| 7821 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7822 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7823 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7824 | |
| 7825 | /* set up input amps for analog loopback */ |
| 7826 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7827 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7828 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7829 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7830 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7831 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7832 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7833 | |
| 7834 | |
| 7835 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 7836 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 7837 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 7838 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 7839 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 7840 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 7841 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 7842 | |
| 7843 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7844 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7845 | |
| 7846 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7847 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7848 | |
| 7849 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 7850 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7851 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7852 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7853 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7854 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7855 | |
| 7856 | /* FIXME: use matrix-type input source selection */ |
| 7857 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7858 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7859 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 7860 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 7861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 7862 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 7863 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 7864 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7865 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 7866 | /* Input mixer2 */ |
| 7867 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7868 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7869 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7870 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7871 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7872 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7873 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7874 | /* Input mixer3 */ |
| 7875 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7876 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7877 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7878 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7879 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7880 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7881 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7882 | |
| 7883 | { } |
| 7884 | }; |
| 7885 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7886 | /* pcm configuration: identiacal with ALC880 */ |
| 7887 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 7888 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 7889 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 7890 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 7891 | |
| 7892 | /* |
| 7893 | * BIOS auto configuration |
| 7894 | */ |
| 7895 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 7896 | { |
| 7897 | struct alc_spec *spec = codec->spec; |
| 7898 | int err; |
| 7899 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 7900 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7901 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7902 | alc262_ignore); |
| 7903 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7904 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7905 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7906 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7907 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7908 | if (err < 0) |
| 7909 | return err; |
| 7910 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 7911 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7912 | return err; |
| 7913 | |
| 7914 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 7915 | |
| 7916 | if (spec->autocfg.dig_out_pin) |
| 7917 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 7918 | if (spec->autocfg.dig_in_pin) |
| 7919 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 7920 | |
| 7921 | if (spec->kctl_alloc) |
| 7922 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 7923 | |
| 7924 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7925 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7926 | spec->input_mux = &spec->private_imux; |
| 7927 | |
| 7928 | return 1; |
| 7929 | } |
| 7930 | |
| 7931 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 7932 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 7933 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 7934 | |
| 7935 | |
| 7936 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7937 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7938 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7939 | alc262_auto_init_multi_out(codec); |
| 7940 | alc262_auto_init_hp_out(codec); |
| 7941 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7942 | } |
| 7943 | |
| 7944 | /* |
| 7945 | * configuration and preset |
| 7946 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7947 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 7948 | [ALC262_BASIC] = "basic", |
| 7949 | [ALC262_HIPPO] = "hippo", |
| 7950 | [ALC262_HIPPO_1] = "hippo_1", |
| 7951 | [ALC262_FUJITSU] = "fujitsu", |
| 7952 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7953 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7954 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 7955 | [ALC262_BENQ_T31] = "benq-t31", |
| 7956 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7957 | [ALC262_AUTO] = "auto", |
| 7958 | }; |
| 7959 | |
| 7960 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 7961 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 7962 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
| 7963 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7964 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
| 7965 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7966 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7967 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7968 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7969 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7970 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7971 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7972 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7973 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7974 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7975 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7976 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7977 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7978 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
| 7979 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
| 7980 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
| 7981 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7982 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7983 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7984 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
| 7985 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 7986 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7987 | {} |
| 7988 | }; |
| 7989 | |
| 7990 | static struct alc_config_preset alc262_presets[] = { |
| 7991 | [ALC262_BASIC] = { |
| 7992 | .mixers = { alc262_base_mixer }, |
| 7993 | .init_verbs = { alc262_init_verbs }, |
| 7994 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7995 | .dac_nids = alc262_dac_nids, |
| 7996 | .hp_nid = 0x03, |
| 7997 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7998 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7999 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8000 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8001 | [ALC262_HIPPO] = { |
| 8002 | .mixers = { alc262_base_mixer }, |
| 8003 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 8004 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8005 | .dac_nids = alc262_dac_nids, |
| 8006 | .hp_nid = 0x03, |
| 8007 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8008 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8009 | .channel_mode = alc262_modes, |
| 8010 | .input_mux = &alc262_capture_source, |
| 8011 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8012 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8013 | }, |
| 8014 | [ALC262_HIPPO_1] = { |
| 8015 | .mixers = { alc262_hippo1_mixer }, |
| 8016 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 8017 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8018 | .dac_nids = alc262_dac_nids, |
| 8019 | .hp_nid = 0x02, |
| 8020 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8021 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8022 | .channel_mode = alc262_modes, |
| 8023 | .input_mux = &alc262_capture_source, |
| 8024 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8025 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8026 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8027 | [ALC262_FUJITSU] = { |
| 8028 | .mixers = { alc262_fujitsu_mixer }, |
| 8029 | .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, |
| 8030 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8031 | .dac_nids = alc262_dac_nids, |
| 8032 | .hp_nid = 0x03, |
| 8033 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8034 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8035 | .channel_mode = alc262_modes, |
| 8036 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8037 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8038 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8039 | [ALC262_HP_BPC] = { |
| 8040 | .mixers = { alc262_HP_BPC_mixer }, |
| 8041 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 8042 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8043 | .dac_nids = alc262_dac_nids, |
| 8044 | .hp_nid = 0x03, |
| 8045 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8046 | .channel_mode = alc262_modes, |
| 8047 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8048 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8049 | [ALC262_HP_BPC_D7000_WF] = { |
| 8050 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 8051 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 8052 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8053 | .dac_nids = alc262_dac_nids, |
| 8054 | .hp_nid = 0x03, |
| 8055 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8056 | .channel_mode = alc262_modes, |
| 8057 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8058 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8059 | [ALC262_HP_BPC_D7000_WL] = { |
| 8060 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 8061 | alc262_HP_BPC_WildWest_option_mixer }, |
| 8062 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 8063 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8064 | .dac_nids = alc262_dac_nids, |
| 8065 | .hp_nid = 0x03, |
| 8066 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8067 | .channel_mode = alc262_modes, |
| 8068 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8069 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8070 | [ALC262_BENQ_ED8] = { |
| 8071 | .mixers = { alc262_base_mixer }, |
| 8072 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 8073 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8074 | .dac_nids = alc262_dac_nids, |
| 8075 | .hp_nid = 0x03, |
| 8076 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8077 | .channel_mode = alc262_modes, |
| 8078 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8079 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8080 | [ALC262_SONY_ASSAMD] = { |
| 8081 | .mixers = { alc262_sony_mixer }, |
| 8082 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 8083 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8084 | .dac_nids = alc262_dac_nids, |
| 8085 | .hp_nid = 0x02, |
| 8086 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8087 | .channel_mode = alc262_modes, |
| 8088 | .input_mux = &alc262_capture_source, |
| 8089 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8090 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8091 | }, |
| 8092 | [ALC262_BENQ_T31] = { |
| 8093 | .mixers = { alc262_benq_t31_mixer }, |
| 8094 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 8095 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8096 | .dac_nids = alc262_dac_nids, |
| 8097 | .hp_nid = 0x03, |
| 8098 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8099 | .channel_mode = alc262_modes, |
| 8100 | .input_mux = &alc262_capture_source, |
| 8101 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8102 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8103 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8104 | }; |
| 8105 | |
| 8106 | static int patch_alc262(struct hda_codec *codec) |
| 8107 | { |
| 8108 | struct alc_spec *spec; |
| 8109 | int board_config; |
| 8110 | int err; |
| 8111 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 8112 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8113 | if (spec == NULL) |
| 8114 | return -ENOMEM; |
| 8115 | |
| 8116 | codec->spec = spec; |
| 8117 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8118 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 8119 | * under-run |
| 8120 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8121 | { |
| 8122 | int tmp; |
| 8123 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 8124 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 8125 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 8126 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 8127 | } |
| 8128 | #endif |
| 8129 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8130 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 8131 | alc262_models, |
| 8132 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8133 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8134 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8135 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 8136 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8137 | board_config = ALC262_AUTO; |
| 8138 | } |
| 8139 | |
| 8140 | if (board_config == ALC262_AUTO) { |
| 8141 | /* automatic parse from the BIOS config */ |
| 8142 | err = alc262_parse_auto_config(codec); |
| 8143 | if (err < 0) { |
| 8144 | alc_free(codec); |
| 8145 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8146 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8147 | printk(KERN_INFO |
| 8148 | "hda_codec: Cannot set up configuration " |
| 8149 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8150 | board_config = ALC262_BASIC; |
| 8151 | } |
| 8152 | } |
| 8153 | |
| 8154 | if (board_config != ALC262_AUTO) |
| 8155 | setup_preset(spec, &alc262_presets[board_config]); |
| 8156 | |
| 8157 | spec->stream_name_analog = "ALC262 Analog"; |
| 8158 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 8159 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 8160 | |
| 8161 | spec->stream_name_digital = "ALC262 Digital"; |
| 8162 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 8163 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 8164 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8165 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8166 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 8167 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 8168 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8169 | /* get type */ |
| 8170 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8171 | if (wcap != AC_WID_AUD_IN) { |
| 8172 | spec->adc_nids = alc262_adc_nids_alt; |
| 8173 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8174 | spec->mixers[spec->num_mixers] = |
| 8175 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8176 | spec->num_mixers++; |
| 8177 | } else { |
| 8178 | spec->adc_nids = alc262_adc_nids; |
| 8179 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 8180 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 8181 | spec->num_mixers++; |
| 8182 | } |
| 8183 | } |
| 8184 | |
| 8185 | codec->patch_ops = alc_patch_ops; |
| 8186 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8187 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8188 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8189 | return 0; |
| 8190 | } |
| 8191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8192 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8193 | * ALC268 channel source setting (2 channel) |
| 8194 | */ |
| 8195 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 8196 | #define alc268_modes alc260_modes |
| 8197 | |
| 8198 | static hda_nid_t alc268_dac_nids[2] = { |
| 8199 | /* front, hp */ |
| 8200 | 0x02, 0x03 |
| 8201 | }; |
| 8202 | |
| 8203 | static hda_nid_t alc268_adc_nids[2] = { |
| 8204 | /* ADC0-1 */ |
| 8205 | 0x08, 0x07 |
| 8206 | }; |
| 8207 | |
| 8208 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 8209 | /* ADC0 */ |
| 8210 | 0x08 |
| 8211 | }; |
| 8212 | |
| 8213 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 8214 | /* output mixer control */ |
| 8215 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 8216 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8217 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 8218 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8219 | { } |
| 8220 | }; |
| 8221 | |
| 8222 | /* |
| 8223 | * generic initialization of ADC, input mixers and output mixers |
| 8224 | */ |
| 8225 | static struct hda_verb alc268_base_init_verbs[] = { |
| 8226 | /* Unmute DAC0-1 and set vol = 0 */ |
| 8227 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8228 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8229 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8230 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8231 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8232 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8233 | |
| 8234 | /* |
| 8235 | * Set up output mixers (0x0c - 0x0e) |
| 8236 | */ |
| 8237 | /* set vol=0 to output mixers */ |
| 8238 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8239 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8240 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8241 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8242 | |
| 8243 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8244 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8245 | |
| 8246 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8248 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8249 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8250 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8251 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8252 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8253 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8254 | |
| 8255 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8256 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8257 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8258 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8259 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8260 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8261 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8262 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8263 | |
| 8264 | /* FIXME: use matrix-type input source selection */ |
| 8265 | /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */ |
| 8266 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8267 | /* Input mixer2 */ |
| 8268 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8269 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8270 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8271 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8272 | |
| 8273 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8274 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8275 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8276 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8277 | { } |
| 8278 | }; |
| 8279 | |
| 8280 | /* |
| 8281 | * generic initialization of ADC, input mixers and output mixers |
| 8282 | */ |
| 8283 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 8284 | /* set output DAC */ |
| 8285 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8286 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8287 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8288 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8289 | |
| 8290 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8291 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8292 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8293 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8294 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8295 | |
| 8296 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8299 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8300 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8301 | |
| 8302 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8303 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8304 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8305 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8306 | |
| 8307 | /* set PCBEEP vol = 0 */ |
| 8308 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 8309 | |
| 8310 | { } |
| 8311 | }; |
| 8312 | |
| 8313 | #define alc268_mux_enum_info alc_mux_enum_info |
| 8314 | #define alc268_mux_enum_get alc_mux_enum_get |
| 8315 | |
| 8316 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 8317 | struct snd_ctl_elem_value *ucontrol) |
| 8318 | { |
| 8319 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8320 | struct alc_spec *spec = codec->spec; |
| 8321 | const struct hda_input_mux *imux = spec->input_mux; |
| 8322 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 8323 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 8324 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 8325 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 8326 | unsigned int i, idx; |
| 8327 | |
| 8328 | idx = ucontrol->value.enumerated.item[0]; |
| 8329 | if (idx >= imux->num_items) |
| 8330 | idx = imux->num_items - 1; |
| 8331 | if (*cur_val == idx && !codec->in_resume) |
| 8332 | return 0; |
| 8333 | for (i = 0; i < imux->num_items; i++) { |
| 8334 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 8335 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8336 | v | (imux->items[i].index << 8)); |
| 8337 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, |
| 8338 | idx ); |
| 8339 | } |
| 8340 | *cur_val = idx; |
| 8341 | return 1; |
| 8342 | } |
| 8343 | |
| 8344 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 8345 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8346 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8347 | { |
| 8348 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8349 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8350 | * So call somewhat different.. |
| 8351 | * FIXME: the controls appear in the "playback" view! |
| 8352 | */ |
| 8353 | /* .name = "Capture Source", */ |
| 8354 | .name = "Input Source", |
| 8355 | .count = 1, |
| 8356 | .info = alc268_mux_enum_info, |
| 8357 | .get = alc268_mux_enum_get, |
| 8358 | .put = alc268_mux_enum_put, |
| 8359 | }, |
| 8360 | { } /* end */ |
| 8361 | }; |
| 8362 | |
| 8363 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 8364 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8365 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8366 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8367 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8368 | { |
| 8369 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8370 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8371 | * So call somewhat different.. |
| 8372 | * FIXME: the controls appear in the "playback" view! |
| 8373 | */ |
| 8374 | /* .name = "Capture Source", */ |
| 8375 | .name = "Input Source", |
| 8376 | .count = 2, |
| 8377 | .info = alc268_mux_enum_info, |
| 8378 | .get = alc268_mux_enum_get, |
| 8379 | .put = alc268_mux_enum_put, |
| 8380 | }, |
| 8381 | { } /* end */ |
| 8382 | }; |
| 8383 | |
| 8384 | static struct hda_input_mux alc268_capture_source = { |
| 8385 | .num_items = 4, |
| 8386 | .items = { |
| 8387 | { "Mic", 0x0 }, |
| 8388 | { "Front Mic", 0x1 }, |
| 8389 | { "Line", 0x2 }, |
| 8390 | { "CD", 0x3 }, |
| 8391 | }, |
| 8392 | }; |
| 8393 | |
| 8394 | /* create input playback/capture controls for the given pin */ |
| 8395 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 8396 | const char *ctlname, int idx) |
| 8397 | { |
| 8398 | char name[32]; |
| 8399 | int err; |
| 8400 | |
| 8401 | sprintf(name, "%s Playback Volume", ctlname); |
| 8402 | if (nid == 0x14) { |
| 8403 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8404 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 8405 | HDA_OUTPUT)); |
| 8406 | if (err < 0) |
| 8407 | return err; |
| 8408 | } else if (nid == 0x15) { |
| 8409 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8410 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 8411 | HDA_OUTPUT)); |
| 8412 | if (err < 0) |
| 8413 | return err; |
| 8414 | } else |
| 8415 | return -1; |
| 8416 | sprintf(name, "%s Playback Switch", ctlname); |
| 8417 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 8418 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 8419 | if (err < 0) |
| 8420 | return err; |
| 8421 | return 0; |
| 8422 | } |
| 8423 | |
| 8424 | /* add playback controls from the parsed DAC table */ |
| 8425 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8426 | const struct auto_pin_cfg *cfg) |
| 8427 | { |
| 8428 | hda_nid_t nid; |
| 8429 | int err; |
| 8430 | |
| 8431 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 8432 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8433 | spec->multiout.dac_nids[0] = 2; |
| 8434 | spec->multiout.dac_nids[1] = 3; |
| 8435 | |
| 8436 | nid = cfg->line_out_pins[0]; |
| 8437 | if (nid) |
| 8438 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 8439 | |
| 8440 | nid = cfg->speaker_pins[0]; |
| 8441 | if (nid == 0x1d) { |
| 8442 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8443 | "Speaker Playback Volume", |
| 8444 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 8445 | if (err < 0) |
| 8446 | return err; |
| 8447 | } |
| 8448 | nid = cfg->hp_pins[0]; |
| 8449 | if (nid) |
| 8450 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 8451 | |
| 8452 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 8453 | if (nid == 0x16) { |
| 8454 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8455 | "Mono Playback Switch", |
| 8456 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 8457 | if (err < 0) |
| 8458 | return err; |
| 8459 | } |
| 8460 | return 0; |
| 8461 | } |
| 8462 | |
| 8463 | /* create playback/capture controls for input pins */ |
| 8464 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 8465 | const struct auto_pin_cfg *cfg) |
| 8466 | { |
| 8467 | struct hda_input_mux *imux = &spec->private_imux; |
| 8468 | int i, idx1; |
| 8469 | |
| 8470 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8471 | switch(cfg->input_pins[i]) { |
| 8472 | case 0x18: |
| 8473 | idx1 = 0; /* Mic 1 */ |
| 8474 | break; |
| 8475 | case 0x19: |
| 8476 | idx1 = 1; /* Mic 2 */ |
| 8477 | break; |
| 8478 | case 0x1a: |
| 8479 | idx1 = 2; /* Line In */ |
| 8480 | break; |
| 8481 | case 0x1c: |
| 8482 | idx1 = 3; /* CD */ |
| 8483 | break; |
| 8484 | default: |
| 8485 | continue; |
| 8486 | } |
| 8487 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 8488 | imux->items[imux->num_items].index = idx1; |
| 8489 | imux->num_items++; |
| 8490 | } |
| 8491 | return 0; |
| 8492 | } |
| 8493 | |
| 8494 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 8495 | { |
| 8496 | struct alc_spec *spec = codec->spec; |
| 8497 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 8498 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 8499 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 8500 | unsigned int dac_vol1, dac_vol2; |
| 8501 | |
| 8502 | if (speaker_nid) { |
| 8503 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 8504 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 8505 | snd_hda_codec_write(codec, 0x0f, 0, |
| 8506 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8507 | AMP_IN_UNMUTE(1)); |
| 8508 | snd_hda_codec_write(codec, 0x10, 0, |
| 8509 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8510 | AMP_IN_UNMUTE(1)); |
| 8511 | } else { |
| 8512 | snd_hda_codec_write(codec, 0x0f, 0, |
| 8513 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 8514 | snd_hda_codec_write(codec, 0x10, 0, |
| 8515 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 8516 | } |
| 8517 | |
| 8518 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 8519 | if (line_nid == 0x14) |
| 8520 | dac_vol2 = AMP_OUT_ZERO; |
| 8521 | else if (line_nid == 0x15) |
| 8522 | dac_vol1 = AMP_OUT_ZERO; |
| 8523 | if (hp_nid == 0x14) |
| 8524 | dac_vol2 = AMP_OUT_ZERO; |
| 8525 | else if (hp_nid == 0x15) |
| 8526 | dac_vol1 = AMP_OUT_ZERO; |
| 8527 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 8528 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 8529 | spec->autocfg.line_out_pins[2] != 0x16) |
| 8530 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 8531 | |
| 8532 | snd_hda_codec_write(codec, 0x02, 0, |
| 8533 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 8534 | snd_hda_codec_write(codec, 0x03, 0, |
| 8535 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 8536 | } |
| 8537 | |
| 8538 | /* pcm configuration: identiacal with ALC880 */ |
| 8539 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 8540 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
| 8541 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 8542 | |
| 8543 | /* |
| 8544 | * BIOS auto configuration |
| 8545 | */ |
| 8546 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 8547 | { |
| 8548 | struct alc_spec *spec = codec->spec; |
| 8549 | int err; |
| 8550 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 8551 | |
| 8552 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 8553 | alc268_ignore); |
| 8554 | if (err < 0) |
| 8555 | return err; |
| 8556 | if (!spec->autocfg.line_outs) |
| 8557 | return 0; /* can't find valid BIOS pin config */ |
| 8558 | |
| 8559 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 8560 | if (err < 0) |
| 8561 | return err; |
| 8562 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 8563 | if (err < 0) |
| 8564 | return err; |
| 8565 | |
| 8566 | spec->multiout.max_channels = 2; |
| 8567 | |
| 8568 | /* digital only support output */ |
| 8569 | if (spec->autocfg.dig_out_pin) |
| 8570 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 8571 | |
| 8572 | if (spec->kctl_alloc) |
| 8573 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 8574 | |
| 8575 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 8576 | spec->num_mux_defs = 1; |
| 8577 | spec->input_mux = &spec->private_imux; |
| 8578 | |
| 8579 | return 1; |
| 8580 | } |
| 8581 | |
| 8582 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 8583 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 8584 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 8585 | |
| 8586 | /* init callback for auto-configuration model -- overriding the default init */ |
| 8587 | static void alc268_auto_init(struct hda_codec *codec) |
| 8588 | { |
| 8589 | alc268_auto_init_multi_out(codec); |
| 8590 | alc268_auto_init_hp_out(codec); |
| 8591 | alc268_auto_init_mono_speaker_out(codec); |
| 8592 | alc268_auto_init_analog_input(codec); |
| 8593 | } |
| 8594 | |
| 8595 | /* |
| 8596 | * configuration and preset |
| 8597 | */ |
| 8598 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 8599 | [ALC268_3ST] = "3stack", |
| 8600 | [ALC268_AUTO] = "auto", |
| 8601 | }; |
| 8602 | |
| 8603 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
| 8604 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
| 8605 | {} |
| 8606 | }; |
| 8607 | |
| 8608 | static struct alc_config_preset alc268_presets[] = { |
| 8609 | [ALC268_3ST] = { |
| 8610 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 8611 | .init_verbs = { alc268_base_init_verbs }, |
| 8612 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 8613 | .dac_nids = alc268_dac_nids, |
| 8614 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 8615 | .adc_nids = alc268_adc_nids_alt, |
| 8616 | .hp_nid = 0x03, |
| 8617 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 8618 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 8619 | .channel_mode = alc268_modes, |
| 8620 | .input_mux = &alc268_capture_source, |
| 8621 | }, |
| 8622 | }; |
| 8623 | |
| 8624 | static int patch_alc268(struct hda_codec *codec) |
| 8625 | { |
| 8626 | struct alc_spec *spec; |
| 8627 | int board_config; |
| 8628 | int err; |
| 8629 | |
| 8630 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 8631 | if (spec == NULL) |
| 8632 | return -ENOMEM; |
| 8633 | |
| 8634 | codec->spec = spec; |
| 8635 | |
| 8636 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 8637 | alc268_models, |
| 8638 | alc268_cfg_tbl); |
| 8639 | |
| 8640 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 8641 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 8642 | "trying auto-probe from BIOS...\n"); |
| 8643 | board_config = ALC268_AUTO; |
| 8644 | } |
| 8645 | |
| 8646 | if (board_config == ALC268_AUTO) { |
| 8647 | /* automatic parse from the BIOS config */ |
| 8648 | err = alc268_parse_auto_config(codec); |
| 8649 | if (err < 0) { |
| 8650 | alc_free(codec); |
| 8651 | return err; |
| 8652 | } else if (!err) { |
| 8653 | printk(KERN_INFO |
| 8654 | "hda_codec: Cannot set up configuration " |
| 8655 | "from BIOS. Using base mode...\n"); |
| 8656 | board_config = ALC268_3ST; |
| 8657 | } |
| 8658 | } |
| 8659 | |
| 8660 | if (board_config != ALC268_AUTO) |
| 8661 | setup_preset(spec, &alc268_presets[board_config]); |
| 8662 | |
| 8663 | spec->stream_name_analog = "ALC268 Analog"; |
| 8664 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 8665 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
| 8666 | |
| 8667 | spec->stream_name_digital = "ALC268 Digital"; |
| 8668 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 8669 | |
| 8670 | if (board_config == ALC268_AUTO) { |
| 8671 | if (!spec->adc_nids && spec->input_mux) { |
| 8672 | /* check whether NID 0x07 is valid */ |
| 8673 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 8674 | |
| 8675 | /* get type */ |
| 8676 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 8677 | if (wcap != AC_WID_AUD_IN) { |
| 8678 | spec->adc_nids = alc268_adc_nids_alt; |
| 8679 | spec->num_adc_nids = |
| 8680 | ARRAY_SIZE(alc268_adc_nids_alt); |
| 8681 | spec->mixers[spec->num_mixers] = |
| 8682 | alc268_capture_alt_mixer; |
| 8683 | spec->num_mixers++; |
| 8684 | } else { |
| 8685 | spec->adc_nids = alc268_adc_nids; |
| 8686 | spec->num_adc_nids = |
| 8687 | ARRAY_SIZE(alc268_adc_nids); |
| 8688 | spec->mixers[spec->num_mixers] = |
| 8689 | alc268_capture_mixer; |
| 8690 | spec->num_mixers++; |
| 8691 | } |
| 8692 | } |
| 8693 | } |
| 8694 | codec->patch_ops = alc_patch_ops; |
| 8695 | if (board_config == ALC268_AUTO) |
| 8696 | spec->init_hook = alc268_auto_init; |
| 8697 | |
| 8698 | return 0; |
| 8699 | } |
| 8700 | |
| 8701 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8702 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 8703 | */ |
| 8704 | |
| 8705 | /* |
| 8706 | * set the path ways for 2 channel output |
| 8707 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 8708 | */ |
| 8709 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 8710 | /* set pin widget 1Ah (line in) for input */ |
| 8711 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8712 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 8713 | * the vref |
| 8714 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8715 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8716 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8717 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 8718 | #if 0 |
| 8719 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8720 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 8721 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8722 | { } /* end */ |
| 8723 | }; |
| 8724 | /* |
| 8725 | * 6ch mode |
| 8726 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 8727 | */ |
| 8728 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 8729 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 8730 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8731 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 8732 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8733 | |
| 8734 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8735 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8736 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8737 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 8738 | #if 0 |
| 8739 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8740 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 8741 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8742 | { } /* end */ |
| 8743 | }; |
| 8744 | |
| 8745 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 8746 | { 2, alc861_threestack_ch2_init }, |
| 8747 | { 6, alc861_threestack_ch6_init }, |
| 8748 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8749 | /* Set mic1 as input and unmute the mixer */ |
| 8750 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 8751 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8752 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8753 | { } /* end */ |
| 8754 | }; |
| 8755 | /* Set mic1 as output and mute mixer */ |
| 8756 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 8757 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8758 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8759 | { } /* end */ |
| 8760 | }; |
| 8761 | |
| 8762 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 8763 | { 2, alc861_uniwill_m31_ch2_init }, |
| 8764 | { 4, alc861_uniwill_m31_ch4_init }, |
| 8765 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8766 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8767 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 8768 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 8769 | /* set pin widget 1Ah (line in) for input */ |
| 8770 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8771 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 8772 | * the vref |
| 8773 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8774 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8775 | |
| 8776 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 8777 | #if 0 |
| 8778 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8779 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 8780 | #endif |
| 8781 | { } /* end */ |
| 8782 | }; |
| 8783 | /* Set mic1 nad line-in as output and mute mixer */ |
| 8784 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 8785 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 8786 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8787 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 8788 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 8789 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8790 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 8791 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8792 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8793 | |
| 8794 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 8795 | #if 0 |
| 8796 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8797 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 8798 | #endif |
| 8799 | { } /* end */ |
| 8800 | }; |
| 8801 | |
| 8802 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 8803 | { 2, alc861_asus_ch2_init }, |
| 8804 | { 6, alc861_asus_ch6_init }, |
| 8805 | }; |
| 8806 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8807 | /* patch-ALC861 */ |
| 8808 | |
| 8809 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 8810 | /* output mixer control */ |
| 8811 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8812 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8813 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8814 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8815 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 8816 | |
| 8817 | /*Input mixer control */ |
| 8818 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8819 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8820 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8821 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8822 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8823 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8824 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8825 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8826 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8827 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8828 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8829 | /* Capture mixer control */ |
| 8830 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8831 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8832 | { |
| 8833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8834 | .name = "Capture Source", |
| 8835 | .count = 1, |
| 8836 | .info = alc_mux_enum_info, |
| 8837 | .get = alc_mux_enum_get, |
| 8838 | .put = alc_mux_enum_put, |
| 8839 | }, |
| 8840 | { } /* end */ |
| 8841 | }; |
| 8842 | |
| 8843 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 8844 | /* output mixer control */ |
| 8845 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8846 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8847 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8848 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8849 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 8850 | |
| 8851 | /* Input mixer control */ |
| 8852 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8853 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8854 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8855 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8856 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8857 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8858 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8859 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8860 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8861 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8862 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8863 | /* Capture mixer control */ |
| 8864 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8865 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8866 | { |
| 8867 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8868 | .name = "Capture Source", |
| 8869 | .count = 1, |
| 8870 | .info = alc_mux_enum_info, |
| 8871 | .get = alc_mux_enum_get, |
| 8872 | .put = alc_mux_enum_put, |
| 8873 | }, |
| 8874 | { |
| 8875 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8876 | .name = "Channel Mode", |
| 8877 | .info = alc_ch_mode_info, |
| 8878 | .get = alc_ch_mode_get, |
| 8879 | .put = alc_ch_mode_put, |
| 8880 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 8881 | }, |
| 8882 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8883 | }; |
| 8884 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8885 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8886 | /* output mixer control */ |
| 8887 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8888 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8889 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8890 | |
| 8891 | /*Capture mixer control */ |
| 8892 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8893 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8894 | { |
| 8895 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8896 | .name = "Capture Source", |
| 8897 | .count = 1, |
| 8898 | .info = alc_mux_enum_info, |
| 8899 | .get = alc_mux_enum_get, |
| 8900 | .put = alc_mux_enum_put, |
| 8901 | }, |
| 8902 | |
| 8903 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8904 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8905 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8906 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 8907 | /* output mixer control */ |
| 8908 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8909 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8910 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8911 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8912 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 8913 | |
| 8914 | /* Input mixer control */ |
| 8915 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8916 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8917 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8918 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8919 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8920 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8921 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8922 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8923 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8924 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8925 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8926 | /* Capture mixer control */ |
| 8927 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8928 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8929 | { |
| 8930 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8931 | .name = "Capture Source", |
| 8932 | .count = 1, |
| 8933 | .info = alc_mux_enum_info, |
| 8934 | .get = alc_mux_enum_get, |
| 8935 | .put = alc_mux_enum_put, |
| 8936 | }, |
| 8937 | { |
| 8938 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8939 | .name = "Channel Mode", |
| 8940 | .info = alc_ch_mode_info, |
| 8941 | .get = alc_ch_mode_get, |
| 8942 | .put = alc_ch_mode_put, |
| 8943 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 8944 | }, |
| 8945 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8946 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8947 | |
| 8948 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 8949 | /* output mixer control */ |
| 8950 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8951 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8952 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8953 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8954 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 8955 | |
| 8956 | /* Input mixer control */ |
| 8957 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8958 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8959 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8960 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8961 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8962 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8963 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8964 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8965 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8966 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 8967 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8968 | /* Capture mixer control */ |
| 8969 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8970 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8971 | { |
| 8972 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8973 | .name = "Capture Source", |
| 8974 | .count = 1, |
| 8975 | .info = alc_mux_enum_info, |
| 8976 | .get = alc_mux_enum_get, |
| 8977 | .put = alc_mux_enum_put, |
| 8978 | }, |
| 8979 | { |
| 8980 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8981 | .name = "Channel Mode", |
| 8982 | .info = alc_ch_mode_info, |
| 8983 | .get = alc_ch_mode_get, |
| 8984 | .put = alc_ch_mode_put, |
| 8985 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 8986 | }, |
| 8987 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8988 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8989 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8990 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8991 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8992 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8993 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8994 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8995 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8996 | { } |
| 8997 | }; |
| 8998 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8999 | /* |
| 9000 | * generic initialization of ADC, input mixers and output mixers |
| 9001 | */ |
| 9002 | static struct hda_verb alc861_base_init_verbs[] = { |
| 9003 | /* |
| 9004 | * Unmute ADC0 and set the default input to mic-in |
| 9005 | */ |
| 9006 | /* port-A for surround (rear panel) */ |
| 9007 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9008 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9009 | /* port-B for mic-in (rear panel) with vref */ |
| 9010 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9011 | /* port-C for line-in (rear panel) */ |
| 9012 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9013 | /* port-D for Front */ |
| 9014 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9015 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9016 | /* port-E for HP out (front panel) */ |
| 9017 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 9018 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9019 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9020 | /* port-F for mic-in (front panel) with vref */ |
| 9021 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9022 | /* port-G for CLFE (rear panel) */ |
| 9023 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9024 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9025 | /* port-H for side (rear panel) */ |
| 9026 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9027 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9028 | /* CD-in */ |
| 9029 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9030 | /* route front mic to ADC1*/ |
| 9031 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9032 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9033 | |
| 9034 | /* Unmute DAC0~3 & spdif out*/ |
| 9035 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9036 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9037 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9038 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9039 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9040 | |
| 9041 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9042 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9043 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9044 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9045 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9046 | |
| 9047 | /* Unmute Stereo Mixer 15 */ |
| 9048 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9049 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9051 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9052 | |
| 9053 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9054 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9055 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9056 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9057 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9058 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9059 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9060 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9061 | /* hp used DAC 3 (Front) */ |
| 9062 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9063 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9064 | |
| 9065 | { } |
| 9066 | }; |
| 9067 | |
| 9068 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 9069 | /* |
| 9070 | * Unmute ADC0 and set the default input to mic-in |
| 9071 | */ |
| 9072 | /* port-A for surround (rear panel) */ |
| 9073 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9074 | /* port-B for mic-in (rear panel) with vref */ |
| 9075 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9076 | /* port-C for line-in (rear panel) */ |
| 9077 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9078 | /* port-D for Front */ |
| 9079 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9080 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9081 | /* port-E for HP out (front panel) */ |
| 9082 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 9083 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9084 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9085 | /* port-F for mic-in (front panel) with vref */ |
| 9086 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9087 | /* port-G for CLFE (rear panel) */ |
| 9088 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9089 | /* port-H for side (rear panel) */ |
| 9090 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9091 | /* CD-in */ |
| 9092 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9093 | /* route front mic to ADC1*/ |
| 9094 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9095 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9096 | /* Unmute DAC0~3 & spdif out*/ |
| 9097 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9098 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9099 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9100 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9101 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9102 | |
| 9103 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9104 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9105 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9106 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9107 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9108 | |
| 9109 | /* Unmute Stereo Mixer 15 */ |
| 9110 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9111 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9112 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9113 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9114 | |
| 9115 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9116 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9117 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9118 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9119 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9120 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9121 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9122 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9123 | /* hp used DAC 3 (Front) */ |
| 9124 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9125 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9126 | { } |
| 9127 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9128 | |
| 9129 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 9130 | /* |
| 9131 | * Unmute ADC0 and set the default input to mic-in |
| 9132 | */ |
| 9133 | /* port-A for surround (rear panel) */ |
| 9134 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9135 | /* port-B for mic-in (rear panel) with vref */ |
| 9136 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9137 | /* port-C for line-in (rear panel) */ |
| 9138 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9139 | /* port-D for Front */ |
| 9140 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9141 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9142 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9143 | /* this has to be set to VREF80 */ |
| 9144 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9145 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9146 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9147 | /* port-F for mic-in (front panel) with vref */ |
| 9148 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9149 | /* port-G for CLFE (rear panel) */ |
| 9150 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9151 | /* port-H for side (rear panel) */ |
| 9152 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9153 | /* CD-in */ |
| 9154 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9155 | /* route front mic to ADC1*/ |
| 9156 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9157 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9158 | /* Unmute DAC0~3 & spdif out*/ |
| 9159 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9160 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9161 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9162 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9163 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9164 | |
| 9165 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9166 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9167 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9168 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9169 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9170 | |
| 9171 | /* Unmute Stereo Mixer 15 */ |
| 9172 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9173 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9174 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9175 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9176 | |
| 9177 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9178 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9179 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9180 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9181 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9182 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9183 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9184 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9185 | /* hp used DAC 3 (Front) */ |
| 9186 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9187 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9188 | { } |
| 9189 | }; |
| 9190 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9191 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 9192 | /* |
| 9193 | * Unmute ADC0 and set the default input to mic-in |
| 9194 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9195 | /* port-A for surround (rear panel) |
| 9196 | * according to codec#0 this is the HP jack |
| 9197 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9198 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 9199 | /* route front PCM to HP */ |
| 9200 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9201 | /* port-B for mic-in (rear panel) with vref */ |
| 9202 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9203 | /* port-C for line-in (rear panel) */ |
| 9204 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9205 | /* port-D for Front */ |
| 9206 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9207 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9208 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9209 | /* this has to be set to VREF80 */ |
| 9210 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9211 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9212 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9213 | /* port-F for mic-in (front panel) with vref */ |
| 9214 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9215 | /* port-G for CLFE (rear panel) */ |
| 9216 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9217 | /* port-H for side (rear panel) */ |
| 9218 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9219 | /* CD-in */ |
| 9220 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9221 | /* route front mic to ADC1*/ |
| 9222 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9223 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9224 | /* Unmute DAC0~3 & spdif out*/ |
| 9225 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9226 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9227 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9228 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9230 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9231 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9232 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9233 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9234 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9235 | |
| 9236 | /* Unmute Stereo Mixer 15 */ |
| 9237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9238 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9239 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9240 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9241 | |
| 9242 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9243 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9244 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9245 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9246 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9247 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9248 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9249 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9250 | /* hp used DAC 3 (Front) */ |
| 9251 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9252 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9253 | { } |
| 9254 | }; |
| 9255 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9256 | /* additional init verbs for ASUS laptops */ |
| 9257 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 9258 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 9259 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 9260 | { } |
| 9261 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9262 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9263 | /* |
| 9264 | * generic initialization of ADC, input mixers and output mixers |
| 9265 | */ |
| 9266 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 9267 | /* |
| 9268 | * Unmute ADC0 and set the default input to mic-in |
| 9269 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9270 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9271 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9272 | |
| 9273 | /* Unmute DAC0~3 & spdif out*/ |
| 9274 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9275 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9276 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9277 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9279 | |
| 9280 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9281 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9282 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9283 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9284 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9285 | |
| 9286 | /* Unmute Stereo Mixer 15 */ |
| 9287 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9288 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9289 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9290 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 9291 | |
| 9292 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9293 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9294 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9295 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9296 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9297 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9298 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9299 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9300 | |
| 9301 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9302 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9303 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9304 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9305 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9306 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9307 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9308 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9309 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9310 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9311 | |
| 9312 | { } |
| 9313 | }; |
| 9314 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9315 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 9316 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9317 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9318 | { } |
| 9319 | }; |
| 9320 | |
| 9321 | /* toggle speaker-output according to the hp-jack state */ |
| 9322 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 9323 | { |
| 9324 | unsigned int present; |
| 9325 | |
| 9326 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 9327 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9328 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, |
| 9329 | 0x80, present ? 0x80 : 0); |
| 9330 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, |
| 9331 | 0x80, present ? 0x80 : 0); |
| 9332 | snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3, |
| 9333 | 0x80, present ? 0 : 0x80); |
| 9334 | snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3, |
| 9335 | 0x80, present ? 0 : 0x80); |
| 9336 | } |
| 9337 | |
| 9338 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 9339 | unsigned int res) |
| 9340 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9341 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9342 | alc861_toshiba_automute(codec); |
| 9343 | } |
| 9344 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9345 | /* pcm configuration: identiacal with ALC880 */ |
| 9346 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 9347 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 9348 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 9349 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 9350 | |
| 9351 | |
| 9352 | #define ALC861_DIGOUT_NID 0x07 |
| 9353 | |
| 9354 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 9355 | { 8, NULL } |
| 9356 | }; |
| 9357 | |
| 9358 | static hda_nid_t alc861_dac_nids[4] = { |
| 9359 | /* front, surround, clfe, side */ |
| 9360 | 0x03, 0x06, 0x05, 0x04 |
| 9361 | }; |
| 9362 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9363 | static hda_nid_t alc660_dac_nids[3] = { |
| 9364 | /* front, clfe, surround */ |
| 9365 | 0x03, 0x05, 0x06 |
| 9366 | }; |
| 9367 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9368 | static hda_nid_t alc861_adc_nids[1] = { |
| 9369 | /* ADC0-2 */ |
| 9370 | 0x08, |
| 9371 | }; |
| 9372 | |
| 9373 | static struct hda_input_mux alc861_capture_source = { |
| 9374 | .num_items = 5, |
| 9375 | .items = { |
| 9376 | { "Mic", 0x0 }, |
| 9377 | { "Front Mic", 0x3 }, |
| 9378 | { "Line", 0x1 }, |
| 9379 | { "CD", 0x4 }, |
| 9380 | { "Mixer", 0x5 }, |
| 9381 | }, |
| 9382 | }; |
| 9383 | |
| 9384 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9385 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 9386 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9387 | { |
| 9388 | int i; |
| 9389 | hda_nid_t nid; |
| 9390 | |
| 9391 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9392 | for (i = 0; i < cfg->line_outs; i++) { |
| 9393 | nid = cfg->line_out_pins[i]; |
| 9394 | if (nid) { |
| 9395 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 9396 | continue; |
| 9397 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 9398 | } |
| 9399 | } |
| 9400 | spec->multiout.num_dacs = cfg->line_outs; |
| 9401 | return 0; |
| 9402 | } |
| 9403 | |
| 9404 | /* add playback controls from the parsed DAC table */ |
| 9405 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9406 | const struct auto_pin_cfg *cfg) |
| 9407 | { |
| 9408 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9409 | static const char *chname[4] = { |
| 9410 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 9411 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9412 | hda_nid_t nid; |
| 9413 | int i, idx, err; |
| 9414 | |
| 9415 | for (i = 0; i < cfg->line_outs; i++) { |
| 9416 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9417 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9418 | continue; |
| 9419 | if (nid == 0x05) { |
| 9420 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9421 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9422 | "Center Playback Switch", |
| 9423 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 9424 | HDA_OUTPUT)); |
| 9425 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9426 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9427 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9428 | "LFE Playback Switch", |
| 9429 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9430 | HDA_OUTPUT)); |
| 9431 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9432 | return err; |
| 9433 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9434 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 9435 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9436 | if (nid == alc861_dac_nids[idx]) |
| 9437 | break; |
| 9438 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9439 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 9440 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9441 | HDA_OUTPUT)); |
| 9442 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9443 | return err; |
| 9444 | } |
| 9445 | } |
| 9446 | return 0; |
| 9447 | } |
| 9448 | |
| 9449 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 9450 | { |
| 9451 | int err; |
| 9452 | hda_nid_t nid; |
| 9453 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9454 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9455 | return 0; |
| 9456 | |
| 9457 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 9458 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9459 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9460 | "Headphone Playback Switch", |
| 9461 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9462 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9463 | return err; |
| 9464 | spec->multiout.hp_nid = nid; |
| 9465 | } |
| 9466 | return 0; |
| 9467 | } |
| 9468 | |
| 9469 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9470 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9471 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9472 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9473 | struct hda_input_mux *imux = &spec->private_imux; |
| 9474 | int i, err, idx, idx1; |
| 9475 | |
| 9476 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9477 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9478 | case 0x0c: |
| 9479 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9480 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9481 | break; |
| 9482 | case 0x0f: |
| 9483 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9484 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9485 | break; |
| 9486 | case 0x0d: |
| 9487 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9488 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9489 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9490 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9491 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9492 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9493 | break; |
| 9494 | case 0x11: |
| 9495 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9496 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9497 | break; |
| 9498 | default: |
| 9499 | continue; |
| 9500 | } |
| 9501 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9502 | err = new_analog_input(spec, cfg->input_pins[i], |
| 9503 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9504 | if (err < 0) |
| 9505 | return err; |
| 9506 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9507 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9508 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9509 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9510 | } |
| 9511 | return 0; |
| 9512 | } |
| 9513 | |
| 9514 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 9515 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 9516 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 9517 | |
| 9518 | { |
| 9519 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9520 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9521 | * So call somewhat different.. |
| 9522 | *FIXME: the controls appear in the "playback" view! |
| 9523 | */ |
| 9524 | /* .name = "Capture Source", */ |
| 9525 | .name = "Input Source", |
| 9526 | .count = 1, |
| 9527 | .info = alc_mux_enum_info, |
| 9528 | .get = alc_mux_enum_get, |
| 9529 | .put = alc_mux_enum_put, |
| 9530 | }, |
| 9531 | { } /* end */ |
| 9532 | }; |
| 9533 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9534 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9535 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9536 | int pin_type, int dac_idx) |
| 9537 | { |
| 9538 | /* set as output */ |
| 9539 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9540 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9541 | pin_type); |
| 9542 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 9543 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9544 | |
| 9545 | } |
| 9546 | |
| 9547 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 9548 | { |
| 9549 | struct alc_spec *spec = codec->spec; |
| 9550 | int i; |
| 9551 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9552 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9553 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 9554 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9555 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9556 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9557 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9558 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9559 | } |
| 9560 | } |
| 9561 | |
| 9562 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 9563 | { |
| 9564 | struct alc_spec *spec = codec->spec; |
| 9565 | hda_nid_t pin; |
| 9566 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9567 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9568 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9569 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 9570 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9571 | } |
| 9572 | |
| 9573 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 9574 | { |
| 9575 | struct alc_spec *spec = codec->spec; |
| 9576 | int i; |
| 9577 | |
| 9578 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9579 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9580 | if (nid >= 0x0c && nid <= 0x11) { |
| 9581 | snd_hda_codec_write(codec, nid, 0, |
| 9582 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9583 | i <= AUTO_PIN_FRONT_MIC ? |
| 9584 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9585 | } |
| 9586 | } |
| 9587 | } |
| 9588 | |
| 9589 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9590 | /* return 1 if successful, 0 if the proper config is not found, |
| 9591 | * or a negative error code |
| 9592 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9593 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 9594 | { |
| 9595 | struct alc_spec *spec = codec->spec; |
| 9596 | int err; |
| 9597 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 9598 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9599 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9600 | alc861_ignore); |
| 9601 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9602 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9603 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9604 | return 0; /* can't find valid BIOS pin config */ |
| 9605 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9606 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9607 | if (err < 0) |
| 9608 | return err; |
| 9609 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9610 | if (err < 0) |
| 9611 | return err; |
| 9612 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 9613 | if (err < 0) |
| 9614 | return err; |
| 9615 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9616 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9617 | return err; |
| 9618 | |
| 9619 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9620 | |
| 9621 | if (spec->autocfg.dig_out_pin) |
| 9622 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 9623 | |
| 9624 | if (spec->kctl_alloc) |
| 9625 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9626 | |
| 9627 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 9628 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9629 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9630 | spec->input_mux = &spec->private_imux; |
| 9631 | |
| 9632 | spec->adc_nids = alc861_adc_nids; |
| 9633 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 9634 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 9635 | spec->num_mixers++; |
| 9636 | |
| 9637 | return 1; |
| 9638 | } |
| 9639 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9640 | /* additional initialization for auto-configuration model */ |
| 9641 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9642 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9643 | alc861_auto_init_multi_out(codec); |
| 9644 | alc861_auto_init_hp_out(codec); |
| 9645 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9646 | } |
| 9647 | |
| 9648 | |
| 9649 | /* |
| 9650 | * configuration and preset |
| 9651 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9652 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 9653 | [ALC861_3ST] = "3stack", |
| 9654 | [ALC660_3ST] = "3stack-660", |
| 9655 | [ALC861_3ST_DIG] = "3stack-dig", |
| 9656 | [ALC861_6ST_DIG] = "6stack-dig", |
| 9657 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 9658 | [ALC861_TOSHIBA] = "toshiba", |
| 9659 | [ALC861_ASUS] = "asus", |
| 9660 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 9661 | [ALC861_AUTO] = "auto", |
| 9662 | }; |
| 9663 | |
| 9664 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 9665 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9666 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 9667 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f223a9f | 2007-04-25 13:38:31 +0200 | [diff] [blame] | 9668 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9669 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9670 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9671 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 9672 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 9673 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 9674 | * Any other models that need this preset? |
| 9675 | */ |
| 9676 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9677 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
Dave Jones | 35739bb | 2007-06-06 14:48:52 +0200 | [diff] [blame] | 9678 | SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), |
Takashi Iwai | 4147dab | 2007-01-31 10:35:19 +0100 | [diff] [blame] | 9679 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 9680 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9681 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 9682 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 9683 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9684 | {} |
| 9685 | }; |
| 9686 | |
| 9687 | static struct alc_config_preset alc861_presets[] = { |
| 9688 | [ALC861_3ST] = { |
| 9689 | .mixers = { alc861_3ST_mixer }, |
| 9690 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9691 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9692 | .dac_nids = alc861_dac_nids, |
| 9693 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9694 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9695 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9696 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9697 | .adc_nids = alc861_adc_nids, |
| 9698 | .input_mux = &alc861_capture_source, |
| 9699 | }, |
| 9700 | [ALC861_3ST_DIG] = { |
| 9701 | .mixers = { alc861_base_mixer }, |
| 9702 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9703 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9704 | .dac_nids = alc861_dac_nids, |
| 9705 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9706 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9707 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9708 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9709 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9710 | .adc_nids = alc861_adc_nids, |
| 9711 | .input_mux = &alc861_capture_source, |
| 9712 | }, |
| 9713 | [ALC861_6ST_DIG] = { |
| 9714 | .mixers = { alc861_base_mixer }, |
| 9715 | .init_verbs = { alc861_base_init_verbs }, |
| 9716 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9717 | .dac_nids = alc861_dac_nids, |
| 9718 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9719 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 9720 | .channel_mode = alc861_8ch_modes, |
| 9721 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9722 | .adc_nids = alc861_adc_nids, |
| 9723 | .input_mux = &alc861_capture_source, |
| 9724 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9725 | [ALC660_3ST] = { |
| 9726 | .mixers = { alc861_3ST_mixer }, |
| 9727 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9728 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 9729 | .dac_nids = alc660_dac_nids, |
| 9730 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9731 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9732 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9733 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9734 | .adc_nids = alc861_adc_nids, |
| 9735 | .input_mux = &alc861_capture_source, |
| 9736 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9737 | [ALC861_UNIWILL_M31] = { |
| 9738 | .mixers = { alc861_uniwill_m31_mixer }, |
| 9739 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 9740 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9741 | .dac_nids = alc861_dac_nids, |
| 9742 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9743 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 9744 | .channel_mode = alc861_uniwill_m31_modes, |
| 9745 | .need_dac_fix = 1, |
| 9746 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9747 | .adc_nids = alc861_adc_nids, |
| 9748 | .input_mux = &alc861_capture_source, |
| 9749 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9750 | [ALC861_TOSHIBA] = { |
| 9751 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9752 | .init_verbs = { alc861_base_init_verbs, |
| 9753 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9754 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9755 | .dac_nids = alc861_dac_nids, |
| 9756 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9757 | .channel_mode = alc883_3ST_2ch_modes, |
| 9758 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9759 | .adc_nids = alc861_adc_nids, |
| 9760 | .input_mux = &alc861_capture_source, |
| 9761 | .unsol_event = alc861_toshiba_unsol_event, |
| 9762 | .init_hook = alc861_toshiba_automute, |
| 9763 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9764 | [ALC861_ASUS] = { |
| 9765 | .mixers = { alc861_asus_mixer }, |
| 9766 | .init_verbs = { alc861_asus_init_verbs }, |
| 9767 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9768 | .dac_nids = alc861_dac_nids, |
| 9769 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9770 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 9771 | .channel_mode = alc861_asus_modes, |
| 9772 | .need_dac_fix = 1, |
| 9773 | .hp_nid = 0x06, |
| 9774 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9775 | .adc_nids = alc861_adc_nids, |
| 9776 | .input_mux = &alc861_capture_source, |
| 9777 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9778 | [ALC861_ASUS_LAPTOP] = { |
| 9779 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 9780 | .init_verbs = { alc861_asus_init_verbs, |
| 9781 | alc861_asus_laptop_init_verbs }, |
| 9782 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9783 | .dac_nids = alc861_dac_nids, |
| 9784 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9785 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9786 | .channel_mode = alc883_3ST_2ch_modes, |
| 9787 | .need_dac_fix = 1, |
| 9788 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9789 | .adc_nids = alc861_adc_nids, |
| 9790 | .input_mux = &alc861_capture_source, |
| 9791 | }, |
| 9792 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9793 | |
| 9794 | |
| 9795 | static int patch_alc861(struct hda_codec *codec) |
| 9796 | { |
| 9797 | struct alc_spec *spec; |
| 9798 | int board_config; |
| 9799 | int err; |
| 9800 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9801 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9802 | if (spec == NULL) |
| 9803 | return -ENOMEM; |
| 9804 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9805 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9806 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9807 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 9808 | alc861_models, |
| 9809 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9810 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9811 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9812 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 9813 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9814 | board_config = ALC861_AUTO; |
| 9815 | } |
| 9816 | |
| 9817 | if (board_config == ALC861_AUTO) { |
| 9818 | /* automatic parse from the BIOS config */ |
| 9819 | err = alc861_parse_auto_config(codec); |
| 9820 | if (err < 0) { |
| 9821 | alc_free(codec); |
| 9822 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9823 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9824 | printk(KERN_INFO |
| 9825 | "hda_codec: Cannot set up configuration " |
| 9826 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9827 | board_config = ALC861_3ST_DIG; |
| 9828 | } |
| 9829 | } |
| 9830 | |
| 9831 | if (board_config != ALC861_AUTO) |
| 9832 | setup_preset(spec, &alc861_presets[board_config]); |
| 9833 | |
| 9834 | spec->stream_name_analog = "ALC861 Analog"; |
| 9835 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 9836 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 9837 | |
| 9838 | spec->stream_name_digital = "ALC861 Digital"; |
| 9839 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 9840 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 9841 | |
| 9842 | codec->patch_ops = alc_patch_ops; |
| 9843 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9844 | spec->init_hook = alc861_auto_init; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9845 | |
| 9846 | return 0; |
| 9847 | } |
| 9848 | |
| 9849 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9850 | * ALC861-VD support |
| 9851 | * |
| 9852 | * Based on ALC882 |
| 9853 | * |
| 9854 | * In addition, an independent DAC |
| 9855 | */ |
| 9856 | #define ALC861VD_DIGOUT_NID 0x06 |
| 9857 | |
| 9858 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 9859 | /* front, surr, clfe, side surr */ |
| 9860 | 0x02, 0x03, 0x04, 0x05 |
| 9861 | }; |
| 9862 | |
| 9863 | /* dac_nids for ALC660vd are in a different order - according to |
| 9864 | * Realtek's driver. |
| 9865 | * This should probably tesult in a different mixer for 6stack models |
| 9866 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 9867 | * - and it is the same as in 861vd. |
| 9868 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 9869 | */ |
| 9870 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 9871 | /* front, rear, clfe, rear_surr */ |
| 9872 | 0x02, 0x04, 0x03 |
| 9873 | }; |
| 9874 | |
| 9875 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 9876 | /* ADC0 */ |
| 9877 | 0x09, |
| 9878 | }; |
| 9879 | |
| 9880 | /* input MUX */ |
| 9881 | /* FIXME: should be a matrix-type input source selection */ |
| 9882 | static struct hda_input_mux alc861vd_capture_source = { |
| 9883 | .num_items = 4, |
| 9884 | .items = { |
| 9885 | { "Mic", 0x0 }, |
| 9886 | { "Front Mic", 0x1 }, |
| 9887 | { "Line", 0x2 }, |
| 9888 | { "CD", 0x4 }, |
| 9889 | }, |
| 9890 | }; |
| 9891 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9892 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 9893 | .num_items = 3, |
| 9894 | .items = { |
| 9895 | { "Front Mic", 0x0 }, |
| 9896 | { "ATAPI Mic", 0x1 }, |
| 9897 | { "Line In", 0x5 }, |
| 9898 | }, |
| 9899 | }; |
| 9900 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9901 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 9902 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 9903 | |
| 9904 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9905 | struct snd_ctl_elem_value *ucontrol) |
| 9906 | { |
| 9907 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9908 | struct alc_spec *spec = codec->spec; |
| 9909 | const struct hda_input_mux *imux = spec->input_mux; |
| 9910 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9911 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 9912 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 9913 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 9914 | unsigned int i, idx; |
| 9915 | |
| 9916 | idx = ucontrol->value.enumerated.item[0]; |
| 9917 | if (idx >= imux->num_items) |
| 9918 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9919 | if (*cur_val == idx && !codec->in_resume) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9920 | return 0; |
| 9921 | for (i = 0; i < imux->num_items; i++) { |
| 9922 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 9923 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 9924 | v | (imux->items[i].index << 8)); |
| 9925 | } |
| 9926 | *cur_val = idx; |
| 9927 | return 1; |
| 9928 | } |
| 9929 | |
| 9930 | /* |
| 9931 | * 2ch mode |
| 9932 | */ |
| 9933 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 9934 | { 2, NULL } |
| 9935 | }; |
| 9936 | |
| 9937 | /* |
| 9938 | * 6ch mode |
| 9939 | */ |
| 9940 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 9941 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9942 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9943 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9944 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9945 | { } /* end */ |
| 9946 | }; |
| 9947 | |
| 9948 | /* |
| 9949 | * 8ch mode |
| 9950 | */ |
| 9951 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 9952 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9953 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9954 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9955 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9956 | { } /* end */ |
| 9957 | }; |
| 9958 | |
| 9959 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 9960 | { 6, alc861vd_6stack_ch6_init }, |
| 9961 | { 8, alc861vd_6stack_ch8_init }, |
| 9962 | }; |
| 9963 | |
| 9964 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 9965 | { |
| 9966 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9967 | .name = "Channel Mode", |
| 9968 | .info = alc_ch_mode_info, |
| 9969 | .get = alc_ch_mode_get, |
| 9970 | .put = alc_ch_mode_put, |
| 9971 | }, |
| 9972 | { } /* end */ |
| 9973 | }; |
| 9974 | |
| 9975 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 9976 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9977 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9978 | |
| 9979 | { |
| 9980 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9981 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9982 | * So call somewhat different.. |
| 9983 | *FIXME: the controls appear in the "playback" view! |
| 9984 | */ |
| 9985 | /* .name = "Capture Source", */ |
| 9986 | .name = "Input Source", |
| 9987 | .count = 1, |
| 9988 | .info = alc861vd_mux_enum_info, |
| 9989 | .get = alc861vd_mux_enum_get, |
| 9990 | .put = alc861vd_mux_enum_put, |
| 9991 | }, |
| 9992 | { } /* end */ |
| 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 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 9999 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10000 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10001 | |
| 10002 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10003 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 10004 | |
| 10005 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 10006 | HDA_OUTPUT), |
| 10007 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 10008 | HDA_OUTPUT), |
| 10009 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10010 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 10011 | |
| 10012 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 10013 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10014 | |
| 10015 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10016 | |
| 10017 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10019 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10020 | |
| 10021 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10022 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10023 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10024 | |
| 10025 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10026 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10027 | |
| 10028 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10029 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10030 | |
| 10031 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10032 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10033 | |
| 10034 | { } /* end */ |
| 10035 | }; |
| 10036 | |
| 10037 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 10038 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10039 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10040 | |
| 10041 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10042 | |
| 10043 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10045 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10046 | |
| 10047 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10048 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10049 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10050 | |
| 10051 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10052 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10053 | |
| 10054 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10055 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10056 | |
| 10057 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10058 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10059 | |
| 10060 | { } /* end */ |
| 10061 | }; |
| 10062 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10063 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 10064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10065 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 10066 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10067 | |
| 10068 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10069 | |
| 10070 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10071 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10072 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10073 | |
| 10074 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10075 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10076 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10077 | |
| 10078 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10079 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10080 | |
| 10081 | { } /* end */ |
| 10082 | }; |
| 10083 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10084 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 10085 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 10086 | */ |
| 10087 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 10088 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10089 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10090 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10091 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 10092 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10093 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10094 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10095 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10096 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10097 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10098 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10099 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10100 | { |
| 10101 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10102 | /* .name = "Capture Source", */ |
| 10103 | .name = "Input Source", |
| 10104 | .count = 1, |
| 10105 | .info = alc882_mux_enum_info, |
| 10106 | .get = alc882_mux_enum_get, |
| 10107 | .put = alc882_mux_enum_put, |
| 10108 | }, |
| 10109 | { } /* end */ |
| 10110 | }; |
| 10111 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10112 | /* |
| 10113 | * generic initialization of ADC, input mixers and output mixers |
| 10114 | */ |
| 10115 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 10116 | /* |
| 10117 | * Unmute ADC0 and set the default input to mic-in |
| 10118 | */ |
| 10119 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10120 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10121 | |
| 10122 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 10123 | * the analog-loopback mixer widget |
| 10124 | */ |
| 10125 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10126 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10127 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 10130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10131 | |
| 10132 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10133 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10134 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10135 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10136 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10137 | |
| 10138 | /* |
| 10139 | * Set up output mixers (0x02 - 0x05) |
| 10140 | */ |
| 10141 | /* set vol=0 to output mixers */ |
| 10142 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10143 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10144 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10145 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10146 | |
| 10147 | /* set up input amps for analog loopback */ |
| 10148 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10151 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10152 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10153 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10154 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10155 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10156 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10157 | |
| 10158 | { } |
| 10159 | }; |
| 10160 | |
| 10161 | /* |
| 10162 | * 3-stack pin configuration: |
| 10163 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 10164 | */ |
| 10165 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 10166 | /* |
| 10167 | * Set pin mode and muting |
| 10168 | */ |
| 10169 | /* set front pin widgets 0x14 for output */ |
| 10170 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10171 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10172 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10173 | |
| 10174 | /* Mic (rear) pin: input vref at 80% */ |
| 10175 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10176 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10177 | /* Front Mic pin: input vref at 80% */ |
| 10178 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10179 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10180 | /* Line In pin: input */ |
| 10181 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10182 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10183 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10184 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10185 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10186 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10187 | /* CD pin widget for input */ |
| 10188 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10189 | |
| 10190 | { } |
| 10191 | }; |
| 10192 | |
| 10193 | /* |
| 10194 | * 6-stack pin configuration: |
| 10195 | */ |
| 10196 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 10197 | /* |
| 10198 | * Set pin mode and muting |
| 10199 | */ |
| 10200 | /* set front pin widgets 0x14 for output */ |
| 10201 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10202 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10203 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10204 | |
| 10205 | /* Rear Pin: output 1 (0x0d) */ |
| 10206 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10207 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10208 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10209 | /* CLFE Pin: output 2 (0x0e) */ |
| 10210 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10211 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10212 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 10213 | /* Side Pin: output 3 (0x0f) */ |
| 10214 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10215 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10216 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 10217 | |
| 10218 | /* Mic (rear) pin: input vref at 80% */ |
| 10219 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10220 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10221 | /* Front Mic pin: input vref at 80% */ |
| 10222 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10223 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10224 | /* Line In pin: input */ |
| 10225 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10226 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10227 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10228 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10229 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10230 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10231 | /* CD pin widget for input */ |
| 10232 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10233 | |
| 10234 | { } |
| 10235 | }; |
| 10236 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10237 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 10238 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10239 | { } |
| 10240 | }; |
| 10241 | |
| 10242 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 10243 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10244 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10246 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10247 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10248 | {} |
| 10249 | }; |
| 10250 | |
| 10251 | /* toggle speaker-output according to the hp-jack state */ |
| 10252 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 10253 | { |
| 10254 | unsigned int present; |
| 10255 | unsigned char bits; |
| 10256 | |
| 10257 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 10258 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10259 | bits = present ? 0x80 : 0; |
| 10260 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10261 | 0x80, bits); |
| 10262 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10263 | 0x80, bits); |
| 10264 | } |
| 10265 | |
| 10266 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 10267 | { |
| 10268 | unsigned int present; |
| 10269 | unsigned char bits; |
| 10270 | |
| 10271 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10272 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10273 | bits = present ? 0x80 : 0; |
| 10274 | snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, |
| 10275 | 0x80, bits); |
| 10276 | snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1, |
| 10277 | 0x80, bits); |
| 10278 | } |
| 10279 | |
| 10280 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 10281 | { |
| 10282 | alc861vd_lenovo_hp_automute(codec); |
| 10283 | alc861vd_lenovo_mic_automute(codec); |
| 10284 | } |
| 10285 | |
| 10286 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 10287 | unsigned int res) |
| 10288 | { |
| 10289 | switch (res >> 26) { |
| 10290 | case ALC880_HP_EVENT: |
| 10291 | alc861vd_lenovo_hp_automute(codec); |
| 10292 | break; |
| 10293 | case ALC880_MIC_EVENT: |
| 10294 | alc861vd_lenovo_mic_automute(codec); |
| 10295 | break; |
| 10296 | } |
| 10297 | } |
| 10298 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10299 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 10300 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10301 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10302 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10303 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10304 | |
| 10305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10307 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10308 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10309 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10311 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10312 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10313 | |
| 10314 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10315 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10316 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10317 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10318 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10319 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10320 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10321 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10322 | |
| 10323 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10324 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10325 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10326 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10327 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10328 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10329 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10330 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10331 | |
| 10332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10335 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10336 | |
| 10337 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10338 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10339 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10340 | |
| 10341 | { } /* end */ |
| 10342 | }; |
| 10343 | |
| 10344 | /* toggle speaker-output according to the hp-jack state */ |
| 10345 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 10346 | { |
| 10347 | unsigned int present; |
| 10348 | |
| 10349 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10350 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10351 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10352 | 0x80, present ? 0x80 : 0); |
| 10353 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10354 | 0x80, present ? 0x80 : 0); |
| 10355 | } |
| 10356 | |
| 10357 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10358 | { |
| 10359 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10360 | alc861vd_dallas_automute(codec); |
| 10361 | } |
| 10362 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10363 | /* pcm configuration: identiacal with ALC880 */ |
| 10364 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 10365 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 10366 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 10367 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 10368 | |
| 10369 | /* |
| 10370 | * configuration and preset |
| 10371 | */ |
| 10372 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 10373 | [ALC660VD_3ST] = "3stack-660", |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10374 | [ALC660VD_3ST_DIG]= "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10375 | [ALC861VD_3ST] = "3stack", |
| 10376 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 10377 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10378 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10379 | [ALC861VD_DALLAS] = "dallas", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10380 | [ALC861VD_AUTO] = "auto", |
| 10381 | }; |
| 10382 | |
| 10383 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 10384 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10385 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10386 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10387 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10388 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10389 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10390 | SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS), |
| 10391 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10392 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
| 10393 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
Takashi Iwai | a18519e | 2007-06-14 12:58:23 +0200 | [diff] [blame] | 10394 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 10395 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10396 | {} |
| 10397 | }; |
| 10398 | |
| 10399 | static struct alc_config_preset alc861vd_presets[] = { |
| 10400 | [ALC660VD_3ST] = { |
| 10401 | .mixers = { alc861vd_3st_mixer }, |
| 10402 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10403 | alc861vd_3stack_init_verbs }, |
| 10404 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10405 | .dac_nids = alc660vd_dac_nids, |
| 10406 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10407 | .adc_nids = alc861vd_adc_nids, |
| 10408 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10409 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10410 | .input_mux = &alc861vd_capture_source, |
| 10411 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10412 | [ALC660VD_3ST_DIG] = { |
| 10413 | .mixers = { alc861vd_3st_mixer }, |
| 10414 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10415 | alc861vd_3stack_init_verbs }, |
| 10416 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10417 | .dac_nids = alc660vd_dac_nids, |
| 10418 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10419 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10420 | .adc_nids = alc861vd_adc_nids, |
| 10421 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10422 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10423 | .input_mux = &alc861vd_capture_source, |
| 10424 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10425 | [ALC861VD_3ST] = { |
| 10426 | .mixers = { alc861vd_3st_mixer }, |
| 10427 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10428 | alc861vd_3stack_init_verbs }, |
| 10429 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10430 | .dac_nids = alc861vd_dac_nids, |
| 10431 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10432 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10433 | .input_mux = &alc861vd_capture_source, |
| 10434 | }, |
| 10435 | [ALC861VD_3ST_DIG] = { |
| 10436 | .mixers = { alc861vd_3st_mixer }, |
| 10437 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10438 | alc861vd_3stack_init_verbs }, |
| 10439 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10440 | .dac_nids = alc861vd_dac_nids, |
| 10441 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10442 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10443 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10444 | .input_mux = &alc861vd_capture_source, |
| 10445 | }, |
| 10446 | [ALC861VD_6ST_DIG] = { |
| 10447 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 10448 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10449 | alc861vd_6stack_init_verbs }, |
| 10450 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10451 | .dac_nids = alc861vd_dac_nids, |
| 10452 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10453 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 10454 | .channel_mode = alc861vd_6stack_modes, |
| 10455 | .input_mux = &alc861vd_capture_source, |
| 10456 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10457 | [ALC861VD_LENOVO] = { |
| 10458 | .mixers = { alc861vd_lenovo_mixer }, |
| 10459 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10460 | alc861vd_3stack_init_verbs, |
| 10461 | alc861vd_eapd_verbs, |
| 10462 | alc861vd_lenovo_unsol_verbs }, |
| 10463 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10464 | .dac_nids = alc660vd_dac_nids, |
| 10465 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10466 | .adc_nids = alc861vd_adc_nids, |
| 10467 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10468 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10469 | .input_mux = &alc861vd_capture_source, |
| 10470 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 10471 | .init_hook = alc861vd_lenovo_automute, |
| 10472 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10473 | [ALC861VD_DALLAS] = { |
| 10474 | .mixers = { alc861vd_dallas_mixer }, |
| 10475 | .init_verbs = { alc861vd_dallas_verbs }, |
| 10476 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10477 | .dac_nids = alc861vd_dac_nids, |
| 10478 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10479 | .adc_nids = alc861vd_adc_nids, |
| 10480 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10481 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10482 | .input_mux = &alc861vd_dallas_capture_source, |
| 10483 | .unsol_event = alc861vd_dallas_unsol_event, |
| 10484 | .init_hook = alc861vd_dallas_automute, |
| 10485 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10486 | }; |
| 10487 | |
| 10488 | /* |
| 10489 | * BIOS auto configuration |
| 10490 | */ |
| 10491 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 10492 | hda_nid_t nid, int pin_type, int dac_idx) |
| 10493 | { |
| 10494 | /* set as output */ |
| 10495 | snd_hda_codec_write(codec, nid, 0, |
| 10496 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 10497 | snd_hda_codec_write(codec, nid, 0, |
| 10498 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 10499 | } |
| 10500 | |
| 10501 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 10502 | { |
| 10503 | struct alc_spec *spec = codec->spec; |
| 10504 | int i; |
| 10505 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10506 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10507 | for (i = 0; i <= HDA_SIDE; i++) { |
| 10508 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10509 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10510 | if (nid) |
| 10511 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10512 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10513 | } |
| 10514 | } |
| 10515 | |
| 10516 | |
| 10517 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 10518 | { |
| 10519 | struct alc_spec *spec = codec->spec; |
| 10520 | hda_nid_t pin; |
| 10521 | |
| 10522 | pin = spec->autocfg.hp_pins[0]; |
| 10523 | if (pin) /* connect to front and use dac 0 */ |
| 10524 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 10525 | } |
| 10526 | |
| 10527 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 10528 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 10529 | |
| 10530 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 10531 | { |
| 10532 | struct alc_spec *spec = codec->spec; |
| 10533 | int i; |
| 10534 | |
| 10535 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10536 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 10537 | if (alc861vd_is_input_pin(nid)) { |
| 10538 | snd_hda_codec_write(codec, nid, 0, |
| 10539 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10540 | i <= AUTO_PIN_FRONT_MIC ? |
| 10541 | PIN_VREF80 : PIN_IN); |
| 10542 | if (nid != ALC861VD_PIN_CD_NID) |
| 10543 | snd_hda_codec_write(codec, nid, 0, |
| 10544 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10545 | AMP_OUT_MUTE); |
| 10546 | } |
| 10547 | } |
| 10548 | } |
| 10549 | |
| 10550 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 10551 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 10552 | |
| 10553 | /* add playback controls from the parsed DAC table */ |
| 10554 | /* Based on ALC880 version. But ALC861VD has separate, |
| 10555 | * different NIDs for mute/unmute switch and volume control */ |
| 10556 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10557 | const struct auto_pin_cfg *cfg) |
| 10558 | { |
| 10559 | char name[32]; |
| 10560 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 10561 | hda_nid_t nid_v, nid_s; |
| 10562 | int i, err; |
| 10563 | |
| 10564 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10565 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10566 | continue; |
| 10567 | nid_v = alc861vd_idx_to_mixer_vol( |
| 10568 | alc880_dac_to_idx( |
| 10569 | spec->multiout.dac_nids[i])); |
| 10570 | nid_s = alc861vd_idx_to_mixer_switch( |
| 10571 | alc880_dac_to_idx( |
| 10572 | spec->multiout.dac_nids[i])); |
| 10573 | |
| 10574 | if (i == 2) { |
| 10575 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10576 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10577 | "Center Playback Volume", |
| 10578 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 10579 | HDA_OUTPUT)); |
| 10580 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10581 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10582 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10583 | "LFE Playback Volume", |
| 10584 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 10585 | HDA_OUTPUT)); |
| 10586 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10587 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10588 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10589 | "Center Playback Switch", |
| 10590 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 10591 | HDA_INPUT)); |
| 10592 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10593 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10594 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10595 | "LFE Playback Switch", |
| 10596 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 10597 | HDA_INPUT)); |
| 10598 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10599 | return err; |
| 10600 | } else { |
| 10601 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10602 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10603 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 10604 | HDA_OUTPUT)); |
| 10605 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10606 | return err; |
| 10607 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10608 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10609 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10610 | HDA_INPUT)); |
| 10611 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10612 | return err; |
| 10613 | } |
| 10614 | } |
| 10615 | return 0; |
| 10616 | } |
| 10617 | |
| 10618 | /* add playback controls for speaker and HP outputs */ |
| 10619 | /* Based on ALC880 version. But ALC861VD has separate, |
| 10620 | * different NIDs for mute/unmute switch and volume control */ |
| 10621 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 10622 | hda_nid_t pin, const char *pfx) |
| 10623 | { |
| 10624 | hda_nid_t nid_v, nid_s; |
| 10625 | int err; |
| 10626 | char name[32]; |
| 10627 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10628 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10629 | return 0; |
| 10630 | |
| 10631 | if (alc880_is_fixed_pin(pin)) { |
| 10632 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 10633 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10634 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10635 | spec->multiout.hp_nid = nid_v; |
| 10636 | else |
| 10637 | spec->multiout.extra_out_nid[0] = nid_v; |
| 10638 | /* control HP volume/switch on the output mixer amp */ |
| 10639 | nid_v = alc861vd_idx_to_mixer_vol( |
| 10640 | alc880_fixed_pin_idx(pin)); |
| 10641 | nid_s = alc861vd_idx_to_mixer_switch( |
| 10642 | alc880_fixed_pin_idx(pin)); |
| 10643 | |
| 10644 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10645 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10646 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 10647 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10648 | return err; |
| 10649 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10650 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 10651 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 10652 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10653 | return err; |
| 10654 | } else if (alc880_is_multi_pin(pin)) { |
| 10655 | /* set manual connection */ |
| 10656 | /* we have only a switch on HP-out PIN */ |
| 10657 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10658 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10659 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 10660 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10661 | return err; |
| 10662 | } |
| 10663 | return 0; |
| 10664 | } |
| 10665 | |
| 10666 | /* parse the BIOS configuration and set up the alc_spec |
| 10667 | * return 1 if successful, 0 if the proper config is not found, |
| 10668 | * or a negative error code |
| 10669 | * Based on ALC880 version - had to change it to override |
| 10670 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 10671 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 10672 | { |
| 10673 | struct alc_spec *spec = codec->spec; |
| 10674 | int err; |
| 10675 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 10676 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10677 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10678 | alc861vd_ignore); |
| 10679 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10680 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10681 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10682 | return 0; /* can't find valid BIOS pin config */ |
| 10683 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10684 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10685 | if (err < 0) |
| 10686 | return err; |
| 10687 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10688 | if (err < 0) |
| 10689 | return err; |
| 10690 | err = alc861vd_auto_create_extra_out(spec, |
| 10691 | spec->autocfg.speaker_pins[0], |
| 10692 | "Speaker"); |
| 10693 | if (err < 0) |
| 10694 | return err; |
| 10695 | err = alc861vd_auto_create_extra_out(spec, |
| 10696 | spec->autocfg.hp_pins[0], |
| 10697 | "Headphone"); |
| 10698 | if (err < 0) |
| 10699 | return err; |
| 10700 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10701 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10702 | return err; |
| 10703 | |
| 10704 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10705 | |
| 10706 | if (spec->autocfg.dig_out_pin) |
| 10707 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 10708 | |
| 10709 | if (spec->kctl_alloc) |
| 10710 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10711 | |
| 10712 | spec->init_verbs[spec->num_init_verbs++] |
| 10713 | = alc861vd_volume_init_verbs; |
| 10714 | |
| 10715 | spec->num_mux_defs = 1; |
| 10716 | spec->input_mux = &spec->private_imux; |
| 10717 | |
| 10718 | return 1; |
| 10719 | } |
| 10720 | |
| 10721 | /* additional initialization for auto-configuration model */ |
| 10722 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 10723 | { |
| 10724 | alc861vd_auto_init_multi_out(codec); |
| 10725 | alc861vd_auto_init_hp_out(codec); |
| 10726 | alc861vd_auto_init_analog_input(codec); |
| 10727 | } |
| 10728 | |
| 10729 | static int patch_alc861vd(struct hda_codec *codec) |
| 10730 | { |
| 10731 | struct alc_spec *spec; |
| 10732 | int err, board_config; |
| 10733 | |
| 10734 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10735 | if (spec == NULL) |
| 10736 | return -ENOMEM; |
| 10737 | |
| 10738 | codec->spec = spec; |
| 10739 | |
| 10740 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 10741 | alc861vd_models, |
| 10742 | alc861vd_cfg_tbl); |
| 10743 | |
| 10744 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 10745 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 10746 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 10747 | board_config = ALC861VD_AUTO; |
| 10748 | } |
| 10749 | |
| 10750 | if (board_config == ALC861VD_AUTO) { |
| 10751 | /* automatic parse from the BIOS config */ |
| 10752 | err = alc861vd_parse_auto_config(codec); |
| 10753 | if (err < 0) { |
| 10754 | alc_free(codec); |
| 10755 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10756 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10757 | printk(KERN_INFO |
| 10758 | "hda_codec: Cannot set up configuration " |
| 10759 | "from BIOS. Using base mode...\n"); |
| 10760 | board_config = ALC861VD_3ST; |
| 10761 | } |
| 10762 | } |
| 10763 | |
| 10764 | if (board_config != ALC861VD_AUTO) |
| 10765 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 10766 | |
| 10767 | spec->stream_name_analog = "ALC861VD Analog"; |
| 10768 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 10769 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 10770 | |
| 10771 | spec->stream_name_digital = "ALC861VD Digital"; |
| 10772 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 10773 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 10774 | |
| 10775 | spec->adc_nids = alc861vd_adc_nids; |
| 10776 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 10777 | |
| 10778 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 10779 | spec->num_mixers++; |
| 10780 | |
| 10781 | codec->patch_ops = alc_patch_ops; |
| 10782 | |
| 10783 | if (board_config == ALC861VD_AUTO) |
| 10784 | spec->init_hook = alc861vd_auto_init; |
| 10785 | |
| 10786 | return 0; |
| 10787 | } |
| 10788 | |
| 10789 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10790 | * ALC662 support |
| 10791 | * |
| 10792 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 10793 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 10794 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 10795 | * 6-channel independent captures. |
| 10796 | * |
| 10797 | * In addition, an independent DAC for the multi-playback (not used in this |
| 10798 | * driver yet). |
| 10799 | */ |
| 10800 | #define ALC662_DIGOUT_NID 0x06 |
| 10801 | #define ALC662_DIGIN_NID 0x0a |
| 10802 | |
| 10803 | static hda_nid_t alc662_dac_nids[4] = { |
| 10804 | /* front, rear, clfe, rear_surr */ |
| 10805 | 0x02, 0x03, 0x04 |
| 10806 | }; |
| 10807 | |
| 10808 | static hda_nid_t alc662_adc_nids[1] = { |
| 10809 | /* ADC1-2 */ |
| 10810 | 0x09, |
| 10811 | }; |
| 10812 | /* input MUX */ |
| 10813 | /* FIXME: should be a matrix-type input source selection */ |
| 10814 | |
| 10815 | static struct hda_input_mux alc662_capture_source = { |
| 10816 | .num_items = 4, |
| 10817 | .items = { |
| 10818 | { "Mic", 0x0 }, |
| 10819 | { "Front Mic", 0x1 }, |
| 10820 | { "Line", 0x2 }, |
| 10821 | { "CD", 0x4 }, |
| 10822 | }, |
| 10823 | }; |
| 10824 | |
| 10825 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 10826 | .num_items = 2, |
| 10827 | .items = { |
| 10828 | { "Mic", 0x1 }, |
| 10829 | { "Line", 0x2 }, |
| 10830 | }, |
| 10831 | }; |
| 10832 | #define alc662_mux_enum_info alc_mux_enum_info |
| 10833 | #define alc662_mux_enum_get alc_mux_enum_get |
| 10834 | |
| 10835 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10836 | struct snd_ctl_elem_value *ucontrol) |
| 10837 | { |
| 10838 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10839 | struct alc_spec *spec = codec->spec; |
| 10840 | const struct hda_input_mux *imux = spec->input_mux; |
| 10841 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 10842 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 10843 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 10844 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 10845 | unsigned int i, idx; |
| 10846 | |
| 10847 | idx = ucontrol->value.enumerated.item[0]; |
| 10848 | if (idx >= imux->num_items) |
| 10849 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10850 | if (*cur_val == idx && !codec->in_resume) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10851 | return 0; |
| 10852 | for (i = 0; i < imux->num_items; i++) { |
| 10853 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 10854 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 10855 | v | (imux->items[i].index << 8)); |
| 10856 | } |
| 10857 | *cur_val = idx; |
| 10858 | return 1; |
| 10859 | } |
| 10860 | /* |
| 10861 | * 2ch mode |
| 10862 | */ |
| 10863 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 10864 | { 2, NULL } |
| 10865 | }; |
| 10866 | |
| 10867 | /* |
| 10868 | * 2ch mode |
| 10869 | */ |
| 10870 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 10871 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 10872 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 10873 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 10874 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 10875 | { } /* end */ |
| 10876 | }; |
| 10877 | |
| 10878 | /* |
| 10879 | * 6ch mode |
| 10880 | */ |
| 10881 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 10882 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10883 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10884 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 10885 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10886 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10887 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 10888 | { } /* end */ |
| 10889 | }; |
| 10890 | |
| 10891 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 10892 | { 2, alc662_3ST_ch2_init }, |
| 10893 | { 6, alc662_3ST_ch6_init }, |
| 10894 | }; |
| 10895 | |
| 10896 | /* |
| 10897 | * 2ch mode |
| 10898 | */ |
| 10899 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 10900 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10901 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10902 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10903 | { } /* end */ |
| 10904 | }; |
| 10905 | |
| 10906 | /* |
| 10907 | * 6ch mode |
| 10908 | */ |
| 10909 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 10910 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10911 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10912 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10913 | { } /* end */ |
| 10914 | }; |
| 10915 | |
| 10916 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 10917 | { 2, alc662_sixstack_ch6_init }, |
| 10918 | { 6, alc662_sixstack_ch8_init }, |
| 10919 | }; |
| 10920 | |
| 10921 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 10922 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 10923 | */ |
| 10924 | |
| 10925 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 10926 | /* output mixer control */ |
| 10927 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10928 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 10929 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10930 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10931 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 10932 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 10933 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 10934 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 10935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10936 | |
| 10937 | /*Input mixer control */ |
| 10938 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 10939 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 10940 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 10941 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 10942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 10943 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 10944 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 10945 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
| 10946 | |
| 10947 | /* Capture mixer control */ |
| 10948 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10949 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10950 | { |
| 10951 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10952 | .name = "Capture Source", |
| 10953 | .count = 1, |
| 10954 | .info = alc_mux_enum_info, |
| 10955 | .get = alc_mux_enum_get, |
| 10956 | .put = alc_mux_enum_put, |
| 10957 | }, |
| 10958 | { } /* end */ |
| 10959 | }; |
| 10960 | |
| 10961 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 10962 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10963 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10964 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10965 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10966 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10968 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10971 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10972 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10973 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10974 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10975 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10976 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10977 | { |
| 10978 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10979 | /* .name = "Capture Source", */ |
| 10980 | .name = "Input Source", |
| 10981 | .count = 1, |
| 10982 | .info = alc662_mux_enum_info, |
| 10983 | .get = alc662_mux_enum_get, |
| 10984 | .put = alc662_mux_enum_put, |
| 10985 | }, |
| 10986 | { } /* end */ |
| 10987 | }; |
| 10988 | |
| 10989 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 10990 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10991 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10992 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10993 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 10994 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 10995 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 10996 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 10997 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 10998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10999 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11000 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11001 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11002 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11005 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11006 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11007 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11008 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11009 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11010 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11011 | { |
| 11012 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11013 | /* .name = "Capture Source", */ |
| 11014 | .name = "Input Source", |
| 11015 | .count = 1, |
| 11016 | .info = alc662_mux_enum_info, |
| 11017 | .get = alc662_mux_enum_get, |
| 11018 | .put = alc662_mux_enum_put, |
| 11019 | }, |
| 11020 | { } /* end */ |
| 11021 | }; |
| 11022 | |
| 11023 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 11024 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11025 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 11026 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11027 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT), |
| 11028 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11029 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11030 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11031 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11032 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11033 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11034 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11035 | { |
| 11036 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11037 | /* .name = "Capture Source", */ |
| 11038 | .name = "Input Source", |
| 11039 | .count = 1, |
| 11040 | .info = alc662_mux_enum_info, |
| 11041 | .get = alc662_mux_enum_get, |
| 11042 | .put = alc662_mux_enum_put, |
| 11043 | }, |
| 11044 | { } /* end */ |
| 11045 | }; |
| 11046 | |
| 11047 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 11048 | { |
| 11049 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11050 | .name = "Channel Mode", |
| 11051 | .info = alc_ch_mode_info, |
| 11052 | .get = alc_ch_mode_get, |
| 11053 | .put = alc_ch_mode_put, |
| 11054 | }, |
| 11055 | { } /* end */ |
| 11056 | }; |
| 11057 | |
| 11058 | static struct hda_verb alc662_init_verbs[] = { |
| 11059 | /* ADC: mute amp left and right */ |
| 11060 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11061 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11062 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 11063 | |
| 11064 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11065 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11066 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11067 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 11068 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11069 | |
| 11070 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11071 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11072 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11073 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11074 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11075 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11076 | |
| 11077 | /* Front Pin: output 0 (0x0c) */ |
| 11078 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11079 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11080 | |
| 11081 | /* Rear Pin: output 1 (0x0d) */ |
| 11082 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11083 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11084 | |
| 11085 | /* CLFE Pin: output 2 (0x0e) */ |
| 11086 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11087 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11088 | |
| 11089 | /* Mic (rear) pin: input vref at 80% */ |
| 11090 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11091 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11092 | /* Front Mic pin: input vref at 80% */ |
| 11093 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11094 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11095 | /* Line In pin: input */ |
| 11096 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11097 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11098 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11099 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11100 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11101 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11102 | /* CD pin widget for input */ |
| 11103 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11104 | |
| 11105 | /* FIXME: use matrix-type input source selection */ |
| 11106 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11107 | /* Input mixer */ |
| 11108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11112 | { } |
| 11113 | }; |
| 11114 | |
| 11115 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 11116 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 11117 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 11118 | {} |
| 11119 | }; |
| 11120 | |
| 11121 | /* |
| 11122 | * generic initialization of ADC, input mixers and output mixers |
| 11123 | */ |
| 11124 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 11125 | /* |
| 11126 | * Unmute ADC and set the default input to mic-in |
| 11127 | */ |
| 11128 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11129 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11130 | |
| 11131 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 11132 | * mixer widget |
| 11133 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11134 | * panel mic (mic 2) |
| 11135 | */ |
| 11136 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11137 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11139 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11140 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 11141 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11142 | |
| 11143 | /* |
| 11144 | * Set up output mixers (0x0c - 0x0f) |
| 11145 | */ |
| 11146 | /* set vol=0 to output mixers */ |
| 11147 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11148 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11149 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11150 | |
| 11151 | /* set up input amps for analog loopback */ |
| 11152 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11153 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11154 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11155 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11156 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11157 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11158 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11159 | |
| 11160 | |
| 11161 | /* FIXME: use matrix-type input source selection */ |
| 11162 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11163 | /* Input mixer */ |
| 11164 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11165 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11166 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11167 | /*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/ |
| 11168 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11169 | |
| 11170 | { } |
| 11171 | }; |
| 11172 | |
| 11173 | /* capture mixer elements */ |
| 11174 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 11175 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11176 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11177 | { |
| 11178 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11179 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11180 | * So call somewhat different.. |
| 11181 | * FIXME: the controls appear in the "playback" view! |
| 11182 | */ |
| 11183 | /* .name = "Capture Source", */ |
| 11184 | .name = "Input Source", |
| 11185 | .count = 1, |
| 11186 | .info = alc882_mux_enum_info, |
| 11187 | .get = alc882_mux_enum_get, |
| 11188 | .put = alc882_mux_enum_put, |
| 11189 | }, |
| 11190 | { } /* end */ |
| 11191 | }; |
| 11192 | |
| 11193 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 11194 | { |
| 11195 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11196 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11197 | |
| 11198 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11199 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11200 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11201 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11202 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11203 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11204 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11205 | } |
| 11206 | |
| 11207 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 11208 | { |
| 11209 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11210 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11211 | |
| 11212 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 11213 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11214 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11215 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11216 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11217 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11218 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11219 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11220 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11221 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11222 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11223 | } |
| 11224 | |
| 11225 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 11226 | unsigned int res) |
| 11227 | { |
| 11228 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11229 | alc662_lenovo_101e_all_automute(codec); |
| 11230 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 11231 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 11232 | } |
| 11233 | |
| 11234 | |
| 11235 | /* pcm configuration: identiacal with ALC880 */ |
| 11236 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 11237 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 11238 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 11239 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 11240 | |
| 11241 | /* |
| 11242 | * configuration and preset |
| 11243 | */ |
| 11244 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 11245 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 11246 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 11247 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 11248 | [ALC662_5ST_DIG] = "6stack-dig", |
| 11249 | [ALC662_LENOVO_101E] = "lenovo-101e", |
| 11250 | [ALC662_AUTO] = "auto", |
| 11251 | }; |
| 11252 | |
| 11253 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
| 11254 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
| 11255 | {} |
| 11256 | }; |
| 11257 | |
| 11258 | static struct alc_config_preset alc662_presets[] = { |
| 11259 | [ALC662_3ST_2ch_DIG] = { |
| 11260 | .mixers = { alc662_3ST_2ch_mixer }, |
| 11261 | .init_verbs = { alc662_init_verbs }, |
| 11262 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11263 | .dac_nids = alc662_dac_nids, |
| 11264 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11265 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11266 | .adc_nids = alc662_adc_nids, |
| 11267 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11268 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 11269 | .channel_mode = alc662_3ST_2ch_modes, |
| 11270 | .input_mux = &alc662_capture_source, |
| 11271 | }, |
| 11272 | [ALC662_3ST_6ch_DIG] = { |
| 11273 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 11274 | .init_verbs = { alc662_init_verbs }, |
| 11275 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11276 | .dac_nids = alc662_dac_nids, |
| 11277 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11278 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11279 | .adc_nids = alc662_adc_nids, |
| 11280 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11281 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 11282 | .channel_mode = alc662_3ST_6ch_modes, |
| 11283 | .need_dac_fix = 1, |
| 11284 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11285 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11286 | [ALC662_3ST_6ch] = { |
| 11287 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 11288 | .init_verbs = { alc662_init_verbs }, |
| 11289 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11290 | .dac_nids = alc662_dac_nids, |
| 11291 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11292 | .adc_nids = alc662_adc_nids, |
| 11293 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 11294 | .channel_mode = alc662_3ST_6ch_modes, |
| 11295 | .need_dac_fix = 1, |
| 11296 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11297 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11298 | [ALC662_5ST_DIG] = { |
| 11299 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
| 11300 | .init_verbs = { alc662_init_verbs }, |
| 11301 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11302 | .dac_nids = alc662_dac_nids, |
| 11303 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11304 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11305 | .adc_nids = alc662_adc_nids, |
| 11306 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11307 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 11308 | .channel_mode = alc662_5stack_modes, |
| 11309 | .input_mux = &alc662_capture_source, |
| 11310 | }, |
| 11311 | [ALC662_LENOVO_101E] = { |
| 11312 | .mixers = { alc662_lenovo_101e_mixer }, |
| 11313 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 11314 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11315 | .dac_nids = alc662_dac_nids, |
| 11316 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11317 | .adc_nids = alc662_adc_nids, |
| 11318 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 11319 | .channel_mode = alc662_3ST_2ch_modes, |
| 11320 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 11321 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 11322 | .init_hook = alc662_lenovo_101e_all_automute, |
| 11323 | }, |
| 11324 | |
| 11325 | }; |
| 11326 | |
| 11327 | |
| 11328 | /* |
| 11329 | * BIOS auto configuration |
| 11330 | */ |
| 11331 | |
| 11332 | /* add playback controls from the parsed DAC table */ |
| 11333 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11334 | const struct auto_pin_cfg *cfg) |
| 11335 | { |
| 11336 | char name[32]; |
| 11337 | static const char *chname[4] = { |
| 11338 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11339 | }; |
| 11340 | hda_nid_t nid; |
| 11341 | int i, err; |
| 11342 | |
| 11343 | for (i = 0; i < cfg->line_outs; i++) { |
| 11344 | if (!spec->multiout.dac_nids[i]) |
| 11345 | continue; |
Kailang Yang | 067b5a8 | 2007-07-05 12:35:15 +0200 | [diff] [blame] | 11346 | nid = alc880_idx_to_mixer(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11347 | if (i == 2) { |
| 11348 | /* Center/LFE */ |
| 11349 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11350 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11351 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11352 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11353 | if (err < 0) |
| 11354 | return err; |
| 11355 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11356 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11357 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11358 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11359 | if (err < 0) |
| 11360 | return err; |
| 11361 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11362 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11363 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 11364 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11365 | if (err < 0) |
| 11366 | return err; |
| 11367 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11368 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11369 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 11370 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11371 | if (err < 0) |
| 11372 | return err; |
| 11373 | } else { |
| 11374 | sprintf(name, "%s Playback Volume", chname[i]); |
| 11375 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11376 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11377 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11378 | if (err < 0) |
| 11379 | return err; |
| 11380 | sprintf(name, "%s Playback Switch", chname[i]); |
| 11381 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11382 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 11383 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11384 | if (err < 0) |
| 11385 | return err; |
| 11386 | } |
| 11387 | } |
| 11388 | return 0; |
| 11389 | } |
| 11390 | |
| 11391 | /* add playback controls for speaker and HP outputs */ |
| 11392 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 11393 | const char *pfx) |
| 11394 | { |
| 11395 | hda_nid_t nid; |
| 11396 | int err; |
| 11397 | char name[32]; |
| 11398 | |
| 11399 | if (!pin) |
| 11400 | return 0; |
| 11401 | |
| 11402 | if (alc880_is_fixed_pin(pin)) { |
| 11403 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11404 | /* printk("DAC nid=%x\n",nid); */ |
| 11405 | /* specify the DAC as the extra output */ |
| 11406 | if (!spec->multiout.hp_nid) |
| 11407 | spec->multiout.hp_nid = nid; |
| 11408 | else |
| 11409 | spec->multiout.extra_out_nid[0] = nid; |
| 11410 | /* control HP volume/switch on the output mixer amp */ |
| 11411 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11412 | sprintf(name, "%s Playback Volume", pfx); |
| 11413 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11414 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11415 | if (err < 0) |
| 11416 | return err; |
| 11417 | sprintf(name, "%s Playback Switch", pfx); |
| 11418 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11419 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 11420 | if (err < 0) |
| 11421 | return err; |
| 11422 | } else if (alc880_is_multi_pin(pin)) { |
| 11423 | /* set manual connection */ |
| 11424 | /* we have only a switch on HP-out PIN */ |
| 11425 | sprintf(name, "%s Playback Switch", pfx); |
| 11426 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11427 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 11428 | if (err < 0) |
| 11429 | return err; |
| 11430 | } |
| 11431 | return 0; |
| 11432 | } |
| 11433 | |
| 11434 | /* create playback/capture controls for input pins */ |
| 11435 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11436 | const struct auto_pin_cfg *cfg) |
| 11437 | { |
| 11438 | struct hda_input_mux *imux = &spec->private_imux; |
| 11439 | int i, err, idx; |
| 11440 | |
| 11441 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11442 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 11443 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 11444 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11445 | auto_pin_cfg_labels[i], |
| 11446 | idx, 0x0b); |
| 11447 | if (err < 0) |
| 11448 | return err; |
| 11449 | imux->items[imux->num_items].label = |
| 11450 | auto_pin_cfg_labels[i]; |
| 11451 | imux->items[imux->num_items].index = |
| 11452 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 11453 | imux->num_items++; |
| 11454 | } |
| 11455 | } |
| 11456 | return 0; |
| 11457 | } |
| 11458 | |
| 11459 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11460 | hda_nid_t nid, int pin_type, |
| 11461 | int dac_idx) |
| 11462 | { |
| 11463 | /* set as output */ |
| 11464 | snd_hda_codec_write(codec, nid, 0, |
| 11465 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 11466 | snd_hda_codec_write(codec, nid, 0, |
| 11467 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 11468 | /* need the manual connection? */ |
| 11469 | if (alc880_is_multi_pin(nid)) { |
| 11470 | struct alc_spec *spec = codec->spec; |
| 11471 | int idx = alc880_multi_pin_idx(nid); |
| 11472 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 11473 | AC_VERB_SET_CONNECT_SEL, |
| 11474 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 11475 | } |
| 11476 | } |
| 11477 | |
| 11478 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 11479 | { |
| 11480 | struct alc_spec *spec = codec->spec; |
| 11481 | int i; |
| 11482 | |
| 11483 | for (i = 0; i <= HDA_SIDE; i++) { |
| 11484 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11485 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11486 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11487 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11488 | i); |
| 11489 | } |
| 11490 | } |
| 11491 | |
| 11492 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 11493 | { |
| 11494 | struct alc_spec *spec = codec->spec; |
| 11495 | hda_nid_t pin; |
| 11496 | |
| 11497 | pin = spec->autocfg.hp_pins[0]; |
| 11498 | if (pin) /* connect to front */ |
| 11499 | /* use dac 0 */ |
| 11500 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 11501 | } |
| 11502 | |
| 11503 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 11504 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 11505 | |
| 11506 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 11507 | { |
| 11508 | struct alc_spec *spec = codec->spec; |
| 11509 | int i; |
| 11510 | |
| 11511 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11512 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 11513 | if (alc662_is_input_pin(nid)) { |
| 11514 | snd_hda_codec_write(codec, nid, 0, |
| 11515 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11516 | (i <= AUTO_PIN_FRONT_MIC ? |
| 11517 | PIN_VREF80 : PIN_IN)); |
| 11518 | if (nid != ALC662_PIN_CD_NID) |
| 11519 | snd_hda_codec_write(codec, nid, 0, |
| 11520 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11521 | AMP_OUT_MUTE); |
| 11522 | } |
| 11523 | } |
| 11524 | } |
| 11525 | |
| 11526 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 11527 | { |
| 11528 | struct alc_spec *spec = codec->spec; |
| 11529 | int err; |
| 11530 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 11531 | |
| 11532 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11533 | alc662_ignore); |
| 11534 | if (err < 0) |
| 11535 | return err; |
| 11536 | if (!spec->autocfg.line_outs) |
| 11537 | return 0; /* can't find valid BIOS pin config */ |
| 11538 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11539 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11540 | if (err < 0) |
| 11541 | return err; |
| 11542 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11543 | if (err < 0) |
| 11544 | return err; |
| 11545 | err = alc662_auto_create_extra_out(spec, |
| 11546 | spec->autocfg.speaker_pins[0], |
| 11547 | "Speaker"); |
| 11548 | if (err < 0) |
| 11549 | return err; |
| 11550 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 11551 | "Headphone"); |
| 11552 | if (err < 0) |
| 11553 | return err; |
| 11554 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11555 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11556 | return err; |
| 11557 | |
| 11558 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11559 | |
| 11560 | if (spec->autocfg.dig_out_pin) |
| 11561 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 11562 | |
| 11563 | if (spec->kctl_alloc) |
| 11564 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11565 | |
| 11566 | spec->num_mux_defs = 1; |
| 11567 | spec->input_mux = &spec->private_imux; |
| 11568 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11569 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11570 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 11571 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11572 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11573 | } |
| 11574 | |
| 11575 | /* additional initialization for auto-configuration model */ |
| 11576 | static void alc662_auto_init(struct hda_codec *codec) |
| 11577 | { |
| 11578 | alc662_auto_init_multi_out(codec); |
| 11579 | alc662_auto_init_hp_out(codec); |
| 11580 | alc662_auto_init_analog_input(codec); |
| 11581 | } |
| 11582 | |
| 11583 | static int patch_alc662(struct hda_codec *codec) |
| 11584 | { |
| 11585 | struct alc_spec *spec; |
| 11586 | int err, board_config; |
| 11587 | |
| 11588 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11589 | if (!spec) |
| 11590 | return -ENOMEM; |
| 11591 | |
| 11592 | codec->spec = spec; |
| 11593 | |
| 11594 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 11595 | alc662_models, |
| 11596 | alc662_cfg_tbl); |
| 11597 | if (board_config < 0) { |
| 11598 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 11599 | "trying auto-probe from BIOS...\n"); |
| 11600 | board_config = ALC662_AUTO; |
| 11601 | } |
| 11602 | |
| 11603 | if (board_config == ALC662_AUTO) { |
| 11604 | /* automatic parse from the BIOS config */ |
| 11605 | err = alc662_parse_auto_config(codec); |
| 11606 | if (err < 0) { |
| 11607 | alc_free(codec); |
| 11608 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11609 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11610 | printk(KERN_INFO |
| 11611 | "hda_codec: Cannot set up configuration " |
| 11612 | "from BIOS. Using base mode...\n"); |
| 11613 | board_config = ALC662_3ST_2ch_DIG; |
| 11614 | } |
| 11615 | } |
| 11616 | |
| 11617 | if (board_config != ALC662_AUTO) |
| 11618 | setup_preset(spec, &alc662_presets[board_config]); |
| 11619 | |
| 11620 | spec->stream_name_analog = "ALC662 Analog"; |
| 11621 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 11622 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 11623 | |
| 11624 | spec->stream_name_digital = "ALC662 Digital"; |
| 11625 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 11626 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 11627 | |
| 11628 | if (!spec->adc_nids && spec->input_mux) { |
| 11629 | spec->adc_nids = alc662_adc_nids; |
| 11630 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 11631 | } |
| 11632 | |
| 11633 | codec->patch_ops = alc_patch_ops; |
| 11634 | if (board_config == ALC662_AUTO) |
| 11635 | spec->init_hook = alc662_auto_init; |
| 11636 | |
| 11637 | return 0; |
| 11638 | } |
| 11639 | |
| 11640 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11641 | * patch entries |
| 11642 | */ |
| 11643 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 11644 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11645 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11646 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11647 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11648 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11649 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 11650 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 11651 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11652 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 11653 | .patch = patch_alc883 }, |
| 11654 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 11655 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11656 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11657 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11658 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11659 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11660 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11661 | {} /* terminator */ |
| 11662 | }; |