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, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 105 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 106 | ALC268_ACER, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 107 | ALC268_AUTO, |
| 108 | ALC268_MODEL_LAST /* last tag */ |
| 109 | }; |
| 110 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 111 | /* ALC861 models */ |
| 112 | enum { |
| 113 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 114 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 115 | ALC861_3ST_DIG, |
| 116 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 117 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 118 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 119 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 120 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 121 | ALC861_AUTO, |
| 122 | ALC861_MODEL_LAST, |
| 123 | }; |
| 124 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 125 | /* ALC861-VD models */ |
| 126 | enum { |
| 127 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 128 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 129 | ALC861VD_3ST, |
| 130 | ALC861VD_3ST_DIG, |
| 131 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 132 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 133 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 134 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 135 | ALC861VD_AUTO, |
| 136 | ALC861VD_MODEL_LAST, |
| 137 | }; |
| 138 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 139 | /* ALC662 models */ |
| 140 | enum { |
| 141 | ALC662_3ST_2ch_DIG, |
| 142 | ALC662_3ST_6ch_DIG, |
| 143 | ALC662_3ST_6ch, |
| 144 | ALC662_5ST_DIG, |
| 145 | ALC662_LENOVO_101E, |
| 146 | ALC662_AUTO, |
| 147 | ALC662_MODEL_LAST, |
| 148 | }; |
| 149 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | /* ALC882 models */ |
| 151 | enum { |
| 152 | ALC882_3ST_DIG, |
| 153 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 154 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 155 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 156 | ALC882_TARGA, |
| 157 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 158 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 159 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 160 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 161 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 162 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 163 | ALC882_MODEL_LAST, |
| 164 | }; |
| 165 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 166 | /* ALC883 models */ |
| 167 | enum { |
| 168 | ALC883_3ST_2ch_DIG, |
| 169 | ALC883_3ST_6ch_DIG, |
| 170 | ALC883_3ST_6ch, |
| 171 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 172 | ALC883_TARGA_DIG, |
| 173 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 174 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 175 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 176 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 177 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 178 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 179 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 180 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 181 | ALC888_LENOVO_MS7195_DIG, |
| 182 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 183 | ALC888_6ST_HP, |
| 184 | ALC888_3ST_HP, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 185 | ALC883_AUTO, |
| 186 | ALC883_MODEL_LAST, |
| 187 | }; |
| 188 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 189 | /* for GPIO Poll */ |
| 190 | #define GPIO_MASK 0x03 |
| 191 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | struct alc_spec { |
| 193 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 194 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | unsigned int num_mixers; |
| 196 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 197 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 198 | * don't forget NULL |
| 199 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 200 | */ |
| 201 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 203 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | struct hda_pcm_stream *stream_analog_playback; |
| 205 | struct hda_pcm_stream *stream_analog_capture; |
| 206 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 207 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | struct hda_pcm_stream *stream_digital_playback; |
| 209 | struct hda_pcm_stream *stream_digital_capture; |
| 210 | |
| 211 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 212 | struct hda_multi_out multiout; /* playback set-up |
| 213 | * max_channels, dacs must be set |
| 214 | * dig_out_nid and hp_nid are optional |
| 215 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | |
| 217 | /* capture */ |
| 218 | unsigned int num_adc_nids; |
| 219 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 220 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | |
| 222 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 223 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | const struct hda_input_mux *input_mux; |
| 225 | unsigned int cur_mux[3]; |
| 226 | |
| 227 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 228 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 230 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | |
| 232 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 233 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 234 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 235 | /* dynamic controls, init_verbs and input_mux */ |
| 236 | struct auto_pin_cfg autocfg; |
| 237 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 238 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 239 | struct hda_input_mux private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 240 | hda_nid_t private_dac_nids[5]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 241 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 242 | /* hooks */ |
| 243 | void (*init_hook)(struct hda_codec *codec); |
| 244 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 245 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 246 | /* for pin sensing */ |
| 247 | unsigned int sense_updated: 1; |
| 248 | unsigned int jack_present: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 249 | |
| 250 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 251 | struct hda_loopback_check loopback; |
| 252 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 253 | }; |
| 254 | |
| 255 | /* |
| 256 | * configuration template - to be copied to the spec instance |
| 257 | */ |
| 258 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 259 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 260 | * with spec |
| 261 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 262 | const struct hda_verb *init_verbs[5]; |
| 263 | unsigned int num_dacs; |
| 264 | hda_nid_t *dac_nids; |
| 265 | hda_nid_t dig_out_nid; /* optional */ |
| 266 | hda_nid_t hp_nid; /* optional */ |
| 267 | unsigned int num_adc_nids; |
| 268 | hda_nid_t *adc_nids; |
| 269 | hda_nid_t dig_in_nid; |
| 270 | unsigned int num_channel_mode; |
| 271 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 272 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 273 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 274 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 275 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 276 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 277 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 278 | struct hda_amp_list *loopbacks; |
| 279 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | }; |
| 281 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | |
| 283 | /* |
| 284 | * input MUX handling |
| 285 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 286 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 287 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | { |
| 289 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 290 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 291 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 292 | if (mux_idx >= spec->num_mux_defs) |
| 293 | mux_idx = 0; |
| 294 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | } |
| 296 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 297 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 298 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | { |
| 300 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 301 | struct alc_spec *spec = codec->spec; |
| 302 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 303 | |
| 304 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 305 | return 0; |
| 306 | } |
| 307 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 308 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 309 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | { |
| 311 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 312 | struct alc_spec *spec = codec->spec; |
| 313 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 314 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 315 | 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] | 316 | spec->adc_nids[adc_idx], |
| 317 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | } |
| 319 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 320 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | /* |
| 322 | * channel mode setting |
| 323 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 324 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 325 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | { |
| 327 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 328 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 329 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 330 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | } |
| 332 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 333 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 334 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | { |
| 336 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 337 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 338 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 339 | spec->num_channel_mode, |
| 340 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | } |
| 342 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 343 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 344 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | { |
| 346 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 347 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 348 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 349 | spec->num_channel_mode, |
| 350 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 351 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 352 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 353 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | } |
| 355 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 357 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 358 | * instead of "%" to avoid consequences of accidently treating the % as |
| 359 | * being part of a format specifier. Maximum allowed length of a value is |
| 360 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 361 | * |
| 362 | * Note: some retasking pin complexes seem to ignore requests for input |
| 363 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 364 | * are requested. Therefore order this list so that this behaviour will not |
| 365 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 366 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 367 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 368 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 369 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 370 | "Mic 50pc bias", "Mic 80pc bias", |
| 371 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 372 | }; |
| 373 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 374 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 375 | }; |
| 376 | /* 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] | 377 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 378 | * addition, "input" pins may or may not process the mic bias option |
| 379 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 380 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 381 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 382 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 383 | #define ALC_PIN_DIR_IN 0x00 |
| 384 | #define ALC_PIN_DIR_OUT 0x01 |
| 385 | #define ALC_PIN_DIR_INOUT 0x02 |
| 386 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 387 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 388 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 389 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 390 | * For each direction the minimum and maximum values are given. |
| 391 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 392 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 393 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 394 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 395 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 396 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 397 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 398 | }; |
| 399 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 400 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 401 | #define alc_pin_mode_n_items(_dir) \ |
| 402 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 403 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 404 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 405 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 406 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 407 | unsigned int item_num = uinfo->value.enumerated.item; |
| 408 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 409 | |
| 410 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 411 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 412 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 413 | |
| 414 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 415 | item_num = alc_pin_mode_min(dir); |
| 416 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 417 | return 0; |
| 418 | } |
| 419 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 420 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 421 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 422 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 423 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 424 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 425 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 426 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 427 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 428 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 429 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 430 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 431 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 432 | /* Find enumerated value for current pinctl setting */ |
| 433 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 434 | 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] | 435 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 436 | *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] | 437 | return 0; |
| 438 | } |
| 439 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 440 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 441 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 442 | { |
| 443 | signed int change; |
| 444 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 445 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 446 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 447 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 448 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 449 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 450 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 451 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 452 | 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] | 453 | val = alc_pin_mode_min(dir); |
| 454 | |
| 455 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 456 | if (change) { |
| 457 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 458 | snd_hda_codec_write_cache(codec, nid, 0, |
| 459 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 460 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 461 | |
| 462 | /* Also enable the retasking pin's input/output as required |
| 463 | * for the requested pin mode. Enum values of 2 or less are |
| 464 | * input modes. |
| 465 | * |
| 466 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 467 | * reduces noise slightly (particularly on input) so we'll |
| 468 | * do it. However, having both input and output buffers |
| 469 | * enabled simultaneously doesn't seem to be problematic if |
| 470 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 471 | */ |
| 472 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 473 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 474 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 475 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 476 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 477 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 478 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 479 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 480 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 481 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 482 | } |
| 483 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 484 | return change; |
| 485 | } |
| 486 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 487 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 488 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 489 | .info = alc_pin_mode_info, \ |
| 490 | .get = alc_pin_mode_get, \ |
| 491 | .put = alc_pin_mode_put, \ |
| 492 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 493 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 494 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 495 | * together using a mask with more than one bit set. This control is |
| 496 | * currently used only by the ALC260 test model. At this stage they are not |
| 497 | * needed for any "production" models. |
| 498 | */ |
| 499 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 500 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 501 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 502 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 503 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 504 | { |
| 505 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 506 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 507 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 508 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 509 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 510 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 511 | |
| 512 | *valp = (val & mask) != 0; |
| 513 | return 0; |
| 514 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 515 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 516 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 517 | { |
| 518 | signed int change; |
| 519 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 520 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 521 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 522 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 523 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 524 | AC_VERB_GET_GPIO_DATA, |
| 525 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 526 | |
| 527 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 528 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 529 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 530 | gpio_data &= ~mask; |
| 531 | else |
| 532 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 533 | snd_hda_codec_write_cache(codec, nid, 0, |
| 534 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 535 | |
| 536 | return change; |
| 537 | } |
| 538 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 539 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 540 | .info = alc_gpio_data_info, \ |
| 541 | .get = alc_gpio_data_get, \ |
| 542 | .put = alc_gpio_data_put, \ |
| 543 | .private_value = nid | (mask<<16) } |
| 544 | #endif /* CONFIG_SND_DEBUG */ |
| 545 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 546 | /* A switch control to allow the enabling of the digital IO pins on the |
| 547 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 548 | * to provide something in the test model allowing digital outputs to be |
| 549 | * identified if present. If models are found which can utilise these |
| 550 | * outputs a more complete mixer control can be devised for those models if |
| 551 | * necessary. |
| 552 | */ |
| 553 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 554 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 555 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 556 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 557 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 558 | { |
| 559 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 560 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 561 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 562 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 563 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 564 | AC_VERB_GET_DIGI_CONVERT, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 565 | |
| 566 | *valp = (val & mask) != 0; |
| 567 | return 0; |
| 568 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 569 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 570 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 571 | { |
| 572 | signed int change; |
| 573 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 574 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 575 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 576 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 577 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 578 | AC_VERB_GET_DIGI_CONVERT, |
| 579 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 580 | |
| 581 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 582 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 583 | if (val==0) |
| 584 | ctrl_data &= ~mask; |
| 585 | else |
| 586 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 587 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 588 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 589 | |
| 590 | return change; |
| 591 | } |
| 592 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 593 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 594 | .info = alc_spdif_ctrl_info, \ |
| 595 | .get = alc_spdif_ctrl_get, \ |
| 596 | .put = alc_spdif_ctrl_put, \ |
| 597 | .private_value = nid | (mask<<16) } |
| 598 | #endif /* CONFIG_SND_DEBUG */ |
| 599 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 600 | /* |
| 601 | * set up from the preset table |
| 602 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 603 | static void setup_preset(struct alc_spec *spec, |
| 604 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 605 | { |
| 606 | int i; |
| 607 | |
| 608 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 609 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 610 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 611 | i++) |
| 612 | spec->init_verbs[spec->num_init_verbs++] = |
| 613 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 614 | |
| 615 | spec->channel_mode = preset->channel_mode; |
| 616 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 617 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 618 | |
| 619 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 620 | |
| 621 | spec->multiout.num_dacs = preset->num_dacs; |
| 622 | spec->multiout.dac_nids = preset->dac_nids; |
| 623 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 624 | spec->multiout.hp_nid = preset->hp_nid; |
| 625 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 626 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 627 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 628 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 629 | spec->input_mux = preset->input_mux; |
| 630 | |
| 631 | spec->num_adc_nids = preset->num_adc_nids; |
| 632 | spec->adc_nids = preset->adc_nids; |
| 633 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 634 | |
| 635 | spec->unsol_event = preset->unsol_event; |
| 636 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 637 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 638 | spec->loopback.amplist = preset->loopbacks; |
| 639 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 640 | } |
| 641 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 642 | /* Enable GPIO mask and set output */ |
| 643 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 644 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 645 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 646 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 647 | { } |
| 648 | }; |
| 649 | |
| 650 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 651 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 652 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 653 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 654 | { } |
| 655 | }; |
| 656 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 657 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 658 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 659 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 660 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 661 | { } |
| 662 | }; |
| 663 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 664 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 665 | * 31 ~ 16 : Manufacture ID |
| 666 | * 15 ~ 8 : SKU ID |
| 667 | * 7 ~ 0 : Assembly ID |
| 668 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 669 | */ |
| 670 | static void alc_subsystem_id(struct hda_codec *codec, |
| 671 | unsigned int porta, unsigned int porte, |
| 672 | unsigned int portd) |
| 673 | { |
| 674 | unsigned int ass, tmp; |
| 675 | |
| 676 | ass = codec->subsystem_id; |
| 677 | if (!(ass & 1)) |
| 678 | return; |
| 679 | |
| 680 | /* Override */ |
| 681 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 682 | switch (tmp) { |
| 683 | case 1: |
| 684 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 685 | break; |
| 686 | case 3: |
| 687 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 688 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 689 | case 7: |
| 690 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 691 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 692 | case 5: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 693 | switch (codec->vendor_id) { |
| 694 | case 0x10ec0862: |
| 695 | case 0x10ec0660: |
| 696 | case 0x10ec0662: |
| 697 | case 0x10ec0267: |
| 698 | case 0x10ec0268: |
| 699 | snd_hda_codec_write(codec, 0x14, 0, |
| 700 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 701 | snd_hda_codec_write(codec, 0x15, 0, |
| 702 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 703 | return; |
| 704 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 705 | case 6: |
| 706 | if (ass & 4) { /* bit 2 : 0 = Desktop, 1 = Laptop */ |
| 707 | hda_nid_t port = 0; |
| 708 | tmp = (ass & 0x1800) >> 11; |
| 709 | switch (tmp) { |
| 710 | case 0: port = porta; break; |
| 711 | case 1: port = porte; break; |
| 712 | case 2: port = portd; break; |
| 713 | } |
| 714 | if (port) |
| 715 | snd_hda_codec_write(codec, port, 0, |
| 716 | AC_VERB_SET_EAPD_BTLENABLE, |
| 717 | 2); |
| 718 | } |
| 719 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 720 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, |
| 721 | (tmp == 5 ? 0x3040 : 0x3050)); |
| 722 | break; |
| 723 | } |
| 724 | } |
| 725 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 726 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 727 | * Fix-up pin default configurations |
| 728 | */ |
| 729 | |
| 730 | struct alc_pincfg { |
| 731 | hda_nid_t nid; |
| 732 | u32 val; |
| 733 | }; |
| 734 | |
| 735 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 736 | const struct snd_pci_quirk *quirk, |
| 737 | const struct alc_pincfg **pinfix) |
| 738 | { |
| 739 | const struct alc_pincfg *cfg; |
| 740 | |
| 741 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 742 | if (!quirk) |
| 743 | return; |
| 744 | |
| 745 | cfg = pinfix[quirk->value]; |
| 746 | for (; cfg->nid; cfg++) { |
| 747 | int i; |
| 748 | u32 val = cfg->val; |
| 749 | for (i = 0; i < 4; i++) { |
| 750 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 751 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 752 | val & 0xff); |
| 753 | val >>= 8; |
| 754 | } |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 759 | * ALC880 3-stack model |
| 760 | * |
| 761 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 762 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 763 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 764 | */ |
| 765 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 766 | static hda_nid_t alc880_dac_nids[4] = { |
| 767 | /* front, rear, clfe, rear_surr */ |
| 768 | 0x02, 0x05, 0x04, 0x03 |
| 769 | }; |
| 770 | |
| 771 | static hda_nid_t alc880_adc_nids[3] = { |
| 772 | /* ADC0-2 */ |
| 773 | 0x07, 0x08, 0x09, |
| 774 | }; |
| 775 | |
| 776 | /* The datasheet says the node 0x07 is connected from inputs, |
| 777 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 778 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 779 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 780 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 781 | /* ADC1-2 */ |
| 782 | 0x08, 0x09, |
| 783 | }; |
| 784 | |
| 785 | #define ALC880_DIGOUT_NID 0x06 |
| 786 | #define ALC880_DIGIN_NID 0x0a |
| 787 | |
| 788 | static struct hda_input_mux alc880_capture_source = { |
| 789 | .num_items = 4, |
| 790 | .items = { |
| 791 | { "Mic", 0x0 }, |
| 792 | { "Front Mic", 0x3 }, |
| 793 | { "Line", 0x2 }, |
| 794 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 795 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 796 | }; |
| 797 | |
| 798 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 799 | /* 2ch mode */ |
| 800 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 801 | /* set line-in to input, mute it */ |
| 802 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 803 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 804 | /* set mic-in to input vref 80%, mute it */ |
| 805 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 806 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 807 | { } /* end */ |
| 808 | }; |
| 809 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 810 | /* 6ch mode */ |
| 811 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 812 | /* set line-in to output, unmute it */ |
| 813 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 814 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 815 | /* set mic-in to output, unmute it */ |
| 816 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 817 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 818 | { } /* end */ |
| 819 | }; |
| 820 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 821 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 822 | { 2, alc880_threestack_ch2_init }, |
| 823 | { 6, alc880_threestack_ch6_init }, |
| 824 | }; |
| 825 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 826 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 827 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 828 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 829 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 830 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 831 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 832 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 833 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 834 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 835 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 836 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 837 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 838 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 840 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 841 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 842 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 843 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 844 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 845 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 846 | { |
| 847 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 848 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 849 | .info = alc_ch_mode_info, |
| 850 | .get = alc_ch_mode_get, |
| 851 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 852 | }, |
| 853 | { } /* end */ |
| 854 | }; |
| 855 | |
| 856 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 857 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 858 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 859 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 860 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 861 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 862 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 863 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 864 | { |
| 865 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 866 | /* The multiple "Capture Source" controls confuse alsamixer |
| 867 | * So call somewhat different.. |
| 868 | * FIXME: the controls appear in the "playback" view! |
| 869 | */ |
| 870 | /* .name = "Capture Source", */ |
| 871 | .name = "Input Source", |
| 872 | .count = 3, |
| 873 | .info = alc_mux_enum_info, |
| 874 | .get = alc_mux_enum_get, |
| 875 | .put = alc_mux_enum_put, |
| 876 | }, |
| 877 | { } /* end */ |
| 878 | }; |
| 879 | |
| 880 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 881 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 882 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 883 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 884 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 885 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 886 | { |
| 887 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 888 | /* The multiple "Capture Source" controls confuse alsamixer |
| 889 | * So call somewhat different.. |
| 890 | * FIXME: the controls appear in the "playback" view! |
| 891 | */ |
| 892 | /* .name = "Capture Source", */ |
| 893 | .name = "Input Source", |
| 894 | .count = 2, |
| 895 | .info = alc_mux_enum_info, |
| 896 | .get = alc_mux_enum_get, |
| 897 | .put = alc_mux_enum_put, |
| 898 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 899 | { } /* end */ |
| 900 | }; |
| 901 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 902 | |
| 903 | |
| 904 | /* |
| 905 | * ALC880 5-stack model |
| 906 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 907 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 908 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 909 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 910 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 911 | */ |
| 912 | |
| 913 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 914 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 915 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 916 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 917 | { } /* end */ |
| 918 | }; |
| 919 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 920 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 921 | /* 6ch mode */ |
| 922 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 923 | /* set line-in to input, mute it */ |
| 924 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 925 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 926 | { } /* end */ |
| 927 | }; |
| 928 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 929 | /* 8ch mode */ |
| 930 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 931 | /* set line-in to output, unmute it */ |
| 932 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 933 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 934 | { } /* end */ |
| 935 | }; |
| 936 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 937 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 938 | { 6, alc880_fivestack_ch6_init }, |
| 939 | { 8, alc880_fivestack_ch8_init }, |
| 940 | }; |
| 941 | |
| 942 | |
| 943 | /* |
| 944 | * ALC880 6-stack model |
| 945 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 946 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 947 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 948 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 949 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 950 | */ |
| 951 | |
| 952 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 953 | /* front, rear, clfe, rear_surr */ |
| 954 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 955 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 956 | |
| 957 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 958 | .num_items = 4, |
| 959 | .items = { |
| 960 | { "Mic", 0x0 }, |
| 961 | { "Front Mic", 0x1 }, |
| 962 | { "Line", 0x2 }, |
| 963 | { "CD", 0x4 }, |
| 964 | }, |
| 965 | }; |
| 966 | |
| 967 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 968 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 969 | { 8, NULL }, |
| 970 | }; |
| 971 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 972 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 973 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 974 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 975 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 976 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 977 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 978 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 979 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 980 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 981 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 982 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 983 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 984 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 985 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 986 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 987 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 988 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 989 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 990 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 991 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 992 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 993 | { |
| 994 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 995 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 996 | .info = alc_ch_mode_info, |
| 997 | .get = alc_ch_mode_get, |
| 998 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 999 | }, |
| 1000 | { } /* end */ |
| 1001 | }; |
| 1002 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1003 | |
| 1004 | /* |
| 1005 | * ALC880 W810 model |
| 1006 | * |
| 1007 | * W810 has rear IO for: |
| 1008 | * Front (DAC 02) |
| 1009 | * Surround (DAC 03) |
| 1010 | * Center/LFE (DAC 04) |
| 1011 | * Digital out (06) |
| 1012 | * |
| 1013 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1014 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1015 | * |
| 1016 | * There is a variable resistor to control the speaker or headphone |
| 1017 | * volume. This is a hardware-only device without a software API. |
| 1018 | * |
| 1019 | * Plugging headphones in will disable the internal speakers. This is |
| 1020 | * implemented in hardware, not via the driver using jack sense. In |
| 1021 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1022 | * disable both the speakers and headphones. |
| 1023 | * |
| 1024 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1025 | * These may not do anything useful with this driver yet, because I |
| 1026 | * haven't setup any initialization verbs for these yet... |
| 1027 | */ |
| 1028 | |
| 1029 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1030 | /* front, rear/surround, clfe */ |
| 1031 | 0x02, 0x03, 0x04 |
| 1032 | }; |
| 1033 | |
| 1034 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1035 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1036 | { 6, NULL } |
| 1037 | }; |
| 1038 | |
| 1039 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1040 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1041 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1042 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1043 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1044 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1045 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1046 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1047 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1048 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1049 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1050 | { } /* end */ |
| 1051 | }; |
| 1052 | |
| 1053 | |
| 1054 | /* |
| 1055 | * Z710V model |
| 1056 | * |
| 1057 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1058 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1059 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1060 | */ |
| 1061 | |
| 1062 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1063 | 0x02 |
| 1064 | }; |
| 1065 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1066 | |
| 1067 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1068 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1069 | { 2, NULL } |
| 1070 | }; |
| 1071 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1072 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1073 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1074 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1075 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1076 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1077 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1078 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1081 | { } /* end */ |
| 1082 | }; |
| 1083 | |
| 1084 | |
| 1085 | /* FIXME! */ |
| 1086 | /* |
| 1087 | * ALC880 F1734 model |
| 1088 | * |
| 1089 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1090 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1091 | */ |
| 1092 | |
| 1093 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1094 | 0x03 |
| 1095 | }; |
| 1096 | #define ALC880_F1734_HP_DAC 0x02 |
| 1097 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1098 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1099 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1100 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1101 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1102 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1103 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1104 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1106 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1107 | { } /* end */ |
| 1108 | }; |
| 1109 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1110 | |
| 1111 | /* FIXME! */ |
| 1112 | /* |
| 1113 | * ALC880 ASUS model |
| 1114 | * |
| 1115 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1116 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1117 | * Mic = 0x18, Line = 0x1a |
| 1118 | */ |
| 1119 | |
| 1120 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1121 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1122 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1123 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1124 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1125 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1126 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1127 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1128 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1129 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1130 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1131 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1132 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1133 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1134 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1135 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1138 | { |
| 1139 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1140 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1141 | .info = alc_ch_mode_info, |
| 1142 | .get = alc_ch_mode_get, |
| 1143 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1144 | }, |
| 1145 | { } /* end */ |
| 1146 | }; |
| 1147 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1148 | /* FIXME! */ |
| 1149 | /* |
| 1150 | * ALC880 ASUS W1V model |
| 1151 | * |
| 1152 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1153 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1154 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1155 | */ |
| 1156 | |
| 1157 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1158 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1159 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1160 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1161 | { } /* end */ |
| 1162 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1163 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1164 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1165 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1166 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1167 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1168 | { } /* end */ |
| 1169 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1170 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1171 | /* TCL S700 */ |
| 1172 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1173 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1174 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1175 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1176 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1177 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1179 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1180 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1181 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1182 | { |
| 1183 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1184 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1185 | * So call somewhat different.. |
| 1186 | * FIXME: the controls appear in the "playback" view! |
| 1187 | */ |
| 1188 | /* .name = "Capture Source", */ |
| 1189 | .name = "Input Source", |
| 1190 | .count = 1, |
| 1191 | .info = alc_mux_enum_info, |
| 1192 | .get = alc_mux_enum_get, |
| 1193 | .put = alc_mux_enum_put, |
| 1194 | }, |
| 1195 | { } /* end */ |
| 1196 | }; |
| 1197 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1198 | /* Uniwill */ |
| 1199 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
| 1200 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1201 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1202 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1203 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1204 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1205 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1206 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1207 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1208 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1209 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1210 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1211 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1212 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1213 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1214 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1215 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1216 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1217 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1218 | { |
| 1219 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1220 | .name = "Channel Mode", |
| 1221 | .info = alc_ch_mode_info, |
| 1222 | .get = alc_ch_mode_get, |
| 1223 | .put = alc_ch_mode_put, |
| 1224 | }, |
| 1225 | { } /* end */ |
| 1226 | }; |
| 1227 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1228 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1229 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1230 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1231 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1232 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1233 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1234 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1235 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1236 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1237 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1238 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1239 | { } /* end */ |
| 1240 | }; |
| 1241 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1242 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
| 1243 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1244 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1245 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1246 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1247 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1249 | { } /* end */ |
| 1250 | }; |
| 1251 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1252 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1253 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1254 | */ |
| 1255 | static int alc_build_controls(struct hda_codec *codec) |
| 1256 | { |
| 1257 | struct alc_spec *spec = codec->spec; |
| 1258 | int err; |
| 1259 | int i; |
| 1260 | |
| 1261 | for (i = 0; i < spec->num_mixers; i++) { |
| 1262 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1263 | if (err < 0) |
| 1264 | return err; |
| 1265 | } |
| 1266 | |
| 1267 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1268 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1269 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1270 | if (err < 0) |
| 1271 | return err; |
| 1272 | } |
| 1273 | if (spec->dig_in_nid) { |
| 1274 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1275 | if (err < 0) |
| 1276 | return err; |
| 1277 | } |
| 1278 | return 0; |
| 1279 | } |
| 1280 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1281 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1282 | /* |
| 1283 | * initialize the codec volumes, etc |
| 1284 | */ |
| 1285 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1286 | /* |
| 1287 | * generic initialization of ADC, input mixers and output mixers |
| 1288 | */ |
| 1289 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1290 | /* |
| 1291 | * Unmute ADC0-2 and set the default input to mic-in |
| 1292 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1293 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1294 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1295 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1296 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1297 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1298 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1299 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1300 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1301 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1302 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1303 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1304 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1305 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1306 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1307 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1311 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1312 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1313 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1314 | /* |
| 1315 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1316 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1317 | /* set vol=0 to output mixers */ |
| 1318 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1319 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1320 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1321 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1322 | /* set up input amps for analog loopback */ |
| 1323 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1326 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1327 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1328 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1329 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1330 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1331 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1332 | |
| 1333 | { } |
| 1334 | }; |
| 1335 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1336 | /* |
| 1337 | * 3-stack pin configuration: |
| 1338 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1339 | */ |
| 1340 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1341 | /* |
| 1342 | * preset connection lists of input pins |
| 1343 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1344 | */ |
| 1345 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1346 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1347 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1348 | |
| 1349 | /* |
| 1350 | * Set pin mode and muting |
| 1351 | */ |
| 1352 | /* set front pin widgets 0x14 for output */ |
| 1353 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1354 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1355 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1356 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1357 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1358 | /* Mic2 (as headphone out) for HP output */ |
| 1359 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1360 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1361 | /* Line In pin widget for input */ |
| 1362 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1363 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1364 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1365 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1366 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1367 | /* CD pin widget for input */ |
| 1368 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1369 | |
| 1370 | { } |
| 1371 | }; |
| 1372 | |
| 1373 | /* |
| 1374 | * 5-stack pin configuration: |
| 1375 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1376 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1377 | */ |
| 1378 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1379 | /* |
| 1380 | * preset connection lists of input pins |
| 1381 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1382 | */ |
| 1383 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1384 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1385 | |
| 1386 | /* |
| 1387 | * Set pin mode and muting |
| 1388 | */ |
| 1389 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1390 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1392 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1393 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1394 | /* unmute pins for output (no gain on this amp) */ |
| 1395 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1396 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1397 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1398 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1399 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1400 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1401 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1402 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1403 | /* Mic2 (as headphone out) for HP output */ |
| 1404 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1405 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1406 | /* Line In pin widget for input */ |
| 1407 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1408 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1409 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1410 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1411 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1412 | /* CD pin widget for input */ |
| 1413 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1414 | |
| 1415 | { } |
| 1416 | }; |
| 1417 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1418 | /* |
| 1419 | * W810 pin configuration: |
| 1420 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1421 | */ |
| 1422 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1423 | /* hphone/speaker input selector: front DAC */ |
| 1424 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1425 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1426 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1427 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1428 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1429 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1430 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1431 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1432 | |
| 1433 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1434 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1435 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1436 | { } |
| 1437 | }; |
| 1438 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1439 | /* |
| 1440 | * Z71V pin configuration: |
| 1441 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1442 | */ |
| 1443 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1444 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1445 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1446 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1447 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1448 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1449 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1450 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1451 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1452 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1453 | |
| 1454 | { } |
| 1455 | }; |
| 1456 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1457 | /* |
| 1458 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1459 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1460 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1461 | */ |
| 1462 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1463 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1464 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1465 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1466 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1467 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1468 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1469 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1470 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1471 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1472 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1473 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1474 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1475 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1476 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1477 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1478 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1479 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1480 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1481 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1482 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1483 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1484 | { } |
| 1485 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1486 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1487 | /* |
| 1488 | * Uniwill pin configuration: |
| 1489 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1490 | * line = 0x1a |
| 1491 | */ |
| 1492 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1493 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1494 | |
| 1495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1497 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1499 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1500 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1501 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1502 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1505 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1506 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1507 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1508 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1509 | |
| 1510 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1511 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1512 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1513 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1514 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1515 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1516 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1517 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1518 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1519 | |
| 1520 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1521 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1522 | |
| 1523 | { } |
| 1524 | }; |
| 1525 | |
| 1526 | /* |
| 1527 | * Uniwill P53 |
| 1528 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1529 | */ |
| 1530 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1531 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1532 | |
| 1533 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1534 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1535 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1536 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1537 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1538 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1539 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1540 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1541 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1542 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1543 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1544 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1545 | |
| 1546 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1547 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1548 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1549 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1550 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1551 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1552 | |
| 1553 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1554 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1555 | |
| 1556 | { } |
| 1557 | }; |
| 1558 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1559 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1560 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1561 | { } |
| 1562 | }; |
| 1563 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1564 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1565 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1566 | { |
| 1567 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1568 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1569 | |
| 1570 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1571 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1572 | bits = present ? HDA_AMP_MUTE : 0; |
| 1573 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1574 | HDA_AMP_MUTE, bits); |
| 1575 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1576 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1577 | } |
| 1578 | |
| 1579 | /* auto-toggle front mic */ |
| 1580 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1581 | { |
| 1582 | unsigned int present; |
| 1583 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1584 | |
| 1585 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1586 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1587 | bits = present ? HDA_AMP_MUTE : 0; |
| 1588 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1589 | } |
| 1590 | |
| 1591 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1592 | { |
| 1593 | alc880_uniwill_hp_automute(codec); |
| 1594 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1595 | } |
| 1596 | |
| 1597 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1598 | unsigned int res) |
| 1599 | { |
| 1600 | /* Looks like the unsol event is incompatible with the standard |
| 1601 | * definition. 4bit tag is placed at 28 bit! |
| 1602 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1603 | switch (res >> 28) { |
| 1604 | case ALC880_HP_EVENT: |
| 1605 | alc880_uniwill_hp_automute(codec); |
| 1606 | break; |
| 1607 | case ALC880_MIC_EVENT: |
| 1608 | alc880_uniwill_mic_automute(codec); |
| 1609 | break; |
| 1610 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1611 | } |
| 1612 | |
| 1613 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1614 | { |
| 1615 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1616 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1617 | |
| 1618 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1619 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1620 | bits = present ? HDA_AMP_MUTE : 0; |
| 1621 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 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, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1629 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1630 | present &= HDA_AMP_VOLMASK; |
| 1631 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1632 | HDA_AMP_VOLMASK, present); |
| 1633 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1634 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1635 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1636 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1637 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1638 | unsigned int res) |
| 1639 | { |
| 1640 | /* Looks like the unsol event is incompatible with the standard |
| 1641 | * definition. 4bit tag is placed at 28 bit! |
| 1642 | */ |
| 1643 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1644 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1645 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1646 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1647 | } |
| 1648 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1649 | /* FIXME! */ |
| 1650 | /* |
| 1651 | * F1734 pin configuration: |
| 1652 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1653 | */ |
| 1654 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1655 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1656 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1657 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1658 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1659 | |
| 1660 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1661 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1662 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1663 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1664 | |
| 1665 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1666 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1667 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1668 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1669 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1670 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1671 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1672 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1673 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1674 | |
| 1675 | { } |
| 1676 | }; |
| 1677 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1678 | /* FIXME! */ |
| 1679 | /* |
| 1680 | * ASUS pin configuration: |
| 1681 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1682 | */ |
| 1683 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1684 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1685 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1686 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1687 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1688 | |
| 1689 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1690 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1692 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1693 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1694 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1695 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1696 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1697 | |
| 1698 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1700 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1701 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1702 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1704 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1705 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1706 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1707 | |
| 1708 | { } |
| 1709 | }; |
| 1710 | |
| 1711 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1712 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1713 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1714 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1715 | /* Clevo m520g init */ |
| 1716 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1717 | /* headphone output */ |
| 1718 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1719 | /* line-out */ |
| 1720 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1721 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1722 | /* Line-in */ |
| 1723 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1724 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1725 | /* CD */ |
| 1726 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1727 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1728 | /* Mic1 (rear panel) */ |
| 1729 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1730 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1731 | /* Mic2 (front panel) */ |
| 1732 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1733 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1734 | /* headphone */ |
| 1735 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1736 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1737 | /* change to EAPD mode */ |
| 1738 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1739 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1740 | |
| 1741 | { } |
| 1742 | }; |
| 1743 | |
| 1744 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 1745 | /* change to EAPD mode */ |
| 1746 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1747 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1748 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1749 | /* Headphone output */ |
| 1750 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1751 | /* Front output*/ |
| 1752 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1753 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1754 | |
| 1755 | /* Line In pin widget for input */ |
| 1756 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1757 | /* CD pin widget for input */ |
| 1758 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1759 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1760 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1761 | |
| 1762 | /* change to EAPD mode */ |
| 1763 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1764 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 1765 | |
| 1766 | { } |
| 1767 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1768 | |
| 1769 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1770 | * LG m1 express dual |
| 1771 | * |
| 1772 | * Pin assignment: |
| 1773 | * Rear Line-In/Out (blue): 0x14 |
| 1774 | * Build-in Mic-In: 0x15 |
| 1775 | * Speaker-out: 0x17 |
| 1776 | * HP-Out (green): 0x1b |
| 1777 | * Mic-In/Out (red): 0x19 |
| 1778 | * SPDIF-Out: 0x1e |
| 1779 | */ |
| 1780 | |
| 1781 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 1782 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 1783 | 0x05, 0x02, 0x03 |
| 1784 | }; |
| 1785 | |
| 1786 | /* seems analog CD is not working */ |
| 1787 | static struct hda_input_mux alc880_lg_capture_source = { |
| 1788 | .num_items = 3, |
| 1789 | .items = { |
| 1790 | { "Mic", 0x1 }, |
| 1791 | { "Line", 0x5 }, |
| 1792 | { "Internal Mic", 0x6 }, |
| 1793 | }, |
| 1794 | }; |
| 1795 | |
| 1796 | /* 2,4,6 channel modes */ |
| 1797 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 1798 | /* set line-in and mic-in to input */ |
| 1799 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1800 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1801 | { } |
| 1802 | }; |
| 1803 | |
| 1804 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 1805 | /* set line-in to out and mic-in to input */ |
| 1806 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1807 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1808 | { } |
| 1809 | }; |
| 1810 | |
| 1811 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 1812 | /* set line-in and mic-in to output */ |
| 1813 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1814 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1815 | { } |
| 1816 | }; |
| 1817 | |
| 1818 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 1819 | { 2, alc880_lg_ch2_init }, |
| 1820 | { 4, alc880_lg_ch4_init }, |
| 1821 | { 6, alc880_lg_ch6_init }, |
| 1822 | }; |
| 1823 | |
| 1824 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 1825 | /* FIXME: it's not really "master" but front channels */ |
| 1826 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1827 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1828 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1829 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1830 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 1831 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 1832 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 1833 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 1834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1835 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1836 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 1837 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 1838 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 1839 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 1840 | { |
| 1841 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1842 | .name = "Channel Mode", |
| 1843 | .info = alc_ch_mode_info, |
| 1844 | .get = alc_ch_mode_get, |
| 1845 | .put = alc_ch_mode_put, |
| 1846 | }, |
| 1847 | { } /* end */ |
| 1848 | }; |
| 1849 | |
| 1850 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 1851 | /* set capture source to mic-in */ |
| 1852 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1853 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1854 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1855 | /* mute all amp mixer inputs */ |
| 1856 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1857 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1858 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1859 | /* line-in to input */ |
| 1860 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1861 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1862 | /* built-in mic */ |
| 1863 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1865 | /* speaker-out */ |
| 1866 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1867 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1868 | /* mic-in to input */ |
| 1869 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1870 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1871 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1872 | /* HP-out */ |
| 1873 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1874 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1875 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1876 | /* jack sense */ |
| 1877 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1878 | { } |
| 1879 | }; |
| 1880 | |
| 1881 | /* toggle speaker-output according to the hp-jack state */ |
| 1882 | static void alc880_lg_automute(struct hda_codec *codec) |
| 1883 | { |
| 1884 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1885 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1886 | |
| 1887 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1888 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1889 | bits = present ? HDA_AMP_MUTE : 0; |
| 1890 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 1891 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1892 | } |
| 1893 | |
| 1894 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1895 | { |
| 1896 | /* Looks like the unsol event is incompatible with the standard |
| 1897 | * definition. 4bit tag is placed at 28 bit! |
| 1898 | */ |
| 1899 | if ((res >> 28) == 0x01) |
| 1900 | alc880_lg_automute(codec); |
| 1901 | } |
| 1902 | |
| 1903 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1904 | * LG LW20 |
| 1905 | * |
| 1906 | * Pin assignment: |
| 1907 | * Speaker-out: 0x14 |
| 1908 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1909 | * Built-in Mic-In: 0x19 |
| 1910 | * Line-In: 0x1b |
| 1911 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1912 | * SPDIF-Out: 0x1e |
| 1913 | */ |
| 1914 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1915 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1916 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1917 | .items = { |
| 1918 | { "Mic", 0x0 }, |
| 1919 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 1920 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1921 | }, |
| 1922 | }; |
| 1923 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1924 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 1925 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1926 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1927 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1928 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1929 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1930 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1931 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1932 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1933 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1934 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1935 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1936 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1937 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1939 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 1940 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1941 | { |
| 1942 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1943 | .name = "Channel Mode", |
| 1944 | .info = alc_ch_mode_info, |
| 1945 | .get = alc_ch_mode_get, |
| 1946 | .put = alc_ch_mode_put, |
| 1947 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1948 | { } /* end */ |
| 1949 | }; |
| 1950 | |
| 1951 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 1952 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1953 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1954 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1955 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1956 | /* set capture source to mic-in */ |
| 1957 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1958 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1959 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1960 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1961 | /* speaker-out */ |
| 1962 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1963 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1964 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1965 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1966 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1967 | /* mic-in to input */ |
| 1968 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1969 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1970 | /* built-in mic */ |
| 1971 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1972 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1973 | /* jack sense */ |
| 1974 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1975 | { } |
| 1976 | }; |
| 1977 | |
| 1978 | /* toggle speaker-output according to the hp-jack state */ |
| 1979 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 1980 | { |
| 1981 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1982 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1983 | |
| 1984 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1985 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1986 | bits = present ? HDA_AMP_MUTE : 0; |
| 1987 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1988 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1989 | } |
| 1990 | |
| 1991 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1992 | { |
| 1993 | /* Looks like the unsol event is incompatible with the standard |
| 1994 | * definition. 4bit tag is placed at 28 bit! |
| 1995 | */ |
| 1996 | if ((res >> 28) == 0x01) |
| 1997 | alc880_lg_lw_automute(codec); |
| 1998 | } |
| 1999 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2000 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2001 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2002 | { 0x0b, HDA_INPUT, 0 }, |
| 2003 | { 0x0b, HDA_INPUT, 1 }, |
| 2004 | { 0x0b, HDA_INPUT, 2 }, |
| 2005 | { 0x0b, HDA_INPUT, 3 }, |
| 2006 | { 0x0b, HDA_INPUT, 4 }, |
| 2007 | { } /* end */ |
| 2008 | }; |
| 2009 | |
| 2010 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2011 | { 0x0b, HDA_INPUT, 1 }, |
| 2012 | { 0x0b, HDA_INPUT, 6 }, |
| 2013 | { 0x0b, HDA_INPUT, 7 }, |
| 2014 | { } /* end */ |
| 2015 | }; |
| 2016 | #endif |
| 2017 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2018 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2019 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2020 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2021 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2022 | static int alc_init(struct hda_codec *codec) |
| 2023 | { |
| 2024 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2025 | unsigned int i; |
| 2026 | |
| 2027 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2028 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2029 | |
| 2030 | if (spec->init_hook) |
| 2031 | spec->init_hook(codec); |
| 2032 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2033 | return 0; |
| 2034 | } |
| 2035 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2036 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2037 | { |
| 2038 | struct alc_spec *spec = codec->spec; |
| 2039 | |
| 2040 | if (spec->unsol_event) |
| 2041 | spec->unsol_event(codec, res); |
| 2042 | } |
| 2043 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2044 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2045 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2046 | { |
| 2047 | struct alc_spec *spec = codec->spec; |
| 2048 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2049 | } |
| 2050 | #endif |
| 2051 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2052 | /* |
| 2053 | * Analog playback callbacks |
| 2054 | */ |
| 2055 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2056 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2057 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2058 | { |
| 2059 | struct alc_spec *spec = codec->spec; |
| 2060 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2061 | } |
| 2062 | |
| 2063 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2064 | struct hda_codec *codec, |
| 2065 | unsigned int stream_tag, |
| 2066 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2067 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2068 | { |
| 2069 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2070 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2071 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2072 | } |
| 2073 | |
| 2074 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2075 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2076 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2077 | { |
| 2078 | struct alc_spec *spec = codec->spec; |
| 2079 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2080 | } |
| 2081 | |
| 2082 | /* |
| 2083 | * Digital out |
| 2084 | */ |
| 2085 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2086 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2087 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2088 | { |
| 2089 | struct alc_spec *spec = codec->spec; |
| 2090 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2091 | } |
| 2092 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2093 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2094 | struct hda_codec *codec, |
| 2095 | unsigned int stream_tag, |
| 2096 | unsigned int format, |
| 2097 | struct snd_pcm_substream *substream) |
| 2098 | { |
| 2099 | struct alc_spec *spec = codec->spec; |
| 2100 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2101 | stream_tag, format, substream); |
| 2102 | } |
| 2103 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2104 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2105 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2106 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2107 | { |
| 2108 | struct alc_spec *spec = codec->spec; |
| 2109 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2110 | } |
| 2111 | |
| 2112 | /* |
| 2113 | * Analog capture |
| 2114 | */ |
| 2115 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2116 | struct hda_codec *codec, |
| 2117 | unsigned int stream_tag, |
| 2118 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2119 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2120 | { |
| 2121 | struct alc_spec *spec = codec->spec; |
| 2122 | |
| 2123 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2124 | stream_tag, 0, format); |
| 2125 | return 0; |
| 2126 | } |
| 2127 | |
| 2128 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2129 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2130 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2131 | { |
| 2132 | struct alc_spec *spec = codec->spec; |
| 2133 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2134 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2135 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2136 | return 0; |
| 2137 | } |
| 2138 | |
| 2139 | |
| 2140 | /* |
| 2141 | */ |
| 2142 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2143 | .substreams = 1, |
| 2144 | .channels_min = 2, |
| 2145 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2146 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2147 | .ops = { |
| 2148 | .open = alc880_playback_pcm_open, |
| 2149 | .prepare = alc880_playback_pcm_prepare, |
| 2150 | .cleanup = alc880_playback_pcm_cleanup |
| 2151 | }, |
| 2152 | }; |
| 2153 | |
| 2154 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 2155 | .substreams = 2, |
| 2156 | .channels_min = 2, |
| 2157 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2158 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2159 | .ops = { |
| 2160 | .prepare = alc880_capture_pcm_prepare, |
| 2161 | .cleanup = alc880_capture_pcm_cleanup |
| 2162 | }, |
| 2163 | }; |
| 2164 | |
| 2165 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2166 | .substreams = 1, |
| 2167 | .channels_min = 2, |
| 2168 | .channels_max = 2, |
| 2169 | /* NID is set in alc_build_pcms */ |
| 2170 | .ops = { |
| 2171 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2172 | .close = alc880_dig_playback_pcm_close, |
| 2173 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2174 | }, |
| 2175 | }; |
| 2176 | |
| 2177 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2178 | .substreams = 1, |
| 2179 | .channels_min = 2, |
| 2180 | .channels_max = 2, |
| 2181 | /* NID is set in alc_build_pcms */ |
| 2182 | }; |
| 2183 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2184 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 2185 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 2186 | .substreams = 0, |
| 2187 | .channels_min = 0, |
| 2188 | .channels_max = 0, |
| 2189 | }; |
| 2190 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2191 | static int alc_build_pcms(struct hda_codec *codec) |
| 2192 | { |
| 2193 | struct alc_spec *spec = codec->spec; |
| 2194 | struct hda_pcm *info = spec->pcm_rec; |
| 2195 | int i; |
| 2196 | |
| 2197 | codec->num_pcms = 1; |
| 2198 | codec->pcm_info = info; |
| 2199 | |
| 2200 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2201 | if (spec->stream_analog_playback) { |
| 2202 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2203 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2204 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2205 | } |
| 2206 | if (spec->stream_analog_capture) { |
| 2207 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2208 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2209 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2210 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2211 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2212 | if (spec->channel_mode) { |
| 2213 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2214 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2215 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2216 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2217 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2218 | } |
| 2219 | } |
| 2220 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2221 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2222 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2223 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2224 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2225 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2226 | if (spec->multiout.dig_out_nid && |
| 2227 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2228 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2229 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2230 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2231 | if (spec->dig_in_nid && |
| 2232 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2233 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2234 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2235 | } |
| 2236 | } |
| 2237 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2238 | /* If the use of more than one ADC is requested for the current |
| 2239 | * model, configure a second analog capture-only PCM. |
| 2240 | */ |
| 2241 | /* Additional Analaog capture for index #2 */ |
| 2242 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2243 | spec->adc_nids) { |
| 2244 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2245 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2246 | info->name = spec->stream_name_analog; |
| 2247 | /* No playback stream for second PCM */ |
| 2248 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2249 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2250 | if (spec->stream_analog_capture) { |
| 2251 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2252 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2253 | } |
| 2254 | } |
| 2255 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2256 | return 0; |
| 2257 | } |
| 2258 | |
| 2259 | static void alc_free(struct hda_codec *codec) |
| 2260 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2261 | struct alc_spec *spec = codec->spec; |
| 2262 | unsigned int i; |
| 2263 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2264 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2265 | return; |
| 2266 | |
| 2267 | if (spec->kctl_alloc) { |
| 2268 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2269 | kfree(spec->kctl_alloc[i].name); |
| 2270 | kfree(spec->kctl_alloc); |
| 2271 | } |
| 2272 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2273 | } |
| 2274 | |
| 2275 | /* |
| 2276 | */ |
| 2277 | static struct hda_codec_ops alc_patch_ops = { |
| 2278 | .build_controls = alc_build_controls, |
| 2279 | .build_pcms = alc_build_pcms, |
| 2280 | .init = alc_init, |
| 2281 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2282 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2283 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2284 | .check_power_status = alc_check_power_status, |
| 2285 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2286 | }; |
| 2287 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2288 | |
| 2289 | /* |
| 2290 | * Test configuration for debugging |
| 2291 | * |
| 2292 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2293 | * enum controls. |
| 2294 | */ |
| 2295 | #ifdef CONFIG_SND_DEBUG |
| 2296 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2297 | 0x02, 0x03, 0x04, 0x05 |
| 2298 | }; |
| 2299 | |
| 2300 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2301 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2302 | .items = { |
| 2303 | { "In-1", 0x0 }, |
| 2304 | { "In-2", 0x1 }, |
| 2305 | { "In-3", 0x2 }, |
| 2306 | { "In-4", 0x3 }, |
| 2307 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2308 | { "Front", 0x5 }, |
| 2309 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2310 | }, |
| 2311 | }; |
| 2312 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2313 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2314 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2315 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2316 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2317 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2318 | }; |
| 2319 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2320 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2321 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2322 | { |
| 2323 | static char *texts[] = { |
| 2324 | "N/A", "Line Out", "HP Out", |
| 2325 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2326 | }; |
| 2327 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2328 | uinfo->count = 1; |
| 2329 | uinfo->value.enumerated.items = 8; |
| 2330 | if (uinfo->value.enumerated.item >= 8) |
| 2331 | uinfo->value.enumerated.item = 7; |
| 2332 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2333 | return 0; |
| 2334 | } |
| 2335 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2336 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2337 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2338 | { |
| 2339 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2340 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2341 | unsigned int pin_ctl, item = 0; |
| 2342 | |
| 2343 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2344 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2345 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2346 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2347 | item = 2; |
| 2348 | else |
| 2349 | item = 1; |
| 2350 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2351 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2352 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2353 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2354 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2355 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2356 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2357 | } |
| 2358 | } |
| 2359 | ucontrol->value.enumerated.item[0] = item; |
| 2360 | return 0; |
| 2361 | } |
| 2362 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2363 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2364 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2365 | { |
| 2366 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2367 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2368 | static unsigned int ctls[] = { |
| 2369 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2370 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2371 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2372 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2373 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2374 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2375 | }; |
| 2376 | unsigned int old_ctl, new_ctl; |
| 2377 | |
| 2378 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2379 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2380 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2381 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2382 | int val; |
| 2383 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2384 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2385 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2386 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2387 | HDA_AMP_MUTE : 0; |
| 2388 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2389 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2390 | return 1; |
| 2391 | } |
| 2392 | return 0; |
| 2393 | } |
| 2394 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2395 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2396 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2397 | { |
| 2398 | static char *texts[] = { |
| 2399 | "Front", "Surround", "CLFE", "Side" |
| 2400 | }; |
| 2401 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2402 | uinfo->count = 1; |
| 2403 | uinfo->value.enumerated.items = 4; |
| 2404 | if (uinfo->value.enumerated.item >= 4) |
| 2405 | uinfo->value.enumerated.item = 3; |
| 2406 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2407 | return 0; |
| 2408 | } |
| 2409 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2410 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2411 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2412 | { |
| 2413 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2414 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2415 | unsigned int sel; |
| 2416 | |
| 2417 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2418 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2419 | return 0; |
| 2420 | } |
| 2421 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2422 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2423 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2424 | { |
| 2425 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2426 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2427 | unsigned int sel; |
| 2428 | |
| 2429 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2430 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2431 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2432 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2433 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2434 | return 1; |
| 2435 | } |
| 2436 | return 0; |
| 2437 | } |
| 2438 | |
| 2439 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2440 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2441 | .name = xname, \ |
| 2442 | .info = alc_test_pin_ctl_info, \ |
| 2443 | .get = alc_test_pin_ctl_get, \ |
| 2444 | .put = alc_test_pin_ctl_put, \ |
| 2445 | .private_value = nid \ |
| 2446 | } |
| 2447 | |
| 2448 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2449 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2450 | .name = xname, \ |
| 2451 | .info = alc_test_pin_src_info, \ |
| 2452 | .get = alc_test_pin_src_get, \ |
| 2453 | .put = alc_test_pin_src_put, \ |
| 2454 | .private_value = nid \ |
| 2455 | } |
| 2456 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2457 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2458 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2459 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2460 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2461 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2462 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2463 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2464 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2465 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2466 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2467 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2468 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2469 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2470 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2471 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2472 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2473 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2474 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2475 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2476 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2477 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2478 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2479 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2480 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2481 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2482 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2483 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2484 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2485 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2486 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2487 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2488 | { |
| 2489 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2490 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2491 | .info = alc_ch_mode_info, |
| 2492 | .get = alc_ch_mode_get, |
| 2493 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2494 | }, |
| 2495 | { } /* end */ |
| 2496 | }; |
| 2497 | |
| 2498 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2499 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2500 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2501 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2502 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2503 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2504 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2505 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2506 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2507 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2508 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2509 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2510 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2511 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2512 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2513 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2514 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2515 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2516 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2517 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2518 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2519 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2521 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2522 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2523 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2524 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2525 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2526 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2527 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2528 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2529 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2530 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2531 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2532 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2533 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2534 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2535 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2536 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2537 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2538 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2539 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2540 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2541 | /* Analog input/passthru */ |
| 2542 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2543 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2544 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2545 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2546 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2547 | { } |
| 2548 | }; |
| 2549 | #endif |
| 2550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2551 | /* |
| 2552 | */ |
| 2553 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2554 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2555 | [ALC880_3ST] = "3stack", |
| 2556 | [ALC880_TCL_S700] = "tcl", |
| 2557 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2558 | [ALC880_CLEVO] = "clevo", |
| 2559 | [ALC880_5ST] = "5stack", |
| 2560 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2561 | [ALC880_W810] = "w810", |
| 2562 | [ALC880_Z71V] = "z71v", |
| 2563 | [ALC880_6ST] = "6stack", |
| 2564 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2565 | [ALC880_ASUS] = "asus", |
| 2566 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2567 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2568 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2569 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2570 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2571 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2572 | [ALC880_F1734] = "F1734", |
| 2573 | [ALC880_LG] = "lg", |
| 2574 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2575 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2576 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2577 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2578 | [ALC880_AUTO] = "auto", |
| 2579 | }; |
| 2580 | |
| 2581 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
| 2582 | /* Broken BIOS configuration */ |
| 2583 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), |
| 2584 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2585 | |
| 2586 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2587 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
Tobin Davis | 4dc53e2 | 2006-12-18 13:24:37 +0100 | [diff] [blame] | 2588 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2589 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2590 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2591 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2592 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2593 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2594 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
| 2595 | |
| 2596 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2597 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
| 2598 | |
| 2599 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2600 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2601 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2602 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2603 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2604 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2605 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2606 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2607 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2608 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2609 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2610 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2611 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2612 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
| 2613 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), |
| 2614 | |
| 2615 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2616 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
| 2617 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2618 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
| 2619 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
| 2620 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2621 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
| 2622 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
| 2623 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2624 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
| 2625 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2626 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2627 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
| 2628 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2629 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2630 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2631 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
| 2632 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
| 2633 | |
| 2634 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
| 2635 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2636 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
| 2637 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
| 2638 | |
| 2639 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
| 2640 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
| 2641 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2642 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2643 | |
| 2644 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2645 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
| 2646 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
| 2647 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
| 2648 | |
| 2649 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
| 2650 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2651 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
| 2652 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2653 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
| 2654 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
| 2655 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2656 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2657 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
| 2658 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
| 2659 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2660 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2661 | {} |
| 2662 | }; |
| 2663 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2664 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2665 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2666 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2667 | static struct alc_config_preset alc880_presets[] = { |
| 2668 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2669 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2670 | .init_verbs = { alc880_volume_init_verbs, |
| 2671 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2672 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2673 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2674 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2675 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2676 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2677 | .input_mux = &alc880_capture_source, |
| 2678 | }, |
| 2679 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2680 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2681 | .init_verbs = { alc880_volume_init_verbs, |
| 2682 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2683 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2684 | .dac_nids = alc880_dac_nids, |
| 2685 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2686 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2687 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2688 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2689 | .input_mux = &alc880_capture_source, |
| 2690 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2691 | [ALC880_TCL_S700] = { |
| 2692 | .mixers = { alc880_tcl_s700_mixer }, |
| 2693 | .init_verbs = { alc880_volume_init_verbs, |
| 2694 | alc880_pin_tcl_S700_init_verbs, |
| 2695 | alc880_gpio2_init_verbs }, |
| 2696 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2697 | .dac_nids = alc880_dac_nids, |
| 2698 | .hp_nid = 0x03, |
| 2699 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2700 | .channel_mode = alc880_2_jack_modes, |
| 2701 | .input_mux = &alc880_capture_source, |
| 2702 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2703 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2704 | .mixers = { alc880_three_stack_mixer, |
| 2705 | alc880_five_stack_mixer}, |
| 2706 | .init_verbs = { alc880_volume_init_verbs, |
| 2707 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2708 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2709 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2710 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2711 | .channel_mode = alc880_fivestack_modes, |
| 2712 | .input_mux = &alc880_capture_source, |
| 2713 | }, |
| 2714 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2715 | .mixers = { alc880_three_stack_mixer, |
| 2716 | alc880_five_stack_mixer }, |
| 2717 | .init_verbs = { alc880_volume_init_verbs, |
| 2718 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2719 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2720 | .dac_nids = alc880_dac_nids, |
| 2721 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2722 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2723 | .channel_mode = alc880_fivestack_modes, |
| 2724 | .input_mux = &alc880_capture_source, |
| 2725 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2726 | [ALC880_6ST] = { |
| 2727 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2728 | .init_verbs = { alc880_volume_init_verbs, |
| 2729 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2730 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2731 | .dac_nids = alc880_6st_dac_nids, |
| 2732 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2733 | .channel_mode = alc880_sixstack_modes, |
| 2734 | .input_mux = &alc880_6stack_capture_source, |
| 2735 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2736 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2737 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2738 | .init_verbs = { alc880_volume_init_verbs, |
| 2739 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2740 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2741 | .dac_nids = alc880_6st_dac_nids, |
| 2742 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2743 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2744 | .channel_mode = alc880_sixstack_modes, |
| 2745 | .input_mux = &alc880_6stack_capture_source, |
| 2746 | }, |
| 2747 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2748 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2749 | .init_verbs = { alc880_volume_init_verbs, |
| 2750 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2751 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2752 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 2753 | .dac_nids = alc880_w810_dac_nids, |
| 2754 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2755 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2756 | .channel_mode = alc880_w810_modes, |
| 2757 | .input_mux = &alc880_capture_source, |
| 2758 | }, |
| 2759 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2760 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2761 | .init_verbs = { alc880_volume_init_verbs, |
| 2762 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2763 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 2764 | .dac_nids = alc880_z71v_dac_nids, |
| 2765 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2766 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2767 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2768 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2769 | .input_mux = &alc880_capture_source, |
| 2770 | }, |
| 2771 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2772 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2773 | .init_verbs = { alc880_volume_init_verbs, |
| 2774 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2775 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 2776 | .dac_nids = alc880_f1734_dac_nids, |
| 2777 | .hp_nid = 0x02, |
| 2778 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2779 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2780 | .input_mux = &alc880_capture_source, |
| 2781 | }, |
| 2782 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2783 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2784 | .init_verbs = { alc880_volume_init_verbs, |
| 2785 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2786 | alc880_gpio1_init_verbs }, |
| 2787 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2788 | .dac_nids = alc880_asus_dac_nids, |
| 2789 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2790 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2791 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2792 | .input_mux = &alc880_capture_source, |
| 2793 | }, |
| 2794 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2795 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2796 | .init_verbs = { alc880_volume_init_verbs, |
| 2797 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2798 | alc880_gpio1_init_verbs }, |
| 2799 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2800 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2801 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2802 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2803 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2804 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2805 | .input_mux = &alc880_capture_source, |
| 2806 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2807 | [ALC880_ASUS_DIG2] = { |
| 2808 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2809 | .init_verbs = { alc880_volume_init_verbs, |
| 2810 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2811 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 2812 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2813 | .dac_nids = alc880_asus_dac_nids, |
| 2814 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2815 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2816 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2817 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2818 | .input_mux = &alc880_capture_source, |
| 2819 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2820 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2821 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2822 | .init_verbs = { alc880_volume_init_verbs, |
| 2823 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2824 | alc880_gpio1_init_verbs }, |
| 2825 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2826 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2827 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2828 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2829 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2830 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2831 | .input_mux = &alc880_capture_source, |
| 2832 | }, |
| 2833 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 2834 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2835 | .init_verbs = { alc880_volume_init_verbs, |
| 2836 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2837 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2838 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2839 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2840 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2841 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2842 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2843 | .input_mux = &alc880_capture_source, |
| 2844 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2845 | [ALC880_UNIWILL] = { |
| 2846 | .mixers = { alc880_uniwill_mixer }, |
| 2847 | .init_verbs = { alc880_volume_init_verbs, |
| 2848 | alc880_uniwill_init_verbs }, |
| 2849 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2850 | .dac_nids = alc880_asus_dac_nids, |
| 2851 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2852 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2853 | .channel_mode = alc880_threestack_modes, |
| 2854 | .need_dac_fix = 1, |
| 2855 | .input_mux = &alc880_capture_source, |
| 2856 | .unsol_event = alc880_uniwill_unsol_event, |
| 2857 | .init_hook = alc880_uniwill_automute, |
| 2858 | }, |
| 2859 | [ALC880_UNIWILL_P53] = { |
| 2860 | .mixers = { alc880_uniwill_p53_mixer }, |
| 2861 | .init_verbs = { alc880_volume_init_verbs, |
| 2862 | alc880_uniwill_p53_init_verbs }, |
| 2863 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2864 | .dac_nids = alc880_asus_dac_nids, |
| 2865 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2866 | .channel_mode = alc880_threestack_modes, |
| 2867 | .input_mux = &alc880_capture_source, |
| 2868 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2869 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2870 | }, |
| 2871 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2872 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2873 | alc880_pcbeep_mixer, }, |
| 2874 | .init_verbs = { alc880_volume_init_verbs, |
| 2875 | alc880_uniwill_p53_init_verbs, |
| 2876 | alc880_beep_init_verbs }, |
| 2877 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2878 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 2879 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2880 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2881 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2882 | .input_mux = &alc880_capture_source, |
| 2883 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2884 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2885 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2886 | [ALC880_CLEVO] = { |
| 2887 | .mixers = { alc880_three_stack_mixer }, |
| 2888 | .init_verbs = { alc880_volume_init_verbs, |
| 2889 | alc880_pin_clevo_init_verbs }, |
| 2890 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2891 | .dac_nids = alc880_dac_nids, |
| 2892 | .hp_nid = 0x03, |
| 2893 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2894 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2895 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2896 | .input_mux = &alc880_capture_source, |
| 2897 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2898 | [ALC880_LG] = { |
| 2899 | .mixers = { alc880_lg_mixer }, |
| 2900 | .init_verbs = { alc880_volume_init_verbs, |
| 2901 | alc880_lg_init_verbs }, |
| 2902 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 2903 | .dac_nids = alc880_lg_dac_nids, |
| 2904 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2905 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 2906 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2907 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2908 | .input_mux = &alc880_lg_capture_source, |
| 2909 | .unsol_event = alc880_lg_unsol_event, |
| 2910 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2911 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2912 | .loopbacks = alc880_lg_loopbacks, |
| 2913 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2914 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2915 | [ALC880_LG_LW] = { |
| 2916 | .mixers = { alc880_lg_lw_mixer }, |
| 2917 | .init_verbs = { alc880_volume_init_verbs, |
| 2918 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2919 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2920 | .dac_nids = alc880_dac_nids, |
| 2921 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2922 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 2923 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2924 | .input_mux = &alc880_lg_lw_capture_source, |
| 2925 | .unsol_event = alc880_lg_lw_unsol_event, |
| 2926 | .init_hook = alc880_lg_lw_automute, |
| 2927 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2928 | #ifdef CONFIG_SND_DEBUG |
| 2929 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2930 | .mixers = { alc880_test_mixer }, |
| 2931 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2932 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 2933 | .dac_nids = alc880_test_dac_nids, |
| 2934 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2935 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 2936 | .channel_mode = alc880_test_modes, |
| 2937 | .input_mux = &alc880_test_capture_source, |
| 2938 | }, |
| 2939 | #endif |
| 2940 | }; |
| 2941 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2942 | /* |
| 2943 | * Automatic parse of I/O pins from the BIOS configuration |
| 2944 | */ |
| 2945 | |
| 2946 | #define NUM_CONTROL_ALLOC 32 |
| 2947 | #define NUM_VERB_ALLOC 32 |
| 2948 | |
| 2949 | enum { |
| 2950 | ALC_CTL_WIDGET_VOL, |
| 2951 | ALC_CTL_WIDGET_MUTE, |
| 2952 | ALC_CTL_BIND_MUTE, |
| 2953 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2954 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2955 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2956 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2957 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2958 | }; |
| 2959 | |
| 2960 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2961 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 2962 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2963 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2964 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2965 | |
| 2966 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 2967 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 2968 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2969 | /* array + terminator */ |
| 2970 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 2971 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2972 | return -ENOMEM; |
| 2973 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2974 | memcpy(knew, spec->kctl_alloc, |
| 2975 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2976 | kfree(spec->kctl_alloc); |
| 2977 | } |
| 2978 | spec->kctl_alloc = knew; |
| 2979 | spec->num_kctl_alloc = num; |
| 2980 | } |
| 2981 | |
| 2982 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 2983 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 2984 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2985 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2986 | return -ENOMEM; |
| 2987 | knew->private_value = val; |
| 2988 | spec->num_kctl_used++; |
| 2989 | return 0; |
| 2990 | } |
| 2991 | |
| 2992 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 2993 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 2994 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 2995 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 2996 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 2997 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 2998 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 2999 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3000 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3001 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3002 | #define ALC880_PIN_CD_NID 0x1c |
| 3003 | |
| 3004 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3005 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3006 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3007 | { |
| 3008 | hda_nid_t nid; |
| 3009 | int assigned[4]; |
| 3010 | int i, j; |
| 3011 | |
| 3012 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3013 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3014 | |
| 3015 | /* check the pins hardwired to audio widget */ |
| 3016 | for (i = 0; i < cfg->line_outs; i++) { |
| 3017 | nid = cfg->line_out_pins[i]; |
| 3018 | if (alc880_is_fixed_pin(nid)) { |
| 3019 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3020 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3021 | assigned[idx] = 1; |
| 3022 | } |
| 3023 | } |
| 3024 | /* left pins can be connect to any audio widget */ |
| 3025 | for (i = 0; i < cfg->line_outs; i++) { |
| 3026 | nid = cfg->line_out_pins[i]; |
| 3027 | if (alc880_is_fixed_pin(nid)) |
| 3028 | continue; |
| 3029 | /* search for an empty channel */ |
| 3030 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3031 | if (!assigned[j]) { |
| 3032 | spec->multiout.dac_nids[i] = |
| 3033 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3034 | assigned[j] = 1; |
| 3035 | break; |
| 3036 | } |
| 3037 | } |
| 3038 | } |
| 3039 | spec->multiout.num_dacs = cfg->line_outs; |
| 3040 | return 0; |
| 3041 | } |
| 3042 | |
| 3043 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3044 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3045 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3046 | { |
| 3047 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3048 | static const char *chname[4] = { |
| 3049 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3050 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3051 | hda_nid_t nid; |
| 3052 | int i, err; |
| 3053 | |
| 3054 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3055 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3056 | continue; |
| 3057 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3058 | if (i == 2) { |
| 3059 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3060 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3061 | "Center Playback Volume", |
| 3062 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3063 | HDA_OUTPUT)); |
| 3064 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3065 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3066 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3067 | "LFE Playback Volume", |
| 3068 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3069 | HDA_OUTPUT)); |
| 3070 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3071 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3072 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3073 | "Center Playback Switch", |
| 3074 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3075 | HDA_INPUT)); |
| 3076 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3077 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3078 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3079 | "LFE Playback Switch", |
| 3080 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3081 | HDA_INPUT)); |
| 3082 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3083 | return err; |
| 3084 | } else { |
| 3085 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3086 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3087 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3088 | HDA_OUTPUT)); |
| 3089 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3090 | return err; |
| 3091 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3092 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3093 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3094 | HDA_INPUT)); |
| 3095 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3096 | return err; |
| 3097 | } |
| 3098 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3099 | return 0; |
| 3100 | } |
| 3101 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3102 | /* add playback controls for speaker and HP outputs */ |
| 3103 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3104 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3105 | { |
| 3106 | hda_nid_t nid; |
| 3107 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3108 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3109 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3110 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3111 | return 0; |
| 3112 | |
| 3113 | if (alc880_is_fixed_pin(pin)) { |
| 3114 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3115 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3116 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3117 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3118 | else |
| 3119 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3120 | /* control HP volume/switch on the output mixer amp */ |
| 3121 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3122 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3123 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3124 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3125 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3126 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3127 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3128 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3129 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3130 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3131 | return err; |
| 3132 | } else if (alc880_is_multi_pin(pin)) { |
| 3133 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3134 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3135 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3136 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3137 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3138 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3139 | return err; |
| 3140 | } |
| 3141 | return 0; |
| 3142 | } |
| 3143 | |
| 3144 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3145 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3146 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3147 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3148 | { |
| 3149 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3150 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3151 | |
| 3152 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3153 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3154 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3155 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3156 | return err; |
| 3157 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3158 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3159 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3160 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3161 | return err; |
| 3162 | return 0; |
| 3163 | } |
| 3164 | |
| 3165 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3166 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3167 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3168 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3169 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3170 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3171 | |
| 3172 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3173 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3174 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3175 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3176 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3177 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3178 | if (err < 0) |
| 3179 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3180 | imux->items[imux->num_items].label = |
| 3181 | auto_pin_cfg_labels[i]; |
| 3182 | imux->items[imux->num_items].index = |
| 3183 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3184 | imux->num_items++; |
| 3185 | } |
| 3186 | } |
| 3187 | return 0; |
| 3188 | } |
| 3189 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3190 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3191 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3192 | int dac_idx) |
| 3193 | { |
| 3194 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3195 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3196 | pin_type); |
| 3197 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3198 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3199 | /* need the manual connection? */ |
| 3200 | if (alc880_is_multi_pin(nid)) { |
| 3201 | struct alc_spec *spec = codec->spec; |
| 3202 | int idx = alc880_multi_pin_idx(nid); |
| 3203 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3204 | AC_VERB_SET_CONNECT_SEL, |
| 3205 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3206 | } |
| 3207 | } |
| 3208 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3209 | static int get_pin_type(int line_out_type) |
| 3210 | { |
| 3211 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3212 | return PIN_HP; |
| 3213 | else |
| 3214 | return PIN_OUT; |
| 3215 | } |
| 3216 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3217 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3218 | { |
| 3219 | struct alc_spec *spec = codec->spec; |
| 3220 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3221 | |
| 3222 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3223 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3224 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3225 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3226 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3227 | } |
| 3228 | } |
| 3229 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3230 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3231 | { |
| 3232 | struct alc_spec *spec = codec->spec; |
| 3233 | hda_nid_t pin; |
| 3234 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3235 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3236 | if (pin) /* connect to front */ |
| 3237 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3238 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3239 | if (pin) /* connect to front */ |
| 3240 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3241 | } |
| 3242 | |
| 3243 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3244 | { |
| 3245 | struct alc_spec *spec = codec->spec; |
| 3246 | int i; |
| 3247 | |
| 3248 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3249 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3250 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3251 | snd_hda_codec_write(codec, nid, 0, |
| 3252 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3253 | i <= AUTO_PIN_FRONT_MIC ? |
| 3254 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3255 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3256 | snd_hda_codec_write(codec, nid, 0, |
| 3257 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3258 | AMP_OUT_MUTE); |
| 3259 | } |
| 3260 | } |
| 3261 | } |
| 3262 | |
| 3263 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3264 | /* return 1 if successful, 0 if the proper config is not found, |
| 3265 | * or a negative error code |
| 3266 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3267 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3268 | { |
| 3269 | struct alc_spec *spec = codec->spec; |
| 3270 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3271 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3272 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3273 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3274 | alc880_ignore); |
| 3275 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3276 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3277 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3278 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3279 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3280 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3281 | if (err < 0) |
| 3282 | return err; |
| 3283 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3284 | if (err < 0) |
| 3285 | return err; |
| 3286 | err = alc880_auto_create_extra_out(spec, |
| 3287 | spec->autocfg.speaker_pins[0], |
| 3288 | "Speaker"); |
| 3289 | if (err < 0) |
| 3290 | return err; |
| 3291 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3292 | "Headphone"); |
| 3293 | if (err < 0) |
| 3294 | return err; |
| 3295 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3296 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3297 | return err; |
| 3298 | |
| 3299 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3300 | |
| 3301 | if (spec->autocfg.dig_out_pin) |
| 3302 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3303 | if (spec->autocfg.dig_in_pin) |
| 3304 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3305 | |
| 3306 | if (spec->kctl_alloc) |
| 3307 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3308 | |
| 3309 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3310 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3311 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3312 | spec->input_mux = &spec->private_imux; |
| 3313 | |
| 3314 | return 1; |
| 3315 | } |
| 3316 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3317 | /* additional initialization for auto-configuration model */ |
| 3318 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3319 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3320 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3321 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3322 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3323 | } |
| 3324 | |
| 3325 | /* |
| 3326 | * OK, here we have finally the patch for ALC880 |
| 3327 | */ |
| 3328 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3329 | static int patch_alc880(struct hda_codec *codec) |
| 3330 | { |
| 3331 | struct alc_spec *spec; |
| 3332 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3333 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3334 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3335 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3336 | if (spec == NULL) |
| 3337 | return -ENOMEM; |
| 3338 | |
| 3339 | codec->spec = spec; |
| 3340 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3341 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3342 | alc880_models, |
| 3343 | alc880_cfg_tbl); |
| 3344 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3345 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3346 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3347 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3348 | } |
| 3349 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3350 | if (board_config == ALC880_AUTO) { |
| 3351 | /* automatic parse from the BIOS config */ |
| 3352 | err = alc880_parse_auto_config(codec); |
| 3353 | if (err < 0) { |
| 3354 | alc_free(codec); |
| 3355 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3356 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3357 | printk(KERN_INFO |
| 3358 | "hda_codec: Cannot set up configuration " |
| 3359 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3360 | board_config = ALC880_3ST; |
| 3361 | } |
| 3362 | } |
| 3363 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3364 | if (board_config != ALC880_AUTO) |
| 3365 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3366 | |
| 3367 | spec->stream_name_analog = "ALC880 Analog"; |
| 3368 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3369 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3370 | |
| 3371 | spec->stream_name_digital = "ALC880 Digital"; |
| 3372 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3373 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3374 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3375 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3376 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3377 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3378 | /* get type */ |
| 3379 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3380 | if (wcap != AC_WID_AUD_IN) { |
| 3381 | spec->adc_nids = alc880_adc_nids_alt; |
| 3382 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3383 | spec->mixers[spec->num_mixers] = |
| 3384 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3385 | spec->num_mixers++; |
| 3386 | } else { |
| 3387 | spec->adc_nids = alc880_adc_nids; |
| 3388 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3389 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3390 | spec->num_mixers++; |
| 3391 | } |
| 3392 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3393 | |
| 3394 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3395 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3396 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3397 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3398 | if (!spec->loopback.amplist) |
| 3399 | spec->loopback.amplist = alc880_loopbacks; |
| 3400 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3401 | |
| 3402 | return 0; |
| 3403 | } |
| 3404 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3405 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3406 | /* |
| 3407 | * ALC260 support |
| 3408 | */ |
| 3409 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3410 | static hda_nid_t alc260_dac_nids[1] = { |
| 3411 | /* front */ |
| 3412 | 0x02, |
| 3413 | }; |
| 3414 | |
| 3415 | static hda_nid_t alc260_adc_nids[1] = { |
| 3416 | /* ADC0 */ |
| 3417 | 0x04, |
| 3418 | }; |
| 3419 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3420 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3421 | /* ADC1 */ |
| 3422 | 0x05, |
| 3423 | }; |
| 3424 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3425 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3426 | /* ADC1, 0 */ |
| 3427 | 0x05, 0x04 |
| 3428 | }; |
| 3429 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3430 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3431 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3432 | */ |
| 3433 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3434 | /* ADC0, ADC1 */ |
| 3435 | 0x04, 0x05 |
| 3436 | }; |
| 3437 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3438 | #define ALC260_DIGOUT_NID 0x03 |
| 3439 | #define ALC260_DIGIN_NID 0x06 |
| 3440 | |
| 3441 | static struct hda_input_mux alc260_capture_source = { |
| 3442 | .num_items = 4, |
| 3443 | .items = { |
| 3444 | { "Mic", 0x0 }, |
| 3445 | { "Front Mic", 0x1 }, |
| 3446 | { "Line", 0x2 }, |
| 3447 | { "CD", 0x4 }, |
| 3448 | }, |
| 3449 | }; |
| 3450 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3451 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3452 | * headphone jack and the internal CD lines since these are the only pins at |
| 3453 | * which audio can appear. For flexibility, also allow the option of |
| 3454 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3455 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3456 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3457 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3458 | { |
| 3459 | .num_items = 3, |
| 3460 | .items = { |
| 3461 | { "Mic/Line", 0x0 }, |
| 3462 | { "CD", 0x4 }, |
| 3463 | { "Headphone", 0x2 }, |
| 3464 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3465 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3466 | { |
| 3467 | .num_items = 4, |
| 3468 | .items = { |
| 3469 | { "Mic/Line", 0x0 }, |
| 3470 | { "CD", 0x4 }, |
| 3471 | { "Headphone", 0x2 }, |
| 3472 | { "Mixer", 0x5 }, |
| 3473 | }, |
| 3474 | }, |
| 3475 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3476 | }; |
| 3477 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3478 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3479 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3480 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3481 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3482 | { |
| 3483 | .num_items = 4, |
| 3484 | .items = { |
| 3485 | { "Mic", 0x0 }, |
| 3486 | { "Line", 0x2 }, |
| 3487 | { "CD", 0x4 }, |
| 3488 | { "Headphone", 0x5 }, |
| 3489 | }, |
| 3490 | }, |
| 3491 | { |
| 3492 | .num_items = 5, |
| 3493 | .items = { |
| 3494 | { "Mic", 0x0 }, |
| 3495 | { "Line", 0x2 }, |
| 3496 | { "CD", 0x4 }, |
| 3497 | { "Headphone", 0x6 }, |
| 3498 | { "Mixer", 0x5 }, |
| 3499 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3500 | }, |
| 3501 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3502 | /* |
| 3503 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3504 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3505 | * element which allows changing the channel mode, so the verb list is |
| 3506 | * never used. |
| 3507 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3508 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3509 | { 2, NULL }, |
| 3510 | }; |
| 3511 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3512 | |
| 3513 | /* Mixer combinations |
| 3514 | * |
| 3515 | * basic: base_output + input + pc_beep + capture |
| 3516 | * HP: base_output + input + capture_alt |
| 3517 | * HP_3013: hp_3013 + input + capture |
| 3518 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3519 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3520 | */ |
| 3521 | |
| 3522 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3523 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3524 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3525 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3526 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3527 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3528 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3529 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3530 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3531 | |
| 3532 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3533 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3534 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3535 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3536 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3537 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3538 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3539 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3540 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3541 | { } /* end */ |
| 3542 | }; |
| 3543 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3544 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3545 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3546 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3547 | { } /* end */ |
| 3548 | }; |
| 3549 | |
| 3550 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3551 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3552 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3553 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3554 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3555 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3556 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3557 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3558 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3559 | { } /* end */ |
| 3560 | }; |
| 3561 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3562 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3563 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3564 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3565 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3566 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3567 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3568 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3569 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3570 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3571 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3572 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3573 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3574 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3575 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3576 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3577 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3578 | { } /* end */ |
| 3579 | }; |
| 3580 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3581 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3582 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3583 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3584 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3585 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3586 | * revisions available in early 2006. Therefore for now allow the |
| 3587 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3588 | * that the lack of mic bias for this NID is intentional we could change the |
| 3589 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3590 | * |
| 3591 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3592 | * don't appear to make the mic bias available from the "line" jack, even |
| 3593 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3594 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3595 | * and the output jack. If this turns out to be the case for all such |
| 3596 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3597 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3598 | * |
| 3599 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3600 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 3601 | * controls for such models. On models without a "mono speaker" the control |
| 3602 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3603 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3604 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3605 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3606 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3607 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3608 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3609 | HDA_OUTPUT), |
| 3610 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 3611 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3612 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3613 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3616 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3617 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3618 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3619 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3620 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3621 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3622 | { } /* end */ |
| 3623 | }; |
| 3624 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3625 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 3626 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 3627 | */ |
| 3628 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 3629 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3630 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3631 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3632 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3633 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3634 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3635 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3636 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3637 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3638 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3639 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3640 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3641 | { } /* end */ |
| 3642 | }; |
| 3643 | |
| 3644 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 3645 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 3646 | */ |
| 3647 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 3648 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3649 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3650 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3651 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3652 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3653 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 3654 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 3655 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3656 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3657 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3658 | { } /* end */ |
| 3659 | }; |
| 3660 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3661 | /* capture mixer elements */ |
| 3662 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3663 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3664 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3665 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3666 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3667 | { |
| 3668 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3669 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3670 | * So call somewhat different.. |
| 3671 | * FIXME: the controls appear in the "playback" view! |
| 3672 | */ |
| 3673 | /* .name = "Capture Source", */ |
| 3674 | .name = "Input Source", |
| 3675 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3676 | .info = alc_mux_enum_info, |
| 3677 | .get = alc_mux_enum_get, |
| 3678 | .put = alc_mux_enum_put, |
| 3679 | }, |
| 3680 | { } /* end */ |
| 3681 | }; |
| 3682 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3683 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3684 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3685 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3686 | { |
| 3687 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3688 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3689 | * So call somewhat different.. |
| 3690 | * FIXME: the controls appear in the "playback" view! |
| 3691 | */ |
| 3692 | /* .name = "Capture Source", */ |
| 3693 | .name = "Input Source", |
| 3694 | .count = 1, |
| 3695 | .info = alc_mux_enum_info, |
| 3696 | .get = alc_mux_enum_get, |
| 3697 | .put = alc_mux_enum_put, |
| 3698 | }, |
| 3699 | { } /* end */ |
| 3700 | }; |
| 3701 | |
| 3702 | /* |
| 3703 | * initialization verbs |
| 3704 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3705 | static struct hda_verb alc260_init_verbs[] = { |
| 3706 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3708 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3709 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3710 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3711 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3712 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3713 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3714 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3715 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3716 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3717 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3718 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3719 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3720 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3721 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3722 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3723 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3724 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3725 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3726 | /* set connection select to line in (default select for this ADC) */ |
| 3727 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3728 | /* mute capture amp left and right */ |
| 3729 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3730 | /* set connection select to line in (default select for this ADC) */ |
| 3731 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3732 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3733 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3734 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3735 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3736 | /* set vol=0 HP mixer amp left and right */ |
| 3737 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3738 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3739 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3740 | /* set vol=0 Mono mixer amp left and right */ |
| 3741 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3742 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3743 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3744 | /* unmute LINE-2 out pin */ |
| 3745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3746 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3747 | * Line In 2 = 0x03 |
| 3748 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3749 | /* mute analog inputs */ |
| 3750 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3751 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3752 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3755 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3756 | /* mute Front out path */ |
| 3757 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3758 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3759 | /* mute Headphone out path */ |
| 3760 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3761 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3762 | /* mute Mono out path */ |
| 3763 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3764 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3765 | { } |
| 3766 | }; |
| 3767 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3768 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3769 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 3770 | /* Headphone and output */ |
| 3771 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3772 | /* mono output */ |
| 3773 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3774 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3775 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3776 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3777 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3778 | /* Line In pin widget for input */ |
| 3779 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3780 | /* Line-2 pin widget for output */ |
| 3781 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3782 | /* CD pin widget for input */ |
| 3783 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3784 | /* unmute amp left and right */ |
| 3785 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3786 | /* set connection select to line in (default select for this ADC) */ |
| 3787 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3788 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3789 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3790 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3792 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3793 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3794 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3795 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3796 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3797 | * Line In 2 = 0x03 |
| 3798 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3799 | /* mute analog inputs */ |
| 3800 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3801 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3802 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3803 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3804 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3805 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3806 | /* Unmute Front out path */ |
| 3807 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3808 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3809 | /* Unmute Headphone out path */ |
| 3810 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3811 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3812 | /* Unmute Mono out path */ |
| 3813 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3814 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3815 | { } |
| 3816 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3817 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3818 | |
| 3819 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 3820 | /* Line out and output */ |
| 3821 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3822 | /* mono output */ |
| 3823 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3824 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3825 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3826 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3827 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3828 | /* Line In pin widget for input */ |
| 3829 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3830 | /* Headphone pin widget for output */ |
| 3831 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3832 | /* CD pin widget for input */ |
| 3833 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3834 | /* unmute amp left and right */ |
| 3835 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3836 | /* set connection select to line in (default select for this ADC) */ |
| 3837 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3838 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3839 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3840 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3841 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3842 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3843 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3844 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3845 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3846 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3847 | * Line In 2 = 0x03 |
| 3848 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3849 | /* mute analog inputs */ |
| 3850 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3851 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3852 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3854 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3855 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3856 | /* Unmute Front out path */ |
| 3857 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3858 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3859 | /* Unmute Headphone out path */ |
| 3860 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3861 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3862 | /* Unmute Mono out path */ |
| 3863 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3864 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3865 | { } |
| 3866 | }; |
| 3867 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3868 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3869 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 3870 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3871 | */ |
| 3872 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 3873 | /* Disable all GPIOs */ |
| 3874 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 3875 | /* Internal speaker is connected to headphone pin */ |
| 3876 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3877 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 3878 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3879 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 3880 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3881 | /* Ensure all other unused pins are disabled and muted. */ |
| 3882 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3883 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3884 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3885 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3886 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3887 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3888 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3889 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3890 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3891 | /* Disable digital (SPDIF) pins */ |
| 3892 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3893 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3894 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3895 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 3896 | * when acting as an output. |
| 3897 | */ |
| 3898 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3899 | |
| 3900 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 3901 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3902 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3903 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3904 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3905 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3906 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3907 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3908 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3909 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3910 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3911 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 3912 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3913 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 3914 | * If the pin mode is changed by the user the pin mode control will |
| 3915 | * take care of enabling the pin's input/output buffers as needed. |
| 3916 | * Therefore there's no need to enable the input buffer at this |
| 3917 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3918 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3919 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3920 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 3921 | * mixer ctrl) |
| 3922 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3923 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3924 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3925 | /* Mute capture amp left and right */ |
| 3926 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3927 | /* Set ADC connection select to match default mixer setting - line |
| 3928 | * in (on mic1 pin) |
| 3929 | */ |
| 3930 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3931 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3932 | /* Do the same for the second ADC: mute capture input amp and |
| 3933 | * set ADC connection to line in (on mic1 pin) |
| 3934 | */ |
| 3935 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3936 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3937 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3938 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3939 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3940 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3941 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3942 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3943 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3944 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3945 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3946 | {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] | 3947 | |
| 3948 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3949 | }; |
| 3950 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3951 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 3952 | * similar laptops (adapted from Fujitsu init verbs). |
| 3953 | */ |
| 3954 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 3955 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 3956 | * the headphone jack. Turn this on and rely on the standard mute |
| 3957 | * methods whenever the user wants to turn these outputs off. |
| 3958 | */ |
| 3959 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 3960 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3961 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 3962 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 3963 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3964 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 3965 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 3966 | /* Line In jack is connected to Line1 pin */ |
| 3967 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3968 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 3969 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3970 | /* Ensure all other unused pins are disabled and muted. */ |
| 3971 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3972 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3973 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3974 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3975 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3977 | /* Disable digital (SPDIF) pins */ |
| 3978 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3979 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3980 | |
| 3981 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 3982 | * bus when acting as outputs. |
| 3983 | */ |
| 3984 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3985 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3986 | |
| 3987 | /* Start with output sum widgets muted and their output gains at min */ |
| 3988 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3989 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3990 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3991 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3992 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3993 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3994 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3995 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3996 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3997 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3998 | /* Unmute Line-out pin widget amp left and right |
| 3999 | * (no equiv mixer ctrl) |
| 4000 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4001 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4002 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4003 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4004 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4005 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4006 | * will take care of enabling the pin's input/output buffers as needed. |
| 4007 | * Therefore there's no need to enable the input buffer at this |
| 4008 | * stage. |
| 4009 | */ |
| 4010 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4011 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4012 | |
| 4013 | /* Mute capture amp left and right */ |
| 4014 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4015 | /* Set ADC connection select to match default mixer setting - mic |
| 4016 | * (on mic1 pin) |
| 4017 | */ |
| 4018 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4019 | |
| 4020 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4021 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4022 | */ |
| 4023 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4024 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4025 | |
| 4026 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4028 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4029 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4030 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4031 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4032 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4033 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4034 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4035 | |
| 4036 | { } |
| 4037 | }; |
| 4038 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4039 | static struct hda_verb alc260_will_verbs[] = { |
| 4040 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4041 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4042 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4043 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4044 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4045 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4046 | {} |
| 4047 | }; |
| 4048 | |
| 4049 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4050 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4051 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4052 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4053 | |
| 4054 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4055 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4056 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4057 | |
| 4058 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4059 | {} |
| 4060 | }; |
| 4061 | |
| 4062 | /* toggle speaker-output according to the hp-jack state */ |
| 4063 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4064 | { |
| 4065 | unsigned int present; |
| 4066 | |
| 4067 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4068 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4069 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4070 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4071 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4072 | AC_VERB_SET_GPIO_DATA, 1); |
| 4073 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4074 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4075 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4076 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4077 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4078 | AC_VERB_SET_GPIO_DATA, 0); |
| 4079 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4080 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4081 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4082 | } |
| 4083 | } |
| 4084 | |
| 4085 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4086 | unsigned int res) |
| 4087 | { |
| 4088 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4089 | alc260_replacer_672v_automute(codec); |
| 4090 | } |
| 4091 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4092 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4093 | * configuration. |
| 4094 | */ |
| 4095 | #ifdef CONFIG_SND_DEBUG |
| 4096 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4097 | 0x02, |
| 4098 | }; |
| 4099 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4100 | 0x04, 0x05, |
| 4101 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4102 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4103 | * the signal assignments are different. This assumes that the first ADC |
| 4104 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4105 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4106 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4107 | { |
| 4108 | .num_items = 7, |
| 4109 | .items = { |
| 4110 | { "MIC1 pin", 0x0 }, |
| 4111 | { "MIC2 pin", 0x1 }, |
| 4112 | { "LINE1 pin", 0x2 }, |
| 4113 | { "LINE2 pin", 0x3 }, |
| 4114 | { "CD pin", 0x4 }, |
| 4115 | { "LINE-OUT pin", 0x5 }, |
| 4116 | { "HP-OUT pin", 0x6 }, |
| 4117 | }, |
| 4118 | }, |
| 4119 | { |
| 4120 | .num_items = 8, |
| 4121 | .items = { |
| 4122 | { "MIC1 pin", 0x0 }, |
| 4123 | { "MIC2 pin", 0x1 }, |
| 4124 | { "LINE1 pin", 0x2 }, |
| 4125 | { "LINE2 pin", 0x3 }, |
| 4126 | { "CD pin", 0x4 }, |
| 4127 | { "Mixer", 0x5 }, |
| 4128 | { "LINE-OUT pin", 0x6 }, |
| 4129 | { "HP-OUT pin", 0x7 }, |
| 4130 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4131 | }, |
| 4132 | }; |
| 4133 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4134 | /* Output driver widgets */ |
| 4135 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4136 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4137 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4138 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4139 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4140 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4141 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4142 | /* Modes for retasking pin widgets |
| 4143 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4144 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4145 | * mention this restriction. At this stage it's not clear whether |
| 4146 | * this behaviour is intentional or is a hardware bug in chip |
| 4147 | * revisions available at least up until early 2006. Therefore for |
| 4148 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4149 | * choices, but if it turns out that the lack of mic bias for these |
| 4150 | * NIDs is intentional we could change their modes from |
| 4151 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4152 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4153 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4154 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4155 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4156 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4157 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4158 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4159 | |
| 4160 | /* Loopback mixer controls */ |
| 4161 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4162 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4163 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4164 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4165 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4166 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4167 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4168 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4169 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4170 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4171 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4172 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4173 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4174 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4175 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4176 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4177 | |
| 4178 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4179 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4180 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4181 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4182 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4183 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4184 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4185 | * is ambigious as to which NID is which; testing on laptops which |
| 4186 | * make this output available should provide clarification. |
| 4187 | */ |
| 4188 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4189 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4190 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4191 | { } /* end */ |
| 4192 | }; |
| 4193 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4194 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4195 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4196 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4197 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4198 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4199 | /* Enable retasking pins as output, initially without power amp */ |
| 4200 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4201 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4202 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4204 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4205 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4206 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4207 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4208 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4209 | * payload also sets the generation to 0, output to be in "consumer" |
| 4210 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4211 | * control. |
| 4212 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4213 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4214 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4215 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4216 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4217 | * OUT1 sum bus when acting as an output. |
| 4218 | */ |
| 4219 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4220 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4221 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4222 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4223 | |
| 4224 | /* Start with output sum widgets muted and their output gains at min */ |
| 4225 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4226 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4227 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4228 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4229 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4230 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4231 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4232 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4233 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4234 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4235 | /* Unmute retasking pin widget output buffers since the default |
| 4236 | * state appears to be output. As the pin mode is changed by the |
| 4237 | * user the pin mode control will take care of enabling the pin's |
| 4238 | * input/output buffers as needed. |
| 4239 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4240 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4241 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4242 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4243 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4244 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4245 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4246 | /* Also unmute the mono-out pin widget */ |
| 4247 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4248 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4249 | /* Mute capture amp left and right */ |
| 4250 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4251 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4252 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4253 | */ |
| 4254 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4255 | |
| 4256 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4257 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4258 | */ |
| 4259 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4260 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4261 | |
| 4262 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4263 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4264 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4265 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4266 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4267 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4268 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4269 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4270 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4271 | |
| 4272 | { } |
| 4273 | }; |
| 4274 | #endif |
| 4275 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4276 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 4277 | .substreams = 1, |
| 4278 | .channels_min = 2, |
| 4279 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4280 | }; |
| 4281 | |
| 4282 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 4283 | .substreams = 1, |
| 4284 | .channels_min = 2, |
| 4285 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4286 | }; |
| 4287 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4288 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4289 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4290 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4291 | /* |
| 4292 | * for BIOS auto-configuration |
| 4293 | */ |
| 4294 | |
| 4295 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4296 | const char *pfx) |
| 4297 | { |
| 4298 | hda_nid_t nid_vol; |
| 4299 | unsigned long vol_val, sw_val; |
| 4300 | char name[32]; |
| 4301 | int err; |
| 4302 | |
| 4303 | if (nid >= 0x0f && nid < 0x11) { |
| 4304 | nid_vol = nid - 0x7; |
| 4305 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4306 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4307 | } else if (nid == 0x11) { |
| 4308 | nid_vol = nid - 0x7; |
| 4309 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4310 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4311 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4312 | nid_vol = 0x08; |
| 4313 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4314 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4315 | } else |
| 4316 | return 0; /* N/A */ |
| 4317 | |
| 4318 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4319 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4320 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4321 | return err; |
| 4322 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4323 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4324 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4325 | return err; |
| 4326 | return 1; |
| 4327 | } |
| 4328 | |
| 4329 | /* add playback controls from the parsed DAC table */ |
| 4330 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4331 | const struct auto_pin_cfg *cfg) |
| 4332 | { |
| 4333 | hda_nid_t nid; |
| 4334 | int err; |
| 4335 | |
| 4336 | spec->multiout.num_dacs = 1; |
| 4337 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4338 | spec->multiout.dac_nids[0] = 0x02; |
| 4339 | |
| 4340 | nid = cfg->line_out_pins[0]; |
| 4341 | if (nid) { |
| 4342 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4343 | if (err < 0) |
| 4344 | return err; |
| 4345 | } |
| 4346 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4347 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4348 | if (nid) { |
| 4349 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4350 | if (err < 0) |
| 4351 | return err; |
| 4352 | } |
| 4353 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4354 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4355 | if (nid) { |
| 4356 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4357 | if (err < 0) |
| 4358 | return err; |
| 4359 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4360 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4361 | } |
| 4362 | |
| 4363 | /* create playback/capture controls for input pins */ |
| 4364 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4365 | const struct auto_pin_cfg *cfg) |
| 4366 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4367 | struct hda_input_mux *imux = &spec->private_imux; |
| 4368 | int i, err, idx; |
| 4369 | |
| 4370 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4371 | if (cfg->input_pins[i] >= 0x12) { |
| 4372 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4373 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4374 | auto_pin_cfg_labels[i], idx, |
| 4375 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4376 | if (err < 0) |
| 4377 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4378 | imux->items[imux->num_items].label = |
| 4379 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4380 | imux->items[imux->num_items].index = idx; |
| 4381 | imux->num_items++; |
| 4382 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4383 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4384 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4385 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4386 | auto_pin_cfg_labels[i], idx, |
| 4387 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4388 | if (err < 0) |
| 4389 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4390 | imux->items[imux->num_items].label = |
| 4391 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4392 | imux->items[imux->num_items].index = idx; |
| 4393 | imux->num_items++; |
| 4394 | } |
| 4395 | } |
| 4396 | return 0; |
| 4397 | } |
| 4398 | |
| 4399 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4400 | hda_nid_t nid, int pin_type, |
| 4401 | int sel_idx) |
| 4402 | { |
| 4403 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4404 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4405 | pin_type); |
| 4406 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4407 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4408 | /* need the manual connection? */ |
| 4409 | if (nid >= 0x12) { |
| 4410 | int idx = nid - 0x12; |
| 4411 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4412 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4413 | } |
| 4414 | } |
| 4415 | |
| 4416 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4417 | { |
| 4418 | struct alc_spec *spec = codec->spec; |
| 4419 | hda_nid_t nid; |
| 4420 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4421 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4422 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4423 | if (nid) { |
| 4424 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4425 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4426 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4427 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4428 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4429 | if (nid) |
| 4430 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4431 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4432 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4433 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4434 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4435 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4436 | |
| 4437 | #define ALC260_PIN_CD_NID 0x16 |
| 4438 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4439 | { |
| 4440 | struct alc_spec *spec = codec->spec; |
| 4441 | int i; |
| 4442 | |
| 4443 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4444 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4445 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4446 | snd_hda_codec_write(codec, nid, 0, |
| 4447 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4448 | i <= AUTO_PIN_FRONT_MIC ? |
| 4449 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4450 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4451 | snd_hda_codec_write(codec, nid, 0, |
| 4452 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4453 | AMP_OUT_MUTE); |
| 4454 | } |
| 4455 | } |
| 4456 | } |
| 4457 | |
| 4458 | /* |
| 4459 | * generic initialization of ADC, input mixers and output mixers |
| 4460 | */ |
| 4461 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4462 | /* |
| 4463 | * Unmute ADC0-1 and set the default input to mic-in |
| 4464 | */ |
| 4465 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4466 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4467 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4468 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4469 | |
| 4470 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4471 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4472 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4473 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4474 | */ |
| 4475 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4476 | /* mute analog inputs */ |
| 4477 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4478 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4479 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4480 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4481 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4482 | |
| 4483 | /* |
| 4484 | * Set up output mixers (0x08 - 0x0a) |
| 4485 | */ |
| 4486 | /* set vol=0 to output mixers */ |
| 4487 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4488 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4489 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4490 | /* set up input amps for analog loopback */ |
| 4491 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4492 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4493 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4494 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4495 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4496 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4497 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4498 | |
| 4499 | { } |
| 4500 | }; |
| 4501 | |
| 4502 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4503 | { |
| 4504 | struct alc_spec *spec = codec->spec; |
| 4505 | unsigned int wcap; |
| 4506 | int err; |
| 4507 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4508 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4509 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4510 | alc260_ignore); |
| 4511 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4512 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4513 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4514 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4515 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4516 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4517 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4518 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4519 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4520 | return err; |
| 4521 | |
| 4522 | spec->multiout.max_channels = 2; |
| 4523 | |
| 4524 | if (spec->autocfg.dig_out_pin) |
| 4525 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4526 | if (spec->kctl_alloc) |
| 4527 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4528 | |
| 4529 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4530 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4531 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4532 | spec->input_mux = &spec->private_imux; |
| 4533 | |
| 4534 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4535 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4536 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4537 | if (wcap != AC_WID_AUD_IN) { |
| 4538 | spec->adc_nids = alc260_adc_nids_alt; |
| 4539 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4540 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4541 | } else { |
| 4542 | spec->adc_nids = alc260_adc_nids; |
| 4543 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4544 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4545 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4546 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4547 | |
| 4548 | return 1; |
| 4549 | } |
| 4550 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4551 | /* additional initialization for auto-configuration model */ |
| 4552 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4553 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4554 | alc260_auto_init_multi_out(codec); |
| 4555 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4556 | } |
| 4557 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4558 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4559 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4560 | { 0x07, HDA_INPUT, 0 }, |
| 4561 | { 0x07, HDA_INPUT, 1 }, |
| 4562 | { 0x07, HDA_INPUT, 2 }, |
| 4563 | { 0x07, HDA_INPUT, 3 }, |
| 4564 | { 0x07, HDA_INPUT, 4 }, |
| 4565 | { } /* end */ |
| 4566 | }; |
| 4567 | #endif |
| 4568 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4569 | /* |
| 4570 | * ALC260 configurations |
| 4571 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4572 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4573 | [ALC260_BASIC] = "basic", |
| 4574 | [ALC260_HP] = "hp", |
| 4575 | [ALC260_HP_3013] = "hp-3013", |
| 4576 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4577 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4578 | [ALC260_WILL] = "will", |
| 4579 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4580 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4581 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4582 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4583 | [ALC260_AUTO] = "auto", |
| 4584 | }; |
| 4585 | |
| 4586 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4587 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4588 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4589 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4590 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4591 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4592 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4593 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4594 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4595 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4596 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4597 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4598 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4599 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4600 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4601 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4602 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4603 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
| 4604 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4605 | {} |
| 4606 | }; |
| 4607 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4608 | static struct alc_config_preset alc260_presets[] = { |
| 4609 | [ALC260_BASIC] = { |
| 4610 | .mixers = { alc260_base_output_mixer, |
| 4611 | alc260_input_mixer, |
| 4612 | alc260_pc_beep_mixer, |
| 4613 | alc260_capture_mixer }, |
| 4614 | .init_verbs = { alc260_init_verbs }, |
| 4615 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4616 | .dac_nids = alc260_dac_nids, |
| 4617 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4618 | .adc_nids = alc260_adc_nids, |
| 4619 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4620 | .channel_mode = alc260_modes, |
| 4621 | .input_mux = &alc260_capture_source, |
| 4622 | }, |
| 4623 | [ALC260_HP] = { |
| 4624 | .mixers = { alc260_base_output_mixer, |
| 4625 | alc260_input_mixer, |
| 4626 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4627 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4628 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4629 | .dac_nids = alc260_dac_nids, |
| 4630 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4631 | .adc_nids = alc260_hp_adc_nids, |
| 4632 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4633 | .channel_mode = alc260_modes, |
| 4634 | .input_mux = &alc260_capture_source, |
| 4635 | }, |
| 4636 | [ALC260_HP_3013] = { |
| 4637 | .mixers = { alc260_hp_3013_mixer, |
| 4638 | alc260_input_mixer, |
| 4639 | alc260_capture_alt_mixer }, |
| 4640 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4641 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4642 | .dac_nids = alc260_dac_nids, |
| 4643 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4644 | .adc_nids = alc260_hp_adc_nids, |
| 4645 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4646 | .channel_mode = alc260_modes, |
| 4647 | .input_mux = &alc260_capture_source, |
| 4648 | }, |
| 4649 | [ALC260_FUJITSU_S702X] = { |
| 4650 | .mixers = { alc260_fujitsu_mixer, |
| 4651 | alc260_capture_mixer }, |
| 4652 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4653 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4654 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4655 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4656 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4657 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4658 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4659 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4660 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4661 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4662 | [ALC260_ACER] = { |
| 4663 | .mixers = { alc260_acer_mixer, |
| 4664 | alc260_capture_mixer }, |
| 4665 | .init_verbs = { alc260_acer_init_verbs }, |
| 4666 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4667 | .dac_nids = alc260_dac_nids, |
| 4668 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4669 | .adc_nids = alc260_dual_adc_nids, |
| 4670 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4671 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4672 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4673 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4674 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4675 | [ALC260_WILL] = { |
| 4676 | .mixers = { alc260_will_mixer, |
| 4677 | alc260_capture_mixer }, |
| 4678 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 4679 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4680 | .dac_nids = alc260_dac_nids, |
| 4681 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4682 | .adc_nids = alc260_adc_nids, |
| 4683 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4684 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4685 | .channel_mode = alc260_modes, |
| 4686 | .input_mux = &alc260_capture_source, |
| 4687 | }, |
| 4688 | [ALC260_REPLACER_672V] = { |
| 4689 | .mixers = { alc260_replacer_672v_mixer, |
| 4690 | alc260_capture_mixer }, |
| 4691 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 4692 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4693 | .dac_nids = alc260_dac_nids, |
| 4694 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4695 | .adc_nids = alc260_adc_nids, |
| 4696 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4697 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4698 | .channel_mode = alc260_modes, |
| 4699 | .input_mux = &alc260_capture_source, |
| 4700 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 4701 | .init_hook = alc260_replacer_672v_automute, |
| 4702 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4703 | #ifdef CONFIG_SND_DEBUG |
| 4704 | [ALC260_TEST] = { |
| 4705 | .mixers = { alc260_test_mixer, |
| 4706 | alc260_capture_mixer }, |
| 4707 | .init_verbs = { alc260_test_init_verbs }, |
| 4708 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4709 | .dac_nids = alc260_test_dac_nids, |
| 4710 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4711 | .adc_nids = alc260_test_adc_nids, |
| 4712 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4713 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4714 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4715 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4716 | }, |
| 4717 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4718 | }; |
| 4719 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4720 | static int patch_alc260(struct hda_codec *codec) |
| 4721 | { |
| 4722 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4723 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4724 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4725 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4726 | if (spec == NULL) |
| 4727 | return -ENOMEM; |
| 4728 | |
| 4729 | codec->spec = spec; |
| 4730 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4731 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 4732 | alc260_models, |
| 4733 | alc260_cfg_tbl); |
| 4734 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4735 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4736 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4737 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4738 | } |
| 4739 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4740 | if (board_config == ALC260_AUTO) { |
| 4741 | /* automatic parse from the BIOS config */ |
| 4742 | err = alc260_parse_auto_config(codec); |
| 4743 | if (err < 0) { |
| 4744 | alc_free(codec); |
| 4745 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4746 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4747 | printk(KERN_INFO |
| 4748 | "hda_codec: Cannot set up configuration " |
| 4749 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4750 | board_config = ALC260_BASIC; |
| 4751 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4752 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4753 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4754 | if (board_config != ALC260_AUTO) |
| 4755 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4756 | |
| 4757 | spec->stream_name_analog = "ALC260 Analog"; |
| 4758 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 4759 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 4760 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4761 | spec->stream_name_digital = "ALC260 Digital"; |
| 4762 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 4763 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 4764 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4765 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4766 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4767 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4768 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4769 | if (!spec->loopback.amplist) |
| 4770 | spec->loopback.amplist = alc260_loopbacks; |
| 4771 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4772 | |
| 4773 | return 0; |
| 4774 | } |
| 4775 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4776 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4777 | /* |
| 4778 | * ALC882 support |
| 4779 | * |
| 4780 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 4781 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4782 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4783 | * 6-channel independent captures. |
| 4784 | * |
| 4785 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4786 | * driver yet). |
| 4787 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4788 | #define ALC882_DIGOUT_NID 0x06 |
| 4789 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4790 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4791 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4792 | { 8, NULL } |
| 4793 | }; |
| 4794 | |
| 4795 | static hda_nid_t alc882_dac_nids[4] = { |
| 4796 | /* front, rear, clfe, rear_surr */ |
| 4797 | 0x02, 0x03, 0x04, 0x05 |
| 4798 | }; |
| 4799 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4800 | /* identical with ALC880 */ |
| 4801 | #define alc882_adc_nids alc880_adc_nids |
| 4802 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4803 | |
| 4804 | /* input MUX */ |
| 4805 | /* FIXME: should be a matrix-type input source selection */ |
| 4806 | |
| 4807 | static struct hda_input_mux alc882_capture_source = { |
| 4808 | .num_items = 4, |
| 4809 | .items = { |
| 4810 | { "Mic", 0x0 }, |
| 4811 | { "Front Mic", 0x1 }, |
| 4812 | { "Line", 0x2 }, |
| 4813 | { "CD", 0x4 }, |
| 4814 | }, |
| 4815 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4816 | #define alc882_mux_enum_info alc_mux_enum_info |
| 4817 | #define alc882_mux_enum_get alc_mux_enum_get |
| 4818 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4819 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 4820 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4821 | { |
| 4822 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4823 | struct alc_spec *spec = codec->spec; |
| 4824 | const struct hda_input_mux *imux = spec->input_mux; |
| 4825 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4826 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4827 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4828 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4829 | unsigned int i, idx; |
| 4830 | |
| 4831 | idx = ucontrol->value.enumerated.item[0]; |
| 4832 | if (idx >= imux->num_items) |
| 4833 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4834 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4835 | return 0; |
| 4836 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4837 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 4838 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4839 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4840 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4841 | } |
| 4842 | *cur_val = idx; |
| 4843 | return 1; |
| 4844 | } |
| 4845 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4846 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4847 | * 2ch mode |
| 4848 | */ |
| 4849 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 4850 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 4851 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4852 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 4853 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4854 | { } /* end */ |
| 4855 | }; |
| 4856 | |
| 4857 | /* |
| 4858 | * 6ch mode |
| 4859 | */ |
| 4860 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 4861 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4862 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4863 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 4864 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4865 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4866 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 4867 | { } /* end */ |
| 4868 | }; |
| 4869 | |
| 4870 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 4871 | { 2, alc882_3ST_ch2_init }, |
| 4872 | { 6, alc882_3ST_ch6_init }, |
| 4873 | }; |
| 4874 | |
| 4875 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4876 | * 6ch mode |
| 4877 | */ |
| 4878 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 4879 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4880 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4881 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4882 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4883 | { } /* end */ |
| 4884 | }; |
| 4885 | |
| 4886 | /* |
| 4887 | * 8ch mode |
| 4888 | */ |
| 4889 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 4890 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4891 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4892 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4893 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4894 | { } /* end */ |
| 4895 | }; |
| 4896 | |
| 4897 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 4898 | { 6, alc882_sixstack_ch6_init }, |
| 4899 | { 8, alc882_sixstack_ch8_init }, |
| 4900 | }; |
| 4901 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 4902 | /* |
| 4903 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 4904 | */ |
| 4905 | |
| 4906 | /* |
| 4907 | * 2ch mode |
| 4908 | */ |
| 4909 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 4910 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 4911 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4912 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4913 | { } /* end */ |
| 4914 | }; |
| 4915 | |
| 4916 | /* |
| 4917 | * 6ch mode |
| 4918 | */ |
| 4919 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 4920 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4921 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4922 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 4923 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4924 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4925 | { } /* end */ |
| 4926 | }; |
| 4927 | |
| 4928 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 4929 | { 2, alc885_mbp_ch2_init }, |
| 4930 | { 6, alc885_mbp_ch6_init }, |
| 4931 | }; |
| 4932 | |
| 4933 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4934 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 4935 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 4936 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4937 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4938 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4939 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4940 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4941 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4942 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 4943 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4944 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 4945 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4946 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4947 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4948 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4949 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4950 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4951 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4952 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4953 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4954 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4955 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4956 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4957 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4958 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4959 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4960 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4961 | { } /* end */ |
| 4962 | }; |
| 4963 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 4964 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
| 4965 | HDA_CODEC_VOLUME("Master Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 4966 | HDA_BIND_MUTE ("Master Switch", 0x0c, 0x02, HDA_INPUT), |
| 4967 | HDA_CODEC_MUTE ("Speaker Switch", 0x14, 0x00, HDA_OUTPUT), |
| 4968 | HDA_CODEC_VOLUME("Line Out Volume", 0x0d,0x00, HDA_OUTPUT), |
| 4969 | HDA_CODEC_VOLUME("Line In Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4970 | HDA_CODEC_MUTE ("Line In Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4971 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 4972 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 4973 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0x00, HDA_INPUT), |
| 4974 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 4975 | { } /* end */ |
| 4976 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 4977 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 4978 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4979 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4980 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4981 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4982 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4983 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4984 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4985 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 4986 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4987 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4988 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 4989 | { } /* end */ |
| 4990 | }; |
| 4991 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4992 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 4993 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4994 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4995 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4996 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4997 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5001 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5002 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5003 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5004 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5005 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5006 | { } /* end */ |
| 5007 | }; |
| 5008 | |
| 5009 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5010 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5011 | */ |
| 5012 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5014 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5015 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5016 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5017 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5018 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5019 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5020 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5021 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5022 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5023 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5024 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5025 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5026 | { } /* end */ |
| 5027 | }; |
| 5028 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5029 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5030 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5031 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5032 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5033 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5034 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5035 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5036 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5038 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5039 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5040 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5041 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5042 | { } /* end */ |
| 5043 | }; |
| 5044 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5045 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5046 | { |
| 5047 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5048 | .name = "Channel Mode", |
| 5049 | .info = alc_ch_mode_info, |
| 5050 | .get = alc_ch_mode_get, |
| 5051 | .put = alc_ch_mode_put, |
| 5052 | }, |
| 5053 | { } /* end */ |
| 5054 | }; |
| 5055 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5056 | static struct hda_verb alc882_init_verbs[] = { |
| 5057 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5058 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5059 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5061 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5062 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5063 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5064 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5065 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5066 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5067 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5068 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5069 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5070 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5071 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5072 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5073 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5074 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5075 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5076 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5077 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5078 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5079 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5080 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5081 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5082 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5083 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5084 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5085 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5086 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5087 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5088 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5089 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5090 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5091 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5092 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5093 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5094 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5095 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5096 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5097 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5098 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5099 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5100 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5101 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5102 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5103 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5104 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5105 | |
| 5106 | /* FIXME: use matrix-type input source selection */ |
| 5107 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5108 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5109 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5110 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5111 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5112 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5113 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5114 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5115 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5116 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5117 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5118 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5119 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5120 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5121 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5123 | /* ADC1: mute amp left and right */ |
| 5124 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5125 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5126 | /* ADC2: mute amp left and right */ |
| 5127 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5128 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5129 | /* ADC3: mute amp left and right */ |
| 5130 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5131 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5132 | |
| 5133 | { } |
| 5134 | }; |
| 5135 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5136 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5137 | /* change to EAPD mode */ |
| 5138 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5139 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5140 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5141 | }; |
| 5142 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5143 | /* Mac Pro test */ |
| 5144 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5145 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5146 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5147 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5148 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5149 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5150 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5151 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5152 | { } /* end */ |
| 5153 | }; |
| 5154 | |
| 5155 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5156 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5157 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5158 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5159 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5160 | /* Front Pin: output 0 (0x0c) */ |
| 5161 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5162 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5163 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5164 | /* Front Mic pin: input vref at 80% */ |
| 5165 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5166 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5167 | /* Speaker: output */ |
| 5168 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5169 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5170 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5171 | /* Headphone output (output 0 - 0x0c) */ |
| 5172 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5173 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5174 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5175 | |
| 5176 | /* FIXME: use matrix-type input source selection */ |
| 5177 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5178 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5179 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5180 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5181 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5182 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5183 | /* Input mixer2 */ |
| 5184 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5185 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5186 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5187 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5188 | /* Input mixer3 */ |
| 5189 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5190 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5191 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5193 | /* ADC1: mute amp left and right */ |
| 5194 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5195 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5196 | /* ADC2: mute amp left and right */ |
| 5197 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5198 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5199 | /* ADC3: mute amp left and right */ |
| 5200 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5201 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5202 | |
| 5203 | { } |
| 5204 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5205 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5206 | /* Macbook Pro rev3 */ |
| 5207 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5208 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5209 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5210 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5211 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5212 | /* Rear mixer */ |
| 5213 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5214 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5215 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5216 | /* Front Pin: output 0 (0x0c) */ |
| 5217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5218 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5219 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5220 | /* HP Pin: output 0 (0x0d) */ |
| 5221 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5222 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5223 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5224 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5225 | /* Mic (rear) pin: input vref at 80% */ |
| 5226 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5227 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5228 | /* Front Mic pin: input vref at 80% */ |
| 5229 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5230 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5231 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5232 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5233 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5234 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5235 | |
| 5236 | /* FIXME: use matrix-type input source selection */ |
| 5237 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5238 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5239 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5240 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5241 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5242 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5243 | /* Input mixer2 */ |
| 5244 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5245 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5246 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5247 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5248 | /* Input mixer3 */ |
| 5249 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5250 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5251 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5252 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5253 | /* ADC1: mute amp left and right */ |
| 5254 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5255 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5256 | /* ADC2: mute amp left and right */ |
| 5257 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5258 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5259 | /* ADC3: mute amp left and right */ |
| 5260 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5261 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5262 | |
| 5263 | { } |
| 5264 | }; |
| 5265 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5266 | /* iMac 24 mixer. */ |
| 5267 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5268 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5269 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5270 | { } /* end */ |
| 5271 | }; |
| 5272 | |
| 5273 | /* iMac 24 init verbs. */ |
| 5274 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5275 | /* Internal speakers: output 0 (0x0c) */ |
| 5276 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5277 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5278 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5279 | /* Internal speakers: output 0 (0x0c) */ |
| 5280 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5281 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5282 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5283 | /* Headphone: output 0 (0x0c) */ |
| 5284 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5285 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5286 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5287 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5288 | /* Front Mic: input vref at 80% */ |
| 5289 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5290 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5291 | { } |
| 5292 | }; |
| 5293 | |
| 5294 | /* Toggle speaker-output according to the hp-jack state */ |
| 5295 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5296 | { |
| 5297 | unsigned int present; |
| 5298 | |
| 5299 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5300 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5301 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5302 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5303 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5304 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5305 | } |
| 5306 | |
| 5307 | /* Processes unsolicited events. */ |
| 5308 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5309 | unsigned int res) |
| 5310 | { |
| 5311 | /* Headphone insertion or removal. */ |
| 5312 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5313 | alc885_imac24_automute(codec); |
| 5314 | } |
| 5315 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5316 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5317 | { |
| 5318 | unsigned int present; |
| 5319 | |
| 5320 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5321 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5322 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5323 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5324 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5325 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5326 | |
| 5327 | } |
| 5328 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5329 | unsigned int res) |
| 5330 | { |
| 5331 | /* Headphone insertion or removal. */ |
| 5332 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5333 | alc885_mbp3_automute(codec); |
| 5334 | } |
| 5335 | |
| 5336 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5337 | static struct hda_verb alc882_targa_verbs[] = { |
| 5338 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5339 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5340 | |
| 5341 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5342 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5343 | |
| 5344 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5345 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5346 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5347 | |
| 5348 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5349 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5350 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5351 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5352 | { } /* end */ |
| 5353 | }; |
| 5354 | |
| 5355 | /* toggle speaker-output according to the hp-jack state */ |
| 5356 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5357 | { |
| 5358 | unsigned int present; |
| 5359 | |
| 5360 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5361 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5362 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5363 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5364 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5365 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5366 | } |
| 5367 | |
| 5368 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5369 | { |
| 5370 | /* Looks like the unsol event is incompatible with the standard |
| 5371 | * definition. 4bit tag is placed at 26 bit! |
| 5372 | */ |
| 5373 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5374 | alc882_targa_automute(codec); |
| 5375 | } |
| 5376 | } |
| 5377 | |
| 5378 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5379 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5381 | |
| 5382 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5383 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5384 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5385 | |
| 5386 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5387 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5388 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5389 | |
| 5390 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5391 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5392 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5393 | { } /* end */ |
| 5394 | }; |
| 5395 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5396 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5397 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5398 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5399 | |
| 5400 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5401 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5402 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5403 | |
| 5404 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5405 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5406 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5407 | |
| 5408 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5409 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5410 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5411 | { } /* end */ |
| 5412 | }; |
| 5413 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5414 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5415 | { |
| 5416 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5417 | |
| 5418 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5419 | AC_VERB_GET_GPIO_DATA, 0); |
| 5420 | |
| 5421 | if (!muted) |
| 5422 | gpiostate |= (1 << pin); |
| 5423 | else |
| 5424 | gpiostate &= ~(1 << pin); |
| 5425 | |
| 5426 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5427 | AC_VERB_GET_GPIO_MASK, 0); |
| 5428 | gpiomask |= (1 << pin); |
| 5429 | |
| 5430 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5431 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5432 | gpiodir |= (1 << pin); |
| 5433 | |
| 5434 | |
| 5435 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5436 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5437 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5438 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5439 | |
| 5440 | msleep(1); |
| 5441 | |
| 5442 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5443 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5444 | } |
| 5445 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5446 | /* set up GPIO at initialization */ |
| 5447 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5448 | { |
| 5449 | alc882_gpio_mute(codec, 0, 0); |
| 5450 | alc882_gpio_mute(codec, 1, 0); |
| 5451 | } |
| 5452 | |
| 5453 | /* set up GPIO and update auto-muting at initialization */ |
| 5454 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5455 | { |
| 5456 | alc885_macpro_init_hook(codec); |
| 5457 | alc885_imac24_automute(codec); |
| 5458 | } |
| 5459 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5460 | /* |
| 5461 | * generic initialization of ADC, input mixers and output mixers |
| 5462 | */ |
| 5463 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5464 | /* |
| 5465 | * Unmute ADC0-2 and set the default input to mic-in |
| 5466 | */ |
| 5467 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5468 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5469 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5470 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5471 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5472 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5473 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5474 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5475 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5476 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5477 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5478 | */ |
| 5479 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5480 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5481 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5482 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5483 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5484 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5485 | |
| 5486 | /* |
| 5487 | * Set up output mixers (0x0c - 0x0f) |
| 5488 | */ |
| 5489 | /* set vol=0 to output mixers */ |
| 5490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5491 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5492 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5493 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5494 | /* set up input amps for analog loopback */ |
| 5495 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5496 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5497 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5498 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5499 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5500 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5501 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5502 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5503 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5504 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5505 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5506 | |
| 5507 | /* FIXME: use matrix-type input source selection */ |
| 5508 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5509 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5510 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5511 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5512 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5513 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5514 | /* Input mixer2 */ |
| 5515 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5516 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5517 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5518 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5519 | /* Input mixer3 */ |
| 5520 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5521 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5522 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5524 | |
| 5525 | { } |
| 5526 | }; |
| 5527 | |
| 5528 | /* capture mixer elements */ |
| 5529 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5530 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5531 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5532 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5533 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5534 | { |
| 5535 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5536 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5537 | * So call somewhat different.. |
| 5538 | * FIXME: the controls appear in the "playback" view! |
| 5539 | */ |
| 5540 | /* .name = "Capture Source", */ |
| 5541 | .name = "Input Source", |
| 5542 | .count = 2, |
| 5543 | .info = alc882_mux_enum_info, |
| 5544 | .get = alc882_mux_enum_get, |
| 5545 | .put = alc882_mux_enum_put, |
| 5546 | }, |
| 5547 | { } /* end */ |
| 5548 | }; |
| 5549 | |
| 5550 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5551 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5552 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5553 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5554 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5555 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5556 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5557 | { |
| 5558 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5559 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5560 | * So call somewhat different.. |
| 5561 | * FIXME: the controls appear in the "playback" view! |
| 5562 | */ |
| 5563 | /* .name = "Capture Source", */ |
| 5564 | .name = "Input Source", |
| 5565 | .count = 3, |
| 5566 | .info = alc882_mux_enum_info, |
| 5567 | .get = alc882_mux_enum_get, |
| 5568 | .put = alc882_mux_enum_put, |
| 5569 | }, |
| 5570 | { } /* end */ |
| 5571 | }; |
| 5572 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5573 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5574 | #define alc882_loopbacks alc880_loopbacks |
| 5575 | #endif |
| 5576 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5577 | /* pcm configuration: identiacal with ALC880 */ |
| 5578 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5579 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5580 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5581 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5582 | |
| 5583 | /* |
| 5584 | * configuration and preset |
| 5585 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5586 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5587 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5588 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5589 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5590 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 5591 | [ALC882_TARGA] = "targa", |
| 5592 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 5593 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5594 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5595 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5596 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5597 | [ALC882_AUTO] = "auto", |
| 5598 | }; |
| 5599 | |
| 5600 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 5601 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 5602 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
| 5603 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5604 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5605 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5606 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5607 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 5608 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 5609 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5610 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5611 | {} |
| 5612 | }; |
| 5613 | |
| 5614 | static struct alc_config_preset alc882_presets[] = { |
| 5615 | [ALC882_3ST_DIG] = { |
| 5616 | .mixers = { alc882_base_mixer }, |
| 5617 | .init_verbs = { alc882_init_verbs }, |
| 5618 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5619 | .dac_nids = alc882_dac_nids, |
| 5620 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5621 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5622 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5623 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5624 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5625 | .input_mux = &alc882_capture_source, |
| 5626 | }, |
| 5627 | [ALC882_6ST_DIG] = { |
| 5628 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5629 | .init_verbs = { alc882_init_verbs }, |
| 5630 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5631 | .dac_nids = alc882_dac_nids, |
| 5632 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5633 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5634 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5635 | .channel_mode = alc882_sixstack_modes, |
| 5636 | .input_mux = &alc882_capture_source, |
| 5637 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5638 | [ALC882_ARIMA] = { |
| 5639 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5640 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 5641 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5642 | .dac_nids = alc882_dac_nids, |
| 5643 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5644 | .channel_mode = alc882_sixstack_modes, |
| 5645 | .input_mux = &alc882_capture_source, |
| 5646 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5647 | [ALC882_W2JC] = { |
| 5648 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 5649 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5650 | alc880_gpio1_init_verbs }, |
| 5651 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5652 | .dac_nids = alc882_dac_nids, |
| 5653 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5654 | .channel_mode = alc880_threestack_modes, |
| 5655 | .need_dac_fix = 1, |
| 5656 | .input_mux = &alc882_capture_source, |
| 5657 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5658 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5659 | [ALC885_MBP3] = { |
| 5660 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 5661 | .init_verbs = { alc885_mbp3_init_verbs, |
| 5662 | alc880_gpio1_init_verbs }, |
| 5663 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5664 | .dac_nids = alc882_dac_nids, |
| 5665 | .channel_mode = alc885_mbp_6ch_modes, |
| 5666 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 5667 | .input_mux = &alc882_capture_source, |
| 5668 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5669 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5670 | .unsol_event = alc885_mbp3_unsol_event, |
| 5671 | .init_hook = alc885_mbp3_automute, |
| 5672 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5673 | [ALC885_MACPRO] = { |
| 5674 | .mixers = { alc882_macpro_mixer }, |
| 5675 | .init_verbs = { alc882_macpro_init_verbs }, |
| 5676 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5677 | .dac_nids = alc882_dac_nids, |
| 5678 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5679 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5680 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5681 | .channel_mode = alc882_ch_modes, |
| 5682 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5683 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5684 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5685 | [ALC885_IMAC24] = { |
| 5686 | .mixers = { alc885_imac24_mixer }, |
| 5687 | .init_verbs = { alc885_imac24_init_verbs }, |
| 5688 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5689 | .dac_nids = alc882_dac_nids, |
| 5690 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5691 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5692 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5693 | .channel_mode = alc882_ch_modes, |
| 5694 | .input_mux = &alc882_capture_source, |
| 5695 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5696 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5697 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5698 | [ALC882_TARGA] = { |
| 5699 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 5700 | alc882_capture_mixer }, |
| 5701 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 5702 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5703 | .dac_nids = alc882_dac_nids, |
| 5704 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5705 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5706 | .adc_nids = alc882_adc_nids, |
| 5707 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5708 | .channel_mode = alc882_3ST_6ch_modes, |
| 5709 | .need_dac_fix = 1, |
| 5710 | .input_mux = &alc882_capture_source, |
| 5711 | .unsol_event = alc882_targa_unsol_event, |
| 5712 | .init_hook = alc882_targa_automute, |
| 5713 | }, |
| 5714 | [ALC882_ASUS_A7J] = { |
| 5715 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 5716 | alc882_capture_mixer }, |
| 5717 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 5718 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5719 | .dac_nids = alc882_dac_nids, |
| 5720 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5721 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5722 | .adc_nids = alc882_adc_nids, |
| 5723 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5724 | .channel_mode = alc882_3ST_6ch_modes, |
| 5725 | .need_dac_fix = 1, |
| 5726 | .input_mux = &alc882_capture_source, |
| 5727 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5728 | [ALC882_ASUS_A7M] = { |
| 5729 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 5730 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5731 | alc880_gpio1_init_verbs, |
| 5732 | alc882_asus_a7m_verbs }, |
| 5733 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5734 | .dac_nids = alc882_dac_nids, |
| 5735 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5736 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5737 | .channel_mode = alc880_threestack_modes, |
| 5738 | .need_dac_fix = 1, |
| 5739 | .input_mux = &alc882_capture_source, |
| 5740 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5741 | }; |
| 5742 | |
| 5743 | |
| 5744 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 5745 | * Pin config fixes |
| 5746 | */ |
| 5747 | enum { |
| 5748 | PINFIX_ABIT_AW9D_MAX |
| 5749 | }; |
| 5750 | |
| 5751 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 5752 | { 0x15, 0x01080104 }, /* side */ |
| 5753 | { 0x16, 0x01011012 }, /* rear */ |
| 5754 | { 0x17, 0x01016011 }, /* clfe */ |
| 5755 | { } |
| 5756 | }; |
| 5757 | |
| 5758 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 5759 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 5760 | }; |
| 5761 | |
| 5762 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 5763 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 5764 | {} |
| 5765 | }; |
| 5766 | |
| 5767 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5768 | * BIOS auto configuration |
| 5769 | */ |
| 5770 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5771 | hda_nid_t nid, int pin_type, |
| 5772 | int dac_idx) |
| 5773 | { |
| 5774 | /* set as output */ |
| 5775 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5776 | int idx; |
| 5777 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5778 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 5779 | idx = 4; |
| 5780 | else |
| 5781 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 5782 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5783 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5784 | pin_type); |
| 5785 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5786 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5787 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 5788 | |
| 5789 | } |
| 5790 | |
| 5791 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 5792 | { |
| 5793 | struct alc_spec *spec = codec->spec; |
| 5794 | int i; |
| 5795 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5796 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5797 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5798 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5799 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5800 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5801 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5802 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5803 | } |
| 5804 | } |
| 5805 | |
| 5806 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 5807 | { |
| 5808 | struct alc_spec *spec = codec->spec; |
| 5809 | hda_nid_t pin; |
| 5810 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5811 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5812 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5813 | /* use dac 0 */ |
| 5814 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5815 | } |
| 5816 | |
| 5817 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 5818 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 5819 | |
| 5820 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 5821 | { |
| 5822 | struct alc_spec *spec = codec->spec; |
| 5823 | int i; |
| 5824 | |
| 5825 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5826 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5827 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5828 | snd_hda_codec_write(codec, nid, 0, |
| 5829 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5830 | i <= AUTO_PIN_FRONT_MIC ? |
| 5831 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5832 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5833 | snd_hda_codec_write(codec, nid, 0, |
| 5834 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5835 | AMP_OUT_MUTE); |
| 5836 | } |
| 5837 | } |
| 5838 | } |
| 5839 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 5840 | /* add mic boosts if needed */ |
| 5841 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 5842 | { |
| 5843 | struct alc_spec *spec = codec->spec; |
| 5844 | int err; |
| 5845 | hda_nid_t nid; |
| 5846 | |
| 5847 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 5848 | if (nid) { |
| 5849 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 5850 | "Mic Boost", |
| 5851 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 5852 | if (err < 0) |
| 5853 | return err; |
| 5854 | } |
| 5855 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 5856 | if (nid) { |
| 5857 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 5858 | "Front Mic Boost", |
| 5859 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 5860 | if (err < 0) |
| 5861 | return err; |
| 5862 | } |
| 5863 | return 0; |
| 5864 | } |
| 5865 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5866 | /* almost identical with ALC880 parser... */ |
| 5867 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 5868 | { |
| 5869 | struct alc_spec *spec = codec->spec; |
| 5870 | int err = alc880_parse_auto_config(codec); |
| 5871 | |
| 5872 | if (err < 0) |
| 5873 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 5874 | else if (!err) |
| 5875 | return 0; /* no config found */ |
| 5876 | |
| 5877 | err = alc_auto_add_mic_boost(codec); |
| 5878 | if (err < 0) |
| 5879 | return err; |
| 5880 | |
| 5881 | /* hack - override the init verbs */ |
| 5882 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 5883 | |
| 5884 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5885 | } |
| 5886 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5887 | /* additional initialization for auto-configuration model */ |
| 5888 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5889 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5890 | alc882_auto_init_multi_out(codec); |
| 5891 | alc882_auto_init_hp_out(codec); |
| 5892 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5893 | } |
| 5894 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5895 | static int patch_alc882(struct hda_codec *codec) |
| 5896 | { |
| 5897 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5898 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5899 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5900 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5901 | if (spec == NULL) |
| 5902 | return -ENOMEM; |
| 5903 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5904 | codec->spec = spec; |
| 5905 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5906 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 5907 | alc882_models, |
| 5908 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5909 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5910 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5911 | /* Pick up systems that don't supply PCI SSID */ |
| 5912 | switch (codec->subsystem_id) { |
| 5913 | case 0x106b0c00: /* Mac Pro */ |
| 5914 | board_config = ALC885_MACPRO; |
| 5915 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5916 | case 0x106b1000: /* iMac 24 */ |
| 5917 | board_config = ALC885_IMAC24; |
| 5918 | break; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5919 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 5920 | board_config = ALC885_MBP3; |
| 5921 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5922 | default: |
| 5923 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 5924 | "trying auto-probe from BIOS...\n"); |
| 5925 | board_config = ALC882_AUTO; |
| 5926 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5927 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5928 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 5929 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 5930 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5931 | if (board_config == ALC882_AUTO) { |
| 5932 | /* automatic parse from the BIOS config */ |
| 5933 | err = alc882_parse_auto_config(codec); |
| 5934 | if (err < 0) { |
| 5935 | alc_free(codec); |
| 5936 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5937 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5938 | printk(KERN_INFO |
| 5939 | "hda_codec: Cannot set up configuration " |
| 5940 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5941 | board_config = ALC882_3ST_DIG; |
| 5942 | } |
| 5943 | } |
| 5944 | |
| 5945 | if (board_config != ALC882_AUTO) |
| 5946 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5947 | |
| 5948 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5949 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 5950 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5951 | |
| 5952 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5953 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 5954 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5955 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5956 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5957 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5958 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5959 | /* get type */ |
| 5960 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5961 | if (wcap != AC_WID_AUD_IN) { |
| 5962 | spec->adc_nids = alc882_adc_nids_alt; |
| 5963 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5964 | spec->mixers[spec->num_mixers] = |
| 5965 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5966 | spec->num_mixers++; |
| 5967 | } else { |
| 5968 | spec->adc_nids = alc882_adc_nids; |
| 5969 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 5970 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 5971 | spec->num_mixers++; |
| 5972 | } |
| 5973 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5974 | |
| 5975 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5976 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5977 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5978 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5979 | if (!spec->loopback.amplist) |
| 5980 | spec->loopback.amplist = alc882_loopbacks; |
| 5981 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5982 | |
| 5983 | return 0; |
| 5984 | } |
| 5985 | |
| 5986 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5987 | * ALC883 support |
| 5988 | * |
| 5989 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 5990 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5991 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5992 | * 6-channel independent captures. |
| 5993 | * |
| 5994 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5995 | * driver yet). |
| 5996 | */ |
| 5997 | #define ALC883_DIGOUT_NID 0x06 |
| 5998 | #define ALC883_DIGIN_NID 0x0a |
| 5999 | |
| 6000 | static hda_nid_t alc883_dac_nids[4] = { |
| 6001 | /* front, rear, clfe, rear_surr */ |
| 6002 | 0x02, 0x04, 0x03, 0x05 |
| 6003 | }; |
| 6004 | |
| 6005 | static hda_nid_t alc883_adc_nids[2] = { |
| 6006 | /* ADC1-2 */ |
| 6007 | 0x08, 0x09, |
| 6008 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6009 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6010 | /* input MUX */ |
| 6011 | /* FIXME: should be a matrix-type input source selection */ |
| 6012 | |
| 6013 | static struct hda_input_mux alc883_capture_source = { |
| 6014 | .num_items = 4, |
| 6015 | .items = { |
| 6016 | { "Mic", 0x0 }, |
| 6017 | { "Front Mic", 0x1 }, |
| 6018 | { "Line", 0x2 }, |
| 6019 | { "CD", 0x4 }, |
| 6020 | }, |
| 6021 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6022 | |
| 6023 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6024 | .num_items = 2, |
| 6025 | .items = { |
| 6026 | { "Mic", 0x1 }, |
| 6027 | { "Line", 0x2 }, |
| 6028 | }, |
| 6029 | }; |
| 6030 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6031 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6032 | .num_items = 4, |
| 6033 | .items = { |
| 6034 | { "Mic", 0x0 }, |
| 6035 | { "iMic", 0x1 }, |
| 6036 | { "Line", 0x2 }, |
| 6037 | { "CD", 0x4 }, |
| 6038 | }, |
| 6039 | }; |
| 6040 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6041 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6042 | #define alc883_mux_enum_get alc_mux_enum_get |
| 6043 | |
| 6044 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 6045 | struct snd_ctl_elem_value *ucontrol) |
| 6046 | { |
| 6047 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6048 | struct alc_spec *spec = codec->spec; |
| 6049 | const struct hda_input_mux *imux = spec->input_mux; |
| 6050 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 6051 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 6052 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 6053 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 6054 | unsigned int i, idx; |
| 6055 | |
| 6056 | idx = ucontrol->value.enumerated.item[0]; |
| 6057 | if (idx >= imux->num_items) |
| 6058 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6059 | if (*cur_val == idx) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6060 | return 0; |
| 6061 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6062 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 6063 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6064 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6065 | HDA_AMP_MUTE, v); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6066 | } |
| 6067 | *cur_val = idx; |
| 6068 | return 1; |
| 6069 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6070 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6071 | /* |
| 6072 | * 2ch mode |
| 6073 | */ |
| 6074 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6075 | { 2, NULL } |
| 6076 | }; |
| 6077 | |
| 6078 | /* |
| 6079 | * 2ch mode |
| 6080 | */ |
| 6081 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6082 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6083 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6084 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6085 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6086 | { } /* end */ |
| 6087 | }; |
| 6088 | |
| 6089 | /* |
| 6090 | * 6ch mode |
| 6091 | */ |
| 6092 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6093 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6094 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6095 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6096 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6097 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6098 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6099 | { } /* end */ |
| 6100 | }; |
| 6101 | |
| 6102 | static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { |
| 6103 | { 2, alc883_3ST_ch2_init }, |
| 6104 | { 6, alc883_3ST_ch6_init }, |
| 6105 | }; |
| 6106 | |
| 6107 | /* |
| 6108 | * 6ch mode |
| 6109 | */ |
| 6110 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6111 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6112 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6113 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6114 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6115 | { } /* end */ |
| 6116 | }; |
| 6117 | |
| 6118 | /* |
| 6119 | * 8ch mode |
| 6120 | */ |
| 6121 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6122 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6123 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6124 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6125 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6126 | { } /* end */ |
| 6127 | }; |
| 6128 | |
| 6129 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6130 | { 6, alc883_sixstack_ch6_init }, |
| 6131 | { 8, alc883_sixstack_ch8_init }, |
| 6132 | }; |
| 6133 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6134 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6135 | /* eanable EAPD on medion laptop */ |
| 6136 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6137 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6138 | { } |
| 6139 | }; |
| 6140 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6141 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6142 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6143 | */ |
| 6144 | |
| 6145 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 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", 0x0d, 0x0, HDA_OUTPUT), |
| 6149 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6150 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6151 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6152 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6153 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 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), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6162 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6164 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6165 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 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 | |
| 6185 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6189 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6190 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6191 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6192 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6193 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6194 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6195 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6196 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6197 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6198 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6199 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6200 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6201 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6202 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6203 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6204 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6205 | { |
| 6206 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6207 | /* .name = "Capture Source", */ |
| 6208 | .name = "Input Source", |
| 6209 | .count = 2, |
| 6210 | .info = alc883_mux_enum_info, |
| 6211 | .get = alc883_mux_enum_get, |
| 6212 | .put = alc883_mux_enum_put, |
| 6213 | }, |
| 6214 | { } /* end */ |
| 6215 | }; |
| 6216 | |
| 6217 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6218 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6219 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6220 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6221 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6222 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6223 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6224 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6225 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6227 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6228 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6229 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6230 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6231 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6232 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6233 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6234 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6235 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6236 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6237 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6238 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6239 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6240 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6241 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6242 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6243 | { |
| 6244 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6245 | /* .name = "Capture Source", */ |
| 6246 | .name = "Input Source", |
| 6247 | .count = 2, |
| 6248 | .info = alc883_mux_enum_info, |
| 6249 | .get = alc883_mux_enum_get, |
| 6250 | .put = alc883_mux_enum_put, |
| 6251 | }, |
| 6252 | { } /* end */ |
| 6253 | }; |
| 6254 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6255 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6256 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6257 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6258 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6259 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6260 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6261 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6262 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6263 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6264 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6265 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6266 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6267 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6268 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6269 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6270 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6271 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6272 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6273 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6274 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6275 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6276 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6277 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6278 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6279 | |
| 6280 | { |
| 6281 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6282 | /* .name = "Capture Source", */ |
| 6283 | .name = "Input Source", |
| 6284 | .count = 1, |
| 6285 | .info = alc883_mux_enum_info, |
| 6286 | .get = alc883_mux_enum_get, |
| 6287 | .put = alc883_mux_enum_put, |
| 6288 | }, |
| 6289 | { } /* end */ |
| 6290 | }; |
| 6291 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6292 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6293 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6294 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6295 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6296 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6297 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6298 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6299 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6300 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6301 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6302 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6303 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6304 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6305 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6306 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6307 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6308 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6309 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6310 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6311 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6312 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6313 | { |
| 6314 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6315 | /* .name = "Capture Source", */ |
| 6316 | .name = "Input Source", |
| 6317 | .count = 2, |
| 6318 | .info = alc883_mux_enum_info, |
| 6319 | .get = alc883_mux_enum_get, |
| 6320 | .put = alc883_mux_enum_put, |
| 6321 | }, |
| 6322 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6323 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6324 | |
| 6325 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6326 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6327 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6328 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6329 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6330 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6331 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6332 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6333 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6334 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6335 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6336 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6337 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6338 | { |
| 6339 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6340 | /* .name = "Capture Source", */ |
| 6341 | .name = "Input Source", |
| 6342 | .count = 2, |
| 6343 | .info = alc883_mux_enum_info, |
| 6344 | .get = alc883_mux_enum_get, |
| 6345 | .put = alc883_mux_enum_put, |
| 6346 | }, |
| 6347 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6348 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6349 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6350 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6351 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6352 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6353 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6354 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6355 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6356 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6357 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6358 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6359 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6360 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6361 | { |
| 6362 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6363 | /* .name = "Capture Source", */ |
| 6364 | .name = "Input Source", |
| 6365 | .count = 1, |
| 6366 | .info = alc883_mux_enum_info, |
| 6367 | .get = alc883_mux_enum_get, |
| 6368 | .put = alc883_mux_enum_put, |
| 6369 | }, |
| 6370 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6371 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6372 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6373 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6374 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6375 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6376 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6377 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6378 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6379 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6381 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6382 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6383 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6384 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6385 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6386 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6387 | { |
| 6388 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6389 | /* .name = "Capture Source", */ |
| 6390 | .name = "Input Source", |
| 6391 | .count = 2, |
| 6392 | .info = alc883_mux_enum_info, |
| 6393 | .get = alc883_mux_enum_get, |
| 6394 | .put = alc883_mux_enum_put, |
| 6395 | }, |
| 6396 | { } /* end */ |
| 6397 | }; |
| 6398 | |
| 6399 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6400 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6401 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6402 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6403 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6404 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6405 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6406 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6407 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6408 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6409 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6410 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6411 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6412 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6413 | { |
| 6414 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6415 | /* .name = "Capture Source", */ |
| 6416 | .name = "Input Source", |
| 6417 | .count = 2, |
| 6418 | .info = alc883_mux_enum_info, |
| 6419 | .get = alc883_mux_enum_get, |
| 6420 | .put = alc883_mux_enum_put, |
| 6421 | }, |
| 6422 | { } /* end */ |
| 6423 | }; |
| 6424 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6425 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6426 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6427 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6428 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6429 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6430 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6431 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6432 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6433 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6434 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6435 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6436 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6437 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6438 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6439 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6440 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6441 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6442 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6443 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6444 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6445 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6446 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6447 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6448 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6449 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6450 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6451 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6452 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6453 | { |
| 6454 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6455 | /* .name = "Capture Source", */ |
| 6456 | .name = "Input Source", |
| 6457 | .count = 2, |
| 6458 | .info = alc883_mux_enum_info, |
| 6459 | .get = alc883_mux_enum_get, |
| 6460 | .put = alc883_mux_enum_put, |
| 6461 | }, |
| 6462 | { } /* end */ |
| 6463 | }; |
| 6464 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6465 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6466 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6467 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6468 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6469 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6470 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6471 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6472 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6473 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6474 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6475 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6476 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6477 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6478 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6479 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6480 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6481 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6482 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6483 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6484 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6485 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6486 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6487 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6488 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6489 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6490 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6491 | { |
| 6492 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6493 | /* .name = "Capture Source", */ |
| 6494 | .name = "Input Source", |
| 6495 | .count = 2, |
| 6496 | .info = alc883_mux_enum_info, |
| 6497 | .get = alc883_mux_enum_get, |
| 6498 | .put = alc883_mux_enum_put, |
| 6499 | }, |
| 6500 | { } /* end */ |
| 6501 | }; |
| 6502 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6503 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6504 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6505 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6506 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6507 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6508 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6509 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6510 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6511 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6512 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6513 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6514 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6515 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6516 | { |
| 6517 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6518 | /* .name = "Capture Source", */ |
| 6519 | .name = "Input Source", |
| 6520 | .count = 2, |
| 6521 | .info = alc883_mux_enum_info, |
| 6522 | .get = alc883_mux_enum_get, |
| 6523 | .put = alc883_mux_enum_put, |
| 6524 | }, |
| 6525 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6526 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6527 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6528 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 6529 | { |
| 6530 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6531 | .name = "Channel Mode", |
| 6532 | .info = alc_ch_mode_info, |
| 6533 | .get = alc_ch_mode_get, |
| 6534 | .put = alc_ch_mode_put, |
| 6535 | }, |
| 6536 | { } /* end */ |
| 6537 | }; |
| 6538 | |
| 6539 | static struct hda_verb alc883_init_verbs[] = { |
| 6540 | /* ADC1: mute amp left and right */ |
| 6541 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6542 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6543 | /* ADC2: mute amp left and right */ |
| 6544 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6545 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6546 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6547 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6548 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6549 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6550 | /* Rear mixer */ |
| 6551 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6552 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6553 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6554 | /* CLFE mixer */ |
| 6555 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6556 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6557 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6558 | /* Side mixer */ |
| 6559 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6560 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6561 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6562 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6563 | /* mute analog input loopbacks */ |
| 6564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6569 | |
| 6570 | /* Front Pin: output 0 (0x0c) */ |
| 6571 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6572 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6573 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6574 | /* Rear Pin: output 1 (0x0d) */ |
| 6575 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6576 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6577 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6578 | /* CLFE Pin: output 2 (0x0e) */ |
| 6579 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6580 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6581 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6582 | /* Side Pin: output 3 (0x0f) */ |
| 6583 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6584 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6585 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 6586 | /* Mic (rear) pin: input vref at 80% */ |
| 6587 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6588 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6589 | /* Front Mic pin: input vref at 80% */ |
| 6590 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6591 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6592 | /* Line In pin: input */ |
| 6593 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6594 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6595 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6596 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6597 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6598 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6599 | /* CD pin widget for input */ |
| 6600 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6601 | |
| 6602 | /* FIXME: use matrix-type input source selection */ |
| 6603 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6604 | /* Input mixer2 */ |
| 6605 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6606 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6607 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6608 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6609 | /* Input mixer3 */ |
| 6610 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6611 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6612 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6613 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6614 | { } |
| 6615 | }; |
| 6616 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6617 | static struct hda_verb alc883_tagra_verbs[] = { |
| 6618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6619 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6620 | |
| 6621 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6622 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6623 | |
| 6624 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6625 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6626 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6627 | |
| 6628 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6629 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6630 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6631 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6632 | |
| 6633 | { } /* end */ |
| 6634 | }; |
| 6635 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6636 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 6637 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6638 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 6639 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 6640 | { } /* end */ |
| 6641 | }; |
| 6642 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6643 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 6644 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6645 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6646 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6647 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6648 | { } /* end */ |
| 6649 | }; |
| 6650 | |
| 6651 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 6652 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6654 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6655 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 6656 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6657 | { } /* end */ |
| 6658 | }; |
| 6659 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 6660 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 6661 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6662 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6663 | |
| 6664 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6665 | |
| 6666 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6667 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6668 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6669 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6670 | { } /* end */ |
| 6671 | }; |
| 6672 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6673 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6674 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6675 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 6676 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 6677 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 6678 | { } |
| 6679 | }; |
| 6680 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6681 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6682 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6683 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 6684 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 6685 | { } |
| 6686 | }; |
| 6687 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6688 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6689 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6690 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6691 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6692 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6693 | { } |
| 6694 | }; |
| 6695 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6696 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6697 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6698 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6699 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6700 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6701 | { } |
| 6702 | }; |
| 6703 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6704 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 6705 | { 2, alc888_3st_hp_2ch_init }, |
| 6706 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6707 | }; |
| 6708 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6709 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 6710 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 6711 | { |
| 6712 | unsigned int present; |
| 6713 | |
| 6714 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6715 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6716 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6717 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6718 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6719 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6720 | } |
| 6721 | |
| 6722 | /* toggle RCA according to the front-jack state */ |
| 6723 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 6724 | { |
| 6725 | unsigned int present; |
| 6726 | |
| 6727 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6728 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6729 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6730 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6731 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6732 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6733 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 6734 | unsigned int res) |
| 6735 | { |
| 6736 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6737 | alc888_lenovo_ms7195_front_automute(codec); |
| 6738 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6739 | alc888_lenovo_ms7195_rca_automute(codec); |
| 6740 | } |
| 6741 | |
| 6742 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 6743 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6744 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6745 | |
| 6746 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6747 | |
| 6748 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6749 | { } /* end */ |
| 6750 | }; |
| 6751 | |
| 6752 | /* toggle speaker-output according to the hp-jack state */ |
| 6753 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 6754 | { |
| 6755 | unsigned int present; |
| 6756 | |
| 6757 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6758 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6759 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6760 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6761 | } |
| 6762 | |
| 6763 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 6764 | unsigned int res) |
| 6765 | { |
| 6766 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6767 | alc883_medion_md2_automute(codec); |
| 6768 | } |
| 6769 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6770 | /* toggle speaker-output according to the hp-jack state */ |
| 6771 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 6772 | { |
| 6773 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6774 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6775 | |
| 6776 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6777 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6778 | bits = present ? HDA_AMP_MUTE : 0; |
| 6779 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6780 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6781 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6782 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6783 | } |
| 6784 | |
| 6785 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6786 | { |
| 6787 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6788 | alc883_tagra_automute(codec); |
| 6789 | } |
| 6790 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 6791 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 6792 | { |
| 6793 | unsigned int present; |
| 6794 | unsigned char bits; |
| 6795 | |
| 6796 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6797 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6798 | bits = present ? 0x80 : 0; |
| 6799 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6800 | 0x80, bits); |
| 6801 | } |
| 6802 | |
| 6803 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 6804 | unsigned int res) |
| 6805 | { |
| 6806 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6807 | alc883_haier_w66_automute(codec); |
| 6808 | } |
| 6809 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6810 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 6811 | { |
| 6812 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6813 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6814 | |
| 6815 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6816 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6817 | bits = present ? HDA_AMP_MUTE : 0; |
| 6818 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6819 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6820 | } |
| 6821 | |
| 6822 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 6823 | { |
| 6824 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6825 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6826 | |
| 6827 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6828 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6829 | bits = present ? HDA_AMP_MUTE : 0; |
| 6830 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6831 | HDA_AMP_MUTE, bits); |
| 6832 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6833 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6834 | } |
| 6835 | |
| 6836 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 6837 | unsigned int res) |
| 6838 | { |
| 6839 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6840 | alc883_lenovo_101e_all_automute(codec); |
| 6841 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6842 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 6843 | } |
| 6844 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 6845 | /* toggle speaker-output according to the hp-jack state */ |
| 6846 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 6847 | { |
| 6848 | unsigned int present; |
| 6849 | |
| 6850 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6851 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6852 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6853 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6854 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 6855 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6856 | } |
| 6857 | |
| 6858 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 6859 | unsigned int res) |
| 6860 | { |
| 6861 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6862 | alc883_acer_aspire_automute(codec); |
| 6863 | } |
| 6864 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6865 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 6866 | /* HP Pin: output 0 (0x0c) */ |
| 6867 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6868 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6869 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6870 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 6871 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6872 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6873 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6874 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6875 | /* eanable EAPD on medion laptop */ |
| 6876 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6877 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 6878 | /* enable unsolicited event */ |
| 6879 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6880 | { } |
| 6881 | }; |
| 6882 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6883 | /* |
| 6884 | * generic initialization of ADC, input mixers and output mixers |
| 6885 | */ |
| 6886 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 6887 | /* |
| 6888 | * Unmute ADC0-2 and set the default input to mic-in |
| 6889 | */ |
| 6890 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6891 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6892 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6893 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6894 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6895 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6896 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6897 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6898 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6899 | */ |
| 6900 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6903 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6904 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6905 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6906 | |
| 6907 | /* |
| 6908 | * Set up output mixers (0x0c - 0x0f) |
| 6909 | */ |
| 6910 | /* set vol=0 to output mixers */ |
| 6911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6912 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6913 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6914 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6915 | /* set up input amps for analog loopback */ |
| 6916 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6918 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6919 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6920 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6924 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6925 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6926 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6927 | |
| 6928 | /* FIXME: use matrix-type input source selection */ |
| 6929 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6930 | /* Input mixer1 */ |
| 6931 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6932 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6933 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6934 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6935 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6936 | /* Input mixer2 */ |
| 6937 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6938 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6939 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6940 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6941 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6942 | |
| 6943 | { } |
| 6944 | }; |
| 6945 | |
| 6946 | /* capture mixer elements */ |
| 6947 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 6948 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6949 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6950 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6951 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6952 | { |
| 6953 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6954 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6955 | * So call somewhat different.. |
| 6956 | * FIXME: the controls appear in the "playback" view! |
| 6957 | */ |
| 6958 | /* .name = "Capture Source", */ |
| 6959 | .name = "Input Source", |
| 6960 | .count = 2, |
| 6961 | .info = alc882_mux_enum_info, |
| 6962 | .get = alc882_mux_enum_get, |
| 6963 | .put = alc882_mux_enum_put, |
| 6964 | }, |
| 6965 | { } /* end */ |
| 6966 | }; |
| 6967 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6968 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6969 | #define alc883_loopbacks alc880_loopbacks |
| 6970 | #endif |
| 6971 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6972 | /* pcm configuration: identiacal with ALC880 */ |
| 6973 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 6974 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 6975 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 6976 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 6977 | |
| 6978 | /* |
| 6979 | * configuration and preset |
| 6980 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6981 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 6982 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 6983 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 6984 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 6985 | [ALC883_6ST_DIG] = "6stack-dig", |
| 6986 | [ALC883_TARGA_DIG] = "targa-dig", |
| 6987 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6988 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6989 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6990 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6991 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6992 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6993 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6994 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 6995 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 6996 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6997 | [ALC888_6ST_HP] = "6stack-hp", |
| 6998 | [ALC888_3ST_HP] = "3stack-hp", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6999 | [ALC883_AUTO] = "auto", |
| 7000 | }; |
| 7001 | |
| 7002 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7003 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7004 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7005 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
| 7006 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
| 7007 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7008 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7009 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7010 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7011 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7012 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7013 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Daniel T Chen | 6f3bf65 | 2007-06-08 11:39:35 +0200 | [diff] [blame] | 7014 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7015 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Baruch Even | dd146a6 | 2007-05-25 12:18:49 +0200 | [diff] [blame] | 7016 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7017 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7018 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7019 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7020 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7021 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | 64ca1c2 | 2007-08-16 17:23:32 +0200 | [diff] [blame] | 7022 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7023 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7024 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7025 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
| 7026 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7027 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7028 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 8da6470 | 2007-09-05 19:14:38 +0200 | [diff] [blame] | 7029 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7030 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7031 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7032 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
| 7033 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7034 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7035 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
| 7036 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7037 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7038 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 7039 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 7040 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7041 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7042 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
| 7043 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7044 | {} |
| 7045 | }; |
| 7046 | |
| 7047 | static struct alc_config_preset alc883_presets[] = { |
| 7048 | [ALC883_3ST_2ch_DIG] = { |
| 7049 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7050 | .init_verbs = { alc883_init_verbs }, |
| 7051 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7052 | .dac_nids = alc883_dac_nids, |
| 7053 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7054 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7055 | .adc_nids = alc883_adc_nids, |
| 7056 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7057 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7058 | .channel_mode = alc883_3ST_2ch_modes, |
| 7059 | .input_mux = &alc883_capture_source, |
| 7060 | }, |
| 7061 | [ALC883_3ST_6ch_DIG] = { |
| 7062 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7063 | .init_verbs = { alc883_init_verbs }, |
| 7064 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7065 | .dac_nids = alc883_dac_nids, |
| 7066 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7067 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7068 | .adc_nids = alc883_adc_nids, |
| 7069 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7070 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7071 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7072 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7073 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7074 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7075 | [ALC883_3ST_6ch] = { |
| 7076 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7077 | .init_verbs = { alc883_init_verbs }, |
| 7078 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7079 | .dac_nids = alc883_dac_nids, |
| 7080 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7081 | .adc_nids = alc883_adc_nids, |
| 7082 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7083 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7084 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7085 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7086 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7087 | [ALC883_6ST_DIG] = { |
| 7088 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7089 | .init_verbs = { alc883_init_verbs }, |
| 7090 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7091 | .dac_nids = alc883_dac_nids, |
| 7092 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7093 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7094 | .adc_nids = alc883_adc_nids, |
| 7095 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7096 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7097 | .channel_mode = alc883_sixstack_modes, |
| 7098 | .input_mux = &alc883_capture_source, |
| 7099 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7100 | [ALC883_TARGA_DIG] = { |
| 7101 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7102 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7103 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7104 | .dac_nids = alc883_dac_nids, |
| 7105 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7106 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7107 | .adc_nids = alc883_adc_nids, |
| 7108 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7109 | .channel_mode = alc883_3ST_6ch_modes, |
| 7110 | .need_dac_fix = 1, |
| 7111 | .input_mux = &alc883_capture_source, |
| 7112 | .unsol_event = alc883_tagra_unsol_event, |
| 7113 | .init_hook = alc883_tagra_automute, |
| 7114 | }, |
| 7115 | [ALC883_TARGA_2ch_DIG] = { |
| 7116 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7117 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7118 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7119 | .dac_nids = alc883_dac_nids, |
| 7120 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7121 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7122 | .adc_nids = alc883_adc_nids, |
| 7123 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7124 | .channel_mode = alc883_3ST_2ch_modes, |
| 7125 | .input_mux = &alc883_capture_source, |
| 7126 | .unsol_event = alc883_tagra_unsol_event, |
| 7127 | .init_hook = alc883_tagra_automute, |
| 7128 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7129 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7130 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7131 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7132 | * and the headphone jack. Turn this on and rely on the |
| 7133 | * standard mute methods whenever the user wants to turn |
| 7134 | * these outputs off. |
| 7135 | */ |
| 7136 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7137 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7138 | .dac_nids = alc883_dac_nids, |
| 7139 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7140 | .adc_nids = alc883_adc_nids, |
| 7141 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7142 | .channel_mode = alc883_3ST_2ch_modes, |
| 7143 | .input_mux = &alc883_capture_source, |
| 7144 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7145 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7146 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7147 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7148 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7149 | .dac_nids = alc883_dac_nids, |
| 7150 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7151 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7152 | .adc_nids = alc883_adc_nids, |
| 7153 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7154 | .channel_mode = alc883_3ST_2ch_modes, |
| 7155 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7156 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7157 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7158 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7159 | [ALC883_MEDION] = { |
| 7160 | .mixers = { alc883_fivestack_mixer, |
| 7161 | alc883_chmode_mixer }, |
| 7162 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7163 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7164 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7165 | .dac_nids = alc883_dac_nids, |
| 7166 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7167 | .adc_nids = alc883_adc_nids, |
| 7168 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7169 | .channel_mode = alc883_sixstack_modes, |
| 7170 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7171 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7172 | [ALC883_MEDION_MD2] = { |
| 7173 | .mixers = { alc883_medion_md2_mixer}, |
| 7174 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7175 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7176 | .dac_nids = alc883_dac_nids, |
| 7177 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7178 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7179 | .adc_nids = alc883_adc_nids, |
| 7180 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7181 | .channel_mode = alc883_3ST_2ch_modes, |
| 7182 | .input_mux = &alc883_capture_source, |
| 7183 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7184 | .init_hook = alc883_medion_md2_automute, |
| 7185 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7186 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7187 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7188 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7189 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7190 | .dac_nids = alc883_dac_nids, |
| 7191 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7192 | .adc_nids = alc883_adc_nids, |
| 7193 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7194 | .channel_mode = alc883_3ST_2ch_modes, |
| 7195 | .input_mux = &alc883_capture_source, |
| 7196 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7197 | [ALC883_LENOVO_101E_2ch] = { |
| 7198 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7199 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7200 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7201 | .dac_nids = alc883_dac_nids, |
| 7202 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7203 | .adc_nids = alc883_adc_nids, |
| 7204 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7205 | .channel_mode = alc883_3ST_2ch_modes, |
| 7206 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7207 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7208 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7209 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7210 | [ALC883_LENOVO_NB0763] = { |
| 7211 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7212 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7213 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7214 | .dac_nids = alc883_dac_nids, |
| 7215 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7216 | .adc_nids = alc883_adc_nids, |
| 7217 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7218 | .channel_mode = alc883_3ST_2ch_modes, |
| 7219 | .need_dac_fix = 1, |
| 7220 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7221 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7222 | .init_hook = alc883_medion_md2_automute, |
| 7223 | }, |
| 7224 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7225 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7226 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7227 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7228 | .dac_nids = alc883_dac_nids, |
| 7229 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7230 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7231 | .adc_nids = alc883_adc_nids, |
| 7232 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7233 | .channel_mode = alc883_3ST_6ch_modes, |
| 7234 | .need_dac_fix = 1, |
| 7235 | .input_mux = &alc883_capture_source, |
| 7236 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7237 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7238 | }, |
| 7239 | [ALC883_HAIER_W66] = { |
| 7240 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7241 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7242 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7243 | .dac_nids = alc883_dac_nids, |
| 7244 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7245 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7246 | .adc_nids = alc883_adc_nids, |
| 7247 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7248 | .channel_mode = alc883_3ST_2ch_modes, |
| 7249 | .input_mux = &alc883_capture_source, |
| 7250 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7251 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7252 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7253 | [ALC888_6ST_HP] = { |
| 7254 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 7255 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7256 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7257 | .dac_nids = alc883_dac_nids, |
| 7258 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7259 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7260 | .adc_nids = alc883_adc_nids, |
| 7261 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7262 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7263 | .channel_mode = alc883_sixstack_modes, |
| 7264 | .input_mux = &alc883_capture_source, |
| 7265 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7266 | [ALC888_3ST_HP] = { |
| 7267 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7268 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7269 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7270 | .dac_nids = alc883_dac_nids, |
| 7271 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7272 | .adc_nids = alc883_adc_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7273 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7274 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7275 | .need_dac_fix = 1, |
| 7276 | .input_mux = &alc883_capture_source, |
| 7277 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7278 | }; |
| 7279 | |
| 7280 | |
| 7281 | /* |
| 7282 | * BIOS auto configuration |
| 7283 | */ |
| 7284 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7285 | hda_nid_t nid, int pin_type, |
| 7286 | int dac_idx) |
| 7287 | { |
| 7288 | /* set as output */ |
| 7289 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7290 | int idx; |
| 7291 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7292 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7293 | idx = 4; |
| 7294 | else |
| 7295 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 7296 | |
| 7297 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7298 | pin_type); |
| 7299 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7300 | AMP_OUT_UNMUTE); |
| 7301 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7302 | |
| 7303 | } |
| 7304 | |
| 7305 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 7306 | { |
| 7307 | struct alc_spec *spec = codec->spec; |
| 7308 | int i; |
| 7309 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7310 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7311 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7312 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7313 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7314 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7315 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7316 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7317 | } |
| 7318 | } |
| 7319 | |
| 7320 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 7321 | { |
| 7322 | struct alc_spec *spec = codec->spec; |
| 7323 | hda_nid_t pin; |
| 7324 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7325 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7326 | if (pin) /* connect to front */ |
| 7327 | /* use dac 0 */ |
| 7328 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 7329 | } |
| 7330 | |
| 7331 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7332 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 7333 | |
| 7334 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 7335 | { |
| 7336 | struct alc_spec *spec = codec->spec; |
| 7337 | int i; |
| 7338 | |
| 7339 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7340 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 7341 | if (alc883_is_input_pin(nid)) { |
| 7342 | snd_hda_codec_write(codec, nid, 0, |
| 7343 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7344 | (i <= AUTO_PIN_FRONT_MIC ? |
| 7345 | PIN_VREF80 : PIN_IN)); |
| 7346 | if (nid != ALC883_PIN_CD_NID) |
| 7347 | snd_hda_codec_write(codec, nid, 0, |
| 7348 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7349 | AMP_OUT_MUTE); |
| 7350 | } |
| 7351 | } |
| 7352 | } |
| 7353 | |
| 7354 | /* almost identical with ALC880 parser... */ |
| 7355 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 7356 | { |
| 7357 | struct alc_spec *spec = codec->spec; |
| 7358 | int err = alc880_parse_auto_config(codec); |
| 7359 | |
| 7360 | if (err < 0) |
| 7361 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7362 | else if (!err) |
| 7363 | return 0; /* no config found */ |
| 7364 | |
| 7365 | err = alc_auto_add_mic_boost(codec); |
| 7366 | if (err < 0) |
| 7367 | return err; |
| 7368 | |
| 7369 | /* hack - override the init verbs */ |
| 7370 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7371 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 7372 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7373 | |
| 7374 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7375 | } |
| 7376 | |
| 7377 | /* additional initialization for auto-configuration model */ |
| 7378 | static void alc883_auto_init(struct hda_codec *codec) |
| 7379 | { |
| 7380 | alc883_auto_init_multi_out(codec); |
| 7381 | alc883_auto_init_hp_out(codec); |
| 7382 | alc883_auto_init_analog_input(codec); |
| 7383 | } |
| 7384 | |
| 7385 | static int patch_alc883(struct hda_codec *codec) |
| 7386 | { |
| 7387 | struct alc_spec *spec; |
| 7388 | int err, board_config; |
| 7389 | |
| 7390 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 7391 | if (spec == NULL) |
| 7392 | return -ENOMEM; |
| 7393 | |
| 7394 | codec->spec = spec; |
| 7395 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7396 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 7397 | alc883_models, |
| 7398 | alc883_cfg_tbl); |
| 7399 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7400 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 7401 | "trying auto-probe from BIOS...\n"); |
| 7402 | board_config = ALC883_AUTO; |
| 7403 | } |
| 7404 | |
| 7405 | if (board_config == ALC883_AUTO) { |
| 7406 | /* automatic parse from the BIOS config */ |
| 7407 | err = alc883_parse_auto_config(codec); |
| 7408 | if (err < 0) { |
| 7409 | alc_free(codec); |
| 7410 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7411 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7412 | printk(KERN_INFO |
| 7413 | "hda_codec: Cannot set up configuration " |
| 7414 | "from BIOS. Using base mode...\n"); |
| 7415 | board_config = ALC883_3ST_2ch_DIG; |
| 7416 | } |
| 7417 | } |
| 7418 | |
| 7419 | if (board_config != ALC883_AUTO) |
| 7420 | setup_preset(spec, &alc883_presets[board_config]); |
| 7421 | |
| 7422 | spec->stream_name_analog = "ALC883 Analog"; |
| 7423 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 7424 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 7425 | |
| 7426 | spec->stream_name_digital = "ALC883 Digital"; |
| 7427 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 7428 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 7429 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7430 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7431 | spec->adc_nids = alc883_adc_nids; |
| 7432 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 7433 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7434 | |
| 7435 | codec->patch_ops = alc_patch_ops; |
| 7436 | if (board_config == ALC883_AUTO) |
| 7437 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7438 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7439 | if (!spec->loopback.amplist) |
| 7440 | spec->loopback.amplist = alc883_loopbacks; |
| 7441 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7442 | |
| 7443 | return 0; |
| 7444 | } |
| 7445 | |
| 7446 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7447 | * ALC262 support |
| 7448 | */ |
| 7449 | |
| 7450 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 7451 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 7452 | |
| 7453 | #define alc262_dac_nids alc260_dac_nids |
| 7454 | #define alc262_adc_nids alc882_adc_nids |
| 7455 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 7456 | |
| 7457 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 7458 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7459 | |
| 7460 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 7461 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7462 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7463 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7464 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7465 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7466 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7469 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7470 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7471 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7472 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7473 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7474 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7475 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 7476 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7477 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7478 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7479 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7480 | }; |
| 7481 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7482 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 7483 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7484 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7485 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7486 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7487 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7488 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7489 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7490 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7491 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7492 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7493 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7494 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7495 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7496 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7497 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 7498 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7499 | { } /* end */ |
| 7500 | }; |
| 7501 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7502 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 7503 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7504 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7505 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7506 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7507 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7508 | |
| 7509 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7510 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7511 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7512 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7513 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7514 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7515 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7516 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7517 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7518 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7519 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7520 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7521 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 7522 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 7523 | { } /* end */ |
| 7524 | }; |
| 7525 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7526 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
| 7527 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7528 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7529 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7530 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7531 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7532 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7533 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7534 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7535 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7536 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7537 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7538 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7539 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7540 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7541 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7542 | { } /* end */ |
| 7543 | }; |
| 7544 | |
| 7545 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 7546 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7547 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7548 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7549 | { } /* end */ |
| 7550 | }; |
| 7551 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 7552 | /* bind hp and internal speaker mute (with plug check) */ |
| 7553 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 7554 | struct snd_ctl_elem_value *ucontrol) |
| 7555 | { |
| 7556 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7557 | long *valp = ucontrol->value.integer.value; |
| 7558 | int change; |
| 7559 | |
| 7560 | /* change hp mute */ |
| 7561 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 7562 | HDA_AMP_MUTE, |
| 7563 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 7564 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 7565 | HDA_AMP_MUTE, |
| 7566 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 7567 | if (change) { |
| 7568 | /* change speaker according to HP jack state */ |
| 7569 | struct alc_spec *spec = codec->spec; |
| 7570 | unsigned int mute; |
| 7571 | if (spec->jack_present) |
| 7572 | mute = HDA_AMP_MUTE; |
| 7573 | else |
| 7574 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 7575 | HDA_OUTPUT, 0); |
| 7576 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7577 | HDA_AMP_MUTE, mute); |
| 7578 | } |
| 7579 | return change; |
| 7580 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7581 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7582 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 7583 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7584 | { |
| 7585 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7586 | .name = "Master Playback Switch", |
| 7587 | .info = snd_hda_mixer_amp_switch_info, |
| 7588 | .get = snd_hda_mixer_amp_switch_get, |
| 7589 | .put = alc262_sony_master_sw_put, |
| 7590 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 7591 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7593 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7594 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7595 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7596 | { } /* end */ |
| 7597 | }; |
| 7598 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7599 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 7600 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7601 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7602 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7603 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7605 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7606 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7607 | { } /* end */ |
| 7608 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7609 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7610 | #define alc262_capture_mixer alc882_capture_mixer |
| 7611 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 7612 | |
| 7613 | /* |
| 7614 | * generic initialization of ADC, input mixers and output mixers |
| 7615 | */ |
| 7616 | static struct hda_verb alc262_init_verbs[] = { |
| 7617 | /* |
| 7618 | * Unmute ADC0-2 and set the default input to mic-in |
| 7619 | */ |
| 7620 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7621 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7622 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7623 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7624 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7625 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7626 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7627 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7628 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7629 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7630 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7631 | */ |
| 7632 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7633 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7634 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7635 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7636 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7637 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7638 | |
| 7639 | /* |
| 7640 | * Set up output mixers (0x0c - 0x0e) |
| 7641 | */ |
| 7642 | /* set vol=0 to output mixers */ |
| 7643 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7644 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7645 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7646 | /* set up input amps for analog loopback */ |
| 7647 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7648 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7649 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7650 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7651 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7652 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7653 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7654 | |
| 7655 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7656 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7657 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7658 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7659 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7660 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7661 | |
| 7662 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7663 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7664 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7665 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7666 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7667 | |
| 7668 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7669 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7670 | |
| 7671 | /* FIXME: use matrix-type input source selection */ |
| 7672 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7673 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7674 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7675 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7676 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7677 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7678 | /* Input mixer2 */ |
| 7679 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7680 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7681 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7682 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7683 | /* Input mixer3 */ |
| 7684 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7685 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7686 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7687 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7688 | |
| 7689 | { } |
| 7690 | }; |
| 7691 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7692 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 7693 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7695 | {} |
| 7696 | }; |
| 7697 | |
| 7698 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 7699 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7700 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7701 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 7702 | |
| 7703 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7704 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7705 | {} |
| 7706 | }; |
| 7707 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7708 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 7709 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7710 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7711 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 7712 | |
| 7713 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7714 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7715 | }; |
| 7716 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7717 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7718 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7719 | { |
| 7720 | struct alc_spec *spec = codec->spec; |
| 7721 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7722 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7723 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7724 | /* need to execute and sync at first */ |
| 7725 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7726 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7727 | AC_VERB_GET_PIN_SENSE, 0); |
| 7728 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7729 | if (spec->jack_present) { |
| 7730 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7731 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7732 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7733 | } else { |
| 7734 | /* unmute internal speaker if necessary */ |
| 7735 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7736 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7737 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7738 | } |
| 7739 | } |
| 7740 | |
| 7741 | /* unsolicited event for HP jack sensing */ |
| 7742 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 7743 | unsigned int res) |
| 7744 | { |
| 7745 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7746 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7747 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7748 | } |
| 7749 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7750 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7751 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7752 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7753 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7754 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7755 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7756 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7757 | AC_VERB_GET_PIN_SENSE, 0); |
| 7758 | present = (present & 0x80000000) != 0; |
| 7759 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7760 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7761 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7762 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7763 | } else { |
| 7764 | /* unmute internal speaker if necessary */ |
| 7765 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7766 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7767 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7768 | } |
| 7769 | } |
| 7770 | |
| 7771 | /* unsolicited event for HP jack sensing */ |
| 7772 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 7773 | unsigned int res) |
| 7774 | { |
| 7775 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7776 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 7777 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7778 | } |
| 7779 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7780 | /* |
| 7781 | * fujitsu model |
| 7782 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 7783 | */ |
| 7784 | |
| 7785 | #define ALC_HP_EVENT 0x37 |
| 7786 | |
| 7787 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 7788 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 7789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7790 | {} |
| 7791 | }; |
| 7792 | |
| 7793 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
| 7794 | .num_items = 2, |
| 7795 | .items = { |
| 7796 | { "Mic", 0x0 }, |
| 7797 | { "CD", 0x4 }, |
| 7798 | }, |
| 7799 | }; |
| 7800 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7801 | static struct hda_input_mux alc262_HP_capture_source = { |
| 7802 | .num_items = 5, |
| 7803 | .items = { |
| 7804 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 7805 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7806 | { "Line", 0x2 }, |
| 7807 | { "CD", 0x4 }, |
| 7808 | { "AUX IN", 0x6 }, |
| 7809 | }, |
| 7810 | }; |
| 7811 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 7812 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 7813 | .num_items = 4, |
| 7814 | .items = { |
| 7815 | { "Mic", 0x0 }, |
| 7816 | { "Front Mic", 0x2 }, |
| 7817 | { "Line", 0x1 }, |
| 7818 | { "CD", 0x4 }, |
| 7819 | }, |
| 7820 | }; |
| 7821 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7822 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 7823 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 7824 | { |
| 7825 | struct alc_spec *spec = codec->spec; |
| 7826 | unsigned int mute; |
| 7827 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7828 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7829 | unsigned int present; |
| 7830 | /* need to execute and sync at first */ |
| 7831 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7832 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7833 | AC_VERB_GET_PIN_SENSE, 0); |
| 7834 | spec->jack_present = (present & 0x80000000) != 0; |
| 7835 | spec->sense_updated = 1; |
| 7836 | } |
| 7837 | if (spec->jack_present) { |
| 7838 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7839 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7840 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7841 | } else { |
| 7842 | /* unmute internal speaker if necessary */ |
| 7843 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7844 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7845 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7846 | } |
| 7847 | } |
| 7848 | |
| 7849 | /* unsolicited event for HP jack sensing */ |
| 7850 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 7851 | unsigned int res) |
| 7852 | { |
| 7853 | if ((res >> 26) != ALC_HP_EVENT) |
| 7854 | return; |
| 7855 | alc262_fujitsu_automute(codec, 1); |
| 7856 | } |
| 7857 | |
| 7858 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 7859 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 7860 | .ops = &snd_hda_bind_vol, |
| 7861 | .values = { |
| 7862 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 7863 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 7864 | 0 |
| 7865 | }, |
| 7866 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7867 | |
| 7868 | /* bind hp and internal speaker mute (with plug check) */ |
| 7869 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 7870 | struct snd_ctl_elem_value *ucontrol) |
| 7871 | { |
| 7872 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7873 | long *valp = ucontrol->value.integer.value; |
| 7874 | int change; |
| 7875 | |
| 7876 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7877 | HDA_AMP_MUTE, |
| 7878 | valp[0] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7879 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7880 | HDA_AMP_MUTE, |
| 7881 | valp[1] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7882 | if (change) |
| 7883 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7884 | return change; |
| 7885 | } |
| 7886 | |
| 7887 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 7888 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7889 | { |
| 7890 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7891 | .name = "Master Playback Switch", |
| 7892 | .info = snd_hda_mixer_amp_switch_info, |
| 7893 | .get = snd_hda_mixer_amp_switch_get, |
| 7894 | .put = alc262_fujitsu_master_sw_put, |
| 7895 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7896 | }, |
| 7897 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7898 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7899 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7900 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7901 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7902 | { } /* end */ |
| 7903 | }; |
| 7904 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 7905 | /* additional init verbs for Benq laptops */ |
| 7906 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 7907 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7908 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7909 | {} |
| 7910 | }; |
| 7911 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 7912 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 7913 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7914 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7915 | |
| 7916 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7917 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 7918 | {} |
| 7919 | }; |
| 7920 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7921 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7922 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7923 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7924 | { |
| 7925 | hda_nid_t nid; |
| 7926 | int err; |
| 7927 | |
| 7928 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 7929 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 7930 | spec->multiout.dac_nids[0] = 2; |
| 7931 | |
| 7932 | nid = cfg->line_out_pins[0]; |
| 7933 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7934 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7935 | "Front Playback Volume", |
| 7936 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 7937 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7938 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7939 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7940 | "Front Playback Switch", |
| 7941 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 7942 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7943 | return err; |
| 7944 | } |
| 7945 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7946 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7947 | if (nid) { |
| 7948 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7949 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7950 | "Speaker Playback Volume", |
| 7951 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7952 | HDA_OUTPUT)); |
| 7953 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7954 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7955 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7956 | "Speaker Playback Switch", |
| 7957 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7958 | HDA_OUTPUT)); |
| 7959 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7960 | return err; |
| 7961 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7962 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7963 | "Speaker Playback Switch", |
| 7964 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7965 | HDA_OUTPUT)); |
| 7966 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7967 | return err; |
| 7968 | } |
| 7969 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7970 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7971 | if (nid) { |
| 7972 | /* spec->multiout.hp_nid = 2; */ |
| 7973 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7974 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7975 | "Headphone Playback Volume", |
| 7976 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7977 | HDA_OUTPUT)); |
| 7978 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7979 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7980 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7981 | "Headphone Playback Switch", |
| 7982 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7983 | HDA_OUTPUT)); |
| 7984 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7985 | return err; |
| 7986 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7987 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7988 | "Headphone Playback Switch", |
| 7989 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7990 | HDA_OUTPUT)); |
| 7991 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7992 | return err; |
| 7993 | } |
| 7994 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7995 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7996 | } |
| 7997 | |
| 7998 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7999 | #define alc262_auto_create_analog_input_ctls \ |
| 8000 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8001 | |
| 8002 | /* |
| 8003 | * generic initialization of ADC, input mixers and output mixers |
| 8004 | */ |
| 8005 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 8006 | /* |
| 8007 | * Unmute ADC0-2 and set the default input to mic-in |
| 8008 | */ |
| 8009 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8010 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8011 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8012 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8013 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8014 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8015 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8016 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8017 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8018 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8019 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8020 | */ |
| 8021 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8022 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8023 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8024 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8025 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8026 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8027 | |
| 8028 | /* |
| 8029 | * Set up output mixers (0x0c - 0x0f) |
| 8030 | */ |
| 8031 | /* set vol=0 to output mixers */ |
| 8032 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8033 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8034 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8035 | |
| 8036 | /* set up input amps for analog loopback */ |
| 8037 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8040 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8041 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8043 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8044 | |
| 8045 | /* FIXME: use matrix-type input source selection */ |
| 8046 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8047 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8052 | /* Input mixer2 */ |
| 8053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8054 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8055 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8056 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8057 | /* Input mixer3 */ |
| 8058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8059 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8060 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8062 | |
| 8063 | { } |
| 8064 | }; |
| 8065 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8066 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 8067 | /* |
| 8068 | * Unmute ADC0-2 and set the default input to mic-in |
| 8069 | */ |
| 8070 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8071 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8072 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8073 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8074 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8075 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8076 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8077 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8078 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8079 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8080 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8081 | */ |
| 8082 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8083 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8084 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8085 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8086 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8087 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8088 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8089 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8090 | |
| 8091 | /* |
| 8092 | * Set up output mixers (0x0c - 0x0e) |
| 8093 | */ |
| 8094 | /* set vol=0 to output mixers */ |
| 8095 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8096 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8097 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8098 | |
| 8099 | /* set up input amps for analog loopback */ |
| 8100 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8103 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8106 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8107 | |
| 8108 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8110 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8111 | |
| 8112 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8113 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8114 | |
| 8115 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8116 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8117 | |
| 8118 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8119 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8120 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8121 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8122 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8123 | |
| 8124 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8125 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8126 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8127 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8128 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8129 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8130 | |
| 8131 | |
| 8132 | /* FIXME: use matrix-type input source selection */ |
| 8133 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8134 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8135 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8136 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8137 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8138 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8139 | /* Input mixer2 */ |
| 8140 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8141 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8142 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8143 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8144 | /* Input mixer3 */ |
| 8145 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8146 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8147 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8148 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8149 | |
| 8150 | { } |
| 8151 | }; |
| 8152 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8153 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 8154 | /* |
| 8155 | * Unmute ADC0-2 and set the default input to mic-in |
| 8156 | */ |
| 8157 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8158 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8159 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8160 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8161 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8162 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8163 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8164 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8165 | * mixer widget |
| 8166 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 8167 | * panel mic (mic 2) |
| 8168 | */ |
| 8169 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8170 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8171 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8172 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8174 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8175 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8176 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 8177 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8178 | /* |
| 8179 | * Set up output mixers (0x0c - 0x0e) |
| 8180 | */ |
| 8181 | /* set vol=0 to output mixers */ |
| 8182 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8183 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8184 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8185 | |
| 8186 | /* set up input amps for analog loopback */ |
| 8187 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8188 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8189 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8190 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8191 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8192 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8193 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8194 | |
| 8195 | |
| 8196 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 8197 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 8198 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 8199 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 8200 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 8201 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 8202 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 8203 | |
| 8204 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8205 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8206 | |
| 8207 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8208 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8209 | |
| 8210 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 8211 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8212 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8213 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8214 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8215 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8216 | |
| 8217 | /* FIXME: use matrix-type input source selection */ |
| 8218 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8219 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8220 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 8221 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 8222 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 8223 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 8224 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 8225 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8226 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 8227 | /* Input mixer2 */ |
| 8228 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8229 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8230 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8231 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8232 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8233 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 8235 | /* Input mixer3 */ |
| 8236 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8237 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8241 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8242 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 8243 | |
| 8244 | { } |
| 8245 | }; |
| 8246 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8247 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8248 | #define alc262_loopbacks alc880_loopbacks |
| 8249 | #endif |
| 8250 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8251 | /* pcm configuration: identiacal with ALC880 */ |
| 8252 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 8253 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 8254 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 8255 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 8256 | |
| 8257 | /* |
| 8258 | * BIOS auto configuration |
| 8259 | */ |
| 8260 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 8261 | { |
| 8262 | struct alc_spec *spec = codec->spec; |
| 8263 | int err; |
| 8264 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 8265 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8266 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 8267 | alc262_ignore); |
| 8268 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8269 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8270 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8271 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8272 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 8273 | if (err < 0) |
| 8274 | return err; |
| 8275 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 8276 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8277 | return err; |
| 8278 | |
| 8279 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 8280 | |
| 8281 | if (spec->autocfg.dig_out_pin) |
| 8282 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 8283 | if (spec->autocfg.dig_in_pin) |
| 8284 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 8285 | |
| 8286 | if (spec->kctl_alloc) |
| 8287 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 8288 | |
| 8289 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 8290 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8291 | spec->input_mux = &spec->private_imux; |
| 8292 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8293 | err = alc_auto_add_mic_boost(codec); |
| 8294 | if (err < 0) |
| 8295 | return err; |
| 8296 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8297 | return 1; |
| 8298 | } |
| 8299 | |
| 8300 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 8301 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 8302 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 8303 | |
| 8304 | |
| 8305 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8306 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8307 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8308 | alc262_auto_init_multi_out(codec); |
| 8309 | alc262_auto_init_hp_out(codec); |
| 8310 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8311 | } |
| 8312 | |
| 8313 | /* |
| 8314 | * configuration and preset |
| 8315 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8316 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 8317 | [ALC262_BASIC] = "basic", |
| 8318 | [ALC262_HIPPO] = "hippo", |
| 8319 | [ALC262_HIPPO_1] = "hippo_1", |
| 8320 | [ALC262_FUJITSU] = "fujitsu", |
| 8321 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8322 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8323 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 8324 | [ALC262_BENQ_T31] = "benq-t31", |
| 8325 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8326 | [ALC262_AUTO] = "auto", |
| 8327 | }; |
| 8328 | |
| 8329 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 8330 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 8331 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
| 8332 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 8333 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
| 8334 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8335 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 8336 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8337 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 8338 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8339 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 8340 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 8341 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 8342 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 8343 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 8344 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 8345 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 8346 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8347 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
| 8348 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
| 8349 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
| 8350 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8351 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8352 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8353 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
| 8354 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 8355 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8356 | {} |
| 8357 | }; |
| 8358 | |
| 8359 | static struct alc_config_preset alc262_presets[] = { |
| 8360 | [ALC262_BASIC] = { |
| 8361 | .mixers = { alc262_base_mixer }, |
| 8362 | .init_verbs = { alc262_init_verbs }, |
| 8363 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8364 | .dac_nids = alc262_dac_nids, |
| 8365 | .hp_nid = 0x03, |
| 8366 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8367 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 8368 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8369 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8370 | [ALC262_HIPPO] = { |
| 8371 | .mixers = { alc262_base_mixer }, |
| 8372 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 8373 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8374 | .dac_nids = alc262_dac_nids, |
| 8375 | .hp_nid = 0x03, |
| 8376 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8377 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8378 | .channel_mode = alc262_modes, |
| 8379 | .input_mux = &alc262_capture_source, |
| 8380 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8381 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8382 | }, |
| 8383 | [ALC262_HIPPO_1] = { |
| 8384 | .mixers = { alc262_hippo1_mixer }, |
| 8385 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 8386 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8387 | .dac_nids = alc262_dac_nids, |
| 8388 | .hp_nid = 0x02, |
| 8389 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8390 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8391 | .channel_mode = alc262_modes, |
| 8392 | .input_mux = &alc262_capture_source, |
| 8393 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8394 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8395 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8396 | [ALC262_FUJITSU] = { |
| 8397 | .mixers = { alc262_fujitsu_mixer }, |
| 8398 | .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, |
| 8399 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8400 | .dac_nids = alc262_dac_nids, |
| 8401 | .hp_nid = 0x03, |
| 8402 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8403 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8404 | .channel_mode = alc262_modes, |
| 8405 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8406 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8407 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8408 | [ALC262_HP_BPC] = { |
| 8409 | .mixers = { alc262_HP_BPC_mixer }, |
| 8410 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 8411 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8412 | .dac_nids = alc262_dac_nids, |
| 8413 | .hp_nid = 0x03, |
| 8414 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8415 | .channel_mode = alc262_modes, |
| 8416 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8417 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8418 | [ALC262_HP_BPC_D7000_WF] = { |
| 8419 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 8420 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 8421 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8422 | .dac_nids = alc262_dac_nids, |
| 8423 | .hp_nid = 0x03, |
| 8424 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8425 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8426 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8427 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8428 | [ALC262_HP_BPC_D7000_WL] = { |
| 8429 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 8430 | alc262_HP_BPC_WildWest_option_mixer }, |
| 8431 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 8432 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8433 | .dac_nids = alc262_dac_nids, |
| 8434 | .hp_nid = 0x03, |
| 8435 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8436 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8437 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8438 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8439 | [ALC262_BENQ_ED8] = { |
| 8440 | .mixers = { alc262_base_mixer }, |
| 8441 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 8442 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8443 | .dac_nids = alc262_dac_nids, |
| 8444 | .hp_nid = 0x03, |
| 8445 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8446 | .channel_mode = alc262_modes, |
| 8447 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8448 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8449 | [ALC262_SONY_ASSAMD] = { |
| 8450 | .mixers = { alc262_sony_mixer }, |
| 8451 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 8452 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8453 | .dac_nids = alc262_dac_nids, |
| 8454 | .hp_nid = 0x02, |
| 8455 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8456 | .channel_mode = alc262_modes, |
| 8457 | .input_mux = &alc262_capture_source, |
| 8458 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8459 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8460 | }, |
| 8461 | [ALC262_BENQ_T31] = { |
| 8462 | .mixers = { alc262_benq_t31_mixer }, |
| 8463 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 8464 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8465 | .dac_nids = alc262_dac_nids, |
| 8466 | .hp_nid = 0x03, |
| 8467 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8468 | .channel_mode = alc262_modes, |
| 8469 | .input_mux = &alc262_capture_source, |
| 8470 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8471 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8472 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8473 | }; |
| 8474 | |
| 8475 | static int patch_alc262(struct hda_codec *codec) |
| 8476 | { |
| 8477 | struct alc_spec *spec; |
| 8478 | int board_config; |
| 8479 | int err; |
| 8480 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 8481 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8482 | if (spec == NULL) |
| 8483 | return -ENOMEM; |
| 8484 | |
| 8485 | codec->spec = spec; |
| 8486 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8487 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 8488 | * under-run |
| 8489 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8490 | { |
| 8491 | int tmp; |
| 8492 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 8493 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 8494 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 8495 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 8496 | } |
| 8497 | #endif |
| 8498 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8499 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 8500 | alc262_models, |
| 8501 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8502 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8503 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8504 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 8505 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8506 | board_config = ALC262_AUTO; |
| 8507 | } |
| 8508 | |
| 8509 | if (board_config == ALC262_AUTO) { |
| 8510 | /* automatic parse from the BIOS config */ |
| 8511 | err = alc262_parse_auto_config(codec); |
| 8512 | if (err < 0) { |
| 8513 | alc_free(codec); |
| 8514 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8515 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8516 | printk(KERN_INFO |
| 8517 | "hda_codec: Cannot set up configuration " |
| 8518 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8519 | board_config = ALC262_BASIC; |
| 8520 | } |
| 8521 | } |
| 8522 | |
| 8523 | if (board_config != ALC262_AUTO) |
| 8524 | setup_preset(spec, &alc262_presets[board_config]); |
| 8525 | |
| 8526 | spec->stream_name_analog = "ALC262 Analog"; |
| 8527 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 8528 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 8529 | |
| 8530 | spec->stream_name_digital = "ALC262 Digital"; |
| 8531 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 8532 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 8533 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8534 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8535 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 8536 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 8537 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8538 | /* get type */ |
| 8539 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8540 | if (wcap != AC_WID_AUD_IN) { |
| 8541 | spec->adc_nids = alc262_adc_nids_alt; |
| 8542 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8543 | spec->mixers[spec->num_mixers] = |
| 8544 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8545 | spec->num_mixers++; |
| 8546 | } else { |
| 8547 | spec->adc_nids = alc262_adc_nids; |
| 8548 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 8549 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 8550 | spec->num_mixers++; |
| 8551 | } |
| 8552 | } |
| 8553 | |
| 8554 | codec->patch_ops = alc_patch_ops; |
| 8555 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8556 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8557 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8558 | if (!spec->loopback.amplist) |
| 8559 | spec->loopback.amplist = alc262_loopbacks; |
| 8560 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8561 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8562 | return 0; |
| 8563 | } |
| 8564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8565 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8566 | * ALC268 channel source setting (2 channel) |
| 8567 | */ |
| 8568 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 8569 | #define alc268_modes alc260_modes |
| 8570 | |
| 8571 | static hda_nid_t alc268_dac_nids[2] = { |
| 8572 | /* front, hp */ |
| 8573 | 0x02, 0x03 |
| 8574 | }; |
| 8575 | |
| 8576 | static hda_nid_t alc268_adc_nids[2] = { |
| 8577 | /* ADC0-1 */ |
| 8578 | 0x08, 0x07 |
| 8579 | }; |
| 8580 | |
| 8581 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 8582 | /* ADC0 */ |
| 8583 | 0x08 |
| 8584 | }; |
| 8585 | |
| 8586 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 8587 | /* output mixer control */ |
| 8588 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 8589 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8590 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 8591 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 8592 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8593 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8594 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8595 | { } |
| 8596 | }; |
| 8597 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8598 | static struct hda_verb alc268_eapd_verbs[] = { |
| 8599 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8600 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8601 | { } |
| 8602 | }; |
| 8603 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 8604 | /* Toshiba specific */ |
| 8605 | #define alc268_toshiba_automute alc262_hippo_automute |
| 8606 | |
| 8607 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 8608 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8609 | { } /* end */ |
| 8610 | }; |
| 8611 | |
| 8612 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 8613 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 8614 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 8615 | .ops = &snd_hda_bind_vol, |
| 8616 | .values = { |
| 8617 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 8618 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 8619 | 0 |
| 8620 | }, |
| 8621 | }; |
| 8622 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 8623 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8624 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 8625 | { |
| 8626 | struct alc_spec *spec = codec->spec; |
| 8627 | unsigned int mute; |
| 8628 | |
| 8629 | if (force || !spec->sense_updated) { |
| 8630 | unsigned int present; |
| 8631 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8632 | AC_VERB_GET_PIN_SENSE, 0); |
| 8633 | spec->jack_present = (present & 0x80000000) != 0; |
| 8634 | spec->sense_updated = 1; |
| 8635 | } |
| 8636 | if (spec->jack_present) |
| 8637 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 8638 | else /* unmute internal speaker if necessary */ |
| 8639 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 8640 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8641 | HDA_AMP_MUTE, mute); |
| 8642 | } |
| 8643 | |
| 8644 | |
| 8645 | /* bind hp and internal speaker mute (with plug check) */ |
| 8646 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8647 | struct snd_ctl_elem_value *ucontrol) |
| 8648 | { |
| 8649 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8650 | long *valp = ucontrol->value.integer.value; |
| 8651 | int change; |
| 8652 | |
| 8653 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 8654 | HDA_AMP_MUTE, |
| 8655 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8656 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 8657 | HDA_AMP_MUTE, |
| 8658 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8659 | if (change) |
| 8660 | alc268_acer_automute(codec, 0); |
| 8661 | return change; |
| 8662 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 8663 | |
| 8664 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 8665 | /* output mixer control */ |
| 8666 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 8667 | { |
| 8668 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8669 | .name = "Master Playback Switch", |
| 8670 | .info = snd_hda_mixer_amp_switch_info, |
| 8671 | .get = snd_hda_mixer_amp_switch_get, |
| 8672 | .put = alc268_acer_master_sw_put, |
| 8673 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8674 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 8675 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8676 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 8677 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 8678 | { } |
| 8679 | }; |
| 8680 | |
| 8681 | static struct hda_verb alc268_acer_verbs[] = { |
| 8682 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8683 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8684 | |
| 8685 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8686 | { } |
| 8687 | }; |
| 8688 | |
| 8689 | /* unsolicited event for HP jack sensing */ |
| 8690 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 8691 | unsigned int res) |
| 8692 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 8693 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 8694 | return; |
| 8695 | alc268_toshiba_automute(codec); |
| 8696 | } |
| 8697 | |
| 8698 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 8699 | unsigned int res) |
| 8700 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 8701 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 8702 | return; |
| 8703 | alc268_acer_automute(codec, 1); |
| 8704 | } |
| 8705 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 8706 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 8707 | { |
| 8708 | alc268_acer_automute(codec, 1); |
| 8709 | } |
| 8710 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8711 | /* |
| 8712 | * generic initialization of ADC, input mixers and output mixers |
| 8713 | */ |
| 8714 | static struct hda_verb alc268_base_init_verbs[] = { |
| 8715 | /* Unmute DAC0-1 and set vol = 0 */ |
| 8716 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8717 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8718 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8719 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8720 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8721 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8722 | |
| 8723 | /* |
| 8724 | * Set up output mixers (0x0c - 0x0e) |
| 8725 | */ |
| 8726 | /* set vol=0 to output mixers */ |
| 8727 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8728 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8729 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8730 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8731 | |
| 8732 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8733 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8734 | |
| 8735 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8737 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8738 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8739 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8740 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8741 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8742 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8743 | |
| 8744 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8746 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8747 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8748 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8749 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8750 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8751 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8752 | |
| 8753 | /* FIXME: use matrix-type input source selection */ |
| 8754 | /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */ |
| 8755 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8756 | /* Input mixer2 */ |
| 8757 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8758 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8759 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8760 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8761 | |
| 8762 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8763 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8764 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8765 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8766 | { } |
| 8767 | }; |
| 8768 | |
| 8769 | /* |
| 8770 | * generic initialization of ADC, input mixers and output mixers |
| 8771 | */ |
| 8772 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 8773 | /* set output DAC */ |
| 8774 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8775 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8776 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8777 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8778 | |
| 8779 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8780 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8781 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8782 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8783 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8784 | |
| 8785 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8786 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8787 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8788 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8789 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8790 | |
| 8791 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8792 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8793 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8794 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8795 | |
| 8796 | /* set PCBEEP vol = 0 */ |
| 8797 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 8798 | |
| 8799 | { } |
| 8800 | }; |
| 8801 | |
| 8802 | #define alc268_mux_enum_info alc_mux_enum_info |
| 8803 | #define alc268_mux_enum_get alc_mux_enum_get |
| 8804 | |
| 8805 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 8806 | struct snd_ctl_elem_value *ucontrol) |
| 8807 | { |
| 8808 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8809 | struct alc_spec *spec = codec->spec; |
| 8810 | const struct hda_input_mux *imux = spec->input_mux; |
| 8811 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 8812 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 8813 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 8814 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 8815 | unsigned int i, idx; |
| 8816 | |
| 8817 | idx = ucontrol->value.enumerated.item[0]; |
| 8818 | if (idx >= imux->num_items) |
| 8819 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8820 | if (*cur_val == idx) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8821 | return 0; |
| 8822 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8823 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 8824 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 8825 | imux->items[i].index, |
| 8826 | HDA_AMP_MUTE, v); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8827 | snd_hda_codec_write_cache(codec, nid, 0, |
| 8828 | AC_VERB_SET_CONNECT_SEL, |
| 8829 | idx ); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 8830 | } |
| 8831 | *cur_val = idx; |
| 8832 | return 1; |
| 8833 | } |
| 8834 | |
| 8835 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 8836 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8837 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8838 | { |
| 8839 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8840 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8841 | * So call somewhat different.. |
| 8842 | * FIXME: the controls appear in the "playback" view! |
| 8843 | */ |
| 8844 | /* .name = "Capture Source", */ |
| 8845 | .name = "Input Source", |
| 8846 | .count = 1, |
| 8847 | .info = alc268_mux_enum_info, |
| 8848 | .get = alc268_mux_enum_get, |
| 8849 | .put = alc268_mux_enum_put, |
| 8850 | }, |
| 8851 | { } /* end */ |
| 8852 | }; |
| 8853 | |
| 8854 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 8855 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8856 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8857 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8858 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8859 | { |
| 8860 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8861 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8862 | * So call somewhat different.. |
| 8863 | * FIXME: the controls appear in the "playback" view! |
| 8864 | */ |
| 8865 | /* .name = "Capture Source", */ |
| 8866 | .name = "Input Source", |
| 8867 | .count = 2, |
| 8868 | .info = alc268_mux_enum_info, |
| 8869 | .get = alc268_mux_enum_get, |
| 8870 | .put = alc268_mux_enum_put, |
| 8871 | }, |
| 8872 | { } /* end */ |
| 8873 | }; |
| 8874 | |
| 8875 | static struct hda_input_mux alc268_capture_source = { |
| 8876 | .num_items = 4, |
| 8877 | .items = { |
| 8878 | { "Mic", 0x0 }, |
| 8879 | { "Front Mic", 0x1 }, |
| 8880 | { "Line", 0x2 }, |
| 8881 | { "CD", 0x3 }, |
| 8882 | }, |
| 8883 | }; |
| 8884 | |
| 8885 | /* create input playback/capture controls for the given pin */ |
| 8886 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 8887 | const char *ctlname, int idx) |
| 8888 | { |
| 8889 | char name[32]; |
| 8890 | int err; |
| 8891 | |
| 8892 | sprintf(name, "%s Playback Volume", ctlname); |
| 8893 | if (nid == 0x14) { |
| 8894 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8895 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 8896 | HDA_OUTPUT)); |
| 8897 | if (err < 0) |
| 8898 | return err; |
| 8899 | } else if (nid == 0x15) { |
| 8900 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8901 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 8902 | HDA_OUTPUT)); |
| 8903 | if (err < 0) |
| 8904 | return err; |
| 8905 | } else |
| 8906 | return -1; |
| 8907 | sprintf(name, "%s Playback Switch", ctlname); |
| 8908 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 8909 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 8910 | if (err < 0) |
| 8911 | return err; |
| 8912 | return 0; |
| 8913 | } |
| 8914 | |
| 8915 | /* add playback controls from the parsed DAC table */ |
| 8916 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8917 | const struct auto_pin_cfg *cfg) |
| 8918 | { |
| 8919 | hda_nid_t nid; |
| 8920 | int err; |
| 8921 | |
| 8922 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 8923 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8924 | spec->multiout.dac_nids[0] = 2; |
| 8925 | spec->multiout.dac_nids[1] = 3; |
| 8926 | |
| 8927 | nid = cfg->line_out_pins[0]; |
| 8928 | if (nid) |
| 8929 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 8930 | |
| 8931 | nid = cfg->speaker_pins[0]; |
| 8932 | if (nid == 0x1d) { |
| 8933 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8934 | "Speaker Playback Volume", |
| 8935 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 8936 | if (err < 0) |
| 8937 | return err; |
| 8938 | } |
| 8939 | nid = cfg->hp_pins[0]; |
| 8940 | if (nid) |
| 8941 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 8942 | |
| 8943 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 8944 | if (nid == 0x16) { |
| 8945 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8946 | "Mono Playback Switch", |
| 8947 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 8948 | if (err < 0) |
| 8949 | return err; |
| 8950 | } |
| 8951 | return 0; |
| 8952 | } |
| 8953 | |
| 8954 | /* create playback/capture controls for input pins */ |
| 8955 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 8956 | const struct auto_pin_cfg *cfg) |
| 8957 | { |
| 8958 | struct hda_input_mux *imux = &spec->private_imux; |
| 8959 | int i, idx1; |
| 8960 | |
| 8961 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8962 | switch(cfg->input_pins[i]) { |
| 8963 | case 0x18: |
| 8964 | idx1 = 0; /* Mic 1 */ |
| 8965 | break; |
| 8966 | case 0x19: |
| 8967 | idx1 = 1; /* Mic 2 */ |
| 8968 | break; |
| 8969 | case 0x1a: |
| 8970 | idx1 = 2; /* Line In */ |
| 8971 | break; |
| 8972 | case 0x1c: |
| 8973 | idx1 = 3; /* CD */ |
| 8974 | break; |
| 8975 | default: |
| 8976 | continue; |
| 8977 | } |
| 8978 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 8979 | imux->items[imux->num_items].index = idx1; |
| 8980 | imux->num_items++; |
| 8981 | } |
| 8982 | return 0; |
| 8983 | } |
| 8984 | |
| 8985 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 8986 | { |
| 8987 | struct alc_spec *spec = codec->spec; |
| 8988 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 8989 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 8990 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 8991 | unsigned int dac_vol1, dac_vol2; |
| 8992 | |
| 8993 | if (speaker_nid) { |
| 8994 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 8995 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 8996 | snd_hda_codec_write(codec, 0x0f, 0, |
| 8997 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8998 | AMP_IN_UNMUTE(1)); |
| 8999 | snd_hda_codec_write(codec, 0x10, 0, |
| 9000 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9001 | AMP_IN_UNMUTE(1)); |
| 9002 | } else { |
| 9003 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9004 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9005 | snd_hda_codec_write(codec, 0x10, 0, |
| 9006 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9007 | } |
| 9008 | |
| 9009 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 9010 | if (line_nid == 0x14) |
| 9011 | dac_vol2 = AMP_OUT_ZERO; |
| 9012 | else if (line_nid == 0x15) |
| 9013 | dac_vol1 = AMP_OUT_ZERO; |
| 9014 | if (hp_nid == 0x14) |
| 9015 | dac_vol2 = AMP_OUT_ZERO; |
| 9016 | else if (hp_nid == 0x15) |
| 9017 | dac_vol1 = AMP_OUT_ZERO; |
| 9018 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 9019 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 9020 | spec->autocfg.line_out_pins[2] != 0x16) |
| 9021 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 9022 | |
| 9023 | snd_hda_codec_write(codec, 0x02, 0, |
| 9024 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 9025 | snd_hda_codec_write(codec, 0x03, 0, |
| 9026 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 9027 | } |
| 9028 | |
| 9029 | /* pcm configuration: identiacal with ALC880 */ |
| 9030 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 9031 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
| 9032 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 9033 | |
| 9034 | /* |
| 9035 | * BIOS auto configuration |
| 9036 | */ |
| 9037 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 9038 | { |
| 9039 | struct alc_spec *spec = codec->spec; |
| 9040 | int err; |
| 9041 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 9042 | |
| 9043 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9044 | alc268_ignore); |
| 9045 | if (err < 0) |
| 9046 | return err; |
| 9047 | if (!spec->autocfg.line_outs) |
| 9048 | return 0; /* can't find valid BIOS pin config */ |
| 9049 | |
| 9050 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9051 | if (err < 0) |
| 9052 | return err; |
| 9053 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9054 | if (err < 0) |
| 9055 | return err; |
| 9056 | |
| 9057 | spec->multiout.max_channels = 2; |
| 9058 | |
| 9059 | /* digital only support output */ |
| 9060 | if (spec->autocfg.dig_out_pin) |
| 9061 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 9062 | |
| 9063 | if (spec->kctl_alloc) |
| 9064 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9065 | |
| 9066 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 9067 | spec->num_mux_defs = 1; |
| 9068 | spec->input_mux = &spec->private_imux; |
| 9069 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9070 | err = alc_auto_add_mic_boost(codec); |
| 9071 | if (err < 0) |
| 9072 | return err; |
| 9073 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9074 | return 1; |
| 9075 | } |
| 9076 | |
| 9077 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 9078 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 9079 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 9080 | |
| 9081 | /* init callback for auto-configuration model -- overriding the default init */ |
| 9082 | static void alc268_auto_init(struct hda_codec *codec) |
| 9083 | { |
| 9084 | alc268_auto_init_multi_out(codec); |
| 9085 | alc268_auto_init_hp_out(codec); |
| 9086 | alc268_auto_init_mono_speaker_out(codec); |
| 9087 | alc268_auto_init_analog_input(codec); |
| 9088 | } |
| 9089 | |
| 9090 | /* |
| 9091 | * configuration and preset |
| 9092 | */ |
| 9093 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 9094 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 9095 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9096 | [ALC268_ACER] = "acer", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9097 | [ALC268_AUTO] = "auto", |
| 9098 | }; |
| 9099 | |
| 9100 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
| 9101 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9102 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame^] | 9103 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9104 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
| 9105 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9106 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 9107 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9108 | {} |
| 9109 | }; |
| 9110 | |
| 9111 | static struct alc_config_preset alc268_presets[] = { |
| 9112 | [ALC268_3ST] = { |
| 9113 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 9114 | .init_verbs = { alc268_base_init_verbs }, |
| 9115 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9116 | .dac_nids = alc268_dac_nids, |
| 9117 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9118 | .adc_nids = alc268_adc_nids_alt, |
| 9119 | .hp_nid = 0x03, |
| 9120 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 9121 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9122 | .channel_mode = alc268_modes, |
| 9123 | .input_mux = &alc268_capture_source, |
| 9124 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9125 | [ALC268_TOSHIBA] = { |
| 9126 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9127 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9128 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9129 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9130 | .dac_nids = alc268_dac_nids, |
| 9131 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9132 | .adc_nids = alc268_adc_nids_alt, |
| 9133 | .hp_nid = 0x03, |
| 9134 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9135 | .channel_mode = alc268_modes, |
| 9136 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9137 | .input_mux = &alc268_capture_source, |
| 9138 | .unsol_event = alc268_toshiba_unsol_event, |
| 9139 | .init_hook = alc268_toshiba_automute, |
| 9140 | }, |
| 9141 | [ALC268_ACER] = { |
| 9142 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, |
| 9143 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9144 | alc268_acer_verbs }, |
| 9145 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9146 | .dac_nids = alc268_dac_nids, |
| 9147 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9148 | .adc_nids = alc268_adc_nids_alt, |
| 9149 | .hp_nid = 0x02, |
| 9150 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9151 | .channel_mode = alc268_modes, |
| 9152 | .input_mux = &alc268_capture_source, |
| 9153 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9154 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9155 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9156 | }; |
| 9157 | |
| 9158 | static int patch_alc268(struct hda_codec *codec) |
| 9159 | { |
| 9160 | struct alc_spec *spec; |
| 9161 | int board_config; |
| 9162 | int err; |
| 9163 | |
| 9164 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 9165 | if (spec == NULL) |
| 9166 | return -ENOMEM; |
| 9167 | |
| 9168 | codec->spec = spec; |
| 9169 | |
| 9170 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 9171 | alc268_models, |
| 9172 | alc268_cfg_tbl); |
| 9173 | |
| 9174 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 9175 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 9176 | "trying auto-probe from BIOS...\n"); |
| 9177 | board_config = ALC268_AUTO; |
| 9178 | } |
| 9179 | |
| 9180 | if (board_config == ALC268_AUTO) { |
| 9181 | /* automatic parse from the BIOS config */ |
| 9182 | err = alc268_parse_auto_config(codec); |
| 9183 | if (err < 0) { |
| 9184 | alc_free(codec); |
| 9185 | return err; |
| 9186 | } else if (!err) { |
| 9187 | printk(KERN_INFO |
| 9188 | "hda_codec: Cannot set up configuration " |
| 9189 | "from BIOS. Using base mode...\n"); |
| 9190 | board_config = ALC268_3ST; |
| 9191 | } |
| 9192 | } |
| 9193 | |
| 9194 | if (board_config != ALC268_AUTO) |
| 9195 | setup_preset(spec, &alc268_presets[board_config]); |
| 9196 | |
| 9197 | spec->stream_name_analog = "ALC268 Analog"; |
| 9198 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 9199 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
| 9200 | |
| 9201 | spec->stream_name_digital = "ALC268 Digital"; |
| 9202 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 9203 | |
| 9204 | if (board_config == ALC268_AUTO) { |
| 9205 | if (!spec->adc_nids && spec->input_mux) { |
| 9206 | /* check whether NID 0x07 is valid */ |
| 9207 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9208 | |
| 9209 | /* get type */ |
| 9210 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 9211 | if (wcap != AC_WID_AUD_IN) { |
| 9212 | spec->adc_nids = alc268_adc_nids_alt; |
| 9213 | spec->num_adc_nids = |
| 9214 | ARRAY_SIZE(alc268_adc_nids_alt); |
| 9215 | spec->mixers[spec->num_mixers] = |
| 9216 | alc268_capture_alt_mixer; |
| 9217 | spec->num_mixers++; |
| 9218 | } else { |
| 9219 | spec->adc_nids = alc268_adc_nids; |
| 9220 | spec->num_adc_nids = |
| 9221 | ARRAY_SIZE(alc268_adc_nids); |
| 9222 | spec->mixers[spec->num_mixers] = |
| 9223 | alc268_capture_mixer; |
| 9224 | spec->num_mixers++; |
| 9225 | } |
| 9226 | } |
| 9227 | } |
| 9228 | codec->patch_ops = alc_patch_ops; |
| 9229 | if (board_config == ALC268_AUTO) |
| 9230 | spec->init_hook = alc268_auto_init; |
| 9231 | |
| 9232 | return 0; |
| 9233 | } |
| 9234 | |
| 9235 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9236 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 9237 | */ |
| 9238 | |
| 9239 | /* |
| 9240 | * set the path ways for 2 channel output |
| 9241 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 9242 | */ |
| 9243 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 9244 | /* set pin widget 1Ah (line in) for input */ |
| 9245 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9246 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 9247 | * the vref |
| 9248 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9249 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9250 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9251 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 9252 | #if 0 |
| 9253 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 9254 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 9255 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9256 | { } /* end */ |
| 9257 | }; |
| 9258 | /* |
| 9259 | * 6ch mode |
| 9260 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 9261 | */ |
| 9262 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 9263 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 9264 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9265 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 9266 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9267 | |
| 9268 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9269 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9270 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9271 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 9272 | #if 0 |
| 9273 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 9274 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 9275 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9276 | { } /* end */ |
| 9277 | }; |
| 9278 | |
| 9279 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 9280 | { 2, alc861_threestack_ch2_init }, |
| 9281 | { 6, alc861_threestack_ch6_init }, |
| 9282 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9283 | /* Set mic1 as input and unmute the mixer */ |
| 9284 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 9285 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9286 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 9287 | { } /* end */ |
| 9288 | }; |
| 9289 | /* Set mic1 as output and mute mixer */ |
| 9290 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 9291 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9292 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 9293 | { } /* end */ |
| 9294 | }; |
| 9295 | |
| 9296 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 9297 | { 2, alc861_uniwill_m31_ch2_init }, |
| 9298 | { 4, alc861_uniwill_m31_ch4_init }, |
| 9299 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9300 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9301 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 9302 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 9303 | /* set pin widget 1Ah (line in) for input */ |
| 9304 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9305 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 9306 | * the vref |
| 9307 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9308 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9309 | |
| 9310 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 9311 | #if 0 |
| 9312 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 9313 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 9314 | #endif |
| 9315 | { } /* end */ |
| 9316 | }; |
| 9317 | /* Set mic1 nad line-in as output and mute mixer */ |
| 9318 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 9319 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 9320 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9321 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 9322 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 9323 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9324 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 9325 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9326 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9327 | |
| 9328 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 9329 | #if 0 |
| 9330 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 9331 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 9332 | #endif |
| 9333 | { } /* end */ |
| 9334 | }; |
| 9335 | |
| 9336 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 9337 | { 2, alc861_asus_ch2_init }, |
| 9338 | { 6, alc861_asus_ch6_init }, |
| 9339 | }; |
| 9340 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9341 | /* patch-ALC861 */ |
| 9342 | |
| 9343 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 9344 | /* output mixer control */ |
| 9345 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 9346 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 9347 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 9348 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 9349 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 9350 | |
| 9351 | /*Input mixer control */ |
| 9352 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 9353 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 9354 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 9355 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 9356 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 9357 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 9358 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 9359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 9360 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 9361 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9362 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9363 | /* Capture mixer control */ |
| 9364 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 9365 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 9366 | { |
| 9367 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9368 | .name = "Capture Source", |
| 9369 | .count = 1, |
| 9370 | .info = alc_mux_enum_info, |
| 9371 | .get = alc_mux_enum_get, |
| 9372 | .put = alc_mux_enum_put, |
| 9373 | }, |
| 9374 | { } /* end */ |
| 9375 | }; |
| 9376 | |
| 9377 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 9378 | /* output mixer control */ |
| 9379 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 9380 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 9381 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 9382 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 9383 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 9384 | |
| 9385 | /* Input mixer control */ |
| 9386 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 9387 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 9388 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 9389 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 9390 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 9391 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 9392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 9393 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 9394 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 9395 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9396 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9397 | /* Capture mixer control */ |
| 9398 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 9399 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 9400 | { |
| 9401 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9402 | .name = "Capture Source", |
| 9403 | .count = 1, |
| 9404 | .info = alc_mux_enum_info, |
| 9405 | .get = alc_mux_enum_get, |
| 9406 | .put = alc_mux_enum_put, |
| 9407 | }, |
| 9408 | { |
| 9409 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9410 | .name = "Channel Mode", |
| 9411 | .info = alc_ch_mode_info, |
| 9412 | .get = alc_ch_mode_get, |
| 9413 | .put = alc_ch_mode_put, |
| 9414 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 9415 | }, |
| 9416 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9417 | }; |
| 9418 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 9419 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9420 | /* output mixer control */ |
| 9421 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 9422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 9423 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 9424 | |
| 9425 | /*Capture mixer control */ |
| 9426 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 9427 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 9428 | { |
| 9429 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9430 | .name = "Capture Source", |
| 9431 | .count = 1, |
| 9432 | .info = alc_mux_enum_info, |
| 9433 | .get = alc_mux_enum_get, |
| 9434 | .put = alc_mux_enum_put, |
| 9435 | }, |
| 9436 | |
| 9437 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9438 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9439 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9440 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 9441 | /* output mixer control */ |
| 9442 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 9443 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 9444 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 9445 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 9446 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 9447 | |
| 9448 | /* Input mixer control */ |
| 9449 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 9450 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 9451 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 9452 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 9453 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 9454 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 9455 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 9456 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 9457 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 9458 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9459 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9460 | /* Capture mixer control */ |
| 9461 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 9462 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 9463 | { |
| 9464 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9465 | .name = "Capture Source", |
| 9466 | .count = 1, |
| 9467 | .info = alc_mux_enum_info, |
| 9468 | .get = alc_mux_enum_get, |
| 9469 | .put = alc_mux_enum_put, |
| 9470 | }, |
| 9471 | { |
| 9472 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9473 | .name = "Channel Mode", |
| 9474 | .info = alc_ch_mode_info, |
| 9475 | .get = alc_ch_mode_get, |
| 9476 | .put = alc_ch_mode_put, |
| 9477 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 9478 | }, |
| 9479 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9480 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9481 | |
| 9482 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 9483 | /* output mixer control */ |
| 9484 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 9485 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 9486 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 9487 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 9488 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 9489 | |
| 9490 | /* Input mixer control */ |
| 9491 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 9492 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9493 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 9494 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 9495 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 9496 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 9497 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 9498 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 9499 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9500 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 9501 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9502 | /* Capture mixer control */ |
| 9503 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 9504 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 9505 | { |
| 9506 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9507 | .name = "Capture Source", |
| 9508 | .count = 1, |
| 9509 | .info = alc_mux_enum_info, |
| 9510 | .get = alc_mux_enum_get, |
| 9511 | .put = alc_mux_enum_put, |
| 9512 | }, |
| 9513 | { |
| 9514 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9515 | .name = "Channel Mode", |
| 9516 | .info = alc_ch_mode_info, |
| 9517 | .get = alc_ch_mode_get, |
| 9518 | .put = alc_ch_mode_put, |
| 9519 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 9520 | }, |
| 9521 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9522 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9523 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9524 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 9525 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9526 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 9527 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 9528 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9529 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9530 | { } |
| 9531 | }; |
| 9532 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9533 | /* |
| 9534 | * generic initialization of ADC, input mixers and output mixers |
| 9535 | */ |
| 9536 | static struct hda_verb alc861_base_init_verbs[] = { |
| 9537 | /* |
| 9538 | * Unmute ADC0 and set the default input to mic-in |
| 9539 | */ |
| 9540 | /* port-A for surround (rear panel) */ |
| 9541 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9542 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9543 | /* port-B for mic-in (rear panel) with vref */ |
| 9544 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9545 | /* port-C for line-in (rear panel) */ |
| 9546 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9547 | /* port-D for Front */ |
| 9548 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9549 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9550 | /* port-E for HP out (front panel) */ |
| 9551 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 9552 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9553 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9554 | /* port-F for mic-in (front panel) with vref */ |
| 9555 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9556 | /* port-G for CLFE (rear panel) */ |
| 9557 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9558 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9559 | /* port-H for side (rear panel) */ |
| 9560 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9561 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9562 | /* CD-in */ |
| 9563 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9564 | /* route front mic to ADC1*/ |
| 9565 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9566 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9567 | |
| 9568 | /* Unmute DAC0~3 & spdif out*/ |
| 9569 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9570 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9571 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9572 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9574 | |
| 9575 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9576 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9577 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9578 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9579 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9580 | |
| 9581 | /* Unmute Stereo Mixer 15 */ |
| 9582 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9583 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9584 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9585 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9586 | |
| 9587 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9588 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9589 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9590 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9591 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9592 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9593 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9594 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9595 | /* hp used DAC 3 (Front) */ |
| 9596 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9597 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9598 | |
| 9599 | { } |
| 9600 | }; |
| 9601 | |
| 9602 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 9603 | /* |
| 9604 | * Unmute ADC0 and set the default input to mic-in |
| 9605 | */ |
| 9606 | /* port-A for surround (rear panel) */ |
| 9607 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9608 | /* port-B for mic-in (rear panel) with vref */ |
| 9609 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9610 | /* port-C for line-in (rear panel) */ |
| 9611 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9612 | /* port-D for Front */ |
| 9613 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9614 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9615 | /* port-E for HP out (front panel) */ |
| 9616 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 9617 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9618 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9619 | /* port-F for mic-in (front panel) with vref */ |
| 9620 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9621 | /* port-G for CLFE (rear panel) */ |
| 9622 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9623 | /* port-H for side (rear panel) */ |
| 9624 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9625 | /* CD-in */ |
| 9626 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9627 | /* route front mic to ADC1*/ |
| 9628 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9629 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9630 | /* Unmute DAC0~3 & spdif out*/ |
| 9631 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9632 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9633 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9634 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9635 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9636 | |
| 9637 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9638 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9639 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9640 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9641 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9642 | |
| 9643 | /* Unmute Stereo Mixer 15 */ |
| 9644 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9645 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9646 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9647 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9648 | |
| 9649 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9650 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9651 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9652 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9653 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9654 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9655 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9656 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9657 | /* hp used DAC 3 (Front) */ |
| 9658 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9659 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9660 | { } |
| 9661 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9662 | |
| 9663 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 9664 | /* |
| 9665 | * Unmute ADC0 and set the default input to mic-in |
| 9666 | */ |
| 9667 | /* port-A for surround (rear panel) */ |
| 9668 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9669 | /* port-B for mic-in (rear panel) with vref */ |
| 9670 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9671 | /* port-C for line-in (rear panel) */ |
| 9672 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9673 | /* port-D for Front */ |
| 9674 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9675 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9676 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9677 | /* this has to be set to VREF80 */ |
| 9678 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9679 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9680 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9681 | /* port-F for mic-in (front panel) with vref */ |
| 9682 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9683 | /* port-G for CLFE (rear panel) */ |
| 9684 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9685 | /* port-H for side (rear panel) */ |
| 9686 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9687 | /* CD-in */ |
| 9688 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9689 | /* route front mic to ADC1*/ |
| 9690 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9691 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9692 | /* Unmute DAC0~3 & spdif out*/ |
| 9693 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9694 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9695 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9696 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9698 | |
| 9699 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9700 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9701 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9702 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9703 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9704 | |
| 9705 | /* Unmute Stereo Mixer 15 */ |
| 9706 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9707 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9708 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9709 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9710 | |
| 9711 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9712 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9713 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9714 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9715 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9716 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9717 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9718 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9719 | /* hp used DAC 3 (Front) */ |
| 9720 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9721 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9722 | { } |
| 9723 | }; |
| 9724 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9725 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 9726 | /* |
| 9727 | * Unmute ADC0 and set the default input to mic-in |
| 9728 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9729 | /* port-A for surround (rear panel) |
| 9730 | * according to codec#0 this is the HP jack |
| 9731 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9732 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 9733 | /* route front PCM to HP */ |
| 9734 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9735 | /* port-B for mic-in (rear panel) with vref */ |
| 9736 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9737 | /* port-C for line-in (rear panel) */ |
| 9738 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9739 | /* port-D for Front */ |
| 9740 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9741 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 9742 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9743 | /* this has to be set to VREF80 */ |
| 9744 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9745 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 9746 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9747 | /* port-F for mic-in (front panel) with vref */ |
| 9748 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 9749 | /* port-G for CLFE (rear panel) */ |
| 9750 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9751 | /* port-H for side (rear panel) */ |
| 9752 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 9753 | /* CD-in */ |
| 9754 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 9755 | /* route front mic to ADC1*/ |
| 9756 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9757 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9758 | /* Unmute DAC0~3 & spdif out*/ |
| 9759 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9760 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9761 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9762 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9763 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9764 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9765 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9766 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9767 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9768 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9769 | |
| 9770 | /* Unmute Stereo Mixer 15 */ |
| 9771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9772 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9775 | |
| 9776 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9777 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9778 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9779 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9780 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9781 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9782 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9783 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9784 | /* hp used DAC 3 (Front) */ |
| 9785 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9786 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9787 | { } |
| 9788 | }; |
| 9789 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9790 | /* additional init verbs for ASUS laptops */ |
| 9791 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 9792 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 9793 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 9794 | { } |
| 9795 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9797 | /* |
| 9798 | * generic initialization of ADC, input mixers and output mixers |
| 9799 | */ |
| 9800 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 9801 | /* |
| 9802 | * Unmute ADC0 and set the default input to mic-in |
| 9803 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9804 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9805 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9806 | |
| 9807 | /* Unmute DAC0~3 & spdif out*/ |
| 9808 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9809 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9810 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9811 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9812 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9813 | |
| 9814 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 9815 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9816 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9817 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9818 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9819 | |
| 9820 | /* Unmute Stereo Mixer 15 */ |
| 9821 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9822 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9823 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9824 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 9825 | |
| 9826 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9827 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9828 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9829 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9830 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9831 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9832 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9833 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9834 | |
| 9835 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9836 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9837 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9838 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9839 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9840 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9841 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9842 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9843 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9844 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9845 | |
| 9846 | { } |
| 9847 | }; |
| 9848 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9849 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 9850 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9851 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9852 | { } |
| 9853 | }; |
| 9854 | |
| 9855 | /* toggle speaker-output according to the hp-jack state */ |
| 9856 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 9857 | { |
| 9858 | unsigned int present; |
| 9859 | |
| 9860 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 9861 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9862 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 9863 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9864 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 9865 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9866 | } |
| 9867 | |
| 9868 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 9869 | unsigned int res) |
| 9870 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9871 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9872 | alc861_toshiba_automute(codec); |
| 9873 | } |
| 9874 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9875 | /* pcm configuration: identiacal with ALC880 */ |
| 9876 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 9877 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 9878 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 9879 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 9880 | |
| 9881 | |
| 9882 | #define ALC861_DIGOUT_NID 0x07 |
| 9883 | |
| 9884 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 9885 | { 8, NULL } |
| 9886 | }; |
| 9887 | |
| 9888 | static hda_nid_t alc861_dac_nids[4] = { |
| 9889 | /* front, surround, clfe, side */ |
| 9890 | 0x03, 0x06, 0x05, 0x04 |
| 9891 | }; |
| 9892 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9893 | static hda_nid_t alc660_dac_nids[3] = { |
| 9894 | /* front, clfe, surround */ |
| 9895 | 0x03, 0x05, 0x06 |
| 9896 | }; |
| 9897 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9898 | static hda_nid_t alc861_adc_nids[1] = { |
| 9899 | /* ADC0-2 */ |
| 9900 | 0x08, |
| 9901 | }; |
| 9902 | |
| 9903 | static struct hda_input_mux alc861_capture_source = { |
| 9904 | .num_items = 5, |
| 9905 | .items = { |
| 9906 | { "Mic", 0x0 }, |
| 9907 | { "Front Mic", 0x3 }, |
| 9908 | { "Line", 0x1 }, |
| 9909 | { "CD", 0x4 }, |
| 9910 | { "Mixer", 0x5 }, |
| 9911 | }, |
| 9912 | }; |
| 9913 | |
| 9914 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9915 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 9916 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9917 | { |
| 9918 | int i; |
| 9919 | hda_nid_t nid; |
| 9920 | |
| 9921 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9922 | for (i = 0; i < cfg->line_outs; i++) { |
| 9923 | nid = cfg->line_out_pins[i]; |
| 9924 | if (nid) { |
| 9925 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 9926 | continue; |
| 9927 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 9928 | } |
| 9929 | } |
| 9930 | spec->multiout.num_dacs = cfg->line_outs; |
| 9931 | return 0; |
| 9932 | } |
| 9933 | |
| 9934 | /* add playback controls from the parsed DAC table */ |
| 9935 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9936 | const struct auto_pin_cfg *cfg) |
| 9937 | { |
| 9938 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9939 | static const char *chname[4] = { |
| 9940 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 9941 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9942 | hda_nid_t nid; |
| 9943 | int i, idx, err; |
| 9944 | |
| 9945 | for (i = 0; i < cfg->line_outs; i++) { |
| 9946 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9947 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9948 | continue; |
| 9949 | if (nid == 0x05) { |
| 9950 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9951 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9952 | "Center Playback Switch", |
| 9953 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 9954 | HDA_OUTPUT)); |
| 9955 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9956 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9957 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9958 | "LFE Playback Switch", |
| 9959 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9960 | HDA_OUTPUT)); |
| 9961 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9962 | return err; |
| 9963 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9964 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 9965 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9966 | if (nid == alc861_dac_nids[idx]) |
| 9967 | break; |
| 9968 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9969 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 9970 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9971 | HDA_OUTPUT)); |
| 9972 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9973 | return err; |
| 9974 | } |
| 9975 | } |
| 9976 | return 0; |
| 9977 | } |
| 9978 | |
| 9979 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 9980 | { |
| 9981 | int err; |
| 9982 | hda_nid_t nid; |
| 9983 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9984 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9985 | return 0; |
| 9986 | |
| 9987 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 9988 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9989 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9990 | "Headphone Playback Switch", |
| 9991 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9992 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9993 | return err; |
| 9994 | spec->multiout.hp_nid = nid; |
| 9995 | } |
| 9996 | return 0; |
| 9997 | } |
| 9998 | |
| 9999 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10000 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10001 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10002 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10003 | struct hda_input_mux *imux = &spec->private_imux; |
| 10004 | int i, err, idx, idx1; |
| 10005 | |
| 10006 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10007 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10008 | case 0x0c: |
| 10009 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10010 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10011 | break; |
| 10012 | case 0x0f: |
| 10013 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10014 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10015 | break; |
| 10016 | case 0x0d: |
| 10017 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10018 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10019 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10020 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10021 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10022 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10023 | break; |
| 10024 | case 0x11: |
| 10025 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10026 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10027 | break; |
| 10028 | default: |
| 10029 | continue; |
| 10030 | } |
| 10031 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10032 | err = new_analog_input(spec, cfg->input_pins[i], |
| 10033 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10034 | if (err < 0) |
| 10035 | return err; |
| 10036 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10037 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10038 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10039 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10040 | } |
| 10041 | return 0; |
| 10042 | } |
| 10043 | |
| 10044 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 10045 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10046 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10047 | |
| 10048 | { |
| 10049 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10050 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10051 | * So call somewhat different.. |
| 10052 | *FIXME: the controls appear in the "playback" view! |
| 10053 | */ |
| 10054 | /* .name = "Capture Source", */ |
| 10055 | .name = "Input Source", |
| 10056 | .count = 1, |
| 10057 | .info = alc_mux_enum_info, |
| 10058 | .get = alc_mux_enum_get, |
| 10059 | .put = alc_mux_enum_put, |
| 10060 | }, |
| 10061 | { } /* end */ |
| 10062 | }; |
| 10063 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10064 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 10065 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10066 | int pin_type, int dac_idx) |
| 10067 | { |
| 10068 | /* set as output */ |
| 10069 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10070 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10071 | pin_type); |
| 10072 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 10073 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10074 | |
| 10075 | } |
| 10076 | |
| 10077 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 10078 | { |
| 10079 | struct alc_spec *spec = codec->spec; |
| 10080 | int i; |
| 10081 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10082 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10083 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 10084 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10085 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10086 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10087 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10088 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10089 | } |
| 10090 | } |
| 10091 | |
| 10092 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 10093 | { |
| 10094 | struct alc_spec *spec = codec->spec; |
| 10095 | hda_nid_t pin; |
| 10096 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10097 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10098 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10099 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 10100 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10101 | } |
| 10102 | |
| 10103 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 10104 | { |
| 10105 | struct alc_spec *spec = codec->spec; |
| 10106 | int i; |
| 10107 | |
| 10108 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10109 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10110 | if (nid >= 0x0c && nid <= 0x11) { |
| 10111 | snd_hda_codec_write(codec, nid, 0, |
| 10112 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10113 | i <= AUTO_PIN_FRONT_MIC ? |
| 10114 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10115 | } |
| 10116 | } |
| 10117 | } |
| 10118 | |
| 10119 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10120 | /* return 1 if successful, 0 if the proper config is not found, |
| 10121 | * or a negative error code |
| 10122 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10123 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 10124 | { |
| 10125 | struct alc_spec *spec = codec->spec; |
| 10126 | int err; |
| 10127 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 10128 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10129 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10130 | alc861_ignore); |
| 10131 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10132 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10133 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10134 | return 0; /* can't find valid BIOS pin config */ |
| 10135 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10136 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10137 | if (err < 0) |
| 10138 | return err; |
| 10139 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10140 | if (err < 0) |
| 10141 | return err; |
| 10142 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 10143 | if (err < 0) |
| 10144 | return err; |
| 10145 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10146 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10147 | return err; |
| 10148 | |
| 10149 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10150 | |
| 10151 | if (spec->autocfg.dig_out_pin) |
| 10152 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 10153 | |
| 10154 | if (spec->kctl_alloc) |
| 10155 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10156 | |
| 10157 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 10158 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10159 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10160 | spec->input_mux = &spec->private_imux; |
| 10161 | |
| 10162 | spec->adc_nids = alc861_adc_nids; |
| 10163 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 10164 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 10165 | spec->num_mixers++; |
| 10166 | |
| 10167 | return 1; |
| 10168 | } |
| 10169 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10170 | /* additional initialization for auto-configuration model */ |
| 10171 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10172 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10173 | alc861_auto_init_multi_out(codec); |
| 10174 | alc861_auto_init_hp_out(codec); |
| 10175 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10176 | } |
| 10177 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10178 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10179 | static struct hda_amp_list alc861_loopbacks[] = { |
| 10180 | { 0x15, HDA_INPUT, 0 }, |
| 10181 | { 0x15, HDA_INPUT, 1 }, |
| 10182 | { 0x15, HDA_INPUT, 2 }, |
| 10183 | { 0x15, HDA_INPUT, 3 }, |
| 10184 | { } /* end */ |
| 10185 | }; |
| 10186 | #endif |
| 10187 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10188 | |
| 10189 | /* |
| 10190 | * configuration and preset |
| 10191 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10192 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 10193 | [ALC861_3ST] = "3stack", |
| 10194 | [ALC660_3ST] = "3stack-660", |
| 10195 | [ALC861_3ST_DIG] = "3stack-dig", |
| 10196 | [ALC861_6ST_DIG] = "6stack-dig", |
| 10197 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 10198 | [ALC861_TOSHIBA] = "toshiba", |
| 10199 | [ALC861_ASUS] = "asus", |
| 10200 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 10201 | [ALC861_AUTO] = "auto", |
| 10202 | }; |
| 10203 | |
| 10204 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 10205 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10206 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 10207 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f223a9f | 2007-04-25 13:38:31 +0200 | [diff] [blame] | 10208 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10209 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10210 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10211 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 10212 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 10213 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 10214 | * Any other models that need this preset? |
| 10215 | */ |
| 10216 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10217 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
Dave Jones | 35739bb | 2007-06-06 14:48:52 +0200 | [diff] [blame] | 10218 | SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), |
Takashi Iwai | 4147dab | 2007-01-31 10:35:19 +0100 | [diff] [blame] | 10219 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 10220 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10221 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 10222 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 10223 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10224 | {} |
| 10225 | }; |
| 10226 | |
| 10227 | static struct alc_config_preset alc861_presets[] = { |
| 10228 | [ALC861_3ST] = { |
| 10229 | .mixers = { alc861_3ST_mixer }, |
| 10230 | .init_verbs = { alc861_threestack_init_verbs }, |
| 10231 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 10232 | .dac_nids = alc861_dac_nids, |
| 10233 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 10234 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10235 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10236 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 10237 | .adc_nids = alc861_adc_nids, |
| 10238 | .input_mux = &alc861_capture_source, |
| 10239 | }, |
| 10240 | [ALC861_3ST_DIG] = { |
| 10241 | .mixers = { alc861_base_mixer }, |
| 10242 | .init_verbs = { alc861_threestack_init_verbs }, |
| 10243 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 10244 | .dac_nids = alc861_dac_nids, |
| 10245 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 10246 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 10247 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10248 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10249 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 10250 | .adc_nids = alc861_adc_nids, |
| 10251 | .input_mux = &alc861_capture_source, |
| 10252 | }, |
| 10253 | [ALC861_6ST_DIG] = { |
| 10254 | .mixers = { alc861_base_mixer }, |
| 10255 | .init_verbs = { alc861_base_init_verbs }, |
| 10256 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 10257 | .dac_nids = alc861_dac_nids, |
| 10258 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 10259 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 10260 | .channel_mode = alc861_8ch_modes, |
| 10261 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 10262 | .adc_nids = alc861_adc_nids, |
| 10263 | .input_mux = &alc861_capture_source, |
| 10264 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10265 | [ALC660_3ST] = { |
| 10266 | .mixers = { alc861_3ST_mixer }, |
| 10267 | .init_verbs = { alc861_threestack_init_verbs }, |
| 10268 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 10269 | .dac_nids = alc660_dac_nids, |
| 10270 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 10271 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10272 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10273 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 10274 | .adc_nids = alc861_adc_nids, |
| 10275 | .input_mux = &alc861_capture_source, |
| 10276 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10277 | [ALC861_UNIWILL_M31] = { |
| 10278 | .mixers = { alc861_uniwill_m31_mixer }, |
| 10279 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 10280 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 10281 | .dac_nids = alc861_dac_nids, |
| 10282 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 10283 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 10284 | .channel_mode = alc861_uniwill_m31_modes, |
| 10285 | .need_dac_fix = 1, |
| 10286 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 10287 | .adc_nids = alc861_adc_nids, |
| 10288 | .input_mux = &alc861_capture_source, |
| 10289 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10290 | [ALC861_TOSHIBA] = { |
| 10291 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10292 | .init_verbs = { alc861_base_init_verbs, |
| 10293 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10294 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 10295 | .dac_nids = alc861_dac_nids, |
| 10296 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10297 | .channel_mode = alc883_3ST_2ch_modes, |
| 10298 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 10299 | .adc_nids = alc861_adc_nids, |
| 10300 | .input_mux = &alc861_capture_source, |
| 10301 | .unsol_event = alc861_toshiba_unsol_event, |
| 10302 | .init_hook = alc861_toshiba_automute, |
| 10303 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10304 | [ALC861_ASUS] = { |
| 10305 | .mixers = { alc861_asus_mixer }, |
| 10306 | .init_verbs = { alc861_asus_init_verbs }, |
| 10307 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 10308 | .dac_nids = alc861_dac_nids, |
| 10309 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 10310 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 10311 | .channel_mode = alc861_asus_modes, |
| 10312 | .need_dac_fix = 1, |
| 10313 | .hp_nid = 0x06, |
| 10314 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 10315 | .adc_nids = alc861_adc_nids, |
| 10316 | .input_mux = &alc861_capture_source, |
| 10317 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10318 | [ALC861_ASUS_LAPTOP] = { |
| 10319 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 10320 | .init_verbs = { alc861_asus_init_verbs, |
| 10321 | alc861_asus_laptop_init_verbs }, |
| 10322 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 10323 | .dac_nids = alc861_dac_nids, |
| 10324 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 10325 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10326 | .channel_mode = alc883_3ST_2ch_modes, |
| 10327 | .need_dac_fix = 1, |
| 10328 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 10329 | .adc_nids = alc861_adc_nids, |
| 10330 | .input_mux = &alc861_capture_source, |
| 10331 | }, |
| 10332 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10333 | |
| 10334 | |
| 10335 | static int patch_alc861(struct hda_codec *codec) |
| 10336 | { |
| 10337 | struct alc_spec *spec; |
| 10338 | int board_config; |
| 10339 | int err; |
| 10340 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10341 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10342 | if (spec == NULL) |
| 10343 | return -ENOMEM; |
| 10344 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10345 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10346 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10347 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 10348 | alc861_models, |
| 10349 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10350 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10351 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10352 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 10353 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10354 | board_config = ALC861_AUTO; |
| 10355 | } |
| 10356 | |
| 10357 | if (board_config == ALC861_AUTO) { |
| 10358 | /* automatic parse from the BIOS config */ |
| 10359 | err = alc861_parse_auto_config(codec); |
| 10360 | if (err < 0) { |
| 10361 | alc_free(codec); |
| 10362 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10363 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10364 | printk(KERN_INFO |
| 10365 | "hda_codec: Cannot set up configuration " |
| 10366 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10367 | board_config = ALC861_3ST_DIG; |
| 10368 | } |
| 10369 | } |
| 10370 | |
| 10371 | if (board_config != ALC861_AUTO) |
| 10372 | setup_preset(spec, &alc861_presets[board_config]); |
| 10373 | |
| 10374 | spec->stream_name_analog = "ALC861 Analog"; |
| 10375 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 10376 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 10377 | |
| 10378 | spec->stream_name_digital = "ALC861 Digital"; |
| 10379 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 10380 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 10381 | |
| 10382 | codec->patch_ops = alc_patch_ops; |
| 10383 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10384 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10385 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10386 | if (!spec->loopback.amplist) |
| 10387 | spec->loopback.amplist = alc861_loopbacks; |
| 10388 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10389 | |
| 10390 | return 0; |
| 10391 | } |
| 10392 | |
| 10393 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10394 | * ALC861-VD support |
| 10395 | * |
| 10396 | * Based on ALC882 |
| 10397 | * |
| 10398 | * In addition, an independent DAC |
| 10399 | */ |
| 10400 | #define ALC861VD_DIGOUT_NID 0x06 |
| 10401 | |
| 10402 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 10403 | /* front, surr, clfe, side surr */ |
| 10404 | 0x02, 0x03, 0x04, 0x05 |
| 10405 | }; |
| 10406 | |
| 10407 | /* dac_nids for ALC660vd are in a different order - according to |
| 10408 | * Realtek's driver. |
| 10409 | * This should probably tesult in a different mixer for 6stack models |
| 10410 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 10411 | * - and it is the same as in 861vd. |
| 10412 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 10413 | */ |
| 10414 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 10415 | /* front, rear, clfe, rear_surr */ |
| 10416 | 0x02, 0x04, 0x03 |
| 10417 | }; |
| 10418 | |
| 10419 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 10420 | /* ADC0 */ |
| 10421 | 0x09, |
| 10422 | }; |
| 10423 | |
| 10424 | /* input MUX */ |
| 10425 | /* FIXME: should be a matrix-type input source selection */ |
| 10426 | static struct hda_input_mux alc861vd_capture_source = { |
| 10427 | .num_items = 4, |
| 10428 | .items = { |
| 10429 | { "Mic", 0x0 }, |
| 10430 | { "Front Mic", 0x1 }, |
| 10431 | { "Line", 0x2 }, |
| 10432 | { "CD", 0x4 }, |
| 10433 | }, |
| 10434 | }; |
| 10435 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10436 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 10437 | .num_items = 3, |
| 10438 | .items = { |
| 10439 | { "Front Mic", 0x0 }, |
| 10440 | { "ATAPI Mic", 0x1 }, |
| 10441 | { "Line In", 0x5 }, |
| 10442 | }, |
| 10443 | }; |
| 10444 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10445 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 10446 | .num_items = 2, |
| 10447 | .items = { |
| 10448 | { "Front Mic", 0x0 }, |
| 10449 | { "ATAPI Mic", 0x1 }, |
| 10450 | }, |
| 10451 | }; |
| 10452 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10453 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 10454 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 10455 | |
| 10456 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10457 | struct snd_ctl_elem_value *ucontrol) |
| 10458 | { |
| 10459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10460 | struct alc_spec *spec = codec->spec; |
| 10461 | const struct hda_input_mux *imux = spec->input_mux; |
| 10462 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 10463 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 10464 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 10465 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 10466 | unsigned int i, idx; |
| 10467 | |
| 10468 | idx = ucontrol->value.enumerated.item[0]; |
| 10469 | if (idx >= imux->num_items) |
| 10470 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10471 | if (*cur_val == idx) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10472 | return 0; |
| 10473 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10474 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 10475 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 10476 | imux->items[i].index, |
| 10477 | HDA_AMP_MUTE, v); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10478 | } |
| 10479 | *cur_val = idx; |
| 10480 | return 1; |
| 10481 | } |
| 10482 | |
| 10483 | /* |
| 10484 | * 2ch mode |
| 10485 | */ |
| 10486 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 10487 | { 2, NULL } |
| 10488 | }; |
| 10489 | |
| 10490 | /* |
| 10491 | * 6ch mode |
| 10492 | */ |
| 10493 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 10494 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10495 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10496 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10497 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10498 | { } /* end */ |
| 10499 | }; |
| 10500 | |
| 10501 | /* |
| 10502 | * 8ch mode |
| 10503 | */ |
| 10504 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 10505 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10506 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10507 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10508 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10509 | { } /* end */ |
| 10510 | }; |
| 10511 | |
| 10512 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 10513 | { 6, alc861vd_6stack_ch6_init }, |
| 10514 | { 8, alc861vd_6stack_ch8_init }, |
| 10515 | }; |
| 10516 | |
| 10517 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 10518 | { |
| 10519 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10520 | .name = "Channel Mode", |
| 10521 | .info = alc_ch_mode_info, |
| 10522 | .get = alc_ch_mode_get, |
| 10523 | .put = alc_ch_mode_put, |
| 10524 | }, |
| 10525 | { } /* end */ |
| 10526 | }; |
| 10527 | |
| 10528 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 10529 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10530 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10531 | |
| 10532 | { |
| 10533 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10534 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10535 | * So call somewhat different.. |
| 10536 | *FIXME: the controls appear in the "playback" view! |
| 10537 | */ |
| 10538 | /* .name = "Capture Source", */ |
| 10539 | .name = "Input Source", |
| 10540 | .count = 1, |
| 10541 | .info = alc861vd_mux_enum_info, |
| 10542 | .get = alc861vd_mux_enum_get, |
| 10543 | .put = alc861vd_mux_enum_put, |
| 10544 | }, |
| 10545 | { } /* end */ |
| 10546 | }; |
| 10547 | |
| 10548 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 10549 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 10550 | */ |
| 10551 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 10552 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10553 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10554 | |
| 10555 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10556 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 10557 | |
| 10558 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 10559 | HDA_OUTPUT), |
| 10560 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 10561 | HDA_OUTPUT), |
| 10562 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10563 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 10564 | |
| 10565 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 10566 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10567 | |
| 10568 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10569 | |
| 10570 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10571 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10572 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10573 | |
| 10574 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10575 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10576 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10577 | |
| 10578 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10579 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10580 | |
| 10581 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10582 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10583 | |
| 10584 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10585 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10586 | |
| 10587 | { } /* end */ |
| 10588 | }; |
| 10589 | |
| 10590 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 10591 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10592 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10593 | |
| 10594 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10595 | |
| 10596 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10597 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10598 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10599 | |
| 10600 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10601 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10602 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10603 | |
| 10604 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10605 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10606 | |
| 10607 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10608 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10609 | |
| 10610 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10611 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10612 | |
| 10613 | { } /* end */ |
| 10614 | }; |
| 10615 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10616 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 10617 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10618 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 10619 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10620 | |
| 10621 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10622 | |
| 10623 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10624 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10625 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10626 | |
| 10627 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10628 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10629 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10630 | |
| 10631 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10632 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10633 | |
| 10634 | { } /* end */ |
| 10635 | }; |
| 10636 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10637 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 10638 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 10639 | */ |
| 10640 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 10641 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10642 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10643 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10644 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 10645 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10646 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10647 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10648 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10649 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10650 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10651 | { } /* end */ |
| 10652 | }; |
| 10653 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10654 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 10655 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 10656 | */ |
| 10657 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 10658 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10659 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10660 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10661 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 10662 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10663 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10664 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10665 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10666 | |
| 10667 | { } /* end */ |
| 10668 | }; |
| 10669 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10670 | /* |
| 10671 | * generic initialization of ADC, input mixers and output mixers |
| 10672 | */ |
| 10673 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 10674 | /* |
| 10675 | * Unmute ADC0 and set the default input to mic-in |
| 10676 | */ |
| 10677 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10678 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10679 | |
| 10680 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 10681 | * the analog-loopback mixer widget |
| 10682 | */ |
| 10683 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10684 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10685 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10686 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10687 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10688 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10689 | |
| 10690 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10691 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10692 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10693 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10694 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10695 | |
| 10696 | /* |
| 10697 | * Set up output mixers (0x02 - 0x05) |
| 10698 | */ |
| 10699 | /* set vol=0 to output mixers */ |
| 10700 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10701 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10702 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10703 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10704 | |
| 10705 | /* set up input amps for analog loopback */ |
| 10706 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10707 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10708 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10709 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10710 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10711 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10712 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10713 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10714 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10715 | |
| 10716 | { } |
| 10717 | }; |
| 10718 | |
| 10719 | /* |
| 10720 | * 3-stack pin configuration: |
| 10721 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 10722 | */ |
| 10723 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 10724 | /* |
| 10725 | * Set pin mode and muting |
| 10726 | */ |
| 10727 | /* set front pin widgets 0x14 for output */ |
| 10728 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10729 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10730 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10731 | |
| 10732 | /* Mic (rear) pin: input vref at 80% */ |
| 10733 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10734 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10735 | /* Front Mic pin: input vref at 80% */ |
| 10736 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10737 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10738 | /* Line In pin: input */ |
| 10739 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10740 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10741 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10742 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10743 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10744 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10745 | /* CD pin widget for input */ |
| 10746 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10747 | |
| 10748 | { } |
| 10749 | }; |
| 10750 | |
| 10751 | /* |
| 10752 | * 6-stack pin configuration: |
| 10753 | */ |
| 10754 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 10755 | /* |
| 10756 | * Set pin mode and muting |
| 10757 | */ |
| 10758 | /* set front pin widgets 0x14 for output */ |
| 10759 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10760 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10761 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10762 | |
| 10763 | /* Rear Pin: output 1 (0x0d) */ |
| 10764 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10765 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10766 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10767 | /* CLFE Pin: output 2 (0x0e) */ |
| 10768 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10769 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10770 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 10771 | /* Side Pin: output 3 (0x0f) */ |
| 10772 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10773 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10774 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 10775 | |
| 10776 | /* Mic (rear) pin: input vref at 80% */ |
| 10777 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10778 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10779 | /* Front Mic pin: input vref at 80% */ |
| 10780 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10781 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10782 | /* Line In pin: input */ |
| 10783 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10784 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10785 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10786 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10787 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10788 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10789 | /* CD pin widget for input */ |
| 10790 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10791 | |
| 10792 | { } |
| 10793 | }; |
| 10794 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10795 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 10796 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10797 | { } |
| 10798 | }; |
| 10799 | |
| 10800 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 10801 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10802 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10803 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10804 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10805 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10806 | {} |
| 10807 | }; |
| 10808 | |
| 10809 | /* toggle speaker-output according to the hp-jack state */ |
| 10810 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 10811 | { |
| 10812 | unsigned int present; |
| 10813 | unsigned char bits; |
| 10814 | |
| 10815 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 10816 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10817 | bits = present ? HDA_AMP_MUTE : 0; |
| 10818 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10819 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10820 | } |
| 10821 | |
| 10822 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 10823 | { |
| 10824 | unsigned int present; |
| 10825 | unsigned char bits; |
| 10826 | |
| 10827 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10828 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10829 | bits = present ? HDA_AMP_MUTE : 0; |
| 10830 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 10831 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10832 | } |
| 10833 | |
| 10834 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 10835 | { |
| 10836 | alc861vd_lenovo_hp_automute(codec); |
| 10837 | alc861vd_lenovo_mic_automute(codec); |
| 10838 | } |
| 10839 | |
| 10840 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 10841 | unsigned int res) |
| 10842 | { |
| 10843 | switch (res >> 26) { |
| 10844 | case ALC880_HP_EVENT: |
| 10845 | alc861vd_lenovo_hp_automute(codec); |
| 10846 | break; |
| 10847 | case ALC880_MIC_EVENT: |
| 10848 | alc861vd_lenovo_mic_automute(codec); |
| 10849 | break; |
| 10850 | } |
| 10851 | } |
| 10852 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10853 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 10854 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10855 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10856 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10857 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10858 | |
| 10859 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10860 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10861 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10862 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10863 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10864 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10865 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10866 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10867 | |
| 10868 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10869 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10870 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10871 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10872 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10873 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10874 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10875 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10876 | |
| 10877 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10878 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10879 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10880 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10881 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10882 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10883 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10884 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10885 | |
| 10886 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10887 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10888 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10890 | |
| 10891 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10892 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10893 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10894 | |
| 10895 | { } /* end */ |
| 10896 | }; |
| 10897 | |
| 10898 | /* toggle speaker-output according to the hp-jack state */ |
| 10899 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 10900 | { |
| 10901 | unsigned int present; |
| 10902 | |
| 10903 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10904 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10905 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10906 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10907 | } |
| 10908 | |
| 10909 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10910 | { |
| 10911 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10912 | alc861vd_dallas_automute(codec); |
| 10913 | } |
| 10914 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10915 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10916 | #define alc861vd_loopbacks alc880_loopbacks |
| 10917 | #endif |
| 10918 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10919 | /* pcm configuration: identiacal with ALC880 */ |
| 10920 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 10921 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 10922 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 10923 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 10924 | |
| 10925 | /* |
| 10926 | * configuration and preset |
| 10927 | */ |
| 10928 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 10929 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10930 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10931 | [ALC861VD_3ST] = "3stack", |
| 10932 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 10933 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10934 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10935 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10936 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10937 | [ALC861VD_AUTO] = "auto", |
| 10938 | }; |
| 10939 | |
| 10940 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 10941 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10942 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10943 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10944 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10945 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10946 | |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 10947 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10948 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10949 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
| 10950 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
Takashi Iwai | a18519e | 2007-06-14 12:58:23 +0200 | [diff] [blame] | 10951 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 10952 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 10953 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 10954 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10955 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10956 | {} |
| 10957 | }; |
| 10958 | |
| 10959 | static struct alc_config_preset alc861vd_presets[] = { |
| 10960 | [ALC660VD_3ST] = { |
| 10961 | .mixers = { alc861vd_3st_mixer }, |
| 10962 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10963 | alc861vd_3stack_init_verbs }, |
| 10964 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10965 | .dac_nids = alc660vd_dac_nids, |
| 10966 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10967 | .adc_nids = alc861vd_adc_nids, |
| 10968 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10969 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10970 | .input_mux = &alc861vd_capture_source, |
| 10971 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10972 | [ALC660VD_3ST_DIG] = { |
| 10973 | .mixers = { alc861vd_3st_mixer }, |
| 10974 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10975 | alc861vd_3stack_init_verbs }, |
| 10976 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10977 | .dac_nids = alc660vd_dac_nids, |
| 10978 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10979 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10980 | .adc_nids = alc861vd_adc_nids, |
| 10981 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10982 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10983 | .input_mux = &alc861vd_capture_source, |
| 10984 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10985 | [ALC861VD_3ST] = { |
| 10986 | .mixers = { alc861vd_3st_mixer }, |
| 10987 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10988 | alc861vd_3stack_init_verbs }, |
| 10989 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10990 | .dac_nids = alc861vd_dac_nids, |
| 10991 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10992 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10993 | .input_mux = &alc861vd_capture_source, |
| 10994 | }, |
| 10995 | [ALC861VD_3ST_DIG] = { |
| 10996 | .mixers = { alc861vd_3st_mixer }, |
| 10997 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10998 | alc861vd_3stack_init_verbs }, |
| 10999 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 11000 | .dac_nids = alc861vd_dac_nids, |
| 11001 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 11002 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 11003 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 11004 | .input_mux = &alc861vd_capture_source, |
| 11005 | }, |
| 11006 | [ALC861VD_6ST_DIG] = { |
| 11007 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 11008 | .init_verbs = { alc861vd_volume_init_verbs, |
| 11009 | alc861vd_6stack_init_verbs }, |
| 11010 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 11011 | .dac_nids = alc861vd_dac_nids, |
| 11012 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 11013 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 11014 | .channel_mode = alc861vd_6stack_modes, |
| 11015 | .input_mux = &alc861vd_capture_source, |
| 11016 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11017 | [ALC861VD_LENOVO] = { |
| 11018 | .mixers = { alc861vd_lenovo_mixer }, |
| 11019 | .init_verbs = { alc861vd_volume_init_verbs, |
| 11020 | alc861vd_3stack_init_verbs, |
| 11021 | alc861vd_eapd_verbs, |
| 11022 | alc861vd_lenovo_unsol_verbs }, |
| 11023 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 11024 | .dac_nids = alc660vd_dac_nids, |
| 11025 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 11026 | .adc_nids = alc861vd_adc_nids, |
| 11027 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 11028 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 11029 | .input_mux = &alc861vd_capture_source, |
| 11030 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 11031 | .init_hook = alc861vd_lenovo_automute, |
| 11032 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11033 | [ALC861VD_DALLAS] = { |
| 11034 | .mixers = { alc861vd_dallas_mixer }, |
| 11035 | .init_verbs = { alc861vd_dallas_verbs }, |
| 11036 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 11037 | .dac_nids = alc861vd_dac_nids, |
| 11038 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 11039 | .adc_nids = alc861vd_adc_nids, |
| 11040 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 11041 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 11042 | .input_mux = &alc861vd_dallas_capture_source, |
| 11043 | .unsol_event = alc861vd_dallas_unsol_event, |
| 11044 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11045 | }, |
| 11046 | [ALC861VD_HP] = { |
| 11047 | .mixers = { alc861vd_hp_mixer }, |
| 11048 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 11049 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 11050 | .dac_nids = alc861vd_dac_nids, |
| 11051 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 11052 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 11053 | .adc_nids = alc861vd_adc_nids, |
| 11054 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 11055 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 11056 | .input_mux = &alc861vd_hp_capture_source, |
| 11057 | .unsol_event = alc861vd_dallas_unsol_event, |
| 11058 | .init_hook = alc861vd_dallas_automute, |
| 11059 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11060 | }; |
| 11061 | |
| 11062 | /* |
| 11063 | * BIOS auto configuration |
| 11064 | */ |
| 11065 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11066 | hda_nid_t nid, int pin_type, int dac_idx) |
| 11067 | { |
| 11068 | /* set as output */ |
| 11069 | snd_hda_codec_write(codec, nid, 0, |
| 11070 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 11071 | snd_hda_codec_write(codec, nid, 0, |
| 11072 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 11073 | } |
| 11074 | |
| 11075 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 11076 | { |
| 11077 | struct alc_spec *spec = codec->spec; |
| 11078 | int i; |
| 11079 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11080 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11081 | for (i = 0; i <= HDA_SIDE; i++) { |
| 11082 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11083 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11084 | if (nid) |
| 11085 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11086 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11087 | } |
| 11088 | } |
| 11089 | |
| 11090 | |
| 11091 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 11092 | { |
| 11093 | struct alc_spec *spec = codec->spec; |
| 11094 | hda_nid_t pin; |
| 11095 | |
| 11096 | pin = spec->autocfg.hp_pins[0]; |
| 11097 | if (pin) /* connect to front and use dac 0 */ |
| 11098 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 11099 | } |
| 11100 | |
| 11101 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 11102 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 11103 | |
| 11104 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 11105 | { |
| 11106 | struct alc_spec *spec = codec->spec; |
| 11107 | int i; |
| 11108 | |
| 11109 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11110 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 11111 | if (alc861vd_is_input_pin(nid)) { |
| 11112 | snd_hda_codec_write(codec, nid, 0, |
| 11113 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11114 | i <= AUTO_PIN_FRONT_MIC ? |
| 11115 | PIN_VREF80 : PIN_IN); |
| 11116 | if (nid != ALC861VD_PIN_CD_NID) |
| 11117 | snd_hda_codec_write(codec, nid, 0, |
| 11118 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11119 | AMP_OUT_MUTE); |
| 11120 | } |
| 11121 | } |
| 11122 | } |
| 11123 | |
| 11124 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 11125 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 11126 | |
| 11127 | /* add playback controls from the parsed DAC table */ |
| 11128 | /* Based on ALC880 version. But ALC861VD has separate, |
| 11129 | * different NIDs for mute/unmute switch and volume control */ |
| 11130 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11131 | const struct auto_pin_cfg *cfg) |
| 11132 | { |
| 11133 | char name[32]; |
| 11134 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 11135 | hda_nid_t nid_v, nid_s; |
| 11136 | int i, err; |
| 11137 | |
| 11138 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11139 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11140 | continue; |
| 11141 | nid_v = alc861vd_idx_to_mixer_vol( |
| 11142 | alc880_dac_to_idx( |
| 11143 | spec->multiout.dac_nids[i])); |
| 11144 | nid_s = alc861vd_idx_to_mixer_switch( |
| 11145 | alc880_dac_to_idx( |
| 11146 | spec->multiout.dac_nids[i])); |
| 11147 | |
| 11148 | if (i == 2) { |
| 11149 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11150 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11151 | "Center Playback Volume", |
| 11152 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 11153 | HDA_OUTPUT)); |
| 11154 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11155 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11156 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11157 | "LFE Playback Volume", |
| 11158 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 11159 | HDA_OUTPUT)); |
| 11160 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11161 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11162 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11163 | "Center Playback Switch", |
| 11164 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 11165 | HDA_INPUT)); |
| 11166 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11167 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11168 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11169 | "LFE Playback Switch", |
| 11170 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 11171 | HDA_INPUT)); |
| 11172 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11173 | return err; |
| 11174 | } else { |
| 11175 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11176 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11177 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 11178 | HDA_OUTPUT)); |
| 11179 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11180 | return err; |
| 11181 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11182 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11183 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11184 | HDA_INPUT)); |
| 11185 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11186 | return err; |
| 11187 | } |
| 11188 | } |
| 11189 | return 0; |
| 11190 | } |
| 11191 | |
| 11192 | /* add playback controls for speaker and HP outputs */ |
| 11193 | /* Based on ALC880 version. But ALC861VD has separate, |
| 11194 | * different NIDs for mute/unmute switch and volume control */ |
| 11195 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 11196 | hda_nid_t pin, const char *pfx) |
| 11197 | { |
| 11198 | hda_nid_t nid_v, nid_s; |
| 11199 | int err; |
| 11200 | char name[32]; |
| 11201 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11202 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11203 | return 0; |
| 11204 | |
| 11205 | if (alc880_is_fixed_pin(pin)) { |
| 11206 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11207 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11208 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11209 | spec->multiout.hp_nid = nid_v; |
| 11210 | else |
| 11211 | spec->multiout.extra_out_nid[0] = nid_v; |
| 11212 | /* control HP volume/switch on the output mixer amp */ |
| 11213 | nid_v = alc861vd_idx_to_mixer_vol( |
| 11214 | alc880_fixed_pin_idx(pin)); |
| 11215 | nid_s = alc861vd_idx_to_mixer_switch( |
| 11216 | alc880_fixed_pin_idx(pin)); |
| 11217 | |
| 11218 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11219 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11220 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 11221 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11222 | return err; |
| 11223 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11224 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11225 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 11226 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11227 | return err; |
| 11228 | } else if (alc880_is_multi_pin(pin)) { |
| 11229 | /* set manual connection */ |
| 11230 | /* we have only a switch on HP-out PIN */ |
| 11231 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11232 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11233 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 11234 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11235 | return err; |
| 11236 | } |
| 11237 | return 0; |
| 11238 | } |
| 11239 | |
| 11240 | /* parse the BIOS configuration and set up the alc_spec |
| 11241 | * return 1 if successful, 0 if the proper config is not found, |
| 11242 | * or a negative error code |
| 11243 | * Based on ALC880 version - had to change it to override |
| 11244 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 11245 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 11246 | { |
| 11247 | struct alc_spec *spec = codec->spec; |
| 11248 | int err; |
| 11249 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 11250 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11251 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11252 | alc861vd_ignore); |
| 11253 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11254 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11255 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11256 | return 0; /* can't find valid BIOS pin config */ |
| 11257 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11258 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11259 | if (err < 0) |
| 11260 | return err; |
| 11261 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11262 | if (err < 0) |
| 11263 | return err; |
| 11264 | err = alc861vd_auto_create_extra_out(spec, |
| 11265 | spec->autocfg.speaker_pins[0], |
| 11266 | "Speaker"); |
| 11267 | if (err < 0) |
| 11268 | return err; |
| 11269 | err = alc861vd_auto_create_extra_out(spec, |
| 11270 | spec->autocfg.hp_pins[0], |
| 11271 | "Headphone"); |
| 11272 | if (err < 0) |
| 11273 | return err; |
| 11274 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11275 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11276 | return err; |
| 11277 | |
| 11278 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11279 | |
| 11280 | if (spec->autocfg.dig_out_pin) |
| 11281 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 11282 | |
| 11283 | if (spec->kctl_alloc) |
| 11284 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11285 | |
| 11286 | spec->init_verbs[spec->num_init_verbs++] |
| 11287 | = alc861vd_volume_init_verbs; |
| 11288 | |
| 11289 | spec->num_mux_defs = 1; |
| 11290 | spec->input_mux = &spec->private_imux; |
| 11291 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11292 | err = alc_auto_add_mic_boost(codec); |
| 11293 | if (err < 0) |
| 11294 | return err; |
| 11295 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11296 | return 1; |
| 11297 | } |
| 11298 | |
| 11299 | /* additional initialization for auto-configuration model */ |
| 11300 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 11301 | { |
| 11302 | alc861vd_auto_init_multi_out(codec); |
| 11303 | alc861vd_auto_init_hp_out(codec); |
| 11304 | alc861vd_auto_init_analog_input(codec); |
| 11305 | } |
| 11306 | |
| 11307 | static int patch_alc861vd(struct hda_codec *codec) |
| 11308 | { |
| 11309 | struct alc_spec *spec; |
| 11310 | int err, board_config; |
| 11311 | |
| 11312 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11313 | if (spec == NULL) |
| 11314 | return -ENOMEM; |
| 11315 | |
| 11316 | codec->spec = spec; |
| 11317 | |
| 11318 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 11319 | alc861vd_models, |
| 11320 | alc861vd_cfg_tbl); |
| 11321 | |
| 11322 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 11323 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 11324 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 11325 | board_config = ALC861VD_AUTO; |
| 11326 | } |
| 11327 | |
| 11328 | if (board_config == ALC861VD_AUTO) { |
| 11329 | /* automatic parse from the BIOS config */ |
| 11330 | err = alc861vd_parse_auto_config(codec); |
| 11331 | if (err < 0) { |
| 11332 | alc_free(codec); |
| 11333 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11334 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11335 | printk(KERN_INFO |
| 11336 | "hda_codec: Cannot set up configuration " |
| 11337 | "from BIOS. Using base mode...\n"); |
| 11338 | board_config = ALC861VD_3ST; |
| 11339 | } |
| 11340 | } |
| 11341 | |
| 11342 | if (board_config != ALC861VD_AUTO) |
| 11343 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 11344 | |
| 11345 | spec->stream_name_analog = "ALC861VD Analog"; |
| 11346 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 11347 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 11348 | |
| 11349 | spec->stream_name_digital = "ALC861VD Digital"; |
| 11350 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 11351 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 11352 | |
| 11353 | spec->adc_nids = alc861vd_adc_nids; |
| 11354 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 11355 | |
| 11356 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 11357 | spec->num_mixers++; |
| 11358 | |
| 11359 | codec->patch_ops = alc_patch_ops; |
| 11360 | |
| 11361 | if (board_config == ALC861VD_AUTO) |
| 11362 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11363 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11364 | if (!spec->loopback.amplist) |
| 11365 | spec->loopback.amplist = alc861vd_loopbacks; |
| 11366 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11367 | |
| 11368 | return 0; |
| 11369 | } |
| 11370 | |
| 11371 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11372 | * ALC662 support |
| 11373 | * |
| 11374 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 11375 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 11376 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 11377 | * 6-channel independent captures. |
| 11378 | * |
| 11379 | * In addition, an independent DAC for the multi-playback (not used in this |
| 11380 | * driver yet). |
| 11381 | */ |
| 11382 | #define ALC662_DIGOUT_NID 0x06 |
| 11383 | #define ALC662_DIGIN_NID 0x0a |
| 11384 | |
| 11385 | static hda_nid_t alc662_dac_nids[4] = { |
| 11386 | /* front, rear, clfe, rear_surr */ |
| 11387 | 0x02, 0x03, 0x04 |
| 11388 | }; |
| 11389 | |
| 11390 | static hda_nid_t alc662_adc_nids[1] = { |
| 11391 | /* ADC1-2 */ |
| 11392 | 0x09, |
| 11393 | }; |
| 11394 | /* input MUX */ |
| 11395 | /* FIXME: should be a matrix-type input source selection */ |
| 11396 | |
| 11397 | static struct hda_input_mux alc662_capture_source = { |
| 11398 | .num_items = 4, |
| 11399 | .items = { |
| 11400 | { "Mic", 0x0 }, |
| 11401 | { "Front Mic", 0x1 }, |
| 11402 | { "Line", 0x2 }, |
| 11403 | { "CD", 0x4 }, |
| 11404 | }, |
| 11405 | }; |
| 11406 | |
| 11407 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 11408 | .num_items = 2, |
| 11409 | .items = { |
| 11410 | { "Mic", 0x1 }, |
| 11411 | { "Line", 0x2 }, |
| 11412 | }, |
| 11413 | }; |
| 11414 | #define alc662_mux_enum_info alc_mux_enum_info |
| 11415 | #define alc662_mux_enum_get alc_mux_enum_get |
| 11416 | |
| 11417 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11418 | struct snd_ctl_elem_value *ucontrol) |
| 11419 | { |
| 11420 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11421 | struct alc_spec *spec = codec->spec; |
| 11422 | const struct hda_input_mux *imux = spec->input_mux; |
| 11423 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11424 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11425 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 11426 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 11427 | unsigned int i, idx; |
| 11428 | |
| 11429 | idx = ucontrol->value.enumerated.item[0]; |
| 11430 | if (idx >= imux->num_items) |
| 11431 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11432 | if (*cur_val == idx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11433 | return 0; |
| 11434 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11435 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 11436 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 11437 | imux->items[i].index, |
| 11438 | HDA_AMP_MUTE, v); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11439 | } |
| 11440 | *cur_val = idx; |
| 11441 | return 1; |
| 11442 | } |
| 11443 | /* |
| 11444 | * 2ch mode |
| 11445 | */ |
| 11446 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 11447 | { 2, NULL } |
| 11448 | }; |
| 11449 | |
| 11450 | /* |
| 11451 | * 2ch mode |
| 11452 | */ |
| 11453 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 11454 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 11455 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 11456 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 11457 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 11458 | { } /* end */ |
| 11459 | }; |
| 11460 | |
| 11461 | /* |
| 11462 | * 6ch mode |
| 11463 | */ |
| 11464 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 11465 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11466 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11467 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 11468 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11469 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11470 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11471 | { } /* end */ |
| 11472 | }; |
| 11473 | |
| 11474 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 11475 | { 2, alc662_3ST_ch2_init }, |
| 11476 | { 6, alc662_3ST_ch6_init }, |
| 11477 | }; |
| 11478 | |
| 11479 | /* |
| 11480 | * 2ch mode |
| 11481 | */ |
| 11482 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 11483 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11484 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11485 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11486 | { } /* end */ |
| 11487 | }; |
| 11488 | |
| 11489 | /* |
| 11490 | * 6ch mode |
| 11491 | */ |
| 11492 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 11493 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11494 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11495 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11496 | { } /* end */ |
| 11497 | }; |
| 11498 | |
| 11499 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 11500 | { 2, alc662_sixstack_ch6_init }, |
| 11501 | { 6, alc662_sixstack_ch8_init }, |
| 11502 | }; |
| 11503 | |
| 11504 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 11505 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 11506 | */ |
| 11507 | |
| 11508 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 11509 | /* output mixer control */ |
| 11510 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11511 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 11512 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11513 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11514 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 11515 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 11516 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 11517 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 11518 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11519 | |
| 11520 | /*Input mixer control */ |
| 11521 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 11522 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 11523 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 11524 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 11525 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 11526 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 11527 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 11528 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
| 11529 | |
| 11530 | /* Capture mixer control */ |
| 11531 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11532 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11533 | { |
| 11534 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11535 | .name = "Capture Source", |
| 11536 | .count = 1, |
| 11537 | .info = alc_mux_enum_info, |
| 11538 | .get = alc_mux_enum_get, |
| 11539 | .put = alc_mux_enum_put, |
| 11540 | }, |
| 11541 | { } /* end */ |
| 11542 | }; |
| 11543 | |
| 11544 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 11545 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11546 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 11547 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11548 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11549 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11550 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11551 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11552 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11553 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11554 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11555 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11556 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11557 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11558 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11559 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11560 | { |
| 11561 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11562 | /* .name = "Capture Source", */ |
| 11563 | .name = "Input Source", |
| 11564 | .count = 1, |
| 11565 | .info = alc662_mux_enum_info, |
| 11566 | .get = alc662_mux_enum_get, |
| 11567 | .put = alc662_mux_enum_put, |
| 11568 | }, |
| 11569 | { } /* end */ |
| 11570 | }; |
| 11571 | |
| 11572 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 11573 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11574 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 11575 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11576 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 11577 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 11578 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 11579 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 11580 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 11581 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11582 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11583 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11584 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11585 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11586 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11587 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11588 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11589 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11590 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11591 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11592 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11593 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11594 | { |
| 11595 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11596 | /* .name = "Capture Source", */ |
| 11597 | .name = "Input Source", |
| 11598 | .count = 1, |
| 11599 | .info = alc662_mux_enum_info, |
| 11600 | .get = alc662_mux_enum_get, |
| 11601 | .put = alc662_mux_enum_put, |
| 11602 | }, |
| 11603 | { } /* end */ |
| 11604 | }; |
| 11605 | |
| 11606 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 11607 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11608 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 11609 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11610 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT), |
| 11611 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11612 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11613 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11616 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11617 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11618 | { |
| 11619 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11620 | /* .name = "Capture Source", */ |
| 11621 | .name = "Input Source", |
| 11622 | .count = 1, |
| 11623 | .info = alc662_mux_enum_info, |
| 11624 | .get = alc662_mux_enum_get, |
| 11625 | .put = alc662_mux_enum_put, |
| 11626 | }, |
| 11627 | { } /* end */ |
| 11628 | }; |
| 11629 | |
| 11630 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 11631 | { |
| 11632 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11633 | .name = "Channel Mode", |
| 11634 | .info = alc_ch_mode_info, |
| 11635 | .get = alc_ch_mode_get, |
| 11636 | .put = alc_ch_mode_put, |
| 11637 | }, |
| 11638 | { } /* end */ |
| 11639 | }; |
| 11640 | |
| 11641 | static struct hda_verb alc662_init_verbs[] = { |
| 11642 | /* ADC: mute amp left and right */ |
| 11643 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11644 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11645 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 11646 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11647 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11648 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11649 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11650 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11651 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11652 | |
| 11653 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11654 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11655 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11656 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11657 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11658 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11659 | |
| 11660 | /* Front Pin: output 0 (0x0c) */ |
| 11661 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11662 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11663 | |
| 11664 | /* Rear Pin: output 1 (0x0d) */ |
| 11665 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11666 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11667 | |
| 11668 | /* CLFE Pin: output 2 (0x0e) */ |
| 11669 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11670 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11671 | |
| 11672 | /* Mic (rear) pin: input vref at 80% */ |
| 11673 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11674 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11675 | /* Front Mic pin: input vref at 80% */ |
| 11676 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11677 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11678 | /* Line In pin: input */ |
| 11679 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11680 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11681 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11682 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11683 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11684 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11685 | /* CD pin widget for input */ |
| 11686 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11687 | |
| 11688 | /* FIXME: use matrix-type input source selection */ |
| 11689 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11690 | /* Input mixer */ |
| 11691 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11692 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11693 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11694 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 11695 | { } |
| 11696 | }; |
| 11697 | |
| 11698 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 11699 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 11700 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 11701 | {} |
| 11702 | }; |
| 11703 | |
| 11704 | /* |
| 11705 | * generic initialization of ADC, input mixers and output mixers |
| 11706 | */ |
| 11707 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 11708 | /* |
| 11709 | * Unmute ADC and set the default input to mic-in |
| 11710 | */ |
| 11711 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11712 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11713 | |
| 11714 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 11715 | * mixer widget |
| 11716 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11717 | * panel mic (mic 2) |
| 11718 | */ |
| 11719 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11720 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11721 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11725 | |
| 11726 | /* |
| 11727 | * Set up output mixers (0x0c - 0x0f) |
| 11728 | */ |
| 11729 | /* set vol=0 to output mixers */ |
| 11730 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11731 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11732 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11733 | |
| 11734 | /* set up input amps for analog loopback */ |
| 11735 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11736 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11737 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11738 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11739 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11740 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11741 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11742 | |
| 11743 | |
| 11744 | /* FIXME: use matrix-type input source selection */ |
| 11745 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11746 | /* Input mixer */ |
| 11747 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11748 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11749 | { } |
| 11750 | }; |
| 11751 | |
| 11752 | /* capture mixer elements */ |
| 11753 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 11754 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11755 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11756 | { |
| 11757 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11758 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11759 | * So call somewhat different.. |
| 11760 | * FIXME: the controls appear in the "playback" view! |
| 11761 | */ |
| 11762 | /* .name = "Capture Source", */ |
| 11763 | .name = "Input Source", |
| 11764 | .count = 1, |
| 11765 | .info = alc882_mux_enum_info, |
| 11766 | .get = alc882_mux_enum_get, |
| 11767 | .put = alc882_mux_enum_put, |
| 11768 | }, |
| 11769 | { } /* end */ |
| 11770 | }; |
| 11771 | |
| 11772 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 11773 | { |
| 11774 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11775 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11776 | |
| 11777 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11778 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11779 | bits = present ? HDA_AMP_MUTE : 0; |
| 11780 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11781 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11782 | } |
| 11783 | |
| 11784 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 11785 | { |
| 11786 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11787 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11788 | |
| 11789 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 11790 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11791 | bits = present ? HDA_AMP_MUTE : 0; |
| 11792 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11793 | HDA_AMP_MUTE, bits); |
| 11794 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11795 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11796 | } |
| 11797 | |
| 11798 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 11799 | unsigned int res) |
| 11800 | { |
| 11801 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11802 | alc662_lenovo_101e_all_automute(codec); |
| 11803 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 11804 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 11805 | } |
| 11806 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11807 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11808 | #define alc662_loopbacks alc880_loopbacks |
| 11809 | #endif |
| 11810 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11811 | |
| 11812 | /* pcm configuration: identiacal with ALC880 */ |
| 11813 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 11814 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 11815 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 11816 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 11817 | |
| 11818 | /* |
| 11819 | * configuration and preset |
| 11820 | */ |
| 11821 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 11822 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 11823 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 11824 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 11825 | [ALC662_5ST_DIG] = "6stack-dig", |
| 11826 | [ALC662_LENOVO_101E] = "lenovo-101e", |
| 11827 | [ALC662_AUTO] = "auto", |
| 11828 | }; |
| 11829 | |
| 11830 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
| 11831 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
| 11832 | {} |
| 11833 | }; |
| 11834 | |
| 11835 | static struct alc_config_preset alc662_presets[] = { |
| 11836 | [ALC662_3ST_2ch_DIG] = { |
| 11837 | .mixers = { alc662_3ST_2ch_mixer }, |
| 11838 | .init_verbs = { alc662_init_verbs }, |
| 11839 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11840 | .dac_nids = alc662_dac_nids, |
| 11841 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11842 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11843 | .adc_nids = alc662_adc_nids, |
| 11844 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11845 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 11846 | .channel_mode = alc662_3ST_2ch_modes, |
| 11847 | .input_mux = &alc662_capture_source, |
| 11848 | }, |
| 11849 | [ALC662_3ST_6ch_DIG] = { |
| 11850 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 11851 | .init_verbs = { alc662_init_verbs }, |
| 11852 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11853 | .dac_nids = alc662_dac_nids, |
| 11854 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11855 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11856 | .adc_nids = alc662_adc_nids, |
| 11857 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11858 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 11859 | .channel_mode = alc662_3ST_6ch_modes, |
| 11860 | .need_dac_fix = 1, |
| 11861 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11862 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11863 | [ALC662_3ST_6ch] = { |
| 11864 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 11865 | .init_verbs = { alc662_init_verbs }, |
| 11866 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11867 | .dac_nids = alc662_dac_nids, |
| 11868 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11869 | .adc_nids = alc662_adc_nids, |
| 11870 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 11871 | .channel_mode = alc662_3ST_6ch_modes, |
| 11872 | .need_dac_fix = 1, |
| 11873 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11874 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11875 | [ALC662_5ST_DIG] = { |
| 11876 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
| 11877 | .init_verbs = { alc662_init_verbs }, |
| 11878 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11879 | .dac_nids = alc662_dac_nids, |
| 11880 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 11881 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11882 | .adc_nids = alc662_adc_nids, |
| 11883 | .dig_in_nid = ALC662_DIGIN_NID, |
| 11884 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 11885 | .channel_mode = alc662_5stack_modes, |
| 11886 | .input_mux = &alc662_capture_source, |
| 11887 | }, |
| 11888 | [ALC662_LENOVO_101E] = { |
| 11889 | .mixers = { alc662_lenovo_101e_mixer }, |
| 11890 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 11891 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 11892 | .dac_nids = alc662_dac_nids, |
| 11893 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 11894 | .adc_nids = alc662_adc_nids, |
| 11895 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 11896 | .channel_mode = alc662_3ST_2ch_modes, |
| 11897 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 11898 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 11899 | .init_hook = alc662_lenovo_101e_all_automute, |
| 11900 | }, |
| 11901 | |
| 11902 | }; |
| 11903 | |
| 11904 | |
| 11905 | /* |
| 11906 | * BIOS auto configuration |
| 11907 | */ |
| 11908 | |
| 11909 | /* add playback controls from the parsed DAC table */ |
| 11910 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11911 | const struct auto_pin_cfg *cfg) |
| 11912 | { |
| 11913 | char name[32]; |
| 11914 | static const char *chname[4] = { |
| 11915 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11916 | }; |
| 11917 | hda_nid_t nid; |
| 11918 | int i, err; |
| 11919 | |
| 11920 | for (i = 0; i < cfg->line_outs; i++) { |
| 11921 | if (!spec->multiout.dac_nids[i]) |
| 11922 | continue; |
Kailang Yang | 067b5a8 | 2007-07-05 12:35:15 +0200 | [diff] [blame] | 11923 | nid = alc880_idx_to_mixer(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11924 | if (i == 2) { |
| 11925 | /* Center/LFE */ |
| 11926 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11927 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11928 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11929 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11930 | if (err < 0) |
| 11931 | return err; |
| 11932 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11933 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11934 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11935 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11936 | if (err < 0) |
| 11937 | return err; |
| 11938 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11939 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11940 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 11941 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11942 | if (err < 0) |
| 11943 | return err; |
| 11944 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11945 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11946 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 11947 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11948 | if (err < 0) |
| 11949 | return err; |
| 11950 | } else { |
| 11951 | sprintf(name, "%s Playback Volume", chname[i]); |
| 11952 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11953 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11954 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11955 | if (err < 0) |
| 11956 | return err; |
| 11957 | sprintf(name, "%s Playback Switch", chname[i]); |
| 11958 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11959 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 11960 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11961 | if (err < 0) |
| 11962 | return err; |
| 11963 | } |
| 11964 | } |
| 11965 | return 0; |
| 11966 | } |
| 11967 | |
| 11968 | /* add playback controls for speaker and HP outputs */ |
| 11969 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 11970 | const char *pfx) |
| 11971 | { |
| 11972 | hda_nid_t nid; |
| 11973 | int err; |
| 11974 | char name[32]; |
| 11975 | |
| 11976 | if (!pin) |
| 11977 | return 0; |
| 11978 | |
| 11979 | if (alc880_is_fixed_pin(pin)) { |
| 11980 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11981 | /* printk("DAC nid=%x\n",nid); */ |
| 11982 | /* specify the DAC as the extra output */ |
| 11983 | if (!spec->multiout.hp_nid) |
| 11984 | spec->multiout.hp_nid = nid; |
| 11985 | else |
| 11986 | spec->multiout.extra_out_nid[0] = nid; |
| 11987 | /* control HP volume/switch on the output mixer amp */ |
| 11988 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11989 | sprintf(name, "%s Playback Volume", pfx); |
| 11990 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11991 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11992 | if (err < 0) |
| 11993 | return err; |
| 11994 | sprintf(name, "%s Playback Switch", pfx); |
| 11995 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11996 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 11997 | if (err < 0) |
| 11998 | return err; |
| 11999 | } else if (alc880_is_multi_pin(pin)) { |
| 12000 | /* set manual connection */ |
| 12001 | /* we have only a switch on HP-out PIN */ |
| 12002 | sprintf(name, "%s Playback Switch", pfx); |
| 12003 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12004 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12005 | if (err < 0) |
| 12006 | return err; |
| 12007 | } |
| 12008 | return 0; |
| 12009 | } |
| 12010 | |
| 12011 | /* create playback/capture controls for input pins */ |
| 12012 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12013 | const struct auto_pin_cfg *cfg) |
| 12014 | { |
| 12015 | struct hda_input_mux *imux = &spec->private_imux; |
| 12016 | int i, err, idx; |
| 12017 | |
| 12018 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12019 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 12020 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 12021 | err = new_analog_input(spec, cfg->input_pins[i], |
| 12022 | auto_pin_cfg_labels[i], |
| 12023 | idx, 0x0b); |
| 12024 | if (err < 0) |
| 12025 | return err; |
| 12026 | imux->items[imux->num_items].label = |
| 12027 | auto_pin_cfg_labels[i]; |
| 12028 | imux->items[imux->num_items].index = |
| 12029 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 12030 | imux->num_items++; |
| 12031 | } |
| 12032 | } |
| 12033 | return 0; |
| 12034 | } |
| 12035 | |
| 12036 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12037 | hda_nid_t nid, int pin_type, |
| 12038 | int dac_idx) |
| 12039 | { |
| 12040 | /* set as output */ |
| 12041 | snd_hda_codec_write(codec, nid, 0, |
| 12042 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 12043 | snd_hda_codec_write(codec, nid, 0, |
| 12044 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 12045 | /* need the manual connection? */ |
| 12046 | if (alc880_is_multi_pin(nid)) { |
| 12047 | struct alc_spec *spec = codec->spec; |
| 12048 | int idx = alc880_multi_pin_idx(nid); |
| 12049 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 12050 | AC_VERB_SET_CONNECT_SEL, |
| 12051 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 12052 | } |
| 12053 | } |
| 12054 | |
| 12055 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 12056 | { |
| 12057 | struct alc_spec *spec = codec->spec; |
| 12058 | int i; |
| 12059 | |
| 12060 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12061 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12062 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12063 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12064 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12065 | i); |
| 12066 | } |
| 12067 | } |
| 12068 | |
| 12069 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 12070 | { |
| 12071 | struct alc_spec *spec = codec->spec; |
| 12072 | hda_nid_t pin; |
| 12073 | |
| 12074 | pin = spec->autocfg.hp_pins[0]; |
| 12075 | if (pin) /* connect to front */ |
| 12076 | /* use dac 0 */ |
| 12077 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 12078 | } |
| 12079 | |
| 12080 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12081 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 12082 | |
| 12083 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 12084 | { |
| 12085 | struct alc_spec *spec = codec->spec; |
| 12086 | int i; |
| 12087 | |
| 12088 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12089 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12090 | if (alc662_is_input_pin(nid)) { |
| 12091 | snd_hda_codec_write(codec, nid, 0, |
| 12092 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12093 | (i <= AUTO_PIN_FRONT_MIC ? |
| 12094 | PIN_VREF80 : PIN_IN)); |
| 12095 | if (nid != ALC662_PIN_CD_NID) |
| 12096 | snd_hda_codec_write(codec, nid, 0, |
| 12097 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12098 | AMP_OUT_MUTE); |
| 12099 | } |
| 12100 | } |
| 12101 | } |
| 12102 | |
| 12103 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 12104 | { |
| 12105 | struct alc_spec *spec = codec->spec; |
| 12106 | int err; |
| 12107 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 12108 | |
| 12109 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12110 | alc662_ignore); |
| 12111 | if (err < 0) |
| 12112 | return err; |
| 12113 | if (!spec->autocfg.line_outs) |
| 12114 | return 0; /* can't find valid BIOS pin config */ |
| 12115 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12116 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12117 | if (err < 0) |
| 12118 | return err; |
| 12119 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12120 | if (err < 0) |
| 12121 | return err; |
| 12122 | err = alc662_auto_create_extra_out(spec, |
| 12123 | spec->autocfg.speaker_pins[0], |
| 12124 | "Speaker"); |
| 12125 | if (err < 0) |
| 12126 | return err; |
| 12127 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 12128 | "Headphone"); |
| 12129 | if (err < 0) |
| 12130 | return err; |
| 12131 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12132 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12133 | return err; |
| 12134 | |
| 12135 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12136 | |
| 12137 | if (spec->autocfg.dig_out_pin) |
| 12138 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 12139 | |
| 12140 | if (spec->kctl_alloc) |
| 12141 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12142 | |
| 12143 | spec->num_mux_defs = 1; |
| 12144 | spec->input_mux = &spec->private_imux; |
| 12145 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 12146 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12147 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 12148 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 12149 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12150 | } |
| 12151 | |
| 12152 | /* additional initialization for auto-configuration model */ |
| 12153 | static void alc662_auto_init(struct hda_codec *codec) |
| 12154 | { |
| 12155 | alc662_auto_init_multi_out(codec); |
| 12156 | alc662_auto_init_hp_out(codec); |
| 12157 | alc662_auto_init_analog_input(codec); |
| 12158 | } |
| 12159 | |
| 12160 | static int patch_alc662(struct hda_codec *codec) |
| 12161 | { |
| 12162 | struct alc_spec *spec; |
| 12163 | int err, board_config; |
| 12164 | |
| 12165 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12166 | if (!spec) |
| 12167 | return -ENOMEM; |
| 12168 | |
| 12169 | codec->spec = spec; |
| 12170 | |
| 12171 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 12172 | alc662_models, |
| 12173 | alc662_cfg_tbl); |
| 12174 | if (board_config < 0) { |
| 12175 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 12176 | "trying auto-probe from BIOS...\n"); |
| 12177 | board_config = ALC662_AUTO; |
| 12178 | } |
| 12179 | |
| 12180 | if (board_config == ALC662_AUTO) { |
| 12181 | /* automatic parse from the BIOS config */ |
| 12182 | err = alc662_parse_auto_config(codec); |
| 12183 | if (err < 0) { |
| 12184 | alc_free(codec); |
| 12185 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 12186 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12187 | printk(KERN_INFO |
| 12188 | "hda_codec: Cannot set up configuration " |
| 12189 | "from BIOS. Using base mode...\n"); |
| 12190 | board_config = ALC662_3ST_2ch_DIG; |
| 12191 | } |
| 12192 | } |
| 12193 | |
| 12194 | if (board_config != ALC662_AUTO) |
| 12195 | setup_preset(spec, &alc662_presets[board_config]); |
| 12196 | |
| 12197 | spec->stream_name_analog = "ALC662 Analog"; |
| 12198 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 12199 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 12200 | |
| 12201 | spec->stream_name_digital = "ALC662 Digital"; |
| 12202 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 12203 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 12204 | |
| 12205 | if (!spec->adc_nids && spec->input_mux) { |
| 12206 | spec->adc_nids = alc662_adc_nids; |
| 12207 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 12208 | } |
| 12209 | |
| 12210 | codec->patch_ops = alc_patch_ops; |
| 12211 | if (board_config == ALC662_AUTO) |
| 12212 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12213 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12214 | if (!spec->loopback.amplist) |
| 12215 | spec->loopback.amplist = alc662_loopbacks; |
| 12216 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12217 | |
| 12218 | return 0; |
| 12219 | } |
| 12220 | |
| 12221 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12222 | * patch entries |
| 12223 | */ |
| 12224 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 12225 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12226 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12227 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12228 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12229 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12230 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 12231 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 12232 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12233 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 12234 | .patch = patch_alc883 }, |
| 12235 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 12236 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12237 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12238 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12239 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12240 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12241 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12242 | {} /* terminator */ |
| 12243 | }; |