Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
| 26 | #include <sound/driver.h> |
| 27 | #include <linux/init.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/slab.h> |
| 30 | #include <linux/pci.h> |
| 31 | #include <sound/core.h> |
| 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
| 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 63 | #ifdef CONFIG_SND_DEBUG |
| 64 | ALC880_TEST, |
| 65 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 66 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 67 | ALC880_MODEL_LAST /* last tag */ |
| 68 | }; |
| 69 | |
| 70 | /* ALC260 models */ |
| 71 | enum { |
| 72 | ALC260_BASIC, |
| 73 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 74 | ALC260_HP_3013, |
| 75 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 76 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 77 | ALC260_WILL, |
| 78 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 79 | #ifdef CONFIG_SND_DEBUG |
| 80 | ALC260_TEST, |
| 81 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 82 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 83 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | }; |
| 85 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | /* ALC262 models */ |
| 87 | enum { |
| 88 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 89 | ALC262_HIPPO, |
| 90 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 91 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 92 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 93 | ALC262_HP_BPC_D7000_WL, |
| 94 | ALC262_HP_BPC_D7000_WF, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 95 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 96 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 97 | ALC262_BENQ_T31, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 98 | ALC262_AUTO, |
| 99 | ALC262_MODEL_LAST /* last tag */ |
| 100 | }; |
| 101 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 102 | /* ALC268 models */ |
| 103 | enum { |
| 104 | ALC268_3ST, |
| 105 | ALC268_AUTO, |
| 106 | ALC268_MODEL_LAST /* last tag */ |
| 107 | }; |
| 108 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | /* ALC861 models */ |
| 110 | enum { |
| 111 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 112 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 113 | ALC861_3ST_DIG, |
| 114 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 115 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 116 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 117 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 118 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 119 | ALC861_AUTO, |
| 120 | ALC861_MODEL_LAST, |
| 121 | }; |
| 122 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 123 | /* ALC861-VD models */ |
| 124 | enum { |
| 125 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 126 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 127 | ALC861VD_3ST, |
| 128 | ALC861VD_3ST_DIG, |
| 129 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 130 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 131 | ALC861VD_DALLAS, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 132 | ALC861VD_AUTO, |
| 133 | ALC861VD_MODEL_LAST, |
| 134 | }; |
| 135 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 136 | /* ALC662 models */ |
| 137 | enum { |
| 138 | ALC662_3ST_2ch_DIG, |
| 139 | ALC662_3ST_6ch_DIG, |
| 140 | ALC662_3ST_6ch, |
| 141 | ALC662_5ST_DIG, |
| 142 | ALC662_LENOVO_101E, |
| 143 | ALC662_AUTO, |
| 144 | ALC662_MODEL_LAST, |
| 145 | }; |
| 146 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 147 | /* ALC882 models */ |
| 148 | enum { |
| 149 | ALC882_3ST_DIG, |
| 150 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 151 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 152 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 153 | ALC882_TARGA, |
| 154 | ALC882_ASUS_A7J, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 155 | ALC885_MACPRO, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 156 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 157 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 158 | ALC882_MODEL_LAST, |
| 159 | }; |
| 160 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 161 | /* ALC883 models */ |
| 162 | enum { |
| 163 | ALC883_3ST_2ch_DIG, |
| 164 | ALC883_3ST_6ch_DIG, |
| 165 | ALC883_3ST_6ch, |
| 166 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 167 | ALC883_TARGA_DIG, |
| 168 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 169 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 170 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 171 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 172 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 173 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 174 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 175 | ALC883_LENOVO_NB0763, |
| 176 | ALC888_LENOVO_MS7195_DIG, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 177 | ALC888_6ST_HP, |
| 178 | ALC888_3ST_HP, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 179 | ALC883_AUTO, |
| 180 | ALC883_MODEL_LAST, |
| 181 | }; |
| 182 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 183 | /* for GPIO Poll */ |
| 184 | #define GPIO_MASK 0x03 |
| 185 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | struct alc_spec { |
| 187 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 188 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | unsigned int num_mixers; |
| 190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 191 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 192 | * don't forget NULL |
| 193 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 194 | */ |
| 195 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 197 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | struct hda_pcm_stream *stream_analog_playback; |
| 199 | struct hda_pcm_stream *stream_analog_capture; |
| 200 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 201 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | struct hda_pcm_stream *stream_digital_playback; |
| 203 | struct hda_pcm_stream *stream_digital_capture; |
| 204 | |
| 205 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 206 | struct hda_multi_out multiout; /* playback set-up |
| 207 | * max_channels, dacs must be set |
| 208 | * dig_out_nid and hp_nid are optional |
| 209 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | |
| 211 | /* capture */ |
| 212 | unsigned int num_adc_nids; |
| 213 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 214 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | |
| 216 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 217 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | const struct hda_input_mux *input_mux; |
| 219 | unsigned int cur_mux[3]; |
| 220 | |
| 221 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 222 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 224 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | |
| 226 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 227 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 228 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 229 | /* dynamic controls, init_verbs and input_mux */ |
| 230 | struct auto_pin_cfg autocfg; |
| 231 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 232 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 233 | struct hda_input_mux private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 234 | hda_nid_t private_dac_nids[5]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 235 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 236 | /* hooks */ |
| 237 | void (*init_hook)(struct hda_codec *codec); |
| 238 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 239 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 240 | /* for pin sensing */ |
| 241 | unsigned int sense_updated: 1; |
| 242 | unsigned int jack_present: 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 243 | }; |
| 244 | |
| 245 | /* |
| 246 | * configuration template - to be copied to the spec instance |
| 247 | */ |
| 248 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 249 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 250 | * with spec |
| 251 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 252 | const struct hda_verb *init_verbs[5]; |
| 253 | unsigned int num_dacs; |
| 254 | hda_nid_t *dac_nids; |
| 255 | hda_nid_t dig_out_nid; /* optional */ |
| 256 | hda_nid_t hp_nid; /* optional */ |
| 257 | unsigned int num_adc_nids; |
| 258 | hda_nid_t *adc_nids; |
| 259 | hda_nid_t dig_in_nid; |
| 260 | unsigned int num_channel_mode; |
| 261 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 262 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 263 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 264 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 265 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 266 | void (*init_hook)(struct hda_codec *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | }; |
| 268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | |
| 270 | /* |
| 271 | * input MUX handling |
| 272 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 273 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 274 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | { |
| 276 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 277 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 278 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 279 | if (mux_idx >= spec->num_mux_defs) |
| 280 | mux_idx = 0; |
| 281 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | } |
| 283 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 284 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 285 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | { |
| 287 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 288 | struct alc_spec *spec = codec->spec; |
| 289 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 290 | |
| 291 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 292 | return 0; |
| 293 | } |
| 294 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 295 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 296 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | { |
| 298 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 299 | struct alc_spec *spec = codec->spec; |
| 300 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 301 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 302 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 303 | spec->adc_nids[adc_idx], |
| 304 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | } |
| 306 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 307 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | /* |
| 309 | * channel mode setting |
| 310 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 311 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 312 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | { |
| 314 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 315 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 316 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 317 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | } |
| 319 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 320 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 321 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | { |
| 323 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 324 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 325 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 326 | spec->num_channel_mode, |
| 327 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | } |
| 329 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 330 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 331 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | { |
| 333 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 334 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 335 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 336 | spec->num_channel_mode, |
| 337 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 338 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 339 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 340 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | } |
| 342 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 344 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 345 | * instead of "%" to avoid consequences of accidently treating the % as |
| 346 | * being part of a format specifier. Maximum allowed length of a value is |
| 347 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 348 | * |
| 349 | * Note: some retasking pin complexes seem to ignore requests for input |
| 350 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 351 | * are requested. Therefore order this list so that this behaviour will not |
| 352 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 353 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 354 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 355 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 356 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 357 | "Mic 50pc bias", "Mic 80pc bias", |
| 358 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 359 | }; |
| 360 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 361 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 362 | }; |
| 363 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 364 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 365 | * addition, "input" pins may or may not process the mic bias option |
| 366 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 367 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 368 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 369 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 370 | #define ALC_PIN_DIR_IN 0x00 |
| 371 | #define ALC_PIN_DIR_OUT 0x01 |
| 372 | #define ALC_PIN_DIR_INOUT 0x02 |
| 373 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 374 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 375 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 376 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 377 | * For each direction the minimum and maximum values are given. |
| 378 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 379 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 380 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 381 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 382 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 383 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 384 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 385 | }; |
| 386 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 387 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 388 | #define alc_pin_mode_n_items(_dir) \ |
| 389 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 390 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 391 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 392 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 393 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 394 | unsigned int item_num = uinfo->value.enumerated.item; |
| 395 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 396 | |
| 397 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 398 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 399 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 400 | |
| 401 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 402 | item_num = alc_pin_mode_min(dir); |
| 403 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 404 | return 0; |
| 405 | } |
| 406 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 407 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 408 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 409 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 410 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 411 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 412 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 413 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 414 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 415 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 416 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 417 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 418 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 419 | /* Find enumerated value for current pinctl setting */ |
| 420 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 421 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 422 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 423 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 424 | return 0; |
| 425 | } |
| 426 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 427 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 428 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 429 | { |
| 430 | signed int change; |
| 431 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 432 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 433 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 434 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 435 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 436 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 437 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 438 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 439 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 440 | val = alc_pin_mode_min(dir); |
| 441 | |
| 442 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 443 | if (change) { |
| 444 | /* Set pin mode to that requested */ |
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 | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 460 | snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0, |
| 461 | 0x80, 0x80); |
| 462 | snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0, |
| 463 | 0x80, 0x80); |
| 464 | snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 0, |
| 465 | 0x80, 0x00); |
| 466 | snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 0, |
| 467 | 0x80, 0x00); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 468 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 469 | snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 0, |
| 470 | 0x80, 0x80); |
| 471 | snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 0, |
| 472 | 0x80, 0x80); |
| 473 | snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0, |
| 474 | 0x80, 0x00); |
| 475 | snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0, |
| 476 | 0x80, 0x00); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 477 | } |
| 478 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 479 | return change; |
| 480 | } |
| 481 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 482 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 483 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 484 | .info = alc_pin_mode_info, \ |
| 485 | .get = alc_pin_mode_get, \ |
| 486 | .put = alc_pin_mode_put, \ |
| 487 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 488 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 489 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 490 | * together using a mask with more than one bit set. This control is |
| 491 | * currently used only by the ALC260 test model. At this stage they are not |
| 492 | * needed for any "production" models. |
| 493 | */ |
| 494 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 495 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 496 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 497 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 498 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 499 | { |
| 500 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 501 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 502 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 503 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 504 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 505 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 506 | |
| 507 | *valp = (val & mask) != 0; |
| 508 | return 0; |
| 509 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 510 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 511 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 512 | { |
| 513 | signed int change; |
| 514 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 515 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 516 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 517 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 518 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 519 | AC_VERB_GET_GPIO_DATA, |
| 520 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 521 | |
| 522 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 523 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 524 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 525 | gpio_data &= ~mask; |
| 526 | else |
| 527 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 528 | snd_hda_codec_write_cache(codec, nid, 0, |
| 529 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 530 | |
| 531 | return change; |
| 532 | } |
| 533 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 534 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 535 | .info = alc_gpio_data_info, \ |
| 536 | .get = alc_gpio_data_get, \ |
| 537 | .put = alc_gpio_data_put, \ |
| 538 | .private_value = nid | (mask<<16) } |
| 539 | #endif /* CONFIG_SND_DEBUG */ |
| 540 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 541 | /* A switch control to allow the enabling of the digital IO pins on the |
| 542 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 543 | * to provide something in the test model allowing digital outputs to be |
| 544 | * identified if present. If models are found which can utilise these |
| 545 | * outputs a more complete mixer control can be devised for those models if |
| 546 | * necessary. |
| 547 | */ |
| 548 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 549 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 550 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 551 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 552 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 553 | { |
| 554 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 555 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 556 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 557 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 559 | AC_VERB_GET_DIGI_CONVERT, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 560 | |
| 561 | *valp = (val & mask) != 0; |
| 562 | return 0; |
| 563 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 564 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 565 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 566 | { |
| 567 | signed int change; |
| 568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 569 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 570 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 571 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 572 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 573 | AC_VERB_GET_DIGI_CONVERT, |
| 574 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 575 | |
| 576 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 577 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 578 | if (val==0) |
| 579 | ctrl_data &= ~mask; |
| 580 | else |
| 581 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 582 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 583 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 584 | |
| 585 | return change; |
| 586 | } |
| 587 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 588 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 589 | .info = alc_spdif_ctrl_info, \ |
| 590 | .get = alc_spdif_ctrl_get, \ |
| 591 | .put = alc_spdif_ctrl_put, \ |
| 592 | .private_value = nid | (mask<<16) } |
| 593 | #endif /* CONFIG_SND_DEBUG */ |
| 594 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 595 | /* |
| 596 | * set up from the preset table |
| 597 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 598 | static void setup_preset(struct alc_spec *spec, |
| 599 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 600 | { |
| 601 | int i; |
| 602 | |
| 603 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 604 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 605 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 606 | i++) |
| 607 | spec->init_verbs[spec->num_init_verbs++] = |
| 608 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 609 | |
| 610 | spec->channel_mode = preset->channel_mode; |
| 611 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 612 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 613 | |
| 614 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 615 | |
| 616 | spec->multiout.num_dacs = preset->num_dacs; |
| 617 | spec->multiout.dac_nids = preset->dac_nids; |
| 618 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 619 | spec->multiout.hp_nid = preset->hp_nid; |
| 620 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 621 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 622 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 623 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 624 | spec->input_mux = preset->input_mux; |
| 625 | |
| 626 | spec->num_adc_nids = preset->num_adc_nids; |
| 627 | spec->adc_nids = preset->adc_nids; |
| 628 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 629 | |
| 630 | spec->unsol_event = preset->unsol_event; |
| 631 | spec->init_hook = preset->init_hook; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 632 | } |
| 633 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 634 | /* Enable GPIO mask and set output */ |
| 635 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 636 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 637 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 638 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 639 | { } |
| 640 | }; |
| 641 | |
| 642 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 643 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 644 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 645 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 646 | { } |
| 647 | }; |
| 648 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 649 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 650 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 651 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 652 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 653 | { } |
| 654 | }; |
| 655 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 656 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 657 | * 31 ~ 16 : Manufacture ID |
| 658 | * 15 ~ 8 : SKU ID |
| 659 | * 7 ~ 0 : Assembly ID |
| 660 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 661 | */ |
| 662 | static void alc_subsystem_id(struct hda_codec *codec, |
| 663 | unsigned int porta, unsigned int porte, |
| 664 | unsigned int portd) |
| 665 | { |
| 666 | unsigned int ass, tmp; |
| 667 | |
| 668 | ass = codec->subsystem_id; |
| 669 | if (!(ass & 1)) |
| 670 | return; |
| 671 | |
| 672 | /* Override */ |
| 673 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 674 | switch (tmp) { |
| 675 | case 1: |
| 676 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 677 | break; |
| 678 | case 3: |
| 679 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 680 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 681 | case 7: |
| 682 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 683 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 684 | case 5: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 685 | switch (codec->vendor_id) { |
| 686 | case 0x10ec0862: |
| 687 | case 0x10ec0660: |
| 688 | case 0x10ec0662: |
| 689 | case 0x10ec0267: |
| 690 | case 0x10ec0268: |
| 691 | snd_hda_codec_write(codec, 0x14, 0, |
| 692 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 693 | snd_hda_codec_write(codec, 0x15, 0, |
| 694 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 695 | return; |
| 696 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 697 | case 6: |
| 698 | if (ass & 4) { /* bit 2 : 0 = Desktop, 1 = Laptop */ |
| 699 | hda_nid_t port = 0; |
| 700 | tmp = (ass & 0x1800) >> 11; |
| 701 | switch (tmp) { |
| 702 | case 0: port = porta; break; |
| 703 | case 1: port = porte; break; |
| 704 | case 2: port = portd; break; |
| 705 | } |
| 706 | if (port) |
| 707 | snd_hda_codec_write(codec, port, 0, |
| 708 | AC_VERB_SET_EAPD_BTLENABLE, |
| 709 | 2); |
| 710 | } |
| 711 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 712 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, |
| 713 | (tmp == 5 ? 0x3040 : 0x3050)); |
| 714 | break; |
| 715 | } |
| 716 | } |
| 717 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 718 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 719 | * Fix-up pin default configurations |
| 720 | */ |
| 721 | |
| 722 | struct alc_pincfg { |
| 723 | hda_nid_t nid; |
| 724 | u32 val; |
| 725 | }; |
| 726 | |
| 727 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 728 | const struct snd_pci_quirk *quirk, |
| 729 | const struct alc_pincfg **pinfix) |
| 730 | { |
| 731 | const struct alc_pincfg *cfg; |
| 732 | |
| 733 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 734 | if (!quirk) |
| 735 | return; |
| 736 | |
| 737 | cfg = pinfix[quirk->value]; |
| 738 | for (; cfg->nid; cfg++) { |
| 739 | int i; |
| 740 | u32 val = cfg->val; |
| 741 | for (i = 0; i < 4; i++) { |
| 742 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 743 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 744 | val & 0xff); |
| 745 | val >>= 8; |
| 746 | } |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 751 | * ALC880 3-stack model |
| 752 | * |
| 753 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 754 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 755 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 756 | */ |
| 757 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 758 | static hda_nid_t alc880_dac_nids[4] = { |
| 759 | /* front, rear, clfe, rear_surr */ |
| 760 | 0x02, 0x05, 0x04, 0x03 |
| 761 | }; |
| 762 | |
| 763 | static hda_nid_t alc880_adc_nids[3] = { |
| 764 | /* ADC0-2 */ |
| 765 | 0x07, 0x08, 0x09, |
| 766 | }; |
| 767 | |
| 768 | /* The datasheet says the node 0x07 is connected from inputs, |
| 769 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 770 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 771 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 772 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 773 | /* ADC1-2 */ |
| 774 | 0x08, 0x09, |
| 775 | }; |
| 776 | |
| 777 | #define ALC880_DIGOUT_NID 0x06 |
| 778 | #define ALC880_DIGIN_NID 0x0a |
| 779 | |
| 780 | static struct hda_input_mux alc880_capture_source = { |
| 781 | .num_items = 4, |
| 782 | .items = { |
| 783 | { "Mic", 0x0 }, |
| 784 | { "Front Mic", 0x3 }, |
| 785 | { "Line", 0x2 }, |
| 786 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 787 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 788 | }; |
| 789 | |
| 790 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 791 | /* 2ch mode */ |
| 792 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 793 | /* set line-in to input, mute it */ |
| 794 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 795 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 796 | /* set mic-in to input vref 80%, mute it */ |
| 797 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 798 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 799 | { } /* end */ |
| 800 | }; |
| 801 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 802 | /* 6ch mode */ |
| 803 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 804 | /* set line-in to output, unmute it */ |
| 805 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 806 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 807 | /* set mic-in to output, unmute it */ |
| 808 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 809 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 810 | { } /* end */ |
| 811 | }; |
| 812 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 813 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 814 | { 2, alc880_threestack_ch2_init }, |
| 815 | { 6, alc880_threestack_ch6_init }, |
| 816 | }; |
| 817 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 818 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 819 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 820 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 821 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 822 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 823 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 824 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 825 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 826 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 827 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 828 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 829 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 830 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 831 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 832 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 833 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 834 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 835 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 836 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 837 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 838 | { |
| 839 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 840 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 841 | .info = alc_ch_mode_info, |
| 842 | .get = alc_ch_mode_get, |
| 843 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 844 | }, |
| 845 | { } /* end */ |
| 846 | }; |
| 847 | |
| 848 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 849 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 850 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 851 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 852 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 853 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 854 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 855 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 856 | { |
| 857 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 858 | /* The multiple "Capture Source" controls confuse alsamixer |
| 859 | * So call somewhat different.. |
| 860 | * FIXME: the controls appear in the "playback" view! |
| 861 | */ |
| 862 | /* .name = "Capture Source", */ |
| 863 | .name = "Input Source", |
| 864 | .count = 3, |
| 865 | .info = alc_mux_enum_info, |
| 866 | .get = alc_mux_enum_get, |
| 867 | .put = alc_mux_enum_put, |
| 868 | }, |
| 869 | { } /* end */ |
| 870 | }; |
| 871 | |
| 872 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 873 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 874 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 875 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 876 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 877 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 878 | { |
| 879 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 880 | /* The multiple "Capture Source" controls confuse alsamixer |
| 881 | * So call somewhat different.. |
| 882 | * FIXME: the controls appear in the "playback" view! |
| 883 | */ |
| 884 | /* .name = "Capture Source", */ |
| 885 | .name = "Input Source", |
| 886 | .count = 2, |
| 887 | .info = alc_mux_enum_info, |
| 888 | .get = alc_mux_enum_get, |
| 889 | .put = alc_mux_enum_put, |
| 890 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 891 | { } /* end */ |
| 892 | }; |
| 893 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 894 | |
| 895 | |
| 896 | /* |
| 897 | * ALC880 5-stack model |
| 898 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 899 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 900 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 901 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 902 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 903 | */ |
| 904 | |
| 905 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 906 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 907 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 908 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 909 | { } /* end */ |
| 910 | }; |
| 911 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 912 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 913 | /* 6ch mode */ |
| 914 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 915 | /* set line-in to input, mute it */ |
| 916 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 917 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 918 | { } /* end */ |
| 919 | }; |
| 920 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 921 | /* 8ch mode */ |
| 922 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 923 | /* set line-in to output, unmute it */ |
| 924 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 925 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 926 | { } /* end */ |
| 927 | }; |
| 928 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 929 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 930 | { 6, alc880_fivestack_ch6_init }, |
| 931 | { 8, alc880_fivestack_ch8_init }, |
| 932 | }; |
| 933 | |
| 934 | |
| 935 | /* |
| 936 | * ALC880 6-stack model |
| 937 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 938 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 939 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 940 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 941 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 942 | */ |
| 943 | |
| 944 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 945 | /* front, rear, clfe, rear_surr */ |
| 946 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 947 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 948 | |
| 949 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 950 | .num_items = 4, |
| 951 | .items = { |
| 952 | { "Mic", 0x0 }, |
| 953 | { "Front Mic", 0x1 }, |
| 954 | { "Line", 0x2 }, |
| 955 | { "CD", 0x4 }, |
| 956 | }, |
| 957 | }; |
| 958 | |
| 959 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 960 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 961 | { 8, NULL }, |
| 962 | }; |
| 963 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 964 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 965 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 966 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 967 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 968 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 969 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 970 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 971 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 972 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 973 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 974 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 975 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 976 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 977 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 978 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 981 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 982 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 983 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 984 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 985 | { |
| 986 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 987 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 988 | .info = alc_ch_mode_info, |
| 989 | .get = alc_ch_mode_get, |
| 990 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 991 | }, |
| 992 | { } /* end */ |
| 993 | }; |
| 994 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 995 | |
| 996 | /* |
| 997 | * ALC880 W810 model |
| 998 | * |
| 999 | * W810 has rear IO for: |
| 1000 | * Front (DAC 02) |
| 1001 | * Surround (DAC 03) |
| 1002 | * Center/LFE (DAC 04) |
| 1003 | * Digital out (06) |
| 1004 | * |
| 1005 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1006 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1007 | * |
| 1008 | * There is a variable resistor to control the speaker or headphone |
| 1009 | * volume. This is a hardware-only device without a software API. |
| 1010 | * |
| 1011 | * Plugging headphones in will disable the internal speakers. This is |
| 1012 | * implemented in hardware, not via the driver using jack sense. In |
| 1013 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1014 | * disable both the speakers and headphones. |
| 1015 | * |
| 1016 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1017 | * These may not do anything useful with this driver yet, because I |
| 1018 | * haven't setup any initialization verbs for these yet... |
| 1019 | */ |
| 1020 | |
| 1021 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1022 | /* front, rear/surround, clfe */ |
| 1023 | 0x02, 0x03, 0x04 |
| 1024 | }; |
| 1025 | |
| 1026 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1027 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1028 | { 6, NULL } |
| 1029 | }; |
| 1030 | |
| 1031 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1032 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1033 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1034 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1035 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1036 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1037 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1038 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1039 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1040 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1041 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1042 | { } /* end */ |
| 1043 | }; |
| 1044 | |
| 1045 | |
| 1046 | /* |
| 1047 | * Z710V model |
| 1048 | * |
| 1049 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1050 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1051 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1052 | */ |
| 1053 | |
| 1054 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1055 | 0x02 |
| 1056 | }; |
| 1057 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1058 | |
| 1059 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1060 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1061 | { 2, NULL } |
| 1062 | }; |
| 1063 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1064 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1065 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1066 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1067 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1068 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1069 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1070 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1071 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1072 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1073 | { } /* end */ |
| 1074 | }; |
| 1075 | |
| 1076 | |
| 1077 | /* FIXME! */ |
| 1078 | /* |
| 1079 | * ALC880 F1734 model |
| 1080 | * |
| 1081 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1082 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1083 | */ |
| 1084 | |
| 1085 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1086 | 0x03 |
| 1087 | }; |
| 1088 | #define ALC880_F1734_HP_DAC 0x02 |
| 1089 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1090 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1091 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1092 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1093 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1094 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1095 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1096 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1097 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1098 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1099 | { } /* end */ |
| 1100 | }; |
| 1101 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1102 | |
| 1103 | /* FIXME! */ |
| 1104 | /* |
| 1105 | * ALC880 ASUS model |
| 1106 | * |
| 1107 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1108 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1109 | * Mic = 0x18, Line = 0x1a |
| 1110 | */ |
| 1111 | |
| 1112 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1113 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1114 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1115 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1116 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1117 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1118 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1119 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1120 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1121 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1122 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1123 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1124 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1125 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1126 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1127 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1128 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1129 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1130 | { |
| 1131 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1132 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1133 | .info = alc_ch_mode_info, |
| 1134 | .get = alc_ch_mode_get, |
| 1135 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1136 | }, |
| 1137 | { } /* end */ |
| 1138 | }; |
| 1139 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1140 | /* FIXME! */ |
| 1141 | /* |
| 1142 | * ALC880 ASUS W1V model |
| 1143 | * |
| 1144 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1145 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1146 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1147 | */ |
| 1148 | |
| 1149 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1150 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1151 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1152 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1153 | { } /* end */ |
| 1154 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1155 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1156 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1157 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1158 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1159 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1160 | { } /* end */ |
| 1161 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1162 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1163 | /* TCL S700 */ |
| 1164 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1165 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1166 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1167 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1168 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1169 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1170 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1171 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1172 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1173 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1174 | { |
| 1175 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1176 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1177 | * So call somewhat different.. |
| 1178 | * FIXME: the controls appear in the "playback" view! |
| 1179 | */ |
| 1180 | /* .name = "Capture Source", */ |
| 1181 | .name = "Input Source", |
| 1182 | .count = 1, |
| 1183 | .info = alc_mux_enum_info, |
| 1184 | .get = alc_mux_enum_get, |
| 1185 | .put = alc_mux_enum_put, |
| 1186 | }, |
| 1187 | { } /* end */ |
| 1188 | }; |
| 1189 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1190 | /* Uniwill */ |
| 1191 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
| 1192 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1193 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1194 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1195 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1196 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1197 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1198 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1199 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1200 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1201 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1202 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1203 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1204 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1205 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1206 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1207 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1208 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1209 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1210 | { |
| 1211 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1212 | .name = "Channel Mode", |
| 1213 | .info = alc_ch_mode_info, |
| 1214 | .get = alc_ch_mode_get, |
| 1215 | .put = alc_ch_mode_put, |
| 1216 | }, |
| 1217 | { } /* end */ |
| 1218 | }; |
| 1219 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1220 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1221 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1222 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1223 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1224 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1225 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1226 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1227 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1228 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1229 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1230 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1231 | { } /* end */ |
| 1232 | }; |
| 1233 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1234 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
| 1235 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1236 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1237 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1238 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1239 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1240 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1241 | { } /* end */ |
| 1242 | }; |
| 1243 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1244 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1245 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1246 | */ |
| 1247 | static int alc_build_controls(struct hda_codec *codec) |
| 1248 | { |
| 1249 | struct alc_spec *spec = codec->spec; |
| 1250 | int err; |
| 1251 | int i; |
| 1252 | |
| 1253 | for (i = 0; i < spec->num_mixers; i++) { |
| 1254 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1255 | if (err < 0) |
| 1256 | return err; |
| 1257 | } |
| 1258 | |
| 1259 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1260 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1261 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1262 | if (err < 0) |
| 1263 | return err; |
| 1264 | } |
| 1265 | if (spec->dig_in_nid) { |
| 1266 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1267 | if (err < 0) |
| 1268 | return err; |
| 1269 | } |
| 1270 | return 0; |
| 1271 | } |
| 1272 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1274 | /* |
| 1275 | * initialize the codec volumes, etc |
| 1276 | */ |
| 1277 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1278 | /* |
| 1279 | * generic initialization of ADC, input mixers and output mixers |
| 1280 | */ |
| 1281 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1282 | /* |
| 1283 | * Unmute ADC0-2 and set the default input to mic-in |
| 1284 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1285 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1287 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1288 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1289 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1290 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1291 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1292 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1293 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1294 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1295 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1296 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1297 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1298 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1299 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1300 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 1301 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 1302 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1303 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1304 | /* |
| 1305 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1306 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1307 | /* set vol=0 to output mixers */ |
| 1308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1311 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1312 | /* set up input amps for analog loopback */ |
| 1313 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1314 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1315 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1316 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1317 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1318 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1319 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1320 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1321 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1322 | |
| 1323 | { } |
| 1324 | }; |
| 1325 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1326 | /* |
| 1327 | * 3-stack pin configuration: |
| 1328 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1329 | */ |
| 1330 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1331 | /* |
| 1332 | * preset connection lists of input pins |
| 1333 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1334 | */ |
| 1335 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1336 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1337 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1338 | |
| 1339 | /* |
| 1340 | * Set pin mode and muting |
| 1341 | */ |
| 1342 | /* set front pin widgets 0x14 for output */ |
| 1343 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1344 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1345 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1346 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1347 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1348 | /* Mic2 (as headphone out) for HP output */ |
| 1349 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1350 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1351 | /* Line In pin widget for input */ |
| 1352 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1353 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1354 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1355 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1356 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1357 | /* CD pin widget for input */ |
| 1358 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1359 | |
| 1360 | { } |
| 1361 | }; |
| 1362 | |
| 1363 | /* |
| 1364 | * 5-stack pin configuration: |
| 1365 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1366 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1367 | */ |
| 1368 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1369 | /* |
| 1370 | * preset connection lists of input pins |
| 1371 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1372 | */ |
| 1373 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1374 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1375 | |
| 1376 | /* |
| 1377 | * Set pin mode and muting |
| 1378 | */ |
| 1379 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1380 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1381 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1382 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1383 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1384 | /* unmute pins for output (no gain on this amp) */ |
| 1385 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1386 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1387 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1388 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1389 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1390 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1391 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1392 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1393 | /* Mic2 (as headphone out) for HP output */ |
| 1394 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1395 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1396 | /* Line In pin widget for input */ |
| 1397 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1398 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1399 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1400 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1401 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1402 | /* CD pin widget for input */ |
| 1403 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1404 | |
| 1405 | { } |
| 1406 | }; |
| 1407 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1408 | /* |
| 1409 | * W810 pin configuration: |
| 1410 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1411 | */ |
| 1412 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1413 | /* hphone/speaker input selector: front DAC */ |
| 1414 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1415 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1416 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1417 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1418 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1419 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1420 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1421 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1422 | |
| 1423 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1424 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1425 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1426 | { } |
| 1427 | }; |
| 1428 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1429 | /* |
| 1430 | * Z71V pin configuration: |
| 1431 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1432 | */ |
| 1433 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1434 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1435 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1436 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1437 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1438 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1439 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1440 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1441 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1442 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1443 | |
| 1444 | { } |
| 1445 | }; |
| 1446 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1447 | /* |
| 1448 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1449 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1450 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1451 | */ |
| 1452 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1453 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1454 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1455 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1456 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1457 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1458 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1459 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1460 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1461 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1462 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1463 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1464 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1465 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1466 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1467 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1468 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1469 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1470 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1471 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1472 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1473 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1474 | { } |
| 1475 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1476 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1477 | /* |
| 1478 | * Uniwill pin configuration: |
| 1479 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1480 | * line = 0x1a |
| 1481 | */ |
| 1482 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1483 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1484 | |
| 1485 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1486 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1487 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1488 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1489 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1490 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1491 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1492 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1493 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1494 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1495 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1496 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1497 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1498 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1499 | |
| 1500 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1502 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1503 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1504 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1505 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1506 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1507 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1508 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1509 | |
| 1510 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1511 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1512 | |
| 1513 | { } |
| 1514 | }; |
| 1515 | |
| 1516 | /* |
| 1517 | * Uniwill P53 |
| 1518 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1519 | */ |
| 1520 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1521 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1522 | |
| 1523 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1524 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1525 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1526 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1527 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1528 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1529 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1530 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1531 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1532 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1533 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1534 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1535 | |
| 1536 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1537 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1538 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1539 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1540 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1541 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1542 | |
| 1543 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1544 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1545 | |
| 1546 | { } |
| 1547 | }; |
| 1548 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1549 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1550 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1551 | { } |
| 1552 | }; |
| 1553 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1554 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1555 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1556 | { |
| 1557 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1558 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1559 | |
| 1560 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1561 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1562 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1563 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1564 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1565 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1566 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1567 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1568 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1569 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1570 | 0x80, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1571 | } |
| 1572 | |
| 1573 | /* auto-toggle front mic */ |
| 1574 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1575 | { |
| 1576 | unsigned int present; |
| 1577 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1578 | |
| 1579 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1580 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1581 | bits = present ? 0x80 : 0; |
| 1582 | snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, |
| 1583 | 0x80, bits); |
| 1584 | snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1, |
| 1585 | 0x80, bits); |
| 1586 | } |
| 1587 | |
| 1588 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1589 | { |
| 1590 | alc880_uniwill_hp_automute(codec); |
| 1591 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1592 | } |
| 1593 | |
| 1594 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1595 | unsigned int res) |
| 1596 | { |
| 1597 | /* Looks like the unsol event is incompatible with the standard |
| 1598 | * definition. 4bit tag is placed at 28 bit! |
| 1599 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1600 | switch (res >> 28) { |
| 1601 | case ALC880_HP_EVENT: |
| 1602 | alc880_uniwill_hp_automute(codec); |
| 1603 | break; |
| 1604 | case ALC880_MIC_EVENT: |
| 1605 | alc880_uniwill_mic_automute(codec); |
| 1606 | break; |
| 1607 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1608 | } |
| 1609 | |
| 1610 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1611 | { |
| 1612 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1613 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1614 | |
| 1615 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1616 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1617 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1618 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1619 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1620 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1621 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1622 | } |
| 1623 | |
| 1624 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1625 | { |
| 1626 | unsigned int present; |
| 1627 | |
| 1628 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 1629 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; |
| 1630 | |
| 1631 | snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 1632 | 0x7f, present); |
| 1633 | snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 1634 | 0x7f, present); |
| 1635 | |
| 1636 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 1637 | 0x7f, present); |
| 1638 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 1639 | 0x7f, present); |
| 1640 | |
| 1641 | } |
| 1642 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1643 | unsigned int res) |
| 1644 | { |
| 1645 | /* Looks like the unsol event is incompatible with the standard |
| 1646 | * definition. 4bit tag is placed at 28 bit! |
| 1647 | */ |
| 1648 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1649 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1650 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1651 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1652 | } |
| 1653 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1654 | /* FIXME! */ |
| 1655 | /* |
| 1656 | * F1734 pin configuration: |
| 1657 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1658 | */ |
| 1659 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1660 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1661 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1662 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1663 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1664 | |
| 1665 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1666 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1667 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1668 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1669 | |
| 1670 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1671 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1672 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1673 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1674 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1675 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1676 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1677 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1678 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1679 | |
| 1680 | { } |
| 1681 | }; |
| 1682 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1683 | /* FIXME! */ |
| 1684 | /* |
| 1685 | * ASUS pin configuration: |
| 1686 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1687 | */ |
| 1688 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1689 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1690 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1691 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1692 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1693 | |
| 1694 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1695 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1696 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1697 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1698 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1700 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1701 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1702 | |
| 1703 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1704 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1705 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1706 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1707 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1708 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1709 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1710 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1711 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1712 | |
| 1713 | { } |
| 1714 | }; |
| 1715 | |
| 1716 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1717 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1718 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1719 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1720 | /* Clevo m520g init */ |
| 1721 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1722 | /* headphone output */ |
| 1723 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1724 | /* line-out */ |
| 1725 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1726 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1727 | /* Line-in */ |
| 1728 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1729 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1730 | /* CD */ |
| 1731 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1732 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1733 | /* Mic1 (rear panel) */ |
| 1734 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1735 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1736 | /* Mic2 (front panel) */ |
| 1737 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1738 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1739 | /* headphone */ |
| 1740 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1741 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1742 | /* change to EAPD mode */ |
| 1743 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1744 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1745 | |
| 1746 | { } |
| 1747 | }; |
| 1748 | |
| 1749 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 1750 | /* change to EAPD mode */ |
| 1751 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1752 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1753 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1754 | /* Headphone output */ |
| 1755 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1756 | /* Front output*/ |
| 1757 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1758 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1759 | |
| 1760 | /* Line In pin widget for input */ |
| 1761 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1762 | /* CD pin widget for input */ |
| 1763 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1764 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1765 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1766 | |
| 1767 | /* change to EAPD mode */ |
| 1768 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1769 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 1770 | |
| 1771 | { } |
| 1772 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1773 | |
| 1774 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1775 | * LG m1 express dual |
| 1776 | * |
| 1777 | * Pin assignment: |
| 1778 | * Rear Line-In/Out (blue): 0x14 |
| 1779 | * Build-in Mic-In: 0x15 |
| 1780 | * Speaker-out: 0x17 |
| 1781 | * HP-Out (green): 0x1b |
| 1782 | * Mic-In/Out (red): 0x19 |
| 1783 | * SPDIF-Out: 0x1e |
| 1784 | */ |
| 1785 | |
| 1786 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 1787 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 1788 | 0x05, 0x02, 0x03 |
| 1789 | }; |
| 1790 | |
| 1791 | /* seems analog CD is not working */ |
| 1792 | static struct hda_input_mux alc880_lg_capture_source = { |
| 1793 | .num_items = 3, |
| 1794 | .items = { |
| 1795 | { "Mic", 0x1 }, |
| 1796 | { "Line", 0x5 }, |
| 1797 | { "Internal Mic", 0x6 }, |
| 1798 | }, |
| 1799 | }; |
| 1800 | |
| 1801 | /* 2,4,6 channel modes */ |
| 1802 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 1803 | /* set line-in and mic-in to input */ |
| 1804 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1805 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1806 | { } |
| 1807 | }; |
| 1808 | |
| 1809 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 1810 | /* set line-in to out and mic-in to input */ |
| 1811 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1812 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1813 | { } |
| 1814 | }; |
| 1815 | |
| 1816 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 1817 | /* set line-in and mic-in to output */ |
| 1818 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1819 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1820 | { } |
| 1821 | }; |
| 1822 | |
| 1823 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 1824 | { 2, alc880_lg_ch2_init }, |
| 1825 | { 4, alc880_lg_ch4_init }, |
| 1826 | { 6, alc880_lg_ch6_init }, |
| 1827 | }; |
| 1828 | |
| 1829 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 1830 | /* FIXME: it's not really "master" but front channels */ |
| 1831 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1832 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1833 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1834 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1835 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 1836 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 1837 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 1838 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 1839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1840 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1841 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 1842 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 1843 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 1844 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 1845 | { |
| 1846 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1847 | .name = "Channel Mode", |
| 1848 | .info = alc_ch_mode_info, |
| 1849 | .get = alc_ch_mode_get, |
| 1850 | .put = alc_ch_mode_put, |
| 1851 | }, |
| 1852 | { } /* end */ |
| 1853 | }; |
| 1854 | |
| 1855 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 1856 | /* set capture source to mic-in */ |
| 1857 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1858 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1859 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1860 | /* mute all amp mixer inputs */ |
| 1861 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 1862 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 1863 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1864 | /* line-in to input */ |
| 1865 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1866 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1867 | /* built-in mic */ |
| 1868 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1869 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1870 | /* speaker-out */ |
| 1871 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1872 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1873 | /* mic-in to input */ |
| 1874 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1875 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1876 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1877 | /* HP-out */ |
| 1878 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1879 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1880 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1881 | /* jack sense */ |
| 1882 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1883 | { } |
| 1884 | }; |
| 1885 | |
| 1886 | /* toggle speaker-output according to the hp-jack state */ |
| 1887 | static void alc880_lg_automute(struct hda_codec *codec) |
| 1888 | { |
| 1889 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1890 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1891 | |
| 1892 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1893 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1894 | bits = present ? 0x80 : 0; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1895 | snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1896 | 0x80, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1897 | snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1898 | 0x80, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1899 | } |
| 1900 | |
| 1901 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1902 | { |
| 1903 | /* Looks like the unsol event is incompatible with the standard |
| 1904 | * definition. 4bit tag is placed at 28 bit! |
| 1905 | */ |
| 1906 | if ((res >> 28) == 0x01) |
| 1907 | alc880_lg_automute(codec); |
| 1908 | } |
| 1909 | |
| 1910 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1911 | * LG LW20 |
| 1912 | * |
| 1913 | * Pin assignment: |
| 1914 | * Speaker-out: 0x14 |
| 1915 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1916 | * Built-in Mic-In: 0x19 |
| 1917 | * Line-In: 0x1b |
| 1918 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1919 | * SPDIF-Out: 0x1e |
| 1920 | */ |
| 1921 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1922 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1923 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1924 | .items = { |
| 1925 | { "Mic", 0x0 }, |
| 1926 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1927 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1928 | }, |
| 1929 | }; |
| 1930 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1931 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 1932 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1933 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1934 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1935 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1936 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1937 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1938 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1939 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1940 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1941 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1942 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1943 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1944 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1945 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1946 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 1947 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1948 | { |
| 1949 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1950 | .name = "Channel Mode", |
| 1951 | .info = alc_ch_mode_info, |
| 1952 | .get = alc_ch_mode_get, |
| 1953 | .put = alc_ch_mode_put, |
| 1954 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1955 | { } /* end */ |
| 1956 | }; |
| 1957 | |
| 1958 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1959 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1960 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1961 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1962 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1963 | /* set capture source to mic-in */ |
| 1964 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1965 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1966 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1967 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1968 | /* speaker-out */ |
| 1969 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1970 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1971 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1972 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1973 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1974 | /* mic-in to input */ |
| 1975 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1976 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1977 | /* built-in mic */ |
| 1978 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1979 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1980 | /* jack sense */ |
| 1981 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1982 | { } |
| 1983 | }; |
| 1984 | |
| 1985 | /* toggle speaker-output according to the hp-jack state */ |
| 1986 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 1987 | { |
| 1988 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1989 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1990 | |
| 1991 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1992 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1993 | bits = present ? 0x80 : 0; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1994 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1995 | 0x80, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1996 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1997 | 0x80, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1998 | } |
| 1999 | |
| 2000 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2001 | { |
| 2002 | /* Looks like the unsol event is incompatible with the standard |
| 2003 | * definition. 4bit tag is placed at 28 bit! |
| 2004 | */ |
| 2005 | if ((res >> 28) == 0x01) |
| 2006 | alc880_lg_lw_automute(codec); |
| 2007 | } |
| 2008 | |
| 2009 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2010 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2011 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2012 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2013 | static int alc_init(struct hda_codec *codec) |
| 2014 | { |
| 2015 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2016 | unsigned int i; |
| 2017 | |
| 2018 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2019 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2020 | |
| 2021 | if (spec->init_hook) |
| 2022 | spec->init_hook(codec); |
| 2023 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2024 | return 0; |
| 2025 | } |
| 2026 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2027 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2028 | { |
| 2029 | struct alc_spec *spec = codec->spec; |
| 2030 | |
| 2031 | if (spec->unsol_event) |
| 2032 | spec->unsol_event(codec, res); |
| 2033 | } |
| 2034 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2035 | /* |
| 2036 | * Analog playback callbacks |
| 2037 | */ |
| 2038 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2039 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2040 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2041 | { |
| 2042 | struct alc_spec *spec = codec->spec; |
| 2043 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2044 | } |
| 2045 | |
| 2046 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2047 | struct hda_codec *codec, |
| 2048 | unsigned int stream_tag, |
| 2049 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2050 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2051 | { |
| 2052 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2053 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2054 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2055 | } |
| 2056 | |
| 2057 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2058 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2059 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2060 | { |
| 2061 | struct alc_spec *spec = codec->spec; |
| 2062 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2063 | } |
| 2064 | |
| 2065 | /* |
| 2066 | * Digital out |
| 2067 | */ |
| 2068 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2069 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2070 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2071 | { |
| 2072 | struct alc_spec *spec = codec->spec; |
| 2073 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2074 | } |
| 2075 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2076 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2077 | struct hda_codec *codec, |
| 2078 | unsigned int stream_tag, |
| 2079 | unsigned int format, |
| 2080 | struct snd_pcm_substream *substream) |
| 2081 | { |
| 2082 | struct alc_spec *spec = codec->spec; |
| 2083 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2084 | stream_tag, format, substream); |
| 2085 | } |
| 2086 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2087 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2088 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2089 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2090 | { |
| 2091 | struct alc_spec *spec = codec->spec; |
| 2092 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2093 | } |
| 2094 | |
| 2095 | /* |
| 2096 | * Analog capture |
| 2097 | */ |
| 2098 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2099 | struct hda_codec *codec, |
| 2100 | unsigned int stream_tag, |
| 2101 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2102 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2103 | { |
| 2104 | struct alc_spec *spec = codec->spec; |
| 2105 | |
| 2106 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2107 | stream_tag, 0, format); |
| 2108 | return 0; |
| 2109 | } |
| 2110 | |
| 2111 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2112 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2113 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2114 | { |
| 2115 | struct alc_spec *spec = codec->spec; |
| 2116 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2117 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2118 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2119 | return 0; |
| 2120 | } |
| 2121 | |
| 2122 | |
| 2123 | /* |
| 2124 | */ |
| 2125 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2126 | .substreams = 1, |
| 2127 | .channels_min = 2, |
| 2128 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2129 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2130 | .ops = { |
| 2131 | .open = alc880_playback_pcm_open, |
| 2132 | .prepare = alc880_playback_pcm_prepare, |
| 2133 | .cleanup = alc880_playback_pcm_cleanup |
| 2134 | }, |
| 2135 | }; |
| 2136 | |
| 2137 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 2138 | .substreams = 2, |
| 2139 | .channels_min = 2, |
| 2140 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2141 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2142 | .ops = { |
| 2143 | .prepare = alc880_capture_pcm_prepare, |
| 2144 | .cleanup = alc880_capture_pcm_cleanup |
| 2145 | }, |
| 2146 | }; |
| 2147 | |
| 2148 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2149 | .substreams = 1, |
| 2150 | .channels_min = 2, |
| 2151 | .channels_max = 2, |
| 2152 | /* NID is set in alc_build_pcms */ |
| 2153 | .ops = { |
| 2154 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2155 | .close = alc880_dig_playback_pcm_close, |
| 2156 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2157 | }, |
| 2158 | }; |
| 2159 | |
| 2160 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2161 | .substreams = 1, |
| 2162 | .channels_min = 2, |
| 2163 | .channels_max = 2, |
| 2164 | /* NID is set in alc_build_pcms */ |
| 2165 | }; |
| 2166 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2167 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 2168 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 2169 | .substreams = 0, |
| 2170 | .channels_min = 0, |
| 2171 | .channels_max = 0, |
| 2172 | }; |
| 2173 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2174 | static int alc_build_pcms(struct hda_codec *codec) |
| 2175 | { |
| 2176 | struct alc_spec *spec = codec->spec; |
| 2177 | struct hda_pcm *info = spec->pcm_rec; |
| 2178 | int i; |
| 2179 | |
| 2180 | codec->num_pcms = 1; |
| 2181 | codec->pcm_info = info; |
| 2182 | |
| 2183 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2184 | if (spec->stream_analog_playback) { |
| 2185 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2186 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2187 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2188 | } |
| 2189 | if (spec->stream_analog_capture) { |
| 2190 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2191 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2192 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2193 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2194 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2195 | if (spec->channel_mode) { |
| 2196 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2197 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2198 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2199 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2200 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2201 | } |
| 2202 | } |
| 2203 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2204 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2205 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2206 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2207 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2208 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2209 | if (spec->multiout.dig_out_nid && |
| 2210 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2211 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2212 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2213 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2214 | if (spec->dig_in_nid && |
| 2215 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2216 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2217 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2218 | } |
| 2219 | } |
| 2220 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2221 | /* If the use of more than one ADC is requested for the current |
| 2222 | * model, configure a second analog capture-only PCM. |
| 2223 | */ |
| 2224 | /* Additional Analaog capture for index #2 */ |
| 2225 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2226 | spec->adc_nids) { |
| 2227 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2228 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2229 | info->name = spec->stream_name_analog; |
| 2230 | /* No playback stream for second PCM */ |
| 2231 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2232 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2233 | if (spec->stream_analog_capture) { |
| 2234 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2235 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2236 | } |
| 2237 | } |
| 2238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2239 | return 0; |
| 2240 | } |
| 2241 | |
| 2242 | static void alc_free(struct hda_codec *codec) |
| 2243 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2244 | struct alc_spec *spec = codec->spec; |
| 2245 | unsigned int i; |
| 2246 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2247 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2248 | return; |
| 2249 | |
| 2250 | if (spec->kctl_alloc) { |
| 2251 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2252 | kfree(spec->kctl_alloc[i].name); |
| 2253 | kfree(spec->kctl_alloc); |
| 2254 | } |
| 2255 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2256 | } |
| 2257 | |
| 2258 | /* |
| 2259 | */ |
| 2260 | static struct hda_codec_ops alc_patch_ops = { |
| 2261 | .build_controls = alc_build_controls, |
| 2262 | .build_pcms = alc_build_pcms, |
| 2263 | .init = alc_init, |
| 2264 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2265 | .unsol_event = alc_unsol_event, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2266 | }; |
| 2267 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2268 | |
| 2269 | /* |
| 2270 | * Test configuration for debugging |
| 2271 | * |
| 2272 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2273 | * enum controls. |
| 2274 | */ |
| 2275 | #ifdef CONFIG_SND_DEBUG |
| 2276 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2277 | 0x02, 0x03, 0x04, 0x05 |
| 2278 | }; |
| 2279 | |
| 2280 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2281 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2282 | .items = { |
| 2283 | { "In-1", 0x0 }, |
| 2284 | { "In-2", 0x1 }, |
| 2285 | { "In-3", 0x2 }, |
| 2286 | { "In-4", 0x3 }, |
| 2287 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2288 | { "Front", 0x5 }, |
| 2289 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2290 | }, |
| 2291 | }; |
| 2292 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2293 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2294 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2295 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2296 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2297 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2298 | }; |
| 2299 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2300 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2301 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2302 | { |
| 2303 | static char *texts[] = { |
| 2304 | "N/A", "Line Out", "HP Out", |
| 2305 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2306 | }; |
| 2307 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2308 | uinfo->count = 1; |
| 2309 | uinfo->value.enumerated.items = 8; |
| 2310 | if (uinfo->value.enumerated.item >= 8) |
| 2311 | uinfo->value.enumerated.item = 7; |
| 2312 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.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_get(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 | unsigned int pin_ctl, item = 0; |
| 2322 | |
| 2323 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2324 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2325 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2326 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2327 | item = 2; |
| 2328 | else |
| 2329 | item = 1; |
| 2330 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2331 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2332 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2333 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2334 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2335 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2336 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2337 | } |
| 2338 | } |
| 2339 | ucontrol->value.enumerated.item[0] = item; |
| 2340 | return 0; |
| 2341 | } |
| 2342 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2343 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2344 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2345 | { |
| 2346 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2347 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2348 | static unsigned int ctls[] = { |
| 2349 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2350 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2351 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2352 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2353 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2354 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2355 | }; |
| 2356 | unsigned int old_ctl, new_ctl; |
| 2357 | |
| 2358 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2359 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2360 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2361 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 2362 | int val; |
| 2363 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2364 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2365 | new_ctl); |
| 2366 | val = ucontrol->value.enumerated.item[0] >= 3 ? 0x80 : 0x00; |
| 2367 | snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0, |
| 2368 | 0x80, val); |
| 2369 | snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0, |
| 2370 | 0x80, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2371 | return 1; |
| 2372 | } |
| 2373 | return 0; |
| 2374 | } |
| 2375 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2376 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2377 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2378 | { |
| 2379 | static char *texts[] = { |
| 2380 | "Front", "Surround", "CLFE", "Side" |
| 2381 | }; |
| 2382 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2383 | uinfo->count = 1; |
| 2384 | uinfo->value.enumerated.items = 4; |
| 2385 | if (uinfo->value.enumerated.item >= 4) |
| 2386 | uinfo->value.enumerated.item = 3; |
| 2387 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2388 | return 0; |
| 2389 | } |
| 2390 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2391 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2392 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2393 | { |
| 2394 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2395 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2396 | unsigned int sel; |
| 2397 | |
| 2398 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2399 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2400 | return 0; |
| 2401 | } |
| 2402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2403 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2404 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2405 | { |
| 2406 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2407 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2408 | unsigned int sel; |
| 2409 | |
| 2410 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2411 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2412 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 2413 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2414 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2415 | return 1; |
| 2416 | } |
| 2417 | return 0; |
| 2418 | } |
| 2419 | |
| 2420 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2421 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2422 | .name = xname, \ |
| 2423 | .info = alc_test_pin_ctl_info, \ |
| 2424 | .get = alc_test_pin_ctl_get, \ |
| 2425 | .put = alc_test_pin_ctl_put, \ |
| 2426 | .private_value = nid \ |
| 2427 | } |
| 2428 | |
| 2429 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2430 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2431 | .name = xname, \ |
| 2432 | .info = alc_test_pin_src_info, \ |
| 2433 | .get = alc_test_pin_src_get, \ |
| 2434 | .put = alc_test_pin_src_put, \ |
| 2435 | .private_value = nid \ |
| 2436 | } |
| 2437 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2438 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2439 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2440 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2441 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2442 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2443 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2444 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2445 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2446 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2447 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2448 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2449 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2450 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2451 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2452 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2453 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2454 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2455 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2456 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2457 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2458 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2459 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2460 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2461 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2462 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2463 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2464 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2465 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2466 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2467 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2468 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2469 | { |
| 2470 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2471 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2472 | .info = alc_ch_mode_info, |
| 2473 | .get = alc_ch_mode_get, |
| 2474 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2475 | }, |
| 2476 | { } /* end */ |
| 2477 | }; |
| 2478 | |
| 2479 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2480 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2481 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2482 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2483 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2484 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2485 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2486 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2487 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2488 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2489 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2491 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2492 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2493 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2494 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2496 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2497 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2498 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2499 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2500 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2501 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2502 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2503 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2504 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2505 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2506 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2507 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2508 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2509 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2510 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2511 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2512 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2513 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2514 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2515 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2516 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2517 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2518 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2519 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2520 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2521 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2522 | /* Analog input/passthru */ |
| 2523 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2524 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2525 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2526 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2527 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2528 | { } |
| 2529 | }; |
| 2530 | #endif |
| 2531 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2532 | /* |
| 2533 | */ |
| 2534 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2535 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2536 | [ALC880_3ST] = "3stack", |
| 2537 | [ALC880_TCL_S700] = "tcl", |
| 2538 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2539 | [ALC880_CLEVO] = "clevo", |
| 2540 | [ALC880_5ST] = "5stack", |
| 2541 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2542 | [ALC880_W810] = "w810", |
| 2543 | [ALC880_Z71V] = "z71v", |
| 2544 | [ALC880_6ST] = "6stack", |
| 2545 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2546 | [ALC880_ASUS] = "asus", |
| 2547 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2548 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2549 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2550 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2551 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2552 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2553 | [ALC880_F1734] = "F1734", |
| 2554 | [ALC880_LG] = "lg", |
| 2555 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2556 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2557 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2558 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2559 | [ALC880_AUTO] = "auto", |
| 2560 | }; |
| 2561 | |
| 2562 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
| 2563 | /* Broken BIOS configuration */ |
| 2564 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), |
| 2565 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2566 | |
| 2567 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2568 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
Tobin Davis | 4dc53e2 | 2006-12-18 13:24:37 +0100 | [diff] [blame] | 2569 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2570 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2571 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2572 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2573 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2574 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2575 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
| 2576 | |
| 2577 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2578 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
| 2579 | |
| 2580 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2581 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2582 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2583 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2584 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2585 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2586 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2587 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2588 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2589 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2590 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2591 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2592 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2593 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
| 2594 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), |
| 2595 | |
| 2596 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2597 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
| 2598 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2599 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
| 2600 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
| 2601 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2602 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
| 2603 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
| 2604 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2605 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
| 2606 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2607 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2608 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
| 2609 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2610 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2611 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2612 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
| 2613 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
| 2614 | |
| 2615 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
| 2616 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2617 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
| 2618 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
| 2619 | |
| 2620 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
| 2621 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
| 2622 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2623 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2624 | |
| 2625 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2626 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
| 2627 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
| 2628 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
| 2629 | |
| 2630 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
| 2631 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2632 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
| 2633 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2634 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
| 2635 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
| 2636 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2637 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2638 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
| 2639 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
| 2640 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2641 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2642 | {} |
| 2643 | }; |
| 2644 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2645 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2646 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2647 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2648 | static struct alc_config_preset alc880_presets[] = { |
| 2649 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2650 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2651 | .init_verbs = { alc880_volume_init_verbs, |
| 2652 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2653 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2654 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2655 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2656 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2657 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2658 | .input_mux = &alc880_capture_source, |
| 2659 | }, |
| 2660 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2661 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2662 | .init_verbs = { alc880_volume_init_verbs, |
| 2663 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2664 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2665 | .dac_nids = alc880_dac_nids, |
| 2666 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2667 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2668 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2669 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2670 | .input_mux = &alc880_capture_source, |
| 2671 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2672 | [ALC880_TCL_S700] = { |
| 2673 | .mixers = { alc880_tcl_s700_mixer }, |
| 2674 | .init_verbs = { alc880_volume_init_verbs, |
| 2675 | alc880_pin_tcl_S700_init_verbs, |
| 2676 | alc880_gpio2_init_verbs }, |
| 2677 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2678 | .dac_nids = alc880_dac_nids, |
| 2679 | .hp_nid = 0x03, |
| 2680 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2681 | .channel_mode = alc880_2_jack_modes, |
| 2682 | .input_mux = &alc880_capture_source, |
| 2683 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2684 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2685 | .mixers = { alc880_three_stack_mixer, |
| 2686 | alc880_five_stack_mixer}, |
| 2687 | .init_verbs = { alc880_volume_init_verbs, |
| 2688 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2689 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2690 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2691 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2692 | .channel_mode = alc880_fivestack_modes, |
| 2693 | .input_mux = &alc880_capture_source, |
| 2694 | }, |
| 2695 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2696 | .mixers = { alc880_three_stack_mixer, |
| 2697 | alc880_five_stack_mixer }, |
| 2698 | .init_verbs = { alc880_volume_init_verbs, |
| 2699 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2700 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2701 | .dac_nids = alc880_dac_nids, |
| 2702 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2703 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2704 | .channel_mode = alc880_fivestack_modes, |
| 2705 | .input_mux = &alc880_capture_source, |
| 2706 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2707 | [ALC880_6ST] = { |
| 2708 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2709 | .init_verbs = { alc880_volume_init_verbs, |
| 2710 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2711 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2712 | .dac_nids = alc880_6st_dac_nids, |
| 2713 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2714 | .channel_mode = alc880_sixstack_modes, |
| 2715 | .input_mux = &alc880_6stack_capture_source, |
| 2716 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2717 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2718 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2719 | .init_verbs = { alc880_volume_init_verbs, |
| 2720 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2721 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2722 | .dac_nids = alc880_6st_dac_nids, |
| 2723 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2724 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2725 | .channel_mode = alc880_sixstack_modes, |
| 2726 | .input_mux = &alc880_6stack_capture_source, |
| 2727 | }, |
| 2728 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2729 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2730 | .init_verbs = { alc880_volume_init_verbs, |
| 2731 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2732 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2733 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 2734 | .dac_nids = alc880_w810_dac_nids, |
| 2735 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2736 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2737 | .channel_mode = alc880_w810_modes, |
| 2738 | .input_mux = &alc880_capture_source, |
| 2739 | }, |
| 2740 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2741 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2742 | .init_verbs = { alc880_volume_init_verbs, |
| 2743 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2744 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 2745 | .dac_nids = alc880_z71v_dac_nids, |
| 2746 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2747 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2748 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2749 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2750 | .input_mux = &alc880_capture_source, |
| 2751 | }, |
| 2752 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2753 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2754 | .init_verbs = { alc880_volume_init_verbs, |
| 2755 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2756 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 2757 | .dac_nids = alc880_f1734_dac_nids, |
| 2758 | .hp_nid = 0x02, |
| 2759 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2760 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2761 | .input_mux = &alc880_capture_source, |
| 2762 | }, |
| 2763 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2764 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2765 | .init_verbs = { alc880_volume_init_verbs, |
| 2766 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2767 | alc880_gpio1_init_verbs }, |
| 2768 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2769 | .dac_nids = alc880_asus_dac_nids, |
| 2770 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2771 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2772 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2773 | .input_mux = &alc880_capture_source, |
| 2774 | }, |
| 2775 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2776 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2777 | .init_verbs = { alc880_volume_init_verbs, |
| 2778 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2779 | alc880_gpio1_init_verbs }, |
| 2780 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2781 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2782 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2783 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2784 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2785 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2786 | .input_mux = &alc880_capture_source, |
| 2787 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2788 | [ALC880_ASUS_DIG2] = { |
| 2789 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2790 | .init_verbs = { alc880_volume_init_verbs, |
| 2791 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2792 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 2793 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2794 | .dac_nids = alc880_asus_dac_nids, |
| 2795 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2796 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2797 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2798 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2799 | .input_mux = &alc880_capture_source, |
| 2800 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2801 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2802 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2803 | .init_verbs = { alc880_volume_init_verbs, |
| 2804 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2805 | alc880_gpio1_init_verbs }, |
| 2806 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2807 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2808 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2809 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2810 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2811 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2812 | .input_mux = &alc880_capture_source, |
| 2813 | }, |
| 2814 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 2815 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2816 | .init_verbs = { alc880_volume_init_verbs, |
| 2817 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2818 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2819 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2820 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2821 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2822 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2823 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2824 | .input_mux = &alc880_capture_source, |
| 2825 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2826 | [ALC880_UNIWILL] = { |
| 2827 | .mixers = { alc880_uniwill_mixer }, |
| 2828 | .init_verbs = { alc880_volume_init_verbs, |
| 2829 | alc880_uniwill_init_verbs }, |
| 2830 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2831 | .dac_nids = alc880_asus_dac_nids, |
| 2832 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2833 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2834 | .channel_mode = alc880_threestack_modes, |
| 2835 | .need_dac_fix = 1, |
| 2836 | .input_mux = &alc880_capture_source, |
| 2837 | .unsol_event = alc880_uniwill_unsol_event, |
| 2838 | .init_hook = alc880_uniwill_automute, |
| 2839 | }, |
| 2840 | [ALC880_UNIWILL_P53] = { |
| 2841 | .mixers = { alc880_uniwill_p53_mixer }, |
| 2842 | .init_verbs = { alc880_volume_init_verbs, |
| 2843 | alc880_uniwill_p53_init_verbs }, |
| 2844 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2845 | .dac_nids = alc880_asus_dac_nids, |
| 2846 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2847 | .channel_mode = alc880_threestack_modes, |
| 2848 | .input_mux = &alc880_capture_source, |
| 2849 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2850 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2851 | }, |
| 2852 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2853 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2854 | alc880_pcbeep_mixer, }, |
| 2855 | .init_verbs = { alc880_volume_init_verbs, |
| 2856 | alc880_uniwill_p53_init_verbs, |
| 2857 | alc880_beep_init_verbs }, |
| 2858 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2859 | .dac_nids = alc880_dac_nids, |
| 2860 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2861 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2862 | .input_mux = &alc880_capture_source, |
| 2863 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2864 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2865 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2866 | [ALC880_CLEVO] = { |
| 2867 | .mixers = { alc880_three_stack_mixer }, |
| 2868 | .init_verbs = { alc880_volume_init_verbs, |
| 2869 | alc880_pin_clevo_init_verbs }, |
| 2870 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2871 | .dac_nids = alc880_dac_nids, |
| 2872 | .hp_nid = 0x03, |
| 2873 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2874 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2875 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2876 | .input_mux = &alc880_capture_source, |
| 2877 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2878 | [ALC880_LG] = { |
| 2879 | .mixers = { alc880_lg_mixer }, |
| 2880 | .init_verbs = { alc880_volume_init_verbs, |
| 2881 | alc880_lg_init_verbs }, |
| 2882 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 2883 | .dac_nids = alc880_lg_dac_nids, |
| 2884 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2885 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 2886 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2887 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2888 | .input_mux = &alc880_lg_capture_source, |
| 2889 | .unsol_event = alc880_lg_unsol_event, |
| 2890 | .init_hook = alc880_lg_automute, |
| 2891 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2892 | [ALC880_LG_LW] = { |
| 2893 | .mixers = { alc880_lg_lw_mixer }, |
| 2894 | .init_verbs = { alc880_volume_init_verbs, |
| 2895 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2896 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2897 | .dac_nids = alc880_dac_nids, |
| 2898 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2899 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 2900 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2901 | .input_mux = &alc880_lg_lw_capture_source, |
| 2902 | .unsol_event = alc880_lg_lw_unsol_event, |
| 2903 | .init_hook = alc880_lg_lw_automute, |
| 2904 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2905 | #ifdef CONFIG_SND_DEBUG |
| 2906 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2907 | .mixers = { alc880_test_mixer }, |
| 2908 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2909 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 2910 | .dac_nids = alc880_test_dac_nids, |
| 2911 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2912 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 2913 | .channel_mode = alc880_test_modes, |
| 2914 | .input_mux = &alc880_test_capture_source, |
| 2915 | }, |
| 2916 | #endif |
| 2917 | }; |
| 2918 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2919 | /* |
| 2920 | * Automatic parse of I/O pins from the BIOS configuration |
| 2921 | */ |
| 2922 | |
| 2923 | #define NUM_CONTROL_ALLOC 32 |
| 2924 | #define NUM_VERB_ALLOC 32 |
| 2925 | |
| 2926 | enum { |
| 2927 | ALC_CTL_WIDGET_VOL, |
| 2928 | ALC_CTL_WIDGET_MUTE, |
| 2929 | ALC_CTL_BIND_MUTE, |
| 2930 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2931 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2932 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2933 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2934 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2935 | }; |
| 2936 | |
| 2937 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2938 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 2939 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2940 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2941 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2942 | |
| 2943 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 2944 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 2945 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2946 | /* array + terminator */ |
| 2947 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 2948 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2949 | return -ENOMEM; |
| 2950 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2951 | memcpy(knew, spec->kctl_alloc, |
| 2952 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2953 | kfree(spec->kctl_alloc); |
| 2954 | } |
| 2955 | spec->kctl_alloc = knew; |
| 2956 | spec->num_kctl_alloc = num; |
| 2957 | } |
| 2958 | |
| 2959 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 2960 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 2961 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2962 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2963 | return -ENOMEM; |
| 2964 | knew->private_value = val; |
| 2965 | spec->num_kctl_used++; |
| 2966 | return 0; |
| 2967 | } |
| 2968 | |
| 2969 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 2970 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 2971 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 2972 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 2973 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 2974 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 2975 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 2976 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 2977 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 2978 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 2979 | #define ALC880_PIN_CD_NID 0x1c |
| 2980 | |
| 2981 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2982 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 2983 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2984 | { |
| 2985 | hda_nid_t nid; |
| 2986 | int assigned[4]; |
| 2987 | int i, j; |
| 2988 | |
| 2989 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2990 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2991 | |
| 2992 | /* check the pins hardwired to audio widget */ |
| 2993 | for (i = 0; i < cfg->line_outs; i++) { |
| 2994 | nid = cfg->line_out_pins[i]; |
| 2995 | if (alc880_is_fixed_pin(nid)) { |
| 2996 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 2997 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2998 | assigned[idx] = 1; |
| 2999 | } |
| 3000 | } |
| 3001 | /* left pins can be connect to any audio widget */ |
| 3002 | for (i = 0; i < cfg->line_outs; i++) { |
| 3003 | nid = cfg->line_out_pins[i]; |
| 3004 | if (alc880_is_fixed_pin(nid)) |
| 3005 | continue; |
| 3006 | /* search for an empty channel */ |
| 3007 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3008 | if (!assigned[j]) { |
| 3009 | spec->multiout.dac_nids[i] = |
| 3010 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3011 | assigned[j] = 1; |
| 3012 | break; |
| 3013 | } |
| 3014 | } |
| 3015 | } |
| 3016 | spec->multiout.num_dacs = cfg->line_outs; |
| 3017 | return 0; |
| 3018 | } |
| 3019 | |
| 3020 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3021 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3022 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3023 | { |
| 3024 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3025 | static const char *chname[4] = { |
| 3026 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3027 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3028 | hda_nid_t nid; |
| 3029 | int i, err; |
| 3030 | |
| 3031 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3032 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3033 | continue; |
| 3034 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3035 | if (i == 2) { |
| 3036 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3037 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3038 | "Center Playback Volume", |
| 3039 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3040 | HDA_OUTPUT)); |
| 3041 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3042 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3043 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3044 | "LFE Playback Volume", |
| 3045 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3046 | HDA_OUTPUT)); |
| 3047 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3048 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3049 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3050 | "Center Playback Switch", |
| 3051 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3052 | HDA_INPUT)); |
| 3053 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3054 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3055 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3056 | "LFE Playback Switch", |
| 3057 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3058 | HDA_INPUT)); |
| 3059 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3060 | return err; |
| 3061 | } else { |
| 3062 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3063 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3064 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3065 | HDA_OUTPUT)); |
| 3066 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3067 | return err; |
| 3068 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3069 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3070 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3071 | HDA_INPUT)); |
| 3072 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3073 | return err; |
| 3074 | } |
| 3075 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3076 | return 0; |
| 3077 | } |
| 3078 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3079 | /* add playback controls for speaker and HP outputs */ |
| 3080 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3081 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3082 | { |
| 3083 | hda_nid_t nid; |
| 3084 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3085 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3086 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3087 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3088 | return 0; |
| 3089 | |
| 3090 | if (alc880_is_fixed_pin(pin)) { |
| 3091 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3092 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3093 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3094 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3095 | else |
| 3096 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3097 | /* control HP volume/switch on the output mixer amp */ |
| 3098 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3099 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3100 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3101 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3102 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3103 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3104 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3105 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3106 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3107 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3108 | return err; |
| 3109 | } else if (alc880_is_multi_pin(pin)) { |
| 3110 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3111 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3112 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3113 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3114 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3115 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3116 | return err; |
| 3117 | } |
| 3118 | return 0; |
| 3119 | } |
| 3120 | |
| 3121 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3122 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3123 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3124 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3125 | { |
| 3126 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3127 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3128 | |
| 3129 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3130 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3131 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3132 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3133 | return err; |
| 3134 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3135 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3136 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3137 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3138 | return err; |
| 3139 | return 0; |
| 3140 | } |
| 3141 | |
| 3142 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3143 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3144 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3145 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3147 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3148 | |
| 3149 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3150 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3151 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3152 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3153 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3154 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3155 | if (err < 0) |
| 3156 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3157 | imux->items[imux->num_items].label = |
| 3158 | auto_pin_cfg_labels[i]; |
| 3159 | imux->items[imux->num_items].index = |
| 3160 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3161 | imux->num_items++; |
| 3162 | } |
| 3163 | } |
| 3164 | return 0; |
| 3165 | } |
| 3166 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3167 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3168 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3169 | int dac_idx) |
| 3170 | { |
| 3171 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3172 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3173 | pin_type); |
| 3174 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3175 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3176 | /* need the manual connection? */ |
| 3177 | if (alc880_is_multi_pin(nid)) { |
| 3178 | struct alc_spec *spec = codec->spec; |
| 3179 | int idx = alc880_multi_pin_idx(nid); |
| 3180 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3181 | AC_VERB_SET_CONNECT_SEL, |
| 3182 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3183 | } |
| 3184 | } |
| 3185 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3186 | static int get_pin_type(int line_out_type) |
| 3187 | { |
| 3188 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3189 | return PIN_HP; |
| 3190 | else |
| 3191 | return PIN_OUT; |
| 3192 | } |
| 3193 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3194 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3195 | { |
| 3196 | struct alc_spec *spec = codec->spec; |
| 3197 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3198 | |
| 3199 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3200 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3201 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3202 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3203 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3204 | } |
| 3205 | } |
| 3206 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3207 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3208 | { |
| 3209 | struct alc_spec *spec = codec->spec; |
| 3210 | hda_nid_t pin; |
| 3211 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3212 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3213 | if (pin) /* connect to front */ |
| 3214 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3215 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3216 | if (pin) /* connect to front */ |
| 3217 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3218 | } |
| 3219 | |
| 3220 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3221 | { |
| 3222 | struct alc_spec *spec = codec->spec; |
| 3223 | int i; |
| 3224 | |
| 3225 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3226 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3227 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3228 | snd_hda_codec_write(codec, nid, 0, |
| 3229 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3230 | i <= AUTO_PIN_FRONT_MIC ? |
| 3231 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3232 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3233 | snd_hda_codec_write(codec, nid, 0, |
| 3234 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3235 | AMP_OUT_MUTE); |
| 3236 | } |
| 3237 | } |
| 3238 | } |
| 3239 | |
| 3240 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3241 | /* return 1 if successful, 0 if the proper config is not found, |
| 3242 | * or a negative error code |
| 3243 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3244 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3245 | { |
| 3246 | struct alc_spec *spec = codec->spec; |
| 3247 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3248 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3249 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3250 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3251 | alc880_ignore); |
| 3252 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3253 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3254 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3255 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3256 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3257 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3258 | if (err < 0) |
| 3259 | return err; |
| 3260 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3261 | if (err < 0) |
| 3262 | return err; |
| 3263 | err = alc880_auto_create_extra_out(spec, |
| 3264 | spec->autocfg.speaker_pins[0], |
| 3265 | "Speaker"); |
| 3266 | if (err < 0) |
| 3267 | return err; |
| 3268 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3269 | "Headphone"); |
| 3270 | if (err < 0) |
| 3271 | return err; |
| 3272 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3273 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3274 | return err; |
| 3275 | |
| 3276 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3277 | |
| 3278 | if (spec->autocfg.dig_out_pin) |
| 3279 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3280 | if (spec->autocfg.dig_in_pin) |
| 3281 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3282 | |
| 3283 | if (spec->kctl_alloc) |
| 3284 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3285 | |
| 3286 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3287 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3288 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3289 | spec->input_mux = &spec->private_imux; |
| 3290 | |
| 3291 | return 1; |
| 3292 | } |
| 3293 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3294 | /* additional initialization for auto-configuration model */ |
| 3295 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3296 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3297 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3298 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3299 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3300 | } |
| 3301 | |
| 3302 | /* |
| 3303 | * OK, here we have finally the patch for ALC880 |
| 3304 | */ |
| 3305 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3306 | static int patch_alc880(struct hda_codec *codec) |
| 3307 | { |
| 3308 | struct alc_spec *spec; |
| 3309 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3310 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3311 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3312 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3313 | if (spec == NULL) |
| 3314 | return -ENOMEM; |
| 3315 | |
| 3316 | codec->spec = spec; |
| 3317 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3318 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3319 | alc880_models, |
| 3320 | alc880_cfg_tbl); |
| 3321 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3322 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3323 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3324 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3325 | } |
| 3326 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3327 | if (board_config == ALC880_AUTO) { |
| 3328 | /* automatic parse from the BIOS config */ |
| 3329 | err = alc880_parse_auto_config(codec); |
| 3330 | if (err < 0) { |
| 3331 | alc_free(codec); |
| 3332 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3333 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3334 | printk(KERN_INFO |
| 3335 | "hda_codec: Cannot set up configuration " |
| 3336 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3337 | board_config = ALC880_3ST; |
| 3338 | } |
| 3339 | } |
| 3340 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3341 | if (board_config != ALC880_AUTO) |
| 3342 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3343 | |
| 3344 | spec->stream_name_analog = "ALC880 Analog"; |
| 3345 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3346 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3347 | |
| 3348 | spec->stream_name_digital = "ALC880 Digital"; |
| 3349 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3350 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3351 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3352 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3353 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3354 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3355 | /* get type */ |
| 3356 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3357 | if (wcap != AC_WID_AUD_IN) { |
| 3358 | spec->adc_nids = alc880_adc_nids_alt; |
| 3359 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3360 | spec->mixers[spec->num_mixers] = |
| 3361 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3362 | spec->num_mixers++; |
| 3363 | } else { |
| 3364 | spec->adc_nids = alc880_adc_nids; |
| 3365 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3366 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3367 | spec->num_mixers++; |
| 3368 | } |
| 3369 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3370 | |
| 3371 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3372 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3373 | spec->init_hook = alc880_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | |
| 3375 | return 0; |
| 3376 | } |
| 3377 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3378 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3379 | /* |
| 3380 | * ALC260 support |
| 3381 | */ |
| 3382 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3383 | static hda_nid_t alc260_dac_nids[1] = { |
| 3384 | /* front */ |
| 3385 | 0x02, |
| 3386 | }; |
| 3387 | |
| 3388 | static hda_nid_t alc260_adc_nids[1] = { |
| 3389 | /* ADC0 */ |
| 3390 | 0x04, |
| 3391 | }; |
| 3392 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3393 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3394 | /* ADC1 */ |
| 3395 | 0x05, |
| 3396 | }; |
| 3397 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3398 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3399 | /* ADC1, 0 */ |
| 3400 | 0x05, 0x04 |
| 3401 | }; |
| 3402 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3403 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3404 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3405 | */ |
| 3406 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3407 | /* ADC0, ADC1 */ |
| 3408 | 0x04, 0x05 |
| 3409 | }; |
| 3410 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3411 | #define ALC260_DIGOUT_NID 0x03 |
| 3412 | #define ALC260_DIGIN_NID 0x06 |
| 3413 | |
| 3414 | static struct hda_input_mux alc260_capture_source = { |
| 3415 | .num_items = 4, |
| 3416 | .items = { |
| 3417 | { "Mic", 0x0 }, |
| 3418 | { "Front Mic", 0x1 }, |
| 3419 | { "Line", 0x2 }, |
| 3420 | { "CD", 0x4 }, |
| 3421 | }, |
| 3422 | }; |
| 3423 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3424 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3425 | * headphone jack and the internal CD lines since these are the only pins at |
| 3426 | * which audio can appear. For flexibility, also allow the option of |
| 3427 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3428 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3429 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3430 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3431 | { |
| 3432 | .num_items = 3, |
| 3433 | .items = { |
| 3434 | { "Mic/Line", 0x0 }, |
| 3435 | { "CD", 0x4 }, |
| 3436 | { "Headphone", 0x2 }, |
| 3437 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3438 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3439 | { |
| 3440 | .num_items = 4, |
| 3441 | .items = { |
| 3442 | { "Mic/Line", 0x0 }, |
| 3443 | { "CD", 0x4 }, |
| 3444 | { "Headphone", 0x2 }, |
| 3445 | { "Mixer", 0x5 }, |
| 3446 | }, |
| 3447 | }, |
| 3448 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3449 | }; |
| 3450 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3451 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3452 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3453 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3454 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3455 | { |
| 3456 | .num_items = 4, |
| 3457 | .items = { |
| 3458 | { "Mic", 0x0 }, |
| 3459 | { "Line", 0x2 }, |
| 3460 | { "CD", 0x4 }, |
| 3461 | { "Headphone", 0x5 }, |
| 3462 | }, |
| 3463 | }, |
| 3464 | { |
| 3465 | .num_items = 5, |
| 3466 | .items = { |
| 3467 | { "Mic", 0x0 }, |
| 3468 | { "Line", 0x2 }, |
| 3469 | { "CD", 0x4 }, |
| 3470 | { "Headphone", 0x6 }, |
| 3471 | { "Mixer", 0x5 }, |
| 3472 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3473 | }, |
| 3474 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3475 | /* |
| 3476 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3477 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3478 | * element which allows changing the channel mode, so the verb list is |
| 3479 | * never used. |
| 3480 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3481 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3482 | { 2, NULL }, |
| 3483 | }; |
| 3484 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3485 | |
| 3486 | /* Mixer combinations |
| 3487 | * |
| 3488 | * basic: base_output + input + pc_beep + capture |
| 3489 | * HP: base_output + input + capture_alt |
| 3490 | * HP_3013: hp_3013 + input + capture |
| 3491 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3492 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3493 | */ |
| 3494 | |
| 3495 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3496 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3497 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3498 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3499 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3500 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3501 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3502 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3503 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3504 | |
| 3505 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3506 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3507 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3508 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3509 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3510 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3511 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3512 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3513 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3514 | { } /* end */ |
| 3515 | }; |
| 3516 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3517 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3518 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3519 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3520 | { } /* end */ |
| 3521 | }; |
| 3522 | |
| 3523 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3524 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3525 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3526 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3527 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3528 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3529 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3530 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3531 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3532 | { } /* end */ |
| 3533 | }; |
| 3534 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3535 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3536 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3537 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3538 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3539 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3540 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3541 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3542 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3543 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3544 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3545 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3546 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3547 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3548 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3549 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3550 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3551 | { } /* end */ |
| 3552 | }; |
| 3553 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3554 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3555 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3556 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3557 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3558 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3559 | * revisions available in early 2006. Therefore for now allow the |
| 3560 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3561 | * that the lack of mic bias for this NID is intentional we could change the |
| 3562 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3563 | * |
| 3564 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3565 | * don't appear to make the mic bias available from the "line" jack, even |
| 3566 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3567 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3568 | * and the output jack. If this turns out to be the case for all such |
| 3569 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3570 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3571 | * |
| 3572 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3573 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 3574 | * controls for such models. On models without a "mono speaker" the control |
| 3575 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3576 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3577 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3578 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3579 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3580 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3581 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3582 | HDA_OUTPUT), |
| 3583 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 3584 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3585 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3586 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3587 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3588 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3589 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3590 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3591 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3592 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3593 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3594 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3595 | { } /* end */ |
| 3596 | }; |
| 3597 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3598 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 3599 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 3600 | */ |
| 3601 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 3602 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3603 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3604 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3605 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3606 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3607 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3608 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3609 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3610 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3611 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3612 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3613 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3614 | { } /* end */ |
| 3615 | }; |
| 3616 | |
| 3617 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 3618 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 3619 | */ |
| 3620 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 3621 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3622 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3623 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3624 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3625 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3626 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 3627 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 3628 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3629 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3630 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3631 | { } /* end */ |
| 3632 | }; |
| 3633 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3634 | /* capture mixer elements */ |
| 3635 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3636 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3637 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3638 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3639 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3640 | { |
| 3641 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3642 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3643 | * So call somewhat different.. |
| 3644 | * FIXME: the controls appear in the "playback" view! |
| 3645 | */ |
| 3646 | /* .name = "Capture Source", */ |
| 3647 | .name = "Input Source", |
| 3648 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3649 | .info = alc_mux_enum_info, |
| 3650 | .get = alc_mux_enum_get, |
| 3651 | .put = alc_mux_enum_put, |
| 3652 | }, |
| 3653 | { } /* end */ |
| 3654 | }; |
| 3655 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3656 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3657 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3658 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3659 | { |
| 3660 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3661 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3662 | * So call somewhat different.. |
| 3663 | * FIXME: the controls appear in the "playback" view! |
| 3664 | */ |
| 3665 | /* .name = "Capture Source", */ |
| 3666 | .name = "Input Source", |
| 3667 | .count = 1, |
| 3668 | .info = alc_mux_enum_info, |
| 3669 | .get = alc_mux_enum_get, |
| 3670 | .put = alc_mux_enum_put, |
| 3671 | }, |
| 3672 | { } /* end */ |
| 3673 | }; |
| 3674 | |
| 3675 | /* |
| 3676 | * initialization verbs |
| 3677 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3678 | static struct hda_verb alc260_init_verbs[] = { |
| 3679 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3680 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3681 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3682 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3683 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3684 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3685 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3686 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3687 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3688 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3689 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3690 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3691 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3692 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3693 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3694 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3695 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3696 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3697 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3698 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3699 | /* set connection select to line in (default select for this ADC) */ |
| 3700 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3701 | /* mute capture amp left and right */ |
| 3702 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3703 | /* set connection select to line in (default select for this ADC) */ |
| 3704 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3705 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3706 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3707 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3708 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3709 | /* set vol=0 HP mixer amp left and right */ |
| 3710 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3711 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3712 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3713 | /* set vol=0 Mono mixer amp left and right */ |
| 3714 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3715 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3716 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3717 | /* unmute LINE-2 out pin */ |
| 3718 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3719 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3720 | * Line In 2 = 0x03 |
| 3721 | */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3722 | /* mute CD */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3723 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3724 | /* mute Line In */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3725 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3726 | /* mute Mic */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3727 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3728 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3729 | /* mute Front out path */ |
| 3730 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3731 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3732 | /* mute Headphone out path */ |
| 3733 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3734 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3735 | /* mute Mono out path */ |
| 3736 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3737 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3738 | { } |
| 3739 | }; |
| 3740 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3741 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3742 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 3743 | /* Headphone and output */ |
| 3744 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3745 | /* mono output */ |
| 3746 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3747 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3748 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3749 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3750 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3751 | /* Line In pin widget for input */ |
| 3752 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3753 | /* Line-2 pin widget for output */ |
| 3754 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3755 | /* CD pin widget for input */ |
| 3756 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3757 | /* unmute amp left and right */ |
| 3758 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3759 | /* set connection select to line in (default select for this ADC) */ |
| 3760 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3761 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3762 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3763 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3764 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3765 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3766 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3767 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3768 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3769 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3770 | * Line In 2 = 0x03 |
| 3771 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3772 | /* unmute CD */ |
| 3773 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3774 | /* unmute Line In */ |
| 3775 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3776 | /* unmute Mic */ |
| 3777 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3778 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3779 | /* Unmute Front out path */ |
| 3780 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3781 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3782 | /* Unmute Headphone out path */ |
| 3783 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3784 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3785 | /* Unmute Mono out path */ |
| 3786 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3787 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3788 | { } |
| 3789 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3790 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3791 | |
| 3792 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 3793 | /* Line out and output */ |
| 3794 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3795 | /* mono output */ |
| 3796 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3797 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3798 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3799 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3800 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3801 | /* Line In pin widget for input */ |
| 3802 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3803 | /* Headphone pin widget for output */ |
| 3804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3805 | /* CD pin widget for input */ |
| 3806 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3807 | /* unmute amp left and right */ |
| 3808 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3809 | /* set connection select to line in (default select for this ADC) */ |
| 3810 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3811 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3812 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3813 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3814 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3815 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3816 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3817 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3818 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3819 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3820 | * Line In 2 = 0x03 |
| 3821 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3822 | /* unmute CD */ |
| 3823 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3824 | /* unmute Line In */ |
| 3825 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3826 | /* unmute Mic */ |
| 3827 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3828 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3829 | /* Unmute Front out path */ |
| 3830 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3831 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3832 | /* Unmute Headphone out path */ |
| 3833 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3834 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3835 | /* Unmute Mono out path */ |
| 3836 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3837 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3838 | { } |
| 3839 | }; |
| 3840 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3841 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3842 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 3843 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3844 | */ |
| 3845 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 3846 | /* Disable all GPIOs */ |
| 3847 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 3848 | /* Internal speaker is connected to headphone pin */ |
| 3849 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3850 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 3851 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3852 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 3853 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3854 | /* Ensure all other unused pins are disabled and muted. */ |
| 3855 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3856 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3857 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3858 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3859 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3860 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3861 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3862 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3863 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3864 | /* Disable digital (SPDIF) pins */ |
| 3865 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3866 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3867 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3868 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 3869 | * when acting as an output. |
| 3870 | */ |
| 3871 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3872 | |
| 3873 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 3874 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3875 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3876 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3877 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3878 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3879 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3880 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3881 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3882 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3883 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3884 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 3885 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3886 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 3887 | * If the pin mode is changed by the user the pin mode control will |
| 3888 | * take care of enabling the pin's input/output buffers as needed. |
| 3889 | * Therefore there's no need to enable the input buffer at this |
| 3890 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3891 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3892 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3893 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 3894 | * mixer ctrl) |
| 3895 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3896 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3897 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3898 | /* Mute capture amp left and right */ |
| 3899 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3900 | /* Set ADC connection select to match default mixer setting - line |
| 3901 | * in (on mic1 pin) |
| 3902 | */ |
| 3903 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3904 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3905 | /* Do the same for the second ADC: mute capture input amp and |
| 3906 | * set ADC connection to line in (on mic1 pin) |
| 3907 | */ |
| 3908 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3909 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3910 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3911 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3912 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3913 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3914 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3915 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3916 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3917 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3918 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3919 | {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] | 3920 | |
| 3921 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3922 | }; |
| 3923 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3924 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 3925 | * similar laptops (adapted from Fujitsu init verbs). |
| 3926 | */ |
| 3927 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 3928 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 3929 | * the headphone jack. Turn this on and rely on the standard mute |
| 3930 | * methods whenever the user wants to turn these outputs off. |
| 3931 | */ |
| 3932 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 3933 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3934 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 3935 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 3936 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3937 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 3938 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 3939 | /* Line In jack is connected to Line1 pin */ |
| 3940 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3941 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 3942 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3943 | /* Ensure all other unused pins are disabled and muted. */ |
| 3944 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3945 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3946 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3947 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3948 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3949 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3950 | /* Disable digital (SPDIF) pins */ |
| 3951 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3952 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3953 | |
| 3954 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 3955 | * bus when acting as outputs. |
| 3956 | */ |
| 3957 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3958 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3959 | |
| 3960 | /* Start with output sum widgets muted and their output gains at min */ |
| 3961 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3962 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3963 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3964 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3965 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3966 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3967 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3968 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3969 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3970 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3971 | /* Unmute Line-out pin widget amp left and right |
| 3972 | * (no equiv mixer ctrl) |
| 3973 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3974 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3975 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 3976 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3977 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 3978 | * inputs. If the pin mode is changed by the user the pin mode control |
| 3979 | * will take care of enabling the pin's input/output buffers as needed. |
| 3980 | * Therefore there's no need to enable the input buffer at this |
| 3981 | * stage. |
| 3982 | */ |
| 3983 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3984 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3985 | |
| 3986 | /* Mute capture amp left and right */ |
| 3987 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3988 | /* Set ADC connection select to match default mixer setting - mic |
| 3989 | * (on mic1 pin) |
| 3990 | */ |
| 3991 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3992 | |
| 3993 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3994 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3995 | */ |
| 3996 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3997 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3998 | |
| 3999 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4000 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4001 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4002 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4003 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4005 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4006 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4007 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4008 | |
| 4009 | { } |
| 4010 | }; |
| 4011 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4012 | static struct hda_verb alc260_will_verbs[] = { |
| 4013 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4014 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4015 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4016 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4017 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4018 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4019 | {} |
| 4020 | }; |
| 4021 | |
| 4022 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4023 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4024 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4025 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4026 | |
| 4027 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4028 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4029 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4030 | |
| 4031 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4032 | {} |
| 4033 | }; |
| 4034 | |
| 4035 | /* toggle speaker-output according to the hp-jack state */ |
| 4036 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4037 | { |
| 4038 | unsigned int present; |
| 4039 | |
| 4040 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4041 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4042 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4043 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 4044 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4045 | AC_VERB_SET_GPIO_DATA, 1); |
| 4046 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4047 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4048 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4049 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 4050 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4051 | AC_VERB_SET_GPIO_DATA, 0); |
| 4052 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4053 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4054 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4055 | } |
| 4056 | } |
| 4057 | |
| 4058 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4059 | unsigned int res) |
| 4060 | { |
| 4061 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4062 | alc260_replacer_672v_automute(codec); |
| 4063 | } |
| 4064 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4065 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4066 | * configuration. |
| 4067 | */ |
| 4068 | #ifdef CONFIG_SND_DEBUG |
| 4069 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4070 | 0x02, |
| 4071 | }; |
| 4072 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4073 | 0x04, 0x05, |
| 4074 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4075 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4076 | * the signal assignments are different. This assumes that the first ADC |
| 4077 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4078 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4079 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4080 | { |
| 4081 | .num_items = 7, |
| 4082 | .items = { |
| 4083 | { "MIC1 pin", 0x0 }, |
| 4084 | { "MIC2 pin", 0x1 }, |
| 4085 | { "LINE1 pin", 0x2 }, |
| 4086 | { "LINE2 pin", 0x3 }, |
| 4087 | { "CD pin", 0x4 }, |
| 4088 | { "LINE-OUT pin", 0x5 }, |
| 4089 | { "HP-OUT pin", 0x6 }, |
| 4090 | }, |
| 4091 | }, |
| 4092 | { |
| 4093 | .num_items = 8, |
| 4094 | .items = { |
| 4095 | { "MIC1 pin", 0x0 }, |
| 4096 | { "MIC2 pin", 0x1 }, |
| 4097 | { "LINE1 pin", 0x2 }, |
| 4098 | { "LINE2 pin", 0x3 }, |
| 4099 | { "CD pin", 0x4 }, |
| 4100 | { "Mixer", 0x5 }, |
| 4101 | { "LINE-OUT pin", 0x6 }, |
| 4102 | { "HP-OUT pin", 0x7 }, |
| 4103 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4104 | }, |
| 4105 | }; |
| 4106 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4107 | /* Output driver widgets */ |
| 4108 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4109 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4110 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4111 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4112 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4113 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4114 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4115 | /* Modes for retasking pin widgets |
| 4116 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4117 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4118 | * mention this restriction. At this stage it's not clear whether |
| 4119 | * this behaviour is intentional or is a hardware bug in chip |
| 4120 | * revisions available at least up until early 2006. Therefore for |
| 4121 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4122 | * choices, but if it turns out that the lack of mic bias for these |
| 4123 | * NIDs is intentional we could change their modes from |
| 4124 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4125 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4126 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4127 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4128 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4129 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4130 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4131 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4132 | |
| 4133 | /* Loopback mixer controls */ |
| 4134 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4135 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4136 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4137 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4138 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4139 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4140 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4141 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4142 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4143 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4144 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4145 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4146 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4147 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4148 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4149 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4150 | |
| 4151 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4152 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4153 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4154 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4155 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4156 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4157 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4158 | * is ambigious as to which NID is which; testing on laptops which |
| 4159 | * make this output available should provide clarification. |
| 4160 | */ |
| 4161 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4162 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4163 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4164 | { } /* end */ |
| 4165 | }; |
| 4166 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4167 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4168 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4169 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4170 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4171 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4172 | /* Enable retasking pins as output, initially without power amp */ |
| 4173 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4174 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4175 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4176 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4177 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4178 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4179 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4180 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4181 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4182 | * payload also sets the generation to 0, output to be in "consumer" |
| 4183 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4184 | * control. |
| 4185 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4186 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4187 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4188 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4189 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4190 | * OUT1 sum bus when acting as an output. |
| 4191 | */ |
| 4192 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4193 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4194 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4195 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4196 | |
| 4197 | /* Start with output sum widgets muted and their output gains at min */ |
| 4198 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4199 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4200 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4201 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4202 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4204 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4205 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4206 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4207 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4208 | /* Unmute retasking pin widget output buffers since the default |
| 4209 | * state appears to be output. As the pin mode is changed by the |
| 4210 | * user the pin mode control will take care of enabling the pin's |
| 4211 | * input/output buffers as needed. |
| 4212 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4213 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4214 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4215 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4216 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4217 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4218 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4219 | /* Also unmute the mono-out pin widget */ |
| 4220 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4221 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4222 | /* Mute capture amp left and right */ |
| 4223 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4224 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4225 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4226 | */ |
| 4227 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4228 | |
| 4229 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4230 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4231 | */ |
| 4232 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4233 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4234 | |
| 4235 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4236 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4237 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4238 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4239 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4240 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4242 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4243 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4244 | |
| 4245 | { } |
| 4246 | }; |
| 4247 | #endif |
| 4248 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4249 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 4250 | .substreams = 1, |
| 4251 | .channels_min = 2, |
| 4252 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4253 | }; |
| 4254 | |
| 4255 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 4256 | .substreams = 1, |
| 4257 | .channels_min = 2, |
| 4258 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4259 | }; |
| 4260 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4261 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4262 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4263 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4264 | /* |
| 4265 | * for BIOS auto-configuration |
| 4266 | */ |
| 4267 | |
| 4268 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4269 | const char *pfx) |
| 4270 | { |
| 4271 | hda_nid_t nid_vol; |
| 4272 | unsigned long vol_val, sw_val; |
| 4273 | char name[32]; |
| 4274 | int err; |
| 4275 | |
| 4276 | if (nid >= 0x0f && nid < 0x11) { |
| 4277 | nid_vol = nid - 0x7; |
| 4278 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4279 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4280 | } else if (nid == 0x11) { |
| 4281 | nid_vol = nid - 0x7; |
| 4282 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4283 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4284 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4285 | nid_vol = 0x08; |
| 4286 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4287 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4288 | } else |
| 4289 | return 0; /* N/A */ |
| 4290 | |
| 4291 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4292 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4293 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4294 | return err; |
| 4295 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4296 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4297 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4298 | return err; |
| 4299 | return 1; |
| 4300 | } |
| 4301 | |
| 4302 | /* add playback controls from the parsed DAC table */ |
| 4303 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4304 | const struct auto_pin_cfg *cfg) |
| 4305 | { |
| 4306 | hda_nid_t nid; |
| 4307 | int err; |
| 4308 | |
| 4309 | spec->multiout.num_dacs = 1; |
| 4310 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4311 | spec->multiout.dac_nids[0] = 0x02; |
| 4312 | |
| 4313 | nid = cfg->line_out_pins[0]; |
| 4314 | if (nid) { |
| 4315 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4316 | if (err < 0) |
| 4317 | return err; |
| 4318 | } |
| 4319 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4320 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4321 | if (nid) { |
| 4322 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4323 | if (err < 0) |
| 4324 | return err; |
| 4325 | } |
| 4326 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4327 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4328 | if (nid) { |
| 4329 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4330 | if (err < 0) |
| 4331 | return err; |
| 4332 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4333 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4334 | } |
| 4335 | |
| 4336 | /* create playback/capture controls for input pins */ |
| 4337 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4338 | const struct auto_pin_cfg *cfg) |
| 4339 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4340 | struct hda_input_mux *imux = &spec->private_imux; |
| 4341 | int i, err, idx; |
| 4342 | |
| 4343 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4344 | if (cfg->input_pins[i] >= 0x12) { |
| 4345 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4346 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4347 | auto_pin_cfg_labels[i], idx, |
| 4348 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4349 | if (err < 0) |
| 4350 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4351 | imux->items[imux->num_items].label = |
| 4352 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4353 | imux->items[imux->num_items].index = idx; |
| 4354 | imux->num_items++; |
| 4355 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4356 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4357 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4358 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4359 | auto_pin_cfg_labels[i], idx, |
| 4360 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4361 | if (err < 0) |
| 4362 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4363 | imux->items[imux->num_items].label = |
| 4364 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4365 | imux->items[imux->num_items].index = idx; |
| 4366 | imux->num_items++; |
| 4367 | } |
| 4368 | } |
| 4369 | return 0; |
| 4370 | } |
| 4371 | |
| 4372 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4373 | hda_nid_t nid, int pin_type, |
| 4374 | int sel_idx) |
| 4375 | { |
| 4376 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4377 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4378 | pin_type); |
| 4379 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4380 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4381 | /* need the manual connection? */ |
| 4382 | if (nid >= 0x12) { |
| 4383 | int idx = nid - 0x12; |
| 4384 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4385 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4386 | } |
| 4387 | } |
| 4388 | |
| 4389 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4390 | { |
| 4391 | struct alc_spec *spec = codec->spec; |
| 4392 | hda_nid_t nid; |
| 4393 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4394 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4395 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4396 | if (nid) { |
| 4397 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4398 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4399 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4400 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4401 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4402 | if (nid) |
| 4403 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4404 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4405 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4406 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4407 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4408 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4409 | |
| 4410 | #define ALC260_PIN_CD_NID 0x16 |
| 4411 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4412 | { |
| 4413 | struct alc_spec *spec = codec->spec; |
| 4414 | int i; |
| 4415 | |
| 4416 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4417 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4418 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4419 | snd_hda_codec_write(codec, nid, 0, |
| 4420 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4421 | i <= AUTO_PIN_FRONT_MIC ? |
| 4422 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4423 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4424 | snd_hda_codec_write(codec, nid, 0, |
| 4425 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4426 | AMP_OUT_MUTE); |
| 4427 | } |
| 4428 | } |
| 4429 | } |
| 4430 | |
| 4431 | /* |
| 4432 | * generic initialization of ADC, input mixers and output mixers |
| 4433 | */ |
| 4434 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4435 | /* |
| 4436 | * Unmute ADC0-1 and set the default input to mic-in |
| 4437 | */ |
| 4438 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4439 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4440 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4441 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4442 | |
| 4443 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4444 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4445 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4446 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4447 | */ |
| 4448 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 4449 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4450 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4451 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 4452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 4453 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 4454 | |
| 4455 | /* |
| 4456 | * Set up output mixers (0x08 - 0x0a) |
| 4457 | */ |
| 4458 | /* set vol=0 to output mixers */ |
| 4459 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4460 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4461 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4462 | /* set up input amps for analog loopback */ |
| 4463 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4464 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4465 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4468 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4469 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4470 | |
| 4471 | { } |
| 4472 | }; |
| 4473 | |
| 4474 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4475 | { |
| 4476 | struct alc_spec *spec = codec->spec; |
| 4477 | unsigned int wcap; |
| 4478 | int err; |
| 4479 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4480 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4481 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4482 | alc260_ignore); |
| 4483 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4484 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4485 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4486 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4487 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4488 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4489 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4490 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4491 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4492 | return err; |
| 4493 | |
| 4494 | spec->multiout.max_channels = 2; |
| 4495 | |
| 4496 | if (spec->autocfg.dig_out_pin) |
| 4497 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4498 | if (spec->kctl_alloc) |
| 4499 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4500 | |
| 4501 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4502 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4503 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4504 | spec->input_mux = &spec->private_imux; |
| 4505 | |
| 4506 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4507 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4508 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4509 | if (wcap != AC_WID_AUD_IN) { |
| 4510 | spec->adc_nids = alc260_adc_nids_alt; |
| 4511 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4512 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4513 | } else { |
| 4514 | spec->adc_nids = alc260_adc_nids; |
| 4515 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4516 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4517 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4518 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4519 | |
| 4520 | return 1; |
| 4521 | } |
| 4522 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4523 | /* additional initialization for auto-configuration model */ |
| 4524 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4525 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4526 | alc260_auto_init_multi_out(codec); |
| 4527 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4528 | } |
| 4529 | |
| 4530 | /* |
| 4531 | * ALC260 configurations |
| 4532 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4533 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4534 | [ALC260_BASIC] = "basic", |
| 4535 | [ALC260_HP] = "hp", |
| 4536 | [ALC260_HP_3013] = "hp-3013", |
| 4537 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4538 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4539 | [ALC260_WILL] = "will", |
| 4540 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4541 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4542 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4543 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4544 | [ALC260_AUTO] = "auto", |
| 4545 | }; |
| 4546 | |
| 4547 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4548 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4549 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4550 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4551 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4552 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4553 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4554 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4555 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4556 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4557 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4558 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4559 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4560 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4561 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4562 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4563 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4564 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
| 4565 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4566 | {} |
| 4567 | }; |
| 4568 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4569 | static struct alc_config_preset alc260_presets[] = { |
| 4570 | [ALC260_BASIC] = { |
| 4571 | .mixers = { alc260_base_output_mixer, |
| 4572 | alc260_input_mixer, |
| 4573 | alc260_pc_beep_mixer, |
| 4574 | alc260_capture_mixer }, |
| 4575 | .init_verbs = { alc260_init_verbs }, |
| 4576 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4577 | .dac_nids = alc260_dac_nids, |
| 4578 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4579 | .adc_nids = alc260_adc_nids, |
| 4580 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4581 | .channel_mode = alc260_modes, |
| 4582 | .input_mux = &alc260_capture_source, |
| 4583 | }, |
| 4584 | [ALC260_HP] = { |
| 4585 | .mixers = { alc260_base_output_mixer, |
| 4586 | alc260_input_mixer, |
| 4587 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4588 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4589 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4590 | .dac_nids = alc260_dac_nids, |
| 4591 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4592 | .adc_nids = alc260_hp_adc_nids, |
| 4593 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4594 | .channel_mode = alc260_modes, |
| 4595 | .input_mux = &alc260_capture_source, |
| 4596 | }, |
| 4597 | [ALC260_HP_3013] = { |
| 4598 | .mixers = { alc260_hp_3013_mixer, |
| 4599 | alc260_input_mixer, |
| 4600 | alc260_capture_alt_mixer }, |
| 4601 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4602 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4603 | .dac_nids = alc260_dac_nids, |
| 4604 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4605 | .adc_nids = alc260_hp_adc_nids, |
| 4606 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4607 | .channel_mode = alc260_modes, |
| 4608 | .input_mux = &alc260_capture_source, |
| 4609 | }, |
| 4610 | [ALC260_FUJITSU_S702X] = { |
| 4611 | .mixers = { alc260_fujitsu_mixer, |
| 4612 | alc260_capture_mixer }, |
| 4613 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4614 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4615 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4616 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4617 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4618 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4619 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4620 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4621 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4622 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4623 | [ALC260_ACER] = { |
| 4624 | .mixers = { alc260_acer_mixer, |
| 4625 | alc260_capture_mixer }, |
| 4626 | .init_verbs = { alc260_acer_init_verbs }, |
| 4627 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4628 | .dac_nids = alc260_dac_nids, |
| 4629 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4630 | .adc_nids = alc260_dual_adc_nids, |
| 4631 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4632 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4633 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4634 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4635 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4636 | [ALC260_WILL] = { |
| 4637 | .mixers = { alc260_will_mixer, |
| 4638 | alc260_capture_mixer }, |
| 4639 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 4640 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4641 | .dac_nids = alc260_dac_nids, |
| 4642 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4643 | .adc_nids = alc260_adc_nids, |
| 4644 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4645 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4646 | .channel_mode = alc260_modes, |
| 4647 | .input_mux = &alc260_capture_source, |
| 4648 | }, |
| 4649 | [ALC260_REPLACER_672V] = { |
| 4650 | .mixers = { alc260_replacer_672v_mixer, |
| 4651 | alc260_capture_mixer }, |
| 4652 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 4653 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4654 | .dac_nids = alc260_dac_nids, |
| 4655 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4656 | .adc_nids = alc260_adc_nids, |
| 4657 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4658 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4659 | .channel_mode = alc260_modes, |
| 4660 | .input_mux = &alc260_capture_source, |
| 4661 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 4662 | .init_hook = alc260_replacer_672v_automute, |
| 4663 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4664 | #ifdef CONFIG_SND_DEBUG |
| 4665 | [ALC260_TEST] = { |
| 4666 | .mixers = { alc260_test_mixer, |
| 4667 | alc260_capture_mixer }, |
| 4668 | .init_verbs = { alc260_test_init_verbs }, |
| 4669 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4670 | .dac_nids = alc260_test_dac_nids, |
| 4671 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4672 | .adc_nids = alc260_test_adc_nids, |
| 4673 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4674 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4675 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4676 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4677 | }, |
| 4678 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4679 | }; |
| 4680 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4681 | static int patch_alc260(struct hda_codec *codec) |
| 4682 | { |
| 4683 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4684 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4685 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4686 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4687 | if (spec == NULL) |
| 4688 | return -ENOMEM; |
| 4689 | |
| 4690 | codec->spec = spec; |
| 4691 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4692 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 4693 | alc260_models, |
| 4694 | alc260_cfg_tbl); |
| 4695 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4696 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4697 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4698 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4699 | } |
| 4700 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4701 | if (board_config == ALC260_AUTO) { |
| 4702 | /* automatic parse from the BIOS config */ |
| 4703 | err = alc260_parse_auto_config(codec); |
| 4704 | if (err < 0) { |
| 4705 | alc_free(codec); |
| 4706 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4707 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4708 | printk(KERN_INFO |
| 4709 | "hda_codec: Cannot set up configuration " |
| 4710 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4711 | board_config = ALC260_BASIC; |
| 4712 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4713 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4714 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4715 | if (board_config != ALC260_AUTO) |
| 4716 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4717 | |
| 4718 | spec->stream_name_analog = "ALC260 Analog"; |
| 4719 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 4720 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 4721 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4722 | spec->stream_name_digital = "ALC260 Digital"; |
| 4723 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 4724 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 4725 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4726 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4727 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4728 | spec->init_hook = alc260_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4729 | |
| 4730 | return 0; |
| 4731 | } |
| 4732 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4733 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4734 | /* |
| 4735 | * ALC882 support |
| 4736 | * |
| 4737 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 4738 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4739 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4740 | * 6-channel independent captures. |
| 4741 | * |
| 4742 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4743 | * driver yet). |
| 4744 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4745 | #define ALC882_DIGOUT_NID 0x06 |
| 4746 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4747 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4748 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4749 | { 8, NULL } |
| 4750 | }; |
| 4751 | |
| 4752 | static hda_nid_t alc882_dac_nids[4] = { |
| 4753 | /* front, rear, clfe, rear_surr */ |
| 4754 | 0x02, 0x03, 0x04, 0x05 |
| 4755 | }; |
| 4756 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4757 | /* identical with ALC880 */ |
| 4758 | #define alc882_adc_nids alc880_adc_nids |
| 4759 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4760 | |
| 4761 | /* input MUX */ |
| 4762 | /* FIXME: should be a matrix-type input source selection */ |
| 4763 | |
| 4764 | static struct hda_input_mux alc882_capture_source = { |
| 4765 | .num_items = 4, |
| 4766 | .items = { |
| 4767 | { "Mic", 0x0 }, |
| 4768 | { "Front Mic", 0x1 }, |
| 4769 | { "Line", 0x2 }, |
| 4770 | { "CD", 0x4 }, |
| 4771 | }, |
| 4772 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4773 | #define alc882_mux_enum_info alc_mux_enum_info |
| 4774 | #define alc882_mux_enum_get alc_mux_enum_get |
| 4775 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4776 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 4777 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4778 | { |
| 4779 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4780 | struct alc_spec *spec = codec->spec; |
| 4781 | const struct hda_input_mux *imux = spec->input_mux; |
| 4782 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4783 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4784 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4785 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4786 | unsigned int i, idx; |
| 4787 | |
| 4788 | idx = ucontrol->value.enumerated.item[0]; |
| 4789 | if (idx >= imux->num_items) |
| 4790 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 4791 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4792 | return 0; |
| 4793 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 4794 | unsigned int v = (i == idx) ? 0x00 : 0x80; |
| 4795 | snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, |
| 4796 | imux->items[i].index, |
| 4797 | 0x80, v); |
| 4798 | snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, |
| 4799 | imux->items[i].index, |
| 4800 | 0x80, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4801 | } |
| 4802 | *cur_val = idx; |
| 4803 | return 1; |
| 4804 | } |
| 4805 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4806 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4807 | * 2ch mode |
| 4808 | */ |
| 4809 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 4810 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 4811 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4812 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 4813 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4814 | { } /* end */ |
| 4815 | }; |
| 4816 | |
| 4817 | /* |
| 4818 | * 6ch mode |
| 4819 | */ |
| 4820 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 4821 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4822 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4823 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 4824 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4825 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4826 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 4827 | { } /* end */ |
| 4828 | }; |
| 4829 | |
| 4830 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 4831 | { 2, alc882_3ST_ch2_init }, |
| 4832 | { 6, alc882_3ST_ch6_init }, |
| 4833 | }; |
| 4834 | |
| 4835 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4836 | * 6ch mode |
| 4837 | */ |
| 4838 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 4839 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4840 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4841 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4842 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4843 | { } /* end */ |
| 4844 | }; |
| 4845 | |
| 4846 | /* |
| 4847 | * 8ch mode |
| 4848 | */ |
| 4849 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 4850 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4851 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4852 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4853 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4854 | { } /* end */ |
| 4855 | }; |
| 4856 | |
| 4857 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 4858 | { 6, alc882_sixstack_ch6_init }, |
| 4859 | { 8, alc882_sixstack_ch8_init }, |
| 4860 | }; |
| 4861 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4862 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 4863 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 4864 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4865 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4866 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4867 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4868 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4869 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4870 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 4871 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4872 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 4873 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4874 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4875 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4876 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4877 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4878 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4879 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4880 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4881 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4882 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4884 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4885 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4886 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4887 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4888 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4889 | { } /* end */ |
| 4890 | }; |
| 4891 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 4892 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 4893 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4894 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4895 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4896 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4897 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4898 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4899 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4900 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 4901 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4902 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4903 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 4904 | { } /* end */ |
| 4905 | }; |
| 4906 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4907 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 4908 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4909 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4910 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4911 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4912 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4913 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4914 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4915 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4916 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4917 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4918 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4919 | { } /* end */ |
| 4920 | }; |
| 4921 | |
| 4922 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 4923 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 4924 | */ |
| 4925 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 4926 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4927 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 4928 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 4929 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 4930 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4931 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4932 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4933 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4934 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 4935 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 4936 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4937 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4938 | { } /* end */ |
| 4939 | }; |
| 4940 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4941 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 4942 | { |
| 4943 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4944 | .name = "Channel Mode", |
| 4945 | .info = alc_ch_mode_info, |
| 4946 | .get = alc_ch_mode_get, |
| 4947 | .put = alc_ch_mode_put, |
| 4948 | }, |
| 4949 | { } /* end */ |
| 4950 | }; |
| 4951 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4952 | static struct hda_verb alc882_init_verbs[] = { |
| 4953 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4954 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4955 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4956 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4957 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4958 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4959 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4960 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4961 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4962 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4963 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4964 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4965 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4966 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4967 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4968 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4969 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4970 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4971 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4973 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4974 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4975 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4977 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4978 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4979 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4980 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4981 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4982 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4983 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4984 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4985 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4986 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4987 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4988 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4989 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4990 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4991 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4992 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4993 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4994 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4995 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 4996 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4997 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4998 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4999 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5000 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5001 | |
| 5002 | /* FIXME: use matrix-type input source selection */ |
| 5003 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5004 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5005 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5006 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5007 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5008 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5009 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5010 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5011 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5012 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5013 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5014 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5015 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5016 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5017 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5018 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5019 | /* ADC1: mute amp left and right */ |
| 5020 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5021 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5022 | /* ADC2: mute amp left and right */ |
| 5023 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5024 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5025 | /* ADC3: mute amp left and right */ |
| 5026 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5027 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5028 | |
| 5029 | { } |
| 5030 | }; |
| 5031 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5032 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5033 | /* change to EAPD mode */ |
| 5034 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5035 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5036 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5037 | }; |
| 5038 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5039 | /* Mac Pro test */ |
| 5040 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5041 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5042 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5043 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5044 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5045 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5046 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5047 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5048 | { } /* end */ |
| 5049 | }; |
| 5050 | |
| 5051 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5052 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5053 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5056 | /* Front Pin: output 0 (0x0c) */ |
| 5057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5059 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5060 | /* Front Mic pin: input vref at 80% */ |
| 5061 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5062 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5063 | /* Speaker: output */ |
| 5064 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5065 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5066 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5067 | /* Headphone output (output 0 - 0x0c) */ |
| 5068 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5069 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5070 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5071 | |
| 5072 | /* FIXME: use matrix-type input source selection */ |
| 5073 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5074 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5075 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5076 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5077 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5078 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5079 | /* Input mixer2 */ |
| 5080 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5081 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5082 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5083 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5084 | /* Input mixer3 */ |
| 5085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5089 | /* ADC1: mute amp left and right */ |
| 5090 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5091 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5092 | /* ADC2: mute amp left and right */ |
| 5093 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5094 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5095 | /* ADC3: mute amp left and right */ |
| 5096 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5097 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5098 | |
| 5099 | { } |
| 5100 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5101 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5102 | /* iMac 24 mixer. */ |
| 5103 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5104 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5105 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5106 | { } /* end */ |
| 5107 | }; |
| 5108 | |
| 5109 | /* iMac 24 init verbs. */ |
| 5110 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5111 | /* Internal speakers: output 0 (0x0c) */ |
| 5112 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5113 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5114 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5115 | /* Internal speakers: output 0 (0x0c) */ |
| 5116 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5117 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5118 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5119 | /* Headphone: output 0 (0x0c) */ |
| 5120 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5121 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5122 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5123 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5124 | /* Front Mic: input vref at 80% */ |
| 5125 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5126 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5127 | { } |
| 5128 | }; |
| 5129 | |
| 5130 | /* Toggle speaker-output according to the hp-jack state */ |
| 5131 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5132 | { |
| 5133 | unsigned int present; |
| 5134 | |
| 5135 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5136 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5137 | snd_hda_codec_amp_update(codec, 0x18, 0, HDA_OUTPUT, 0, |
| 5138 | 0x80, present ? 0x80 : 0); |
| 5139 | snd_hda_codec_amp_update(codec, 0x18, 1, HDA_OUTPUT, 0, |
| 5140 | 0x80, present ? 0x80 : 0); |
| 5141 | snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_OUTPUT, 0, |
| 5142 | 0x80, present ? 0x80 : 0); |
| 5143 | snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_OUTPUT, 0, |
| 5144 | 0x80, present ? 0x80 : 0); |
| 5145 | } |
| 5146 | |
| 5147 | /* Processes unsolicited events. */ |
| 5148 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5149 | unsigned int res) |
| 5150 | { |
| 5151 | /* Headphone insertion or removal. */ |
| 5152 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5153 | alc885_imac24_automute(codec); |
| 5154 | } |
| 5155 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5156 | static struct hda_verb alc882_targa_verbs[] = { |
| 5157 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5158 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5159 | |
| 5160 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5161 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5162 | |
| 5163 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5164 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5165 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5166 | |
| 5167 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5168 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5169 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5170 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5171 | { } /* end */ |
| 5172 | }; |
| 5173 | |
| 5174 | /* toggle speaker-output according to the hp-jack state */ |
| 5175 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5176 | { |
| 5177 | unsigned int present; |
| 5178 | |
| 5179 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5180 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5181 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 5182 | 0x80, present ? 0x80 : 0); |
| 5183 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 5184 | 0x80, present ? 0x80 : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 5185 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5186 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5187 | } |
| 5188 | |
| 5189 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5190 | { |
| 5191 | /* Looks like the unsol event is incompatible with the standard |
| 5192 | * definition. 4bit tag is placed at 26 bit! |
| 5193 | */ |
| 5194 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5195 | alc882_targa_automute(codec); |
| 5196 | } |
| 5197 | } |
| 5198 | |
| 5199 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5201 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5202 | |
| 5203 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5204 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5205 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5206 | |
| 5207 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5208 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5209 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5210 | |
| 5211 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5212 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5213 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5214 | { } /* end */ |
| 5215 | }; |
| 5216 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5217 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5218 | { |
| 5219 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5220 | |
| 5221 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5222 | AC_VERB_GET_GPIO_DATA, 0); |
| 5223 | |
| 5224 | if (!muted) |
| 5225 | gpiostate |= (1 << pin); |
| 5226 | else |
| 5227 | gpiostate &= ~(1 << pin); |
| 5228 | |
| 5229 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5230 | AC_VERB_GET_GPIO_MASK, 0); |
| 5231 | gpiomask |= (1 << pin); |
| 5232 | |
| 5233 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5234 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5235 | gpiodir |= (1 << pin); |
| 5236 | |
| 5237 | |
| 5238 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5239 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5240 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5241 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5242 | |
| 5243 | msleep(1); |
| 5244 | |
| 5245 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5246 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5247 | } |
| 5248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5249 | /* |
| 5250 | * generic initialization of ADC, input mixers and output mixers |
| 5251 | */ |
| 5252 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5253 | /* |
| 5254 | * Unmute ADC0-2 and set the default input to mic-in |
| 5255 | */ |
| 5256 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5257 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5258 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5259 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5260 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5261 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5262 | |
| 5263 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5264 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5265 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5266 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5267 | */ |
| 5268 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 5269 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5270 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5271 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5272 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5273 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5274 | |
| 5275 | /* |
| 5276 | * Set up output mixers (0x0c - 0x0f) |
| 5277 | */ |
| 5278 | /* set vol=0 to output mixers */ |
| 5279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5280 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5281 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5282 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5283 | /* set up input amps for analog loopback */ |
| 5284 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5285 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5286 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5287 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5288 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5289 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5290 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5291 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5292 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5293 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5294 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5295 | |
| 5296 | /* FIXME: use matrix-type input source selection */ |
| 5297 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5298 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5299 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5301 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5302 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5303 | /* Input mixer2 */ |
| 5304 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5305 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5306 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5307 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5308 | /* Input mixer3 */ |
| 5309 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5311 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5312 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5313 | |
| 5314 | { } |
| 5315 | }; |
| 5316 | |
| 5317 | /* capture mixer elements */ |
| 5318 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5319 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5320 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5321 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5322 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5323 | { |
| 5324 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5325 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5326 | * So call somewhat different.. |
| 5327 | * FIXME: the controls appear in the "playback" view! |
| 5328 | */ |
| 5329 | /* .name = "Capture Source", */ |
| 5330 | .name = "Input Source", |
| 5331 | .count = 2, |
| 5332 | .info = alc882_mux_enum_info, |
| 5333 | .get = alc882_mux_enum_get, |
| 5334 | .put = alc882_mux_enum_put, |
| 5335 | }, |
| 5336 | { } /* end */ |
| 5337 | }; |
| 5338 | |
| 5339 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5340 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5341 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5342 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5343 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5344 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5345 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5346 | { |
| 5347 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5348 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5349 | * So call somewhat different.. |
| 5350 | * FIXME: the controls appear in the "playback" view! |
| 5351 | */ |
| 5352 | /* .name = "Capture Source", */ |
| 5353 | .name = "Input Source", |
| 5354 | .count = 3, |
| 5355 | .info = alc882_mux_enum_info, |
| 5356 | .get = alc882_mux_enum_get, |
| 5357 | .put = alc882_mux_enum_put, |
| 5358 | }, |
| 5359 | { } /* end */ |
| 5360 | }; |
| 5361 | |
| 5362 | /* pcm configuration: identiacal with ALC880 */ |
| 5363 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5364 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5365 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5366 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5367 | |
| 5368 | /* |
| 5369 | * configuration and preset |
| 5370 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5371 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5372 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5373 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5374 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5375 | [ALC882_W2JC] = "w2jc", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5376 | [ALC885_MACPRO] = "macpro", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5377 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5378 | [ALC882_AUTO] = "auto", |
| 5379 | }; |
| 5380 | |
| 5381 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 5382 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 5383 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
| 5384 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5385 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5386 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5387 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 5388 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 5389 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5390 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5391 | {} |
| 5392 | }; |
| 5393 | |
| 5394 | static struct alc_config_preset alc882_presets[] = { |
| 5395 | [ALC882_3ST_DIG] = { |
| 5396 | .mixers = { alc882_base_mixer }, |
| 5397 | .init_verbs = { alc882_init_verbs }, |
| 5398 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5399 | .dac_nids = alc882_dac_nids, |
| 5400 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5401 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5402 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5403 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5404 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5405 | .input_mux = &alc882_capture_source, |
| 5406 | }, |
| 5407 | [ALC882_6ST_DIG] = { |
| 5408 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5409 | .init_verbs = { alc882_init_verbs }, |
| 5410 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5411 | .dac_nids = alc882_dac_nids, |
| 5412 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5413 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5414 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5415 | .channel_mode = alc882_sixstack_modes, |
| 5416 | .input_mux = &alc882_capture_source, |
| 5417 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5418 | [ALC882_ARIMA] = { |
| 5419 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5420 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 5421 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5422 | .dac_nids = alc882_dac_nids, |
| 5423 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5424 | .channel_mode = alc882_sixstack_modes, |
| 5425 | .input_mux = &alc882_capture_source, |
| 5426 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5427 | [ALC882_W2JC] = { |
| 5428 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 5429 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5430 | alc880_gpio1_init_verbs }, |
| 5431 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5432 | .dac_nids = alc882_dac_nids, |
| 5433 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5434 | .channel_mode = alc880_threestack_modes, |
| 5435 | .need_dac_fix = 1, |
| 5436 | .input_mux = &alc882_capture_source, |
| 5437 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5438 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5439 | [ALC885_MACPRO] = { |
| 5440 | .mixers = { alc882_macpro_mixer }, |
| 5441 | .init_verbs = { alc882_macpro_init_verbs }, |
| 5442 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5443 | .dac_nids = alc882_dac_nids, |
| 5444 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5445 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5446 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5447 | .channel_mode = alc882_ch_modes, |
| 5448 | .input_mux = &alc882_capture_source, |
| 5449 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5450 | [ALC885_IMAC24] = { |
| 5451 | .mixers = { alc885_imac24_mixer }, |
| 5452 | .init_verbs = { alc885_imac24_init_verbs }, |
| 5453 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5454 | .dac_nids = alc882_dac_nids, |
| 5455 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5456 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5457 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5458 | .channel_mode = alc882_ch_modes, |
| 5459 | .input_mux = &alc882_capture_source, |
| 5460 | .unsol_event = alc885_imac24_unsol_event, |
| 5461 | .init_hook = alc885_imac24_automute, |
| 5462 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5463 | [ALC882_TARGA] = { |
| 5464 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 5465 | alc882_capture_mixer }, |
| 5466 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 5467 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5468 | .dac_nids = alc882_dac_nids, |
| 5469 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5470 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5471 | .adc_nids = alc882_adc_nids, |
| 5472 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5473 | .channel_mode = alc882_3ST_6ch_modes, |
| 5474 | .need_dac_fix = 1, |
| 5475 | .input_mux = &alc882_capture_source, |
| 5476 | .unsol_event = alc882_targa_unsol_event, |
| 5477 | .init_hook = alc882_targa_automute, |
| 5478 | }, |
| 5479 | [ALC882_ASUS_A7J] = { |
| 5480 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 5481 | alc882_capture_mixer }, |
| 5482 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 5483 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5484 | .dac_nids = alc882_dac_nids, |
| 5485 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5486 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5487 | .adc_nids = alc882_adc_nids, |
| 5488 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5489 | .channel_mode = alc882_3ST_6ch_modes, |
| 5490 | .need_dac_fix = 1, |
| 5491 | .input_mux = &alc882_capture_source, |
| 5492 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5493 | }; |
| 5494 | |
| 5495 | |
| 5496 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 5497 | * Pin config fixes |
| 5498 | */ |
| 5499 | enum { |
| 5500 | PINFIX_ABIT_AW9D_MAX |
| 5501 | }; |
| 5502 | |
| 5503 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 5504 | { 0x15, 0x01080104 }, /* side */ |
| 5505 | { 0x16, 0x01011012 }, /* rear */ |
| 5506 | { 0x17, 0x01016011 }, /* clfe */ |
| 5507 | { } |
| 5508 | }; |
| 5509 | |
| 5510 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 5511 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 5512 | }; |
| 5513 | |
| 5514 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 5515 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 5516 | {} |
| 5517 | }; |
| 5518 | |
| 5519 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5520 | * BIOS auto configuration |
| 5521 | */ |
| 5522 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5523 | hda_nid_t nid, int pin_type, |
| 5524 | int dac_idx) |
| 5525 | { |
| 5526 | /* set as output */ |
| 5527 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5528 | int idx; |
| 5529 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5530 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 5531 | idx = 4; |
| 5532 | else |
| 5533 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 5534 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5535 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5536 | pin_type); |
| 5537 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5538 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5539 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 5540 | |
| 5541 | } |
| 5542 | |
| 5543 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 5544 | { |
| 5545 | struct alc_spec *spec = codec->spec; |
| 5546 | int i; |
| 5547 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5548 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5549 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5550 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5551 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5552 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5553 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5554 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5555 | } |
| 5556 | } |
| 5557 | |
| 5558 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 5559 | { |
| 5560 | struct alc_spec *spec = codec->spec; |
| 5561 | hda_nid_t pin; |
| 5562 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5563 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5564 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5565 | /* use dac 0 */ |
| 5566 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5567 | } |
| 5568 | |
| 5569 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 5570 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 5571 | |
| 5572 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 5573 | { |
| 5574 | struct alc_spec *spec = codec->spec; |
| 5575 | int i; |
| 5576 | |
| 5577 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5578 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5579 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5580 | snd_hda_codec_write(codec, nid, 0, |
| 5581 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5582 | i <= AUTO_PIN_FRONT_MIC ? |
| 5583 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5584 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5585 | snd_hda_codec_write(codec, nid, 0, |
| 5586 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5587 | AMP_OUT_MUTE); |
| 5588 | } |
| 5589 | } |
| 5590 | } |
| 5591 | |
| 5592 | /* almost identical with ALC880 parser... */ |
| 5593 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 5594 | { |
| 5595 | struct alc_spec *spec = codec->spec; |
| 5596 | int err = alc880_parse_auto_config(codec); |
| 5597 | |
| 5598 | if (err < 0) |
| 5599 | return err; |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 5600 | else if (err > 0) |
| 5601 | /* hack - override the init verbs */ |
| 5602 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 5603 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5604 | } |
| 5605 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5606 | /* additional initialization for auto-configuration model */ |
| 5607 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5608 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5609 | alc882_auto_init_multi_out(codec); |
| 5610 | alc882_auto_init_hp_out(codec); |
| 5611 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5612 | } |
| 5613 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5614 | static int patch_alc882(struct hda_codec *codec) |
| 5615 | { |
| 5616 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5617 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5618 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5619 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5620 | if (spec == NULL) |
| 5621 | return -ENOMEM; |
| 5622 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5623 | codec->spec = spec; |
| 5624 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5625 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 5626 | alc882_models, |
| 5627 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5628 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5629 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5630 | /* Pick up systems that don't supply PCI SSID */ |
| 5631 | switch (codec->subsystem_id) { |
| 5632 | case 0x106b0c00: /* Mac Pro */ |
| 5633 | board_config = ALC885_MACPRO; |
| 5634 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5635 | case 0x106b1000: /* iMac 24 */ |
| 5636 | board_config = ALC885_IMAC24; |
| 5637 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5638 | default: |
| 5639 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 5640 | "trying auto-probe from BIOS...\n"); |
| 5641 | board_config = ALC882_AUTO; |
| 5642 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5643 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5644 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 5645 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 5646 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5647 | if (board_config == ALC882_AUTO) { |
| 5648 | /* automatic parse from the BIOS config */ |
| 5649 | err = alc882_parse_auto_config(codec); |
| 5650 | if (err < 0) { |
| 5651 | alc_free(codec); |
| 5652 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5653 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5654 | printk(KERN_INFO |
| 5655 | "hda_codec: Cannot set up configuration " |
| 5656 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5657 | board_config = ALC882_3ST_DIG; |
| 5658 | } |
| 5659 | } |
| 5660 | |
| 5661 | if (board_config != ALC882_AUTO) |
| 5662 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5663 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5664 | if (board_config == ALC885_MACPRO || board_config == ALC885_IMAC24) { |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5665 | alc882_gpio_mute(codec, 0, 0); |
| 5666 | alc882_gpio_mute(codec, 1, 0); |
| 5667 | } |
| 5668 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5669 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5670 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 5671 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5672 | |
| 5673 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5674 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 5675 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5676 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5677 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5678 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5679 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5680 | /* get type */ |
| 5681 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5682 | if (wcap != AC_WID_AUD_IN) { |
| 5683 | spec->adc_nids = alc882_adc_nids_alt; |
| 5684 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5685 | spec->mixers[spec->num_mixers] = |
| 5686 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5687 | spec->num_mixers++; |
| 5688 | } else { |
| 5689 | spec->adc_nids = alc882_adc_nids; |
| 5690 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 5691 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 5692 | spec->num_mixers++; |
| 5693 | } |
| 5694 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5695 | |
| 5696 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5697 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5698 | spec->init_hook = alc882_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5699 | |
| 5700 | return 0; |
| 5701 | } |
| 5702 | |
| 5703 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5704 | * ALC883 support |
| 5705 | * |
| 5706 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 5707 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5708 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5709 | * 6-channel independent captures. |
| 5710 | * |
| 5711 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5712 | * driver yet). |
| 5713 | */ |
| 5714 | #define ALC883_DIGOUT_NID 0x06 |
| 5715 | #define ALC883_DIGIN_NID 0x0a |
| 5716 | |
| 5717 | static hda_nid_t alc883_dac_nids[4] = { |
| 5718 | /* front, rear, clfe, rear_surr */ |
| 5719 | 0x02, 0x04, 0x03, 0x05 |
| 5720 | }; |
| 5721 | |
| 5722 | static hda_nid_t alc883_adc_nids[2] = { |
| 5723 | /* ADC1-2 */ |
| 5724 | 0x08, 0x09, |
| 5725 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5726 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5727 | /* input MUX */ |
| 5728 | /* FIXME: should be a matrix-type input source selection */ |
| 5729 | |
| 5730 | static struct hda_input_mux alc883_capture_source = { |
| 5731 | .num_items = 4, |
| 5732 | .items = { |
| 5733 | { "Mic", 0x0 }, |
| 5734 | { "Front Mic", 0x1 }, |
| 5735 | { "Line", 0x2 }, |
| 5736 | { "CD", 0x4 }, |
| 5737 | }, |
| 5738 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5739 | |
| 5740 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 5741 | .num_items = 2, |
| 5742 | .items = { |
| 5743 | { "Mic", 0x1 }, |
| 5744 | { "Line", 0x2 }, |
| 5745 | }, |
| 5746 | }; |
| 5747 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5748 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 5749 | .num_items = 4, |
| 5750 | .items = { |
| 5751 | { "Mic", 0x0 }, |
| 5752 | { "iMic", 0x1 }, |
| 5753 | { "Line", 0x2 }, |
| 5754 | { "CD", 0x4 }, |
| 5755 | }, |
| 5756 | }; |
| 5757 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5758 | #define alc883_mux_enum_info alc_mux_enum_info |
| 5759 | #define alc883_mux_enum_get alc_mux_enum_get |
| 5760 | |
| 5761 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5762 | struct snd_ctl_elem_value *ucontrol) |
| 5763 | { |
| 5764 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5765 | struct alc_spec *spec = codec->spec; |
| 5766 | const struct hda_input_mux *imux = spec->input_mux; |
| 5767 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5768 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 5769 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 5770 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5771 | unsigned int i, idx; |
| 5772 | |
| 5773 | idx = ucontrol->value.enumerated.item[0]; |
| 5774 | if (idx >= imux->num_items) |
| 5775 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 5776 | if (*cur_val == idx) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5777 | return 0; |
| 5778 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 5779 | unsigned int v = (i == idx) ? 0x00 : 0x80; |
| 5780 | snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, |
| 5781 | imux->items[i].index, |
| 5782 | 0x80, v); |
| 5783 | snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, |
| 5784 | imux->items[i].index, |
| 5785 | 0x80, v); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5786 | } |
| 5787 | *cur_val = idx; |
| 5788 | return 1; |
| 5789 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5790 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5791 | /* |
| 5792 | * 2ch mode |
| 5793 | */ |
| 5794 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 5795 | { 2, NULL } |
| 5796 | }; |
| 5797 | |
| 5798 | /* |
| 5799 | * 2ch mode |
| 5800 | */ |
| 5801 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 5802 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5803 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5804 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5805 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5806 | { } /* end */ |
| 5807 | }; |
| 5808 | |
| 5809 | /* |
| 5810 | * 6ch mode |
| 5811 | */ |
| 5812 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 5813 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5814 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5815 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5816 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5817 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5818 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5819 | { } /* end */ |
| 5820 | }; |
| 5821 | |
| 5822 | static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { |
| 5823 | { 2, alc883_3ST_ch2_init }, |
| 5824 | { 6, alc883_3ST_ch6_init }, |
| 5825 | }; |
| 5826 | |
| 5827 | /* |
| 5828 | * 6ch mode |
| 5829 | */ |
| 5830 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 5831 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5832 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5833 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5834 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5835 | { } /* end */ |
| 5836 | }; |
| 5837 | |
| 5838 | /* |
| 5839 | * 8ch mode |
| 5840 | */ |
| 5841 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 5842 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5843 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5844 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5845 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5846 | { } /* end */ |
| 5847 | }; |
| 5848 | |
| 5849 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 5850 | { 6, alc883_sixstack_ch6_init }, |
| 5851 | { 8, alc883_sixstack_ch8_init }, |
| 5852 | }; |
| 5853 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5854 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 5855 | /* eanable EAPD on medion laptop */ |
| 5856 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5857 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 5858 | { } |
| 5859 | }; |
| 5860 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5861 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5862 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5863 | */ |
| 5864 | |
| 5865 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 5866 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5867 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5868 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5869 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5870 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5871 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5872 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5873 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5874 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 5875 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 5876 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5877 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5878 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5879 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5880 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5881 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5882 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5884 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5885 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5886 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5887 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5888 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5889 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5890 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5891 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5892 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5893 | { |
| 5894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5895 | /* .name = "Capture Source", */ |
| 5896 | .name = "Input Source", |
| 5897 | .count = 2, |
| 5898 | .info = alc883_mux_enum_info, |
| 5899 | .get = alc883_mux_enum_get, |
| 5900 | .put = alc883_mux_enum_put, |
| 5901 | }, |
| 5902 | { } /* end */ |
| 5903 | }; |
| 5904 | |
| 5905 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 5906 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5907 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5908 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5909 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5910 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5911 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5912 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5913 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5914 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5915 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5916 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5917 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5918 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5919 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5920 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5921 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5922 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5923 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5924 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5925 | { |
| 5926 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5927 | /* .name = "Capture Source", */ |
| 5928 | .name = "Input Source", |
| 5929 | .count = 2, |
| 5930 | .info = alc883_mux_enum_info, |
| 5931 | .get = alc883_mux_enum_get, |
| 5932 | .put = alc883_mux_enum_put, |
| 5933 | }, |
| 5934 | { } /* end */ |
| 5935 | }; |
| 5936 | |
| 5937 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 5938 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5939 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5940 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5941 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5942 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5943 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5944 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5945 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5946 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5948 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5950 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5952 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5953 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5954 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5955 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5956 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5957 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5958 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5959 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5960 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5961 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5962 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5963 | { |
| 5964 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5965 | /* .name = "Capture Source", */ |
| 5966 | .name = "Input Source", |
| 5967 | .count = 2, |
| 5968 | .info = alc883_mux_enum_info, |
| 5969 | .get = alc883_mux_enum_get, |
| 5970 | .put = alc883_mux_enum_put, |
| 5971 | }, |
| 5972 | { } /* end */ |
| 5973 | }; |
| 5974 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 5975 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5976 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5977 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5978 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5979 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5980 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5981 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5982 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 5983 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 5984 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5985 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5986 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5987 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5988 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5990 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5991 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5992 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5993 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5994 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5995 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5996 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5997 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5998 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5999 | |
| 6000 | { |
| 6001 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6002 | /* .name = "Capture Source", */ |
| 6003 | .name = "Input Source", |
| 6004 | .count = 1, |
| 6005 | .info = alc883_mux_enum_info, |
| 6006 | .get = alc883_mux_enum_get, |
| 6007 | .put = alc883_mux_enum_put, |
| 6008 | }, |
| 6009 | { } /* end */ |
| 6010 | }; |
| 6011 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6012 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6014 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6015 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6016 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6017 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6018 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6019 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6020 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6021 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6022 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6023 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6024 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6025 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6026 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6027 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6028 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6029 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6030 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6031 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6032 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6033 | { |
| 6034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6035 | /* .name = "Capture Source", */ |
| 6036 | .name = "Input Source", |
| 6037 | .count = 2, |
| 6038 | .info = alc883_mux_enum_info, |
| 6039 | .get = alc883_mux_enum_get, |
| 6040 | .put = alc883_mux_enum_put, |
| 6041 | }, |
| 6042 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6043 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6044 | |
| 6045 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6046 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6047 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6048 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6049 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6050 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6051 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6052 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6053 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6054 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6055 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6056 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6057 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6058 | { |
| 6059 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6060 | /* .name = "Capture Source", */ |
| 6061 | .name = "Input Source", |
| 6062 | .count = 2, |
| 6063 | .info = alc883_mux_enum_info, |
| 6064 | .get = alc883_mux_enum_get, |
| 6065 | .put = alc883_mux_enum_put, |
| 6066 | }, |
| 6067 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6068 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6069 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6070 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6071 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6072 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6073 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6074 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6075 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6076 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6077 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6078 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6079 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6080 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6081 | { |
| 6082 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6083 | /* .name = "Capture Source", */ |
| 6084 | .name = "Input Source", |
| 6085 | .count = 1, |
| 6086 | .info = alc883_mux_enum_info, |
| 6087 | .get = alc883_mux_enum_get, |
| 6088 | .put = alc883_mux_enum_put, |
| 6089 | }, |
| 6090 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6091 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6092 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6093 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6094 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6095 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6096 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6097 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6098 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6099 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6100 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6101 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6102 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6103 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6104 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6105 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6106 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6107 | { |
| 6108 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6109 | /* .name = "Capture Source", */ |
| 6110 | .name = "Input Source", |
| 6111 | .count = 2, |
| 6112 | .info = alc883_mux_enum_info, |
| 6113 | .get = alc883_mux_enum_get, |
| 6114 | .put = alc883_mux_enum_put, |
| 6115 | }, |
| 6116 | { } /* end */ |
| 6117 | }; |
| 6118 | |
| 6119 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6120 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6121 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6122 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6123 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6124 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6125 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6126 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6129 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6130 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6131 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6132 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6133 | { |
| 6134 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6135 | /* .name = "Capture Source", */ |
| 6136 | .name = "Input Source", |
| 6137 | .count = 2, |
| 6138 | .info = alc883_mux_enum_info, |
| 6139 | .get = alc883_mux_enum_get, |
| 6140 | .put = alc883_mux_enum_put, |
| 6141 | }, |
| 6142 | { } /* end */ |
| 6143 | }; |
| 6144 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6145 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6146 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6147 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6148 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6149 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6150 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6151 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6152 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6153 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6154 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6155 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6156 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6157 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6158 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6159 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6160 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6161 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6162 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6164 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6165 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6166 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6167 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6168 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6169 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6170 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6171 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6172 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6173 | { |
| 6174 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6175 | /* .name = "Capture Source", */ |
| 6176 | .name = "Input Source", |
| 6177 | .count = 2, |
| 6178 | .info = alc883_mux_enum_info, |
| 6179 | .get = alc883_mux_enum_get, |
| 6180 | .put = alc883_mux_enum_put, |
| 6181 | }, |
| 6182 | { } /* end */ |
| 6183 | }; |
| 6184 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6185 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6186 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6187 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6188 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6189 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6190 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6191 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6192 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6193 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6194 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6195 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6196 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6197 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6198 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6199 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6200 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6201 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6202 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6203 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6204 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6205 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6206 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6207 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6208 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6209 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6210 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6211 | { |
| 6212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6213 | /* .name = "Capture Source", */ |
| 6214 | .name = "Input Source", |
| 6215 | .count = 2, |
| 6216 | .info = alc883_mux_enum_info, |
| 6217 | .get = alc883_mux_enum_get, |
| 6218 | .put = alc883_mux_enum_put, |
| 6219 | }, |
| 6220 | { } /* end */ |
| 6221 | }; |
| 6222 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6223 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
| 6224 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6225 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6226 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6227 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6228 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6229 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6232 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6233 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6234 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6235 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6236 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6237 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6238 | { |
| 6239 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6240 | /* .name = "Capture Source", */ |
| 6241 | .name = "Input Source", |
| 6242 | .count = 2, |
| 6243 | .info = alc883_mux_enum_info, |
| 6244 | .get = alc883_mux_enum_get, |
| 6245 | .put = alc883_mux_enum_put, |
| 6246 | }, |
| 6247 | { } /* end */ |
| 6248 | }; |
| 6249 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6250 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 6251 | { |
| 6252 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6253 | .name = "Channel Mode", |
| 6254 | .info = alc_ch_mode_info, |
| 6255 | .get = alc_ch_mode_get, |
| 6256 | .put = alc_ch_mode_put, |
| 6257 | }, |
| 6258 | { } /* end */ |
| 6259 | }; |
| 6260 | |
| 6261 | static struct hda_verb alc883_init_verbs[] = { |
| 6262 | /* ADC1: mute amp left and right */ |
| 6263 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6264 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6265 | /* ADC2: mute amp left and right */ |
| 6266 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6267 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6268 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6269 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6270 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6271 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6272 | /* Rear mixer */ |
| 6273 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6274 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6275 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6276 | /* CLFE mixer */ |
| 6277 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6278 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6279 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6280 | /* Side mixer */ |
| 6281 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6282 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6283 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6284 | |
| 6285 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6286 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6287 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6290 | |
| 6291 | /* Front Pin: output 0 (0x0c) */ |
| 6292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6293 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6294 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6295 | /* Rear Pin: output 1 (0x0d) */ |
| 6296 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6297 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6299 | /* CLFE Pin: output 2 (0x0e) */ |
| 6300 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6301 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6302 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6303 | /* Side Pin: output 3 (0x0f) */ |
| 6304 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6305 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6306 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 6307 | /* Mic (rear) pin: input vref at 80% */ |
| 6308 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6309 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6310 | /* Front Mic pin: input vref at 80% */ |
| 6311 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6312 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6313 | /* Line In pin: input */ |
| 6314 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6315 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6316 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6317 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6318 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6319 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6320 | /* CD pin widget for input */ |
| 6321 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6322 | |
| 6323 | /* FIXME: use matrix-type input source selection */ |
| 6324 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6325 | /* Input mixer2 */ |
| 6326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6330 | /* Input mixer3 */ |
| 6331 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6335 | { } |
| 6336 | }; |
| 6337 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6338 | static struct hda_verb alc883_tagra_verbs[] = { |
| 6339 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6340 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6341 | |
| 6342 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6343 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6344 | |
| 6345 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6346 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6347 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6348 | |
| 6349 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6350 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6351 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6352 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6353 | |
| 6354 | { } /* end */ |
| 6355 | }; |
| 6356 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6357 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 6358 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6359 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 6360 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 6361 | { } /* end */ |
| 6362 | }; |
| 6363 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6364 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 6365 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6367 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6368 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6369 | { } /* end */ |
| 6370 | }; |
| 6371 | |
| 6372 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 6373 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6374 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6375 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6376 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 6377 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6378 | { } /* end */ |
| 6379 | }; |
| 6380 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6381 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6382 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6383 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 6384 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 6385 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 6386 | { } |
| 6387 | }; |
| 6388 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6389 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6390 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6391 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 6392 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 6393 | { } |
| 6394 | }; |
| 6395 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6396 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6397 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6398 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6399 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6400 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6401 | { } |
| 6402 | }; |
| 6403 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6404 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6405 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6406 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6407 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6408 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6409 | { } |
| 6410 | }; |
| 6411 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6412 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 6413 | { 2, alc888_3st_hp_2ch_init }, |
| 6414 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6415 | }; |
| 6416 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6417 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 6418 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 6419 | { |
| 6420 | unsigned int present; |
| 6421 | |
| 6422 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6423 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6424 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 6425 | 0x80, present ? 0x80 : 0); |
| 6426 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 6427 | 0x80, present ? 0x80 : 0); |
| 6428 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6429 | 0x80, present ? 0x80 : 0); |
| 6430 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6431 | 0x80, present ? 0x80 : 0); |
| 6432 | |
| 6433 | } |
| 6434 | |
| 6435 | /* toggle RCA according to the front-jack state */ |
| 6436 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 6437 | { |
| 6438 | unsigned int present; |
| 6439 | |
| 6440 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6441 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6442 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6443 | 0x80, present ? 0x80 : 0); |
| 6444 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6445 | 0x80, present ? 0x80 : 0); |
| 6446 | |
| 6447 | } |
| 6448 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 6449 | unsigned int res) |
| 6450 | { |
| 6451 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6452 | alc888_lenovo_ms7195_front_automute(codec); |
| 6453 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6454 | alc888_lenovo_ms7195_rca_automute(codec); |
| 6455 | } |
| 6456 | |
| 6457 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 6458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6459 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6460 | |
| 6461 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6462 | |
| 6463 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6464 | { } /* end */ |
| 6465 | }; |
| 6466 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6467 | static struct hda_verb alc883_acer_aspire_verbs[] = { |
| 6468 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6470 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6471 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6472 | |
| 6473 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6474 | |
| 6475 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6476 | { } /* end */ |
| 6477 | }; |
| 6478 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6479 | /* toggle speaker-output according to the hp-jack state */ |
| 6480 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 6481 | { |
| 6482 | unsigned int present; |
| 6483 | |
| 6484 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6485 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6486 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6487 | 0x80, present ? 0x80 : 0); |
| 6488 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6489 | 0x80, present ? 0x80 : 0); |
| 6490 | } |
| 6491 | |
| 6492 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 6493 | unsigned int res) |
| 6494 | { |
| 6495 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6496 | alc883_medion_md2_automute(codec); |
| 6497 | } |
| 6498 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6499 | /* toggle speaker-output according to the hp-jack state */ |
| 6500 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 6501 | { |
| 6502 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6503 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6504 | |
| 6505 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6506 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6507 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6508 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6509 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6510 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6511 | 0x80, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 6512 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6513 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6514 | } |
| 6515 | |
| 6516 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6517 | { |
| 6518 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6519 | alc883_tagra_automute(codec); |
| 6520 | } |
| 6521 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6522 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 6523 | { |
| 6524 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6525 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6526 | |
| 6527 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6528 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6529 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6530 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6531 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6532 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6533 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6534 | } |
| 6535 | |
| 6536 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 6537 | { |
| 6538 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6539 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6540 | |
| 6541 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6542 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6543 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6544 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6545 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6546 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6547 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6548 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6549 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6550 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6551 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6552 | } |
| 6553 | |
| 6554 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 6555 | unsigned int res) |
| 6556 | { |
| 6557 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6558 | alc883_lenovo_101e_all_automute(codec); |
| 6559 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6560 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 6561 | } |
| 6562 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6563 | /* |
| 6564 | * generic initialization of ADC, input mixers and output mixers |
| 6565 | */ |
| 6566 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 6567 | /* |
| 6568 | * Unmute ADC0-2 and set the default input to mic-in |
| 6569 | */ |
| 6570 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6571 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6572 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6573 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6574 | |
| 6575 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6576 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6577 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6578 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6579 | */ |
| 6580 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6581 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6582 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6583 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6584 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6586 | |
| 6587 | /* |
| 6588 | * Set up output mixers (0x0c - 0x0f) |
| 6589 | */ |
| 6590 | /* set vol=0 to output mixers */ |
| 6591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6592 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6593 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6595 | /* set up input amps for analog loopback */ |
| 6596 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6600 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6601 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6602 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6603 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6604 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6605 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6606 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6607 | |
| 6608 | /* FIXME: use matrix-type input source selection */ |
| 6609 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6610 | /* Input mixer1 */ |
| 6611 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6612 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6613 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6614 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6616 | /* Input mixer2 */ |
| 6617 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6618 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6620 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6622 | |
| 6623 | { } |
| 6624 | }; |
| 6625 | |
| 6626 | /* capture mixer elements */ |
| 6627 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 6628 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6629 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6630 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6631 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6632 | { |
| 6633 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6634 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6635 | * So call somewhat different.. |
| 6636 | * FIXME: the controls appear in the "playback" view! |
| 6637 | */ |
| 6638 | /* .name = "Capture Source", */ |
| 6639 | .name = "Input Source", |
| 6640 | .count = 2, |
| 6641 | .info = alc882_mux_enum_info, |
| 6642 | .get = alc882_mux_enum_get, |
| 6643 | .put = alc882_mux_enum_put, |
| 6644 | }, |
| 6645 | { } /* end */ |
| 6646 | }; |
| 6647 | |
| 6648 | /* pcm configuration: identiacal with ALC880 */ |
| 6649 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 6650 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 6651 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 6652 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 6653 | |
| 6654 | /* |
| 6655 | * configuration and preset |
| 6656 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6657 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 6658 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 6659 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 6660 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 6661 | [ALC883_6ST_DIG] = "6stack-dig", |
| 6662 | [ALC883_TARGA_DIG] = "targa-dig", |
| 6663 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6664 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6665 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6666 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6667 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6668 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6669 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6670 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 6671 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6672 | [ALC888_6ST_HP] = "6stack-hp", |
| 6673 | [ALC888_3ST_HP] = "3stack-hp", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6674 | [ALC883_AUTO] = "auto", |
| 6675 | }; |
| 6676 | |
| 6677 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 6678 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 6679 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6680 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
| 6681 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
| 6682 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 6683 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6684 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 6685 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 6686 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 6687 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 6688 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Daniel T Chen | 6f3bf65 | 2007-06-08 11:39:35 +0200 | [diff] [blame] | 6689 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6690 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Baruch Even | dd146a6 | 2007-05-25 12:18:49 +0200 | [diff] [blame] | 6691 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6692 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 6693 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 6694 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 6695 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 6696 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 6697 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 6698 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 6699 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
| 6700 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6701 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6702 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 6703 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6704 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
| 6705 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 6706 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6707 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
| 6708 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 6709 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6710 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 6711 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 6712 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6713 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6714 | {} |
| 6715 | }; |
| 6716 | |
| 6717 | static struct alc_config_preset alc883_presets[] = { |
| 6718 | [ALC883_3ST_2ch_DIG] = { |
| 6719 | .mixers = { alc883_3ST_2ch_mixer }, |
| 6720 | .init_verbs = { alc883_init_verbs }, |
| 6721 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6722 | .dac_nids = alc883_dac_nids, |
| 6723 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6724 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6725 | .adc_nids = alc883_adc_nids, |
| 6726 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6727 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6728 | .channel_mode = alc883_3ST_2ch_modes, |
| 6729 | .input_mux = &alc883_capture_source, |
| 6730 | }, |
| 6731 | [ALC883_3ST_6ch_DIG] = { |
| 6732 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6733 | .init_verbs = { alc883_init_verbs }, |
| 6734 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6735 | .dac_nids = alc883_dac_nids, |
| 6736 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6737 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6738 | .adc_nids = alc883_adc_nids, |
| 6739 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6740 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6741 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6742 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6743 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6744 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6745 | [ALC883_3ST_6ch] = { |
| 6746 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6747 | .init_verbs = { alc883_init_verbs }, |
| 6748 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6749 | .dac_nids = alc883_dac_nids, |
| 6750 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6751 | .adc_nids = alc883_adc_nids, |
| 6752 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6753 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6754 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6755 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6756 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6757 | [ALC883_6ST_DIG] = { |
| 6758 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 6759 | .init_verbs = { alc883_init_verbs }, |
| 6760 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6761 | .dac_nids = alc883_dac_nids, |
| 6762 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6763 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6764 | .adc_nids = alc883_adc_nids, |
| 6765 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6766 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6767 | .channel_mode = alc883_sixstack_modes, |
| 6768 | .input_mux = &alc883_capture_source, |
| 6769 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6770 | [ALC883_TARGA_DIG] = { |
| 6771 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 6772 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6773 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6774 | .dac_nids = alc883_dac_nids, |
| 6775 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6776 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6777 | .adc_nids = alc883_adc_nids, |
| 6778 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6779 | .channel_mode = alc883_3ST_6ch_modes, |
| 6780 | .need_dac_fix = 1, |
| 6781 | .input_mux = &alc883_capture_source, |
| 6782 | .unsol_event = alc883_tagra_unsol_event, |
| 6783 | .init_hook = alc883_tagra_automute, |
| 6784 | }, |
| 6785 | [ALC883_TARGA_2ch_DIG] = { |
| 6786 | .mixers = { alc883_tagra_2ch_mixer}, |
| 6787 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6788 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6789 | .dac_nids = alc883_dac_nids, |
| 6790 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6791 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6792 | .adc_nids = alc883_adc_nids, |
| 6793 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6794 | .channel_mode = alc883_3ST_2ch_modes, |
| 6795 | .input_mux = &alc883_capture_source, |
| 6796 | .unsol_event = alc883_tagra_unsol_event, |
| 6797 | .init_hook = alc883_tagra_automute, |
| 6798 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 6799 | [ALC883_ACER] = { |
| 6800 | .mixers = { alc883_base_mixer, |
| 6801 | alc883_chmode_mixer }, |
| 6802 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 6803 | * and the headphone jack. Turn this on and rely on the |
| 6804 | * standard mute methods whenever the user wants to turn |
| 6805 | * these outputs off. |
| 6806 | */ |
| 6807 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 6808 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6809 | .dac_nids = alc883_dac_nids, |
| 6810 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6811 | .adc_nids = alc883_adc_nids, |
| 6812 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6813 | .channel_mode = alc883_3ST_2ch_modes, |
| 6814 | .input_mux = &alc883_capture_source, |
| 6815 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6816 | [ALC883_ACER_ASPIRE] = { |
| 6817 | .mixers = { alc883_acer_aspire_mixer}, |
| 6818 | .init_verbs = { alc883_init_verbs, alc883_acer_aspire_verbs}, |
| 6819 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6820 | .dac_nids = alc883_dac_nids, |
| 6821 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6822 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6823 | .adc_nids = alc883_adc_nids, |
| 6824 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6825 | .channel_mode = alc883_3ST_2ch_modes, |
| 6826 | .input_mux = &alc883_capture_source, |
| 6827 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6828 | .init_hook = alc883_medion_md2_automute, |
| 6829 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6830 | [ALC883_MEDION] = { |
| 6831 | .mixers = { alc883_fivestack_mixer, |
| 6832 | alc883_chmode_mixer }, |
| 6833 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6834 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6835 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6836 | .dac_nids = alc883_dac_nids, |
| 6837 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6838 | .adc_nids = alc883_adc_nids, |
| 6839 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6840 | .channel_mode = alc883_sixstack_modes, |
| 6841 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6842 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6843 | [ALC883_MEDION_MD2] = { |
| 6844 | .mixers = { alc883_medion_md2_mixer}, |
| 6845 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 6846 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6847 | .dac_nids = alc883_dac_nids, |
| 6848 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6849 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6850 | .adc_nids = alc883_adc_nids, |
| 6851 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6852 | .channel_mode = alc883_3ST_2ch_modes, |
| 6853 | .input_mux = &alc883_capture_source, |
| 6854 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6855 | .init_hook = alc883_medion_md2_automute, |
| 6856 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6857 | [ALC883_LAPTOP_EAPD] = { |
| 6858 | .mixers = { alc883_base_mixer, |
| 6859 | alc883_chmode_mixer }, |
| 6860 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 6861 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6862 | .dac_nids = alc883_dac_nids, |
| 6863 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6864 | .adc_nids = alc883_adc_nids, |
| 6865 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6866 | .channel_mode = alc883_3ST_2ch_modes, |
| 6867 | .input_mux = &alc883_capture_source, |
| 6868 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6869 | [ALC883_LENOVO_101E_2ch] = { |
| 6870 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 6871 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 6872 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6873 | .dac_nids = alc883_dac_nids, |
| 6874 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6875 | .adc_nids = alc883_adc_nids, |
| 6876 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6877 | .channel_mode = alc883_3ST_2ch_modes, |
| 6878 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 6879 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 6880 | .init_hook = alc883_lenovo_101e_all_automute, |
| 6881 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6882 | [ALC883_LENOVO_NB0763] = { |
| 6883 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 6884 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 6885 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6886 | .dac_nids = alc883_dac_nids, |
| 6887 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6888 | .adc_nids = alc883_adc_nids, |
| 6889 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6890 | .channel_mode = alc883_3ST_2ch_modes, |
| 6891 | .need_dac_fix = 1, |
| 6892 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 6893 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6894 | .init_hook = alc883_medion_md2_automute, |
| 6895 | }, |
| 6896 | [ALC888_LENOVO_MS7195_DIG] = { |
| 6897 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6898 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 6899 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6900 | .dac_nids = alc883_dac_nids, |
| 6901 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6902 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6903 | .adc_nids = alc883_adc_nids, |
| 6904 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6905 | .channel_mode = alc883_3ST_6ch_modes, |
| 6906 | .need_dac_fix = 1, |
| 6907 | .input_mux = &alc883_capture_source, |
| 6908 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 6909 | .init_hook = alc888_lenovo_ms7195_front_automute, |
| 6910 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6911 | [ALC888_6ST_HP] = { |
| 6912 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 6913 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6914 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6915 | .dac_nids = alc883_dac_nids, |
| 6916 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6917 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6918 | .adc_nids = alc883_adc_nids, |
| 6919 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6920 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6921 | .channel_mode = alc883_sixstack_modes, |
| 6922 | .input_mux = &alc883_capture_source, |
| 6923 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6924 | [ALC888_3ST_HP] = { |
| 6925 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 6926 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6927 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6928 | .dac_nids = alc883_dac_nids, |
| 6929 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6930 | .adc_nids = alc883_adc_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6931 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 6932 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6933 | .need_dac_fix = 1, |
| 6934 | .input_mux = &alc883_capture_source, |
| 6935 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6936 | }; |
| 6937 | |
| 6938 | |
| 6939 | /* |
| 6940 | * BIOS auto configuration |
| 6941 | */ |
| 6942 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6943 | hda_nid_t nid, int pin_type, |
| 6944 | int dac_idx) |
| 6945 | { |
| 6946 | /* set as output */ |
| 6947 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6948 | int idx; |
| 6949 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6950 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6951 | idx = 4; |
| 6952 | else |
| 6953 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 6954 | |
| 6955 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6956 | pin_type); |
| 6957 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 6958 | AMP_OUT_UNMUTE); |
| 6959 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6960 | |
| 6961 | } |
| 6962 | |
| 6963 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 6964 | { |
| 6965 | struct alc_spec *spec = codec->spec; |
| 6966 | int i; |
| 6967 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6968 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6969 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6970 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6971 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6972 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6973 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6974 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6975 | } |
| 6976 | } |
| 6977 | |
| 6978 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 6979 | { |
| 6980 | struct alc_spec *spec = codec->spec; |
| 6981 | hda_nid_t pin; |
| 6982 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6983 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6984 | if (pin) /* connect to front */ |
| 6985 | /* use dac 0 */ |
| 6986 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 6987 | } |
| 6988 | |
| 6989 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6990 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 6991 | |
| 6992 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 6993 | { |
| 6994 | struct alc_spec *spec = codec->spec; |
| 6995 | int i; |
| 6996 | |
| 6997 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6998 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6999 | if (alc883_is_input_pin(nid)) { |
| 7000 | snd_hda_codec_write(codec, nid, 0, |
| 7001 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7002 | (i <= AUTO_PIN_FRONT_MIC ? |
| 7003 | PIN_VREF80 : PIN_IN)); |
| 7004 | if (nid != ALC883_PIN_CD_NID) |
| 7005 | snd_hda_codec_write(codec, nid, 0, |
| 7006 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7007 | AMP_OUT_MUTE); |
| 7008 | } |
| 7009 | } |
| 7010 | } |
| 7011 | |
| 7012 | /* almost identical with ALC880 parser... */ |
| 7013 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 7014 | { |
| 7015 | struct alc_spec *spec = codec->spec; |
| 7016 | int err = alc880_parse_auto_config(codec); |
| 7017 | |
| 7018 | if (err < 0) |
| 7019 | return err; |
| 7020 | else if (err > 0) |
| 7021 | /* hack - override the init verbs */ |
| 7022 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7023 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 7024 | spec->num_mixers++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7025 | return err; |
| 7026 | } |
| 7027 | |
| 7028 | /* additional initialization for auto-configuration model */ |
| 7029 | static void alc883_auto_init(struct hda_codec *codec) |
| 7030 | { |
| 7031 | alc883_auto_init_multi_out(codec); |
| 7032 | alc883_auto_init_hp_out(codec); |
| 7033 | alc883_auto_init_analog_input(codec); |
| 7034 | } |
| 7035 | |
| 7036 | static int patch_alc883(struct hda_codec *codec) |
| 7037 | { |
| 7038 | struct alc_spec *spec; |
| 7039 | int err, board_config; |
| 7040 | |
| 7041 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 7042 | if (spec == NULL) |
| 7043 | return -ENOMEM; |
| 7044 | |
| 7045 | codec->spec = spec; |
| 7046 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7047 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 7048 | alc883_models, |
| 7049 | alc883_cfg_tbl); |
| 7050 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7051 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 7052 | "trying auto-probe from BIOS...\n"); |
| 7053 | board_config = ALC883_AUTO; |
| 7054 | } |
| 7055 | |
| 7056 | if (board_config == ALC883_AUTO) { |
| 7057 | /* automatic parse from the BIOS config */ |
| 7058 | err = alc883_parse_auto_config(codec); |
| 7059 | if (err < 0) { |
| 7060 | alc_free(codec); |
| 7061 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7062 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7063 | printk(KERN_INFO |
| 7064 | "hda_codec: Cannot set up configuration " |
| 7065 | "from BIOS. Using base mode...\n"); |
| 7066 | board_config = ALC883_3ST_2ch_DIG; |
| 7067 | } |
| 7068 | } |
| 7069 | |
| 7070 | if (board_config != ALC883_AUTO) |
| 7071 | setup_preset(spec, &alc883_presets[board_config]); |
| 7072 | |
| 7073 | spec->stream_name_analog = "ALC883 Analog"; |
| 7074 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 7075 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 7076 | |
| 7077 | spec->stream_name_digital = "ALC883 Digital"; |
| 7078 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 7079 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 7080 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7081 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7082 | spec->adc_nids = alc883_adc_nids; |
| 7083 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 7084 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7085 | |
| 7086 | codec->patch_ops = alc_patch_ops; |
| 7087 | if (board_config == ALC883_AUTO) |
| 7088 | spec->init_hook = alc883_auto_init; |
| 7089 | |
| 7090 | return 0; |
| 7091 | } |
| 7092 | |
| 7093 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7094 | * ALC262 support |
| 7095 | */ |
| 7096 | |
| 7097 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 7098 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 7099 | |
| 7100 | #define alc262_dac_nids alc260_dac_nids |
| 7101 | #define alc262_adc_nids alc882_adc_nids |
| 7102 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 7103 | |
| 7104 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 7105 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7106 | |
| 7107 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 7108 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7109 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7111 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7112 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7113 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7114 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7115 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7116 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7117 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7118 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7119 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7120 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7121 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7122 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 7123 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7124 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7125 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7126 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7127 | }; |
| 7128 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7129 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 7130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7131 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7132 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7133 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7134 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7135 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7138 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7139 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7140 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7141 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7142 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7143 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7144 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 7145 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7146 | { } /* end */ |
| 7147 | }; |
| 7148 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7149 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 7150 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7151 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7152 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7153 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7154 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7155 | |
| 7156 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7157 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7158 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7159 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7160 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7161 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7162 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7163 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7164 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7165 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7166 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7167 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7168 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 7169 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 7170 | { } /* end */ |
| 7171 | }; |
| 7172 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7173 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
| 7174 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7175 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7176 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7178 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7179 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7180 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7181 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7182 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7183 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7184 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7185 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7186 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7187 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7188 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7189 | { } /* end */ |
| 7190 | }; |
| 7191 | |
| 7192 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 7193 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7194 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7195 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7196 | { } /* end */ |
| 7197 | }; |
| 7198 | |
Takashi Iwai | 532d538 | 2007-07-27 19:02:40 +0200 | [diff] [blame] | 7199 | static struct hda_bind_ctls alc262_sony_bind_sw = { |
| 7200 | .ops = &snd_hda_bind_sw, |
| 7201 | .values = { |
| 7202 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 7203 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7204 | 0, |
| 7205 | }, |
| 7206 | }; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7207 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7208 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
| 7209 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 532d538 | 2007-07-27 19:02:40 +0200 | [diff] [blame] | 7210 | HDA_BIND_SW("Front Playback Switch", &alc262_sony_bind_sw), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7211 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7213 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7214 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7215 | { } /* end */ |
| 7216 | }; |
| 7217 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7218 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 7219 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7220 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7221 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7222 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7223 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7224 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7225 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7226 | { } /* end */ |
| 7227 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7228 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7229 | #define alc262_capture_mixer alc882_capture_mixer |
| 7230 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 7231 | |
| 7232 | /* |
| 7233 | * generic initialization of ADC, input mixers and output mixers |
| 7234 | */ |
| 7235 | static struct hda_verb alc262_init_verbs[] = { |
| 7236 | /* |
| 7237 | * Unmute ADC0-2 and set the default input to mic-in |
| 7238 | */ |
| 7239 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7240 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7241 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7242 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7243 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7245 | |
| 7246 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7247 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7248 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7249 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7250 | */ |
| 7251 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7252 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7253 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7254 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7255 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7256 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7257 | |
| 7258 | /* |
| 7259 | * Set up output mixers (0x0c - 0x0e) |
| 7260 | */ |
| 7261 | /* set vol=0 to output mixers */ |
| 7262 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7263 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7264 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7265 | /* set up input amps for analog loopback */ |
| 7266 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7267 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7268 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7269 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7270 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7271 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7272 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7273 | |
| 7274 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7275 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7276 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7277 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7278 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7280 | |
| 7281 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7282 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7283 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7284 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7285 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7286 | |
| 7287 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7289 | |
| 7290 | /* FIXME: use matrix-type input source selection */ |
| 7291 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7292 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7294 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7295 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7296 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7297 | /* Input mixer2 */ |
| 7298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7299 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7300 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7301 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7302 | /* Input mixer3 */ |
| 7303 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7304 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7305 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7306 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7307 | |
| 7308 | { } |
| 7309 | }; |
| 7310 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7311 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 7312 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7313 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7314 | {} |
| 7315 | }; |
| 7316 | |
| 7317 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 7318 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7319 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7320 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7321 | |
| 7322 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7323 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7324 | {} |
| 7325 | }; |
| 7326 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7327 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 7328 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7329 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7330 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 7331 | |
| 7332 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7333 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7334 | }; |
| 7335 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7336 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7337 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7338 | { |
| 7339 | struct alc_spec *spec = codec->spec; |
| 7340 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7341 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7342 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7343 | /* need to execute and sync at first */ |
| 7344 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7345 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7346 | AC_VERB_GET_PIN_SENSE, 0); |
| 7347 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7348 | if (spec->jack_present) { |
| 7349 | /* mute internal speaker */ |
| 7350 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7351 | 0x80, 0x80); |
| 7352 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7353 | 0x80, 0x80); |
| 7354 | } else { |
| 7355 | /* unmute internal speaker if necessary */ |
| 7356 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 7357 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7358 | 0x80, mute & 0x80); |
| 7359 | mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0); |
| 7360 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7361 | 0x80, mute & 0x80); |
| 7362 | } |
| 7363 | } |
| 7364 | |
| 7365 | /* unsolicited event for HP jack sensing */ |
| 7366 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 7367 | unsigned int res) |
| 7368 | { |
| 7369 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7370 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7371 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7372 | } |
| 7373 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7374 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7375 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7376 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7377 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7378 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7379 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7380 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7381 | AC_VERB_GET_PIN_SENSE, 0); |
| 7382 | present = (present & 0x80000000) != 0; |
| 7383 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7384 | /* mute internal speaker */ |
| 7385 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7386 | 0x80, 0x80); |
| 7387 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7388 | 0x80, 0x80); |
| 7389 | } else { |
| 7390 | /* unmute internal speaker if necessary */ |
| 7391 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 7392 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7393 | 0x80, mute & 0x80); |
| 7394 | mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0); |
| 7395 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7396 | 0x80, mute & 0x80); |
| 7397 | } |
| 7398 | } |
| 7399 | |
| 7400 | /* unsolicited event for HP jack sensing */ |
| 7401 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 7402 | unsigned int res) |
| 7403 | { |
| 7404 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7405 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7406 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7407 | } |
| 7408 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7409 | /* |
| 7410 | * fujitsu model |
| 7411 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 7412 | */ |
| 7413 | |
| 7414 | #define ALC_HP_EVENT 0x37 |
| 7415 | |
| 7416 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 7417 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 7418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7419 | {} |
| 7420 | }; |
| 7421 | |
| 7422 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
| 7423 | .num_items = 2, |
| 7424 | .items = { |
| 7425 | { "Mic", 0x0 }, |
| 7426 | { "CD", 0x4 }, |
| 7427 | }, |
| 7428 | }; |
| 7429 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7430 | static struct hda_input_mux alc262_HP_capture_source = { |
| 7431 | .num_items = 5, |
| 7432 | .items = { |
| 7433 | { "Mic", 0x0 }, |
| 7434 | { "Front Mic", 0x3 }, |
| 7435 | { "Line", 0x2 }, |
| 7436 | { "CD", 0x4 }, |
| 7437 | { "AUX IN", 0x6 }, |
| 7438 | }, |
| 7439 | }; |
| 7440 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7441 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 7442 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 7443 | { |
| 7444 | struct alc_spec *spec = codec->spec; |
| 7445 | unsigned int mute; |
| 7446 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7447 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7448 | unsigned int present; |
| 7449 | /* need to execute and sync at first */ |
| 7450 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7451 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7452 | AC_VERB_GET_PIN_SENSE, 0); |
| 7453 | spec->jack_present = (present & 0x80000000) != 0; |
| 7454 | spec->sense_updated = 1; |
| 7455 | } |
| 7456 | if (spec->jack_present) { |
| 7457 | /* mute internal speaker */ |
| 7458 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 7459 | 0x80, 0x80); |
| 7460 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 7461 | 0x80, 0x80); |
| 7462 | } else { |
| 7463 | /* unmute internal speaker if necessary */ |
| 7464 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 7465 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 7466 | 0x80, mute & 0x80); |
| 7467 | mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0); |
| 7468 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 7469 | 0x80, mute & 0x80); |
| 7470 | } |
| 7471 | } |
| 7472 | |
| 7473 | /* unsolicited event for HP jack sensing */ |
| 7474 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 7475 | unsigned int res) |
| 7476 | { |
| 7477 | if ((res >> 26) != ALC_HP_EVENT) |
| 7478 | return; |
| 7479 | alc262_fujitsu_automute(codec, 1); |
| 7480 | } |
| 7481 | |
| 7482 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 7483 | static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol, |
| 7484 | struct snd_ctl_elem_value *ucontrol) |
| 7485 | { |
| 7486 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7487 | long *valp = ucontrol->value.integer.value; |
| 7488 | int change; |
| 7489 | |
| 7490 | change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 7491 | 0x7f, valp[0] & 0x7f); |
| 7492 | change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 7493 | 0x7f, valp[1] & 0x7f); |
| 7494 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 7495 | 0x7f, valp[0] & 0x7f); |
| 7496 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 7497 | 0x7f, valp[1] & 0x7f); |
| 7498 | return change; |
| 7499 | } |
| 7500 | |
| 7501 | /* bind hp and internal speaker mute (with plug check) */ |
| 7502 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 7503 | struct snd_ctl_elem_value *ucontrol) |
| 7504 | { |
| 7505 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7506 | long *valp = ucontrol->value.integer.value; |
| 7507 | int change; |
| 7508 | |
| 7509 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7510 | 0x80, valp[0] ? 0 : 0x80); |
| 7511 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7512 | 0x80, valp[1] ? 0 : 0x80); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 7513 | if (change) |
| 7514 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7515 | return change; |
| 7516 | } |
| 7517 | |
| 7518 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
| 7519 | { |
| 7520 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7521 | .name = "Master Playback Volume", |
| 7522 | .info = snd_hda_mixer_amp_volume_info, |
| 7523 | .get = snd_hda_mixer_amp_volume_get, |
| 7524 | .put = alc262_fujitsu_master_vol_put, |
Takashi Iwai | c256652 | 2006-08-17 18:21:36 +0200 | [diff] [blame] | 7525 | .tlv = { .c = snd_hda_mixer_amp_tlv }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7526 | .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 7527 | }, |
| 7528 | { |
| 7529 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7530 | .name = "Master Playback Switch", |
| 7531 | .info = snd_hda_mixer_amp_switch_info, |
| 7532 | .get = snd_hda_mixer_amp_switch_get, |
| 7533 | .put = alc262_fujitsu_master_sw_put, |
| 7534 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7535 | }, |
| 7536 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7537 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7538 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7539 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7540 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7541 | { } /* end */ |
| 7542 | }; |
| 7543 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 7544 | /* additional init verbs for Benq laptops */ |
| 7545 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 7546 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7547 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7548 | {} |
| 7549 | }; |
| 7550 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7551 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 7552 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7553 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7554 | |
| 7555 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7556 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 7557 | {} |
| 7558 | }; |
| 7559 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7560 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7561 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7562 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7563 | { |
| 7564 | hda_nid_t nid; |
| 7565 | int err; |
| 7566 | |
| 7567 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 7568 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 7569 | spec->multiout.dac_nids[0] = 2; |
| 7570 | |
| 7571 | nid = cfg->line_out_pins[0]; |
| 7572 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7573 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7574 | "Front Playback Volume", |
| 7575 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 7576 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7577 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7578 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7579 | "Front Playback Switch", |
| 7580 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 7581 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7582 | return err; |
| 7583 | } |
| 7584 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7585 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7586 | if (nid) { |
| 7587 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7588 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7589 | "Speaker Playback Volume", |
| 7590 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7591 | HDA_OUTPUT)); |
| 7592 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7593 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7594 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7595 | "Speaker Playback Switch", |
| 7596 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7597 | HDA_OUTPUT)); |
| 7598 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7599 | return err; |
| 7600 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7601 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7602 | "Speaker Playback Switch", |
| 7603 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7604 | HDA_OUTPUT)); |
| 7605 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7606 | return err; |
| 7607 | } |
| 7608 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7609 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7610 | if (nid) { |
| 7611 | /* spec->multiout.hp_nid = 2; */ |
| 7612 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7613 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7614 | "Headphone Playback Volume", |
| 7615 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7616 | HDA_OUTPUT)); |
| 7617 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7618 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7619 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7620 | "Headphone Playback Switch", |
| 7621 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7622 | HDA_OUTPUT)); |
| 7623 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7624 | return err; |
| 7625 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7626 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7627 | "Headphone Playback Switch", |
| 7628 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7629 | HDA_OUTPUT)); |
| 7630 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7631 | return err; |
| 7632 | } |
| 7633 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7634 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7635 | } |
| 7636 | |
| 7637 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7638 | #define alc262_auto_create_analog_input_ctls \ |
| 7639 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7640 | |
| 7641 | /* |
| 7642 | * generic initialization of ADC, input mixers and output mixers |
| 7643 | */ |
| 7644 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 7645 | /* |
| 7646 | * Unmute ADC0-2 and set the default input to mic-in |
| 7647 | */ |
| 7648 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7650 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7651 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7652 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7653 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7654 | |
| 7655 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7656 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7657 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7658 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7659 | */ |
| 7660 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7661 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7662 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7663 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7664 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7665 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7666 | |
| 7667 | /* |
| 7668 | * Set up output mixers (0x0c - 0x0f) |
| 7669 | */ |
| 7670 | /* set vol=0 to output mixers */ |
| 7671 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7672 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7673 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7674 | |
| 7675 | /* set up input amps for analog loopback */ |
| 7676 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7677 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7678 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7679 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7680 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7681 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7682 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7683 | |
| 7684 | /* FIXME: use matrix-type input source selection */ |
| 7685 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7686 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7687 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7688 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7689 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7690 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7691 | /* Input mixer2 */ |
| 7692 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7693 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7694 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7695 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7696 | /* Input mixer3 */ |
| 7697 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7698 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7699 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7700 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7701 | |
| 7702 | { } |
| 7703 | }; |
| 7704 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7705 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 7706 | /* |
| 7707 | * Unmute ADC0-2 and set the default input to mic-in |
| 7708 | */ |
| 7709 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7710 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7711 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7712 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7713 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7714 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7715 | |
| 7716 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7717 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7718 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7719 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7720 | */ |
| 7721 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7725 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7726 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7727 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 7728 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 7729 | |
| 7730 | /* |
| 7731 | * Set up output mixers (0x0c - 0x0e) |
| 7732 | */ |
| 7733 | /* set vol=0 to output mixers */ |
| 7734 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7735 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7736 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7737 | |
| 7738 | /* set up input amps for analog loopback */ |
| 7739 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7740 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7741 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7742 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7743 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7744 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7745 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7746 | |
| 7747 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7748 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7749 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7750 | |
| 7751 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7752 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7753 | |
| 7754 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7755 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7756 | |
| 7757 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7758 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7759 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7760 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7761 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7762 | |
| 7763 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7764 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7766 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7767 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7768 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7769 | |
| 7770 | |
| 7771 | /* FIXME: use matrix-type input source selection */ |
| 7772 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7773 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7774 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7775 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7776 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7777 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7778 | /* Input mixer2 */ |
| 7779 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7780 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7781 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7782 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7783 | /* Input mixer3 */ |
| 7784 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7785 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7786 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7787 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7788 | |
| 7789 | { } |
| 7790 | }; |
| 7791 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7792 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 7793 | /* |
| 7794 | * Unmute ADC0-2 and set the default input to mic-in |
| 7795 | */ |
| 7796 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7797 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7798 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7799 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7800 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7801 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7802 | |
| 7803 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7804 | * mixer widget |
| 7805 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 7806 | * panel mic (mic 2) |
| 7807 | */ |
| 7808 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7809 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7810 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7811 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7812 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7813 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7814 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 7815 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 7816 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 7817 | /* |
| 7818 | * Set up output mixers (0x0c - 0x0e) |
| 7819 | */ |
| 7820 | /* set vol=0 to output mixers */ |
| 7821 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7822 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7823 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7824 | |
| 7825 | /* set up input amps for analog loopback */ |
| 7826 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7827 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7828 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7829 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7830 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7831 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7832 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7833 | |
| 7834 | |
| 7835 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 7836 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 7837 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 7838 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 7839 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 7840 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 7841 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 7842 | |
| 7843 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7844 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7845 | |
| 7846 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7847 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7848 | |
| 7849 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 7850 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7851 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7852 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7853 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7854 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7855 | |
| 7856 | /* FIXME: use matrix-type input source selection */ |
| 7857 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7858 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7859 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 7860 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 7861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 7862 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 7863 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 7864 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7865 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 7866 | /* Input mixer2 */ |
| 7867 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7868 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7869 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7870 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7871 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7872 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7873 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7874 | /* Input mixer3 */ |
| 7875 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7876 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7877 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7878 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7879 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7880 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7881 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7882 | |
| 7883 | { } |
| 7884 | }; |
| 7885 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7886 | /* pcm configuration: identiacal with ALC880 */ |
| 7887 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 7888 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 7889 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 7890 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 7891 | |
| 7892 | /* |
| 7893 | * BIOS auto configuration |
| 7894 | */ |
| 7895 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 7896 | { |
| 7897 | struct alc_spec *spec = codec->spec; |
| 7898 | int err; |
| 7899 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 7900 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7901 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7902 | alc262_ignore); |
| 7903 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7904 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7905 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7906 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7907 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7908 | if (err < 0) |
| 7909 | return err; |
| 7910 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 7911 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7912 | return err; |
| 7913 | |
| 7914 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 7915 | |
| 7916 | if (spec->autocfg.dig_out_pin) |
| 7917 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 7918 | if (spec->autocfg.dig_in_pin) |
| 7919 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 7920 | |
| 7921 | if (spec->kctl_alloc) |
| 7922 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 7923 | |
| 7924 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7925 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7926 | spec->input_mux = &spec->private_imux; |
| 7927 | |
| 7928 | return 1; |
| 7929 | } |
| 7930 | |
| 7931 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 7932 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 7933 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 7934 | |
| 7935 | |
| 7936 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7937 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7938 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7939 | alc262_auto_init_multi_out(codec); |
| 7940 | alc262_auto_init_hp_out(codec); |
| 7941 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7942 | } |
| 7943 | |
| 7944 | /* |
| 7945 | * configuration and preset |
| 7946 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7947 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 7948 | [ALC262_BASIC] = "basic", |
| 7949 | [ALC262_HIPPO] = "hippo", |
| 7950 | [ALC262_HIPPO_1] = "hippo_1", |
| 7951 | [ALC262_FUJITSU] = "fujitsu", |
| 7952 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7953 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7954 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 7955 | [ALC262_BENQ_T31] = "benq-t31", |
| 7956 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7957 | [ALC262_AUTO] = "auto", |
| 7958 | }; |
| 7959 | |
| 7960 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 7961 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 7962 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
| 7963 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7964 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
| 7965 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7966 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7967 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7968 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7969 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7970 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7971 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7972 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7973 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7974 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7975 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7976 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7977 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7978 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
| 7979 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
| 7980 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
| 7981 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7982 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7983 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7984 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
| 7985 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 7986 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7987 | {} |
| 7988 | }; |
| 7989 | |
| 7990 | static struct alc_config_preset alc262_presets[] = { |
| 7991 | [ALC262_BASIC] = { |
| 7992 | .mixers = { alc262_base_mixer }, |
| 7993 | .init_verbs = { alc262_init_verbs }, |
| 7994 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7995 | .dac_nids = alc262_dac_nids, |
| 7996 | .hp_nid = 0x03, |
| 7997 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7998 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7999 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8000 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8001 | [ALC262_HIPPO] = { |
| 8002 | .mixers = { alc262_base_mixer }, |
| 8003 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 8004 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8005 | .dac_nids = alc262_dac_nids, |
| 8006 | .hp_nid = 0x03, |
| 8007 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8008 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8009 | .channel_mode = alc262_modes, |
| 8010 | .input_mux = &alc262_capture_source, |
| 8011 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8012 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8013 | }, |
| 8014 | [ALC262_HIPPO_1] = { |
| 8015 | .mixers = { alc262_hippo1_mixer }, |
| 8016 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 8017 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8018 | .dac_nids = alc262_dac_nids, |
| 8019 | .hp_nid = 0x02, |
| 8020 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8021 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8022 | .channel_mode = alc262_modes, |
| 8023 | .input_mux = &alc262_capture_source, |
| 8024 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8025 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8026 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8027 | [ALC262_FUJITSU] = { |
| 8028 | .mixers = { alc262_fujitsu_mixer }, |
| 8029 | .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, |
| 8030 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8031 | .dac_nids = alc262_dac_nids, |
| 8032 | .hp_nid = 0x03, |
| 8033 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8034 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8035 | .channel_mode = alc262_modes, |
| 8036 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8037 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8038 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8039 | [ALC262_HP_BPC] = { |
| 8040 | .mixers = { alc262_HP_BPC_mixer }, |
| 8041 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 8042 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8043 | .dac_nids = alc262_dac_nids, |
| 8044 | .hp_nid = 0x03, |
| 8045 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8046 | .channel_mode = alc262_modes, |
| 8047 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8048 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8049 | [ALC262_HP_BPC_D7000_WF] = { |
| 8050 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 8051 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 8052 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8053 | .dac_nids = alc262_dac_nids, |
| 8054 | .hp_nid = 0x03, |
| 8055 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8056 | .channel_mode = alc262_modes, |
| 8057 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8058 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8059 | [ALC262_HP_BPC_D7000_WL] = { |
| 8060 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 8061 | alc262_HP_BPC_WildWest_option_mixer }, |
| 8062 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 8063 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8064 | .dac_nids = alc262_dac_nids, |
| 8065 | .hp_nid = 0x03, |
| 8066 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8067 | .channel_mode = alc262_modes, |
| 8068 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8069 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8070 | [ALC262_BENQ_ED8] = { |
| 8071 | .mixers = { alc262_base_mixer }, |
| 8072 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 8073 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8074 | .dac_nids = alc262_dac_nids, |
| 8075 | .hp_nid = 0x03, |
| 8076 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8077 | .channel_mode = alc262_modes, |
| 8078 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8079 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8080 | [ALC262_SONY_ASSAMD] = { |
| 8081 | .mixers = { alc262_sony_mixer }, |
| 8082 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 8083 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8084 | .dac_nids = alc262_dac_nids, |
| 8085 | .hp_nid = 0x02, |
| 8086 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8087 | .channel_mode = alc262_modes, |
| 8088 | .input_mux = &alc262_capture_source, |
| 8089 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8090 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8091 | }, |
| 8092 | [ALC262_BENQ_T31] = { |
| 8093 | .mixers = { alc262_benq_t31_mixer }, |
| 8094 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 8095 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8096 | .dac_nids = alc262_dac_nids, |
| 8097 | .hp_nid = 0x03, |
| 8098 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8099 | .channel_mode = alc262_modes, |
| 8100 | .input_mux = &alc262_capture_source, |
| 8101 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8102 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8103 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8104 | }; |
| 8105 | |
| 8106 | static int patch_alc262(struct hda_codec *codec) |
| 8107 | { |
| 8108 | struct alc_spec *spec; |
| 8109 | int board_config; |
| 8110 | int err; |
| 8111 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 8112 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8113 | if (spec == NULL) |
| 8114 | return -ENOMEM; |
| 8115 | |
| 8116 | codec->spec = spec; |
| 8117 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8118 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 8119 | * under-run |
| 8120 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8121 | { |
| 8122 | int tmp; |
| 8123 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 8124 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 8125 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 8126 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 8127 | } |
| 8128 | #endif |
| 8129 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8130 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 8131 | alc262_models, |
| 8132 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8133 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8134 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8135 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 8136 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8137 | board_config = ALC262_AUTO; |
| 8138 | } |
| 8139 | |
| 8140 | if (board_config == ALC262_AUTO) { |
| 8141 | /* automatic parse from the BIOS config */ |
| 8142 | err = alc262_parse_auto_config(codec); |
| 8143 | if (err < 0) { |
| 8144 | alc_free(codec); |
| 8145 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8146 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8147 | printk(KERN_INFO |
| 8148 | "hda_codec: Cannot set up configuration " |
| 8149 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8150 | board_config = ALC262_BASIC; |
| 8151 | } |
| 8152 | } |
| 8153 | |
| 8154 | if (board_config != ALC262_AUTO) |
| 8155 | setup_preset(spec, &alc262_presets[board_config]); |
| 8156 | |
| 8157 | spec->stream_name_analog = "ALC262 Analog"; |
| 8158 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 8159 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 8160 | |
| 8161 | spec->stream_name_digital = "ALC262 Digital"; |
| 8162 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 8163 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 8164 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8165 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8166 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 8167 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 8168 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8169 | /* get type */ |
| 8170 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8171 | if (wcap != AC_WID_AUD_IN) { |
| 8172 | spec->adc_nids = alc262_adc_nids_alt; |
| 8173 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8174 | spec->mixers[spec->num_mixers] = |
| 8175 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8176 | spec->num_mixers++; |
| 8177 | } else { |
| 8178 | spec->adc_nids = alc262_adc_nids; |
| 8179 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 8180 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 8181 | spec->num_mixers++; |
| 8182 | } |
| 8183 | } |
| 8184 | |
| 8185 | codec->patch_ops = alc_patch_ops; |
| 8186 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8187 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8188 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8189 | return 0; |
| 8190 | } |
| 8191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8192 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8193 | * ALC268 channel source setting (2 channel) |
| 8194 | */ |
| 8195 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 8196 | #define alc268_modes alc260_modes |
| 8197 | |
| 8198 | static hda_nid_t alc268_dac_nids[2] = { |
| 8199 | /* front, hp */ |
| 8200 | 0x02, 0x03 |
| 8201 | }; |
| 8202 | |
| 8203 | static hda_nid_t alc268_adc_nids[2] = { |
| 8204 | /* ADC0-1 */ |
| 8205 | 0x08, 0x07 |
| 8206 | }; |
| 8207 | |
| 8208 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 8209 | /* ADC0 */ |
| 8210 | 0x08 |
| 8211 | }; |
| 8212 | |
| 8213 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 8214 | /* output mixer control */ |
| 8215 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 8216 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8217 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 8218 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8219 | { } |
| 8220 | }; |
| 8221 | |
| 8222 | /* |
| 8223 | * generic initialization of ADC, input mixers and output mixers |
| 8224 | */ |
| 8225 | static struct hda_verb alc268_base_init_verbs[] = { |
| 8226 | /* Unmute DAC0-1 and set vol = 0 */ |
| 8227 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8228 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8229 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8230 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8231 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8232 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8233 | |
| 8234 | /* |
| 8235 | * Set up output mixers (0x0c - 0x0e) |
| 8236 | */ |
| 8237 | /* set vol=0 to output mixers */ |
| 8238 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8239 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8240 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8241 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8242 | |
| 8243 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8244 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8245 | |
| 8246 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8248 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8249 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8250 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8251 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8252 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8253 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8254 | |
| 8255 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8256 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8257 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8258 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8259 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8260 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8261 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8262 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8263 | |
| 8264 | /* FIXME: use matrix-type input source selection */ |
| 8265 | /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */ |
| 8266 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8267 | /* Input mixer2 */ |
| 8268 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8269 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8270 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8271 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8272 | |
| 8273 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8274 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8275 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8276 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8277 | { } |
| 8278 | }; |
| 8279 | |
| 8280 | /* |
| 8281 | * generic initialization of ADC, input mixers and output mixers |
| 8282 | */ |
| 8283 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 8284 | /* set output DAC */ |
| 8285 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8286 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8287 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8288 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8289 | |
| 8290 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8291 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8292 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8293 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8294 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8295 | |
| 8296 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8299 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8300 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8301 | |
| 8302 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8303 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8304 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8305 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8306 | |
| 8307 | /* set PCBEEP vol = 0 */ |
| 8308 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 8309 | |
| 8310 | { } |
| 8311 | }; |
| 8312 | |
| 8313 | #define alc268_mux_enum_info alc_mux_enum_info |
| 8314 | #define alc268_mux_enum_get alc_mux_enum_get |
| 8315 | |
| 8316 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 8317 | struct snd_ctl_elem_value *ucontrol) |
| 8318 | { |
| 8319 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8320 | struct alc_spec *spec = codec->spec; |
| 8321 | const struct hda_input_mux *imux = spec->input_mux; |
| 8322 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 8323 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 8324 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 8325 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 8326 | unsigned int i, idx; |
| 8327 | |
| 8328 | idx = ucontrol->value.enumerated.item[0]; |
| 8329 | if (idx >= imux->num_items) |
| 8330 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 8331 | if (*cur_val == idx) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8332 | return 0; |
| 8333 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 8334 | unsigned int v = (i == idx) ? 0x00 : 0x80; |
| 8335 | snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, |
| 8336 | imux->items[i].index, 0x80, v); |
| 8337 | snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, |
| 8338 | imux->items[i].index, 0x80, v); |
| 8339 | snd_hda_codec_write_cache(codec, nid, 0, |
| 8340 | AC_VERB_SET_CONNECT_SEL, |
| 8341 | idx ); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8342 | } |
| 8343 | *cur_val = idx; |
| 8344 | return 1; |
| 8345 | } |
| 8346 | |
| 8347 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 8348 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8349 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8350 | { |
| 8351 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8352 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8353 | * So call somewhat different.. |
| 8354 | * FIXME: the controls appear in the "playback" view! |
| 8355 | */ |
| 8356 | /* .name = "Capture Source", */ |
| 8357 | .name = "Input Source", |
| 8358 | .count = 1, |
| 8359 | .info = alc268_mux_enum_info, |
| 8360 | .get = alc268_mux_enum_get, |
| 8361 | .put = alc268_mux_enum_put, |
| 8362 | }, |
| 8363 | { } /* end */ |
| 8364 | }; |
| 8365 | |
| 8366 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 8367 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8368 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8369 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8370 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8371 | { |
| 8372 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8373 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8374 | * So call somewhat different.. |
| 8375 | * FIXME: the controls appear in the "playback" view! |
| 8376 | */ |
| 8377 | /* .name = "Capture Source", */ |
| 8378 | .name = "Input Source", |
| 8379 | .count = 2, |
| 8380 | .info = alc268_mux_enum_info, |
| 8381 | .get = alc268_mux_enum_get, |
| 8382 | .put = alc268_mux_enum_put, |
| 8383 | }, |
| 8384 | { } /* end */ |
| 8385 | }; |
| 8386 | |
| 8387 | static struct hda_input_mux alc268_capture_source = { |
| 8388 | .num_items = 4, |
| 8389 | .items = { |
| 8390 | { "Mic", 0x0 }, |
| 8391 | { "Front Mic", 0x1 }, |
| 8392 | { "Line", 0x2 }, |
| 8393 | { "CD", 0x3 }, |
| 8394 | }, |
| 8395 | }; |
| 8396 | |
| 8397 | /* create input playback/capture controls for the given pin */ |
| 8398 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 8399 | const char *ctlname, int idx) |
| 8400 | { |
| 8401 | char name[32]; |
| 8402 | int err; |
| 8403 | |
| 8404 | sprintf(name, "%s Playback Volume", ctlname); |
| 8405 | if (nid == 0x14) { |
| 8406 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8407 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 8408 | HDA_OUTPUT)); |
| 8409 | if (err < 0) |
| 8410 | return err; |
| 8411 | } else if (nid == 0x15) { |
| 8412 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8413 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 8414 | HDA_OUTPUT)); |
| 8415 | if (err < 0) |
| 8416 | return err; |
| 8417 | } else |
| 8418 | return -1; |
| 8419 | sprintf(name, "%s Playback Switch", ctlname); |
| 8420 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 8421 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 8422 | if (err < 0) |
| 8423 | return err; |
| 8424 | return 0; |
| 8425 | } |
| 8426 | |
| 8427 | /* add playback controls from the parsed DAC table */ |
| 8428 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8429 | const struct auto_pin_cfg *cfg) |
| 8430 | { |
| 8431 | hda_nid_t nid; |
| 8432 | int err; |
| 8433 | |
| 8434 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 8435 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8436 | spec->multiout.dac_nids[0] = 2; |
| 8437 | spec->multiout.dac_nids[1] = 3; |
| 8438 | |
| 8439 | nid = cfg->line_out_pins[0]; |
| 8440 | if (nid) |
| 8441 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 8442 | |
| 8443 | nid = cfg->speaker_pins[0]; |
| 8444 | if (nid == 0x1d) { |
| 8445 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8446 | "Speaker Playback Volume", |
| 8447 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 8448 | if (err < 0) |
| 8449 | return err; |
| 8450 | } |
| 8451 | nid = cfg->hp_pins[0]; |
| 8452 | if (nid) |
| 8453 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 8454 | |
| 8455 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 8456 | if (nid == 0x16) { |
| 8457 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8458 | "Mono Playback Switch", |
| 8459 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 8460 | if (err < 0) |
| 8461 | return err; |
| 8462 | } |
| 8463 | return 0; |
| 8464 | } |
| 8465 | |
| 8466 | /* create playback/capture controls for input pins */ |
| 8467 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 8468 | const struct auto_pin_cfg *cfg) |
| 8469 | { |
| 8470 | struct hda_input_mux *imux = &spec->private_imux; |
| 8471 | int i, idx1; |
| 8472 | |
| 8473 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8474 | switch(cfg->input_pins[i]) { |
| 8475 | case 0x18: |
| 8476 | idx1 = 0; /* Mic 1 */ |
| 8477 | break; |
| 8478 | case 0x19: |
| 8479 | idx1 = 1; /* Mic 2 */ |
| 8480 | break; |
| 8481 | case 0x1a: |
| 8482 | idx1 = 2; /* Line In */ |
| 8483 | break; |
| 8484 | case 0x1c: |
| 8485 | idx1 = 3; /* CD */ |
| 8486 | break; |
| 8487 | default: |
| 8488 | continue; |
| 8489 | } |
| 8490 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 8491 | imux->items[imux->num_items].index = idx1; |
| 8492 | imux->num_items++; |
| 8493 | } |
| 8494 | return 0; |
| 8495 | } |
| 8496 | |
| 8497 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 8498 | { |
| 8499 | struct alc_spec *spec = codec->spec; |
| 8500 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 8501 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 8502 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 8503 | unsigned int dac_vol1, dac_vol2; |
| 8504 | |
| 8505 | if (speaker_nid) { |
| 8506 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 8507 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 8508 | snd_hda_codec_write(codec, 0x0f, 0, |
| 8509 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8510 | AMP_IN_UNMUTE(1)); |
| 8511 | snd_hda_codec_write(codec, 0x10, 0, |
| 8512 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8513 | AMP_IN_UNMUTE(1)); |
| 8514 | } else { |
| 8515 | snd_hda_codec_write(codec, 0x0f, 0, |
| 8516 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 8517 | snd_hda_codec_write(codec, 0x10, 0, |
| 8518 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 8519 | } |
| 8520 | |
| 8521 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 8522 | if (line_nid == 0x14) |
| 8523 | dac_vol2 = AMP_OUT_ZERO; |
| 8524 | else if (line_nid == 0x15) |
| 8525 | dac_vol1 = AMP_OUT_ZERO; |
| 8526 | if (hp_nid == 0x14) |
| 8527 | dac_vol2 = AMP_OUT_ZERO; |
| 8528 | else if (hp_nid == 0x15) |
| 8529 | dac_vol1 = AMP_OUT_ZERO; |
| 8530 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 8531 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 8532 | spec->autocfg.line_out_pins[2] != 0x16) |
| 8533 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 8534 | |
| 8535 | snd_hda_codec_write(codec, 0x02, 0, |
| 8536 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 8537 | snd_hda_codec_write(codec, 0x03, 0, |
| 8538 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 8539 | } |
| 8540 | |
| 8541 | /* pcm configuration: identiacal with ALC880 */ |
| 8542 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 8543 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
| 8544 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 8545 | |
| 8546 | /* |
| 8547 | * BIOS auto configuration |
| 8548 | */ |
| 8549 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 8550 | { |
| 8551 | struct alc_spec *spec = codec->spec; |
| 8552 | int err; |
| 8553 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 8554 | |
| 8555 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 8556 | alc268_ignore); |
| 8557 | if (err < 0) |
| 8558 | return err; |
| 8559 | if (!spec->autocfg.line_outs) |
| 8560 | return 0; /* can't find valid BIOS pin config */ |
| 8561 | |
| 8562 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 8563 | if (err < 0) |
| 8564 | return err; |
| 8565 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 8566 | if (err < 0) |
| 8567 | return err; |
| 8568 | |
| 8569 | spec->multiout.max_channels = 2; |
| 8570 | |
| 8571 | /* digital only support output */ |
| 8572 | if (spec->autocfg.dig_out_pin) |
| 8573 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 8574 | |
| 8575 | if (spec->kctl_alloc) |
| 8576 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 8577 | |
| 8578 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 8579 | spec->num_mux_defs = 1; |
| 8580 | spec->input_mux = &spec->private_imux; |
| 8581 | |
| 8582 | return 1; |
| 8583 | } |
| 8584 | |
| 8585 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 8586 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 8587 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 8588 | |
| 8589 | /* init callback for auto-configuration model -- overriding the default init */ |
| 8590 | static void alc268_auto_init(struct hda_codec *codec) |
| 8591 | { |
| 8592 | alc268_auto_init_multi_out(codec); |
| 8593 | alc268_auto_init_hp_out(codec); |
| 8594 | alc268_auto_init_mono_speaker_out(codec); |
| 8595 | alc268_auto_init_analog_input(codec); |
| 8596 | } |
| 8597 | |
| 8598 | /* |
| 8599 | * configuration and preset |
| 8600 | */ |
| 8601 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 8602 | [ALC268_3ST] = "3stack", |
| 8603 | [ALC268_AUTO] = "auto", |
| 8604 | }; |
| 8605 | |
| 8606 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
| 8607 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
| 8608 | {} |
| 8609 | }; |
| 8610 | |
| 8611 | static struct alc_config_preset alc268_presets[] = { |
| 8612 | [ALC268_3ST] = { |
| 8613 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 8614 | .init_verbs = { alc268_base_init_verbs }, |
| 8615 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 8616 | .dac_nids = alc268_dac_nids, |
| 8617 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 8618 | .adc_nids = alc268_adc_nids_alt, |
| 8619 | .hp_nid = 0x03, |
| 8620 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 8621 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 8622 | .channel_mode = alc268_modes, |
| 8623 | .input_mux = &alc268_capture_source, |
| 8624 | }, |
| 8625 | }; |
| 8626 | |
| 8627 | static int patch_alc268(struct hda_codec *codec) |
| 8628 | { |
| 8629 | struct alc_spec *spec; |
| 8630 | int board_config; |
| 8631 | int err; |
| 8632 | |
| 8633 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 8634 | if (spec == NULL) |
| 8635 | return -ENOMEM; |
| 8636 | |
| 8637 | codec->spec = spec; |
| 8638 | |
| 8639 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 8640 | alc268_models, |
| 8641 | alc268_cfg_tbl); |
| 8642 | |
| 8643 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 8644 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 8645 | "trying auto-probe from BIOS...\n"); |
| 8646 | board_config = ALC268_AUTO; |
| 8647 | } |
| 8648 | |
| 8649 | if (board_config == ALC268_AUTO) { |
| 8650 | /* automatic parse from the BIOS config */ |
| 8651 | err = alc268_parse_auto_config(codec); |
| 8652 | if (err < 0) { |
| 8653 | alc_free(codec); |
| 8654 | return err; |
| 8655 | } else if (!err) { |
| 8656 | printk(KERN_INFO |
| 8657 | "hda_codec: Cannot set up configuration " |
| 8658 | "from BIOS. Using base mode...\n"); |
| 8659 | board_config = ALC268_3ST; |
| 8660 | } |
| 8661 | } |
| 8662 | |
| 8663 | if (board_config != ALC268_AUTO) |
| 8664 | setup_preset(spec, &alc268_presets[board_config]); |
| 8665 | |
| 8666 | spec->stream_name_analog = "ALC268 Analog"; |
| 8667 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 8668 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
| 8669 | |
| 8670 | spec->stream_name_digital = "ALC268 Digital"; |
| 8671 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 8672 | |
| 8673 | if (board_config == ALC268_AUTO) { |
| 8674 | if (!spec->adc_nids && spec->input_mux) { |
| 8675 | /* check whether NID 0x07 is valid */ |
| 8676 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 8677 | |
| 8678 | /* get type */ |
| 8679 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 8680 | if (wcap != AC_WID_AUD_IN) { |
| 8681 | spec->adc_nids = alc268_adc_nids_alt; |
| 8682 | spec->num_adc_nids = |
| 8683 | ARRAY_SIZE(alc268_adc_nids_alt); |
| 8684 | spec->mixers[spec->num_mixers] = |
| 8685 | alc268_capture_alt_mixer; |
| 8686 | spec->num_mixers++; |
| 8687 | } else { |
| 8688 | spec->adc_nids = alc268_adc_nids; |
| 8689 | spec->num_adc_nids = |
| 8690 | ARRAY_SIZE(alc268_adc_nids); |
| 8691 | spec->mixers[spec->num_mixers] = |
| 8692 | alc268_capture_mixer; |
| 8693 | spec->num_mixers++; |
| 8694 | } |
| 8695 | } |
| 8696 | } |
| 8697 | codec->patch_ops = alc_patch_ops; |
| 8698 | if (board_config == ALC268_AUTO) |
| 8699 | spec->init_hook = alc268_auto_init; |
| 8700 | |
| 8701 | return 0; |
| 8702 | } |
| 8703 | |
| 8704 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8705 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 8706 | */ |
| 8707 | |
| 8708 | /* |
| 8709 | * set the path ways for 2 channel output |
| 8710 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 8711 | */ |
| 8712 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 8713 | /* set pin widget 1Ah (line in) for input */ |
| 8714 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8715 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 8716 | * the vref |
| 8717 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8718 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8719 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8720 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 8721 | #if 0 |
| 8722 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8723 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 8724 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8725 | { } /* end */ |
| 8726 | }; |
| 8727 | /* |
| 8728 | * 6ch mode |
| 8729 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 8730 | */ |
| 8731 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 8732 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 8733 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8734 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 8735 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8736 | |
| 8737 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8738 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8739 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8740 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 8741 | #if 0 |
| 8742 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8743 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 8744 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8745 | { } /* end */ |
| 8746 | }; |
| 8747 | |
| 8748 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 8749 | { 2, alc861_threestack_ch2_init }, |
| 8750 | { 6, alc861_threestack_ch6_init }, |
| 8751 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8752 | /* Set mic1 as input and unmute the mixer */ |
| 8753 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 8754 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8755 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8756 | { } /* end */ |
| 8757 | }; |
| 8758 | /* Set mic1 as output and mute mixer */ |
| 8759 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 8760 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8761 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8762 | { } /* end */ |
| 8763 | }; |
| 8764 | |
| 8765 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 8766 | { 2, alc861_uniwill_m31_ch2_init }, |
| 8767 | { 4, alc861_uniwill_m31_ch4_init }, |
| 8768 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8769 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8770 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 8771 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 8772 | /* set pin widget 1Ah (line in) for input */ |
| 8773 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8774 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 8775 | * the vref |
| 8776 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8777 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8778 | |
| 8779 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 8780 | #if 0 |
| 8781 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8782 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 8783 | #endif |
| 8784 | { } /* end */ |
| 8785 | }; |
| 8786 | /* Set mic1 nad line-in as output and mute mixer */ |
| 8787 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 8788 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 8789 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8790 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 8791 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 8792 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8793 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 8794 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8795 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8796 | |
| 8797 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 8798 | #if 0 |
| 8799 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8800 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 8801 | #endif |
| 8802 | { } /* end */ |
| 8803 | }; |
| 8804 | |
| 8805 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 8806 | { 2, alc861_asus_ch2_init }, |
| 8807 | { 6, alc861_asus_ch6_init }, |
| 8808 | }; |
| 8809 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8810 | /* patch-ALC861 */ |
| 8811 | |
| 8812 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 8813 | /* output mixer control */ |
| 8814 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8815 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8816 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8817 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8818 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 8819 | |
| 8820 | /*Input mixer control */ |
| 8821 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8822 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8823 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8824 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8825 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8826 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8828 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8829 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8830 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8831 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8832 | /* Capture mixer control */ |
| 8833 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8834 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8835 | { |
| 8836 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8837 | .name = "Capture Source", |
| 8838 | .count = 1, |
| 8839 | .info = alc_mux_enum_info, |
| 8840 | .get = alc_mux_enum_get, |
| 8841 | .put = alc_mux_enum_put, |
| 8842 | }, |
| 8843 | { } /* end */ |
| 8844 | }; |
| 8845 | |
| 8846 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 8847 | /* output mixer control */ |
| 8848 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8849 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8850 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8851 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8852 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 8853 | |
| 8854 | /* Input mixer control */ |
| 8855 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8856 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8857 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8858 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8859 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8860 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8861 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8862 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8863 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8864 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8865 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8866 | /* Capture mixer control */ |
| 8867 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8868 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8869 | { |
| 8870 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8871 | .name = "Capture Source", |
| 8872 | .count = 1, |
| 8873 | .info = alc_mux_enum_info, |
| 8874 | .get = alc_mux_enum_get, |
| 8875 | .put = alc_mux_enum_put, |
| 8876 | }, |
| 8877 | { |
| 8878 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8879 | .name = "Channel Mode", |
| 8880 | .info = alc_ch_mode_info, |
| 8881 | .get = alc_ch_mode_get, |
| 8882 | .put = alc_ch_mode_put, |
| 8883 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 8884 | }, |
| 8885 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8886 | }; |
| 8887 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8888 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8889 | /* output mixer control */ |
| 8890 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8891 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8893 | |
| 8894 | /*Capture mixer control */ |
| 8895 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8896 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8897 | { |
| 8898 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8899 | .name = "Capture Source", |
| 8900 | .count = 1, |
| 8901 | .info = alc_mux_enum_info, |
| 8902 | .get = alc_mux_enum_get, |
| 8903 | .put = alc_mux_enum_put, |
| 8904 | }, |
| 8905 | |
| 8906 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8907 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8908 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8909 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 8910 | /* output mixer control */ |
| 8911 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8912 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8913 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8914 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8915 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 8916 | |
| 8917 | /* Input mixer control */ |
| 8918 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8919 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8920 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8921 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8922 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8923 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8926 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8927 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8928 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8929 | /* Capture mixer control */ |
| 8930 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8931 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8932 | { |
| 8933 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8934 | .name = "Capture Source", |
| 8935 | .count = 1, |
| 8936 | .info = alc_mux_enum_info, |
| 8937 | .get = alc_mux_enum_get, |
| 8938 | .put = alc_mux_enum_put, |
| 8939 | }, |
| 8940 | { |
| 8941 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8942 | .name = "Channel Mode", |
| 8943 | .info = alc_ch_mode_info, |
| 8944 | .get = alc_ch_mode_get, |
| 8945 | .put = alc_ch_mode_put, |
| 8946 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 8947 | }, |
| 8948 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8949 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8950 | |
| 8951 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 8952 | /* output mixer control */ |
| 8953 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8954 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8955 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8956 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8957 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 8958 | |
| 8959 | /* Input mixer control */ |
| 8960 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8961 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8962 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8963 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8964 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8965 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8966 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8967 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8968 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8969 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 8970 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8971 | /* Capture mixer control */ |
| 8972 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8973 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8974 | { |
| 8975 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8976 | .name = "Capture Source", |
| 8977 | .count = 1, |
| 8978 | .info = alc_mux_enum_info, |
| 8979 | .get = alc_mux_enum_get, |
| 8980 | .put = alc_mux_enum_put, |
| 8981 | }, |
| 8982 | { |
| 8983 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8984 | .name = "Channel Mode", |
| 8985 | .info = alc_ch_mode_info, |
| 8986 | .get = alc_ch_mode_get, |
| 8987 | .put = alc_ch_mode_put, |
| 8988 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 8989 | }, |
| 8990 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8991 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8992 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8993 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8994 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8995 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8996 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8997 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8998 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8999 | { } |
| 9000 | }; |
| 9001 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9002 | /* |
| 9003 | * generic initialization of ADC, input mixers and output mixers |
| 9004 | */ |
| 9005 | static struct hda_verb alc861_base_init_verbs[] = { |
| 9006 | /* |
| 9007 | * Unmute ADC0 and set the default input to mic-in |
| 9008 | */ |
| 9009 | /* port-A for surround (rear panel) */ |
| 9010 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9011 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9012 | /* port-B for mic-in (rear panel) with vref */ |
| 9013 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9014 | /* port-C for line-in (rear panel) */ |
| 9015 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9016 | /* port-D for Front */ |
| 9017 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9018 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9019 | /* port-E for HP out (front panel) */ |
| 9020 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 9021 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9022 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9023 | /* port-F for mic-in (front panel) with vref */ |
| 9024 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9025 | /* port-G for CLFE (rear panel) */ |
| 9026 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9027 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9028 | /* port-H for side (rear panel) */ |
| 9029 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9030 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9031 | /* CD-in */ |
| 9032 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9033 | /* route front mic to ADC1*/ |
| 9034 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9035 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9036 | |
| 9037 | /* Unmute DAC0~3 & spdif out*/ |
| 9038 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9039 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9040 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9041 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9042 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9043 | |
| 9044 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9045 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9046 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9047 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9048 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9049 | |
| 9050 | /* Unmute Stereo Mixer 15 */ |
| 9051 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9052 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9053 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9054 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9055 | |
| 9056 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9057 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9058 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9059 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9060 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9061 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9062 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9063 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9064 | /* hp used DAC 3 (Front) */ |
| 9065 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9066 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9067 | |
| 9068 | { } |
| 9069 | }; |
| 9070 | |
| 9071 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 9072 | /* |
| 9073 | * Unmute ADC0 and set the default input to mic-in |
| 9074 | */ |
| 9075 | /* port-A for surround (rear panel) */ |
| 9076 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9077 | /* port-B for mic-in (rear panel) with vref */ |
| 9078 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9079 | /* port-C for line-in (rear panel) */ |
| 9080 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9081 | /* port-D for Front */ |
| 9082 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9083 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9084 | /* port-E for HP out (front panel) */ |
| 9085 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 9086 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9087 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9088 | /* port-F for mic-in (front panel) with vref */ |
| 9089 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9090 | /* port-G for CLFE (rear panel) */ |
| 9091 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9092 | /* port-H for side (rear panel) */ |
| 9093 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9094 | /* CD-in */ |
| 9095 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9096 | /* route front mic to ADC1*/ |
| 9097 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9098 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9099 | /* Unmute DAC0~3 & spdif out*/ |
| 9100 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9101 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9102 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9103 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9104 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9105 | |
| 9106 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9107 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9108 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9109 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9110 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9111 | |
| 9112 | /* Unmute Stereo Mixer 15 */ |
| 9113 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9114 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9115 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9116 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9117 | |
| 9118 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9119 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9120 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9121 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9122 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9123 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9124 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9125 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9126 | /* hp used DAC 3 (Front) */ |
| 9127 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9128 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9129 | { } |
| 9130 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9131 | |
| 9132 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 9133 | /* |
| 9134 | * Unmute ADC0 and set the default input to mic-in |
| 9135 | */ |
| 9136 | /* port-A for surround (rear panel) */ |
| 9137 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9138 | /* port-B for mic-in (rear panel) with vref */ |
| 9139 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9140 | /* port-C for line-in (rear panel) */ |
| 9141 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9142 | /* port-D for Front */ |
| 9143 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9144 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9145 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9146 | /* this has to be set to VREF80 */ |
| 9147 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9148 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9149 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9150 | /* port-F for mic-in (front panel) with vref */ |
| 9151 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9152 | /* port-G for CLFE (rear panel) */ |
| 9153 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9154 | /* port-H for side (rear panel) */ |
| 9155 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9156 | /* CD-in */ |
| 9157 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9158 | /* route front mic to ADC1*/ |
| 9159 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9160 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9161 | /* Unmute DAC0~3 & spdif out*/ |
| 9162 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9163 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9164 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9165 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9166 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9167 | |
| 9168 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9169 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9170 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9171 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9172 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9173 | |
| 9174 | /* Unmute Stereo Mixer 15 */ |
| 9175 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9176 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9177 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9178 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9179 | |
| 9180 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9181 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9182 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9183 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9184 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9185 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9186 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9187 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9188 | /* hp used DAC 3 (Front) */ |
| 9189 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9190 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9191 | { } |
| 9192 | }; |
| 9193 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9194 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 9195 | /* |
| 9196 | * Unmute ADC0 and set the default input to mic-in |
| 9197 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9198 | /* port-A for surround (rear panel) |
| 9199 | * according to codec#0 this is the HP jack |
| 9200 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9201 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 9202 | /* route front PCM to HP */ |
| 9203 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9204 | /* port-B for mic-in (rear panel) with vref */ |
| 9205 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9206 | /* port-C for line-in (rear panel) */ |
| 9207 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9208 | /* port-D for Front */ |
| 9209 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9210 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9211 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9212 | /* this has to be set to VREF80 */ |
| 9213 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9214 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9215 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9216 | /* port-F for mic-in (front panel) with vref */ |
| 9217 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9218 | /* port-G for CLFE (rear panel) */ |
| 9219 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9220 | /* port-H for side (rear panel) */ |
| 9221 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9222 | /* CD-in */ |
| 9223 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9224 | /* route front mic to ADC1*/ |
| 9225 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9226 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9227 | /* Unmute DAC0~3 & spdif out*/ |
| 9228 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9229 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9230 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9231 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9232 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9233 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9234 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9235 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9236 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9237 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9238 | |
| 9239 | /* Unmute Stereo Mixer 15 */ |
| 9240 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9241 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9242 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9243 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9244 | |
| 9245 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9246 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9247 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9248 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9249 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9250 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9251 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9252 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9253 | /* hp used DAC 3 (Front) */ |
| 9254 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9255 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9256 | { } |
| 9257 | }; |
| 9258 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9259 | /* additional init verbs for ASUS laptops */ |
| 9260 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 9261 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 9262 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 9263 | { } |
| 9264 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9266 | /* |
| 9267 | * generic initialization of ADC, input mixers and output mixers |
| 9268 | */ |
| 9269 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 9270 | /* |
| 9271 | * Unmute ADC0 and set the default input to mic-in |
| 9272 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9273 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9274 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9275 | |
| 9276 | /* Unmute DAC0~3 & spdif out*/ |
| 9277 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9278 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9279 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9280 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9282 | |
| 9283 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9284 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9285 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9286 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9287 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9288 | |
| 9289 | /* Unmute Stereo Mixer 15 */ |
| 9290 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9291 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9292 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9293 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 9294 | |
| 9295 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9296 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9297 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9298 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9299 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9300 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9301 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9302 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9303 | |
| 9304 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9305 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9306 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9307 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9308 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9309 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9310 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9311 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9312 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9313 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9314 | |
| 9315 | { } |
| 9316 | }; |
| 9317 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9318 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 9319 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9320 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9321 | { } |
| 9322 | }; |
| 9323 | |
| 9324 | /* toggle speaker-output according to the hp-jack state */ |
| 9325 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 9326 | { |
| 9327 | unsigned int present; |
| 9328 | |
| 9329 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 9330 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9331 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, |
| 9332 | 0x80, present ? 0x80 : 0); |
| 9333 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, |
| 9334 | 0x80, present ? 0x80 : 0); |
| 9335 | snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3, |
| 9336 | 0x80, present ? 0 : 0x80); |
| 9337 | snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3, |
| 9338 | 0x80, present ? 0 : 0x80); |
| 9339 | } |
| 9340 | |
| 9341 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 9342 | unsigned int res) |
| 9343 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9344 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9345 | alc861_toshiba_automute(codec); |
| 9346 | } |
| 9347 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9348 | /* pcm configuration: identiacal with ALC880 */ |
| 9349 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 9350 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 9351 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 9352 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 9353 | |
| 9354 | |
| 9355 | #define ALC861_DIGOUT_NID 0x07 |
| 9356 | |
| 9357 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 9358 | { 8, NULL } |
| 9359 | }; |
| 9360 | |
| 9361 | static hda_nid_t alc861_dac_nids[4] = { |
| 9362 | /* front, surround, clfe, side */ |
| 9363 | 0x03, 0x06, 0x05, 0x04 |
| 9364 | }; |
| 9365 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9366 | static hda_nid_t alc660_dac_nids[3] = { |
| 9367 | /* front, clfe, surround */ |
| 9368 | 0x03, 0x05, 0x06 |
| 9369 | }; |
| 9370 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9371 | static hda_nid_t alc861_adc_nids[1] = { |
| 9372 | /* ADC0-2 */ |
| 9373 | 0x08, |
| 9374 | }; |
| 9375 | |
| 9376 | static struct hda_input_mux alc861_capture_source = { |
| 9377 | .num_items = 5, |
| 9378 | .items = { |
| 9379 | { "Mic", 0x0 }, |
| 9380 | { "Front Mic", 0x3 }, |
| 9381 | { "Line", 0x1 }, |
| 9382 | { "CD", 0x4 }, |
| 9383 | { "Mixer", 0x5 }, |
| 9384 | }, |
| 9385 | }; |
| 9386 | |
| 9387 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9388 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 9389 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9390 | { |
| 9391 | int i; |
| 9392 | hda_nid_t nid; |
| 9393 | |
| 9394 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9395 | for (i = 0; i < cfg->line_outs; i++) { |
| 9396 | nid = cfg->line_out_pins[i]; |
| 9397 | if (nid) { |
| 9398 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 9399 | continue; |
| 9400 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 9401 | } |
| 9402 | } |
| 9403 | spec->multiout.num_dacs = cfg->line_outs; |
| 9404 | return 0; |
| 9405 | } |
| 9406 | |
| 9407 | /* add playback controls from the parsed DAC table */ |
| 9408 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9409 | const struct auto_pin_cfg *cfg) |
| 9410 | { |
| 9411 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9412 | static const char *chname[4] = { |
| 9413 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 9414 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9415 | hda_nid_t nid; |
| 9416 | int i, idx, err; |
| 9417 | |
| 9418 | for (i = 0; i < cfg->line_outs; i++) { |
| 9419 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9420 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9421 | continue; |
| 9422 | if (nid == 0x05) { |
| 9423 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9424 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9425 | "Center Playback Switch", |
| 9426 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 9427 | HDA_OUTPUT)); |
| 9428 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9429 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9430 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9431 | "LFE Playback Switch", |
| 9432 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9433 | HDA_OUTPUT)); |
| 9434 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9435 | return err; |
| 9436 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9437 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 9438 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9439 | if (nid == alc861_dac_nids[idx]) |
| 9440 | break; |
| 9441 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9442 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 9443 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9444 | HDA_OUTPUT)); |
| 9445 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9446 | return err; |
| 9447 | } |
| 9448 | } |
| 9449 | return 0; |
| 9450 | } |
| 9451 | |
| 9452 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 9453 | { |
| 9454 | int err; |
| 9455 | hda_nid_t nid; |
| 9456 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9457 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9458 | return 0; |
| 9459 | |
| 9460 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 9461 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9462 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9463 | "Headphone Playback Switch", |
| 9464 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9465 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9466 | return err; |
| 9467 | spec->multiout.hp_nid = nid; |
| 9468 | } |
| 9469 | return 0; |
| 9470 | } |
| 9471 | |
| 9472 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9473 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9474 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9475 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9476 | struct hda_input_mux *imux = &spec->private_imux; |
| 9477 | int i, err, idx, idx1; |
| 9478 | |
| 9479 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9480 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9481 | case 0x0c: |
| 9482 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9483 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9484 | break; |
| 9485 | case 0x0f: |
| 9486 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9487 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9488 | break; |
| 9489 | case 0x0d: |
| 9490 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9491 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9492 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9493 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9494 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9495 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9496 | break; |
| 9497 | case 0x11: |
| 9498 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9499 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9500 | break; |
| 9501 | default: |
| 9502 | continue; |
| 9503 | } |
| 9504 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9505 | err = new_analog_input(spec, cfg->input_pins[i], |
| 9506 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9507 | if (err < 0) |
| 9508 | return err; |
| 9509 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9510 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9511 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9512 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9513 | } |
| 9514 | return 0; |
| 9515 | } |
| 9516 | |
| 9517 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 9518 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 9519 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 9520 | |
| 9521 | { |
| 9522 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9523 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9524 | * So call somewhat different.. |
| 9525 | *FIXME: the controls appear in the "playback" view! |
| 9526 | */ |
| 9527 | /* .name = "Capture Source", */ |
| 9528 | .name = "Input Source", |
| 9529 | .count = 1, |
| 9530 | .info = alc_mux_enum_info, |
| 9531 | .get = alc_mux_enum_get, |
| 9532 | .put = alc_mux_enum_put, |
| 9533 | }, |
| 9534 | { } /* end */ |
| 9535 | }; |
| 9536 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9537 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9538 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9539 | int pin_type, int dac_idx) |
| 9540 | { |
| 9541 | /* set as output */ |
| 9542 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9543 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9544 | pin_type); |
| 9545 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 9546 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9547 | |
| 9548 | } |
| 9549 | |
| 9550 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 9551 | { |
| 9552 | struct alc_spec *spec = codec->spec; |
| 9553 | int i; |
| 9554 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9555 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9556 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 9557 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9558 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9559 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9560 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9561 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9562 | } |
| 9563 | } |
| 9564 | |
| 9565 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 9566 | { |
| 9567 | struct alc_spec *spec = codec->spec; |
| 9568 | hda_nid_t pin; |
| 9569 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9570 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9571 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9572 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 9573 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9574 | } |
| 9575 | |
| 9576 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 9577 | { |
| 9578 | struct alc_spec *spec = codec->spec; |
| 9579 | int i; |
| 9580 | |
| 9581 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9582 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9583 | if (nid >= 0x0c && nid <= 0x11) { |
| 9584 | snd_hda_codec_write(codec, nid, 0, |
| 9585 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9586 | i <= AUTO_PIN_FRONT_MIC ? |
| 9587 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9588 | } |
| 9589 | } |
| 9590 | } |
| 9591 | |
| 9592 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9593 | /* return 1 if successful, 0 if the proper config is not found, |
| 9594 | * or a negative error code |
| 9595 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9596 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 9597 | { |
| 9598 | struct alc_spec *spec = codec->spec; |
| 9599 | int err; |
| 9600 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 9601 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9602 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9603 | alc861_ignore); |
| 9604 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9605 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9606 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9607 | return 0; /* can't find valid BIOS pin config */ |
| 9608 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9609 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9610 | if (err < 0) |
| 9611 | return err; |
| 9612 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9613 | if (err < 0) |
| 9614 | return err; |
| 9615 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 9616 | if (err < 0) |
| 9617 | return err; |
| 9618 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9619 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9620 | return err; |
| 9621 | |
| 9622 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9623 | |
| 9624 | if (spec->autocfg.dig_out_pin) |
| 9625 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 9626 | |
| 9627 | if (spec->kctl_alloc) |
| 9628 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9629 | |
| 9630 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 9631 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9632 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9633 | spec->input_mux = &spec->private_imux; |
| 9634 | |
| 9635 | spec->adc_nids = alc861_adc_nids; |
| 9636 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 9637 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 9638 | spec->num_mixers++; |
| 9639 | |
| 9640 | return 1; |
| 9641 | } |
| 9642 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9643 | /* additional initialization for auto-configuration model */ |
| 9644 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9645 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9646 | alc861_auto_init_multi_out(codec); |
| 9647 | alc861_auto_init_hp_out(codec); |
| 9648 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9649 | } |
| 9650 | |
| 9651 | |
| 9652 | /* |
| 9653 | * configuration and preset |
| 9654 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9655 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 9656 | [ALC861_3ST] = "3stack", |
| 9657 | [ALC660_3ST] = "3stack-660", |
| 9658 | [ALC861_3ST_DIG] = "3stack-dig", |
| 9659 | [ALC861_6ST_DIG] = "6stack-dig", |
| 9660 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 9661 | [ALC861_TOSHIBA] = "toshiba", |
| 9662 | [ALC861_ASUS] = "asus", |
| 9663 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 9664 | [ALC861_AUTO] = "auto", |
| 9665 | }; |
| 9666 | |
| 9667 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 9668 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9669 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 9670 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f223a9f | 2007-04-25 13:38:31 +0200 | [diff] [blame] | 9671 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9672 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9673 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9674 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 9675 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 9676 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 9677 | * Any other models that need this preset? |
| 9678 | */ |
| 9679 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9680 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
Dave Jones | 35739bb | 2007-06-06 14:48:52 +0200 | [diff] [blame] | 9681 | SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), |
Takashi Iwai | 4147dab | 2007-01-31 10:35:19 +0100 | [diff] [blame] | 9682 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 9683 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9684 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 9685 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 9686 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9687 | {} |
| 9688 | }; |
| 9689 | |
| 9690 | static struct alc_config_preset alc861_presets[] = { |
| 9691 | [ALC861_3ST] = { |
| 9692 | .mixers = { alc861_3ST_mixer }, |
| 9693 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9694 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9695 | .dac_nids = alc861_dac_nids, |
| 9696 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9697 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9698 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9699 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9700 | .adc_nids = alc861_adc_nids, |
| 9701 | .input_mux = &alc861_capture_source, |
| 9702 | }, |
| 9703 | [ALC861_3ST_DIG] = { |
| 9704 | .mixers = { alc861_base_mixer }, |
| 9705 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9706 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9707 | .dac_nids = alc861_dac_nids, |
| 9708 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9709 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9710 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9711 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9712 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9713 | .adc_nids = alc861_adc_nids, |
| 9714 | .input_mux = &alc861_capture_source, |
| 9715 | }, |
| 9716 | [ALC861_6ST_DIG] = { |
| 9717 | .mixers = { alc861_base_mixer }, |
| 9718 | .init_verbs = { alc861_base_init_verbs }, |
| 9719 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9720 | .dac_nids = alc861_dac_nids, |
| 9721 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9722 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 9723 | .channel_mode = alc861_8ch_modes, |
| 9724 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9725 | .adc_nids = alc861_adc_nids, |
| 9726 | .input_mux = &alc861_capture_source, |
| 9727 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9728 | [ALC660_3ST] = { |
| 9729 | .mixers = { alc861_3ST_mixer }, |
| 9730 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9731 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 9732 | .dac_nids = alc660_dac_nids, |
| 9733 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9734 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9735 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9736 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9737 | .adc_nids = alc861_adc_nids, |
| 9738 | .input_mux = &alc861_capture_source, |
| 9739 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9740 | [ALC861_UNIWILL_M31] = { |
| 9741 | .mixers = { alc861_uniwill_m31_mixer }, |
| 9742 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 9743 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9744 | .dac_nids = alc861_dac_nids, |
| 9745 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9746 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 9747 | .channel_mode = alc861_uniwill_m31_modes, |
| 9748 | .need_dac_fix = 1, |
| 9749 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9750 | .adc_nids = alc861_adc_nids, |
| 9751 | .input_mux = &alc861_capture_source, |
| 9752 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9753 | [ALC861_TOSHIBA] = { |
| 9754 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9755 | .init_verbs = { alc861_base_init_verbs, |
| 9756 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9757 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9758 | .dac_nids = alc861_dac_nids, |
| 9759 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9760 | .channel_mode = alc883_3ST_2ch_modes, |
| 9761 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9762 | .adc_nids = alc861_adc_nids, |
| 9763 | .input_mux = &alc861_capture_source, |
| 9764 | .unsol_event = alc861_toshiba_unsol_event, |
| 9765 | .init_hook = alc861_toshiba_automute, |
| 9766 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9767 | [ALC861_ASUS] = { |
| 9768 | .mixers = { alc861_asus_mixer }, |
| 9769 | .init_verbs = { alc861_asus_init_verbs }, |
| 9770 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9771 | .dac_nids = alc861_dac_nids, |
| 9772 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9773 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 9774 | .channel_mode = alc861_asus_modes, |
| 9775 | .need_dac_fix = 1, |
| 9776 | .hp_nid = 0x06, |
| 9777 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9778 | .adc_nids = alc861_adc_nids, |
| 9779 | .input_mux = &alc861_capture_source, |
| 9780 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9781 | [ALC861_ASUS_LAPTOP] = { |
| 9782 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 9783 | .init_verbs = { alc861_asus_init_verbs, |
| 9784 | alc861_asus_laptop_init_verbs }, |
| 9785 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9786 | .dac_nids = alc861_dac_nids, |
| 9787 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9788 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9789 | .channel_mode = alc883_3ST_2ch_modes, |
| 9790 | .need_dac_fix = 1, |
| 9791 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9792 | .adc_nids = alc861_adc_nids, |
| 9793 | .input_mux = &alc861_capture_source, |
| 9794 | }, |
| 9795 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9796 | |
| 9797 | |
| 9798 | static int patch_alc861(struct hda_codec *codec) |
| 9799 | { |
| 9800 | struct alc_spec *spec; |
| 9801 | int board_config; |
| 9802 | int err; |
| 9803 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9804 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9805 | if (spec == NULL) |
| 9806 | return -ENOMEM; |
| 9807 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9808 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9809 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9810 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 9811 | alc861_models, |
| 9812 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9813 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9814 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9815 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 9816 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9817 | board_config = ALC861_AUTO; |
| 9818 | } |
| 9819 | |
| 9820 | if (board_config == ALC861_AUTO) { |
| 9821 | /* automatic parse from the BIOS config */ |
| 9822 | err = alc861_parse_auto_config(codec); |
| 9823 | if (err < 0) { |
| 9824 | alc_free(codec); |
| 9825 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9826 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9827 | printk(KERN_INFO |
| 9828 | "hda_codec: Cannot set up configuration " |
| 9829 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9830 | board_config = ALC861_3ST_DIG; |
| 9831 | } |
| 9832 | } |
| 9833 | |
| 9834 | if (board_config != ALC861_AUTO) |
| 9835 | setup_preset(spec, &alc861_presets[board_config]); |
| 9836 | |
| 9837 | spec->stream_name_analog = "ALC861 Analog"; |
| 9838 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 9839 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 9840 | |
| 9841 | spec->stream_name_digital = "ALC861 Digital"; |
| 9842 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 9843 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 9844 | |
| 9845 | codec->patch_ops = alc_patch_ops; |
| 9846 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9847 | spec->init_hook = alc861_auto_init; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9848 | |
| 9849 | return 0; |
| 9850 | } |
| 9851 | |
| 9852 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9853 | * ALC861-VD support |
| 9854 | * |
| 9855 | * Based on ALC882 |
| 9856 | * |
| 9857 | * In addition, an independent DAC |
| 9858 | */ |
| 9859 | #define ALC861VD_DIGOUT_NID 0x06 |
| 9860 | |
| 9861 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 9862 | /* front, surr, clfe, side surr */ |
| 9863 | 0x02, 0x03, 0x04, 0x05 |
| 9864 | }; |
| 9865 | |
| 9866 | /* dac_nids for ALC660vd are in a different order - according to |
| 9867 | * Realtek's driver. |
| 9868 | * This should probably tesult in a different mixer for 6stack models |
| 9869 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 9870 | * - and it is the same as in 861vd. |
| 9871 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 9872 | */ |
| 9873 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 9874 | /* front, rear, clfe, rear_surr */ |
| 9875 | 0x02, 0x04, 0x03 |
| 9876 | }; |
| 9877 | |
| 9878 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 9879 | /* ADC0 */ |
| 9880 | 0x09, |
| 9881 | }; |
| 9882 | |
| 9883 | /* input MUX */ |
| 9884 | /* FIXME: should be a matrix-type input source selection */ |
| 9885 | static struct hda_input_mux alc861vd_capture_source = { |
| 9886 | .num_items = 4, |
| 9887 | .items = { |
| 9888 | { "Mic", 0x0 }, |
| 9889 | { "Front Mic", 0x1 }, |
| 9890 | { "Line", 0x2 }, |
| 9891 | { "CD", 0x4 }, |
| 9892 | }, |
| 9893 | }; |
| 9894 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9895 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 9896 | .num_items = 3, |
| 9897 | .items = { |
| 9898 | { "Front Mic", 0x0 }, |
| 9899 | { "ATAPI Mic", 0x1 }, |
| 9900 | { "Line In", 0x5 }, |
| 9901 | }, |
| 9902 | }; |
| 9903 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9904 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 9905 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 9906 | |
| 9907 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9908 | struct snd_ctl_elem_value *ucontrol) |
| 9909 | { |
| 9910 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9911 | struct alc_spec *spec = codec->spec; |
| 9912 | const struct hda_input_mux *imux = spec->input_mux; |
| 9913 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9914 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 9915 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 9916 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 9917 | unsigned int i, idx; |
| 9918 | |
| 9919 | idx = ucontrol->value.enumerated.item[0]; |
| 9920 | if (idx >= imux->num_items) |
| 9921 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 9922 | if (*cur_val == idx) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9923 | return 0; |
| 9924 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 9925 | unsigned int v = (i == idx) ? 0x00 : 0x80; |
| 9926 | snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, |
| 9927 | imux->items[i].index, 0x80, v); |
| 9928 | snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, |
| 9929 | imux->items[i].index, 0x80, v); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9930 | } |
| 9931 | *cur_val = idx; |
| 9932 | return 1; |
| 9933 | } |
| 9934 | |
| 9935 | /* |
| 9936 | * 2ch mode |
| 9937 | */ |
| 9938 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 9939 | { 2, NULL } |
| 9940 | }; |
| 9941 | |
| 9942 | /* |
| 9943 | * 6ch mode |
| 9944 | */ |
| 9945 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 9946 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9947 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9948 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9949 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9950 | { } /* end */ |
| 9951 | }; |
| 9952 | |
| 9953 | /* |
| 9954 | * 8ch mode |
| 9955 | */ |
| 9956 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 9957 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9958 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9959 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9960 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9961 | { } /* end */ |
| 9962 | }; |
| 9963 | |
| 9964 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 9965 | { 6, alc861vd_6stack_ch6_init }, |
| 9966 | { 8, alc861vd_6stack_ch8_init }, |
| 9967 | }; |
| 9968 | |
| 9969 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 9970 | { |
| 9971 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9972 | .name = "Channel Mode", |
| 9973 | .info = alc_ch_mode_info, |
| 9974 | .get = alc_ch_mode_get, |
| 9975 | .put = alc_ch_mode_put, |
| 9976 | }, |
| 9977 | { } /* end */ |
| 9978 | }; |
| 9979 | |
| 9980 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 9981 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9982 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9983 | |
| 9984 | { |
| 9985 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9986 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9987 | * So call somewhat different.. |
| 9988 | *FIXME: the controls appear in the "playback" view! |
| 9989 | */ |
| 9990 | /* .name = "Capture Source", */ |
| 9991 | .name = "Input Source", |
| 9992 | .count = 1, |
| 9993 | .info = alc861vd_mux_enum_info, |
| 9994 | .get = alc861vd_mux_enum_get, |
| 9995 | .put = alc861vd_mux_enum_put, |
| 9996 | }, |
| 9997 | { } /* end */ |
| 9998 | }; |
| 9999 | |
| 10000 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 10001 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 10002 | */ |
| 10003 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 10004 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10005 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10006 | |
| 10007 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10008 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 10009 | |
| 10010 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 10011 | HDA_OUTPUT), |
| 10012 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 10013 | HDA_OUTPUT), |
| 10014 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10015 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 10016 | |
| 10017 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 10018 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10019 | |
| 10020 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10021 | |
| 10022 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10023 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10024 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10025 | |
| 10026 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10027 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10028 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10029 | |
| 10030 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10031 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10032 | |
| 10033 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10034 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10035 | |
| 10036 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10037 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10038 | |
| 10039 | { } /* end */ |
| 10040 | }; |
| 10041 | |
| 10042 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 10043 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10044 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10045 | |
| 10046 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10047 | |
| 10048 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10049 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10050 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10051 | |
| 10052 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10053 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10054 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10055 | |
| 10056 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10057 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10058 | |
| 10059 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10060 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10061 | |
| 10062 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10063 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10064 | |
| 10065 | { } /* end */ |
| 10066 | }; |
| 10067 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10068 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 10069 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10070 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 10071 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10072 | |
| 10073 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10074 | |
| 10075 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10076 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10077 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10078 | |
| 10079 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10080 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10081 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10082 | |
| 10083 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10084 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10085 | |
| 10086 | { } /* end */ |
| 10087 | }; |
| 10088 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10089 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 10090 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 10091 | */ |
| 10092 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 10093 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10094 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10095 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10096 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 10097 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10098 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10099 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10100 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10101 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10102 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10103 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10104 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10105 | { |
| 10106 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10107 | /* .name = "Capture Source", */ |
| 10108 | .name = "Input Source", |
| 10109 | .count = 1, |
| 10110 | .info = alc882_mux_enum_info, |
| 10111 | .get = alc882_mux_enum_get, |
| 10112 | .put = alc882_mux_enum_put, |
| 10113 | }, |
| 10114 | { } /* end */ |
| 10115 | }; |
| 10116 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10117 | /* |
| 10118 | * generic initialization of ADC, input mixers and output mixers |
| 10119 | */ |
| 10120 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 10121 | /* |
| 10122 | * Unmute ADC0 and set the default input to mic-in |
| 10123 | */ |
| 10124 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10126 | |
| 10127 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 10128 | * the analog-loopback mixer widget |
| 10129 | */ |
| 10130 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 10135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10136 | |
| 10137 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10138 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10139 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10140 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10141 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10142 | |
| 10143 | /* |
| 10144 | * Set up output mixers (0x02 - 0x05) |
| 10145 | */ |
| 10146 | /* set vol=0 to output mixers */ |
| 10147 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10148 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10149 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10150 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10151 | |
| 10152 | /* set up input amps for analog loopback */ |
| 10153 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10154 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10155 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10156 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10157 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10158 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10159 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10160 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10161 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10162 | |
| 10163 | { } |
| 10164 | }; |
| 10165 | |
| 10166 | /* |
| 10167 | * 3-stack pin configuration: |
| 10168 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 10169 | */ |
| 10170 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 10171 | /* |
| 10172 | * Set pin mode and muting |
| 10173 | */ |
| 10174 | /* set front pin widgets 0x14 for output */ |
| 10175 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10176 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10177 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10178 | |
| 10179 | /* Mic (rear) pin: input vref at 80% */ |
| 10180 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10181 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10182 | /* Front Mic pin: input vref at 80% */ |
| 10183 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10184 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10185 | /* Line In pin: input */ |
| 10186 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10187 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10188 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10189 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10190 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10191 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10192 | /* CD pin widget for input */ |
| 10193 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10194 | |
| 10195 | { } |
| 10196 | }; |
| 10197 | |
| 10198 | /* |
| 10199 | * 6-stack pin configuration: |
| 10200 | */ |
| 10201 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 10202 | /* |
| 10203 | * Set pin mode and muting |
| 10204 | */ |
| 10205 | /* set front pin widgets 0x14 for output */ |
| 10206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10207 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10208 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10209 | |
| 10210 | /* Rear Pin: output 1 (0x0d) */ |
| 10211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10212 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10213 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10214 | /* CLFE Pin: output 2 (0x0e) */ |
| 10215 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10216 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10217 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 10218 | /* Side Pin: output 3 (0x0f) */ |
| 10219 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10220 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10221 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 10222 | |
| 10223 | /* Mic (rear) pin: input vref at 80% */ |
| 10224 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10225 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10226 | /* Front Mic pin: input vref at 80% */ |
| 10227 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10228 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10229 | /* Line In pin: input */ |
| 10230 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10231 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10232 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10233 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10234 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10235 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10236 | /* CD pin widget for input */ |
| 10237 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10238 | |
| 10239 | { } |
| 10240 | }; |
| 10241 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10242 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 10243 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10244 | { } |
| 10245 | }; |
| 10246 | |
| 10247 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 10248 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10249 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10250 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10251 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10252 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10253 | {} |
| 10254 | }; |
| 10255 | |
| 10256 | /* toggle speaker-output according to the hp-jack state */ |
| 10257 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 10258 | { |
| 10259 | unsigned int present; |
| 10260 | unsigned char bits; |
| 10261 | |
| 10262 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 10263 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10264 | bits = present ? 0x80 : 0; |
| 10265 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10266 | 0x80, bits); |
| 10267 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10268 | 0x80, bits); |
| 10269 | } |
| 10270 | |
| 10271 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 10272 | { |
| 10273 | unsigned int present; |
| 10274 | unsigned char bits; |
| 10275 | |
| 10276 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10277 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10278 | bits = present ? 0x80 : 0; |
| 10279 | snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, |
| 10280 | 0x80, bits); |
| 10281 | snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1, |
| 10282 | 0x80, bits); |
| 10283 | } |
| 10284 | |
| 10285 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 10286 | { |
| 10287 | alc861vd_lenovo_hp_automute(codec); |
| 10288 | alc861vd_lenovo_mic_automute(codec); |
| 10289 | } |
| 10290 | |
| 10291 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 10292 | unsigned int res) |
| 10293 | { |
| 10294 | switch (res >> 26) { |
| 10295 | case ALC880_HP_EVENT: |
| 10296 | alc861vd_lenovo_hp_automute(codec); |
| 10297 | break; |
| 10298 | case ALC880_MIC_EVENT: |
| 10299 | alc861vd_lenovo_mic_automute(codec); |
| 10300 | break; |
| 10301 | } |
| 10302 | } |
| 10303 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10304 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 10305 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10306 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10307 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10308 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10309 | |
| 10310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10311 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10312 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10313 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10314 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10315 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10316 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10317 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10318 | |
| 10319 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10320 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10321 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10322 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10323 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10324 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10325 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10326 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10327 | |
| 10328 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10329 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10330 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10331 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10332 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10333 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10334 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10335 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10336 | |
| 10337 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10338 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10339 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10340 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10341 | |
| 10342 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10343 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10344 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10345 | |
| 10346 | { } /* end */ |
| 10347 | }; |
| 10348 | |
| 10349 | /* toggle speaker-output according to the hp-jack state */ |
| 10350 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 10351 | { |
| 10352 | unsigned int present; |
| 10353 | |
| 10354 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10355 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10356 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10357 | 0x80, present ? 0x80 : 0); |
| 10358 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10359 | 0x80, present ? 0x80 : 0); |
| 10360 | } |
| 10361 | |
| 10362 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10363 | { |
| 10364 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10365 | alc861vd_dallas_automute(codec); |
| 10366 | } |
| 10367 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10368 | /* pcm configuration: identiacal with ALC880 */ |
| 10369 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 10370 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 10371 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 10372 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 10373 | |
| 10374 | /* |
| 10375 | * configuration and preset |
| 10376 | */ |
| 10377 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 10378 | [ALC660VD_3ST] = "3stack-660", |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10379 | [ALC660VD_3ST_DIG]= "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10380 | [ALC861VD_3ST] = "3stack", |
| 10381 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 10382 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10383 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10384 | [ALC861VD_DALLAS] = "dallas", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10385 | [ALC861VD_AUTO] = "auto", |
| 10386 | }; |
| 10387 | |
| 10388 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 10389 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10390 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10391 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10392 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10393 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10394 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10395 | SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS), |
| 10396 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10397 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
| 10398 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
Takashi Iwai | a18519e | 2007-06-14 12:58:23 +0200 | [diff] [blame] | 10399 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 10400 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10401 | {} |
| 10402 | }; |
| 10403 | |
| 10404 | static struct alc_config_preset alc861vd_presets[] = { |
| 10405 | [ALC660VD_3ST] = { |
| 10406 | .mixers = { alc861vd_3st_mixer }, |
| 10407 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10408 | alc861vd_3stack_init_verbs }, |
| 10409 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10410 | .dac_nids = alc660vd_dac_nids, |
| 10411 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10412 | .adc_nids = alc861vd_adc_nids, |
| 10413 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10414 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10415 | .input_mux = &alc861vd_capture_source, |
| 10416 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10417 | [ALC660VD_3ST_DIG] = { |
| 10418 | .mixers = { alc861vd_3st_mixer }, |
| 10419 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10420 | alc861vd_3stack_init_verbs }, |
| 10421 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10422 | .dac_nids = alc660vd_dac_nids, |
| 10423 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10424 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10425 | .adc_nids = alc861vd_adc_nids, |
| 10426 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10427 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10428 | .input_mux = &alc861vd_capture_source, |
| 10429 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10430 | [ALC861VD_3ST] = { |
| 10431 | .mixers = { alc861vd_3st_mixer }, |
| 10432 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10433 | alc861vd_3stack_init_verbs }, |
| 10434 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10435 | .dac_nids = alc861vd_dac_nids, |
| 10436 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10437 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10438 | .input_mux = &alc861vd_capture_source, |
| 10439 | }, |
| 10440 | [ALC861VD_3ST_DIG] = { |
| 10441 | .mixers = { alc861vd_3st_mixer }, |
| 10442 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10443 | alc861vd_3stack_init_verbs }, |
| 10444 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10445 | .dac_nids = alc861vd_dac_nids, |
| 10446 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10447 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10448 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10449 | .input_mux = &alc861vd_capture_source, |
| 10450 | }, |
| 10451 | [ALC861VD_6ST_DIG] = { |
| 10452 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 10453 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10454 | alc861vd_6stack_init_verbs }, |
| 10455 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10456 | .dac_nids = alc861vd_dac_nids, |
| 10457 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10458 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 10459 | .channel_mode = alc861vd_6stack_modes, |
| 10460 | .input_mux = &alc861vd_capture_source, |
| 10461 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10462 | [ALC861VD_LENOVO] = { |
| 10463 | .mixers = { alc861vd_lenovo_mixer }, |
| 10464 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10465 | alc861vd_3stack_init_verbs, |
| 10466 | alc861vd_eapd_verbs, |
| 10467 | alc861vd_lenovo_unsol_verbs }, |
| 10468 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10469 | .dac_nids = alc660vd_dac_nids, |
| 10470 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10471 | .adc_nids = alc861vd_adc_nids, |
| 10472 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10473 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10474 | .input_mux = &alc861vd_capture_source, |
| 10475 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 10476 | .init_hook = alc861vd_lenovo_automute, |
| 10477 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10478 | [ALC861VD_DALLAS] = { |
| 10479 | .mixers = { alc861vd_dallas_mixer }, |
| 10480 | .init_verbs = { alc861vd_dallas_verbs }, |
| 10481 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10482 | .dac_nids = alc861vd_dac_nids, |
| 10483 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10484 | .adc_nids = alc861vd_adc_nids, |
| 10485 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10486 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10487 | .input_mux = &alc861vd_dallas_capture_source, |
| 10488 | .unsol_event = alc861vd_dallas_unsol_event, |
| 10489 | .init_hook = alc861vd_dallas_automute, |
| 10490 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10491 | }; |
| 10492 | |
| 10493 | /* |
| 10494 | * BIOS auto configuration |
| 10495 | */ |
| 10496 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 10497 | hda_nid_t nid, int pin_type, int dac_idx) |
| 10498 | { |
| 10499 | /* set as output */ |
| 10500 | snd_hda_codec_write(codec, nid, 0, |
| 10501 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 10502 | snd_hda_codec_write(codec, nid, 0, |
| 10503 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 10504 | } |
| 10505 | |
| 10506 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 10507 | { |
| 10508 | struct alc_spec *spec = codec->spec; |
| 10509 | int i; |
| 10510 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10511 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10512 | for (i = 0; i <= HDA_SIDE; i++) { |
| 10513 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10514 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10515 | if (nid) |
| 10516 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10517 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10518 | } |
| 10519 | } |
| 10520 | |
| 10521 | |
| 10522 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 10523 | { |
| 10524 | struct alc_spec *spec = codec->spec; |
| 10525 | hda_nid_t pin; |
| 10526 | |
| 10527 | pin = spec->autocfg.hp_pins[0]; |
| 10528 | if (pin) /* connect to front and use dac 0 */ |
| 10529 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 10530 | } |
| 10531 | |
| 10532 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 10533 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 10534 | |
| 10535 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 10536 | { |
| 10537 | struct alc_spec *spec = codec->spec; |
| 10538 | int i; |
| 10539 | |
| 10540 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10541 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 10542 | if (alc861vd_is_input_pin(nid)) { |
| 10543 | snd_hda_codec_write(codec, nid, 0, |
| 10544 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10545 | i <= AUTO_PIN_FRONT_MIC ? |
| 10546 | PIN_VREF80 : PIN_IN); |
| 10547 | if (nid != ALC861VD_PIN_CD_NID) |
| 10548 | snd_hda_codec_write(codec, nid, 0, |
| 10549 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10550 | AMP_OUT_MUTE); |
| 10551 | } |
| 10552 | } |
| 10553 | } |
| 10554 | |
| 10555 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 10556 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 10557 | |
| 10558 | /* add playback controls from the parsed DAC table */ |
| 10559 | /* Based on ALC880 version. But ALC861VD has separate, |
| 10560 | * different NIDs for mute/unmute switch and volume control */ |
| 10561 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10562 | const struct auto_pin_cfg *cfg) |
| 10563 | { |
| 10564 | char name[32]; |
| 10565 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 10566 | hda_nid_t nid_v, nid_s; |
| 10567 | int i, err; |
| 10568 | |
| 10569 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10570 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10571 | continue; |
| 10572 | nid_v = alc861vd_idx_to_mixer_vol( |
| 10573 | alc880_dac_to_idx( |
| 10574 | spec->multiout.dac_nids[i])); |
| 10575 | nid_s = alc861vd_idx_to_mixer_switch( |
| 10576 | alc880_dac_to_idx( |
| 10577 | spec->multiout.dac_nids[i])); |
| 10578 | |
| 10579 | if (i == 2) { |
| 10580 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10581 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10582 | "Center Playback Volume", |
| 10583 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 10584 | HDA_OUTPUT)); |
| 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 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10588 | "LFE Playback Volume", |
| 10589 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 10590 | HDA_OUTPUT)); |
| 10591 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10592 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10593 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10594 | "Center Playback Switch", |
| 10595 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 10596 | HDA_INPUT)); |
| 10597 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10598 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10599 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10600 | "LFE Playback Switch", |
| 10601 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 10602 | HDA_INPUT)); |
| 10603 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10604 | return err; |
| 10605 | } else { |
| 10606 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10607 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10608 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 10609 | HDA_OUTPUT)); |
| 10610 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10611 | return err; |
| 10612 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10613 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10614 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10615 | HDA_INPUT)); |
| 10616 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10617 | return err; |
| 10618 | } |
| 10619 | } |
| 10620 | return 0; |
| 10621 | } |
| 10622 | |
| 10623 | /* add playback controls for speaker and HP outputs */ |
| 10624 | /* Based on ALC880 version. But ALC861VD has separate, |
| 10625 | * different NIDs for mute/unmute switch and volume control */ |
| 10626 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 10627 | hda_nid_t pin, const char *pfx) |
| 10628 | { |
| 10629 | hda_nid_t nid_v, nid_s; |
| 10630 | int err; |
| 10631 | char name[32]; |
| 10632 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10633 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10634 | return 0; |
| 10635 | |
| 10636 | if (alc880_is_fixed_pin(pin)) { |
| 10637 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 10638 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10639 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10640 | spec->multiout.hp_nid = nid_v; |
| 10641 | else |
| 10642 | spec->multiout.extra_out_nid[0] = nid_v; |
| 10643 | /* control HP volume/switch on the output mixer amp */ |
| 10644 | nid_v = alc861vd_idx_to_mixer_vol( |
| 10645 | alc880_fixed_pin_idx(pin)); |
| 10646 | nid_s = alc861vd_idx_to_mixer_switch( |
| 10647 | alc880_fixed_pin_idx(pin)); |
| 10648 | |
| 10649 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10650 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10651 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 10652 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10653 | return err; |
| 10654 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10655 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 10656 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 10657 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10658 | return err; |
| 10659 | } else if (alc880_is_multi_pin(pin)) { |
| 10660 | /* set manual connection */ |
| 10661 | /* we have only a switch on HP-out PIN */ |
| 10662 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10663 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10664 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 10665 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10666 | return err; |
| 10667 | } |
| 10668 | return 0; |
| 10669 | } |
| 10670 | |
| 10671 | /* parse the BIOS configuration and set up the alc_spec |
| 10672 | * return 1 if successful, 0 if the proper config is not found, |
| 10673 | * or a negative error code |
| 10674 | * Based on ALC880 version - had to change it to override |
| 10675 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 10676 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 10677 | { |
| 10678 | struct alc_spec *spec = codec->spec; |
| 10679 | int err; |
| 10680 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 10681 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10682 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10683 | alc861vd_ignore); |
| 10684 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10685 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10686 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10687 | return 0; /* can't find valid BIOS pin config */ |
| 10688 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10689 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10690 | if (err < 0) |
| 10691 | return err; |
| 10692 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10693 | if (err < 0) |
| 10694 | return err; |
| 10695 | err = alc861vd_auto_create_extra_out(spec, |
| 10696 | spec->autocfg.speaker_pins[0], |
| 10697 | "Speaker"); |
| 10698 | if (err < 0) |
| 10699 | return err; |
| 10700 | err = alc861vd_auto_create_extra_out(spec, |
| 10701 | spec->autocfg.hp_pins[0], |
| 10702 | "Headphone"); |
| 10703 | if (err < 0) |
| 10704 | return err; |
| 10705 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10706 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10707 | return err; |
| 10708 | |
| 10709 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10710 | |
| 10711 | if (spec->autocfg.dig_out_pin) |
| 10712 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 10713 | |
| 10714 | if (spec->kctl_alloc) |
| 10715 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10716 | |
| 10717 | spec->init_verbs[spec->num_init_verbs++] |
| 10718 | = alc861vd_volume_init_verbs; |
| 10719 | |
| 10720 | spec->num_mux_defs = 1; |
| 10721 | spec->input_mux = &spec->private_imux; |
| 10722 | |
| 10723 | return 1; |
| 10724 | } |
| 10725 | |
| 10726 | /* additional initialization for auto-configuration model */ |
| 10727 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 10728 | { |
| 10729 | alc861vd_auto_init_multi_out(codec); |
| 10730 | alc861vd_auto_init_hp_out(codec); |
| 10731 | alc861vd_auto_init_analog_input(codec); |
| 10732 | } |
| 10733 | |
| 10734 | static int patch_alc861vd(struct hda_codec *codec) |
| 10735 | { |
| 10736 | struct alc_spec *spec; |
| 10737 | int err, board_config; |
| 10738 | |
| 10739 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10740 | if (spec == NULL) |
| 10741 | return -ENOMEM; |
| 10742 | |
| 10743 | codec->spec = spec; |
| 10744 | |
| 10745 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 10746 | alc861vd_models, |
| 10747 | alc861vd_cfg_tbl); |
| 10748 | |
| 10749 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 10750 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 10751 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 10752 | board_config = ALC861VD_AUTO; |
| 10753 | } |
| 10754 | |
| 10755 | if (board_config == ALC861VD_AUTO) { |
| 10756 | /* automatic parse from the BIOS config */ |
| 10757 | err = alc861vd_parse_auto_config(codec); |
| 10758 | if (err < 0) { |
| 10759 | alc_free(codec); |
| 10760 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10761 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10762 | printk(KERN_INFO |
| 10763 | "hda_codec: Cannot set up configuration " |
| 10764 | "from BIOS. Using base mode...\n"); |
| 10765 | board_config = ALC861VD_3ST; |
| 10766 | } |
| 10767 | } |
| 10768 | |
| 10769 | if (board_config != ALC861VD_AUTO) |
| 10770 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 10771 | |
| 10772 | spec->stream_name_analog = "ALC861VD Analog"; |
| 10773 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 10774 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 10775 | |
| 10776 | spec->stream_name_digital = "ALC861VD Digital"; |
| 10777 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 10778 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 10779 | |
| 10780 | spec->adc_nids = alc861vd_adc_nids; |
| 10781 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 10782 | |
| 10783 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 10784 | spec->num_mixers++; |
| 10785 | |
| 10786 | codec->patch_ops = alc_patch_ops; |
| 10787 | |
| 10788 | if (board_config == ALC861VD_AUTO) |
| 10789 | spec->init_hook = alc861vd_auto_init; |
| 10790 | |
| 10791 | return 0; |
| 10792 | } |
| 10793 | |
| 10794 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10795 | * ALC662 support |
| 10796 | * |
| 10797 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 10798 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 10799 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 10800 | * 6-channel independent captures. |
| 10801 | * |
| 10802 | * In addition, an independent DAC for the multi-playback (not used in this |
| 10803 | * driver yet). |
| 10804 | */ |
| 10805 | #define ALC662_DIGOUT_NID 0x06 |
| 10806 | #define ALC662_DIGIN_NID 0x0a |
| 10807 | |
| 10808 | static hda_nid_t alc662_dac_nids[4] = { |
| 10809 | /* front, rear, clfe, rear_surr */ |
| 10810 | 0x02, 0x03, 0x04 |
| 10811 | }; |
| 10812 | |
| 10813 | static hda_nid_t alc662_adc_nids[1] = { |
| 10814 | /* ADC1-2 */ |
| 10815 | 0x09, |
| 10816 | }; |
| 10817 | /* input MUX */ |
| 10818 | /* FIXME: should be a matrix-type input source selection */ |
| 10819 | |
| 10820 | static struct hda_input_mux alc662_capture_source = { |
| 10821 | .num_items = 4, |
| 10822 | .items = { |
| 10823 | { "Mic", 0x0 }, |
| 10824 | { "Front Mic", 0x1 }, |
| 10825 | { "Line", 0x2 }, |
| 10826 | { "CD", 0x4 }, |
| 10827 | }, |
| 10828 | }; |
| 10829 | |
| 10830 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 10831 | .num_items = 2, |
| 10832 | .items = { |
| 10833 | { "Mic", 0x1 }, |
| 10834 | { "Line", 0x2 }, |
| 10835 | }, |
| 10836 | }; |
| 10837 | #define alc662_mux_enum_info alc_mux_enum_info |
| 10838 | #define alc662_mux_enum_get alc_mux_enum_get |
| 10839 | |
| 10840 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10841 | struct snd_ctl_elem_value *ucontrol) |
| 10842 | { |
| 10843 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10844 | struct alc_spec *spec = codec->spec; |
| 10845 | const struct hda_input_mux *imux = spec->input_mux; |
| 10846 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 10847 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 10848 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 10849 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 10850 | unsigned int i, idx; |
| 10851 | |
| 10852 | idx = ucontrol->value.enumerated.item[0]; |
| 10853 | if (idx >= imux->num_items) |
| 10854 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 10855 | if (*cur_val == idx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10856 | return 0; |
| 10857 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame^] | 10858 | unsigned int v = (i == idx) ? 0x00 : 0x80; |
| 10859 | snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, |
| 10860 | imux->items[i].index, 0x80, v); |
| 10861 | snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, |
| 10862 | imux->items[i].index, 0x80, v); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10863 | } |
| 10864 | *cur_val = idx; |
| 10865 | return 1; |
| 10866 | } |
| 10867 | /* |
| 10868 | * 2ch mode |
| 10869 | */ |
| 10870 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 10871 | { 2, NULL } |
| 10872 | }; |
| 10873 | |
| 10874 | /* |
| 10875 | * 2ch mode |
| 10876 | */ |
| 10877 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 10878 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 10879 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 10880 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 10881 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 10882 | { } /* end */ |
| 10883 | }; |
| 10884 | |
| 10885 | /* |
| 10886 | * 6ch mode |
| 10887 | */ |
| 10888 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 10889 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10890 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10891 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 10892 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10893 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10894 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 10895 | { } /* end */ |
| 10896 | }; |
| 10897 | |
| 10898 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 10899 | { 2, alc662_3ST_ch2_init }, |
| 10900 | { 6, alc662_3ST_ch6_init }, |
| 10901 | }; |
| 10902 | |
| 10903 | /* |
| 10904 | * 2ch mode |
| 10905 | */ |
| 10906 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 10907 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10908 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10909 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10910 | { } /* end */ |
| 10911 | }; |
| 10912 | |
| 10913 | /* |
| 10914 | * 6ch mode |
| 10915 | */ |
| 10916 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 10917 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10918 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10919 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10920 | { } /* end */ |
| 10921 | }; |
| 10922 | |
| 10923 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 10924 | { 2, alc662_sixstack_ch6_init }, |
| 10925 | { 6, alc662_sixstack_ch8_init }, |
| 10926 | }; |
| 10927 | |
| 10928 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 10929 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 10930 | */ |
| 10931 | |
| 10932 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 10933 | /* output mixer control */ |
| 10934 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10935 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 10936 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10937 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10938 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 10939 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 10940 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 10941 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 10942 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10943 | |
| 10944 | /*Input mixer control */ |
| 10945 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 10946 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 10947 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 10948 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 10949 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 10950 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 10951 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 10952 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
| 10953 | |
| 10954 | /* Capture mixer control */ |
| 10955 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10956 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10957 | { |
| 10958 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10959 | .name = "Capture Source", |
| 10960 | .count = 1, |
| 10961 | .info = alc_mux_enum_info, |
| 10962 | .get = alc_mux_enum_get, |
| 10963 | .put = alc_mux_enum_put, |
| 10964 | }, |
| 10965 | { } /* end */ |
| 10966 | }; |
| 10967 | |
| 10968 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 10969 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10970 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10971 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10978 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10979 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10980 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10981 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10982 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10983 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10984 | { |
| 10985 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10986 | /* .name = "Capture Source", */ |
| 10987 | .name = "Input Source", |
| 10988 | .count = 1, |
| 10989 | .info = alc662_mux_enum_info, |
| 10990 | .get = alc662_mux_enum_get, |
| 10991 | .put = alc662_mux_enum_put, |
| 10992 | }, |
| 10993 | { } /* end */ |
| 10994 | }; |
| 10995 | |
| 10996 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 10997 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10998 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10999 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11000 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 11001 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 11002 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 11003 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 11004 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 11005 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11006 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11007 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11008 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11009 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11010 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11011 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11012 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11013 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11014 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11015 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11016 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11017 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11018 | { |
| 11019 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11020 | /* .name = "Capture Source", */ |
| 11021 | .name = "Input Source", |
| 11022 | .count = 1, |
| 11023 | .info = alc662_mux_enum_info, |
| 11024 | .get = alc662_mux_enum_get, |
| 11025 | .put = alc662_mux_enum_put, |
| 11026 | }, |
| 11027 | { } /* end */ |
| 11028 | }; |
| 11029 | |
| 11030 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 11031 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11032 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 11033 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11034 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT), |
| 11035 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11036 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11037 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11038 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11039 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11040 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11041 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11042 | { |
| 11043 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11044 | /* .name = "Capture Source", */ |
| 11045 | .name = "Input Source", |
| 11046 | .count = 1, |
| 11047 | .info = alc662_mux_enum_info, |
| 11048 | .get = alc662_mux_enum_get, |
| 11049 | .put = alc662_mux_enum_put, |
| 11050 | }, |
| 11051 | { } /* end */ |
| 11052 | }; |
| 11053 | |
| 11054 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 11055 | { |
| 11056 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11057 | .name = "Channel Mode", |
| 11058 | .info = alc_ch_mode_info, |
| 11059 | .get = alc_ch_mode_get, |
| 11060 | .put = alc_ch_mode_put, |
| 11061 | }, |
| 11062 | { } /* end */ |
| 11063 | }; |
| 11064 | |
| 11065 | static struct hda_verb alc662_init_verbs[] = { |
| 11066 | /* ADC: mute amp left and right */ |
| 11067 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11068 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11069 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 11070 | |
| 11071 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11072 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11073 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11074 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 11075 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11076 | |
| 11077 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11078 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11079 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11080 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11081 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11082 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11083 | |
| 11084 | /* Front Pin: output 0 (0x0c) */ |
| 11085 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11086 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11087 | |
| 11088 | /* Rear Pin: output 1 (0x0d) */ |
| 11089 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11090 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11091 | |
| 11092 | /* CLFE Pin: output 2 (0x0e) */ |
| 11093 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11094 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11095 | |
| 11096 | /* Mic (rear) pin: input vref at 80% */ |
| 11097 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11098 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11099 | /* Front Mic pin: input vref at 80% */ |
| 11100 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11101 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11102 | /* Line In pin: input */ |
| 11103 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11104 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11105 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11106 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11107 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11108 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11109 | /* CD pin widget for input */ |
| 11110 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11111 | |
| 11112 | /* FIXME: use matrix-type input source selection */ |
| 11113 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11114 | /* Input mixer */ |
| 11115 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11116 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11117 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11119 | { } |
| 11120 | }; |
| 11121 | |
| 11122 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 11123 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 11124 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 11125 | {} |
| 11126 | }; |
| 11127 | |
| 11128 | /* |
| 11129 | * generic initialization of ADC, input mixers and output mixers |
| 11130 | */ |
| 11131 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 11132 | /* |
| 11133 | * Unmute ADC and set the default input to mic-in |
| 11134 | */ |
| 11135 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11136 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11137 | |
| 11138 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 11139 | * mixer widget |
| 11140 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11141 | * panel mic (mic 2) |
| 11142 | */ |
| 11143 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11144 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11145 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11146 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11147 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 11148 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11149 | |
| 11150 | /* |
| 11151 | * Set up output mixers (0x0c - 0x0f) |
| 11152 | */ |
| 11153 | /* set vol=0 to output mixers */ |
| 11154 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11155 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11156 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11157 | |
| 11158 | /* set up input amps for analog loopback */ |
| 11159 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11160 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11161 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11162 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11163 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11164 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11165 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11166 | |
| 11167 | |
| 11168 | /* FIXME: use matrix-type input source selection */ |
| 11169 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11170 | /* Input mixer */ |
| 11171 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11172 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11173 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11174 | /*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/ |
| 11175 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11176 | |
| 11177 | { } |
| 11178 | }; |
| 11179 | |
| 11180 | /* capture mixer elements */ |
| 11181 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 11182 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11183 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11184 | { |
| 11185 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11186 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11187 | * So call somewhat different.. |
| 11188 | * FIXME: the controls appear in the "playback" view! |
| 11189 | */ |
| 11190 | /* .name = "Capture Source", */ |
| 11191 | .name = "Input Source", |
| 11192 | .count = 1, |
| 11193 | .info = alc882_mux_enum_info, |
| 11194 | .get = alc882_mux_enum_get, |
| 11195 | .put = alc882_mux_enum_put, |
| 11196 | }, |
| 11197 | { } /* end */ |
| 11198 | }; |
| 11199 | |
| 11200 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 11201 | { |
| 11202 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11203 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11204 | |
| 11205 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11206 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11207 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11208 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11209 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11210 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11211 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11212 | } |
| 11213 | |
| 11214 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 11215 | { |
| 11216 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11217 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11218 | |
| 11219 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 11220 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11221 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11222 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11223 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11224 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11225 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11226 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11227 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11228 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11229 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11230 | } |
| 11231 | |
| 11232 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 11233 | unsigned int res) |
| 11234 | { |
| 11235 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11236 | alc662_lenovo_101e_all_automute(codec); |
| 11237 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 11238 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 11239 | } |
| 11240 | |
| 11241 | |
| 11242 | /* pcm configuration: identiacal with ALC880 */ |
| 11243 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 11244 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 11245 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 11246 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 11247 | |
| 11248 | /* |
| 11249 | * configuration and preset |
| 11250 | */ |
| 11251 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 11252 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 11253 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 11254 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 11255 | [ALC662_5ST_DIG] = "6stack-dig", |
| 11256 | [ALC662_LENOVO_101E] = "lenovo-101e", |
| 11257 | [ALC662_AUTO] = "auto", |
| 11258 | }; |
| 11259 | |
| 11260 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
| 11261 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
| 11262 | {} |
| 11263 | }; |
| 11264 | |
| 11265 | static struct alc_config_preset alc662_presets[] = { |
| 11266 | [ALC662_3ST_2ch_DIG] = { |
| 11267 | .mixers = { alc662_3ST_2ch_mixer }, |
| 11268 | .init_verbs = { alc662_init_verbs }, |
| 11269 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11270 | .dac_nids = alc662_dac_nids, |
| 11271 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11272 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11273 | .adc_nids = alc662_adc_nids, |
| 11274 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11275 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 11276 | .channel_mode = alc662_3ST_2ch_modes, |
| 11277 | .input_mux = &alc662_capture_source, |
| 11278 | }, |
| 11279 | [ALC662_3ST_6ch_DIG] = { |
| 11280 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 11281 | .init_verbs = { alc662_init_verbs }, |
| 11282 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11283 | .dac_nids = alc662_dac_nids, |
| 11284 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11285 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11286 | .adc_nids = alc662_adc_nids, |
| 11287 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11288 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 11289 | .channel_mode = alc662_3ST_6ch_modes, |
| 11290 | .need_dac_fix = 1, |
| 11291 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11292 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11293 | [ALC662_3ST_6ch] = { |
| 11294 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 11295 | .init_verbs = { alc662_init_verbs }, |
| 11296 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11297 | .dac_nids = alc662_dac_nids, |
| 11298 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11299 | .adc_nids = alc662_adc_nids, |
| 11300 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 11301 | .channel_mode = alc662_3ST_6ch_modes, |
| 11302 | .need_dac_fix = 1, |
| 11303 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11304 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11305 | [ALC662_5ST_DIG] = { |
| 11306 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
| 11307 | .init_verbs = { alc662_init_verbs }, |
| 11308 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11309 | .dac_nids = alc662_dac_nids, |
| 11310 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11311 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11312 | .adc_nids = alc662_adc_nids, |
| 11313 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11314 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 11315 | .channel_mode = alc662_5stack_modes, |
| 11316 | .input_mux = &alc662_capture_source, |
| 11317 | }, |
| 11318 | [ALC662_LENOVO_101E] = { |
| 11319 | .mixers = { alc662_lenovo_101e_mixer }, |
| 11320 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 11321 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11322 | .dac_nids = alc662_dac_nids, |
| 11323 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11324 | .adc_nids = alc662_adc_nids, |
| 11325 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 11326 | .channel_mode = alc662_3ST_2ch_modes, |
| 11327 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 11328 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 11329 | .init_hook = alc662_lenovo_101e_all_automute, |
| 11330 | }, |
| 11331 | |
| 11332 | }; |
| 11333 | |
| 11334 | |
| 11335 | /* |
| 11336 | * BIOS auto configuration |
| 11337 | */ |
| 11338 | |
| 11339 | /* add playback controls from the parsed DAC table */ |
| 11340 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11341 | const struct auto_pin_cfg *cfg) |
| 11342 | { |
| 11343 | char name[32]; |
| 11344 | static const char *chname[4] = { |
| 11345 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11346 | }; |
| 11347 | hda_nid_t nid; |
| 11348 | int i, err; |
| 11349 | |
| 11350 | for (i = 0; i < cfg->line_outs; i++) { |
| 11351 | if (!spec->multiout.dac_nids[i]) |
| 11352 | continue; |
Kailang Yang | 067b5a8 | 2007-07-05 12:35:15 +0200 | [diff] [blame] | 11353 | nid = alc880_idx_to_mixer(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11354 | if (i == 2) { |
| 11355 | /* Center/LFE */ |
| 11356 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11357 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11358 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11359 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11360 | if (err < 0) |
| 11361 | return err; |
| 11362 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11363 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11364 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11365 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11366 | if (err < 0) |
| 11367 | return err; |
| 11368 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11369 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11370 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 11371 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11372 | if (err < 0) |
| 11373 | return err; |
| 11374 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11375 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11376 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 11377 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11378 | if (err < 0) |
| 11379 | return err; |
| 11380 | } else { |
| 11381 | sprintf(name, "%s Playback Volume", chname[i]); |
| 11382 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11383 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11384 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11385 | if (err < 0) |
| 11386 | return err; |
| 11387 | sprintf(name, "%s Playback Switch", chname[i]); |
| 11388 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11389 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 11390 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11391 | if (err < 0) |
| 11392 | return err; |
| 11393 | } |
| 11394 | } |
| 11395 | return 0; |
| 11396 | } |
| 11397 | |
| 11398 | /* add playback controls for speaker and HP outputs */ |
| 11399 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 11400 | const char *pfx) |
| 11401 | { |
| 11402 | hda_nid_t nid; |
| 11403 | int err; |
| 11404 | char name[32]; |
| 11405 | |
| 11406 | if (!pin) |
| 11407 | return 0; |
| 11408 | |
| 11409 | if (alc880_is_fixed_pin(pin)) { |
| 11410 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11411 | /* printk("DAC nid=%x\n",nid); */ |
| 11412 | /* specify the DAC as the extra output */ |
| 11413 | if (!spec->multiout.hp_nid) |
| 11414 | spec->multiout.hp_nid = nid; |
| 11415 | else |
| 11416 | spec->multiout.extra_out_nid[0] = nid; |
| 11417 | /* control HP volume/switch on the output mixer amp */ |
| 11418 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11419 | sprintf(name, "%s Playback Volume", pfx); |
| 11420 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11421 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11422 | if (err < 0) |
| 11423 | return err; |
| 11424 | sprintf(name, "%s Playback Switch", pfx); |
| 11425 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11426 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 11427 | if (err < 0) |
| 11428 | return err; |
| 11429 | } else if (alc880_is_multi_pin(pin)) { |
| 11430 | /* set manual connection */ |
| 11431 | /* we have only a switch on HP-out PIN */ |
| 11432 | sprintf(name, "%s Playback Switch", pfx); |
| 11433 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11434 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 11435 | if (err < 0) |
| 11436 | return err; |
| 11437 | } |
| 11438 | return 0; |
| 11439 | } |
| 11440 | |
| 11441 | /* create playback/capture controls for input pins */ |
| 11442 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11443 | const struct auto_pin_cfg *cfg) |
| 11444 | { |
| 11445 | struct hda_input_mux *imux = &spec->private_imux; |
| 11446 | int i, err, idx; |
| 11447 | |
| 11448 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11449 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 11450 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 11451 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11452 | auto_pin_cfg_labels[i], |
| 11453 | idx, 0x0b); |
| 11454 | if (err < 0) |
| 11455 | return err; |
| 11456 | imux->items[imux->num_items].label = |
| 11457 | auto_pin_cfg_labels[i]; |
| 11458 | imux->items[imux->num_items].index = |
| 11459 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 11460 | imux->num_items++; |
| 11461 | } |
| 11462 | } |
| 11463 | return 0; |
| 11464 | } |
| 11465 | |
| 11466 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11467 | hda_nid_t nid, int pin_type, |
| 11468 | int dac_idx) |
| 11469 | { |
| 11470 | /* set as output */ |
| 11471 | snd_hda_codec_write(codec, nid, 0, |
| 11472 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 11473 | snd_hda_codec_write(codec, nid, 0, |
| 11474 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 11475 | /* need the manual connection? */ |
| 11476 | if (alc880_is_multi_pin(nid)) { |
| 11477 | struct alc_spec *spec = codec->spec; |
| 11478 | int idx = alc880_multi_pin_idx(nid); |
| 11479 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 11480 | AC_VERB_SET_CONNECT_SEL, |
| 11481 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 11482 | } |
| 11483 | } |
| 11484 | |
| 11485 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 11486 | { |
| 11487 | struct alc_spec *spec = codec->spec; |
| 11488 | int i; |
| 11489 | |
| 11490 | for (i = 0; i <= HDA_SIDE; i++) { |
| 11491 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11492 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11493 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11494 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11495 | i); |
| 11496 | } |
| 11497 | } |
| 11498 | |
| 11499 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 11500 | { |
| 11501 | struct alc_spec *spec = codec->spec; |
| 11502 | hda_nid_t pin; |
| 11503 | |
| 11504 | pin = spec->autocfg.hp_pins[0]; |
| 11505 | if (pin) /* connect to front */ |
| 11506 | /* use dac 0 */ |
| 11507 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 11508 | } |
| 11509 | |
| 11510 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 11511 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 11512 | |
| 11513 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 11514 | { |
| 11515 | struct alc_spec *spec = codec->spec; |
| 11516 | int i; |
| 11517 | |
| 11518 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11519 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 11520 | if (alc662_is_input_pin(nid)) { |
| 11521 | snd_hda_codec_write(codec, nid, 0, |
| 11522 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11523 | (i <= AUTO_PIN_FRONT_MIC ? |
| 11524 | PIN_VREF80 : PIN_IN)); |
| 11525 | if (nid != ALC662_PIN_CD_NID) |
| 11526 | snd_hda_codec_write(codec, nid, 0, |
| 11527 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11528 | AMP_OUT_MUTE); |
| 11529 | } |
| 11530 | } |
| 11531 | } |
| 11532 | |
| 11533 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 11534 | { |
| 11535 | struct alc_spec *spec = codec->spec; |
| 11536 | int err; |
| 11537 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 11538 | |
| 11539 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11540 | alc662_ignore); |
| 11541 | if (err < 0) |
| 11542 | return err; |
| 11543 | if (!spec->autocfg.line_outs) |
| 11544 | return 0; /* can't find valid BIOS pin config */ |
| 11545 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11546 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11547 | if (err < 0) |
| 11548 | return err; |
| 11549 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11550 | if (err < 0) |
| 11551 | return err; |
| 11552 | err = alc662_auto_create_extra_out(spec, |
| 11553 | spec->autocfg.speaker_pins[0], |
| 11554 | "Speaker"); |
| 11555 | if (err < 0) |
| 11556 | return err; |
| 11557 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 11558 | "Headphone"); |
| 11559 | if (err < 0) |
| 11560 | return err; |
| 11561 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11562 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11563 | return err; |
| 11564 | |
| 11565 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11566 | |
| 11567 | if (spec->autocfg.dig_out_pin) |
| 11568 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 11569 | |
| 11570 | if (spec->kctl_alloc) |
| 11571 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11572 | |
| 11573 | spec->num_mux_defs = 1; |
| 11574 | spec->input_mux = &spec->private_imux; |
| 11575 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11576 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11577 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 11578 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11579 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11580 | } |
| 11581 | |
| 11582 | /* additional initialization for auto-configuration model */ |
| 11583 | static void alc662_auto_init(struct hda_codec *codec) |
| 11584 | { |
| 11585 | alc662_auto_init_multi_out(codec); |
| 11586 | alc662_auto_init_hp_out(codec); |
| 11587 | alc662_auto_init_analog_input(codec); |
| 11588 | } |
| 11589 | |
| 11590 | static int patch_alc662(struct hda_codec *codec) |
| 11591 | { |
| 11592 | struct alc_spec *spec; |
| 11593 | int err, board_config; |
| 11594 | |
| 11595 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11596 | if (!spec) |
| 11597 | return -ENOMEM; |
| 11598 | |
| 11599 | codec->spec = spec; |
| 11600 | |
| 11601 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 11602 | alc662_models, |
| 11603 | alc662_cfg_tbl); |
| 11604 | if (board_config < 0) { |
| 11605 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 11606 | "trying auto-probe from BIOS...\n"); |
| 11607 | board_config = ALC662_AUTO; |
| 11608 | } |
| 11609 | |
| 11610 | if (board_config == ALC662_AUTO) { |
| 11611 | /* automatic parse from the BIOS config */ |
| 11612 | err = alc662_parse_auto_config(codec); |
| 11613 | if (err < 0) { |
| 11614 | alc_free(codec); |
| 11615 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11616 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11617 | printk(KERN_INFO |
| 11618 | "hda_codec: Cannot set up configuration " |
| 11619 | "from BIOS. Using base mode...\n"); |
| 11620 | board_config = ALC662_3ST_2ch_DIG; |
| 11621 | } |
| 11622 | } |
| 11623 | |
| 11624 | if (board_config != ALC662_AUTO) |
| 11625 | setup_preset(spec, &alc662_presets[board_config]); |
| 11626 | |
| 11627 | spec->stream_name_analog = "ALC662 Analog"; |
| 11628 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 11629 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 11630 | |
| 11631 | spec->stream_name_digital = "ALC662 Digital"; |
| 11632 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 11633 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 11634 | |
| 11635 | if (!spec->adc_nids && spec->input_mux) { |
| 11636 | spec->adc_nids = alc662_adc_nids; |
| 11637 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 11638 | } |
| 11639 | |
| 11640 | codec->patch_ops = alc_patch_ops; |
| 11641 | if (board_config == ALC662_AUTO) |
| 11642 | spec->init_hook = alc662_auto_init; |
| 11643 | |
| 11644 | return 0; |
| 11645 | } |
| 11646 | |
| 11647 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11648 | * patch entries |
| 11649 | */ |
| 11650 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 11651 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11652 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11653 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11654 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11655 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11656 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 11657 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 11658 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11659 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 11660 | .patch = patch_alc883 }, |
| 11661 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 11662 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11663 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11664 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11665 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11666 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11667 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11668 | {} /* terminator */ |
| 11669 | }; |