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 | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 169 | ALC883_ACER, |
Tobin Davis | 2880a867 | 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 */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 445 | snd_hda_codec_write_cache(codec, nid, 0, |
| 446 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 447 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 448 | |
| 449 | /* Also enable the retasking pin's input/output as required |
| 450 | * for the requested pin mode. Enum values of 2 or less are |
| 451 | * input modes. |
| 452 | * |
| 453 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 454 | * reduces noise slightly (particularly on input) so we'll |
| 455 | * do it. However, having both input and output buffers |
| 456 | * enabled simultaneously doesn't seem to be problematic if |
| 457 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 458 | */ |
| 459 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 460 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 461 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 462 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 463 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 464 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 465 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 466 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 467 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 468 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 469 | } |
| 470 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 471 | return change; |
| 472 | } |
| 473 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 474 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 475 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 476 | .info = alc_pin_mode_info, \ |
| 477 | .get = alc_pin_mode_get, \ |
| 478 | .put = alc_pin_mode_put, \ |
| 479 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 480 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 481 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 482 | * together using a mask with more than one bit set. This control is |
| 483 | * currently used only by the ALC260 test model. At this stage they are not |
| 484 | * needed for any "production" models. |
| 485 | */ |
| 486 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 487 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 488 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 489 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 490 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 491 | { |
| 492 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 493 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 494 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 495 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 496 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 497 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 498 | |
| 499 | *valp = (val & mask) != 0; |
| 500 | return 0; |
| 501 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 502 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 503 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 504 | { |
| 505 | signed int change; |
| 506 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 507 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 508 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 509 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 510 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 511 | AC_VERB_GET_GPIO_DATA, |
| 512 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 513 | |
| 514 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 515 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 516 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 517 | gpio_data &= ~mask; |
| 518 | else |
| 519 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 520 | snd_hda_codec_write_cache(codec, nid, 0, |
| 521 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 522 | |
| 523 | return change; |
| 524 | } |
| 525 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 526 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 527 | .info = alc_gpio_data_info, \ |
| 528 | .get = alc_gpio_data_get, \ |
| 529 | .put = alc_gpio_data_put, \ |
| 530 | .private_value = nid | (mask<<16) } |
| 531 | #endif /* CONFIG_SND_DEBUG */ |
| 532 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 533 | /* A switch control to allow the enabling of the digital IO pins on the |
| 534 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 535 | * to provide something in the test model allowing digital outputs to be |
| 536 | * identified if present. If models are found which can utilise these |
| 537 | * outputs a more complete mixer control can be devised for those models if |
| 538 | * necessary. |
| 539 | */ |
| 540 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 541 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 542 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 543 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 544 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 545 | { |
| 546 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 547 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 548 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 549 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 550 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 551 | AC_VERB_GET_DIGI_CONVERT, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 552 | |
| 553 | *valp = (val & mask) != 0; |
| 554 | return 0; |
| 555 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 556 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 557 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 558 | { |
| 559 | signed int change; |
| 560 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 561 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 562 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 563 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 564 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 565 | AC_VERB_GET_DIGI_CONVERT, |
| 566 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 567 | |
| 568 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 569 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 570 | if (val==0) |
| 571 | ctrl_data &= ~mask; |
| 572 | else |
| 573 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 574 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 575 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 576 | |
| 577 | return change; |
| 578 | } |
| 579 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 580 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 581 | .info = alc_spdif_ctrl_info, \ |
| 582 | .get = alc_spdif_ctrl_get, \ |
| 583 | .put = alc_spdif_ctrl_put, \ |
| 584 | .private_value = nid | (mask<<16) } |
| 585 | #endif /* CONFIG_SND_DEBUG */ |
| 586 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 587 | /* |
| 588 | * set up from the preset table |
| 589 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 590 | static void setup_preset(struct alc_spec *spec, |
| 591 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 592 | { |
| 593 | int i; |
| 594 | |
| 595 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 596 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 597 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 598 | i++) |
| 599 | spec->init_verbs[spec->num_init_verbs++] = |
| 600 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 601 | |
| 602 | spec->channel_mode = preset->channel_mode; |
| 603 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 604 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 605 | |
| 606 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 607 | |
| 608 | spec->multiout.num_dacs = preset->num_dacs; |
| 609 | spec->multiout.dac_nids = preset->dac_nids; |
| 610 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 611 | spec->multiout.hp_nid = preset->hp_nid; |
| 612 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 613 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 614 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 615 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 616 | spec->input_mux = preset->input_mux; |
| 617 | |
| 618 | spec->num_adc_nids = preset->num_adc_nids; |
| 619 | spec->adc_nids = preset->adc_nids; |
| 620 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 621 | |
| 622 | spec->unsol_event = preset->unsol_event; |
| 623 | spec->init_hook = preset->init_hook; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 624 | } |
| 625 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 626 | /* Enable GPIO mask and set output */ |
| 627 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 628 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 629 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 630 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 631 | { } |
| 632 | }; |
| 633 | |
| 634 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 635 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 636 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 637 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 638 | { } |
| 639 | }; |
| 640 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 641 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 642 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 643 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 644 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 645 | { } |
| 646 | }; |
| 647 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 648 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 649 | * 31 ~ 16 : Manufacture ID |
| 650 | * 15 ~ 8 : SKU ID |
| 651 | * 7 ~ 0 : Assembly ID |
| 652 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 653 | */ |
| 654 | static void alc_subsystem_id(struct hda_codec *codec, |
| 655 | unsigned int porta, unsigned int porte, |
| 656 | unsigned int portd) |
| 657 | { |
| 658 | unsigned int ass, tmp; |
| 659 | |
| 660 | ass = codec->subsystem_id; |
| 661 | if (!(ass & 1)) |
| 662 | return; |
| 663 | |
| 664 | /* Override */ |
| 665 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 666 | switch (tmp) { |
| 667 | case 1: |
| 668 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 669 | break; |
| 670 | case 3: |
| 671 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 672 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 673 | case 7: |
| 674 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 675 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 676 | case 5: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 677 | switch (codec->vendor_id) { |
| 678 | case 0x10ec0862: |
| 679 | case 0x10ec0660: |
| 680 | case 0x10ec0662: |
| 681 | case 0x10ec0267: |
| 682 | case 0x10ec0268: |
| 683 | snd_hda_codec_write(codec, 0x14, 0, |
| 684 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 685 | snd_hda_codec_write(codec, 0x15, 0, |
| 686 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 687 | return; |
| 688 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 689 | case 6: |
| 690 | if (ass & 4) { /* bit 2 : 0 = Desktop, 1 = Laptop */ |
| 691 | hda_nid_t port = 0; |
| 692 | tmp = (ass & 0x1800) >> 11; |
| 693 | switch (tmp) { |
| 694 | case 0: port = porta; break; |
| 695 | case 1: port = porte; break; |
| 696 | case 2: port = portd; break; |
| 697 | } |
| 698 | if (port) |
| 699 | snd_hda_codec_write(codec, port, 0, |
| 700 | AC_VERB_SET_EAPD_BTLENABLE, |
| 701 | 2); |
| 702 | } |
| 703 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 704 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, |
| 705 | (tmp == 5 ? 0x3040 : 0x3050)); |
| 706 | break; |
| 707 | } |
| 708 | } |
| 709 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 710 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 711 | * Fix-up pin default configurations |
| 712 | */ |
| 713 | |
| 714 | struct alc_pincfg { |
| 715 | hda_nid_t nid; |
| 716 | u32 val; |
| 717 | }; |
| 718 | |
| 719 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 720 | const struct snd_pci_quirk *quirk, |
| 721 | const struct alc_pincfg **pinfix) |
| 722 | { |
| 723 | const struct alc_pincfg *cfg; |
| 724 | |
| 725 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 726 | if (!quirk) |
| 727 | return; |
| 728 | |
| 729 | cfg = pinfix[quirk->value]; |
| 730 | for (; cfg->nid; cfg++) { |
| 731 | int i; |
| 732 | u32 val = cfg->val; |
| 733 | for (i = 0; i < 4; i++) { |
| 734 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 735 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 736 | val & 0xff); |
| 737 | val >>= 8; |
| 738 | } |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 743 | * ALC880 3-stack model |
| 744 | * |
| 745 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 746 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 747 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 748 | */ |
| 749 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 750 | static hda_nid_t alc880_dac_nids[4] = { |
| 751 | /* front, rear, clfe, rear_surr */ |
| 752 | 0x02, 0x05, 0x04, 0x03 |
| 753 | }; |
| 754 | |
| 755 | static hda_nid_t alc880_adc_nids[3] = { |
| 756 | /* ADC0-2 */ |
| 757 | 0x07, 0x08, 0x09, |
| 758 | }; |
| 759 | |
| 760 | /* The datasheet says the node 0x07 is connected from inputs, |
| 761 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 762 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 763 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 764 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 765 | /* ADC1-2 */ |
| 766 | 0x08, 0x09, |
| 767 | }; |
| 768 | |
| 769 | #define ALC880_DIGOUT_NID 0x06 |
| 770 | #define ALC880_DIGIN_NID 0x0a |
| 771 | |
| 772 | static struct hda_input_mux alc880_capture_source = { |
| 773 | .num_items = 4, |
| 774 | .items = { |
| 775 | { "Mic", 0x0 }, |
| 776 | { "Front Mic", 0x3 }, |
| 777 | { "Line", 0x2 }, |
| 778 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 779 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 780 | }; |
| 781 | |
| 782 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 783 | /* 2ch mode */ |
| 784 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 785 | /* set line-in to input, mute it */ |
| 786 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 787 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 788 | /* set mic-in to input vref 80%, mute it */ |
| 789 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 790 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 791 | { } /* end */ |
| 792 | }; |
| 793 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 794 | /* 6ch mode */ |
| 795 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 796 | /* set line-in to output, unmute it */ |
| 797 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 798 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 799 | /* set mic-in to output, unmute it */ |
| 800 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 801 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 802 | { } /* end */ |
| 803 | }; |
| 804 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 805 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 806 | { 2, alc880_threestack_ch2_init }, |
| 807 | { 6, alc880_threestack_ch6_init }, |
| 808 | }; |
| 809 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 810 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 811 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 812 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 813 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 814 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 815 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 816 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 817 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 818 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 819 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 820 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 821 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 822 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 823 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 824 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 825 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 826 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 827 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 828 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 829 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 830 | { |
| 831 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 832 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 833 | .info = alc_ch_mode_info, |
| 834 | .get = alc_ch_mode_get, |
| 835 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 836 | }, |
| 837 | { } /* end */ |
| 838 | }; |
| 839 | |
| 840 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 841 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 842 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 843 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 844 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 845 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 846 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 847 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 848 | { |
| 849 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 850 | /* The multiple "Capture Source" controls confuse alsamixer |
| 851 | * So call somewhat different.. |
| 852 | * FIXME: the controls appear in the "playback" view! |
| 853 | */ |
| 854 | /* .name = "Capture Source", */ |
| 855 | .name = "Input Source", |
| 856 | .count = 3, |
| 857 | .info = alc_mux_enum_info, |
| 858 | .get = alc_mux_enum_get, |
| 859 | .put = alc_mux_enum_put, |
| 860 | }, |
| 861 | { } /* end */ |
| 862 | }; |
| 863 | |
| 864 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 865 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 866 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 867 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 868 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 869 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 870 | { |
| 871 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 872 | /* The multiple "Capture Source" controls confuse alsamixer |
| 873 | * So call somewhat different.. |
| 874 | * FIXME: the controls appear in the "playback" view! |
| 875 | */ |
| 876 | /* .name = "Capture Source", */ |
| 877 | .name = "Input Source", |
| 878 | .count = 2, |
| 879 | .info = alc_mux_enum_info, |
| 880 | .get = alc_mux_enum_get, |
| 881 | .put = alc_mux_enum_put, |
| 882 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 883 | { } /* end */ |
| 884 | }; |
| 885 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 886 | |
| 887 | |
| 888 | /* |
| 889 | * ALC880 5-stack model |
| 890 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 891 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 892 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 893 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 894 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 895 | */ |
| 896 | |
| 897 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 898 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 899 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 900 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 901 | { } /* end */ |
| 902 | }; |
| 903 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 904 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 905 | /* 6ch mode */ |
| 906 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 907 | /* set line-in to input, mute it */ |
| 908 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 909 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 910 | { } /* end */ |
| 911 | }; |
| 912 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 913 | /* 8ch mode */ |
| 914 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 915 | /* set line-in to output, unmute it */ |
| 916 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 917 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 918 | { } /* end */ |
| 919 | }; |
| 920 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 921 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 922 | { 6, alc880_fivestack_ch6_init }, |
| 923 | { 8, alc880_fivestack_ch8_init }, |
| 924 | }; |
| 925 | |
| 926 | |
| 927 | /* |
| 928 | * ALC880 6-stack model |
| 929 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 930 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 931 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 932 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 933 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 934 | */ |
| 935 | |
| 936 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 937 | /* front, rear, clfe, rear_surr */ |
| 938 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 939 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 940 | |
| 941 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 942 | .num_items = 4, |
| 943 | .items = { |
| 944 | { "Mic", 0x0 }, |
| 945 | { "Front Mic", 0x1 }, |
| 946 | { "Line", 0x2 }, |
| 947 | { "CD", 0x4 }, |
| 948 | }, |
| 949 | }; |
| 950 | |
| 951 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 952 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 953 | { 8, NULL }, |
| 954 | }; |
| 955 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 956 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 957 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 958 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 959 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 960 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 961 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 962 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 963 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 964 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 965 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 966 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 967 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 968 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 969 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 970 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 971 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 972 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 973 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 974 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 975 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 976 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 977 | { |
| 978 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 979 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 980 | .info = alc_ch_mode_info, |
| 981 | .get = alc_ch_mode_get, |
| 982 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 983 | }, |
| 984 | { } /* end */ |
| 985 | }; |
| 986 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 987 | |
| 988 | /* |
| 989 | * ALC880 W810 model |
| 990 | * |
| 991 | * W810 has rear IO for: |
| 992 | * Front (DAC 02) |
| 993 | * Surround (DAC 03) |
| 994 | * Center/LFE (DAC 04) |
| 995 | * Digital out (06) |
| 996 | * |
| 997 | * The system also has a pair of internal speakers, and a headphone jack. |
| 998 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 999 | * |
| 1000 | * There is a variable resistor to control the speaker or headphone |
| 1001 | * volume. This is a hardware-only device without a software API. |
| 1002 | * |
| 1003 | * Plugging headphones in will disable the internal speakers. This is |
| 1004 | * implemented in hardware, not via the driver using jack sense. In |
| 1005 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1006 | * disable both the speakers and headphones. |
| 1007 | * |
| 1008 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1009 | * These may not do anything useful with this driver yet, because I |
| 1010 | * haven't setup any initialization verbs for these yet... |
| 1011 | */ |
| 1012 | |
| 1013 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1014 | /* front, rear/surround, clfe */ |
| 1015 | 0x02, 0x03, 0x04 |
| 1016 | }; |
| 1017 | |
| 1018 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1019 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1020 | { 6, NULL } |
| 1021 | }; |
| 1022 | |
| 1023 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1024 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1025 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1026 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1027 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1028 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1029 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1030 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1031 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1032 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1033 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1034 | { } /* end */ |
| 1035 | }; |
| 1036 | |
| 1037 | |
| 1038 | /* |
| 1039 | * Z710V model |
| 1040 | * |
| 1041 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1042 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1043 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1044 | */ |
| 1045 | |
| 1046 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1047 | 0x02 |
| 1048 | }; |
| 1049 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1050 | |
| 1051 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1052 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1053 | { 2, NULL } |
| 1054 | }; |
| 1055 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1056 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1057 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1058 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1059 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1060 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1061 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1062 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1063 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1064 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1065 | { } /* end */ |
| 1066 | }; |
| 1067 | |
| 1068 | |
| 1069 | /* FIXME! */ |
| 1070 | /* |
| 1071 | * ALC880 F1734 model |
| 1072 | * |
| 1073 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1074 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1075 | */ |
| 1076 | |
| 1077 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1078 | 0x03 |
| 1079 | }; |
| 1080 | #define ALC880_F1734_HP_DAC 0x02 |
| 1081 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1082 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1083 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1084 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1085 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1086 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1087 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1088 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1089 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1090 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1091 | { } /* end */ |
| 1092 | }; |
| 1093 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1094 | |
| 1095 | /* FIXME! */ |
| 1096 | /* |
| 1097 | * ALC880 ASUS model |
| 1098 | * |
| 1099 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1100 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1101 | * Mic = 0x18, Line = 0x1a |
| 1102 | */ |
| 1103 | |
| 1104 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1105 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1106 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1107 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1108 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1109 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1110 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1111 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1112 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1113 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1114 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1115 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1116 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1117 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1118 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1119 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1120 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1121 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1122 | { |
| 1123 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1124 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1125 | .info = alc_ch_mode_info, |
| 1126 | .get = alc_ch_mode_get, |
| 1127 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1128 | }, |
| 1129 | { } /* end */ |
| 1130 | }; |
| 1131 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1132 | /* FIXME! */ |
| 1133 | /* |
| 1134 | * ALC880 ASUS W1V model |
| 1135 | * |
| 1136 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1137 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1138 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1139 | */ |
| 1140 | |
| 1141 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1142 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1143 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1144 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1145 | { } /* end */ |
| 1146 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1147 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1148 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1149 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1150 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1151 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1152 | { } /* end */ |
| 1153 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1154 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1155 | /* TCL S700 */ |
| 1156 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1157 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1158 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1159 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1160 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1161 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1164 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1165 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1166 | { |
| 1167 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1168 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1169 | * So call somewhat different.. |
| 1170 | * FIXME: the controls appear in the "playback" view! |
| 1171 | */ |
| 1172 | /* .name = "Capture Source", */ |
| 1173 | .name = "Input Source", |
| 1174 | .count = 1, |
| 1175 | .info = alc_mux_enum_info, |
| 1176 | .get = alc_mux_enum_get, |
| 1177 | .put = alc_mux_enum_put, |
| 1178 | }, |
| 1179 | { } /* end */ |
| 1180 | }; |
| 1181 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1182 | /* Uniwill */ |
| 1183 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
| 1184 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1185 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1186 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1187 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1188 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1189 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1190 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1191 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1192 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1193 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1194 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1195 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1197 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1198 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1199 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1200 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1201 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1202 | { |
| 1203 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1204 | .name = "Channel Mode", |
| 1205 | .info = alc_ch_mode_info, |
| 1206 | .get = alc_ch_mode_get, |
| 1207 | .put = alc_ch_mode_put, |
| 1208 | }, |
| 1209 | { } /* end */ |
| 1210 | }; |
| 1211 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1212 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1213 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1214 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1215 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1216 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1217 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1218 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1219 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1220 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1221 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1222 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1223 | { } /* end */ |
| 1224 | }; |
| 1225 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1226 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
| 1227 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1228 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1229 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1230 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1231 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1232 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1233 | { } /* end */ |
| 1234 | }; |
| 1235 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1236 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1237 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1238 | */ |
| 1239 | static int alc_build_controls(struct hda_codec *codec) |
| 1240 | { |
| 1241 | struct alc_spec *spec = codec->spec; |
| 1242 | int err; |
| 1243 | int i; |
| 1244 | |
| 1245 | for (i = 0; i < spec->num_mixers; i++) { |
| 1246 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1247 | if (err < 0) |
| 1248 | return err; |
| 1249 | } |
| 1250 | |
| 1251 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1252 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1253 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1254 | if (err < 0) |
| 1255 | return err; |
| 1256 | } |
| 1257 | if (spec->dig_in_nid) { |
| 1258 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1259 | if (err < 0) |
| 1260 | return err; |
| 1261 | } |
| 1262 | return 0; |
| 1263 | } |
| 1264 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1265 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1266 | /* |
| 1267 | * initialize the codec volumes, etc |
| 1268 | */ |
| 1269 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1270 | /* |
| 1271 | * generic initialization of ADC, input mixers and output mixers |
| 1272 | */ |
| 1273 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1274 | /* |
| 1275 | * Unmute ADC0-2 and set the default input to mic-in |
| 1276 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1277 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1279 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1280 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1281 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1282 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1283 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1284 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1285 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1286 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1287 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1288 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1289 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 1293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 1294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1295 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1296 | /* |
| 1297 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1298 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1299 | /* set vol=0 to output mixers */ |
| 1300 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1301 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1302 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1303 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1304 | /* set up input amps for analog loopback */ |
| 1305 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1308 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1312 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1313 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1314 | |
| 1315 | { } |
| 1316 | }; |
| 1317 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1318 | /* |
| 1319 | * 3-stack pin configuration: |
| 1320 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1321 | */ |
| 1322 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1323 | /* |
| 1324 | * preset connection lists of input pins |
| 1325 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1326 | */ |
| 1327 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1328 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1329 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1330 | |
| 1331 | /* |
| 1332 | * Set pin mode and muting |
| 1333 | */ |
| 1334 | /* set front pin widgets 0x14 for output */ |
| 1335 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1336 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1337 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1338 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1339 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1340 | /* Mic2 (as headphone out) for HP output */ |
| 1341 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1342 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1343 | /* Line In pin widget for input */ |
| 1344 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1345 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1346 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1347 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1348 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1349 | /* CD pin widget for input */ |
| 1350 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1351 | |
| 1352 | { } |
| 1353 | }; |
| 1354 | |
| 1355 | /* |
| 1356 | * 5-stack pin configuration: |
| 1357 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1358 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1359 | */ |
| 1360 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1361 | /* |
| 1362 | * preset connection lists of input pins |
| 1363 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1364 | */ |
| 1365 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1366 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1367 | |
| 1368 | /* |
| 1369 | * Set pin mode and muting |
| 1370 | */ |
| 1371 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1372 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1373 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1374 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1375 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1376 | /* unmute pins for output (no gain on this amp) */ |
| 1377 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1378 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1379 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1380 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1381 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1382 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1383 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1384 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1385 | /* Mic2 (as headphone out) for HP output */ |
| 1386 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1387 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1388 | /* Line In pin widget for input */ |
| 1389 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1390 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1391 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1392 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1393 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1394 | /* CD pin widget for input */ |
| 1395 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1396 | |
| 1397 | { } |
| 1398 | }; |
| 1399 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1400 | /* |
| 1401 | * W810 pin configuration: |
| 1402 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1403 | */ |
| 1404 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1405 | /* hphone/speaker input selector: front DAC */ |
| 1406 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1407 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1408 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1409 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1410 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1411 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1412 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1413 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1414 | |
| 1415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1416 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1417 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1418 | { } |
| 1419 | }; |
| 1420 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1421 | /* |
| 1422 | * Z71V pin configuration: |
| 1423 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1424 | */ |
| 1425 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1426 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1427 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1428 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1429 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1430 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1431 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1432 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1433 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1434 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1435 | |
| 1436 | { } |
| 1437 | }; |
| 1438 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1439 | /* |
| 1440 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1441 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1442 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1443 | */ |
| 1444 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1445 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1446 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1447 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1448 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1449 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1451 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1452 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1453 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1454 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1455 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1456 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1457 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1458 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1459 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1460 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1461 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1462 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1463 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1464 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1465 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1466 | { } |
| 1467 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1468 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1469 | /* |
| 1470 | * Uniwill pin configuration: |
| 1471 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1472 | * line = 0x1a |
| 1473 | */ |
| 1474 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1475 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1476 | |
| 1477 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1478 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1479 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1480 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1481 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1482 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1483 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1484 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1485 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1486 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1487 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1488 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1489 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1490 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1491 | |
| 1492 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1493 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1494 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1495 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1496 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1497 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1498 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1499 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1500 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1501 | |
| 1502 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1503 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1504 | |
| 1505 | { } |
| 1506 | }; |
| 1507 | |
| 1508 | /* |
| 1509 | * Uniwill P53 |
| 1510 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1511 | */ |
| 1512 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1513 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1514 | |
| 1515 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1516 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1517 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1518 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1519 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1520 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1521 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1522 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1523 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1524 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1525 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1526 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1527 | |
| 1528 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1529 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1530 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1531 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1532 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1533 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1534 | |
| 1535 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1536 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1537 | |
| 1538 | { } |
| 1539 | }; |
| 1540 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1541 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1542 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1543 | { } |
| 1544 | }; |
| 1545 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1546 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1547 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1548 | { |
| 1549 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1550 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1551 | |
| 1552 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1553 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1554 | bits = present ? HDA_AMP_MUTE : 0; |
| 1555 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1556 | HDA_AMP_MUTE, bits); |
| 1557 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1558 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1559 | } |
| 1560 | |
| 1561 | /* auto-toggle front mic */ |
| 1562 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1563 | { |
| 1564 | unsigned int present; |
| 1565 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1566 | |
| 1567 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1568 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1569 | bits = present ? HDA_AMP_MUTE : 0; |
| 1570 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1571 | } |
| 1572 | |
| 1573 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1574 | { |
| 1575 | alc880_uniwill_hp_automute(codec); |
| 1576 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1577 | } |
| 1578 | |
| 1579 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1580 | unsigned int res) |
| 1581 | { |
| 1582 | /* Looks like the unsol event is incompatible with the standard |
| 1583 | * definition. 4bit tag is placed at 28 bit! |
| 1584 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1585 | switch (res >> 28) { |
| 1586 | case ALC880_HP_EVENT: |
| 1587 | alc880_uniwill_hp_automute(codec); |
| 1588 | break; |
| 1589 | case ALC880_MIC_EVENT: |
| 1590 | alc880_uniwill_mic_automute(codec); |
| 1591 | break; |
| 1592 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1593 | } |
| 1594 | |
| 1595 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1596 | { |
| 1597 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1598 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1599 | |
| 1600 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1601 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1602 | bits = present ? HDA_AMP_MUTE : 0; |
| 1603 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1604 | } |
| 1605 | |
| 1606 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1607 | { |
| 1608 | unsigned int present; |
| 1609 | |
| 1610 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1611 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1612 | present &= HDA_AMP_VOLMASK; |
| 1613 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1614 | HDA_AMP_VOLMASK, present); |
| 1615 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1616 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1617 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1618 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1619 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1620 | unsigned int res) |
| 1621 | { |
| 1622 | /* Looks like the unsol event is incompatible with the standard |
| 1623 | * definition. 4bit tag is placed at 28 bit! |
| 1624 | */ |
| 1625 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1626 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1627 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1628 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1629 | } |
| 1630 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1631 | /* FIXME! */ |
| 1632 | /* |
| 1633 | * F1734 pin configuration: |
| 1634 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1635 | */ |
| 1636 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1637 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1638 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1639 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1640 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1641 | |
| 1642 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1643 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1644 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1645 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1646 | |
| 1647 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1648 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1649 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1650 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1651 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1652 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1653 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1654 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1655 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1656 | |
| 1657 | { } |
| 1658 | }; |
| 1659 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1660 | /* FIXME! */ |
| 1661 | /* |
| 1662 | * ASUS pin configuration: |
| 1663 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1664 | */ |
| 1665 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1666 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1667 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1668 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1669 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1670 | |
| 1671 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1672 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1673 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1674 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1675 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1676 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1677 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1678 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1679 | |
| 1680 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1681 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1682 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1683 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1684 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1685 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1686 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1687 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1688 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1689 | |
| 1690 | { } |
| 1691 | }; |
| 1692 | |
| 1693 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1694 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1695 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1696 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1697 | /* Clevo m520g init */ |
| 1698 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1699 | /* headphone output */ |
| 1700 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1701 | /* line-out */ |
| 1702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1704 | /* Line-in */ |
| 1705 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1706 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1707 | /* CD */ |
| 1708 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1709 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1710 | /* Mic1 (rear panel) */ |
| 1711 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1712 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1713 | /* Mic2 (front panel) */ |
| 1714 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1715 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1716 | /* headphone */ |
| 1717 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1718 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1719 | /* change to EAPD mode */ |
| 1720 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1721 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1722 | |
| 1723 | { } |
| 1724 | }; |
| 1725 | |
| 1726 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 1727 | /* change to EAPD mode */ |
| 1728 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1729 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1730 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1731 | /* Headphone output */ |
| 1732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1733 | /* Front output*/ |
| 1734 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1735 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1736 | |
| 1737 | /* Line In pin widget for input */ |
| 1738 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1739 | /* CD pin widget for input */ |
| 1740 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1741 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1742 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1743 | |
| 1744 | /* change to EAPD mode */ |
| 1745 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1746 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 1747 | |
| 1748 | { } |
| 1749 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1750 | |
| 1751 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1752 | * LG m1 express dual |
| 1753 | * |
| 1754 | * Pin assignment: |
| 1755 | * Rear Line-In/Out (blue): 0x14 |
| 1756 | * Build-in Mic-In: 0x15 |
| 1757 | * Speaker-out: 0x17 |
| 1758 | * HP-Out (green): 0x1b |
| 1759 | * Mic-In/Out (red): 0x19 |
| 1760 | * SPDIF-Out: 0x1e |
| 1761 | */ |
| 1762 | |
| 1763 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 1764 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 1765 | 0x05, 0x02, 0x03 |
| 1766 | }; |
| 1767 | |
| 1768 | /* seems analog CD is not working */ |
| 1769 | static struct hda_input_mux alc880_lg_capture_source = { |
| 1770 | .num_items = 3, |
| 1771 | .items = { |
| 1772 | { "Mic", 0x1 }, |
| 1773 | { "Line", 0x5 }, |
| 1774 | { "Internal Mic", 0x6 }, |
| 1775 | }, |
| 1776 | }; |
| 1777 | |
| 1778 | /* 2,4,6 channel modes */ |
| 1779 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 1780 | /* set line-in and mic-in to input */ |
| 1781 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1782 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1783 | { } |
| 1784 | }; |
| 1785 | |
| 1786 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 1787 | /* set line-in to out and mic-in to input */ |
| 1788 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1789 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1790 | { } |
| 1791 | }; |
| 1792 | |
| 1793 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 1794 | /* set line-in and mic-in to output */ |
| 1795 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1796 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1797 | { } |
| 1798 | }; |
| 1799 | |
| 1800 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 1801 | { 2, alc880_lg_ch2_init }, |
| 1802 | { 4, alc880_lg_ch4_init }, |
| 1803 | { 6, alc880_lg_ch6_init }, |
| 1804 | }; |
| 1805 | |
| 1806 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 1807 | /* FIXME: it's not really "master" but front channels */ |
| 1808 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1809 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1810 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1811 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1812 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 1813 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 1814 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 1815 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 1816 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1817 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 1819 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 1820 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 1821 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 1822 | { |
| 1823 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1824 | .name = "Channel Mode", |
| 1825 | .info = alc_ch_mode_info, |
| 1826 | .get = alc_ch_mode_get, |
| 1827 | .put = alc_ch_mode_put, |
| 1828 | }, |
| 1829 | { } /* end */ |
| 1830 | }; |
| 1831 | |
| 1832 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 1833 | /* set capture source to mic-in */ |
| 1834 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1835 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1836 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1837 | /* mute all amp mixer inputs */ |
| 1838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 1839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 1840 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1841 | /* line-in to input */ |
| 1842 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1843 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1844 | /* built-in mic */ |
| 1845 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1846 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1847 | /* speaker-out */ |
| 1848 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1849 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1850 | /* mic-in to input */ |
| 1851 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1852 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1853 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1854 | /* HP-out */ |
| 1855 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1856 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1857 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1858 | /* jack sense */ |
| 1859 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1860 | { } |
| 1861 | }; |
| 1862 | |
| 1863 | /* toggle speaker-output according to the hp-jack state */ |
| 1864 | static void alc880_lg_automute(struct hda_codec *codec) |
| 1865 | { |
| 1866 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1867 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1868 | |
| 1869 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1870 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1871 | bits = present ? HDA_AMP_MUTE : 0; |
| 1872 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 1873 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1874 | } |
| 1875 | |
| 1876 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1877 | { |
| 1878 | /* Looks like the unsol event is incompatible with the standard |
| 1879 | * definition. 4bit tag is placed at 28 bit! |
| 1880 | */ |
| 1881 | if ((res >> 28) == 0x01) |
| 1882 | alc880_lg_automute(codec); |
| 1883 | } |
| 1884 | |
| 1885 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1886 | * LG LW20 |
| 1887 | * |
| 1888 | * Pin assignment: |
| 1889 | * Speaker-out: 0x14 |
| 1890 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1891 | * Built-in Mic-In: 0x19 |
| 1892 | * Line-In: 0x1b |
| 1893 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1894 | * SPDIF-Out: 0x1e |
| 1895 | */ |
| 1896 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1897 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1898 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1899 | .items = { |
| 1900 | { "Mic", 0x0 }, |
| 1901 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1902 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1903 | }, |
| 1904 | }; |
| 1905 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1906 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 1907 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1908 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1909 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1910 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1911 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1912 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1913 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1914 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1915 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1916 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1917 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1918 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1919 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1920 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1921 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 1922 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1923 | { |
| 1924 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1925 | .name = "Channel Mode", |
| 1926 | .info = alc_ch_mode_info, |
| 1927 | .get = alc_ch_mode_get, |
| 1928 | .put = alc_ch_mode_put, |
| 1929 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1930 | { } /* end */ |
| 1931 | }; |
| 1932 | |
| 1933 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1934 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1935 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1936 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1937 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1938 | /* set capture source to mic-in */ |
| 1939 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1940 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1941 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1942 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1943 | /* speaker-out */ |
| 1944 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1945 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1946 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1947 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1948 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1949 | /* mic-in to input */ |
| 1950 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1951 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1952 | /* built-in mic */ |
| 1953 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1954 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1955 | /* jack sense */ |
| 1956 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1957 | { } |
| 1958 | }; |
| 1959 | |
| 1960 | /* toggle speaker-output according to the hp-jack state */ |
| 1961 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 1962 | { |
| 1963 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1964 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1965 | |
| 1966 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1967 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1968 | bits = present ? HDA_AMP_MUTE : 0; |
| 1969 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1970 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1971 | } |
| 1972 | |
| 1973 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1974 | { |
| 1975 | /* Looks like the unsol event is incompatible with the standard |
| 1976 | * definition. 4bit tag is placed at 28 bit! |
| 1977 | */ |
| 1978 | if ((res >> 28) == 0x01) |
| 1979 | alc880_lg_lw_automute(codec); |
| 1980 | } |
| 1981 | |
| 1982 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1983 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1984 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1985 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1986 | static int alc_init(struct hda_codec *codec) |
| 1987 | { |
| 1988 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1989 | unsigned int i; |
| 1990 | |
| 1991 | for (i = 0; i < spec->num_init_verbs; i++) |
| 1992 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1993 | |
| 1994 | if (spec->init_hook) |
| 1995 | spec->init_hook(codec); |
| 1996 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1997 | return 0; |
| 1998 | } |
| 1999 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2000 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2001 | { |
| 2002 | struct alc_spec *spec = codec->spec; |
| 2003 | |
| 2004 | if (spec->unsol_event) |
| 2005 | spec->unsol_event(codec, res); |
| 2006 | } |
| 2007 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2008 | /* |
| 2009 | * Analog playback callbacks |
| 2010 | */ |
| 2011 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2012 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2013 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2014 | { |
| 2015 | struct alc_spec *spec = codec->spec; |
| 2016 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2017 | } |
| 2018 | |
| 2019 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2020 | struct hda_codec *codec, |
| 2021 | unsigned int stream_tag, |
| 2022 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2023 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2024 | { |
| 2025 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2026 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2027 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2028 | } |
| 2029 | |
| 2030 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2031 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2032 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2033 | { |
| 2034 | struct alc_spec *spec = codec->spec; |
| 2035 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2036 | } |
| 2037 | |
| 2038 | /* |
| 2039 | * Digital out |
| 2040 | */ |
| 2041 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2042 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2043 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2044 | { |
| 2045 | struct alc_spec *spec = codec->spec; |
| 2046 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2047 | } |
| 2048 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2049 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2050 | struct hda_codec *codec, |
| 2051 | unsigned int stream_tag, |
| 2052 | unsigned int format, |
| 2053 | struct snd_pcm_substream *substream) |
| 2054 | { |
| 2055 | struct alc_spec *spec = codec->spec; |
| 2056 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2057 | stream_tag, format, substream); |
| 2058 | } |
| 2059 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2060 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2061 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2062 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2063 | { |
| 2064 | struct alc_spec *spec = codec->spec; |
| 2065 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2066 | } |
| 2067 | |
| 2068 | /* |
| 2069 | * Analog capture |
| 2070 | */ |
| 2071 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2072 | struct hda_codec *codec, |
| 2073 | unsigned int stream_tag, |
| 2074 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2075 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2076 | { |
| 2077 | struct alc_spec *spec = codec->spec; |
| 2078 | |
| 2079 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2080 | stream_tag, 0, format); |
| 2081 | return 0; |
| 2082 | } |
| 2083 | |
| 2084 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2085 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2086 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2087 | { |
| 2088 | struct alc_spec *spec = codec->spec; |
| 2089 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2090 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2091 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2092 | return 0; |
| 2093 | } |
| 2094 | |
| 2095 | |
| 2096 | /* |
| 2097 | */ |
| 2098 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2099 | .substreams = 1, |
| 2100 | .channels_min = 2, |
| 2101 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2102 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2103 | .ops = { |
| 2104 | .open = alc880_playback_pcm_open, |
| 2105 | .prepare = alc880_playback_pcm_prepare, |
| 2106 | .cleanup = alc880_playback_pcm_cleanup |
| 2107 | }, |
| 2108 | }; |
| 2109 | |
| 2110 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 2111 | .substreams = 2, |
| 2112 | .channels_min = 2, |
| 2113 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2114 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2115 | .ops = { |
| 2116 | .prepare = alc880_capture_pcm_prepare, |
| 2117 | .cleanup = alc880_capture_pcm_cleanup |
| 2118 | }, |
| 2119 | }; |
| 2120 | |
| 2121 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2122 | .substreams = 1, |
| 2123 | .channels_min = 2, |
| 2124 | .channels_max = 2, |
| 2125 | /* NID is set in alc_build_pcms */ |
| 2126 | .ops = { |
| 2127 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2128 | .close = alc880_dig_playback_pcm_close, |
| 2129 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2130 | }, |
| 2131 | }; |
| 2132 | |
| 2133 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2134 | .substreams = 1, |
| 2135 | .channels_min = 2, |
| 2136 | .channels_max = 2, |
| 2137 | /* NID is set in alc_build_pcms */ |
| 2138 | }; |
| 2139 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2140 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 2141 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 2142 | .substreams = 0, |
| 2143 | .channels_min = 0, |
| 2144 | .channels_max = 0, |
| 2145 | }; |
| 2146 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2147 | static int alc_build_pcms(struct hda_codec *codec) |
| 2148 | { |
| 2149 | struct alc_spec *spec = codec->spec; |
| 2150 | struct hda_pcm *info = spec->pcm_rec; |
| 2151 | int i; |
| 2152 | |
| 2153 | codec->num_pcms = 1; |
| 2154 | codec->pcm_info = info; |
| 2155 | |
| 2156 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2157 | if (spec->stream_analog_playback) { |
| 2158 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2159 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2160 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2161 | } |
| 2162 | if (spec->stream_analog_capture) { |
| 2163 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2164 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2165 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2166 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2167 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2168 | if (spec->channel_mode) { |
| 2169 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2170 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2171 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2172 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2173 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2174 | } |
| 2175 | } |
| 2176 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2177 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2178 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2179 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2180 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2181 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2182 | if (spec->multiout.dig_out_nid && |
| 2183 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2184 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2185 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2186 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2187 | if (spec->dig_in_nid && |
| 2188 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2189 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2190 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2191 | } |
| 2192 | } |
| 2193 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2194 | /* If the use of more than one ADC is requested for the current |
| 2195 | * model, configure a second analog capture-only PCM. |
| 2196 | */ |
| 2197 | /* Additional Analaog capture for index #2 */ |
| 2198 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2199 | spec->adc_nids) { |
| 2200 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2201 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2202 | info->name = spec->stream_name_analog; |
| 2203 | /* No playback stream for second PCM */ |
| 2204 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2205 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2206 | if (spec->stream_analog_capture) { |
| 2207 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2208 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2209 | } |
| 2210 | } |
| 2211 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2212 | return 0; |
| 2213 | } |
| 2214 | |
| 2215 | static void alc_free(struct hda_codec *codec) |
| 2216 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2217 | struct alc_spec *spec = codec->spec; |
| 2218 | unsigned int i; |
| 2219 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2220 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2221 | return; |
| 2222 | |
| 2223 | if (spec->kctl_alloc) { |
| 2224 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2225 | kfree(spec->kctl_alloc[i].name); |
| 2226 | kfree(spec->kctl_alloc); |
| 2227 | } |
| 2228 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2229 | } |
| 2230 | |
| 2231 | /* |
| 2232 | */ |
| 2233 | static struct hda_codec_ops alc_patch_ops = { |
| 2234 | .build_controls = alc_build_controls, |
| 2235 | .build_pcms = alc_build_pcms, |
| 2236 | .init = alc_init, |
| 2237 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2238 | .unsol_event = alc_unsol_event, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2239 | }; |
| 2240 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2241 | |
| 2242 | /* |
| 2243 | * Test configuration for debugging |
| 2244 | * |
| 2245 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2246 | * enum controls. |
| 2247 | */ |
| 2248 | #ifdef CONFIG_SND_DEBUG |
| 2249 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2250 | 0x02, 0x03, 0x04, 0x05 |
| 2251 | }; |
| 2252 | |
| 2253 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2254 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2255 | .items = { |
| 2256 | { "In-1", 0x0 }, |
| 2257 | { "In-2", 0x1 }, |
| 2258 | { "In-3", 0x2 }, |
| 2259 | { "In-4", 0x3 }, |
| 2260 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2261 | { "Front", 0x5 }, |
| 2262 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2263 | }, |
| 2264 | }; |
| 2265 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2266 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2267 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2268 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2269 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2270 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2271 | }; |
| 2272 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2273 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2274 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2275 | { |
| 2276 | static char *texts[] = { |
| 2277 | "N/A", "Line Out", "HP Out", |
| 2278 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2279 | }; |
| 2280 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2281 | uinfo->count = 1; |
| 2282 | uinfo->value.enumerated.items = 8; |
| 2283 | if (uinfo->value.enumerated.item >= 8) |
| 2284 | uinfo->value.enumerated.item = 7; |
| 2285 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2286 | return 0; |
| 2287 | } |
| 2288 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2289 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2290 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2291 | { |
| 2292 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2293 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2294 | unsigned int pin_ctl, item = 0; |
| 2295 | |
| 2296 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2297 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2298 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2299 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2300 | item = 2; |
| 2301 | else |
| 2302 | item = 1; |
| 2303 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2304 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2305 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2306 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2307 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2308 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2309 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2310 | } |
| 2311 | } |
| 2312 | ucontrol->value.enumerated.item[0] = item; |
| 2313 | return 0; |
| 2314 | } |
| 2315 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2316 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2317 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2318 | { |
| 2319 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2320 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2321 | static unsigned int ctls[] = { |
| 2322 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2323 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2324 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2325 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2326 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2327 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2328 | }; |
| 2329 | unsigned int old_ctl, new_ctl; |
| 2330 | |
| 2331 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2332 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2333 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2334 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2335 | int val; |
| 2336 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2337 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2338 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2339 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2340 | HDA_AMP_MUTE : 0; |
| 2341 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2342 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2343 | return 1; |
| 2344 | } |
| 2345 | return 0; |
| 2346 | } |
| 2347 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2348 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2349 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2350 | { |
| 2351 | static char *texts[] = { |
| 2352 | "Front", "Surround", "CLFE", "Side" |
| 2353 | }; |
| 2354 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2355 | uinfo->count = 1; |
| 2356 | uinfo->value.enumerated.items = 4; |
| 2357 | if (uinfo->value.enumerated.item >= 4) |
| 2358 | uinfo->value.enumerated.item = 3; |
| 2359 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2360 | return 0; |
| 2361 | } |
| 2362 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2363 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2364 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2365 | { |
| 2366 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2367 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2368 | unsigned int sel; |
| 2369 | |
| 2370 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2371 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2372 | return 0; |
| 2373 | } |
| 2374 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2375 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2376 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2377 | { |
| 2378 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2379 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2380 | unsigned int sel; |
| 2381 | |
| 2382 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2383 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2384 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2385 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2386 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2387 | return 1; |
| 2388 | } |
| 2389 | return 0; |
| 2390 | } |
| 2391 | |
| 2392 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2393 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2394 | .name = xname, \ |
| 2395 | .info = alc_test_pin_ctl_info, \ |
| 2396 | .get = alc_test_pin_ctl_get, \ |
| 2397 | .put = alc_test_pin_ctl_put, \ |
| 2398 | .private_value = nid \ |
| 2399 | } |
| 2400 | |
| 2401 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2402 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2403 | .name = xname, \ |
| 2404 | .info = alc_test_pin_src_info, \ |
| 2405 | .get = alc_test_pin_src_get, \ |
| 2406 | .put = alc_test_pin_src_put, \ |
| 2407 | .private_value = nid \ |
| 2408 | } |
| 2409 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2410 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2411 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2412 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2413 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2414 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2415 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2416 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2417 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2418 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2419 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2420 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2421 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2422 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2423 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2424 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2425 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2426 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2427 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2428 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2429 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2430 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2431 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2432 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2433 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2434 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2435 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2436 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2437 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2438 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2439 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2440 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2441 | { |
| 2442 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2443 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2444 | .info = alc_ch_mode_info, |
| 2445 | .get = alc_ch_mode_get, |
| 2446 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2447 | }, |
| 2448 | { } /* end */ |
| 2449 | }; |
| 2450 | |
| 2451 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2452 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2453 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2454 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2455 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2456 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2457 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2458 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2459 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2460 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2461 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2463 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2464 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2465 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2466 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2467 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2469 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2470 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2471 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2472 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2473 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2474 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2475 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2476 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2477 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2478 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2479 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2480 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2481 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2482 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2483 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2484 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2485 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2486 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2487 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2489 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2491 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2492 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2493 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2494 | /* Analog input/passthru */ |
| 2495 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2496 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2497 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2498 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2499 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2500 | { } |
| 2501 | }; |
| 2502 | #endif |
| 2503 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2504 | /* |
| 2505 | */ |
| 2506 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2507 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2508 | [ALC880_3ST] = "3stack", |
| 2509 | [ALC880_TCL_S700] = "tcl", |
| 2510 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2511 | [ALC880_CLEVO] = "clevo", |
| 2512 | [ALC880_5ST] = "5stack", |
| 2513 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2514 | [ALC880_W810] = "w810", |
| 2515 | [ALC880_Z71V] = "z71v", |
| 2516 | [ALC880_6ST] = "6stack", |
| 2517 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2518 | [ALC880_ASUS] = "asus", |
| 2519 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2520 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2521 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2522 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2523 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2524 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2525 | [ALC880_F1734] = "F1734", |
| 2526 | [ALC880_LG] = "lg", |
| 2527 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2528 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2529 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2530 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2531 | [ALC880_AUTO] = "auto", |
| 2532 | }; |
| 2533 | |
| 2534 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
| 2535 | /* Broken BIOS configuration */ |
| 2536 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), |
| 2537 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2538 | |
| 2539 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2540 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
Tobin Davis | 4dc53e2 | 2006-12-18 13:24:37 +0100 | [diff] [blame] | 2541 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2542 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2543 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2544 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2545 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2546 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2547 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
| 2548 | |
| 2549 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2550 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
| 2551 | |
| 2552 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2553 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2554 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2555 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2556 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2557 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2558 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2559 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2560 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2561 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2562 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2563 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2564 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2565 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
| 2566 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), |
| 2567 | |
| 2568 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2569 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
| 2570 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2571 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
| 2572 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
| 2573 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2574 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
| 2575 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
| 2576 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2577 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
| 2578 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2579 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2580 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
| 2581 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2582 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2583 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2584 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
| 2585 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
| 2586 | |
| 2587 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
| 2588 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2589 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
| 2590 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
| 2591 | |
| 2592 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
| 2593 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
| 2594 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2595 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2596 | |
| 2597 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2598 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
| 2599 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
| 2600 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
| 2601 | |
| 2602 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
| 2603 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2604 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
| 2605 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2606 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
| 2607 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
| 2608 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2609 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2610 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
| 2611 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
| 2612 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2613 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2614 | {} |
| 2615 | }; |
| 2616 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2617 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2618 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2619 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2620 | static struct alc_config_preset alc880_presets[] = { |
| 2621 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2622 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2623 | .init_verbs = { alc880_volume_init_verbs, |
| 2624 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2625 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2626 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2627 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2628 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2629 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2630 | .input_mux = &alc880_capture_source, |
| 2631 | }, |
| 2632 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2633 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2634 | .init_verbs = { alc880_volume_init_verbs, |
| 2635 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2636 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2637 | .dac_nids = alc880_dac_nids, |
| 2638 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2639 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2640 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2641 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2642 | .input_mux = &alc880_capture_source, |
| 2643 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2644 | [ALC880_TCL_S700] = { |
| 2645 | .mixers = { alc880_tcl_s700_mixer }, |
| 2646 | .init_verbs = { alc880_volume_init_verbs, |
| 2647 | alc880_pin_tcl_S700_init_verbs, |
| 2648 | alc880_gpio2_init_verbs }, |
| 2649 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2650 | .dac_nids = alc880_dac_nids, |
| 2651 | .hp_nid = 0x03, |
| 2652 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2653 | .channel_mode = alc880_2_jack_modes, |
| 2654 | .input_mux = &alc880_capture_source, |
| 2655 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2656 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2657 | .mixers = { alc880_three_stack_mixer, |
| 2658 | alc880_five_stack_mixer}, |
| 2659 | .init_verbs = { alc880_volume_init_verbs, |
| 2660 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2661 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2662 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2663 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2664 | .channel_mode = alc880_fivestack_modes, |
| 2665 | .input_mux = &alc880_capture_source, |
| 2666 | }, |
| 2667 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2668 | .mixers = { alc880_three_stack_mixer, |
| 2669 | alc880_five_stack_mixer }, |
| 2670 | .init_verbs = { alc880_volume_init_verbs, |
| 2671 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2672 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2673 | .dac_nids = alc880_dac_nids, |
| 2674 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2675 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2676 | .channel_mode = alc880_fivestack_modes, |
| 2677 | .input_mux = &alc880_capture_source, |
| 2678 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2679 | [ALC880_6ST] = { |
| 2680 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2681 | .init_verbs = { alc880_volume_init_verbs, |
| 2682 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2683 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2684 | .dac_nids = alc880_6st_dac_nids, |
| 2685 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2686 | .channel_mode = alc880_sixstack_modes, |
| 2687 | .input_mux = &alc880_6stack_capture_source, |
| 2688 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2689 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2690 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2691 | .init_verbs = { alc880_volume_init_verbs, |
| 2692 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2693 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2694 | .dac_nids = alc880_6st_dac_nids, |
| 2695 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2696 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2697 | .channel_mode = alc880_sixstack_modes, |
| 2698 | .input_mux = &alc880_6stack_capture_source, |
| 2699 | }, |
| 2700 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2701 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2702 | .init_verbs = { alc880_volume_init_verbs, |
| 2703 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2704 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2705 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 2706 | .dac_nids = alc880_w810_dac_nids, |
| 2707 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2708 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2709 | .channel_mode = alc880_w810_modes, |
| 2710 | .input_mux = &alc880_capture_source, |
| 2711 | }, |
| 2712 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2713 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2714 | .init_verbs = { alc880_volume_init_verbs, |
| 2715 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2716 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 2717 | .dac_nids = alc880_z71v_dac_nids, |
| 2718 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2719 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2720 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2721 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2722 | .input_mux = &alc880_capture_source, |
| 2723 | }, |
| 2724 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2725 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2726 | .init_verbs = { alc880_volume_init_verbs, |
| 2727 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2728 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 2729 | .dac_nids = alc880_f1734_dac_nids, |
| 2730 | .hp_nid = 0x02, |
| 2731 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2732 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2733 | .input_mux = &alc880_capture_source, |
| 2734 | }, |
| 2735 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2736 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2737 | .init_verbs = { alc880_volume_init_verbs, |
| 2738 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2739 | alc880_gpio1_init_verbs }, |
| 2740 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2741 | .dac_nids = alc880_asus_dac_nids, |
| 2742 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2743 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2744 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2745 | .input_mux = &alc880_capture_source, |
| 2746 | }, |
| 2747 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2748 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2749 | .init_verbs = { alc880_volume_init_verbs, |
| 2750 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2751 | alc880_gpio1_init_verbs }, |
| 2752 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2753 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2754 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2755 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2756 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2757 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2758 | .input_mux = &alc880_capture_source, |
| 2759 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2760 | [ALC880_ASUS_DIG2] = { |
| 2761 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2762 | .init_verbs = { alc880_volume_init_verbs, |
| 2763 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2764 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 2765 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2766 | .dac_nids = alc880_asus_dac_nids, |
| 2767 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2768 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2769 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2770 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2771 | .input_mux = &alc880_capture_source, |
| 2772 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2773 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2774 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2775 | .init_verbs = { alc880_volume_init_verbs, |
| 2776 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2777 | alc880_gpio1_init_verbs }, |
| 2778 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2779 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2780 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2781 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2782 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2783 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2784 | .input_mux = &alc880_capture_source, |
| 2785 | }, |
| 2786 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 2787 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2788 | .init_verbs = { alc880_volume_init_verbs, |
| 2789 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2790 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2791 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2792 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2793 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2794 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2795 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2796 | .input_mux = &alc880_capture_source, |
| 2797 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2798 | [ALC880_UNIWILL] = { |
| 2799 | .mixers = { alc880_uniwill_mixer }, |
| 2800 | .init_verbs = { alc880_volume_init_verbs, |
| 2801 | alc880_uniwill_init_verbs }, |
| 2802 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2803 | .dac_nids = alc880_asus_dac_nids, |
| 2804 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2805 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2806 | .channel_mode = alc880_threestack_modes, |
| 2807 | .need_dac_fix = 1, |
| 2808 | .input_mux = &alc880_capture_source, |
| 2809 | .unsol_event = alc880_uniwill_unsol_event, |
| 2810 | .init_hook = alc880_uniwill_automute, |
| 2811 | }, |
| 2812 | [ALC880_UNIWILL_P53] = { |
| 2813 | .mixers = { alc880_uniwill_p53_mixer }, |
| 2814 | .init_verbs = { alc880_volume_init_verbs, |
| 2815 | alc880_uniwill_p53_init_verbs }, |
| 2816 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2817 | .dac_nids = alc880_asus_dac_nids, |
| 2818 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2819 | .channel_mode = alc880_threestack_modes, |
| 2820 | .input_mux = &alc880_capture_source, |
| 2821 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2822 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2823 | }, |
| 2824 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2825 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2826 | alc880_pcbeep_mixer, }, |
| 2827 | .init_verbs = { alc880_volume_init_verbs, |
| 2828 | alc880_uniwill_p53_init_verbs, |
| 2829 | alc880_beep_init_verbs }, |
| 2830 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2831 | .dac_nids = alc880_dac_nids, |
| 2832 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2833 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2834 | .input_mux = &alc880_capture_source, |
| 2835 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2836 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2837 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2838 | [ALC880_CLEVO] = { |
| 2839 | .mixers = { alc880_three_stack_mixer }, |
| 2840 | .init_verbs = { alc880_volume_init_verbs, |
| 2841 | alc880_pin_clevo_init_verbs }, |
| 2842 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2843 | .dac_nids = alc880_dac_nids, |
| 2844 | .hp_nid = 0x03, |
| 2845 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2846 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2847 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2848 | .input_mux = &alc880_capture_source, |
| 2849 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2850 | [ALC880_LG] = { |
| 2851 | .mixers = { alc880_lg_mixer }, |
| 2852 | .init_verbs = { alc880_volume_init_verbs, |
| 2853 | alc880_lg_init_verbs }, |
| 2854 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 2855 | .dac_nids = alc880_lg_dac_nids, |
| 2856 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2857 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 2858 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2859 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2860 | .input_mux = &alc880_lg_capture_source, |
| 2861 | .unsol_event = alc880_lg_unsol_event, |
| 2862 | .init_hook = alc880_lg_automute, |
| 2863 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2864 | [ALC880_LG_LW] = { |
| 2865 | .mixers = { alc880_lg_lw_mixer }, |
| 2866 | .init_verbs = { alc880_volume_init_verbs, |
| 2867 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2868 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2869 | .dac_nids = alc880_dac_nids, |
| 2870 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2871 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 2872 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2873 | .input_mux = &alc880_lg_lw_capture_source, |
| 2874 | .unsol_event = alc880_lg_lw_unsol_event, |
| 2875 | .init_hook = alc880_lg_lw_automute, |
| 2876 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2877 | #ifdef CONFIG_SND_DEBUG |
| 2878 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2879 | .mixers = { alc880_test_mixer }, |
| 2880 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2881 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 2882 | .dac_nids = alc880_test_dac_nids, |
| 2883 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2884 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 2885 | .channel_mode = alc880_test_modes, |
| 2886 | .input_mux = &alc880_test_capture_source, |
| 2887 | }, |
| 2888 | #endif |
| 2889 | }; |
| 2890 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2891 | /* |
| 2892 | * Automatic parse of I/O pins from the BIOS configuration |
| 2893 | */ |
| 2894 | |
| 2895 | #define NUM_CONTROL_ALLOC 32 |
| 2896 | #define NUM_VERB_ALLOC 32 |
| 2897 | |
| 2898 | enum { |
| 2899 | ALC_CTL_WIDGET_VOL, |
| 2900 | ALC_CTL_WIDGET_MUTE, |
| 2901 | ALC_CTL_BIND_MUTE, |
| 2902 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2903 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2904 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2905 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2906 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2907 | }; |
| 2908 | |
| 2909 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2910 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 2911 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2912 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2913 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2914 | |
| 2915 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 2916 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 2917 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2918 | /* array + terminator */ |
| 2919 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 2920 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2921 | return -ENOMEM; |
| 2922 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2923 | memcpy(knew, spec->kctl_alloc, |
| 2924 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2925 | kfree(spec->kctl_alloc); |
| 2926 | } |
| 2927 | spec->kctl_alloc = knew; |
| 2928 | spec->num_kctl_alloc = num; |
| 2929 | } |
| 2930 | |
| 2931 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 2932 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 2933 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2934 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2935 | return -ENOMEM; |
| 2936 | knew->private_value = val; |
| 2937 | spec->num_kctl_used++; |
| 2938 | return 0; |
| 2939 | } |
| 2940 | |
| 2941 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 2942 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 2943 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 2944 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 2945 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 2946 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 2947 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 2948 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 2949 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 2950 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 2951 | #define ALC880_PIN_CD_NID 0x1c |
| 2952 | |
| 2953 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2954 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 2955 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2956 | { |
| 2957 | hda_nid_t nid; |
| 2958 | int assigned[4]; |
| 2959 | int i, j; |
| 2960 | |
| 2961 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2962 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2963 | |
| 2964 | /* check the pins hardwired to audio widget */ |
| 2965 | for (i = 0; i < cfg->line_outs; i++) { |
| 2966 | nid = cfg->line_out_pins[i]; |
| 2967 | if (alc880_is_fixed_pin(nid)) { |
| 2968 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 2969 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2970 | assigned[idx] = 1; |
| 2971 | } |
| 2972 | } |
| 2973 | /* left pins can be connect to any audio widget */ |
| 2974 | for (i = 0; i < cfg->line_outs; i++) { |
| 2975 | nid = cfg->line_out_pins[i]; |
| 2976 | if (alc880_is_fixed_pin(nid)) |
| 2977 | continue; |
| 2978 | /* search for an empty channel */ |
| 2979 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2980 | if (!assigned[j]) { |
| 2981 | spec->multiout.dac_nids[i] = |
| 2982 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2983 | assigned[j] = 1; |
| 2984 | break; |
| 2985 | } |
| 2986 | } |
| 2987 | } |
| 2988 | spec->multiout.num_dacs = cfg->line_outs; |
| 2989 | return 0; |
| 2990 | } |
| 2991 | |
| 2992 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2993 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 2994 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2995 | { |
| 2996 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2997 | static const char *chname[4] = { |
| 2998 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 2999 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3000 | hda_nid_t nid; |
| 3001 | int i, err; |
| 3002 | |
| 3003 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3004 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3005 | continue; |
| 3006 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3007 | if (i == 2) { |
| 3008 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3009 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3010 | "Center Playback Volume", |
| 3011 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3012 | HDA_OUTPUT)); |
| 3013 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3014 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3015 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3016 | "LFE Playback Volume", |
| 3017 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3018 | HDA_OUTPUT)); |
| 3019 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3020 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3021 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3022 | "Center Playback Switch", |
| 3023 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3024 | HDA_INPUT)); |
| 3025 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3026 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3027 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3028 | "LFE Playback Switch", |
| 3029 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3030 | HDA_INPUT)); |
| 3031 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3032 | return err; |
| 3033 | } else { |
| 3034 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3035 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3036 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3037 | HDA_OUTPUT)); |
| 3038 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3039 | return err; |
| 3040 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3041 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3042 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3043 | HDA_INPUT)); |
| 3044 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3045 | return err; |
| 3046 | } |
| 3047 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3048 | return 0; |
| 3049 | } |
| 3050 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3051 | /* add playback controls for speaker and HP outputs */ |
| 3052 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3053 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3054 | { |
| 3055 | hda_nid_t nid; |
| 3056 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3057 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3058 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3059 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3060 | return 0; |
| 3061 | |
| 3062 | if (alc880_is_fixed_pin(pin)) { |
| 3063 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3064 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3065 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3066 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3067 | else |
| 3068 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3069 | /* control HP volume/switch on the output mixer amp */ |
| 3070 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3071 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3072 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3073 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3074 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3075 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3076 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3077 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3078 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3079 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3080 | return err; |
| 3081 | } else if (alc880_is_multi_pin(pin)) { |
| 3082 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3083 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3084 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3085 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3086 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3087 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3088 | return err; |
| 3089 | } |
| 3090 | return 0; |
| 3091 | } |
| 3092 | |
| 3093 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3094 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3095 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3096 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3097 | { |
| 3098 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3099 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3100 | |
| 3101 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3102 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3103 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3104 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3105 | return err; |
| 3106 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3107 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3108 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3109 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3110 | return err; |
| 3111 | return 0; |
| 3112 | } |
| 3113 | |
| 3114 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3115 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3116 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3117 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3118 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3119 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3120 | |
| 3121 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3122 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3123 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3124 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3125 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3126 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3127 | if (err < 0) |
| 3128 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3129 | imux->items[imux->num_items].label = |
| 3130 | auto_pin_cfg_labels[i]; |
| 3131 | imux->items[imux->num_items].index = |
| 3132 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3133 | imux->num_items++; |
| 3134 | } |
| 3135 | } |
| 3136 | return 0; |
| 3137 | } |
| 3138 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3139 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3140 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3141 | int dac_idx) |
| 3142 | { |
| 3143 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3144 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3145 | pin_type); |
| 3146 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3147 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3148 | /* need the manual connection? */ |
| 3149 | if (alc880_is_multi_pin(nid)) { |
| 3150 | struct alc_spec *spec = codec->spec; |
| 3151 | int idx = alc880_multi_pin_idx(nid); |
| 3152 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3153 | AC_VERB_SET_CONNECT_SEL, |
| 3154 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3155 | } |
| 3156 | } |
| 3157 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3158 | static int get_pin_type(int line_out_type) |
| 3159 | { |
| 3160 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3161 | return PIN_HP; |
| 3162 | else |
| 3163 | return PIN_OUT; |
| 3164 | } |
| 3165 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3166 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3167 | { |
| 3168 | struct alc_spec *spec = codec->spec; |
| 3169 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3170 | |
| 3171 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3172 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3173 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3174 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3175 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3176 | } |
| 3177 | } |
| 3178 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3179 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3180 | { |
| 3181 | struct alc_spec *spec = codec->spec; |
| 3182 | hda_nid_t pin; |
| 3183 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3184 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3185 | if (pin) /* connect to front */ |
| 3186 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3187 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3188 | if (pin) /* connect to front */ |
| 3189 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3190 | } |
| 3191 | |
| 3192 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3193 | { |
| 3194 | struct alc_spec *spec = codec->spec; |
| 3195 | int i; |
| 3196 | |
| 3197 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3198 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3199 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3200 | snd_hda_codec_write(codec, nid, 0, |
| 3201 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3202 | i <= AUTO_PIN_FRONT_MIC ? |
| 3203 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3204 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3205 | snd_hda_codec_write(codec, nid, 0, |
| 3206 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3207 | AMP_OUT_MUTE); |
| 3208 | } |
| 3209 | } |
| 3210 | } |
| 3211 | |
| 3212 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3213 | /* return 1 if successful, 0 if the proper config is not found, |
| 3214 | * or a negative error code |
| 3215 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3216 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3217 | { |
| 3218 | struct alc_spec *spec = codec->spec; |
| 3219 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3220 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3221 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3222 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3223 | alc880_ignore); |
| 3224 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3225 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3226 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3227 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3228 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3229 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3230 | if (err < 0) |
| 3231 | return err; |
| 3232 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3233 | if (err < 0) |
| 3234 | return err; |
| 3235 | err = alc880_auto_create_extra_out(spec, |
| 3236 | spec->autocfg.speaker_pins[0], |
| 3237 | "Speaker"); |
| 3238 | if (err < 0) |
| 3239 | return err; |
| 3240 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3241 | "Headphone"); |
| 3242 | if (err < 0) |
| 3243 | return err; |
| 3244 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3245 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3246 | return err; |
| 3247 | |
| 3248 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3249 | |
| 3250 | if (spec->autocfg.dig_out_pin) |
| 3251 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3252 | if (spec->autocfg.dig_in_pin) |
| 3253 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3254 | |
| 3255 | if (spec->kctl_alloc) |
| 3256 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3257 | |
| 3258 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3259 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3260 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3261 | spec->input_mux = &spec->private_imux; |
| 3262 | |
| 3263 | return 1; |
| 3264 | } |
| 3265 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3266 | /* additional initialization for auto-configuration model */ |
| 3267 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3268 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3269 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3270 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3271 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3272 | } |
| 3273 | |
| 3274 | /* |
| 3275 | * OK, here we have finally the patch for ALC880 |
| 3276 | */ |
| 3277 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3278 | static int patch_alc880(struct hda_codec *codec) |
| 3279 | { |
| 3280 | struct alc_spec *spec; |
| 3281 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3282 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3283 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3284 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3285 | if (spec == NULL) |
| 3286 | return -ENOMEM; |
| 3287 | |
| 3288 | codec->spec = spec; |
| 3289 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3290 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3291 | alc880_models, |
| 3292 | alc880_cfg_tbl); |
| 3293 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3294 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3295 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3296 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3297 | } |
| 3298 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3299 | if (board_config == ALC880_AUTO) { |
| 3300 | /* automatic parse from the BIOS config */ |
| 3301 | err = alc880_parse_auto_config(codec); |
| 3302 | if (err < 0) { |
| 3303 | alc_free(codec); |
| 3304 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3305 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3306 | printk(KERN_INFO |
| 3307 | "hda_codec: Cannot set up configuration " |
| 3308 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3309 | board_config = ALC880_3ST; |
| 3310 | } |
| 3311 | } |
| 3312 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3313 | if (board_config != ALC880_AUTO) |
| 3314 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3315 | |
| 3316 | spec->stream_name_analog = "ALC880 Analog"; |
| 3317 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3318 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3319 | |
| 3320 | spec->stream_name_digital = "ALC880 Digital"; |
| 3321 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3322 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3323 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3324 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3325 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3326 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3327 | /* get type */ |
| 3328 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3329 | if (wcap != AC_WID_AUD_IN) { |
| 3330 | spec->adc_nids = alc880_adc_nids_alt; |
| 3331 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3332 | spec->mixers[spec->num_mixers] = |
| 3333 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3334 | spec->num_mixers++; |
| 3335 | } else { |
| 3336 | spec->adc_nids = alc880_adc_nids; |
| 3337 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3338 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3339 | spec->num_mixers++; |
| 3340 | } |
| 3341 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3342 | |
| 3343 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3344 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3345 | spec->init_hook = alc880_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3346 | |
| 3347 | return 0; |
| 3348 | } |
| 3349 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3350 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3351 | /* |
| 3352 | * ALC260 support |
| 3353 | */ |
| 3354 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3355 | static hda_nid_t alc260_dac_nids[1] = { |
| 3356 | /* front */ |
| 3357 | 0x02, |
| 3358 | }; |
| 3359 | |
| 3360 | static hda_nid_t alc260_adc_nids[1] = { |
| 3361 | /* ADC0 */ |
| 3362 | 0x04, |
| 3363 | }; |
| 3364 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3365 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3366 | /* ADC1 */ |
| 3367 | 0x05, |
| 3368 | }; |
| 3369 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3370 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3371 | /* ADC1, 0 */ |
| 3372 | 0x05, 0x04 |
| 3373 | }; |
| 3374 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3375 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3376 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3377 | */ |
| 3378 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3379 | /* ADC0, ADC1 */ |
| 3380 | 0x04, 0x05 |
| 3381 | }; |
| 3382 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3383 | #define ALC260_DIGOUT_NID 0x03 |
| 3384 | #define ALC260_DIGIN_NID 0x06 |
| 3385 | |
| 3386 | static struct hda_input_mux alc260_capture_source = { |
| 3387 | .num_items = 4, |
| 3388 | .items = { |
| 3389 | { "Mic", 0x0 }, |
| 3390 | { "Front Mic", 0x1 }, |
| 3391 | { "Line", 0x2 }, |
| 3392 | { "CD", 0x4 }, |
| 3393 | }, |
| 3394 | }; |
| 3395 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3396 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3397 | * headphone jack and the internal CD lines since these are the only pins at |
| 3398 | * which audio can appear. For flexibility, also allow the option of |
| 3399 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3400 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3401 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3402 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3403 | { |
| 3404 | .num_items = 3, |
| 3405 | .items = { |
| 3406 | { "Mic/Line", 0x0 }, |
| 3407 | { "CD", 0x4 }, |
| 3408 | { "Headphone", 0x2 }, |
| 3409 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3410 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3411 | { |
| 3412 | .num_items = 4, |
| 3413 | .items = { |
| 3414 | { "Mic/Line", 0x0 }, |
| 3415 | { "CD", 0x4 }, |
| 3416 | { "Headphone", 0x2 }, |
| 3417 | { "Mixer", 0x5 }, |
| 3418 | }, |
| 3419 | }, |
| 3420 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3421 | }; |
| 3422 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3423 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3424 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3425 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3426 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3427 | { |
| 3428 | .num_items = 4, |
| 3429 | .items = { |
| 3430 | { "Mic", 0x0 }, |
| 3431 | { "Line", 0x2 }, |
| 3432 | { "CD", 0x4 }, |
| 3433 | { "Headphone", 0x5 }, |
| 3434 | }, |
| 3435 | }, |
| 3436 | { |
| 3437 | .num_items = 5, |
| 3438 | .items = { |
| 3439 | { "Mic", 0x0 }, |
| 3440 | { "Line", 0x2 }, |
| 3441 | { "CD", 0x4 }, |
| 3442 | { "Headphone", 0x6 }, |
| 3443 | { "Mixer", 0x5 }, |
| 3444 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3445 | }, |
| 3446 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3447 | /* |
| 3448 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3449 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3450 | * element which allows changing the channel mode, so the verb list is |
| 3451 | * never used. |
| 3452 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3453 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3454 | { 2, NULL }, |
| 3455 | }; |
| 3456 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3457 | |
| 3458 | /* Mixer combinations |
| 3459 | * |
| 3460 | * basic: base_output + input + pc_beep + capture |
| 3461 | * HP: base_output + input + capture_alt |
| 3462 | * HP_3013: hp_3013 + input + capture |
| 3463 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3464 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3465 | */ |
| 3466 | |
| 3467 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3468 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3469 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3470 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3471 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3472 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3473 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3474 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3475 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3476 | |
| 3477 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3478 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3479 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3480 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3481 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3482 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3483 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3484 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3485 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3486 | { } /* end */ |
| 3487 | }; |
| 3488 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3489 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3490 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3491 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3492 | { } /* end */ |
| 3493 | }; |
| 3494 | |
| 3495 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3496 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3497 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3498 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3499 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3500 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3501 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3502 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3503 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3504 | { } /* end */ |
| 3505 | }; |
| 3506 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3507 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3508 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3509 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3510 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3511 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3512 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3513 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3514 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3515 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3516 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3517 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3518 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3519 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3520 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3521 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3522 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3523 | { } /* end */ |
| 3524 | }; |
| 3525 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3526 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3527 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3528 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3529 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3530 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3531 | * revisions available in early 2006. Therefore for now allow the |
| 3532 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3533 | * that the lack of mic bias for this NID is intentional we could change the |
| 3534 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3535 | * |
| 3536 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3537 | * don't appear to make the mic bias available from the "line" jack, even |
| 3538 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3539 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3540 | * and the output jack. If this turns out to be the case for all such |
| 3541 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3542 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3543 | * |
| 3544 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3545 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 3546 | * controls for such models. On models without a "mono speaker" the control |
| 3547 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3548 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3549 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3550 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3551 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3552 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3553 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3554 | HDA_OUTPUT), |
| 3555 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 3556 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3557 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3558 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3559 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3560 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3561 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3562 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3563 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3564 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3565 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3566 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3567 | { } /* end */ |
| 3568 | }; |
| 3569 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3570 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 3571 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 3572 | */ |
| 3573 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 3574 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3575 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3577 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3578 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3579 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3580 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3581 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3582 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3583 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3584 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3585 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3586 | { } /* end */ |
| 3587 | }; |
| 3588 | |
| 3589 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 3590 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 3591 | */ |
| 3592 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 3593 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3594 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3595 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3596 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3597 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3598 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 3599 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 3600 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3601 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3602 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3603 | { } /* end */ |
| 3604 | }; |
| 3605 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3606 | /* capture mixer elements */ |
| 3607 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3608 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3609 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3610 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3611 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3612 | { |
| 3613 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3614 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3615 | * So call somewhat different.. |
| 3616 | * FIXME: the controls appear in the "playback" view! |
| 3617 | */ |
| 3618 | /* .name = "Capture Source", */ |
| 3619 | .name = "Input Source", |
| 3620 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3621 | .info = alc_mux_enum_info, |
| 3622 | .get = alc_mux_enum_get, |
| 3623 | .put = alc_mux_enum_put, |
| 3624 | }, |
| 3625 | { } /* end */ |
| 3626 | }; |
| 3627 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3628 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3629 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3630 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3631 | { |
| 3632 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3633 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3634 | * So call somewhat different.. |
| 3635 | * FIXME: the controls appear in the "playback" view! |
| 3636 | */ |
| 3637 | /* .name = "Capture Source", */ |
| 3638 | .name = "Input Source", |
| 3639 | .count = 1, |
| 3640 | .info = alc_mux_enum_info, |
| 3641 | .get = alc_mux_enum_get, |
| 3642 | .put = alc_mux_enum_put, |
| 3643 | }, |
| 3644 | { } /* end */ |
| 3645 | }; |
| 3646 | |
| 3647 | /* |
| 3648 | * initialization verbs |
| 3649 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3650 | static struct hda_verb alc260_init_verbs[] = { |
| 3651 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3652 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3653 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3654 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3655 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3656 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3657 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3658 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3659 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3660 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3661 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3662 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3663 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3664 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3665 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3666 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3667 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3668 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3669 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3670 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3671 | /* set connection select to line in (default select for this ADC) */ |
| 3672 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3673 | /* mute capture amp left and right */ |
| 3674 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3675 | /* set connection select to line in (default select for this ADC) */ |
| 3676 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3677 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3678 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3679 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3680 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3681 | /* set vol=0 HP mixer amp left and right */ |
| 3682 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3683 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3684 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3685 | /* set vol=0 Mono mixer amp left and right */ |
| 3686 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3687 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3688 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3689 | /* unmute LINE-2 out pin */ |
| 3690 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3691 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3692 | * Line In 2 = 0x03 |
| 3693 | */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3694 | /* mute CD */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3696 | /* mute Line In */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3698 | /* mute Mic */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3700 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3701 | /* mute Front out path */ |
| 3702 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3703 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3704 | /* mute Headphone out path */ |
| 3705 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3706 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3707 | /* mute Mono out path */ |
| 3708 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3709 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3710 | { } |
| 3711 | }; |
| 3712 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3713 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3714 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 3715 | /* Headphone and output */ |
| 3716 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3717 | /* mono output */ |
| 3718 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3719 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3720 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3721 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3722 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3723 | /* Line In pin widget for input */ |
| 3724 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3725 | /* Line-2 pin widget for output */ |
| 3726 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3727 | /* CD pin widget for input */ |
| 3728 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3729 | /* unmute amp left and right */ |
| 3730 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3731 | /* set connection select to line in (default select for this ADC) */ |
| 3732 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3733 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3734 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3735 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3736 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3737 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3738 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3739 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3740 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3741 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3742 | * Line In 2 = 0x03 |
| 3743 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3744 | /* unmute CD */ |
| 3745 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3746 | /* unmute Line In */ |
| 3747 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3748 | /* unmute Mic */ |
| 3749 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3750 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3751 | /* Unmute Front out path */ |
| 3752 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3753 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3754 | /* Unmute Headphone out path */ |
| 3755 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3756 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3757 | /* Unmute Mono out path */ |
| 3758 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3759 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3760 | { } |
| 3761 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3762 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3763 | |
| 3764 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 3765 | /* Line out and output */ |
| 3766 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3767 | /* mono output */ |
| 3768 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3769 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3770 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3771 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3772 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3773 | /* Line In pin widget for input */ |
| 3774 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3775 | /* Headphone pin widget for output */ |
| 3776 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3777 | /* CD pin widget for input */ |
| 3778 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3779 | /* unmute amp left and right */ |
| 3780 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3781 | /* set connection select to line in (default select for this ADC) */ |
| 3782 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3783 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3784 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3785 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3786 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3787 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3788 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3789 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3790 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3791 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3792 | * Line In 2 = 0x03 |
| 3793 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3794 | /* unmute CD */ |
| 3795 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3796 | /* unmute Line In */ |
| 3797 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3798 | /* unmute Mic */ |
| 3799 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3800 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3801 | /* Unmute Front out path */ |
| 3802 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3803 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3804 | /* Unmute Headphone out path */ |
| 3805 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3806 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3807 | /* Unmute Mono out path */ |
| 3808 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3809 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3810 | { } |
| 3811 | }; |
| 3812 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3813 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3814 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 3815 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3816 | */ |
| 3817 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 3818 | /* Disable all GPIOs */ |
| 3819 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 3820 | /* Internal speaker is connected to headphone pin */ |
| 3821 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3822 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 3823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3824 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 3825 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3826 | /* Ensure all other unused pins are disabled and muted. */ |
| 3827 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3828 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3829 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3830 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3831 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3832 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3833 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3834 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3835 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3836 | /* Disable digital (SPDIF) pins */ |
| 3837 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3838 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3839 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3840 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 3841 | * when acting as an output. |
| 3842 | */ |
| 3843 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3844 | |
| 3845 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 3846 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3847 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3848 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3849 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3850 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3851 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3852 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3853 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3854 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3855 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3856 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 3857 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3858 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 3859 | * If the pin mode is changed by the user the pin mode control will |
| 3860 | * take care of enabling the pin's input/output buffers as needed. |
| 3861 | * Therefore there's no need to enable the input buffer at this |
| 3862 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3863 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3864 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3865 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 3866 | * mixer ctrl) |
| 3867 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3868 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3869 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3870 | /* Mute capture amp left and right */ |
| 3871 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3872 | /* Set ADC connection select to match default mixer setting - line |
| 3873 | * in (on mic1 pin) |
| 3874 | */ |
| 3875 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
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 | /* Do the same for the second ADC: mute capture input amp and |
| 3878 | * set ADC connection to line in (on mic1 pin) |
| 3879 | */ |
| 3880 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3881 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3882 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3883 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3884 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3885 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3886 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3887 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3888 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3889 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3890 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3891 | {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] | 3892 | |
| 3893 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3894 | }; |
| 3895 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3896 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 3897 | * similar laptops (adapted from Fujitsu init verbs). |
| 3898 | */ |
| 3899 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 3900 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 3901 | * the headphone jack. Turn this on and rely on the standard mute |
| 3902 | * methods whenever the user wants to turn these outputs off. |
| 3903 | */ |
| 3904 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 3905 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3906 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 3907 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 3908 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3909 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 3910 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 3911 | /* Line In jack is connected to Line1 pin */ |
| 3912 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3913 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 3914 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3915 | /* Ensure all other unused pins are disabled and muted. */ |
| 3916 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3917 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3918 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3919 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3920 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3921 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3922 | /* Disable digital (SPDIF) pins */ |
| 3923 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3924 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3925 | |
| 3926 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 3927 | * bus when acting as outputs. |
| 3928 | */ |
| 3929 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3930 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3931 | |
| 3932 | /* Start with output sum widgets muted and their output gains at min */ |
| 3933 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3934 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3935 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3936 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3937 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3938 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3939 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3940 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3941 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3942 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3943 | /* Unmute Line-out pin widget amp left and right |
| 3944 | * (no equiv mixer ctrl) |
| 3945 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3946 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3947 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 3948 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3949 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 3950 | * inputs. If the pin mode is changed by the user the pin mode control |
| 3951 | * will take care of enabling the pin's input/output buffers as needed. |
| 3952 | * Therefore there's no need to enable the input buffer at this |
| 3953 | * stage. |
| 3954 | */ |
| 3955 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3956 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3957 | |
| 3958 | /* Mute capture amp left and right */ |
| 3959 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3960 | /* Set ADC connection select to match default mixer setting - mic |
| 3961 | * (on mic1 pin) |
| 3962 | */ |
| 3963 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3964 | |
| 3965 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3966 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3967 | */ |
| 3968 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3969 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3970 | |
| 3971 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3972 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3973 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3974 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3975 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3976 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3977 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3978 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3979 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 3980 | |
| 3981 | { } |
| 3982 | }; |
| 3983 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3984 | static struct hda_verb alc260_will_verbs[] = { |
| 3985 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3986 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3987 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3988 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 3989 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3990 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 3991 | {} |
| 3992 | }; |
| 3993 | |
| 3994 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 3995 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 3996 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3997 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 3998 | |
| 3999 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4000 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4001 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4002 | |
| 4003 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4004 | {} |
| 4005 | }; |
| 4006 | |
| 4007 | /* toggle speaker-output according to the hp-jack state */ |
| 4008 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4009 | { |
| 4010 | unsigned int present; |
| 4011 | |
| 4012 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4013 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4014 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4015 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4016 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4017 | AC_VERB_SET_GPIO_DATA, 1); |
| 4018 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4019 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4020 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4021 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4022 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4023 | AC_VERB_SET_GPIO_DATA, 0); |
| 4024 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4025 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4026 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4027 | } |
| 4028 | } |
| 4029 | |
| 4030 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4031 | unsigned int res) |
| 4032 | { |
| 4033 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4034 | alc260_replacer_672v_automute(codec); |
| 4035 | } |
| 4036 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4037 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4038 | * configuration. |
| 4039 | */ |
| 4040 | #ifdef CONFIG_SND_DEBUG |
| 4041 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4042 | 0x02, |
| 4043 | }; |
| 4044 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4045 | 0x04, 0x05, |
| 4046 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4047 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4048 | * the signal assignments are different. This assumes that the first ADC |
| 4049 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4050 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4051 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4052 | { |
| 4053 | .num_items = 7, |
| 4054 | .items = { |
| 4055 | { "MIC1 pin", 0x0 }, |
| 4056 | { "MIC2 pin", 0x1 }, |
| 4057 | { "LINE1 pin", 0x2 }, |
| 4058 | { "LINE2 pin", 0x3 }, |
| 4059 | { "CD pin", 0x4 }, |
| 4060 | { "LINE-OUT pin", 0x5 }, |
| 4061 | { "HP-OUT pin", 0x6 }, |
| 4062 | }, |
| 4063 | }, |
| 4064 | { |
| 4065 | .num_items = 8, |
| 4066 | .items = { |
| 4067 | { "MIC1 pin", 0x0 }, |
| 4068 | { "MIC2 pin", 0x1 }, |
| 4069 | { "LINE1 pin", 0x2 }, |
| 4070 | { "LINE2 pin", 0x3 }, |
| 4071 | { "CD pin", 0x4 }, |
| 4072 | { "Mixer", 0x5 }, |
| 4073 | { "LINE-OUT pin", 0x6 }, |
| 4074 | { "HP-OUT pin", 0x7 }, |
| 4075 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4076 | }, |
| 4077 | }; |
| 4078 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4079 | /* Output driver widgets */ |
| 4080 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4081 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4082 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4083 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4084 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4085 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4086 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4087 | /* Modes for retasking pin widgets |
| 4088 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4089 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4090 | * mention this restriction. At this stage it's not clear whether |
| 4091 | * this behaviour is intentional or is a hardware bug in chip |
| 4092 | * revisions available at least up until early 2006. Therefore for |
| 4093 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4094 | * choices, but if it turns out that the lack of mic bias for these |
| 4095 | * NIDs is intentional we could change their modes from |
| 4096 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4097 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4098 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4099 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4100 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4101 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4102 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4103 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4104 | |
| 4105 | /* Loopback mixer controls */ |
| 4106 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4107 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4108 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4109 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4110 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4111 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4112 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4113 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4114 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4115 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4116 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4117 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4118 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4119 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4120 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4121 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4122 | |
| 4123 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4124 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4125 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4126 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4127 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4128 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4129 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4130 | * is ambigious as to which NID is which; testing on laptops which |
| 4131 | * make this output available should provide clarification. |
| 4132 | */ |
| 4133 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4134 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4135 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4136 | { } /* end */ |
| 4137 | }; |
| 4138 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4139 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4140 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4141 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4142 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4143 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4144 | /* Enable retasking pins as output, initially without power amp */ |
| 4145 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4146 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4147 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4148 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4149 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4150 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4151 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4152 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4153 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4154 | * payload also sets the generation to 0, output to be in "consumer" |
| 4155 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4156 | * control. |
| 4157 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4158 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4159 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4160 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4161 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4162 | * OUT1 sum bus when acting as an output. |
| 4163 | */ |
| 4164 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4165 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4166 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4167 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4168 | |
| 4169 | /* Start with output sum widgets muted and their output gains at min */ |
| 4170 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4171 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4172 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4173 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4174 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4175 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4176 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4177 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4178 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4179 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4180 | /* Unmute retasking pin widget output buffers since the default |
| 4181 | * state appears to be output. As the pin mode is changed by the |
| 4182 | * user the pin mode control will take care of enabling the pin's |
| 4183 | * input/output buffers as needed. |
| 4184 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4185 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4186 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4188 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4189 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4190 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4191 | /* Also unmute the mono-out pin widget */ |
| 4192 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4193 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4194 | /* Mute capture amp left and right */ |
| 4195 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4196 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4197 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4198 | */ |
| 4199 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4200 | |
| 4201 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4202 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4203 | */ |
| 4204 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4205 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4206 | |
| 4207 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4208 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4209 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4210 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4211 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4212 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4213 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4214 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4215 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4216 | |
| 4217 | { } |
| 4218 | }; |
| 4219 | #endif |
| 4220 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4221 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 4222 | .substreams = 1, |
| 4223 | .channels_min = 2, |
| 4224 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4225 | }; |
| 4226 | |
| 4227 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 4228 | .substreams = 1, |
| 4229 | .channels_min = 2, |
| 4230 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4231 | }; |
| 4232 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4233 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4234 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4235 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4236 | /* |
| 4237 | * for BIOS auto-configuration |
| 4238 | */ |
| 4239 | |
| 4240 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4241 | const char *pfx) |
| 4242 | { |
| 4243 | hda_nid_t nid_vol; |
| 4244 | unsigned long vol_val, sw_val; |
| 4245 | char name[32]; |
| 4246 | int err; |
| 4247 | |
| 4248 | if (nid >= 0x0f && nid < 0x11) { |
| 4249 | nid_vol = nid - 0x7; |
| 4250 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4251 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4252 | } else if (nid == 0x11) { |
| 4253 | nid_vol = nid - 0x7; |
| 4254 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4255 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4256 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4257 | nid_vol = 0x08; |
| 4258 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4259 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4260 | } else |
| 4261 | return 0; /* N/A */ |
| 4262 | |
| 4263 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4264 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4265 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4266 | return err; |
| 4267 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4268 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4269 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4270 | return err; |
| 4271 | return 1; |
| 4272 | } |
| 4273 | |
| 4274 | /* add playback controls from the parsed DAC table */ |
| 4275 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4276 | const struct auto_pin_cfg *cfg) |
| 4277 | { |
| 4278 | hda_nid_t nid; |
| 4279 | int err; |
| 4280 | |
| 4281 | spec->multiout.num_dacs = 1; |
| 4282 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4283 | spec->multiout.dac_nids[0] = 0x02; |
| 4284 | |
| 4285 | nid = cfg->line_out_pins[0]; |
| 4286 | if (nid) { |
| 4287 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4288 | if (err < 0) |
| 4289 | return err; |
| 4290 | } |
| 4291 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4292 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4293 | if (nid) { |
| 4294 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4295 | if (err < 0) |
| 4296 | return err; |
| 4297 | } |
| 4298 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4299 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4300 | if (nid) { |
| 4301 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4302 | if (err < 0) |
| 4303 | return err; |
| 4304 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4305 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4306 | } |
| 4307 | |
| 4308 | /* create playback/capture controls for input pins */ |
| 4309 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4310 | const struct auto_pin_cfg *cfg) |
| 4311 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4312 | struct hda_input_mux *imux = &spec->private_imux; |
| 4313 | int i, err, idx; |
| 4314 | |
| 4315 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4316 | if (cfg->input_pins[i] >= 0x12) { |
| 4317 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4318 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4319 | auto_pin_cfg_labels[i], idx, |
| 4320 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4321 | if (err < 0) |
| 4322 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4323 | imux->items[imux->num_items].label = |
| 4324 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4325 | imux->items[imux->num_items].index = idx; |
| 4326 | imux->num_items++; |
| 4327 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4328 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4329 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4330 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4331 | auto_pin_cfg_labels[i], idx, |
| 4332 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4333 | if (err < 0) |
| 4334 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4335 | imux->items[imux->num_items].label = |
| 4336 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4337 | imux->items[imux->num_items].index = idx; |
| 4338 | imux->num_items++; |
| 4339 | } |
| 4340 | } |
| 4341 | return 0; |
| 4342 | } |
| 4343 | |
| 4344 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4345 | hda_nid_t nid, int pin_type, |
| 4346 | int sel_idx) |
| 4347 | { |
| 4348 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4349 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4350 | pin_type); |
| 4351 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4352 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4353 | /* need the manual connection? */ |
| 4354 | if (nid >= 0x12) { |
| 4355 | int idx = nid - 0x12; |
| 4356 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4357 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4358 | } |
| 4359 | } |
| 4360 | |
| 4361 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4362 | { |
| 4363 | struct alc_spec *spec = codec->spec; |
| 4364 | hda_nid_t nid; |
| 4365 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4366 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4367 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4368 | if (nid) { |
| 4369 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4370 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4371 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4372 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4373 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4374 | if (nid) |
| 4375 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4376 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4377 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4378 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4379 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4380 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4381 | |
| 4382 | #define ALC260_PIN_CD_NID 0x16 |
| 4383 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4384 | { |
| 4385 | struct alc_spec *spec = codec->spec; |
| 4386 | int i; |
| 4387 | |
| 4388 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4389 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4390 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4391 | snd_hda_codec_write(codec, nid, 0, |
| 4392 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4393 | i <= AUTO_PIN_FRONT_MIC ? |
| 4394 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4395 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4396 | snd_hda_codec_write(codec, nid, 0, |
| 4397 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4398 | AMP_OUT_MUTE); |
| 4399 | } |
| 4400 | } |
| 4401 | } |
| 4402 | |
| 4403 | /* |
| 4404 | * generic initialization of ADC, input mixers and output mixers |
| 4405 | */ |
| 4406 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4407 | /* |
| 4408 | * Unmute ADC0-1 and set the default input to mic-in |
| 4409 | */ |
| 4410 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4411 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4412 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4413 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4414 | |
| 4415 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4416 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4417 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4418 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4419 | */ |
| 4420 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 4421 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4422 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4423 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 4424 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 4425 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 4426 | |
| 4427 | /* |
| 4428 | * Set up output mixers (0x08 - 0x0a) |
| 4429 | */ |
| 4430 | /* set vol=0 to output mixers */ |
| 4431 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4432 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4433 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4434 | /* set up input amps for analog loopback */ |
| 4435 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4436 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4437 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4438 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4439 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4440 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4441 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4442 | |
| 4443 | { } |
| 4444 | }; |
| 4445 | |
| 4446 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4447 | { |
| 4448 | struct alc_spec *spec = codec->spec; |
| 4449 | unsigned int wcap; |
| 4450 | int err; |
| 4451 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4452 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4453 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4454 | alc260_ignore); |
| 4455 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4456 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4457 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4458 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4459 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4460 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4461 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4462 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4463 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4464 | return err; |
| 4465 | |
| 4466 | spec->multiout.max_channels = 2; |
| 4467 | |
| 4468 | if (spec->autocfg.dig_out_pin) |
| 4469 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4470 | if (spec->kctl_alloc) |
| 4471 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4472 | |
| 4473 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4474 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4475 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4476 | spec->input_mux = &spec->private_imux; |
| 4477 | |
| 4478 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4479 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4480 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4481 | if (wcap != AC_WID_AUD_IN) { |
| 4482 | spec->adc_nids = alc260_adc_nids_alt; |
| 4483 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4484 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4485 | } else { |
| 4486 | spec->adc_nids = alc260_adc_nids; |
| 4487 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4488 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4489 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4490 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4491 | |
| 4492 | return 1; |
| 4493 | } |
| 4494 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4495 | /* additional initialization for auto-configuration model */ |
| 4496 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4497 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4498 | alc260_auto_init_multi_out(codec); |
| 4499 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4500 | } |
| 4501 | |
| 4502 | /* |
| 4503 | * ALC260 configurations |
| 4504 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4505 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4506 | [ALC260_BASIC] = "basic", |
| 4507 | [ALC260_HP] = "hp", |
| 4508 | [ALC260_HP_3013] = "hp-3013", |
| 4509 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4510 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4511 | [ALC260_WILL] = "will", |
| 4512 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4513 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4514 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4515 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4516 | [ALC260_AUTO] = "auto", |
| 4517 | }; |
| 4518 | |
| 4519 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4520 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4521 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4522 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4523 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4524 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4525 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4526 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4527 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4528 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4529 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4530 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4531 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4532 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4533 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4534 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4535 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4536 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
| 4537 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4538 | {} |
| 4539 | }; |
| 4540 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4541 | static struct alc_config_preset alc260_presets[] = { |
| 4542 | [ALC260_BASIC] = { |
| 4543 | .mixers = { alc260_base_output_mixer, |
| 4544 | alc260_input_mixer, |
| 4545 | alc260_pc_beep_mixer, |
| 4546 | alc260_capture_mixer }, |
| 4547 | .init_verbs = { alc260_init_verbs }, |
| 4548 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4549 | .dac_nids = alc260_dac_nids, |
| 4550 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4551 | .adc_nids = alc260_adc_nids, |
| 4552 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4553 | .channel_mode = alc260_modes, |
| 4554 | .input_mux = &alc260_capture_source, |
| 4555 | }, |
| 4556 | [ALC260_HP] = { |
| 4557 | .mixers = { alc260_base_output_mixer, |
| 4558 | alc260_input_mixer, |
| 4559 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4560 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4561 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4562 | .dac_nids = alc260_dac_nids, |
| 4563 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4564 | .adc_nids = alc260_hp_adc_nids, |
| 4565 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4566 | .channel_mode = alc260_modes, |
| 4567 | .input_mux = &alc260_capture_source, |
| 4568 | }, |
| 4569 | [ALC260_HP_3013] = { |
| 4570 | .mixers = { alc260_hp_3013_mixer, |
| 4571 | alc260_input_mixer, |
| 4572 | alc260_capture_alt_mixer }, |
| 4573 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4574 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4575 | .dac_nids = alc260_dac_nids, |
| 4576 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4577 | .adc_nids = alc260_hp_adc_nids, |
| 4578 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4579 | .channel_mode = alc260_modes, |
| 4580 | .input_mux = &alc260_capture_source, |
| 4581 | }, |
| 4582 | [ALC260_FUJITSU_S702X] = { |
| 4583 | .mixers = { alc260_fujitsu_mixer, |
| 4584 | alc260_capture_mixer }, |
| 4585 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4586 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4587 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4588 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4589 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4590 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4591 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4592 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4593 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4594 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4595 | [ALC260_ACER] = { |
| 4596 | .mixers = { alc260_acer_mixer, |
| 4597 | alc260_capture_mixer }, |
| 4598 | .init_verbs = { alc260_acer_init_verbs }, |
| 4599 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4600 | .dac_nids = alc260_dac_nids, |
| 4601 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4602 | .adc_nids = alc260_dual_adc_nids, |
| 4603 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4604 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4605 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4606 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4607 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4608 | [ALC260_WILL] = { |
| 4609 | .mixers = { alc260_will_mixer, |
| 4610 | alc260_capture_mixer }, |
| 4611 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 4612 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4613 | .dac_nids = alc260_dac_nids, |
| 4614 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4615 | .adc_nids = alc260_adc_nids, |
| 4616 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4617 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4618 | .channel_mode = alc260_modes, |
| 4619 | .input_mux = &alc260_capture_source, |
| 4620 | }, |
| 4621 | [ALC260_REPLACER_672V] = { |
| 4622 | .mixers = { alc260_replacer_672v_mixer, |
| 4623 | alc260_capture_mixer }, |
| 4624 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 4625 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4626 | .dac_nids = alc260_dac_nids, |
| 4627 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4628 | .adc_nids = alc260_adc_nids, |
| 4629 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4630 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4631 | .channel_mode = alc260_modes, |
| 4632 | .input_mux = &alc260_capture_source, |
| 4633 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 4634 | .init_hook = alc260_replacer_672v_automute, |
| 4635 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4636 | #ifdef CONFIG_SND_DEBUG |
| 4637 | [ALC260_TEST] = { |
| 4638 | .mixers = { alc260_test_mixer, |
| 4639 | alc260_capture_mixer }, |
| 4640 | .init_verbs = { alc260_test_init_verbs }, |
| 4641 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4642 | .dac_nids = alc260_test_dac_nids, |
| 4643 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4644 | .adc_nids = alc260_test_adc_nids, |
| 4645 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4646 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4647 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4648 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4649 | }, |
| 4650 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4651 | }; |
| 4652 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4653 | static int patch_alc260(struct hda_codec *codec) |
| 4654 | { |
| 4655 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4656 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4657 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4658 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4659 | if (spec == NULL) |
| 4660 | return -ENOMEM; |
| 4661 | |
| 4662 | codec->spec = spec; |
| 4663 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4664 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 4665 | alc260_models, |
| 4666 | alc260_cfg_tbl); |
| 4667 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4668 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4669 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4670 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4671 | } |
| 4672 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4673 | if (board_config == ALC260_AUTO) { |
| 4674 | /* automatic parse from the BIOS config */ |
| 4675 | err = alc260_parse_auto_config(codec); |
| 4676 | if (err < 0) { |
| 4677 | alc_free(codec); |
| 4678 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4679 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4680 | printk(KERN_INFO |
| 4681 | "hda_codec: Cannot set up configuration " |
| 4682 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4683 | board_config = ALC260_BASIC; |
| 4684 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4685 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4686 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4687 | if (board_config != ALC260_AUTO) |
| 4688 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4689 | |
| 4690 | spec->stream_name_analog = "ALC260 Analog"; |
| 4691 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 4692 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 4693 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4694 | spec->stream_name_digital = "ALC260 Digital"; |
| 4695 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 4696 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 4697 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4698 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4699 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4700 | spec->init_hook = alc260_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4701 | |
| 4702 | return 0; |
| 4703 | } |
| 4704 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4705 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4706 | /* |
| 4707 | * ALC882 support |
| 4708 | * |
| 4709 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 4710 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4711 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4712 | * 6-channel independent captures. |
| 4713 | * |
| 4714 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4715 | * driver yet). |
| 4716 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4717 | #define ALC882_DIGOUT_NID 0x06 |
| 4718 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4719 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4720 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4721 | { 8, NULL } |
| 4722 | }; |
| 4723 | |
| 4724 | static hda_nid_t alc882_dac_nids[4] = { |
| 4725 | /* front, rear, clfe, rear_surr */ |
| 4726 | 0x02, 0x03, 0x04, 0x05 |
| 4727 | }; |
| 4728 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4729 | /* identical with ALC880 */ |
| 4730 | #define alc882_adc_nids alc880_adc_nids |
| 4731 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4732 | |
| 4733 | /* input MUX */ |
| 4734 | /* FIXME: should be a matrix-type input source selection */ |
| 4735 | |
| 4736 | static struct hda_input_mux alc882_capture_source = { |
| 4737 | .num_items = 4, |
| 4738 | .items = { |
| 4739 | { "Mic", 0x0 }, |
| 4740 | { "Front Mic", 0x1 }, |
| 4741 | { "Line", 0x2 }, |
| 4742 | { "CD", 0x4 }, |
| 4743 | }, |
| 4744 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4745 | #define alc882_mux_enum_info alc_mux_enum_info |
| 4746 | #define alc882_mux_enum_get alc_mux_enum_get |
| 4747 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4748 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 4749 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4750 | { |
| 4751 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4752 | struct alc_spec *spec = codec->spec; |
| 4753 | const struct hda_input_mux *imux = spec->input_mux; |
| 4754 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4755 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4756 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4757 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4758 | unsigned int i, idx; |
| 4759 | |
| 4760 | idx = ucontrol->value.enumerated.item[0]; |
| 4761 | if (idx >= imux->num_items) |
| 4762 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4763 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4764 | return 0; |
| 4765 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4766 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 4767 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4768 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4769 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4770 | } |
| 4771 | *cur_val = idx; |
| 4772 | return 1; |
| 4773 | } |
| 4774 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4775 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4776 | * 2ch mode |
| 4777 | */ |
| 4778 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 4779 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 4780 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4781 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 4782 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4783 | { } /* end */ |
| 4784 | }; |
| 4785 | |
| 4786 | /* |
| 4787 | * 6ch mode |
| 4788 | */ |
| 4789 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 4790 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4791 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4792 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 4793 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4794 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4795 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 4796 | { } /* end */ |
| 4797 | }; |
| 4798 | |
| 4799 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 4800 | { 2, alc882_3ST_ch2_init }, |
| 4801 | { 6, alc882_3ST_ch6_init }, |
| 4802 | }; |
| 4803 | |
| 4804 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4805 | * 6ch mode |
| 4806 | */ |
| 4807 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 4808 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4809 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4810 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4811 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4812 | { } /* end */ |
| 4813 | }; |
| 4814 | |
| 4815 | /* |
| 4816 | * 8ch mode |
| 4817 | */ |
| 4818 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 4819 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4820 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4821 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4822 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4823 | { } /* end */ |
| 4824 | }; |
| 4825 | |
| 4826 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 4827 | { 6, alc882_sixstack_ch6_init }, |
| 4828 | { 8, alc882_sixstack_ch8_init }, |
| 4829 | }; |
| 4830 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4831 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 4832 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 4833 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4834 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4835 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4836 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4837 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4838 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4839 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 4840 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4841 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 4842 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4843 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4844 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4845 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4846 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4847 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4848 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4849 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4851 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4852 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4853 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4854 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4855 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4856 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4857 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4858 | { } /* end */ |
| 4859 | }; |
| 4860 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 4861 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 4862 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4863 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4864 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4865 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4866 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4867 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4868 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4869 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 4870 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4871 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4872 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 4873 | { } /* end */ |
| 4874 | }; |
| 4875 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4876 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 4877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4878 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4879 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4880 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4881 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4882 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4883 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4886 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4887 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4888 | { } /* end */ |
| 4889 | }; |
| 4890 | |
| 4891 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 4892 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 4893 | */ |
| 4894 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 4895 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4896 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 4897 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 4898 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 4899 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4900 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4901 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4902 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4903 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 4904 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 4905 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4906 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4907 | { } /* end */ |
| 4908 | }; |
| 4909 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4910 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 4911 | { |
| 4912 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4913 | .name = "Channel Mode", |
| 4914 | .info = alc_ch_mode_info, |
| 4915 | .get = alc_ch_mode_get, |
| 4916 | .put = alc_ch_mode_put, |
| 4917 | }, |
| 4918 | { } /* end */ |
| 4919 | }; |
| 4920 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4921 | static struct hda_verb alc882_init_verbs[] = { |
| 4922 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4923 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4924 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4925 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4926 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4927 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4928 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4929 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4930 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4931 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4932 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4933 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4934 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4935 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4936 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4937 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4938 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4939 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4940 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4941 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4942 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4943 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4944 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4945 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4946 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4947 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4948 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4949 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4950 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4951 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4952 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4953 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4954 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4955 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4956 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4957 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4958 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4959 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4960 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4961 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4962 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4963 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4964 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 4965 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4966 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4967 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4968 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4969 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4970 | |
| 4971 | /* FIXME: use matrix-type input source selection */ |
| 4972 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 4973 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4974 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4975 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4976 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4977 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4978 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4979 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4980 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4981 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4982 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4983 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4984 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4985 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4986 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 4988 | /* ADC1: mute amp left and right */ |
| 4989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4990 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4991 | /* ADC2: mute amp left and right */ |
| 4992 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4993 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4994 | /* ADC3: mute amp left and right */ |
| 4995 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4996 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4997 | |
| 4998 | { } |
| 4999 | }; |
| 5000 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5001 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5002 | /* change to EAPD mode */ |
| 5003 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5004 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5005 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5006 | }; |
| 5007 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5008 | /* Mac Pro test */ |
| 5009 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5010 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5011 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5013 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5014 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5015 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5016 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5017 | { } /* end */ |
| 5018 | }; |
| 5019 | |
| 5020 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5021 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5022 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5024 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5025 | /* Front Pin: output 0 (0x0c) */ |
| 5026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5028 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5029 | /* Front Mic pin: input vref at 80% */ |
| 5030 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5031 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5032 | /* Speaker: output */ |
| 5033 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5034 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5035 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5036 | /* Headphone output (output 0 - 0x0c) */ |
| 5037 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5038 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5039 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5040 | |
| 5041 | /* FIXME: use matrix-type input source selection */ |
| 5042 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5043 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5044 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5045 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5048 | /* Input mixer2 */ |
| 5049 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5051 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5053 | /* Input mixer3 */ |
| 5054 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5055 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5056 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5058 | /* ADC1: mute amp left and right */ |
| 5059 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5060 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5061 | /* ADC2: mute amp left and right */ |
| 5062 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5063 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5064 | /* ADC3: mute amp left and right */ |
| 5065 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5066 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5067 | |
| 5068 | { } |
| 5069 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5070 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5071 | /* iMac 24 mixer. */ |
| 5072 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5073 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5074 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5075 | { } /* end */ |
| 5076 | }; |
| 5077 | |
| 5078 | /* iMac 24 init verbs. */ |
| 5079 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5080 | /* Internal speakers: output 0 (0x0c) */ |
| 5081 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5082 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5083 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5084 | /* Internal speakers: output 0 (0x0c) */ |
| 5085 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5086 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5087 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5088 | /* Headphone: output 0 (0x0c) */ |
| 5089 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5090 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5091 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5092 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5093 | /* Front Mic: input vref at 80% */ |
| 5094 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5095 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5096 | { } |
| 5097 | }; |
| 5098 | |
| 5099 | /* Toggle speaker-output according to the hp-jack state */ |
| 5100 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5101 | { |
| 5102 | unsigned int present; |
| 5103 | |
| 5104 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5105 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5106 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5107 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5108 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5109 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5110 | } |
| 5111 | |
| 5112 | /* Processes unsolicited events. */ |
| 5113 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5114 | unsigned int res) |
| 5115 | { |
| 5116 | /* Headphone insertion or removal. */ |
| 5117 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5118 | alc885_imac24_automute(codec); |
| 5119 | } |
| 5120 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5121 | static struct hda_verb alc882_targa_verbs[] = { |
| 5122 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5123 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5124 | |
| 5125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5126 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5127 | |
| 5128 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5129 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5130 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5131 | |
| 5132 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5133 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5134 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5135 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5136 | { } /* end */ |
| 5137 | }; |
| 5138 | |
| 5139 | /* toggle speaker-output according to the hp-jack state */ |
| 5140 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5141 | { |
| 5142 | unsigned int present; |
| 5143 | |
| 5144 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5145 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5146 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5147 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5148 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5149 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5150 | } |
| 5151 | |
| 5152 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5153 | { |
| 5154 | /* Looks like the unsol event is incompatible with the standard |
| 5155 | * definition. 4bit tag is placed at 26 bit! |
| 5156 | */ |
| 5157 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5158 | alc882_targa_automute(codec); |
| 5159 | } |
| 5160 | } |
| 5161 | |
| 5162 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5163 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5164 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5165 | |
| 5166 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5167 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5168 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5169 | |
| 5170 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5171 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5172 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5173 | |
| 5174 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5175 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5176 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5177 | { } /* end */ |
| 5178 | }; |
| 5179 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5180 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5181 | { |
| 5182 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5183 | |
| 5184 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5185 | AC_VERB_GET_GPIO_DATA, 0); |
| 5186 | |
| 5187 | if (!muted) |
| 5188 | gpiostate |= (1 << pin); |
| 5189 | else |
| 5190 | gpiostate &= ~(1 << pin); |
| 5191 | |
| 5192 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5193 | AC_VERB_GET_GPIO_MASK, 0); |
| 5194 | gpiomask |= (1 << pin); |
| 5195 | |
| 5196 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5197 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5198 | gpiodir |= (1 << pin); |
| 5199 | |
| 5200 | |
| 5201 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5202 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5203 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5204 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5205 | |
| 5206 | msleep(1); |
| 5207 | |
| 5208 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5209 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5210 | } |
| 5211 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5212 | /* |
| 5213 | * generic initialization of ADC, input mixers and output mixers |
| 5214 | */ |
| 5215 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5216 | /* |
| 5217 | * Unmute ADC0-2 and set the default input to mic-in |
| 5218 | */ |
| 5219 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5220 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5221 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5222 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5223 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5224 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5225 | |
| 5226 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5227 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5228 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5229 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5230 | */ |
| 5231 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 5232 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5233 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5234 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5235 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5236 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5237 | |
| 5238 | /* |
| 5239 | * Set up output mixers (0x0c - 0x0f) |
| 5240 | */ |
| 5241 | /* set vol=0 to output mixers */ |
| 5242 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5243 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5244 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5245 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5246 | /* set up input amps for analog loopback */ |
| 5247 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5248 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5249 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5250 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5251 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5252 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5253 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5254 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5255 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5256 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5257 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5258 | |
| 5259 | /* FIXME: use matrix-type input source selection */ |
| 5260 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5261 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5262 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5263 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5264 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5265 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5266 | /* Input mixer2 */ |
| 5267 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5268 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5269 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5270 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5271 | /* Input mixer3 */ |
| 5272 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5274 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5275 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5276 | |
| 5277 | { } |
| 5278 | }; |
| 5279 | |
| 5280 | /* capture mixer elements */ |
| 5281 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5282 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5283 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5284 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5285 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5286 | { |
| 5287 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5288 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5289 | * So call somewhat different.. |
| 5290 | * FIXME: the controls appear in the "playback" view! |
| 5291 | */ |
| 5292 | /* .name = "Capture Source", */ |
| 5293 | .name = "Input Source", |
| 5294 | .count = 2, |
| 5295 | .info = alc882_mux_enum_info, |
| 5296 | .get = alc882_mux_enum_get, |
| 5297 | .put = alc882_mux_enum_put, |
| 5298 | }, |
| 5299 | { } /* end */ |
| 5300 | }; |
| 5301 | |
| 5302 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5303 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5304 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5305 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5306 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5307 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5308 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5309 | { |
| 5310 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5311 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5312 | * So call somewhat different.. |
| 5313 | * FIXME: the controls appear in the "playback" view! |
| 5314 | */ |
| 5315 | /* .name = "Capture Source", */ |
| 5316 | .name = "Input Source", |
| 5317 | .count = 3, |
| 5318 | .info = alc882_mux_enum_info, |
| 5319 | .get = alc882_mux_enum_get, |
| 5320 | .put = alc882_mux_enum_put, |
| 5321 | }, |
| 5322 | { } /* end */ |
| 5323 | }; |
| 5324 | |
| 5325 | /* pcm configuration: identiacal with ALC880 */ |
| 5326 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5327 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5328 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5329 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5330 | |
| 5331 | /* |
| 5332 | * configuration and preset |
| 5333 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5334 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5335 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5336 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5337 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5338 | [ALC882_W2JC] = "w2jc", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5339 | [ALC885_MACPRO] = "macpro", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5340 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5341 | [ALC882_AUTO] = "auto", |
| 5342 | }; |
| 5343 | |
| 5344 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 5345 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 5346 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
| 5347 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5348 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5349 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5350 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 5351 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 5352 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5353 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5354 | {} |
| 5355 | }; |
| 5356 | |
| 5357 | static struct alc_config_preset alc882_presets[] = { |
| 5358 | [ALC882_3ST_DIG] = { |
| 5359 | .mixers = { alc882_base_mixer }, |
| 5360 | .init_verbs = { alc882_init_verbs }, |
| 5361 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5362 | .dac_nids = alc882_dac_nids, |
| 5363 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5364 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5365 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5366 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5367 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5368 | .input_mux = &alc882_capture_source, |
| 5369 | }, |
| 5370 | [ALC882_6ST_DIG] = { |
| 5371 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5372 | .init_verbs = { alc882_init_verbs }, |
| 5373 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5374 | .dac_nids = alc882_dac_nids, |
| 5375 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5376 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5377 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5378 | .channel_mode = alc882_sixstack_modes, |
| 5379 | .input_mux = &alc882_capture_source, |
| 5380 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5381 | [ALC882_ARIMA] = { |
| 5382 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5383 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 5384 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5385 | .dac_nids = alc882_dac_nids, |
| 5386 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5387 | .channel_mode = alc882_sixstack_modes, |
| 5388 | .input_mux = &alc882_capture_source, |
| 5389 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5390 | [ALC882_W2JC] = { |
| 5391 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 5392 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5393 | alc880_gpio1_init_verbs }, |
| 5394 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5395 | .dac_nids = alc882_dac_nids, |
| 5396 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5397 | .channel_mode = alc880_threestack_modes, |
| 5398 | .need_dac_fix = 1, |
| 5399 | .input_mux = &alc882_capture_source, |
| 5400 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5401 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5402 | [ALC885_MACPRO] = { |
| 5403 | .mixers = { alc882_macpro_mixer }, |
| 5404 | .init_verbs = { alc882_macpro_init_verbs }, |
| 5405 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5406 | .dac_nids = alc882_dac_nids, |
| 5407 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5408 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5409 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5410 | .channel_mode = alc882_ch_modes, |
| 5411 | .input_mux = &alc882_capture_source, |
| 5412 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5413 | [ALC885_IMAC24] = { |
| 5414 | .mixers = { alc885_imac24_mixer }, |
| 5415 | .init_verbs = { alc885_imac24_init_verbs }, |
| 5416 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5417 | .dac_nids = alc882_dac_nids, |
| 5418 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5419 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5420 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5421 | .channel_mode = alc882_ch_modes, |
| 5422 | .input_mux = &alc882_capture_source, |
| 5423 | .unsol_event = alc885_imac24_unsol_event, |
| 5424 | .init_hook = alc885_imac24_automute, |
| 5425 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5426 | [ALC882_TARGA] = { |
| 5427 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 5428 | alc882_capture_mixer }, |
| 5429 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 5430 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5431 | .dac_nids = alc882_dac_nids, |
| 5432 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5433 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5434 | .adc_nids = alc882_adc_nids, |
| 5435 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5436 | .channel_mode = alc882_3ST_6ch_modes, |
| 5437 | .need_dac_fix = 1, |
| 5438 | .input_mux = &alc882_capture_source, |
| 5439 | .unsol_event = alc882_targa_unsol_event, |
| 5440 | .init_hook = alc882_targa_automute, |
| 5441 | }, |
| 5442 | [ALC882_ASUS_A7J] = { |
| 5443 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 5444 | alc882_capture_mixer }, |
| 5445 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 5446 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5447 | .dac_nids = alc882_dac_nids, |
| 5448 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5449 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5450 | .adc_nids = alc882_adc_nids, |
| 5451 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5452 | .channel_mode = alc882_3ST_6ch_modes, |
| 5453 | .need_dac_fix = 1, |
| 5454 | .input_mux = &alc882_capture_source, |
| 5455 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5456 | }; |
| 5457 | |
| 5458 | |
| 5459 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 5460 | * Pin config fixes |
| 5461 | */ |
| 5462 | enum { |
| 5463 | PINFIX_ABIT_AW9D_MAX |
| 5464 | }; |
| 5465 | |
| 5466 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 5467 | { 0x15, 0x01080104 }, /* side */ |
| 5468 | { 0x16, 0x01011012 }, /* rear */ |
| 5469 | { 0x17, 0x01016011 }, /* clfe */ |
| 5470 | { } |
| 5471 | }; |
| 5472 | |
| 5473 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 5474 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 5475 | }; |
| 5476 | |
| 5477 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 5478 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 5479 | {} |
| 5480 | }; |
| 5481 | |
| 5482 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5483 | * BIOS auto configuration |
| 5484 | */ |
| 5485 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5486 | hda_nid_t nid, int pin_type, |
| 5487 | int dac_idx) |
| 5488 | { |
| 5489 | /* set as output */ |
| 5490 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5491 | int idx; |
| 5492 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5493 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 5494 | idx = 4; |
| 5495 | else |
| 5496 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 5497 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5498 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5499 | pin_type); |
| 5500 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5501 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5502 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 5503 | |
| 5504 | } |
| 5505 | |
| 5506 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 5507 | { |
| 5508 | struct alc_spec *spec = codec->spec; |
| 5509 | int i; |
| 5510 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5511 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5512 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5513 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5514 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5515 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5516 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5517 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5518 | } |
| 5519 | } |
| 5520 | |
| 5521 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 5522 | { |
| 5523 | struct alc_spec *spec = codec->spec; |
| 5524 | hda_nid_t pin; |
| 5525 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5526 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5527 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5528 | /* use dac 0 */ |
| 5529 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5530 | } |
| 5531 | |
| 5532 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 5533 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 5534 | |
| 5535 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 5536 | { |
| 5537 | struct alc_spec *spec = codec->spec; |
| 5538 | int i; |
| 5539 | |
| 5540 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5541 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5542 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5543 | snd_hda_codec_write(codec, nid, 0, |
| 5544 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5545 | i <= AUTO_PIN_FRONT_MIC ? |
| 5546 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5547 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5548 | snd_hda_codec_write(codec, nid, 0, |
| 5549 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5550 | AMP_OUT_MUTE); |
| 5551 | } |
| 5552 | } |
| 5553 | } |
| 5554 | |
| 5555 | /* almost identical with ALC880 parser... */ |
| 5556 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 5557 | { |
| 5558 | struct alc_spec *spec = codec->spec; |
| 5559 | int err = alc880_parse_auto_config(codec); |
| 5560 | |
| 5561 | if (err < 0) |
| 5562 | return err; |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 5563 | else if (err > 0) |
| 5564 | /* hack - override the init verbs */ |
| 5565 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 5566 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5567 | } |
| 5568 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5569 | /* additional initialization for auto-configuration model */ |
| 5570 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5571 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5572 | alc882_auto_init_multi_out(codec); |
| 5573 | alc882_auto_init_hp_out(codec); |
| 5574 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5575 | } |
| 5576 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5577 | static int patch_alc882(struct hda_codec *codec) |
| 5578 | { |
| 5579 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5580 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5581 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5582 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5583 | if (spec == NULL) |
| 5584 | return -ENOMEM; |
| 5585 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5586 | codec->spec = spec; |
| 5587 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5588 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 5589 | alc882_models, |
| 5590 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5591 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5592 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5593 | /* Pick up systems that don't supply PCI SSID */ |
| 5594 | switch (codec->subsystem_id) { |
| 5595 | case 0x106b0c00: /* Mac Pro */ |
| 5596 | board_config = ALC885_MACPRO; |
| 5597 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5598 | case 0x106b1000: /* iMac 24 */ |
| 5599 | board_config = ALC885_IMAC24; |
| 5600 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5601 | default: |
| 5602 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 5603 | "trying auto-probe from BIOS...\n"); |
| 5604 | board_config = ALC882_AUTO; |
| 5605 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5606 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5607 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 5608 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 5609 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5610 | if (board_config == ALC882_AUTO) { |
| 5611 | /* automatic parse from the BIOS config */ |
| 5612 | err = alc882_parse_auto_config(codec); |
| 5613 | if (err < 0) { |
| 5614 | alc_free(codec); |
| 5615 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5616 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5617 | printk(KERN_INFO |
| 5618 | "hda_codec: Cannot set up configuration " |
| 5619 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5620 | board_config = ALC882_3ST_DIG; |
| 5621 | } |
| 5622 | } |
| 5623 | |
| 5624 | if (board_config != ALC882_AUTO) |
| 5625 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5626 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5627 | if (board_config == ALC885_MACPRO || board_config == ALC885_IMAC24) { |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5628 | alc882_gpio_mute(codec, 0, 0); |
| 5629 | alc882_gpio_mute(codec, 1, 0); |
| 5630 | } |
| 5631 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5632 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5633 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 5634 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5635 | |
| 5636 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5637 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 5638 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5639 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5640 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5641 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5642 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5643 | /* get type */ |
| 5644 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5645 | if (wcap != AC_WID_AUD_IN) { |
| 5646 | spec->adc_nids = alc882_adc_nids_alt; |
| 5647 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5648 | spec->mixers[spec->num_mixers] = |
| 5649 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5650 | spec->num_mixers++; |
| 5651 | } else { |
| 5652 | spec->adc_nids = alc882_adc_nids; |
| 5653 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 5654 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 5655 | spec->num_mixers++; |
| 5656 | } |
| 5657 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5658 | |
| 5659 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5660 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5661 | spec->init_hook = alc882_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5662 | |
| 5663 | return 0; |
| 5664 | } |
| 5665 | |
| 5666 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5667 | * ALC883 support |
| 5668 | * |
| 5669 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 5670 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5671 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5672 | * 6-channel independent captures. |
| 5673 | * |
| 5674 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5675 | * driver yet). |
| 5676 | */ |
| 5677 | #define ALC883_DIGOUT_NID 0x06 |
| 5678 | #define ALC883_DIGIN_NID 0x0a |
| 5679 | |
| 5680 | static hda_nid_t alc883_dac_nids[4] = { |
| 5681 | /* front, rear, clfe, rear_surr */ |
| 5682 | 0x02, 0x04, 0x03, 0x05 |
| 5683 | }; |
| 5684 | |
| 5685 | static hda_nid_t alc883_adc_nids[2] = { |
| 5686 | /* ADC1-2 */ |
| 5687 | 0x08, 0x09, |
| 5688 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5689 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5690 | /* input MUX */ |
| 5691 | /* FIXME: should be a matrix-type input source selection */ |
| 5692 | |
| 5693 | static struct hda_input_mux alc883_capture_source = { |
| 5694 | .num_items = 4, |
| 5695 | .items = { |
| 5696 | { "Mic", 0x0 }, |
| 5697 | { "Front Mic", 0x1 }, |
| 5698 | { "Line", 0x2 }, |
| 5699 | { "CD", 0x4 }, |
| 5700 | }, |
| 5701 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5702 | |
| 5703 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 5704 | .num_items = 2, |
| 5705 | .items = { |
| 5706 | { "Mic", 0x1 }, |
| 5707 | { "Line", 0x2 }, |
| 5708 | }, |
| 5709 | }; |
| 5710 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5711 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 5712 | .num_items = 4, |
| 5713 | .items = { |
| 5714 | { "Mic", 0x0 }, |
| 5715 | { "iMic", 0x1 }, |
| 5716 | { "Line", 0x2 }, |
| 5717 | { "CD", 0x4 }, |
| 5718 | }, |
| 5719 | }; |
| 5720 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5721 | #define alc883_mux_enum_info alc_mux_enum_info |
| 5722 | #define alc883_mux_enum_get alc_mux_enum_get |
| 5723 | |
| 5724 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5725 | struct snd_ctl_elem_value *ucontrol) |
| 5726 | { |
| 5727 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5728 | struct alc_spec *spec = codec->spec; |
| 5729 | const struct hda_input_mux *imux = spec->input_mux; |
| 5730 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5731 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 5732 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 5733 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5734 | unsigned int i, idx; |
| 5735 | |
| 5736 | idx = ucontrol->value.enumerated.item[0]; |
| 5737 | if (idx >= imux->num_items) |
| 5738 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5739 | if (*cur_val == idx) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5740 | return 0; |
| 5741 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5742 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5743 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5744 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5745 | HDA_AMP_MUTE, v); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5746 | } |
| 5747 | *cur_val = idx; |
| 5748 | return 1; |
| 5749 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5750 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5751 | /* |
| 5752 | * 2ch mode |
| 5753 | */ |
| 5754 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 5755 | { 2, NULL } |
| 5756 | }; |
| 5757 | |
| 5758 | /* |
| 5759 | * 2ch mode |
| 5760 | */ |
| 5761 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 5762 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5763 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5764 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5765 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5766 | { } /* end */ |
| 5767 | }; |
| 5768 | |
| 5769 | /* |
| 5770 | * 6ch mode |
| 5771 | */ |
| 5772 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 5773 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5774 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5775 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5776 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5777 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5778 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5779 | { } /* end */ |
| 5780 | }; |
| 5781 | |
| 5782 | static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { |
| 5783 | { 2, alc883_3ST_ch2_init }, |
| 5784 | { 6, alc883_3ST_ch6_init }, |
| 5785 | }; |
| 5786 | |
| 5787 | /* |
| 5788 | * 6ch mode |
| 5789 | */ |
| 5790 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 5791 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5792 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5793 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5794 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5795 | { } /* end */ |
| 5796 | }; |
| 5797 | |
| 5798 | /* |
| 5799 | * 8ch mode |
| 5800 | */ |
| 5801 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 5802 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5803 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5804 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5805 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5806 | { } /* end */ |
| 5807 | }; |
| 5808 | |
| 5809 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 5810 | { 6, alc883_sixstack_ch6_init }, |
| 5811 | { 8, alc883_sixstack_ch8_init }, |
| 5812 | }; |
| 5813 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5814 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 5815 | /* eanable EAPD on medion laptop */ |
| 5816 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5817 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 5818 | { } |
| 5819 | }; |
| 5820 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5821 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5822 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5823 | */ |
| 5824 | |
| 5825 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 5826 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5827 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5828 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5829 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5830 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5831 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5832 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5833 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5834 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 5835 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 5836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5837 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5838 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5839 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5840 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5842 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5843 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5844 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5845 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5846 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5847 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5848 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5849 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5850 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5851 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5852 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5853 | { |
| 5854 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5855 | /* .name = "Capture Source", */ |
| 5856 | .name = "Input Source", |
| 5857 | .count = 2, |
| 5858 | .info = alc883_mux_enum_info, |
| 5859 | .get = alc883_mux_enum_get, |
| 5860 | .put = alc883_mux_enum_put, |
| 5861 | }, |
| 5862 | { } /* end */ |
| 5863 | }; |
| 5864 | |
| 5865 | static struct snd_kcontrol_new alc883_3ST_2ch_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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5870 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5872 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5874 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5876 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5877 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5878 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5879 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5880 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5881 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5882 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5883 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5884 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5885 | { |
| 5886 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5887 | /* .name = "Capture Source", */ |
| 5888 | .name = "Input Source", |
| 5889 | .count = 2, |
| 5890 | .info = alc883_mux_enum_info, |
| 5891 | .get = alc883_mux_enum_get, |
| 5892 | .put = alc883_mux_enum_put, |
| 5893 | }, |
| 5894 | { } /* end */ |
| 5895 | }; |
| 5896 | |
| 5897 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 5898 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5899 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5900 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5901 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5902 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5903 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5904 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5905 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5906 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5907 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5908 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5909 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5910 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5911 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5912 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5914 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5915 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5916 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5917 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5918 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5919 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5920 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5921 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5922 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5923 | { |
| 5924 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5925 | /* .name = "Capture Source", */ |
| 5926 | .name = "Input Source", |
| 5927 | .count = 2, |
| 5928 | .info = alc883_mux_enum_info, |
| 5929 | .get = alc883_mux_enum_get, |
| 5930 | .put = alc883_mux_enum_put, |
| 5931 | }, |
| 5932 | { } /* end */ |
| 5933 | }; |
| 5934 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 5935 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5936 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5937 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5938 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5939 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5940 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5941 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5942 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 5943 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 5944 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5945 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5946 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5947 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5948 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5949 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5950 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5951 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5952 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5953 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5954 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5955 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5956 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5957 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5958 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5959 | |
| 5960 | { |
| 5961 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5962 | /* .name = "Capture Source", */ |
| 5963 | .name = "Input Source", |
| 5964 | .count = 1, |
| 5965 | .info = alc883_mux_enum_info, |
| 5966 | .get = alc883_mux_enum_get, |
| 5967 | .put = alc883_mux_enum_put, |
| 5968 | }, |
| 5969 | { } /* end */ |
| 5970 | }; |
| 5971 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5972 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 5973 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5974 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5975 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5976 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5977 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5978 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5979 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5980 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5981 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5982 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5983 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5984 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5985 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5986 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5987 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5988 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5989 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5990 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5991 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5992 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5993 | { |
| 5994 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5995 | /* .name = "Capture Source", */ |
| 5996 | .name = "Input Source", |
| 5997 | .count = 2, |
| 5998 | .info = alc883_mux_enum_info, |
| 5999 | .get = alc883_mux_enum_get, |
| 6000 | .put = alc883_mux_enum_put, |
| 6001 | }, |
| 6002 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6003 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6004 | |
| 6005 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6007 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6008 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6009 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6010 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6012 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6013 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6014 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6015 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6016 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6017 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6018 | { |
| 6019 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6020 | /* .name = "Capture Source", */ |
| 6021 | .name = "Input Source", |
| 6022 | .count = 2, |
| 6023 | .info = alc883_mux_enum_info, |
| 6024 | .get = alc883_mux_enum_get, |
| 6025 | .put = alc883_mux_enum_put, |
| 6026 | }, |
| 6027 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6028 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6029 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6030 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6031 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6032 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6033 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6034 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6035 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6036 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6037 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6038 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6039 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6040 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6041 | { |
| 6042 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6043 | /* .name = "Capture Source", */ |
| 6044 | .name = "Input Source", |
| 6045 | .count = 1, |
| 6046 | .info = alc883_mux_enum_info, |
| 6047 | .get = alc883_mux_enum_get, |
| 6048 | .put = alc883_mux_enum_put, |
| 6049 | }, |
| 6050 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6051 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6052 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6053 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6054 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6055 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6056 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6057 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6058 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6059 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6060 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6061 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6062 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6063 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6064 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6065 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6066 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6067 | { |
| 6068 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6069 | /* .name = "Capture Source", */ |
| 6070 | .name = "Input Source", |
| 6071 | .count = 2, |
| 6072 | .info = alc883_mux_enum_info, |
| 6073 | .get = alc883_mux_enum_get, |
| 6074 | .put = alc883_mux_enum_put, |
| 6075 | }, |
| 6076 | { } /* end */ |
| 6077 | }; |
| 6078 | |
| 6079 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6081 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6082 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6083 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6084 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6085 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6086 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6087 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6088 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6089 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6090 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6091 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6092 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6093 | { |
| 6094 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6095 | /* .name = "Capture Source", */ |
| 6096 | .name = "Input Source", |
| 6097 | .count = 2, |
| 6098 | .info = alc883_mux_enum_info, |
| 6099 | .get = alc883_mux_enum_get, |
| 6100 | .put = alc883_mux_enum_put, |
| 6101 | }, |
| 6102 | { } /* end */ |
| 6103 | }; |
| 6104 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6105 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6107 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6108 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6109 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6110 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6111 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6112 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6113 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6114 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6115 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6116 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6117 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6118 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6119 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6120 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6121 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6122 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6124 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6125 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6126 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6127 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6128 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, 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_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6155 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6156 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6157 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6158 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6159 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6160 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6161 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6162 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6163 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6164 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6165 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6166 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6167 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6168 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6169 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6170 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6171 | { |
| 6172 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6173 | /* .name = "Capture Source", */ |
| 6174 | .name = "Input Source", |
| 6175 | .count = 2, |
| 6176 | .info = alc883_mux_enum_info, |
| 6177 | .get = alc883_mux_enum_get, |
| 6178 | .put = alc883_mux_enum_put, |
| 6179 | }, |
| 6180 | { } /* end */ |
| 6181 | }; |
| 6182 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6183 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
| 6184 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6185 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6186 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6187 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6188 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6189 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6192 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6193 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6194 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6195 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6196 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6197 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6198 | { |
| 6199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6200 | /* .name = "Capture Source", */ |
| 6201 | .name = "Input Source", |
| 6202 | .count = 2, |
| 6203 | .info = alc883_mux_enum_info, |
| 6204 | .get = alc883_mux_enum_get, |
| 6205 | .put = alc883_mux_enum_put, |
| 6206 | }, |
| 6207 | { } /* end */ |
| 6208 | }; |
| 6209 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6210 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 6211 | { |
| 6212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6213 | .name = "Channel Mode", |
| 6214 | .info = alc_ch_mode_info, |
| 6215 | .get = alc_ch_mode_get, |
| 6216 | .put = alc_ch_mode_put, |
| 6217 | }, |
| 6218 | { } /* end */ |
| 6219 | }; |
| 6220 | |
| 6221 | static struct hda_verb alc883_init_verbs[] = { |
| 6222 | /* ADC1: mute amp left and right */ |
| 6223 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6224 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6225 | /* ADC2: mute amp left and right */ |
| 6226 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6227 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6228 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6229 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6231 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6232 | /* Rear mixer */ |
| 6233 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6234 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6235 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6236 | /* CLFE mixer */ |
| 6237 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6238 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6239 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6240 | /* Side mixer */ |
| 6241 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6242 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6243 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6244 | |
| 6245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6246 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6247 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6248 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6249 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6250 | |
| 6251 | /* Front Pin: output 0 (0x0c) */ |
| 6252 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6253 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6254 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6255 | /* Rear Pin: output 1 (0x0d) */ |
| 6256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6257 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6258 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6259 | /* CLFE Pin: output 2 (0x0e) */ |
| 6260 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6261 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6262 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6263 | /* Side Pin: output 3 (0x0f) */ |
| 6264 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6265 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6266 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 6267 | /* Mic (rear) pin: input vref at 80% */ |
| 6268 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6269 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6270 | /* Front Mic pin: input vref at 80% */ |
| 6271 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6272 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6273 | /* Line In pin: input */ |
| 6274 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6275 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6276 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6277 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6278 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6279 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6280 | /* CD pin widget for input */ |
| 6281 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6282 | |
| 6283 | /* FIXME: use matrix-type input source selection */ |
| 6284 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6285 | /* Input mixer2 */ |
| 6286 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6287 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6288 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6289 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6290 | /* Input mixer3 */ |
| 6291 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6292 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6293 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6294 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6295 | { } |
| 6296 | }; |
| 6297 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6298 | static struct hda_verb alc883_tagra_verbs[] = { |
| 6299 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6300 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6301 | |
| 6302 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6303 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6304 | |
| 6305 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6306 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6307 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6308 | |
| 6309 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6310 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6311 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6312 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6313 | |
| 6314 | { } /* end */ |
| 6315 | }; |
| 6316 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6317 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 6318 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6319 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 6320 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 6321 | { } /* end */ |
| 6322 | }; |
| 6323 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6324 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 6325 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6326 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6327 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6328 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6329 | { } /* end */ |
| 6330 | }; |
| 6331 | |
| 6332 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 6333 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6335 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6336 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 6337 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6338 | { } /* end */ |
| 6339 | }; |
| 6340 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6341 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6342 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6343 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 6344 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 6345 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 6346 | { } |
| 6347 | }; |
| 6348 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6349 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6350 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6351 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 6352 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 6353 | { } |
| 6354 | }; |
| 6355 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6356 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6357 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6358 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6359 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6360 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6361 | { } |
| 6362 | }; |
| 6363 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6364 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6365 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6366 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6367 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6368 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6369 | { } |
| 6370 | }; |
| 6371 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6372 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 6373 | { 2, alc888_3st_hp_2ch_init }, |
| 6374 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6375 | }; |
| 6376 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6377 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 6378 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 6379 | { |
| 6380 | unsigned int present; |
| 6381 | |
| 6382 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6383 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6384 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6385 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6386 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6387 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6388 | } |
| 6389 | |
| 6390 | /* toggle RCA according to the front-jack state */ |
| 6391 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 6392 | { |
| 6393 | unsigned int present; |
| 6394 | |
| 6395 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6396 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6397 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6398 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6399 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6400 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6401 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 6402 | unsigned int res) |
| 6403 | { |
| 6404 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6405 | alc888_lenovo_ms7195_front_automute(codec); |
| 6406 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6407 | alc888_lenovo_ms7195_rca_automute(codec); |
| 6408 | } |
| 6409 | |
| 6410 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 6411 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6412 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6413 | |
| 6414 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6415 | |
| 6416 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6417 | { } /* end */ |
| 6418 | }; |
| 6419 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6420 | static struct hda_verb alc883_acer_aspire_verbs[] = { |
| 6421 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6422 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6423 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6424 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6425 | |
| 6426 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6427 | |
| 6428 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6429 | { } /* end */ |
| 6430 | }; |
| 6431 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6432 | /* toggle speaker-output according to the hp-jack state */ |
| 6433 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 6434 | { |
| 6435 | unsigned int present; |
| 6436 | |
| 6437 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6438 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6439 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6440 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6441 | } |
| 6442 | |
| 6443 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 6444 | unsigned int res) |
| 6445 | { |
| 6446 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6447 | alc883_medion_md2_automute(codec); |
| 6448 | } |
| 6449 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6450 | /* toggle speaker-output according to the hp-jack state */ |
| 6451 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 6452 | { |
| 6453 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6454 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6455 | |
| 6456 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6457 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6458 | bits = present ? HDA_AMP_MUTE : 0; |
| 6459 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6460 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6461 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6462 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6463 | } |
| 6464 | |
| 6465 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6466 | { |
| 6467 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6468 | alc883_tagra_automute(codec); |
| 6469 | } |
| 6470 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6471 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 6472 | { |
| 6473 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6474 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6475 | |
| 6476 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6477 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6478 | bits = present ? HDA_AMP_MUTE : 0; |
| 6479 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6480 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6481 | } |
| 6482 | |
| 6483 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 6484 | { |
| 6485 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6486 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6487 | |
| 6488 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6489 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6490 | bits = present ? HDA_AMP_MUTE : 0; |
| 6491 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6492 | HDA_AMP_MUTE, bits); |
| 6493 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6494 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6495 | } |
| 6496 | |
| 6497 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 6498 | unsigned int res) |
| 6499 | { |
| 6500 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6501 | alc883_lenovo_101e_all_automute(codec); |
| 6502 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6503 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 6504 | } |
| 6505 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6506 | /* |
| 6507 | * generic initialization of ADC, input mixers and output mixers |
| 6508 | */ |
| 6509 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 6510 | /* |
| 6511 | * Unmute ADC0-2 and set the default input to mic-in |
| 6512 | */ |
| 6513 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6514 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6515 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6516 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6517 | |
| 6518 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6519 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6520 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6521 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6522 | */ |
| 6523 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6524 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6525 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6526 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6527 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6528 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6529 | |
| 6530 | /* |
| 6531 | * Set up output mixers (0x0c - 0x0f) |
| 6532 | */ |
| 6533 | /* set vol=0 to output mixers */ |
| 6534 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6535 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6536 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6537 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6538 | /* set up input amps for analog loopback */ |
| 6539 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6540 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6541 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6542 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6543 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6544 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6545 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6546 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6547 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6548 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6549 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6550 | |
| 6551 | /* FIXME: use matrix-type input source selection */ |
| 6552 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6553 | /* Input mixer1 */ |
| 6554 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6555 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6556 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6557 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6558 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6559 | /* Input mixer2 */ |
| 6560 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6561 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6562 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6563 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6565 | |
| 6566 | { } |
| 6567 | }; |
| 6568 | |
| 6569 | /* capture mixer elements */ |
| 6570 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 6571 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6572 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6573 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6574 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6575 | { |
| 6576 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6577 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6578 | * So call somewhat different.. |
| 6579 | * FIXME: the controls appear in the "playback" view! |
| 6580 | */ |
| 6581 | /* .name = "Capture Source", */ |
| 6582 | .name = "Input Source", |
| 6583 | .count = 2, |
| 6584 | .info = alc882_mux_enum_info, |
| 6585 | .get = alc882_mux_enum_get, |
| 6586 | .put = alc882_mux_enum_put, |
| 6587 | }, |
| 6588 | { } /* end */ |
| 6589 | }; |
| 6590 | |
| 6591 | /* pcm configuration: identiacal with ALC880 */ |
| 6592 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 6593 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 6594 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 6595 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 6596 | |
| 6597 | /* |
| 6598 | * configuration and preset |
| 6599 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6600 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 6601 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 6602 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 6603 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 6604 | [ALC883_6ST_DIG] = "6stack-dig", |
| 6605 | [ALC883_TARGA_DIG] = "targa-dig", |
| 6606 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6607 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6608 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6609 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6610 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6611 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6612 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6613 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 6614 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6615 | [ALC888_6ST_HP] = "6stack-hp", |
| 6616 | [ALC888_3ST_HP] = "3stack-hp", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6617 | [ALC883_AUTO] = "auto", |
| 6618 | }; |
| 6619 | |
| 6620 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 6621 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 6622 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6623 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
| 6624 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
| 6625 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 6626 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6627 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 6628 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 6629 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 6630 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 6631 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Daniel T Chen | 6f3bf65 | 2007-06-08 11:39:35 +0200 | [diff] [blame] | 6632 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6633 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Baruch Even | dd146a6 | 2007-05-25 12:18:49 +0200 | [diff] [blame] | 6634 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6635 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 6636 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 6637 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 6638 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 6639 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 6640 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 6641 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 6642 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
| 6643 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6644 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6645 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 6646 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6647 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
| 6648 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 6649 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6650 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
| 6651 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 6652 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6653 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 6654 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 6655 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6656 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6657 | {} |
| 6658 | }; |
| 6659 | |
| 6660 | static struct alc_config_preset alc883_presets[] = { |
| 6661 | [ALC883_3ST_2ch_DIG] = { |
| 6662 | .mixers = { alc883_3ST_2ch_mixer }, |
| 6663 | .init_verbs = { alc883_init_verbs }, |
| 6664 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6665 | .dac_nids = alc883_dac_nids, |
| 6666 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6667 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6668 | .adc_nids = alc883_adc_nids, |
| 6669 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6670 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6671 | .channel_mode = alc883_3ST_2ch_modes, |
| 6672 | .input_mux = &alc883_capture_source, |
| 6673 | }, |
| 6674 | [ALC883_3ST_6ch_DIG] = { |
| 6675 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6676 | .init_verbs = { alc883_init_verbs }, |
| 6677 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6678 | .dac_nids = alc883_dac_nids, |
| 6679 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6680 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6681 | .adc_nids = alc883_adc_nids, |
| 6682 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6683 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6684 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6685 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6686 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6687 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6688 | [ALC883_3ST_6ch] = { |
| 6689 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6690 | .init_verbs = { alc883_init_verbs }, |
| 6691 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6692 | .dac_nids = alc883_dac_nids, |
| 6693 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6694 | .adc_nids = alc883_adc_nids, |
| 6695 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6696 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6697 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6698 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6699 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6700 | [ALC883_6ST_DIG] = { |
| 6701 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 6702 | .init_verbs = { alc883_init_verbs }, |
| 6703 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6704 | .dac_nids = alc883_dac_nids, |
| 6705 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6706 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6707 | .adc_nids = alc883_adc_nids, |
| 6708 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6709 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6710 | .channel_mode = alc883_sixstack_modes, |
| 6711 | .input_mux = &alc883_capture_source, |
| 6712 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6713 | [ALC883_TARGA_DIG] = { |
| 6714 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 6715 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6716 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6717 | .dac_nids = alc883_dac_nids, |
| 6718 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6719 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6720 | .adc_nids = alc883_adc_nids, |
| 6721 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6722 | .channel_mode = alc883_3ST_6ch_modes, |
| 6723 | .need_dac_fix = 1, |
| 6724 | .input_mux = &alc883_capture_source, |
| 6725 | .unsol_event = alc883_tagra_unsol_event, |
| 6726 | .init_hook = alc883_tagra_automute, |
| 6727 | }, |
| 6728 | [ALC883_TARGA_2ch_DIG] = { |
| 6729 | .mixers = { alc883_tagra_2ch_mixer}, |
| 6730 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6731 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6732 | .dac_nids = alc883_dac_nids, |
| 6733 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6734 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6735 | .adc_nids = alc883_adc_nids, |
| 6736 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6737 | .channel_mode = alc883_3ST_2ch_modes, |
| 6738 | .input_mux = &alc883_capture_source, |
| 6739 | .unsol_event = alc883_tagra_unsol_event, |
| 6740 | .init_hook = alc883_tagra_automute, |
| 6741 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 6742 | [ALC883_ACER] = { |
| 6743 | .mixers = { alc883_base_mixer, |
| 6744 | alc883_chmode_mixer }, |
| 6745 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 6746 | * and the headphone jack. Turn this on and rely on the |
| 6747 | * standard mute methods whenever the user wants to turn |
| 6748 | * these outputs off. |
| 6749 | */ |
| 6750 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 6751 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6752 | .dac_nids = alc883_dac_nids, |
| 6753 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6754 | .adc_nids = alc883_adc_nids, |
| 6755 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6756 | .channel_mode = alc883_3ST_2ch_modes, |
| 6757 | .input_mux = &alc883_capture_source, |
| 6758 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6759 | [ALC883_ACER_ASPIRE] = { |
| 6760 | .mixers = { alc883_acer_aspire_mixer}, |
| 6761 | .init_verbs = { alc883_init_verbs, alc883_acer_aspire_verbs}, |
| 6762 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6763 | .dac_nids = alc883_dac_nids, |
| 6764 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6765 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6766 | .adc_nids = alc883_adc_nids, |
| 6767 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6768 | .channel_mode = alc883_3ST_2ch_modes, |
| 6769 | .input_mux = &alc883_capture_source, |
| 6770 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6771 | .init_hook = alc883_medion_md2_automute, |
| 6772 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6773 | [ALC883_MEDION] = { |
| 6774 | .mixers = { alc883_fivestack_mixer, |
| 6775 | alc883_chmode_mixer }, |
| 6776 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6777 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6778 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6779 | .dac_nids = alc883_dac_nids, |
| 6780 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6781 | .adc_nids = alc883_adc_nids, |
| 6782 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6783 | .channel_mode = alc883_sixstack_modes, |
| 6784 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6785 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6786 | [ALC883_MEDION_MD2] = { |
| 6787 | .mixers = { alc883_medion_md2_mixer}, |
| 6788 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 6789 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6790 | .dac_nids = alc883_dac_nids, |
| 6791 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6792 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6793 | .adc_nids = alc883_adc_nids, |
| 6794 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6795 | .channel_mode = alc883_3ST_2ch_modes, |
| 6796 | .input_mux = &alc883_capture_source, |
| 6797 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6798 | .init_hook = alc883_medion_md2_automute, |
| 6799 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6800 | [ALC883_LAPTOP_EAPD] = { |
| 6801 | .mixers = { alc883_base_mixer, |
| 6802 | alc883_chmode_mixer }, |
| 6803 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 6804 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6805 | .dac_nids = alc883_dac_nids, |
| 6806 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6807 | .adc_nids = alc883_adc_nids, |
| 6808 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6809 | .channel_mode = alc883_3ST_2ch_modes, |
| 6810 | .input_mux = &alc883_capture_source, |
| 6811 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6812 | [ALC883_LENOVO_101E_2ch] = { |
| 6813 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 6814 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 6815 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6816 | .dac_nids = alc883_dac_nids, |
| 6817 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6818 | .adc_nids = alc883_adc_nids, |
| 6819 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6820 | .channel_mode = alc883_3ST_2ch_modes, |
| 6821 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 6822 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 6823 | .init_hook = alc883_lenovo_101e_all_automute, |
| 6824 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6825 | [ALC883_LENOVO_NB0763] = { |
| 6826 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 6827 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 6828 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6829 | .dac_nids = alc883_dac_nids, |
| 6830 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6831 | .adc_nids = alc883_adc_nids, |
| 6832 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6833 | .channel_mode = alc883_3ST_2ch_modes, |
| 6834 | .need_dac_fix = 1, |
| 6835 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 6836 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6837 | .init_hook = alc883_medion_md2_automute, |
| 6838 | }, |
| 6839 | [ALC888_LENOVO_MS7195_DIG] = { |
| 6840 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6841 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 6842 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6843 | .dac_nids = alc883_dac_nids, |
| 6844 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6845 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6846 | .adc_nids = alc883_adc_nids, |
| 6847 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6848 | .channel_mode = alc883_3ST_6ch_modes, |
| 6849 | .need_dac_fix = 1, |
| 6850 | .input_mux = &alc883_capture_source, |
| 6851 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 6852 | .init_hook = alc888_lenovo_ms7195_front_automute, |
| 6853 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6854 | [ALC888_6ST_HP] = { |
| 6855 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 6856 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6857 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6858 | .dac_nids = alc883_dac_nids, |
| 6859 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6860 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6861 | .adc_nids = alc883_adc_nids, |
| 6862 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6863 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6864 | .channel_mode = alc883_sixstack_modes, |
| 6865 | .input_mux = &alc883_capture_source, |
| 6866 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6867 | [ALC888_3ST_HP] = { |
| 6868 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 6869 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6870 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6871 | .dac_nids = alc883_dac_nids, |
| 6872 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6873 | .adc_nids = alc883_adc_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6874 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 6875 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6876 | .need_dac_fix = 1, |
| 6877 | .input_mux = &alc883_capture_source, |
| 6878 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6879 | }; |
| 6880 | |
| 6881 | |
| 6882 | /* |
| 6883 | * BIOS auto configuration |
| 6884 | */ |
| 6885 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6886 | hda_nid_t nid, int pin_type, |
| 6887 | int dac_idx) |
| 6888 | { |
| 6889 | /* set as output */ |
| 6890 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6891 | int idx; |
| 6892 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6893 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6894 | idx = 4; |
| 6895 | else |
| 6896 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 6897 | |
| 6898 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6899 | pin_type); |
| 6900 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 6901 | AMP_OUT_UNMUTE); |
| 6902 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6903 | |
| 6904 | } |
| 6905 | |
| 6906 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 6907 | { |
| 6908 | struct alc_spec *spec = codec->spec; |
| 6909 | int i; |
| 6910 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6911 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6912 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6913 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6914 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6915 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6916 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6917 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6918 | } |
| 6919 | } |
| 6920 | |
| 6921 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 6922 | { |
| 6923 | struct alc_spec *spec = codec->spec; |
| 6924 | hda_nid_t pin; |
| 6925 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6926 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6927 | if (pin) /* connect to front */ |
| 6928 | /* use dac 0 */ |
| 6929 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 6930 | } |
| 6931 | |
| 6932 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6933 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 6934 | |
| 6935 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 6936 | { |
| 6937 | struct alc_spec *spec = codec->spec; |
| 6938 | int i; |
| 6939 | |
| 6940 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6941 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6942 | if (alc883_is_input_pin(nid)) { |
| 6943 | snd_hda_codec_write(codec, nid, 0, |
| 6944 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6945 | (i <= AUTO_PIN_FRONT_MIC ? |
| 6946 | PIN_VREF80 : PIN_IN)); |
| 6947 | if (nid != ALC883_PIN_CD_NID) |
| 6948 | snd_hda_codec_write(codec, nid, 0, |
| 6949 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6950 | AMP_OUT_MUTE); |
| 6951 | } |
| 6952 | } |
| 6953 | } |
| 6954 | |
| 6955 | /* almost identical with ALC880 parser... */ |
| 6956 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 6957 | { |
| 6958 | struct alc_spec *spec = codec->spec; |
| 6959 | int err = alc880_parse_auto_config(codec); |
| 6960 | |
| 6961 | if (err < 0) |
| 6962 | return err; |
| 6963 | else if (err > 0) |
| 6964 | /* hack - override the init verbs */ |
| 6965 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6966 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 6967 | spec->num_mixers++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6968 | return err; |
| 6969 | } |
| 6970 | |
| 6971 | /* additional initialization for auto-configuration model */ |
| 6972 | static void alc883_auto_init(struct hda_codec *codec) |
| 6973 | { |
| 6974 | alc883_auto_init_multi_out(codec); |
| 6975 | alc883_auto_init_hp_out(codec); |
| 6976 | alc883_auto_init_analog_input(codec); |
| 6977 | } |
| 6978 | |
| 6979 | static int patch_alc883(struct hda_codec *codec) |
| 6980 | { |
| 6981 | struct alc_spec *spec; |
| 6982 | int err, board_config; |
| 6983 | |
| 6984 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6985 | if (spec == NULL) |
| 6986 | return -ENOMEM; |
| 6987 | |
| 6988 | codec->spec = spec; |
| 6989 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6990 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 6991 | alc883_models, |
| 6992 | alc883_cfg_tbl); |
| 6993 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6994 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 6995 | "trying auto-probe from BIOS...\n"); |
| 6996 | board_config = ALC883_AUTO; |
| 6997 | } |
| 6998 | |
| 6999 | if (board_config == ALC883_AUTO) { |
| 7000 | /* automatic parse from the BIOS config */ |
| 7001 | err = alc883_parse_auto_config(codec); |
| 7002 | if (err < 0) { |
| 7003 | alc_free(codec); |
| 7004 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7005 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7006 | printk(KERN_INFO |
| 7007 | "hda_codec: Cannot set up configuration " |
| 7008 | "from BIOS. Using base mode...\n"); |
| 7009 | board_config = ALC883_3ST_2ch_DIG; |
| 7010 | } |
| 7011 | } |
| 7012 | |
| 7013 | if (board_config != ALC883_AUTO) |
| 7014 | setup_preset(spec, &alc883_presets[board_config]); |
| 7015 | |
| 7016 | spec->stream_name_analog = "ALC883 Analog"; |
| 7017 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 7018 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 7019 | |
| 7020 | spec->stream_name_digital = "ALC883 Digital"; |
| 7021 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 7022 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 7023 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7024 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7025 | spec->adc_nids = alc883_adc_nids; |
| 7026 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 7027 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7028 | |
| 7029 | codec->patch_ops = alc_patch_ops; |
| 7030 | if (board_config == ALC883_AUTO) |
| 7031 | spec->init_hook = alc883_auto_init; |
| 7032 | |
| 7033 | return 0; |
| 7034 | } |
| 7035 | |
| 7036 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7037 | * ALC262 support |
| 7038 | */ |
| 7039 | |
| 7040 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 7041 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 7042 | |
| 7043 | #define alc262_dac_nids alc260_dac_nids |
| 7044 | #define alc262_adc_nids alc882_adc_nids |
| 7045 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 7046 | |
| 7047 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 7048 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7049 | |
| 7050 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 7051 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7052 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7053 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7054 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7055 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7056 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7057 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7058 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7059 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7060 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7061 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7062 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7063 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7064 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7065 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 7066 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7067 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7068 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7069 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7070 | }; |
| 7071 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7072 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 7073 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7074 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7075 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7076 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7077 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7078 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7081 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7082 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7083 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7084 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7085 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7086 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7087 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 7088 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7089 | { } /* end */ |
| 7090 | }; |
| 7091 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7092 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 7093 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7094 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7095 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7096 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7097 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7098 | |
| 7099 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7100 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7101 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7102 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7103 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7104 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7105 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7106 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7107 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7108 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7109 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7110 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7111 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 7112 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 7113 | { } /* end */ |
| 7114 | }; |
| 7115 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7116 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
| 7117 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7118 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7119 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7120 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7121 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7122 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7123 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7124 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7125 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7126 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7127 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7128 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7129 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7130 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7131 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7132 | { } /* end */ |
| 7133 | }; |
| 7134 | |
| 7135 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 7136 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7137 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7138 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7139 | { } /* end */ |
| 7140 | }; |
| 7141 | |
Takashi Iwai | 532d538 | 2007-07-27 19:02:40 +0200 | [diff] [blame] | 7142 | static struct hda_bind_ctls alc262_sony_bind_sw = { |
| 7143 | .ops = &snd_hda_bind_sw, |
| 7144 | .values = { |
| 7145 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 7146 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7147 | 0, |
| 7148 | }, |
| 7149 | }; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7150 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7151 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
| 7152 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 532d538 | 2007-07-27 19:02:40 +0200 | [diff] [blame] | 7153 | HDA_BIND_SW("Front Playback Switch", &alc262_sony_bind_sw), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7154 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7155 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7156 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7157 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7158 | { } /* end */ |
| 7159 | }; |
| 7160 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7161 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 7162 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7163 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7164 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7165 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7166 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7167 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7168 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7169 | { } /* end */ |
| 7170 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7171 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7172 | #define alc262_capture_mixer alc882_capture_mixer |
| 7173 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 7174 | |
| 7175 | /* |
| 7176 | * generic initialization of ADC, input mixers and output mixers |
| 7177 | */ |
| 7178 | static struct hda_verb alc262_init_verbs[] = { |
| 7179 | /* |
| 7180 | * Unmute ADC0-2 and set the default input to mic-in |
| 7181 | */ |
| 7182 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7183 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7184 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7185 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7186 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7187 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7188 | |
| 7189 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7190 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7191 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7192 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7193 | */ |
| 7194 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7195 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7196 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7197 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7198 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7199 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7200 | |
| 7201 | /* |
| 7202 | * Set up output mixers (0x0c - 0x0e) |
| 7203 | */ |
| 7204 | /* set vol=0 to output mixers */ |
| 7205 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7206 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7207 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7208 | /* set up input amps for analog loopback */ |
| 7209 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7210 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7211 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7212 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7213 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7214 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7215 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7216 | |
| 7217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7219 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7220 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7221 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7222 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7223 | |
| 7224 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7225 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7226 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7227 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7228 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7229 | |
| 7230 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7231 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7232 | |
| 7233 | /* FIXME: use matrix-type input source selection */ |
| 7234 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7235 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7236 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7237 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7238 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7239 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7240 | /* Input mixer2 */ |
| 7241 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7242 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7243 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7244 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7245 | /* Input mixer3 */ |
| 7246 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7247 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7248 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7249 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7250 | |
| 7251 | { } |
| 7252 | }; |
| 7253 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7254 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 7255 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7257 | {} |
| 7258 | }; |
| 7259 | |
| 7260 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 7261 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7262 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7263 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7264 | |
| 7265 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7266 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7267 | {} |
| 7268 | }; |
| 7269 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7270 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 7271 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7272 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7273 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 7274 | |
| 7275 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7276 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7277 | }; |
| 7278 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7279 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7280 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7281 | { |
| 7282 | struct alc_spec *spec = codec->spec; |
| 7283 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7284 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7285 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7286 | /* need to execute and sync at first */ |
| 7287 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7288 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7289 | AC_VERB_GET_PIN_SENSE, 0); |
| 7290 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7291 | if (spec->jack_present) { |
| 7292 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7293 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7294 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7295 | } else { |
| 7296 | /* unmute internal speaker if necessary */ |
| 7297 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7298 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7299 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7300 | } |
| 7301 | } |
| 7302 | |
| 7303 | /* unsolicited event for HP jack sensing */ |
| 7304 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 7305 | unsigned int res) |
| 7306 | { |
| 7307 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7308 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7309 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7310 | } |
| 7311 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7312 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7313 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7314 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7315 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7316 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7317 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7318 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7319 | AC_VERB_GET_PIN_SENSE, 0); |
| 7320 | present = (present & 0x80000000) != 0; |
| 7321 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7322 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7323 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7324 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7325 | } else { |
| 7326 | /* unmute internal speaker if necessary */ |
| 7327 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7328 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7329 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7330 | } |
| 7331 | } |
| 7332 | |
| 7333 | /* unsolicited event for HP jack sensing */ |
| 7334 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 7335 | unsigned int res) |
| 7336 | { |
| 7337 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7338 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7339 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7340 | } |
| 7341 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7342 | /* |
| 7343 | * fujitsu model |
| 7344 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 7345 | */ |
| 7346 | |
| 7347 | #define ALC_HP_EVENT 0x37 |
| 7348 | |
| 7349 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 7350 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 7351 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7352 | {} |
| 7353 | }; |
| 7354 | |
| 7355 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
| 7356 | .num_items = 2, |
| 7357 | .items = { |
| 7358 | { "Mic", 0x0 }, |
| 7359 | { "CD", 0x4 }, |
| 7360 | }, |
| 7361 | }; |
| 7362 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7363 | static struct hda_input_mux alc262_HP_capture_source = { |
| 7364 | .num_items = 5, |
| 7365 | .items = { |
| 7366 | { "Mic", 0x0 }, |
| 7367 | { "Front Mic", 0x3 }, |
| 7368 | { "Line", 0x2 }, |
| 7369 | { "CD", 0x4 }, |
| 7370 | { "AUX IN", 0x6 }, |
| 7371 | }, |
| 7372 | }; |
| 7373 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7374 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 7375 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 7376 | { |
| 7377 | struct alc_spec *spec = codec->spec; |
| 7378 | unsigned int mute; |
| 7379 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7380 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7381 | unsigned int present; |
| 7382 | /* need to execute and sync at first */ |
| 7383 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7384 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7385 | AC_VERB_GET_PIN_SENSE, 0); |
| 7386 | spec->jack_present = (present & 0x80000000) != 0; |
| 7387 | spec->sense_updated = 1; |
| 7388 | } |
| 7389 | if (spec->jack_present) { |
| 7390 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7391 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7392 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7393 | } else { |
| 7394 | /* unmute internal speaker if necessary */ |
| 7395 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7396 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7397 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7398 | } |
| 7399 | } |
| 7400 | |
| 7401 | /* unsolicited event for HP jack sensing */ |
| 7402 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 7403 | unsigned int res) |
| 7404 | { |
| 7405 | if ((res >> 26) != ALC_HP_EVENT) |
| 7406 | return; |
| 7407 | alc262_fujitsu_automute(codec, 1); |
| 7408 | } |
| 7409 | |
| 7410 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame^] | 7411 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 7412 | .ops = &snd_hda_bind_vol, |
| 7413 | .values = { |
| 7414 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 7415 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 7416 | 0 |
| 7417 | }, |
| 7418 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7419 | |
| 7420 | /* bind hp and internal speaker mute (with plug check) */ |
| 7421 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 7422 | struct snd_ctl_elem_value *ucontrol) |
| 7423 | { |
| 7424 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7425 | long *valp = ucontrol->value.integer.value; |
| 7426 | int change; |
| 7427 | |
| 7428 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7429 | HDA_AMP_MUTE, |
| 7430 | valp[0] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7431 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7432 | HDA_AMP_MUTE, |
| 7433 | valp[1] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7434 | if (change) |
| 7435 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7436 | return change; |
| 7437 | } |
| 7438 | |
| 7439 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame^] | 7440 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7441 | { |
| 7442 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7443 | .name = "Master Playback Switch", |
| 7444 | .info = snd_hda_mixer_amp_switch_info, |
| 7445 | .get = snd_hda_mixer_amp_switch_get, |
| 7446 | .put = alc262_fujitsu_master_sw_put, |
| 7447 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7448 | }, |
| 7449 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7450 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7451 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7452 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7453 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7454 | { } /* end */ |
| 7455 | }; |
| 7456 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 7457 | /* additional init verbs for Benq laptops */ |
| 7458 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 7459 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7460 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7461 | {} |
| 7462 | }; |
| 7463 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7464 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 7465 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7466 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7467 | |
| 7468 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7469 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 7470 | {} |
| 7471 | }; |
| 7472 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7473 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7474 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7475 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7476 | { |
| 7477 | hda_nid_t nid; |
| 7478 | int err; |
| 7479 | |
| 7480 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 7481 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 7482 | spec->multiout.dac_nids[0] = 2; |
| 7483 | |
| 7484 | nid = cfg->line_out_pins[0]; |
| 7485 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7486 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7487 | "Front Playback Volume", |
| 7488 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 7489 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7490 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7491 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7492 | "Front Playback Switch", |
| 7493 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 7494 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7495 | return err; |
| 7496 | } |
| 7497 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7498 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7499 | if (nid) { |
| 7500 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7501 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7502 | "Speaker Playback Volume", |
| 7503 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7504 | HDA_OUTPUT)); |
| 7505 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7506 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7507 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7508 | "Speaker Playback Switch", |
| 7509 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7510 | HDA_OUTPUT)); |
| 7511 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7512 | return err; |
| 7513 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7514 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7515 | "Speaker Playback Switch", |
| 7516 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7517 | HDA_OUTPUT)); |
| 7518 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7519 | return err; |
| 7520 | } |
| 7521 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7522 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7523 | if (nid) { |
| 7524 | /* spec->multiout.hp_nid = 2; */ |
| 7525 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7526 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7527 | "Headphone Playback Volume", |
| 7528 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7529 | HDA_OUTPUT)); |
| 7530 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7531 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7532 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7533 | "Headphone Playback Switch", |
| 7534 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7535 | HDA_OUTPUT)); |
| 7536 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7537 | return err; |
| 7538 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7539 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7540 | "Headphone Playback Switch", |
| 7541 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7542 | HDA_OUTPUT)); |
| 7543 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7544 | return err; |
| 7545 | } |
| 7546 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7547 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7548 | } |
| 7549 | |
| 7550 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7551 | #define alc262_auto_create_analog_input_ctls \ |
| 7552 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7553 | |
| 7554 | /* |
| 7555 | * generic initialization of ADC, input mixers and output mixers |
| 7556 | */ |
| 7557 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 7558 | /* |
| 7559 | * Unmute ADC0-2 and set the default input to mic-in |
| 7560 | */ |
| 7561 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7562 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7563 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7564 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7565 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7566 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7567 | |
| 7568 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7569 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7570 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7571 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7572 | */ |
| 7573 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7574 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7575 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7576 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7577 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7578 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7579 | |
| 7580 | /* |
| 7581 | * Set up output mixers (0x0c - 0x0f) |
| 7582 | */ |
| 7583 | /* set vol=0 to output mixers */ |
| 7584 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7585 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7586 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7587 | |
| 7588 | /* set up input amps for analog loopback */ |
| 7589 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7592 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7593 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7594 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7595 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7596 | |
| 7597 | /* FIXME: use matrix-type input source selection */ |
| 7598 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7599 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7600 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7601 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7602 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7603 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7604 | /* Input mixer2 */ |
| 7605 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7606 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7607 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7608 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7609 | /* Input mixer3 */ |
| 7610 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7611 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7612 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7613 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7614 | |
| 7615 | { } |
| 7616 | }; |
| 7617 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7618 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 7619 | /* |
| 7620 | * Unmute ADC0-2 and set the default input to mic-in |
| 7621 | */ |
| 7622 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7623 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7624 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7625 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7626 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7627 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7628 | |
| 7629 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7630 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7631 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7632 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7633 | */ |
| 7634 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7635 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7636 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7637 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7638 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 7641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 7642 | |
| 7643 | /* |
| 7644 | * Set up output mixers (0x0c - 0x0e) |
| 7645 | */ |
| 7646 | /* set vol=0 to output mixers */ |
| 7647 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7648 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7649 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7650 | |
| 7651 | /* set up input amps for analog loopback */ |
| 7652 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7654 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7655 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7656 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7657 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7658 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7659 | |
| 7660 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7661 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7662 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7663 | |
| 7664 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7665 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7666 | |
| 7667 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7668 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7669 | |
| 7670 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7671 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7672 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7673 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7674 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7675 | |
| 7676 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7677 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7678 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7679 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7680 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7681 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7682 | |
| 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, (0x7000 | (0x03 << 8))}, |
| 7689 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7690 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7691 | /* Input mixer2 */ |
| 7692 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7693 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7694 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7695 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7696 | /* Input mixer3 */ |
| 7697 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7698 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7699 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7700 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7701 | |
| 7702 | { } |
| 7703 | }; |
| 7704 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7705 | static struct hda_verb alc262_HP_BPC_WildWest_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 |
| 7718 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 7719 | * panel mic (mic 2) |
| 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 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 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 | |
| 7748 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 7749 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 7750 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 7751 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 7752 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 7753 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 7754 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 7755 | |
| 7756 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7757 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7758 | |
| 7759 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7760 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7761 | |
| 7762 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 7763 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7764 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7765 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7766 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7767 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7768 | |
| 7769 | /* FIXME: use matrix-type input source selection */ |
| 7770 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7771 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7772 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 7773 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 7774 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 7775 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 7776 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 7777 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7778 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 7779 | /* Input mixer2 */ |
| 7780 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7781 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7782 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7783 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7784 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7785 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7786 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7787 | /* Input mixer3 */ |
| 7788 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7789 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7790 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7791 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7792 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7793 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7794 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7795 | |
| 7796 | { } |
| 7797 | }; |
| 7798 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7799 | /* pcm configuration: identiacal with ALC880 */ |
| 7800 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 7801 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 7802 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 7803 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 7804 | |
| 7805 | /* |
| 7806 | * BIOS auto configuration |
| 7807 | */ |
| 7808 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 7809 | { |
| 7810 | struct alc_spec *spec = codec->spec; |
| 7811 | int err; |
| 7812 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 7813 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7814 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7815 | alc262_ignore); |
| 7816 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7817 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7818 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7819 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7820 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7821 | if (err < 0) |
| 7822 | return err; |
| 7823 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 7824 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7825 | return err; |
| 7826 | |
| 7827 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 7828 | |
| 7829 | if (spec->autocfg.dig_out_pin) |
| 7830 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 7831 | if (spec->autocfg.dig_in_pin) |
| 7832 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 7833 | |
| 7834 | if (spec->kctl_alloc) |
| 7835 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 7836 | |
| 7837 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7838 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7839 | spec->input_mux = &spec->private_imux; |
| 7840 | |
| 7841 | return 1; |
| 7842 | } |
| 7843 | |
| 7844 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 7845 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 7846 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 7847 | |
| 7848 | |
| 7849 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7850 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7851 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7852 | alc262_auto_init_multi_out(codec); |
| 7853 | alc262_auto_init_hp_out(codec); |
| 7854 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7855 | } |
| 7856 | |
| 7857 | /* |
| 7858 | * configuration and preset |
| 7859 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7860 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 7861 | [ALC262_BASIC] = "basic", |
| 7862 | [ALC262_HIPPO] = "hippo", |
| 7863 | [ALC262_HIPPO_1] = "hippo_1", |
| 7864 | [ALC262_FUJITSU] = "fujitsu", |
| 7865 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7866 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7867 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 7868 | [ALC262_BENQ_T31] = "benq-t31", |
| 7869 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7870 | [ALC262_AUTO] = "auto", |
| 7871 | }; |
| 7872 | |
| 7873 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 7874 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 7875 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
| 7876 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7877 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
| 7878 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7879 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7880 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7881 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7882 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7883 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7884 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7885 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7886 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7887 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7888 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7889 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7890 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7891 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
| 7892 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
| 7893 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
| 7894 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7895 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7896 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7897 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
| 7898 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 7899 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7900 | {} |
| 7901 | }; |
| 7902 | |
| 7903 | static struct alc_config_preset alc262_presets[] = { |
| 7904 | [ALC262_BASIC] = { |
| 7905 | .mixers = { alc262_base_mixer }, |
| 7906 | .init_verbs = { alc262_init_verbs }, |
| 7907 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7908 | .dac_nids = alc262_dac_nids, |
| 7909 | .hp_nid = 0x03, |
| 7910 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7911 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7912 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7913 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7914 | [ALC262_HIPPO] = { |
| 7915 | .mixers = { alc262_base_mixer }, |
| 7916 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 7917 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7918 | .dac_nids = alc262_dac_nids, |
| 7919 | .hp_nid = 0x03, |
| 7920 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 7921 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7922 | .channel_mode = alc262_modes, |
| 7923 | .input_mux = &alc262_capture_source, |
| 7924 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7925 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7926 | }, |
| 7927 | [ALC262_HIPPO_1] = { |
| 7928 | .mixers = { alc262_hippo1_mixer }, |
| 7929 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 7930 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7931 | .dac_nids = alc262_dac_nids, |
| 7932 | .hp_nid = 0x02, |
| 7933 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 7934 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7935 | .channel_mode = alc262_modes, |
| 7936 | .input_mux = &alc262_capture_source, |
| 7937 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7938 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7939 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7940 | [ALC262_FUJITSU] = { |
| 7941 | .mixers = { alc262_fujitsu_mixer }, |
| 7942 | .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, |
| 7943 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7944 | .dac_nids = alc262_dac_nids, |
| 7945 | .hp_nid = 0x03, |
| 7946 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 7947 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7948 | .channel_mode = alc262_modes, |
| 7949 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7950 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7951 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7952 | [ALC262_HP_BPC] = { |
| 7953 | .mixers = { alc262_HP_BPC_mixer }, |
| 7954 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 7955 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7956 | .dac_nids = alc262_dac_nids, |
| 7957 | .hp_nid = 0x03, |
| 7958 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7959 | .channel_mode = alc262_modes, |
| 7960 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7961 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7962 | [ALC262_HP_BPC_D7000_WF] = { |
| 7963 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 7964 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 7965 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7966 | .dac_nids = alc262_dac_nids, |
| 7967 | .hp_nid = 0x03, |
| 7968 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7969 | .channel_mode = alc262_modes, |
| 7970 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7971 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7972 | [ALC262_HP_BPC_D7000_WL] = { |
| 7973 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 7974 | alc262_HP_BPC_WildWest_option_mixer }, |
| 7975 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 7976 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7977 | .dac_nids = alc262_dac_nids, |
| 7978 | .hp_nid = 0x03, |
| 7979 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7980 | .channel_mode = alc262_modes, |
| 7981 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7982 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 7983 | [ALC262_BENQ_ED8] = { |
| 7984 | .mixers = { alc262_base_mixer }, |
| 7985 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 7986 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7987 | .dac_nids = alc262_dac_nids, |
| 7988 | .hp_nid = 0x03, |
| 7989 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7990 | .channel_mode = alc262_modes, |
| 7991 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7992 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7993 | [ALC262_SONY_ASSAMD] = { |
| 7994 | .mixers = { alc262_sony_mixer }, |
| 7995 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 7996 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7997 | .dac_nids = alc262_dac_nids, |
| 7998 | .hp_nid = 0x02, |
| 7999 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8000 | .channel_mode = alc262_modes, |
| 8001 | .input_mux = &alc262_capture_source, |
| 8002 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8003 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8004 | }, |
| 8005 | [ALC262_BENQ_T31] = { |
| 8006 | .mixers = { alc262_benq_t31_mixer }, |
| 8007 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 8008 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8009 | .dac_nids = alc262_dac_nids, |
| 8010 | .hp_nid = 0x03, |
| 8011 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8012 | .channel_mode = alc262_modes, |
| 8013 | .input_mux = &alc262_capture_source, |
| 8014 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8015 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8016 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8017 | }; |
| 8018 | |
| 8019 | static int patch_alc262(struct hda_codec *codec) |
| 8020 | { |
| 8021 | struct alc_spec *spec; |
| 8022 | int board_config; |
| 8023 | int err; |
| 8024 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 8025 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8026 | if (spec == NULL) |
| 8027 | return -ENOMEM; |
| 8028 | |
| 8029 | codec->spec = spec; |
| 8030 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8031 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 8032 | * under-run |
| 8033 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8034 | { |
| 8035 | int tmp; |
| 8036 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 8037 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 8038 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 8039 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 8040 | } |
| 8041 | #endif |
| 8042 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8043 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 8044 | alc262_models, |
| 8045 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8046 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8047 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8048 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 8049 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8050 | board_config = ALC262_AUTO; |
| 8051 | } |
| 8052 | |
| 8053 | if (board_config == ALC262_AUTO) { |
| 8054 | /* automatic parse from the BIOS config */ |
| 8055 | err = alc262_parse_auto_config(codec); |
| 8056 | if (err < 0) { |
| 8057 | alc_free(codec); |
| 8058 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8059 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8060 | printk(KERN_INFO |
| 8061 | "hda_codec: Cannot set up configuration " |
| 8062 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8063 | board_config = ALC262_BASIC; |
| 8064 | } |
| 8065 | } |
| 8066 | |
| 8067 | if (board_config != ALC262_AUTO) |
| 8068 | setup_preset(spec, &alc262_presets[board_config]); |
| 8069 | |
| 8070 | spec->stream_name_analog = "ALC262 Analog"; |
| 8071 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 8072 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 8073 | |
| 8074 | spec->stream_name_digital = "ALC262 Digital"; |
| 8075 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 8076 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 8077 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8078 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8079 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 8080 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 8081 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8082 | /* get type */ |
| 8083 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8084 | if (wcap != AC_WID_AUD_IN) { |
| 8085 | spec->adc_nids = alc262_adc_nids_alt; |
| 8086 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8087 | spec->mixers[spec->num_mixers] = |
| 8088 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8089 | spec->num_mixers++; |
| 8090 | } else { |
| 8091 | spec->adc_nids = alc262_adc_nids; |
| 8092 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 8093 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 8094 | spec->num_mixers++; |
| 8095 | } |
| 8096 | } |
| 8097 | |
| 8098 | codec->patch_ops = alc_patch_ops; |
| 8099 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8100 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8101 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8102 | return 0; |
| 8103 | } |
| 8104 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8105 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8106 | * ALC268 channel source setting (2 channel) |
| 8107 | */ |
| 8108 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 8109 | #define alc268_modes alc260_modes |
| 8110 | |
| 8111 | static hda_nid_t alc268_dac_nids[2] = { |
| 8112 | /* front, hp */ |
| 8113 | 0x02, 0x03 |
| 8114 | }; |
| 8115 | |
| 8116 | static hda_nid_t alc268_adc_nids[2] = { |
| 8117 | /* ADC0-1 */ |
| 8118 | 0x08, 0x07 |
| 8119 | }; |
| 8120 | |
| 8121 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 8122 | /* ADC0 */ |
| 8123 | 0x08 |
| 8124 | }; |
| 8125 | |
| 8126 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 8127 | /* output mixer control */ |
| 8128 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 8129 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8130 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 8131 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8132 | { } |
| 8133 | }; |
| 8134 | |
| 8135 | /* |
| 8136 | * generic initialization of ADC, input mixers and output mixers |
| 8137 | */ |
| 8138 | static struct hda_verb alc268_base_init_verbs[] = { |
| 8139 | /* Unmute DAC0-1 and set vol = 0 */ |
| 8140 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8141 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8142 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8143 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8144 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8145 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8146 | |
| 8147 | /* |
| 8148 | * Set up output mixers (0x0c - 0x0e) |
| 8149 | */ |
| 8150 | /* set vol=0 to output mixers */ |
| 8151 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8152 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8153 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8154 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8155 | |
| 8156 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8157 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8158 | |
| 8159 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8160 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8161 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8162 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8163 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8164 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8165 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8166 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8167 | |
| 8168 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8169 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8170 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8171 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8172 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8173 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8174 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8175 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8176 | |
| 8177 | /* FIXME: use matrix-type input source selection */ |
| 8178 | /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */ |
| 8179 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8180 | /* Input mixer2 */ |
| 8181 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8182 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8183 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8184 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8185 | |
| 8186 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8187 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8188 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8189 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8190 | { } |
| 8191 | }; |
| 8192 | |
| 8193 | /* |
| 8194 | * generic initialization of ADC, input mixers and output mixers |
| 8195 | */ |
| 8196 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 8197 | /* set output DAC */ |
| 8198 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8199 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8200 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8201 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8202 | |
| 8203 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8204 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8205 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8206 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8207 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8208 | |
| 8209 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8210 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8211 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8212 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8213 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8214 | |
| 8215 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8216 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8217 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8218 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8219 | |
| 8220 | /* set PCBEEP vol = 0 */ |
| 8221 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 8222 | |
| 8223 | { } |
| 8224 | }; |
| 8225 | |
| 8226 | #define alc268_mux_enum_info alc_mux_enum_info |
| 8227 | #define alc268_mux_enum_get alc_mux_enum_get |
| 8228 | |
| 8229 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 8230 | struct snd_ctl_elem_value *ucontrol) |
| 8231 | { |
| 8232 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8233 | struct alc_spec *spec = codec->spec; |
| 8234 | const struct hda_input_mux *imux = spec->input_mux; |
| 8235 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 8236 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 8237 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 8238 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 8239 | unsigned int i, idx; |
| 8240 | |
| 8241 | idx = ucontrol->value.enumerated.item[0]; |
| 8242 | if (idx >= imux->num_items) |
| 8243 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8244 | if (*cur_val == idx) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8245 | return 0; |
| 8246 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8247 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 8248 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 8249 | imux->items[i].index, |
| 8250 | HDA_AMP_MUTE, v); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8251 | snd_hda_codec_write_cache(codec, nid, 0, |
| 8252 | AC_VERB_SET_CONNECT_SEL, |
| 8253 | idx ); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8254 | } |
| 8255 | *cur_val = idx; |
| 8256 | return 1; |
| 8257 | } |
| 8258 | |
| 8259 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 8260 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8261 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8262 | { |
| 8263 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8264 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8265 | * So call somewhat different.. |
| 8266 | * FIXME: the controls appear in the "playback" view! |
| 8267 | */ |
| 8268 | /* .name = "Capture Source", */ |
| 8269 | .name = "Input Source", |
| 8270 | .count = 1, |
| 8271 | .info = alc268_mux_enum_info, |
| 8272 | .get = alc268_mux_enum_get, |
| 8273 | .put = alc268_mux_enum_put, |
| 8274 | }, |
| 8275 | { } /* end */ |
| 8276 | }; |
| 8277 | |
| 8278 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 8279 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8280 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8281 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8282 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8283 | { |
| 8284 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8285 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8286 | * So call somewhat different.. |
| 8287 | * FIXME: the controls appear in the "playback" view! |
| 8288 | */ |
| 8289 | /* .name = "Capture Source", */ |
| 8290 | .name = "Input Source", |
| 8291 | .count = 2, |
| 8292 | .info = alc268_mux_enum_info, |
| 8293 | .get = alc268_mux_enum_get, |
| 8294 | .put = alc268_mux_enum_put, |
| 8295 | }, |
| 8296 | { } /* end */ |
| 8297 | }; |
| 8298 | |
| 8299 | static struct hda_input_mux alc268_capture_source = { |
| 8300 | .num_items = 4, |
| 8301 | .items = { |
| 8302 | { "Mic", 0x0 }, |
| 8303 | { "Front Mic", 0x1 }, |
| 8304 | { "Line", 0x2 }, |
| 8305 | { "CD", 0x3 }, |
| 8306 | }, |
| 8307 | }; |
| 8308 | |
| 8309 | /* create input playback/capture controls for the given pin */ |
| 8310 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 8311 | const char *ctlname, int idx) |
| 8312 | { |
| 8313 | char name[32]; |
| 8314 | int err; |
| 8315 | |
| 8316 | sprintf(name, "%s Playback Volume", ctlname); |
| 8317 | if (nid == 0x14) { |
| 8318 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8319 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 8320 | HDA_OUTPUT)); |
| 8321 | if (err < 0) |
| 8322 | return err; |
| 8323 | } else if (nid == 0x15) { |
| 8324 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8325 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 8326 | HDA_OUTPUT)); |
| 8327 | if (err < 0) |
| 8328 | return err; |
| 8329 | } else |
| 8330 | return -1; |
| 8331 | sprintf(name, "%s Playback Switch", ctlname); |
| 8332 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 8333 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 8334 | if (err < 0) |
| 8335 | return err; |
| 8336 | return 0; |
| 8337 | } |
| 8338 | |
| 8339 | /* add playback controls from the parsed DAC table */ |
| 8340 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8341 | const struct auto_pin_cfg *cfg) |
| 8342 | { |
| 8343 | hda_nid_t nid; |
| 8344 | int err; |
| 8345 | |
| 8346 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 8347 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8348 | spec->multiout.dac_nids[0] = 2; |
| 8349 | spec->multiout.dac_nids[1] = 3; |
| 8350 | |
| 8351 | nid = cfg->line_out_pins[0]; |
| 8352 | if (nid) |
| 8353 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 8354 | |
| 8355 | nid = cfg->speaker_pins[0]; |
| 8356 | if (nid == 0x1d) { |
| 8357 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8358 | "Speaker Playback Volume", |
| 8359 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 8360 | if (err < 0) |
| 8361 | return err; |
| 8362 | } |
| 8363 | nid = cfg->hp_pins[0]; |
| 8364 | if (nid) |
| 8365 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 8366 | |
| 8367 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 8368 | if (nid == 0x16) { |
| 8369 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8370 | "Mono Playback Switch", |
| 8371 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 8372 | if (err < 0) |
| 8373 | return err; |
| 8374 | } |
| 8375 | return 0; |
| 8376 | } |
| 8377 | |
| 8378 | /* create playback/capture controls for input pins */ |
| 8379 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 8380 | const struct auto_pin_cfg *cfg) |
| 8381 | { |
| 8382 | struct hda_input_mux *imux = &spec->private_imux; |
| 8383 | int i, idx1; |
| 8384 | |
| 8385 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8386 | switch(cfg->input_pins[i]) { |
| 8387 | case 0x18: |
| 8388 | idx1 = 0; /* Mic 1 */ |
| 8389 | break; |
| 8390 | case 0x19: |
| 8391 | idx1 = 1; /* Mic 2 */ |
| 8392 | break; |
| 8393 | case 0x1a: |
| 8394 | idx1 = 2; /* Line In */ |
| 8395 | break; |
| 8396 | case 0x1c: |
| 8397 | idx1 = 3; /* CD */ |
| 8398 | break; |
| 8399 | default: |
| 8400 | continue; |
| 8401 | } |
| 8402 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 8403 | imux->items[imux->num_items].index = idx1; |
| 8404 | imux->num_items++; |
| 8405 | } |
| 8406 | return 0; |
| 8407 | } |
| 8408 | |
| 8409 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 8410 | { |
| 8411 | struct alc_spec *spec = codec->spec; |
| 8412 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 8413 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 8414 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 8415 | unsigned int dac_vol1, dac_vol2; |
| 8416 | |
| 8417 | if (speaker_nid) { |
| 8418 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 8419 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 8420 | snd_hda_codec_write(codec, 0x0f, 0, |
| 8421 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8422 | AMP_IN_UNMUTE(1)); |
| 8423 | snd_hda_codec_write(codec, 0x10, 0, |
| 8424 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8425 | AMP_IN_UNMUTE(1)); |
| 8426 | } else { |
| 8427 | snd_hda_codec_write(codec, 0x0f, 0, |
| 8428 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 8429 | snd_hda_codec_write(codec, 0x10, 0, |
| 8430 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 8431 | } |
| 8432 | |
| 8433 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 8434 | if (line_nid == 0x14) |
| 8435 | dac_vol2 = AMP_OUT_ZERO; |
| 8436 | else if (line_nid == 0x15) |
| 8437 | dac_vol1 = AMP_OUT_ZERO; |
| 8438 | if (hp_nid == 0x14) |
| 8439 | dac_vol2 = AMP_OUT_ZERO; |
| 8440 | else if (hp_nid == 0x15) |
| 8441 | dac_vol1 = AMP_OUT_ZERO; |
| 8442 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 8443 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 8444 | spec->autocfg.line_out_pins[2] != 0x16) |
| 8445 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 8446 | |
| 8447 | snd_hda_codec_write(codec, 0x02, 0, |
| 8448 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 8449 | snd_hda_codec_write(codec, 0x03, 0, |
| 8450 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 8451 | } |
| 8452 | |
| 8453 | /* pcm configuration: identiacal with ALC880 */ |
| 8454 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 8455 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
| 8456 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 8457 | |
| 8458 | /* |
| 8459 | * BIOS auto configuration |
| 8460 | */ |
| 8461 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 8462 | { |
| 8463 | struct alc_spec *spec = codec->spec; |
| 8464 | int err; |
| 8465 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 8466 | |
| 8467 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 8468 | alc268_ignore); |
| 8469 | if (err < 0) |
| 8470 | return err; |
| 8471 | if (!spec->autocfg.line_outs) |
| 8472 | return 0; /* can't find valid BIOS pin config */ |
| 8473 | |
| 8474 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 8475 | if (err < 0) |
| 8476 | return err; |
| 8477 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 8478 | if (err < 0) |
| 8479 | return err; |
| 8480 | |
| 8481 | spec->multiout.max_channels = 2; |
| 8482 | |
| 8483 | /* digital only support output */ |
| 8484 | if (spec->autocfg.dig_out_pin) |
| 8485 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 8486 | |
| 8487 | if (spec->kctl_alloc) |
| 8488 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 8489 | |
| 8490 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 8491 | spec->num_mux_defs = 1; |
| 8492 | spec->input_mux = &spec->private_imux; |
| 8493 | |
| 8494 | return 1; |
| 8495 | } |
| 8496 | |
| 8497 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 8498 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 8499 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 8500 | |
| 8501 | /* init callback for auto-configuration model -- overriding the default init */ |
| 8502 | static void alc268_auto_init(struct hda_codec *codec) |
| 8503 | { |
| 8504 | alc268_auto_init_multi_out(codec); |
| 8505 | alc268_auto_init_hp_out(codec); |
| 8506 | alc268_auto_init_mono_speaker_out(codec); |
| 8507 | alc268_auto_init_analog_input(codec); |
| 8508 | } |
| 8509 | |
| 8510 | /* |
| 8511 | * configuration and preset |
| 8512 | */ |
| 8513 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 8514 | [ALC268_3ST] = "3stack", |
| 8515 | [ALC268_AUTO] = "auto", |
| 8516 | }; |
| 8517 | |
| 8518 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
| 8519 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
| 8520 | {} |
| 8521 | }; |
| 8522 | |
| 8523 | static struct alc_config_preset alc268_presets[] = { |
| 8524 | [ALC268_3ST] = { |
| 8525 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 8526 | .init_verbs = { alc268_base_init_verbs }, |
| 8527 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 8528 | .dac_nids = alc268_dac_nids, |
| 8529 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 8530 | .adc_nids = alc268_adc_nids_alt, |
| 8531 | .hp_nid = 0x03, |
| 8532 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 8533 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 8534 | .channel_mode = alc268_modes, |
| 8535 | .input_mux = &alc268_capture_source, |
| 8536 | }, |
| 8537 | }; |
| 8538 | |
| 8539 | static int patch_alc268(struct hda_codec *codec) |
| 8540 | { |
| 8541 | struct alc_spec *spec; |
| 8542 | int board_config; |
| 8543 | int err; |
| 8544 | |
| 8545 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 8546 | if (spec == NULL) |
| 8547 | return -ENOMEM; |
| 8548 | |
| 8549 | codec->spec = spec; |
| 8550 | |
| 8551 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 8552 | alc268_models, |
| 8553 | alc268_cfg_tbl); |
| 8554 | |
| 8555 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 8556 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 8557 | "trying auto-probe from BIOS...\n"); |
| 8558 | board_config = ALC268_AUTO; |
| 8559 | } |
| 8560 | |
| 8561 | if (board_config == ALC268_AUTO) { |
| 8562 | /* automatic parse from the BIOS config */ |
| 8563 | err = alc268_parse_auto_config(codec); |
| 8564 | if (err < 0) { |
| 8565 | alc_free(codec); |
| 8566 | return err; |
| 8567 | } else if (!err) { |
| 8568 | printk(KERN_INFO |
| 8569 | "hda_codec: Cannot set up configuration " |
| 8570 | "from BIOS. Using base mode...\n"); |
| 8571 | board_config = ALC268_3ST; |
| 8572 | } |
| 8573 | } |
| 8574 | |
| 8575 | if (board_config != ALC268_AUTO) |
| 8576 | setup_preset(spec, &alc268_presets[board_config]); |
| 8577 | |
| 8578 | spec->stream_name_analog = "ALC268 Analog"; |
| 8579 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 8580 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
| 8581 | |
| 8582 | spec->stream_name_digital = "ALC268 Digital"; |
| 8583 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 8584 | |
| 8585 | if (board_config == ALC268_AUTO) { |
| 8586 | if (!spec->adc_nids && spec->input_mux) { |
| 8587 | /* check whether NID 0x07 is valid */ |
| 8588 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 8589 | |
| 8590 | /* get type */ |
| 8591 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 8592 | if (wcap != AC_WID_AUD_IN) { |
| 8593 | spec->adc_nids = alc268_adc_nids_alt; |
| 8594 | spec->num_adc_nids = |
| 8595 | ARRAY_SIZE(alc268_adc_nids_alt); |
| 8596 | spec->mixers[spec->num_mixers] = |
| 8597 | alc268_capture_alt_mixer; |
| 8598 | spec->num_mixers++; |
| 8599 | } else { |
| 8600 | spec->adc_nids = alc268_adc_nids; |
| 8601 | spec->num_adc_nids = |
| 8602 | ARRAY_SIZE(alc268_adc_nids); |
| 8603 | spec->mixers[spec->num_mixers] = |
| 8604 | alc268_capture_mixer; |
| 8605 | spec->num_mixers++; |
| 8606 | } |
| 8607 | } |
| 8608 | } |
| 8609 | codec->patch_ops = alc_patch_ops; |
| 8610 | if (board_config == ALC268_AUTO) |
| 8611 | spec->init_hook = alc268_auto_init; |
| 8612 | |
| 8613 | return 0; |
| 8614 | } |
| 8615 | |
| 8616 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8617 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 8618 | */ |
| 8619 | |
| 8620 | /* |
| 8621 | * set the path ways for 2 channel output |
| 8622 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 8623 | */ |
| 8624 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 8625 | /* set pin widget 1Ah (line in) for input */ |
| 8626 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8627 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 8628 | * the vref |
| 8629 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8630 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8631 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8632 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 8633 | #if 0 |
| 8634 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8635 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 8636 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8637 | { } /* end */ |
| 8638 | }; |
| 8639 | /* |
| 8640 | * 6ch mode |
| 8641 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 8642 | */ |
| 8643 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 8644 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 8645 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8646 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 8647 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8648 | |
| 8649 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8650 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8651 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8652 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 8653 | #if 0 |
| 8654 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8655 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 8656 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8657 | { } /* end */ |
| 8658 | }; |
| 8659 | |
| 8660 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 8661 | { 2, alc861_threestack_ch2_init }, |
| 8662 | { 6, alc861_threestack_ch6_init }, |
| 8663 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8664 | /* Set mic1 as input and unmute the mixer */ |
| 8665 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 8666 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8667 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8668 | { } /* end */ |
| 8669 | }; |
| 8670 | /* Set mic1 as output and mute mixer */ |
| 8671 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 8672 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8673 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8674 | { } /* end */ |
| 8675 | }; |
| 8676 | |
| 8677 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 8678 | { 2, alc861_uniwill_m31_ch2_init }, |
| 8679 | { 4, alc861_uniwill_m31_ch4_init }, |
| 8680 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8681 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8682 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 8683 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 8684 | /* set pin widget 1Ah (line in) for input */ |
| 8685 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8686 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 8687 | * the vref |
| 8688 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8689 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8690 | |
| 8691 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 8692 | #if 0 |
| 8693 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8694 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 8695 | #endif |
| 8696 | { } /* end */ |
| 8697 | }; |
| 8698 | /* Set mic1 nad line-in as output and mute mixer */ |
| 8699 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 8700 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 8701 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8702 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 8703 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 8704 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8705 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 8706 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8707 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8708 | |
| 8709 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 8710 | #if 0 |
| 8711 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8712 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 8713 | #endif |
| 8714 | { } /* end */ |
| 8715 | }; |
| 8716 | |
| 8717 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 8718 | { 2, alc861_asus_ch2_init }, |
| 8719 | { 6, alc861_asus_ch6_init }, |
| 8720 | }; |
| 8721 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8722 | /* patch-ALC861 */ |
| 8723 | |
| 8724 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 8725 | /* output mixer control */ |
| 8726 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8727 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8728 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8729 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8730 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 8731 | |
| 8732 | /*Input mixer control */ |
| 8733 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8734 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8735 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8736 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8737 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8738 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8739 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8740 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8741 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8743 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8744 | /* Capture mixer control */ |
| 8745 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8746 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8747 | { |
| 8748 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8749 | .name = "Capture Source", |
| 8750 | .count = 1, |
| 8751 | .info = alc_mux_enum_info, |
| 8752 | .get = alc_mux_enum_get, |
| 8753 | .put = alc_mux_enum_put, |
| 8754 | }, |
| 8755 | { } /* end */ |
| 8756 | }; |
| 8757 | |
| 8758 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 8759 | /* output mixer control */ |
| 8760 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8761 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8762 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8763 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8764 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 8765 | |
| 8766 | /* Input mixer control */ |
| 8767 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8768 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8769 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8770 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8771 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8772 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8774 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8775 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8776 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8777 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8778 | /* Capture mixer control */ |
| 8779 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8780 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8781 | { |
| 8782 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8783 | .name = "Capture Source", |
| 8784 | .count = 1, |
| 8785 | .info = alc_mux_enum_info, |
| 8786 | .get = alc_mux_enum_get, |
| 8787 | .put = alc_mux_enum_put, |
| 8788 | }, |
| 8789 | { |
| 8790 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8791 | .name = "Channel Mode", |
| 8792 | .info = alc_ch_mode_info, |
| 8793 | .get = alc_ch_mode_get, |
| 8794 | .put = alc_ch_mode_put, |
| 8795 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 8796 | }, |
| 8797 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8798 | }; |
| 8799 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8800 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8801 | /* output mixer control */ |
| 8802 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8805 | |
| 8806 | /*Capture mixer control */ |
| 8807 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8808 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8809 | { |
| 8810 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8811 | .name = "Capture Source", |
| 8812 | .count = 1, |
| 8813 | .info = alc_mux_enum_info, |
| 8814 | .get = alc_mux_enum_get, |
| 8815 | .put = alc_mux_enum_put, |
| 8816 | }, |
| 8817 | |
| 8818 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8819 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8820 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8821 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 8822 | /* output mixer control */ |
| 8823 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8824 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8825 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8826 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8827 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 8828 | |
| 8829 | /* Input mixer control */ |
| 8830 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8831 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8832 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8833 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8834 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8835 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8836 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8837 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8838 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8839 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8840 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8841 | /* Capture mixer control */ |
| 8842 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8843 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8844 | { |
| 8845 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8846 | .name = "Capture Source", |
| 8847 | .count = 1, |
| 8848 | .info = alc_mux_enum_info, |
| 8849 | .get = alc_mux_enum_get, |
| 8850 | .put = alc_mux_enum_put, |
| 8851 | }, |
| 8852 | { |
| 8853 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8854 | .name = "Channel Mode", |
| 8855 | .info = alc_ch_mode_info, |
| 8856 | .get = alc_ch_mode_get, |
| 8857 | .put = alc_ch_mode_put, |
| 8858 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 8859 | }, |
| 8860 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8861 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8862 | |
| 8863 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 8864 | /* output mixer control */ |
| 8865 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8866 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8867 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8868 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8869 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 8870 | |
| 8871 | /* Input mixer control */ |
| 8872 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8873 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8874 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8875 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8876 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8877 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8880 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8881 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 8882 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8883 | /* Capture mixer control */ |
| 8884 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8885 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8886 | { |
| 8887 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8888 | .name = "Capture Source", |
| 8889 | .count = 1, |
| 8890 | .info = alc_mux_enum_info, |
| 8891 | .get = alc_mux_enum_get, |
| 8892 | .put = alc_mux_enum_put, |
| 8893 | }, |
| 8894 | { |
| 8895 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8896 | .name = "Channel Mode", |
| 8897 | .info = alc_ch_mode_info, |
| 8898 | .get = alc_ch_mode_get, |
| 8899 | .put = alc_ch_mode_put, |
| 8900 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 8901 | }, |
| 8902 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8903 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8904 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8905 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8906 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8907 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8908 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8909 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8910 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8911 | { } |
| 8912 | }; |
| 8913 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8914 | /* |
| 8915 | * generic initialization of ADC, input mixers and output mixers |
| 8916 | */ |
| 8917 | static struct hda_verb alc861_base_init_verbs[] = { |
| 8918 | /* |
| 8919 | * Unmute ADC0 and set the default input to mic-in |
| 8920 | */ |
| 8921 | /* port-A for surround (rear panel) */ |
| 8922 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8923 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8924 | /* port-B for mic-in (rear panel) with vref */ |
| 8925 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8926 | /* port-C for line-in (rear panel) */ |
| 8927 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8928 | /* port-D for Front */ |
| 8929 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8930 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8931 | /* port-E for HP out (front panel) */ |
| 8932 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 8933 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8934 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8935 | /* port-F for mic-in (front panel) with vref */ |
| 8936 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8937 | /* port-G for CLFE (rear panel) */ |
| 8938 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8939 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8940 | /* port-H for side (rear panel) */ |
| 8941 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8942 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8943 | /* CD-in */ |
| 8944 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8945 | /* route front mic to ADC1*/ |
| 8946 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8947 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8948 | |
| 8949 | /* Unmute DAC0~3 & spdif out*/ |
| 8950 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8951 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8952 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8953 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8954 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8955 | |
| 8956 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8957 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8958 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8959 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8960 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8961 | |
| 8962 | /* Unmute Stereo Mixer 15 */ |
| 8963 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8964 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8965 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8966 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8967 | |
| 8968 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8969 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8970 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8971 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8972 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8973 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8974 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8975 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8976 | /* hp used DAC 3 (Front) */ |
| 8977 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8978 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8979 | |
| 8980 | { } |
| 8981 | }; |
| 8982 | |
| 8983 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 8984 | /* |
| 8985 | * Unmute ADC0 and set the default input to mic-in |
| 8986 | */ |
| 8987 | /* port-A for surround (rear panel) */ |
| 8988 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8989 | /* port-B for mic-in (rear panel) with vref */ |
| 8990 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8991 | /* port-C for line-in (rear panel) */ |
| 8992 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8993 | /* port-D for Front */ |
| 8994 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8995 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8996 | /* port-E for HP out (front panel) */ |
| 8997 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 8998 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8999 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9000 | /* port-F for mic-in (front panel) with vref */ |
| 9001 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9002 | /* port-G for CLFE (rear panel) */ |
| 9003 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9004 | /* port-H for side (rear panel) */ |
| 9005 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9006 | /* CD-in */ |
| 9007 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9008 | /* route front mic to ADC1*/ |
| 9009 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9010 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9011 | /* Unmute DAC0~3 & spdif out*/ |
| 9012 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9013 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9014 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9015 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9016 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9017 | |
| 9018 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9019 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9020 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9021 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9022 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9023 | |
| 9024 | /* Unmute Stereo Mixer 15 */ |
| 9025 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9026 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9028 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9029 | |
| 9030 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9031 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9032 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9033 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9034 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9035 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9036 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9037 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9038 | /* hp used DAC 3 (Front) */ |
| 9039 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9040 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9041 | { } |
| 9042 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9043 | |
| 9044 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 9045 | /* |
| 9046 | * Unmute ADC0 and set the default input to mic-in |
| 9047 | */ |
| 9048 | /* port-A for surround (rear panel) */ |
| 9049 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9050 | /* port-B for mic-in (rear panel) with vref */ |
| 9051 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9052 | /* port-C for line-in (rear panel) */ |
| 9053 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9054 | /* port-D for Front */ |
| 9055 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9056 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9057 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9058 | /* this has to be set to VREF80 */ |
| 9059 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9060 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9061 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9062 | /* port-F for mic-in (front panel) with vref */ |
| 9063 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9064 | /* port-G for CLFE (rear panel) */ |
| 9065 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9066 | /* port-H for side (rear panel) */ |
| 9067 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9068 | /* CD-in */ |
| 9069 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9070 | /* route front mic to ADC1*/ |
| 9071 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9072 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9073 | /* Unmute DAC0~3 & spdif out*/ |
| 9074 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9075 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9076 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9077 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9078 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9079 | |
| 9080 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9081 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9082 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9083 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9084 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9085 | |
| 9086 | /* Unmute Stereo Mixer 15 */ |
| 9087 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9088 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9089 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9090 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9091 | |
| 9092 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9093 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9094 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9095 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9096 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9097 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9098 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9099 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9100 | /* hp used DAC 3 (Front) */ |
| 9101 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9102 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9103 | { } |
| 9104 | }; |
| 9105 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9106 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 9107 | /* |
| 9108 | * Unmute ADC0 and set the default input to mic-in |
| 9109 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9110 | /* port-A for surround (rear panel) |
| 9111 | * according to codec#0 this is the HP jack |
| 9112 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9113 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 9114 | /* route front PCM to HP */ |
| 9115 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9116 | /* port-B for mic-in (rear panel) with vref */ |
| 9117 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9118 | /* port-C for line-in (rear panel) */ |
| 9119 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9120 | /* port-D for Front */ |
| 9121 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9122 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9123 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9124 | /* this has to be set to VREF80 */ |
| 9125 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9126 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9127 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9128 | /* port-F for mic-in (front panel) with vref */ |
| 9129 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9130 | /* port-G for CLFE (rear panel) */ |
| 9131 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9132 | /* port-H for side (rear panel) */ |
| 9133 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9134 | /* CD-in */ |
| 9135 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9136 | /* route front mic to ADC1*/ |
| 9137 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9138 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9139 | /* Unmute DAC0~3 & spdif out*/ |
| 9140 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9141 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9142 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9143 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9144 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9145 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9146 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9147 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9148 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9149 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9150 | |
| 9151 | /* Unmute Stereo Mixer 15 */ |
| 9152 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9153 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9154 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9155 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9156 | |
| 9157 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9158 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9159 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9160 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9161 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9162 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9163 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9164 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9165 | /* hp used DAC 3 (Front) */ |
| 9166 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9167 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9168 | { } |
| 9169 | }; |
| 9170 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9171 | /* additional init verbs for ASUS laptops */ |
| 9172 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 9173 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 9174 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 9175 | { } |
| 9176 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9177 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9178 | /* |
| 9179 | * generic initialization of ADC, input mixers and output mixers |
| 9180 | */ |
| 9181 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 9182 | /* |
| 9183 | * Unmute ADC0 and set the default input to mic-in |
| 9184 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9185 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9186 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9187 | |
| 9188 | /* Unmute DAC0~3 & spdif out*/ |
| 9189 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9190 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9191 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9192 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9193 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9194 | |
| 9195 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9196 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9197 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9198 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9199 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9200 | |
| 9201 | /* Unmute Stereo Mixer 15 */ |
| 9202 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9203 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9204 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9205 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 9206 | |
| 9207 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9208 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9209 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9210 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9211 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9212 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9213 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9214 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9215 | |
| 9216 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9217 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9218 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9219 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9220 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9221 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9222 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9223 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9224 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9225 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9226 | |
| 9227 | { } |
| 9228 | }; |
| 9229 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9230 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 9231 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9232 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9233 | { } |
| 9234 | }; |
| 9235 | |
| 9236 | /* toggle speaker-output according to the hp-jack state */ |
| 9237 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 9238 | { |
| 9239 | unsigned int present; |
| 9240 | |
| 9241 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 9242 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9243 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 9244 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9245 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 9246 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9247 | } |
| 9248 | |
| 9249 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 9250 | unsigned int res) |
| 9251 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9252 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9253 | alc861_toshiba_automute(codec); |
| 9254 | } |
| 9255 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9256 | /* pcm configuration: identiacal with ALC880 */ |
| 9257 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 9258 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 9259 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 9260 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 9261 | |
| 9262 | |
| 9263 | #define ALC861_DIGOUT_NID 0x07 |
| 9264 | |
| 9265 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 9266 | { 8, NULL } |
| 9267 | }; |
| 9268 | |
| 9269 | static hda_nid_t alc861_dac_nids[4] = { |
| 9270 | /* front, surround, clfe, side */ |
| 9271 | 0x03, 0x06, 0x05, 0x04 |
| 9272 | }; |
| 9273 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9274 | static hda_nid_t alc660_dac_nids[3] = { |
| 9275 | /* front, clfe, surround */ |
| 9276 | 0x03, 0x05, 0x06 |
| 9277 | }; |
| 9278 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9279 | static hda_nid_t alc861_adc_nids[1] = { |
| 9280 | /* ADC0-2 */ |
| 9281 | 0x08, |
| 9282 | }; |
| 9283 | |
| 9284 | static struct hda_input_mux alc861_capture_source = { |
| 9285 | .num_items = 5, |
| 9286 | .items = { |
| 9287 | { "Mic", 0x0 }, |
| 9288 | { "Front Mic", 0x3 }, |
| 9289 | { "Line", 0x1 }, |
| 9290 | { "CD", 0x4 }, |
| 9291 | { "Mixer", 0x5 }, |
| 9292 | }, |
| 9293 | }; |
| 9294 | |
| 9295 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9296 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 9297 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9298 | { |
| 9299 | int i; |
| 9300 | hda_nid_t nid; |
| 9301 | |
| 9302 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9303 | for (i = 0; i < cfg->line_outs; i++) { |
| 9304 | nid = cfg->line_out_pins[i]; |
| 9305 | if (nid) { |
| 9306 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 9307 | continue; |
| 9308 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 9309 | } |
| 9310 | } |
| 9311 | spec->multiout.num_dacs = cfg->line_outs; |
| 9312 | return 0; |
| 9313 | } |
| 9314 | |
| 9315 | /* add playback controls from the parsed DAC table */ |
| 9316 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9317 | const struct auto_pin_cfg *cfg) |
| 9318 | { |
| 9319 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9320 | static const char *chname[4] = { |
| 9321 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 9322 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9323 | hda_nid_t nid; |
| 9324 | int i, idx, err; |
| 9325 | |
| 9326 | for (i = 0; i < cfg->line_outs; i++) { |
| 9327 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9328 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9329 | continue; |
| 9330 | if (nid == 0x05) { |
| 9331 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9332 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9333 | "Center Playback Switch", |
| 9334 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 9335 | HDA_OUTPUT)); |
| 9336 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9337 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9338 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9339 | "LFE Playback Switch", |
| 9340 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9341 | HDA_OUTPUT)); |
| 9342 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9343 | return err; |
| 9344 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9345 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 9346 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9347 | if (nid == alc861_dac_nids[idx]) |
| 9348 | break; |
| 9349 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9350 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 9351 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9352 | HDA_OUTPUT)); |
| 9353 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9354 | return err; |
| 9355 | } |
| 9356 | } |
| 9357 | return 0; |
| 9358 | } |
| 9359 | |
| 9360 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 9361 | { |
| 9362 | int err; |
| 9363 | hda_nid_t nid; |
| 9364 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9365 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9366 | return 0; |
| 9367 | |
| 9368 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 9369 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9370 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9371 | "Headphone Playback Switch", |
| 9372 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9373 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9374 | return err; |
| 9375 | spec->multiout.hp_nid = nid; |
| 9376 | } |
| 9377 | return 0; |
| 9378 | } |
| 9379 | |
| 9380 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9381 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9382 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9383 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9384 | struct hda_input_mux *imux = &spec->private_imux; |
| 9385 | int i, err, idx, idx1; |
| 9386 | |
| 9387 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9388 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9389 | case 0x0c: |
| 9390 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9391 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9392 | break; |
| 9393 | case 0x0f: |
| 9394 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9395 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9396 | break; |
| 9397 | case 0x0d: |
| 9398 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9399 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9400 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9401 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9402 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9403 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9404 | break; |
| 9405 | case 0x11: |
| 9406 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9407 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9408 | break; |
| 9409 | default: |
| 9410 | continue; |
| 9411 | } |
| 9412 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9413 | err = new_analog_input(spec, cfg->input_pins[i], |
| 9414 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9415 | if (err < 0) |
| 9416 | return err; |
| 9417 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9418 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9419 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9420 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9421 | } |
| 9422 | return 0; |
| 9423 | } |
| 9424 | |
| 9425 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 9426 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 9427 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 9428 | |
| 9429 | { |
| 9430 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9431 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9432 | * So call somewhat different.. |
| 9433 | *FIXME: the controls appear in the "playback" view! |
| 9434 | */ |
| 9435 | /* .name = "Capture Source", */ |
| 9436 | .name = "Input Source", |
| 9437 | .count = 1, |
| 9438 | .info = alc_mux_enum_info, |
| 9439 | .get = alc_mux_enum_get, |
| 9440 | .put = alc_mux_enum_put, |
| 9441 | }, |
| 9442 | { } /* end */ |
| 9443 | }; |
| 9444 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9445 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9446 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9447 | int pin_type, int dac_idx) |
| 9448 | { |
| 9449 | /* set as output */ |
| 9450 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9451 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9452 | pin_type); |
| 9453 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 9454 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9455 | |
| 9456 | } |
| 9457 | |
| 9458 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 9459 | { |
| 9460 | struct alc_spec *spec = codec->spec; |
| 9461 | int i; |
| 9462 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9463 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9464 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 9465 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9466 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9467 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9468 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9469 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9470 | } |
| 9471 | } |
| 9472 | |
| 9473 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 9474 | { |
| 9475 | struct alc_spec *spec = codec->spec; |
| 9476 | hda_nid_t pin; |
| 9477 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9478 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9479 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9480 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 9481 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9482 | } |
| 9483 | |
| 9484 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 9485 | { |
| 9486 | struct alc_spec *spec = codec->spec; |
| 9487 | int i; |
| 9488 | |
| 9489 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9490 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9491 | if (nid >= 0x0c && nid <= 0x11) { |
| 9492 | snd_hda_codec_write(codec, nid, 0, |
| 9493 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9494 | i <= AUTO_PIN_FRONT_MIC ? |
| 9495 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9496 | } |
| 9497 | } |
| 9498 | } |
| 9499 | |
| 9500 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9501 | /* return 1 if successful, 0 if the proper config is not found, |
| 9502 | * or a negative error code |
| 9503 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9504 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 9505 | { |
| 9506 | struct alc_spec *spec = codec->spec; |
| 9507 | int err; |
| 9508 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 9509 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9510 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9511 | alc861_ignore); |
| 9512 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9513 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9514 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9515 | return 0; /* can't find valid BIOS pin config */ |
| 9516 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9517 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9518 | if (err < 0) |
| 9519 | return err; |
| 9520 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9521 | if (err < 0) |
| 9522 | return err; |
| 9523 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 9524 | if (err < 0) |
| 9525 | return err; |
| 9526 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9527 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9528 | return err; |
| 9529 | |
| 9530 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9531 | |
| 9532 | if (spec->autocfg.dig_out_pin) |
| 9533 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 9534 | |
| 9535 | if (spec->kctl_alloc) |
| 9536 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9537 | |
| 9538 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 9539 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9540 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9541 | spec->input_mux = &spec->private_imux; |
| 9542 | |
| 9543 | spec->adc_nids = alc861_adc_nids; |
| 9544 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 9545 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 9546 | spec->num_mixers++; |
| 9547 | |
| 9548 | return 1; |
| 9549 | } |
| 9550 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9551 | /* additional initialization for auto-configuration model */ |
| 9552 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9553 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9554 | alc861_auto_init_multi_out(codec); |
| 9555 | alc861_auto_init_hp_out(codec); |
| 9556 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9557 | } |
| 9558 | |
| 9559 | |
| 9560 | /* |
| 9561 | * configuration and preset |
| 9562 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9563 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 9564 | [ALC861_3ST] = "3stack", |
| 9565 | [ALC660_3ST] = "3stack-660", |
| 9566 | [ALC861_3ST_DIG] = "3stack-dig", |
| 9567 | [ALC861_6ST_DIG] = "6stack-dig", |
| 9568 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 9569 | [ALC861_TOSHIBA] = "toshiba", |
| 9570 | [ALC861_ASUS] = "asus", |
| 9571 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 9572 | [ALC861_AUTO] = "auto", |
| 9573 | }; |
| 9574 | |
| 9575 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 9576 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9577 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 9578 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f223a9f | 2007-04-25 13:38:31 +0200 | [diff] [blame] | 9579 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9580 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9581 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9582 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 9583 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 9584 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 9585 | * Any other models that need this preset? |
| 9586 | */ |
| 9587 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9588 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
Dave Jones | 35739bb | 2007-06-06 14:48:52 +0200 | [diff] [blame] | 9589 | SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), |
Takashi Iwai | 4147dab | 2007-01-31 10:35:19 +0100 | [diff] [blame] | 9590 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 9591 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9592 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 9593 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 9594 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9595 | {} |
| 9596 | }; |
| 9597 | |
| 9598 | static struct alc_config_preset alc861_presets[] = { |
| 9599 | [ALC861_3ST] = { |
| 9600 | .mixers = { alc861_3ST_mixer }, |
| 9601 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9602 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9603 | .dac_nids = alc861_dac_nids, |
| 9604 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9605 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9606 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9607 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9608 | .adc_nids = alc861_adc_nids, |
| 9609 | .input_mux = &alc861_capture_source, |
| 9610 | }, |
| 9611 | [ALC861_3ST_DIG] = { |
| 9612 | .mixers = { alc861_base_mixer }, |
| 9613 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9614 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9615 | .dac_nids = alc861_dac_nids, |
| 9616 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9617 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9618 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9619 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9620 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9621 | .adc_nids = alc861_adc_nids, |
| 9622 | .input_mux = &alc861_capture_source, |
| 9623 | }, |
| 9624 | [ALC861_6ST_DIG] = { |
| 9625 | .mixers = { alc861_base_mixer }, |
| 9626 | .init_verbs = { alc861_base_init_verbs }, |
| 9627 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9628 | .dac_nids = alc861_dac_nids, |
| 9629 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9630 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 9631 | .channel_mode = alc861_8ch_modes, |
| 9632 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9633 | .adc_nids = alc861_adc_nids, |
| 9634 | .input_mux = &alc861_capture_source, |
| 9635 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9636 | [ALC660_3ST] = { |
| 9637 | .mixers = { alc861_3ST_mixer }, |
| 9638 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9639 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 9640 | .dac_nids = alc660_dac_nids, |
| 9641 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9642 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9643 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9644 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9645 | .adc_nids = alc861_adc_nids, |
| 9646 | .input_mux = &alc861_capture_source, |
| 9647 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9648 | [ALC861_UNIWILL_M31] = { |
| 9649 | .mixers = { alc861_uniwill_m31_mixer }, |
| 9650 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 9651 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9652 | .dac_nids = alc861_dac_nids, |
| 9653 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9654 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 9655 | .channel_mode = alc861_uniwill_m31_modes, |
| 9656 | .need_dac_fix = 1, |
| 9657 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9658 | .adc_nids = alc861_adc_nids, |
| 9659 | .input_mux = &alc861_capture_source, |
| 9660 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9661 | [ALC861_TOSHIBA] = { |
| 9662 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9663 | .init_verbs = { alc861_base_init_verbs, |
| 9664 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9665 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9666 | .dac_nids = alc861_dac_nids, |
| 9667 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9668 | .channel_mode = alc883_3ST_2ch_modes, |
| 9669 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9670 | .adc_nids = alc861_adc_nids, |
| 9671 | .input_mux = &alc861_capture_source, |
| 9672 | .unsol_event = alc861_toshiba_unsol_event, |
| 9673 | .init_hook = alc861_toshiba_automute, |
| 9674 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9675 | [ALC861_ASUS] = { |
| 9676 | .mixers = { alc861_asus_mixer }, |
| 9677 | .init_verbs = { alc861_asus_init_verbs }, |
| 9678 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9679 | .dac_nids = alc861_dac_nids, |
| 9680 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9681 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 9682 | .channel_mode = alc861_asus_modes, |
| 9683 | .need_dac_fix = 1, |
| 9684 | .hp_nid = 0x06, |
| 9685 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9686 | .adc_nids = alc861_adc_nids, |
| 9687 | .input_mux = &alc861_capture_source, |
| 9688 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9689 | [ALC861_ASUS_LAPTOP] = { |
| 9690 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 9691 | .init_verbs = { alc861_asus_init_verbs, |
| 9692 | alc861_asus_laptop_init_verbs }, |
| 9693 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9694 | .dac_nids = alc861_dac_nids, |
| 9695 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9696 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9697 | .channel_mode = alc883_3ST_2ch_modes, |
| 9698 | .need_dac_fix = 1, |
| 9699 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9700 | .adc_nids = alc861_adc_nids, |
| 9701 | .input_mux = &alc861_capture_source, |
| 9702 | }, |
| 9703 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9704 | |
| 9705 | |
| 9706 | static int patch_alc861(struct hda_codec *codec) |
| 9707 | { |
| 9708 | struct alc_spec *spec; |
| 9709 | int board_config; |
| 9710 | int err; |
| 9711 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9712 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9713 | if (spec == NULL) |
| 9714 | return -ENOMEM; |
| 9715 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9716 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9717 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9718 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 9719 | alc861_models, |
| 9720 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9721 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9722 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9723 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 9724 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9725 | board_config = ALC861_AUTO; |
| 9726 | } |
| 9727 | |
| 9728 | if (board_config == ALC861_AUTO) { |
| 9729 | /* automatic parse from the BIOS config */ |
| 9730 | err = alc861_parse_auto_config(codec); |
| 9731 | if (err < 0) { |
| 9732 | alc_free(codec); |
| 9733 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9734 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9735 | printk(KERN_INFO |
| 9736 | "hda_codec: Cannot set up configuration " |
| 9737 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9738 | board_config = ALC861_3ST_DIG; |
| 9739 | } |
| 9740 | } |
| 9741 | |
| 9742 | if (board_config != ALC861_AUTO) |
| 9743 | setup_preset(spec, &alc861_presets[board_config]); |
| 9744 | |
| 9745 | spec->stream_name_analog = "ALC861 Analog"; |
| 9746 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 9747 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 9748 | |
| 9749 | spec->stream_name_digital = "ALC861 Digital"; |
| 9750 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 9751 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 9752 | |
| 9753 | codec->patch_ops = alc_patch_ops; |
| 9754 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9755 | spec->init_hook = alc861_auto_init; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9756 | |
| 9757 | return 0; |
| 9758 | } |
| 9759 | |
| 9760 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9761 | * ALC861-VD support |
| 9762 | * |
| 9763 | * Based on ALC882 |
| 9764 | * |
| 9765 | * In addition, an independent DAC |
| 9766 | */ |
| 9767 | #define ALC861VD_DIGOUT_NID 0x06 |
| 9768 | |
| 9769 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 9770 | /* front, surr, clfe, side surr */ |
| 9771 | 0x02, 0x03, 0x04, 0x05 |
| 9772 | }; |
| 9773 | |
| 9774 | /* dac_nids for ALC660vd are in a different order - according to |
| 9775 | * Realtek's driver. |
| 9776 | * This should probably tesult in a different mixer for 6stack models |
| 9777 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 9778 | * - and it is the same as in 861vd. |
| 9779 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 9780 | */ |
| 9781 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 9782 | /* front, rear, clfe, rear_surr */ |
| 9783 | 0x02, 0x04, 0x03 |
| 9784 | }; |
| 9785 | |
| 9786 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 9787 | /* ADC0 */ |
| 9788 | 0x09, |
| 9789 | }; |
| 9790 | |
| 9791 | /* input MUX */ |
| 9792 | /* FIXME: should be a matrix-type input source selection */ |
| 9793 | static struct hda_input_mux alc861vd_capture_source = { |
| 9794 | .num_items = 4, |
| 9795 | .items = { |
| 9796 | { "Mic", 0x0 }, |
| 9797 | { "Front Mic", 0x1 }, |
| 9798 | { "Line", 0x2 }, |
| 9799 | { "CD", 0x4 }, |
| 9800 | }, |
| 9801 | }; |
| 9802 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9803 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 9804 | .num_items = 3, |
| 9805 | .items = { |
| 9806 | { "Front Mic", 0x0 }, |
| 9807 | { "ATAPI Mic", 0x1 }, |
| 9808 | { "Line In", 0x5 }, |
| 9809 | }, |
| 9810 | }; |
| 9811 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9812 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 9813 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 9814 | |
| 9815 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9816 | struct snd_ctl_elem_value *ucontrol) |
| 9817 | { |
| 9818 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9819 | struct alc_spec *spec = codec->spec; |
| 9820 | const struct hda_input_mux *imux = spec->input_mux; |
| 9821 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9822 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 9823 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 9824 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 9825 | unsigned int i, idx; |
| 9826 | |
| 9827 | idx = ucontrol->value.enumerated.item[0]; |
| 9828 | if (idx >= imux->num_items) |
| 9829 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9830 | if (*cur_val == idx) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9831 | return 0; |
| 9832 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9833 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 9834 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 9835 | imux->items[i].index, |
| 9836 | HDA_AMP_MUTE, v); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9837 | } |
| 9838 | *cur_val = idx; |
| 9839 | return 1; |
| 9840 | } |
| 9841 | |
| 9842 | /* |
| 9843 | * 2ch mode |
| 9844 | */ |
| 9845 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 9846 | { 2, NULL } |
| 9847 | }; |
| 9848 | |
| 9849 | /* |
| 9850 | * 6ch mode |
| 9851 | */ |
| 9852 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 9853 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9854 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9855 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9856 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9857 | { } /* end */ |
| 9858 | }; |
| 9859 | |
| 9860 | /* |
| 9861 | * 8ch mode |
| 9862 | */ |
| 9863 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 9864 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9865 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9866 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9867 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9868 | { } /* end */ |
| 9869 | }; |
| 9870 | |
| 9871 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 9872 | { 6, alc861vd_6stack_ch6_init }, |
| 9873 | { 8, alc861vd_6stack_ch8_init }, |
| 9874 | }; |
| 9875 | |
| 9876 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 9877 | { |
| 9878 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9879 | .name = "Channel Mode", |
| 9880 | .info = alc_ch_mode_info, |
| 9881 | .get = alc_ch_mode_get, |
| 9882 | .put = alc_ch_mode_put, |
| 9883 | }, |
| 9884 | { } /* end */ |
| 9885 | }; |
| 9886 | |
| 9887 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 9888 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9889 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9890 | |
| 9891 | { |
| 9892 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9893 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9894 | * So call somewhat different.. |
| 9895 | *FIXME: the controls appear in the "playback" view! |
| 9896 | */ |
| 9897 | /* .name = "Capture Source", */ |
| 9898 | .name = "Input Source", |
| 9899 | .count = 1, |
| 9900 | .info = alc861vd_mux_enum_info, |
| 9901 | .get = alc861vd_mux_enum_get, |
| 9902 | .put = alc861vd_mux_enum_put, |
| 9903 | }, |
| 9904 | { } /* end */ |
| 9905 | }; |
| 9906 | |
| 9907 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 9908 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 9909 | */ |
| 9910 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 9911 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9912 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9913 | |
| 9914 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9915 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9916 | |
| 9917 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 9918 | HDA_OUTPUT), |
| 9919 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 9920 | HDA_OUTPUT), |
| 9921 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9922 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9923 | |
| 9924 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 9925 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9926 | |
| 9927 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9928 | |
| 9929 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9930 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9931 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9932 | |
| 9933 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9934 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9935 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9936 | |
| 9937 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9938 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9939 | |
| 9940 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9941 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9942 | |
| 9943 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9944 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9945 | |
| 9946 | { } /* end */ |
| 9947 | }; |
| 9948 | |
| 9949 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 9950 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9951 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9952 | |
| 9953 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9954 | |
| 9955 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9957 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9958 | |
| 9959 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9960 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9961 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9962 | |
| 9963 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9964 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9965 | |
| 9966 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9967 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9968 | |
| 9969 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9970 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9971 | |
| 9972 | { } /* end */ |
| 9973 | }; |
| 9974 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9975 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 9976 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9977 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 9978 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9979 | |
| 9980 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9981 | |
| 9982 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9983 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9984 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9985 | |
| 9986 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9987 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9988 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9989 | |
| 9990 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9991 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9992 | |
| 9993 | { } /* end */ |
| 9994 | }; |
| 9995 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9996 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 9997 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 9998 | */ |
| 9999 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 10000 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10001 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10002 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10003 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 10004 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10005 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10006 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10007 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10008 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10009 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10010 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10011 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10012 | { |
| 10013 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10014 | /* .name = "Capture Source", */ |
| 10015 | .name = "Input Source", |
| 10016 | .count = 1, |
| 10017 | .info = alc882_mux_enum_info, |
| 10018 | .get = alc882_mux_enum_get, |
| 10019 | .put = alc882_mux_enum_put, |
| 10020 | }, |
| 10021 | { } /* end */ |
| 10022 | }; |
| 10023 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10024 | /* |
| 10025 | * generic initialization of ADC, input mixers and output mixers |
| 10026 | */ |
| 10027 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 10028 | /* |
| 10029 | * Unmute ADC0 and set the default input to mic-in |
| 10030 | */ |
| 10031 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10032 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10033 | |
| 10034 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 10035 | * the analog-loopback mixer widget |
| 10036 | */ |
| 10037 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10038 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 10042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10043 | |
| 10044 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10045 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10048 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10049 | |
| 10050 | /* |
| 10051 | * Set up output mixers (0x02 - 0x05) |
| 10052 | */ |
| 10053 | /* set vol=0 to output mixers */ |
| 10054 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10055 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10056 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10057 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10058 | |
| 10059 | /* set up input amps for analog loopback */ |
| 10060 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10062 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10063 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10064 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10065 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10066 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10067 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10068 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10069 | |
| 10070 | { } |
| 10071 | }; |
| 10072 | |
| 10073 | /* |
| 10074 | * 3-stack pin configuration: |
| 10075 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 10076 | */ |
| 10077 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 10078 | /* |
| 10079 | * Set pin mode and muting |
| 10080 | */ |
| 10081 | /* set front pin widgets 0x14 for output */ |
| 10082 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10083 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10084 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10085 | |
| 10086 | /* Mic (rear) pin: input vref at 80% */ |
| 10087 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10088 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10089 | /* Front Mic pin: input vref at 80% */ |
| 10090 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10091 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10092 | /* Line In pin: input */ |
| 10093 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10094 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10095 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10096 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10097 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10098 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10099 | /* CD pin widget for input */ |
| 10100 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10101 | |
| 10102 | { } |
| 10103 | }; |
| 10104 | |
| 10105 | /* |
| 10106 | * 6-stack pin configuration: |
| 10107 | */ |
| 10108 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 10109 | /* |
| 10110 | * Set pin mode and muting |
| 10111 | */ |
| 10112 | /* set front pin widgets 0x14 for output */ |
| 10113 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10114 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10115 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10116 | |
| 10117 | /* Rear Pin: output 1 (0x0d) */ |
| 10118 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10119 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10120 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10121 | /* CLFE Pin: output 2 (0x0e) */ |
| 10122 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10123 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10124 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 10125 | /* Side Pin: output 3 (0x0f) */ |
| 10126 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10127 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10128 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 10129 | |
| 10130 | /* Mic (rear) pin: input vref at 80% */ |
| 10131 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10132 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10133 | /* Front Mic pin: input vref at 80% */ |
| 10134 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10135 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10136 | /* Line In pin: input */ |
| 10137 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10138 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10139 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10140 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10141 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10142 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10143 | /* CD pin widget for input */ |
| 10144 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10145 | |
| 10146 | { } |
| 10147 | }; |
| 10148 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10149 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 10150 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10151 | { } |
| 10152 | }; |
| 10153 | |
| 10154 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 10155 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10156 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10157 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10158 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10159 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10160 | {} |
| 10161 | }; |
| 10162 | |
| 10163 | /* toggle speaker-output according to the hp-jack state */ |
| 10164 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 10165 | { |
| 10166 | unsigned int present; |
| 10167 | unsigned char bits; |
| 10168 | |
| 10169 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 10170 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10171 | bits = present ? HDA_AMP_MUTE : 0; |
| 10172 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10173 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10174 | } |
| 10175 | |
| 10176 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 10177 | { |
| 10178 | unsigned int present; |
| 10179 | unsigned char bits; |
| 10180 | |
| 10181 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10182 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10183 | bits = present ? HDA_AMP_MUTE : 0; |
| 10184 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 10185 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10186 | } |
| 10187 | |
| 10188 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 10189 | { |
| 10190 | alc861vd_lenovo_hp_automute(codec); |
| 10191 | alc861vd_lenovo_mic_automute(codec); |
| 10192 | } |
| 10193 | |
| 10194 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 10195 | unsigned int res) |
| 10196 | { |
| 10197 | switch (res >> 26) { |
| 10198 | case ALC880_HP_EVENT: |
| 10199 | alc861vd_lenovo_hp_automute(codec); |
| 10200 | break; |
| 10201 | case ALC880_MIC_EVENT: |
| 10202 | alc861vd_lenovo_mic_automute(codec); |
| 10203 | break; |
| 10204 | } |
| 10205 | } |
| 10206 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10207 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 10208 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10209 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10210 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10211 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10212 | |
| 10213 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10214 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10215 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10216 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10217 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10218 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10219 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10220 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10221 | |
| 10222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10223 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10225 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10226 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10227 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10228 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10229 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10230 | |
| 10231 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10232 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10233 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10234 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10235 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10236 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10237 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10238 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10239 | |
| 10240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10242 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10243 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10244 | |
| 10245 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10246 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10247 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10248 | |
| 10249 | { } /* end */ |
| 10250 | }; |
| 10251 | |
| 10252 | /* toggle speaker-output according to the hp-jack state */ |
| 10253 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 10254 | { |
| 10255 | unsigned int present; |
| 10256 | |
| 10257 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10258 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10259 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10260 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10261 | } |
| 10262 | |
| 10263 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10264 | { |
| 10265 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10266 | alc861vd_dallas_automute(codec); |
| 10267 | } |
| 10268 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10269 | /* pcm configuration: identiacal with ALC880 */ |
| 10270 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 10271 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 10272 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 10273 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 10274 | |
| 10275 | /* |
| 10276 | * configuration and preset |
| 10277 | */ |
| 10278 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 10279 | [ALC660VD_3ST] = "3stack-660", |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10280 | [ALC660VD_3ST_DIG]= "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10281 | [ALC861VD_3ST] = "3stack", |
| 10282 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 10283 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10284 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10285 | [ALC861VD_DALLAS] = "dallas", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10286 | [ALC861VD_AUTO] = "auto", |
| 10287 | }; |
| 10288 | |
| 10289 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 10290 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10291 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10292 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10293 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10294 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10295 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10296 | SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS), |
| 10297 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10298 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
| 10299 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
Takashi Iwai | a18519e | 2007-06-14 12:58:23 +0200 | [diff] [blame] | 10300 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 10301 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10302 | {} |
| 10303 | }; |
| 10304 | |
| 10305 | static struct alc_config_preset alc861vd_presets[] = { |
| 10306 | [ALC660VD_3ST] = { |
| 10307 | .mixers = { alc861vd_3st_mixer }, |
| 10308 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10309 | alc861vd_3stack_init_verbs }, |
| 10310 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10311 | .dac_nids = alc660vd_dac_nids, |
| 10312 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10313 | .adc_nids = alc861vd_adc_nids, |
| 10314 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10315 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10316 | .input_mux = &alc861vd_capture_source, |
| 10317 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10318 | [ALC660VD_3ST_DIG] = { |
| 10319 | .mixers = { alc861vd_3st_mixer }, |
| 10320 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10321 | alc861vd_3stack_init_verbs }, |
| 10322 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10323 | .dac_nids = alc660vd_dac_nids, |
| 10324 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10325 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10326 | .adc_nids = alc861vd_adc_nids, |
| 10327 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10328 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10329 | .input_mux = &alc861vd_capture_source, |
| 10330 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10331 | [ALC861VD_3ST] = { |
| 10332 | .mixers = { alc861vd_3st_mixer }, |
| 10333 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10334 | alc861vd_3stack_init_verbs }, |
| 10335 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10336 | .dac_nids = alc861vd_dac_nids, |
| 10337 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10338 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10339 | .input_mux = &alc861vd_capture_source, |
| 10340 | }, |
| 10341 | [ALC861VD_3ST_DIG] = { |
| 10342 | .mixers = { alc861vd_3st_mixer }, |
| 10343 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10344 | alc861vd_3stack_init_verbs }, |
| 10345 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10346 | .dac_nids = alc861vd_dac_nids, |
| 10347 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10348 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10349 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10350 | .input_mux = &alc861vd_capture_source, |
| 10351 | }, |
| 10352 | [ALC861VD_6ST_DIG] = { |
| 10353 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 10354 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10355 | alc861vd_6stack_init_verbs }, |
| 10356 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10357 | .dac_nids = alc861vd_dac_nids, |
| 10358 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10359 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 10360 | .channel_mode = alc861vd_6stack_modes, |
| 10361 | .input_mux = &alc861vd_capture_source, |
| 10362 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10363 | [ALC861VD_LENOVO] = { |
| 10364 | .mixers = { alc861vd_lenovo_mixer }, |
| 10365 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10366 | alc861vd_3stack_init_verbs, |
| 10367 | alc861vd_eapd_verbs, |
| 10368 | alc861vd_lenovo_unsol_verbs }, |
| 10369 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10370 | .dac_nids = alc660vd_dac_nids, |
| 10371 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10372 | .adc_nids = alc861vd_adc_nids, |
| 10373 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10374 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10375 | .input_mux = &alc861vd_capture_source, |
| 10376 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 10377 | .init_hook = alc861vd_lenovo_automute, |
| 10378 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10379 | [ALC861VD_DALLAS] = { |
| 10380 | .mixers = { alc861vd_dallas_mixer }, |
| 10381 | .init_verbs = { alc861vd_dallas_verbs }, |
| 10382 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10383 | .dac_nids = alc861vd_dac_nids, |
| 10384 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10385 | .adc_nids = alc861vd_adc_nids, |
| 10386 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10387 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10388 | .input_mux = &alc861vd_dallas_capture_source, |
| 10389 | .unsol_event = alc861vd_dallas_unsol_event, |
| 10390 | .init_hook = alc861vd_dallas_automute, |
| 10391 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10392 | }; |
| 10393 | |
| 10394 | /* |
| 10395 | * BIOS auto configuration |
| 10396 | */ |
| 10397 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 10398 | hda_nid_t nid, int pin_type, int dac_idx) |
| 10399 | { |
| 10400 | /* set as output */ |
| 10401 | snd_hda_codec_write(codec, nid, 0, |
| 10402 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 10403 | snd_hda_codec_write(codec, nid, 0, |
| 10404 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 10405 | } |
| 10406 | |
| 10407 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 10408 | { |
| 10409 | struct alc_spec *spec = codec->spec; |
| 10410 | int i; |
| 10411 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10412 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10413 | for (i = 0; i <= HDA_SIDE; i++) { |
| 10414 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10415 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10416 | if (nid) |
| 10417 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10418 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10419 | } |
| 10420 | } |
| 10421 | |
| 10422 | |
| 10423 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 10424 | { |
| 10425 | struct alc_spec *spec = codec->spec; |
| 10426 | hda_nid_t pin; |
| 10427 | |
| 10428 | pin = spec->autocfg.hp_pins[0]; |
| 10429 | if (pin) /* connect to front and use dac 0 */ |
| 10430 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 10431 | } |
| 10432 | |
| 10433 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 10434 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 10435 | |
| 10436 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 10437 | { |
| 10438 | struct alc_spec *spec = codec->spec; |
| 10439 | int i; |
| 10440 | |
| 10441 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10442 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 10443 | if (alc861vd_is_input_pin(nid)) { |
| 10444 | snd_hda_codec_write(codec, nid, 0, |
| 10445 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10446 | i <= AUTO_PIN_FRONT_MIC ? |
| 10447 | PIN_VREF80 : PIN_IN); |
| 10448 | if (nid != ALC861VD_PIN_CD_NID) |
| 10449 | snd_hda_codec_write(codec, nid, 0, |
| 10450 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10451 | AMP_OUT_MUTE); |
| 10452 | } |
| 10453 | } |
| 10454 | } |
| 10455 | |
| 10456 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 10457 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 10458 | |
| 10459 | /* add playback controls from the parsed DAC table */ |
| 10460 | /* Based on ALC880 version. But ALC861VD has separate, |
| 10461 | * different NIDs for mute/unmute switch and volume control */ |
| 10462 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10463 | const struct auto_pin_cfg *cfg) |
| 10464 | { |
| 10465 | char name[32]; |
| 10466 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 10467 | hda_nid_t nid_v, nid_s; |
| 10468 | int i, err; |
| 10469 | |
| 10470 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10471 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10472 | continue; |
| 10473 | nid_v = alc861vd_idx_to_mixer_vol( |
| 10474 | alc880_dac_to_idx( |
| 10475 | spec->multiout.dac_nids[i])); |
| 10476 | nid_s = alc861vd_idx_to_mixer_switch( |
| 10477 | alc880_dac_to_idx( |
| 10478 | spec->multiout.dac_nids[i])); |
| 10479 | |
| 10480 | if (i == 2) { |
| 10481 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10482 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10483 | "Center Playback Volume", |
| 10484 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 10485 | HDA_OUTPUT)); |
| 10486 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10487 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10488 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10489 | "LFE Playback Volume", |
| 10490 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 10491 | HDA_OUTPUT)); |
| 10492 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10493 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10494 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10495 | "Center Playback Switch", |
| 10496 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 10497 | HDA_INPUT)); |
| 10498 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10499 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10500 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10501 | "LFE Playback Switch", |
| 10502 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 10503 | HDA_INPUT)); |
| 10504 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10505 | return err; |
| 10506 | } else { |
| 10507 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10508 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10509 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 10510 | HDA_OUTPUT)); |
| 10511 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10512 | return err; |
| 10513 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10514 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10515 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10516 | HDA_INPUT)); |
| 10517 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10518 | return err; |
| 10519 | } |
| 10520 | } |
| 10521 | return 0; |
| 10522 | } |
| 10523 | |
| 10524 | /* add playback controls for speaker and HP outputs */ |
| 10525 | /* Based on ALC880 version. But ALC861VD has separate, |
| 10526 | * different NIDs for mute/unmute switch and volume control */ |
| 10527 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 10528 | hda_nid_t pin, const char *pfx) |
| 10529 | { |
| 10530 | hda_nid_t nid_v, nid_s; |
| 10531 | int err; |
| 10532 | char name[32]; |
| 10533 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10534 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10535 | return 0; |
| 10536 | |
| 10537 | if (alc880_is_fixed_pin(pin)) { |
| 10538 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 10539 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10540 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10541 | spec->multiout.hp_nid = nid_v; |
| 10542 | else |
| 10543 | spec->multiout.extra_out_nid[0] = nid_v; |
| 10544 | /* control HP volume/switch on the output mixer amp */ |
| 10545 | nid_v = alc861vd_idx_to_mixer_vol( |
| 10546 | alc880_fixed_pin_idx(pin)); |
| 10547 | nid_s = alc861vd_idx_to_mixer_switch( |
| 10548 | alc880_fixed_pin_idx(pin)); |
| 10549 | |
| 10550 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10551 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10552 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 10553 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10554 | return err; |
| 10555 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10556 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 10557 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 10558 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10559 | return err; |
| 10560 | } else if (alc880_is_multi_pin(pin)) { |
| 10561 | /* set manual connection */ |
| 10562 | /* we have only a switch on HP-out PIN */ |
| 10563 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10564 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10565 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 10566 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10567 | return err; |
| 10568 | } |
| 10569 | return 0; |
| 10570 | } |
| 10571 | |
| 10572 | /* parse the BIOS configuration and set up the alc_spec |
| 10573 | * return 1 if successful, 0 if the proper config is not found, |
| 10574 | * or a negative error code |
| 10575 | * Based on ALC880 version - had to change it to override |
| 10576 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 10577 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 10578 | { |
| 10579 | struct alc_spec *spec = codec->spec; |
| 10580 | int err; |
| 10581 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 10582 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10583 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10584 | alc861vd_ignore); |
| 10585 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10586 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10587 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10588 | return 0; /* can't find valid BIOS pin config */ |
| 10589 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10590 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10591 | if (err < 0) |
| 10592 | return err; |
| 10593 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10594 | if (err < 0) |
| 10595 | return err; |
| 10596 | err = alc861vd_auto_create_extra_out(spec, |
| 10597 | spec->autocfg.speaker_pins[0], |
| 10598 | "Speaker"); |
| 10599 | if (err < 0) |
| 10600 | return err; |
| 10601 | err = alc861vd_auto_create_extra_out(spec, |
| 10602 | spec->autocfg.hp_pins[0], |
| 10603 | "Headphone"); |
| 10604 | if (err < 0) |
| 10605 | return err; |
| 10606 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10607 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10608 | return err; |
| 10609 | |
| 10610 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10611 | |
| 10612 | if (spec->autocfg.dig_out_pin) |
| 10613 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 10614 | |
| 10615 | if (spec->kctl_alloc) |
| 10616 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10617 | |
| 10618 | spec->init_verbs[spec->num_init_verbs++] |
| 10619 | = alc861vd_volume_init_verbs; |
| 10620 | |
| 10621 | spec->num_mux_defs = 1; |
| 10622 | spec->input_mux = &spec->private_imux; |
| 10623 | |
| 10624 | return 1; |
| 10625 | } |
| 10626 | |
| 10627 | /* additional initialization for auto-configuration model */ |
| 10628 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 10629 | { |
| 10630 | alc861vd_auto_init_multi_out(codec); |
| 10631 | alc861vd_auto_init_hp_out(codec); |
| 10632 | alc861vd_auto_init_analog_input(codec); |
| 10633 | } |
| 10634 | |
| 10635 | static int patch_alc861vd(struct hda_codec *codec) |
| 10636 | { |
| 10637 | struct alc_spec *spec; |
| 10638 | int err, board_config; |
| 10639 | |
| 10640 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10641 | if (spec == NULL) |
| 10642 | return -ENOMEM; |
| 10643 | |
| 10644 | codec->spec = spec; |
| 10645 | |
| 10646 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 10647 | alc861vd_models, |
| 10648 | alc861vd_cfg_tbl); |
| 10649 | |
| 10650 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 10651 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 10652 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 10653 | board_config = ALC861VD_AUTO; |
| 10654 | } |
| 10655 | |
| 10656 | if (board_config == ALC861VD_AUTO) { |
| 10657 | /* automatic parse from the BIOS config */ |
| 10658 | err = alc861vd_parse_auto_config(codec); |
| 10659 | if (err < 0) { |
| 10660 | alc_free(codec); |
| 10661 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10662 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10663 | printk(KERN_INFO |
| 10664 | "hda_codec: Cannot set up configuration " |
| 10665 | "from BIOS. Using base mode...\n"); |
| 10666 | board_config = ALC861VD_3ST; |
| 10667 | } |
| 10668 | } |
| 10669 | |
| 10670 | if (board_config != ALC861VD_AUTO) |
| 10671 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 10672 | |
| 10673 | spec->stream_name_analog = "ALC861VD Analog"; |
| 10674 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 10675 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 10676 | |
| 10677 | spec->stream_name_digital = "ALC861VD Digital"; |
| 10678 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 10679 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 10680 | |
| 10681 | spec->adc_nids = alc861vd_adc_nids; |
| 10682 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 10683 | |
| 10684 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 10685 | spec->num_mixers++; |
| 10686 | |
| 10687 | codec->patch_ops = alc_patch_ops; |
| 10688 | |
| 10689 | if (board_config == ALC861VD_AUTO) |
| 10690 | spec->init_hook = alc861vd_auto_init; |
| 10691 | |
| 10692 | return 0; |
| 10693 | } |
| 10694 | |
| 10695 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10696 | * ALC662 support |
| 10697 | * |
| 10698 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 10699 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 10700 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 10701 | * 6-channel independent captures. |
| 10702 | * |
| 10703 | * In addition, an independent DAC for the multi-playback (not used in this |
| 10704 | * driver yet). |
| 10705 | */ |
| 10706 | #define ALC662_DIGOUT_NID 0x06 |
| 10707 | #define ALC662_DIGIN_NID 0x0a |
| 10708 | |
| 10709 | static hda_nid_t alc662_dac_nids[4] = { |
| 10710 | /* front, rear, clfe, rear_surr */ |
| 10711 | 0x02, 0x03, 0x04 |
| 10712 | }; |
| 10713 | |
| 10714 | static hda_nid_t alc662_adc_nids[1] = { |
| 10715 | /* ADC1-2 */ |
| 10716 | 0x09, |
| 10717 | }; |
| 10718 | /* input MUX */ |
| 10719 | /* FIXME: should be a matrix-type input source selection */ |
| 10720 | |
| 10721 | static struct hda_input_mux alc662_capture_source = { |
| 10722 | .num_items = 4, |
| 10723 | .items = { |
| 10724 | { "Mic", 0x0 }, |
| 10725 | { "Front Mic", 0x1 }, |
| 10726 | { "Line", 0x2 }, |
| 10727 | { "CD", 0x4 }, |
| 10728 | }, |
| 10729 | }; |
| 10730 | |
| 10731 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 10732 | .num_items = 2, |
| 10733 | .items = { |
| 10734 | { "Mic", 0x1 }, |
| 10735 | { "Line", 0x2 }, |
| 10736 | }, |
| 10737 | }; |
| 10738 | #define alc662_mux_enum_info alc_mux_enum_info |
| 10739 | #define alc662_mux_enum_get alc_mux_enum_get |
| 10740 | |
| 10741 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10742 | struct snd_ctl_elem_value *ucontrol) |
| 10743 | { |
| 10744 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10745 | struct alc_spec *spec = codec->spec; |
| 10746 | const struct hda_input_mux *imux = spec->input_mux; |
| 10747 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 10748 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 10749 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 10750 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 10751 | unsigned int i, idx; |
| 10752 | |
| 10753 | idx = ucontrol->value.enumerated.item[0]; |
| 10754 | if (idx >= imux->num_items) |
| 10755 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10756 | if (*cur_val == idx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10757 | return 0; |
| 10758 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10759 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 10760 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 10761 | imux->items[i].index, |
| 10762 | HDA_AMP_MUTE, v); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10763 | } |
| 10764 | *cur_val = idx; |
| 10765 | return 1; |
| 10766 | } |
| 10767 | /* |
| 10768 | * 2ch mode |
| 10769 | */ |
| 10770 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 10771 | { 2, NULL } |
| 10772 | }; |
| 10773 | |
| 10774 | /* |
| 10775 | * 2ch mode |
| 10776 | */ |
| 10777 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 10778 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 10779 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 10780 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 10781 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 10782 | { } /* end */ |
| 10783 | }; |
| 10784 | |
| 10785 | /* |
| 10786 | * 6ch mode |
| 10787 | */ |
| 10788 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 10789 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10790 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10791 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 10792 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10793 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10794 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 10795 | { } /* end */ |
| 10796 | }; |
| 10797 | |
| 10798 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 10799 | { 2, alc662_3ST_ch2_init }, |
| 10800 | { 6, alc662_3ST_ch6_init }, |
| 10801 | }; |
| 10802 | |
| 10803 | /* |
| 10804 | * 2ch mode |
| 10805 | */ |
| 10806 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 10807 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10808 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10809 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10810 | { } /* end */ |
| 10811 | }; |
| 10812 | |
| 10813 | /* |
| 10814 | * 6ch mode |
| 10815 | */ |
| 10816 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 10817 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10818 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10819 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10820 | { } /* end */ |
| 10821 | }; |
| 10822 | |
| 10823 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 10824 | { 2, alc662_sixstack_ch6_init }, |
| 10825 | { 6, alc662_sixstack_ch8_init }, |
| 10826 | }; |
| 10827 | |
| 10828 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 10829 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 10830 | */ |
| 10831 | |
| 10832 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 10833 | /* output mixer control */ |
| 10834 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10835 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 10836 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10837 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10838 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 10839 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 10840 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 10841 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 10842 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10843 | |
| 10844 | /*Input mixer control */ |
| 10845 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 10846 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 10847 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 10848 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 10849 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 10850 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 10851 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 10852 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
| 10853 | |
| 10854 | /* Capture mixer control */ |
| 10855 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10856 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10857 | { |
| 10858 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10859 | .name = "Capture Source", |
| 10860 | .count = 1, |
| 10861 | .info = alc_mux_enum_info, |
| 10862 | .get = alc_mux_enum_get, |
| 10863 | .put = alc_mux_enum_put, |
| 10864 | }, |
| 10865 | { } /* end */ |
| 10866 | }; |
| 10867 | |
| 10868 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 10869 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10870 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10871 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10872 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10873 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10874 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10875 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10876 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10877 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10878 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10879 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10880 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10881 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10882 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10883 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10884 | { |
| 10885 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10886 | /* .name = "Capture Source", */ |
| 10887 | .name = "Input Source", |
| 10888 | .count = 1, |
| 10889 | .info = alc662_mux_enum_info, |
| 10890 | .get = alc662_mux_enum_get, |
| 10891 | .put = alc662_mux_enum_put, |
| 10892 | }, |
| 10893 | { } /* end */ |
| 10894 | }; |
| 10895 | |
| 10896 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 10897 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10898 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10899 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10900 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 10901 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 10902 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 10903 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 10904 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 10905 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10906 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10907 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10908 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10909 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10910 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10911 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10912 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10913 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10914 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10915 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10916 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10917 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10918 | { |
| 10919 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10920 | /* .name = "Capture Source", */ |
| 10921 | .name = "Input Source", |
| 10922 | .count = 1, |
| 10923 | .info = alc662_mux_enum_info, |
| 10924 | .get = alc662_mux_enum_get, |
| 10925 | .put = alc662_mux_enum_put, |
| 10926 | }, |
| 10927 | { } /* end */ |
| 10928 | }; |
| 10929 | |
| 10930 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 10931 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10932 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10933 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10934 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT), |
| 10935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10936 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10937 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10939 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10940 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10941 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10942 | { |
| 10943 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10944 | /* .name = "Capture Source", */ |
| 10945 | .name = "Input Source", |
| 10946 | .count = 1, |
| 10947 | .info = alc662_mux_enum_info, |
| 10948 | .get = alc662_mux_enum_get, |
| 10949 | .put = alc662_mux_enum_put, |
| 10950 | }, |
| 10951 | { } /* end */ |
| 10952 | }; |
| 10953 | |
| 10954 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 10955 | { |
| 10956 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10957 | .name = "Channel Mode", |
| 10958 | .info = alc_ch_mode_info, |
| 10959 | .get = alc_ch_mode_get, |
| 10960 | .put = alc_ch_mode_put, |
| 10961 | }, |
| 10962 | { } /* end */ |
| 10963 | }; |
| 10964 | |
| 10965 | static struct hda_verb alc662_init_verbs[] = { |
| 10966 | /* ADC: mute amp left and right */ |
| 10967 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10968 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10969 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 10970 | |
| 10971 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10972 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10973 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10974 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 10975 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10976 | |
| 10977 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10978 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10979 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10980 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10981 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10982 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10983 | |
| 10984 | /* Front Pin: output 0 (0x0c) */ |
| 10985 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10986 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10987 | |
| 10988 | /* Rear Pin: output 1 (0x0d) */ |
| 10989 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10990 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10991 | |
| 10992 | /* CLFE Pin: output 2 (0x0e) */ |
| 10993 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10994 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10995 | |
| 10996 | /* Mic (rear) pin: input vref at 80% */ |
| 10997 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10998 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10999 | /* Front Mic pin: input vref at 80% */ |
| 11000 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11001 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11002 | /* Line In pin: input */ |
| 11003 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11004 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11005 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11006 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11007 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11008 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11009 | /* CD pin widget for input */ |
| 11010 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11011 | |
| 11012 | /* FIXME: use matrix-type input source selection */ |
| 11013 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11014 | /* Input mixer */ |
| 11015 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11016 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11017 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11018 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11019 | { } |
| 11020 | }; |
| 11021 | |
| 11022 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 11023 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 11024 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 11025 | {} |
| 11026 | }; |
| 11027 | |
| 11028 | /* |
| 11029 | * generic initialization of ADC, input mixers and output mixers |
| 11030 | */ |
| 11031 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 11032 | /* |
| 11033 | * Unmute ADC and set the default input to mic-in |
| 11034 | */ |
| 11035 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11036 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11037 | |
| 11038 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 11039 | * mixer widget |
| 11040 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11041 | * panel mic (mic 2) |
| 11042 | */ |
| 11043 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11045 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11046 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11047 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 11048 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11049 | |
| 11050 | /* |
| 11051 | * Set up output mixers (0x0c - 0x0f) |
| 11052 | */ |
| 11053 | /* set vol=0 to output mixers */ |
| 11054 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11055 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11056 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11057 | |
| 11058 | /* set up input amps for analog loopback */ |
| 11059 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11060 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11061 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11062 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11063 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11064 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11065 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11066 | |
| 11067 | |
| 11068 | /* FIXME: use matrix-type input source selection */ |
| 11069 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11070 | /* Input mixer */ |
| 11071 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11072 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11074 | /*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/ |
| 11075 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11076 | |
| 11077 | { } |
| 11078 | }; |
| 11079 | |
| 11080 | /* capture mixer elements */ |
| 11081 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 11082 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11083 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11084 | { |
| 11085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11086 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11087 | * So call somewhat different.. |
| 11088 | * FIXME: the controls appear in the "playback" view! |
| 11089 | */ |
| 11090 | /* .name = "Capture Source", */ |
| 11091 | .name = "Input Source", |
| 11092 | .count = 1, |
| 11093 | .info = alc882_mux_enum_info, |
| 11094 | .get = alc882_mux_enum_get, |
| 11095 | .put = alc882_mux_enum_put, |
| 11096 | }, |
| 11097 | { } /* end */ |
| 11098 | }; |
| 11099 | |
| 11100 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 11101 | { |
| 11102 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11103 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11104 | |
| 11105 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11106 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11107 | bits = present ? HDA_AMP_MUTE : 0; |
| 11108 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11109 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11110 | } |
| 11111 | |
| 11112 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 11113 | { |
| 11114 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11115 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11116 | |
| 11117 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 11118 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11119 | bits = present ? HDA_AMP_MUTE : 0; |
| 11120 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11121 | HDA_AMP_MUTE, bits); |
| 11122 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11123 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11124 | } |
| 11125 | |
| 11126 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 11127 | unsigned int res) |
| 11128 | { |
| 11129 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11130 | alc662_lenovo_101e_all_automute(codec); |
| 11131 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 11132 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 11133 | } |
| 11134 | |
| 11135 | |
| 11136 | /* pcm configuration: identiacal with ALC880 */ |
| 11137 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 11138 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 11139 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 11140 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 11141 | |
| 11142 | /* |
| 11143 | * configuration and preset |
| 11144 | */ |
| 11145 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 11146 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 11147 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 11148 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 11149 | [ALC662_5ST_DIG] = "6stack-dig", |
| 11150 | [ALC662_LENOVO_101E] = "lenovo-101e", |
| 11151 | [ALC662_AUTO] = "auto", |
| 11152 | }; |
| 11153 | |
| 11154 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
| 11155 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
| 11156 | {} |
| 11157 | }; |
| 11158 | |
| 11159 | static struct alc_config_preset alc662_presets[] = { |
| 11160 | [ALC662_3ST_2ch_DIG] = { |
| 11161 | .mixers = { alc662_3ST_2ch_mixer }, |
| 11162 | .init_verbs = { alc662_init_verbs }, |
| 11163 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11164 | .dac_nids = alc662_dac_nids, |
| 11165 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11166 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11167 | .adc_nids = alc662_adc_nids, |
| 11168 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11169 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 11170 | .channel_mode = alc662_3ST_2ch_modes, |
| 11171 | .input_mux = &alc662_capture_source, |
| 11172 | }, |
| 11173 | [ALC662_3ST_6ch_DIG] = { |
| 11174 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 11175 | .init_verbs = { alc662_init_verbs }, |
| 11176 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11177 | .dac_nids = alc662_dac_nids, |
| 11178 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11179 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11180 | .adc_nids = alc662_adc_nids, |
| 11181 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11182 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 11183 | .channel_mode = alc662_3ST_6ch_modes, |
| 11184 | .need_dac_fix = 1, |
| 11185 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11186 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11187 | [ALC662_3ST_6ch] = { |
| 11188 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 11189 | .init_verbs = { alc662_init_verbs }, |
| 11190 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11191 | .dac_nids = alc662_dac_nids, |
| 11192 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11193 | .adc_nids = alc662_adc_nids, |
| 11194 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 11195 | .channel_mode = alc662_3ST_6ch_modes, |
| 11196 | .need_dac_fix = 1, |
| 11197 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11198 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11199 | [ALC662_5ST_DIG] = { |
| 11200 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
| 11201 | .init_verbs = { alc662_init_verbs }, |
| 11202 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11203 | .dac_nids = alc662_dac_nids, |
| 11204 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11205 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11206 | .adc_nids = alc662_adc_nids, |
| 11207 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11208 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 11209 | .channel_mode = alc662_5stack_modes, |
| 11210 | .input_mux = &alc662_capture_source, |
| 11211 | }, |
| 11212 | [ALC662_LENOVO_101E] = { |
| 11213 | .mixers = { alc662_lenovo_101e_mixer }, |
| 11214 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 11215 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11216 | .dac_nids = alc662_dac_nids, |
| 11217 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11218 | .adc_nids = alc662_adc_nids, |
| 11219 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 11220 | .channel_mode = alc662_3ST_2ch_modes, |
| 11221 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 11222 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 11223 | .init_hook = alc662_lenovo_101e_all_automute, |
| 11224 | }, |
| 11225 | |
| 11226 | }; |
| 11227 | |
| 11228 | |
| 11229 | /* |
| 11230 | * BIOS auto configuration |
| 11231 | */ |
| 11232 | |
| 11233 | /* add playback controls from the parsed DAC table */ |
| 11234 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11235 | const struct auto_pin_cfg *cfg) |
| 11236 | { |
| 11237 | char name[32]; |
| 11238 | static const char *chname[4] = { |
| 11239 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11240 | }; |
| 11241 | hda_nid_t nid; |
| 11242 | int i, err; |
| 11243 | |
| 11244 | for (i = 0; i < cfg->line_outs; i++) { |
| 11245 | if (!spec->multiout.dac_nids[i]) |
| 11246 | continue; |
Kailang Yang | 067b5a8 | 2007-07-05 12:35:15 +0200 | [diff] [blame] | 11247 | nid = alc880_idx_to_mixer(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11248 | if (i == 2) { |
| 11249 | /* Center/LFE */ |
| 11250 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11251 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11252 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11253 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11254 | if (err < 0) |
| 11255 | return err; |
| 11256 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11257 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11258 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11259 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11260 | if (err < 0) |
| 11261 | return err; |
| 11262 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11263 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11264 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 11265 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11266 | if (err < 0) |
| 11267 | return err; |
| 11268 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11269 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11270 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 11271 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11272 | if (err < 0) |
| 11273 | return err; |
| 11274 | } else { |
| 11275 | sprintf(name, "%s Playback Volume", chname[i]); |
| 11276 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11277 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11278 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11279 | if (err < 0) |
| 11280 | return err; |
| 11281 | sprintf(name, "%s Playback Switch", chname[i]); |
| 11282 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11283 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 11284 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11285 | if (err < 0) |
| 11286 | return err; |
| 11287 | } |
| 11288 | } |
| 11289 | return 0; |
| 11290 | } |
| 11291 | |
| 11292 | /* add playback controls for speaker and HP outputs */ |
| 11293 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 11294 | const char *pfx) |
| 11295 | { |
| 11296 | hda_nid_t nid; |
| 11297 | int err; |
| 11298 | char name[32]; |
| 11299 | |
| 11300 | if (!pin) |
| 11301 | return 0; |
| 11302 | |
| 11303 | if (alc880_is_fixed_pin(pin)) { |
| 11304 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11305 | /* printk("DAC nid=%x\n",nid); */ |
| 11306 | /* specify the DAC as the extra output */ |
| 11307 | if (!spec->multiout.hp_nid) |
| 11308 | spec->multiout.hp_nid = nid; |
| 11309 | else |
| 11310 | spec->multiout.extra_out_nid[0] = nid; |
| 11311 | /* control HP volume/switch on the output mixer amp */ |
| 11312 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11313 | sprintf(name, "%s Playback Volume", pfx); |
| 11314 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11315 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11316 | if (err < 0) |
| 11317 | return err; |
| 11318 | sprintf(name, "%s Playback Switch", pfx); |
| 11319 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11320 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 11321 | if (err < 0) |
| 11322 | return err; |
| 11323 | } else if (alc880_is_multi_pin(pin)) { |
| 11324 | /* set manual connection */ |
| 11325 | /* we have only a switch on HP-out PIN */ |
| 11326 | sprintf(name, "%s Playback Switch", pfx); |
| 11327 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11328 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 11329 | if (err < 0) |
| 11330 | return err; |
| 11331 | } |
| 11332 | return 0; |
| 11333 | } |
| 11334 | |
| 11335 | /* create playback/capture controls for input pins */ |
| 11336 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11337 | const struct auto_pin_cfg *cfg) |
| 11338 | { |
| 11339 | struct hda_input_mux *imux = &spec->private_imux; |
| 11340 | int i, err, idx; |
| 11341 | |
| 11342 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11343 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 11344 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 11345 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11346 | auto_pin_cfg_labels[i], |
| 11347 | idx, 0x0b); |
| 11348 | if (err < 0) |
| 11349 | return err; |
| 11350 | imux->items[imux->num_items].label = |
| 11351 | auto_pin_cfg_labels[i]; |
| 11352 | imux->items[imux->num_items].index = |
| 11353 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 11354 | imux->num_items++; |
| 11355 | } |
| 11356 | } |
| 11357 | return 0; |
| 11358 | } |
| 11359 | |
| 11360 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11361 | hda_nid_t nid, int pin_type, |
| 11362 | int dac_idx) |
| 11363 | { |
| 11364 | /* set as output */ |
| 11365 | snd_hda_codec_write(codec, nid, 0, |
| 11366 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 11367 | snd_hda_codec_write(codec, nid, 0, |
| 11368 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 11369 | /* need the manual connection? */ |
| 11370 | if (alc880_is_multi_pin(nid)) { |
| 11371 | struct alc_spec *spec = codec->spec; |
| 11372 | int idx = alc880_multi_pin_idx(nid); |
| 11373 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 11374 | AC_VERB_SET_CONNECT_SEL, |
| 11375 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 11376 | } |
| 11377 | } |
| 11378 | |
| 11379 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 11380 | { |
| 11381 | struct alc_spec *spec = codec->spec; |
| 11382 | int i; |
| 11383 | |
| 11384 | for (i = 0; i <= HDA_SIDE; i++) { |
| 11385 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11386 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11387 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11388 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11389 | i); |
| 11390 | } |
| 11391 | } |
| 11392 | |
| 11393 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 11394 | { |
| 11395 | struct alc_spec *spec = codec->spec; |
| 11396 | hda_nid_t pin; |
| 11397 | |
| 11398 | pin = spec->autocfg.hp_pins[0]; |
| 11399 | if (pin) /* connect to front */ |
| 11400 | /* use dac 0 */ |
| 11401 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 11402 | } |
| 11403 | |
| 11404 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 11405 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 11406 | |
| 11407 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 11408 | { |
| 11409 | struct alc_spec *spec = codec->spec; |
| 11410 | int i; |
| 11411 | |
| 11412 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11413 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 11414 | if (alc662_is_input_pin(nid)) { |
| 11415 | snd_hda_codec_write(codec, nid, 0, |
| 11416 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11417 | (i <= AUTO_PIN_FRONT_MIC ? |
| 11418 | PIN_VREF80 : PIN_IN)); |
| 11419 | if (nid != ALC662_PIN_CD_NID) |
| 11420 | snd_hda_codec_write(codec, nid, 0, |
| 11421 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11422 | AMP_OUT_MUTE); |
| 11423 | } |
| 11424 | } |
| 11425 | } |
| 11426 | |
| 11427 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 11428 | { |
| 11429 | struct alc_spec *spec = codec->spec; |
| 11430 | int err; |
| 11431 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 11432 | |
| 11433 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11434 | alc662_ignore); |
| 11435 | if (err < 0) |
| 11436 | return err; |
| 11437 | if (!spec->autocfg.line_outs) |
| 11438 | return 0; /* can't find valid BIOS pin config */ |
| 11439 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11440 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11441 | if (err < 0) |
| 11442 | return err; |
| 11443 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11444 | if (err < 0) |
| 11445 | return err; |
| 11446 | err = alc662_auto_create_extra_out(spec, |
| 11447 | spec->autocfg.speaker_pins[0], |
| 11448 | "Speaker"); |
| 11449 | if (err < 0) |
| 11450 | return err; |
| 11451 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 11452 | "Headphone"); |
| 11453 | if (err < 0) |
| 11454 | return err; |
| 11455 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11456 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11457 | return err; |
| 11458 | |
| 11459 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11460 | |
| 11461 | if (spec->autocfg.dig_out_pin) |
| 11462 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 11463 | |
| 11464 | if (spec->kctl_alloc) |
| 11465 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11466 | |
| 11467 | spec->num_mux_defs = 1; |
| 11468 | spec->input_mux = &spec->private_imux; |
| 11469 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11470 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11471 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 11472 | spec->num_mixers++; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11473 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11474 | } |
| 11475 | |
| 11476 | /* additional initialization for auto-configuration model */ |
| 11477 | static void alc662_auto_init(struct hda_codec *codec) |
| 11478 | { |
| 11479 | alc662_auto_init_multi_out(codec); |
| 11480 | alc662_auto_init_hp_out(codec); |
| 11481 | alc662_auto_init_analog_input(codec); |
| 11482 | } |
| 11483 | |
| 11484 | static int patch_alc662(struct hda_codec *codec) |
| 11485 | { |
| 11486 | struct alc_spec *spec; |
| 11487 | int err, board_config; |
| 11488 | |
| 11489 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11490 | if (!spec) |
| 11491 | return -ENOMEM; |
| 11492 | |
| 11493 | codec->spec = spec; |
| 11494 | |
| 11495 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 11496 | alc662_models, |
| 11497 | alc662_cfg_tbl); |
| 11498 | if (board_config < 0) { |
| 11499 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 11500 | "trying auto-probe from BIOS...\n"); |
| 11501 | board_config = ALC662_AUTO; |
| 11502 | } |
| 11503 | |
| 11504 | if (board_config == ALC662_AUTO) { |
| 11505 | /* automatic parse from the BIOS config */ |
| 11506 | err = alc662_parse_auto_config(codec); |
| 11507 | if (err < 0) { |
| 11508 | alc_free(codec); |
| 11509 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11510 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11511 | printk(KERN_INFO |
| 11512 | "hda_codec: Cannot set up configuration " |
| 11513 | "from BIOS. Using base mode...\n"); |
| 11514 | board_config = ALC662_3ST_2ch_DIG; |
| 11515 | } |
| 11516 | } |
| 11517 | |
| 11518 | if (board_config != ALC662_AUTO) |
| 11519 | setup_preset(spec, &alc662_presets[board_config]); |
| 11520 | |
| 11521 | spec->stream_name_analog = "ALC662 Analog"; |
| 11522 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 11523 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 11524 | |
| 11525 | spec->stream_name_digital = "ALC662 Digital"; |
| 11526 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 11527 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 11528 | |
| 11529 | if (!spec->adc_nids && spec->input_mux) { |
| 11530 | spec->adc_nids = alc662_adc_nids; |
| 11531 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 11532 | } |
| 11533 | |
| 11534 | codec->patch_ops = alc_patch_ops; |
| 11535 | if (board_config == ALC662_AUTO) |
| 11536 | spec->init_hook = alc662_auto_init; |
| 11537 | |
| 11538 | return 0; |
| 11539 | } |
| 11540 | |
| 11541 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11542 | * patch entries |
| 11543 | */ |
| 11544 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 11545 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11546 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11547 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11548 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11549 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11550 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 11551 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 11552 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11553 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 11554 | .patch = patch_alc883 }, |
| 11555 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 11556 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11557 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11558 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11559 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11560 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11561 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11562 | {} /* terminator */ |
| 11563 | }; |