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 | 7cf51e4 | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
| 33 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 34 | #define ALC880_FRONT_EVENT 0x01 |
| 35 | #define ALC880_DCVOL_EVENT 0x02 |
| 36 | #define ALC880_HP_EVENT 0x04 |
| 37 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | /* ALC880 board config type */ |
| 40 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | ALC880_3ST, |
| 42 | ALC880_3ST_DIG, |
| 43 | ALC880_5ST, |
| 44 | ALC880_5ST_DIG, |
| 45 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 46 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 47 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 48 | ALC880_6ST_DIG, |
| 49 | ALC880_F1734, |
| 50 | ALC880_ASUS, |
| 51 | ALC880_ASUS_DIG, |
| 52 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 53 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 54 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 55 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL, |
| 57 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 58 | ALC880_CLEVO, |
| 59 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 60 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 61 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 62 | #ifdef CONFIG_SND_DEBUG |
| 63 | ALC880_TEST, |
| 64 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 65 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 66 | ALC880_MODEL_LAST /* last tag */ |
| 67 | }; |
| 68 | |
| 69 | /* ALC260 models */ |
| 70 | enum { |
| 71 | ALC260_BASIC, |
| 72 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 73 | ALC260_HP_3013, |
| 74 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 75 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 76 | ALC260_WILL, |
| 77 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 78 | #ifdef CONFIG_SND_DEBUG |
| 79 | ALC260_TEST, |
| 80 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 81 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 82 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | }; |
| 84 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | /* ALC262 models */ |
| 86 | enum { |
| 87 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 88 | ALC262_HIPPO, |
| 89 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 90 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 91 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 92 | ALC262_HP_BPC_D7000_WL, |
| 93 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 94 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 95 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 96 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 97 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 98 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 99 | ALC262_ULTRA, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 100 | ALC262_AUTO, |
| 101 | ALC262_MODEL_LAST /* last tag */ |
| 102 | }; |
| 103 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 104 | /* ALC268 models */ |
| 105 | enum { |
| 106 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 107 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 108 | ALC268_ACER, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 109 | #ifdef CONFIG_SND_DEBUG |
| 110 | ALC268_TEST, |
| 111 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 112 | ALC268_AUTO, |
| 113 | ALC268_MODEL_LAST /* last tag */ |
| 114 | }; |
| 115 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 116 | /* ALC269 models */ |
| 117 | enum { |
| 118 | ALC269_BASIC, |
| 119 | ALC269_AUTO, |
| 120 | ALC269_MODEL_LAST /* last tag */ |
| 121 | }; |
| 122 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 123 | /* ALC861 models */ |
| 124 | enum { |
| 125 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 126 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 127 | ALC861_3ST_DIG, |
| 128 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 129 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 130 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 131 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 132 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 133 | ALC861_AUTO, |
| 134 | ALC861_MODEL_LAST, |
| 135 | }; |
| 136 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 137 | /* ALC861-VD models */ |
| 138 | enum { |
| 139 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 140 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 141 | ALC861VD_3ST, |
| 142 | ALC861VD_3ST_DIG, |
| 143 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 144 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 145 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 146 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 147 | ALC861VD_AUTO, |
| 148 | ALC861VD_MODEL_LAST, |
| 149 | }; |
| 150 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 151 | /* ALC662 models */ |
| 152 | enum { |
| 153 | ALC662_3ST_2ch_DIG, |
| 154 | ALC662_3ST_6ch_DIG, |
| 155 | ALC662_3ST_6ch, |
| 156 | ALC662_5ST_DIG, |
| 157 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 158 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 159 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 160 | ALC662_AUTO, |
| 161 | ALC662_MODEL_LAST, |
| 162 | }; |
| 163 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 164 | /* ALC882 models */ |
| 165 | enum { |
| 166 | ALC882_3ST_DIG, |
| 167 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 168 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 169 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 170 | ALC882_TARGA, |
| 171 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 172 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 173 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 174 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 175 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 176 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 177 | ALC882_MODEL_LAST, |
| 178 | }; |
| 179 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 180 | /* ALC883 models */ |
| 181 | enum { |
| 182 | ALC883_3ST_2ch_DIG, |
| 183 | ALC883_3ST_6ch_DIG, |
| 184 | ALC883_3ST_6ch, |
| 185 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 186 | ALC883_TARGA_DIG, |
| 187 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 188 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 189 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 190 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 191 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 192 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 193 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 194 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 195 | ALC888_LENOVO_MS7195_DIG, |
| 196 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 197 | ALC888_6ST_HP, |
| 198 | ALC888_3ST_HP, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 199 | ALC883_MITAC, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 200 | ALC883_AUTO, |
| 201 | ALC883_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* for GPIO Poll */ |
| 205 | #define GPIO_MASK 0x03 |
| 206 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | struct alc_spec { |
| 208 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 209 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | unsigned int num_mixers; |
| 211 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 213 | * don't forget NULL |
| 214 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 215 | */ |
| 216 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 218 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | struct hda_pcm_stream *stream_analog_playback; |
| 220 | struct hda_pcm_stream *stream_analog_capture; |
| 221 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 222 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | struct hda_pcm_stream *stream_digital_playback; |
| 224 | struct hda_pcm_stream *stream_digital_capture; |
| 225 | |
| 226 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 227 | struct hda_multi_out multiout; /* playback set-up |
| 228 | * max_channels, dacs must be set |
| 229 | * dig_out_nid and hp_nid are optional |
| 230 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | |
| 232 | /* capture */ |
| 233 | unsigned int num_adc_nids; |
| 234 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 235 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
| 237 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 238 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | const struct hda_input_mux *input_mux; |
| 240 | unsigned int cur_mux[3]; |
| 241 | |
| 242 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 243 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 245 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | |
| 247 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 248 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 249 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 250 | /* dynamic controls, init_verbs and input_mux */ |
| 251 | struct auto_pin_cfg autocfg; |
| 252 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 253 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 254 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 255 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 256 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 257 | /* hooks */ |
| 258 | void (*init_hook)(struct hda_codec *codec); |
| 259 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 260 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 261 | /* for pin sensing */ |
| 262 | unsigned int sense_updated: 1; |
| 263 | unsigned int jack_present: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 264 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 265 | /* for virtual master */ |
| 266 | hda_nid_t vmaster_nid; |
| 267 | u32 vmaster_tlv[4]; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 268 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 269 | struct hda_loopback_check loopback; |
| 270 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 271 | }; |
| 272 | |
| 273 | /* |
| 274 | * configuration template - to be copied to the spec instance |
| 275 | */ |
| 276 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 277 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 278 | * with spec |
| 279 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 280 | const struct hda_verb *init_verbs[5]; |
| 281 | unsigned int num_dacs; |
| 282 | hda_nid_t *dac_nids; |
| 283 | hda_nid_t dig_out_nid; /* optional */ |
| 284 | hda_nid_t hp_nid; /* optional */ |
| 285 | unsigned int num_adc_nids; |
| 286 | hda_nid_t *adc_nids; |
| 287 | hda_nid_t dig_in_nid; |
| 288 | unsigned int num_channel_mode; |
| 289 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 290 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 291 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 292 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 293 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 294 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 295 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 296 | struct hda_amp_list *loopbacks; |
| 297 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | }; |
| 299 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | |
| 301 | /* |
| 302 | * input MUX handling |
| 303 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 304 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 305 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | { |
| 307 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 308 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 309 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 310 | if (mux_idx >= spec->num_mux_defs) |
| 311 | mux_idx = 0; |
| 312 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | } |
| 314 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 315 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 316 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | { |
| 318 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 319 | struct alc_spec *spec = codec->spec; |
| 320 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 321 | |
| 322 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 323 | return 0; |
| 324 | } |
| 325 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 326 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 327 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | { |
| 329 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 330 | struct alc_spec *spec = codec->spec; |
| 331 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 332 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 333 | 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] | 334 | spec->adc_nids[adc_idx], |
| 335 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | } |
| 337 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 338 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | /* |
| 340 | * channel mode setting |
| 341 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 342 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 343 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | { |
| 345 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 346 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 347 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 348 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | } |
| 350 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 351 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 352 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | { |
| 354 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 355 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 356 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 357 | spec->num_channel_mode, |
| 358 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | } |
| 360 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 361 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 362 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | { |
| 364 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 365 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 366 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 367 | spec->num_channel_mode, |
| 368 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 369 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 370 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 371 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | } |
| 373 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 375 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 376 | * instead of "%" to avoid consequences of accidently treating the % as |
| 377 | * being part of a format specifier. Maximum allowed length of a value is |
| 378 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 379 | * |
| 380 | * Note: some retasking pin complexes seem to ignore requests for input |
| 381 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 382 | * are requested. Therefore order this list so that this behaviour will not |
| 383 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 384 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 385 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 386 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 387 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 388 | "Mic 50pc bias", "Mic 80pc bias", |
| 389 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 390 | }; |
| 391 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 392 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 393 | }; |
| 394 | /* 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] | 395 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 396 | * addition, "input" pins may or may not process the mic bias option |
| 397 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 398 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 399 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 400 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 401 | #define ALC_PIN_DIR_IN 0x00 |
| 402 | #define ALC_PIN_DIR_OUT 0x01 |
| 403 | #define ALC_PIN_DIR_INOUT 0x02 |
| 404 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 405 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 406 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 407 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 408 | * For each direction the minimum and maximum values are given. |
| 409 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 410 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 411 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 412 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 413 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 414 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 415 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 416 | }; |
| 417 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 418 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 419 | #define alc_pin_mode_n_items(_dir) \ |
| 420 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 421 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 422 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 423 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 424 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 425 | unsigned int item_num = uinfo->value.enumerated.item; |
| 426 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 427 | |
| 428 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 429 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 430 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 431 | |
| 432 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 433 | item_num = alc_pin_mode_min(dir); |
| 434 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 435 | return 0; |
| 436 | } |
| 437 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 438 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 439 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 440 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 441 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 442 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 443 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 444 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 445 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 446 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 447 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 448 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 449 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 450 | /* Find enumerated value for current pinctl setting */ |
| 451 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 452 | 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] | 453 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 454 | *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] | 455 | return 0; |
| 456 | } |
| 457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 460 | { |
| 461 | signed int change; |
| 462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 463 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 464 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 465 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 467 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 468 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 469 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 470 | 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] | 471 | val = alc_pin_mode_min(dir); |
| 472 | |
| 473 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 474 | if (change) { |
| 475 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 476 | snd_hda_codec_write_cache(codec, nid, 0, |
| 477 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 478 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 479 | |
| 480 | /* Also enable the retasking pin's input/output as required |
| 481 | * for the requested pin mode. Enum values of 2 or less are |
| 482 | * input modes. |
| 483 | * |
| 484 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 485 | * reduces noise slightly (particularly on input) so we'll |
| 486 | * do it. However, having both input and output buffers |
| 487 | * enabled simultaneously doesn't seem to be problematic if |
| 488 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 489 | */ |
| 490 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 491 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 492 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 493 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 494 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 495 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 496 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 497 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 498 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 499 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 500 | } |
| 501 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 502 | return change; |
| 503 | } |
| 504 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 505 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 506 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 507 | .info = alc_pin_mode_info, \ |
| 508 | .get = alc_pin_mode_get, \ |
| 509 | .put = alc_pin_mode_put, \ |
| 510 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 511 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 512 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 513 | * together using a mask with more than one bit set. This control is |
| 514 | * currently used only by the ALC260 test model. At this stage they are not |
| 515 | * needed for any "production" models. |
| 516 | */ |
| 517 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 518 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 519 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 520 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 521 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 522 | { |
| 523 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 524 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 525 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 526 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 527 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 528 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 529 | |
| 530 | *valp = (val & mask) != 0; |
| 531 | return 0; |
| 532 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 533 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 534 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 535 | { |
| 536 | signed int change; |
| 537 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 538 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 539 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 540 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 541 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 542 | AC_VERB_GET_GPIO_DATA, |
| 543 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 544 | |
| 545 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 547 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 548 | gpio_data &= ~mask; |
| 549 | else |
| 550 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 551 | snd_hda_codec_write_cache(codec, nid, 0, |
| 552 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 553 | |
| 554 | return change; |
| 555 | } |
| 556 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 557 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 558 | .info = alc_gpio_data_info, \ |
| 559 | .get = alc_gpio_data_get, \ |
| 560 | .put = alc_gpio_data_put, \ |
| 561 | .private_value = nid | (mask<<16) } |
| 562 | #endif /* CONFIG_SND_DEBUG */ |
| 563 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 564 | /* A switch control to allow the enabling of the digital IO pins on the |
| 565 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 566 | * to provide something in the test model allowing digital outputs to be |
| 567 | * identified if present. If models are found which can utilise these |
| 568 | * outputs a more complete mixer control can be devised for those models if |
| 569 | * necessary. |
| 570 | */ |
| 571 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 572 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 573 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 574 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 575 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 576 | { |
| 577 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 578 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 579 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 580 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 581 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 582 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 583 | |
| 584 | *valp = (val & mask) != 0; |
| 585 | return 0; |
| 586 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 588 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 589 | { |
| 590 | signed int change; |
| 591 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 592 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 593 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 594 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 595 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 596 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 597 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 598 | |
| 599 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 600 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 601 | if (val==0) |
| 602 | ctrl_data &= ~mask; |
| 603 | else |
| 604 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 605 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 606 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 607 | |
| 608 | return change; |
| 609 | } |
| 610 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 611 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 612 | .info = alc_spdif_ctrl_info, \ |
| 613 | .get = alc_spdif_ctrl_get, \ |
| 614 | .put = alc_spdif_ctrl_put, \ |
| 615 | .private_value = nid | (mask<<16) } |
| 616 | #endif /* CONFIG_SND_DEBUG */ |
| 617 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 618 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 619 | * Again, this is only used in the ALC26x test models to help identify when |
| 620 | * the EAPD line must be asserted for features to work. |
| 621 | */ |
| 622 | #ifdef CONFIG_SND_DEBUG |
| 623 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 624 | |
| 625 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 626 | struct snd_ctl_elem_value *ucontrol) |
| 627 | { |
| 628 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 629 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 630 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 631 | long *valp = ucontrol->value.integer.value; |
| 632 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 633 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 634 | |
| 635 | *valp = (val & mask) != 0; |
| 636 | return 0; |
| 637 | } |
| 638 | |
| 639 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 640 | struct snd_ctl_elem_value *ucontrol) |
| 641 | { |
| 642 | int change; |
| 643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 644 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 645 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 646 | long val = *ucontrol->value.integer.value; |
| 647 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 648 | AC_VERB_GET_EAPD_BTLENABLE, |
| 649 | 0x00); |
| 650 | |
| 651 | /* Set/unset the masked control bit(s) as needed */ |
| 652 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 653 | if (!val) |
| 654 | ctrl_data &= ~mask; |
| 655 | else |
| 656 | ctrl_data |= mask; |
| 657 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 658 | ctrl_data); |
| 659 | |
| 660 | return change; |
| 661 | } |
| 662 | |
| 663 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 664 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 665 | .info = alc_eapd_ctrl_info, \ |
| 666 | .get = alc_eapd_ctrl_get, \ |
| 667 | .put = alc_eapd_ctrl_put, \ |
| 668 | .private_value = nid | (mask<<16) } |
| 669 | #endif /* CONFIG_SND_DEBUG */ |
| 670 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 671 | /* |
| 672 | * set up from the preset table |
| 673 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 674 | static void setup_preset(struct alc_spec *spec, |
| 675 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 676 | { |
| 677 | int i; |
| 678 | |
| 679 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 680 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 681 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 682 | i++) |
| 683 | spec->init_verbs[spec->num_init_verbs++] = |
| 684 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 685 | |
| 686 | spec->channel_mode = preset->channel_mode; |
| 687 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 688 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 689 | |
| 690 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 691 | |
| 692 | spec->multiout.num_dacs = preset->num_dacs; |
| 693 | spec->multiout.dac_nids = preset->dac_nids; |
| 694 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 695 | spec->multiout.hp_nid = preset->hp_nid; |
| 696 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 697 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 698 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 699 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 700 | spec->input_mux = preset->input_mux; |
| 701 | |
| 702 | spec->num_adc_nids = preset->num_adc_nids; |
| 703 | spec->adc_nids = preset->adc_nids; |
| 704 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 705 | |
| 706 | spec->unsol_event = preset->unsol_event; |
| 707 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 708 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 709 | spec->loopback.amplist = preset->loopbacks; |
| 710 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 711 | } |
| 712 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 713 | /* Enable GPIO mask and set output */ |
| 714 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 715 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 716 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 717 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 718 | { } |
| 719 | }; |
| 720 | |
| 721 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 722 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 723 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 724 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 725 | { } |
| 726 | }; |
| 727 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 728 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 729 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 730 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 731 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 732 | { } |
| 733 | }; |
| 734 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 735 | static void alc_sku_automute(struct hda_codec *codec) |
| 736 | { |
| 737 | struct alc_spec *spec = codec->spec; |
| 738 | unsigned int mute; |
| 739 | unsigned int present; |
| 740 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 741 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 742 | |
| 743 | /* need to execute and sync at first */ |
| 744 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 745 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 746 | AC_VERB_GET_PIN_SENSE, 0); |
| 747 | spec->jack_present = (present & 0x80000000) != 0; |
| 748 | if (spec->jack_present) { |
| 749 | /* mute internal speaker */ |
| 750 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 751 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 752 | } else { |
| 753 | /* unmute internal speaker if necessary */ |
| 754 | mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0); |
| 755 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 756 | HDA_AMP_MUTE, mute); |
| 757 | } |
| 758 | } |
| 759 | |
| 760 | /* unsolicited event for HP jack sensing */ |
| 761 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 762 | { |
| 763 | if (codec->vendor_id == 0x10ec0880) |
| 764 | res >>= 28; |
| 765 | else |
| 766 | res >>= 26; |
| 767 | if (res != ALC880_HP_EVENT) |
| 768 | return; |
| 769 | |
| 770 | alc_sku_automute(codec); |
| 771 | } |
| 772 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 773 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 774 | * 31 ~ 16 : Manufacture ID |
| 775 | * 15 ~ 8 : SKU ID |
| 776 | * 7 ~ 0 : Assembly ID |
| 777 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 778 | */ |
| 779 | static void alc_subsystem_id(struct hda_codec *codec, |
| 780 | unsigned int porta, unsigned int porte, |
| 781 | unsigned int portd) |
| 782 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 783 | unsigned int ass, tmp, i; |
| 784 | unsigned nid; |
| 785 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 786 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 787 | ass = codec->subsystem_id & 0xffff; |
| 788 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 789 | goto do_sku; |
| 790 | |
| 791 | /* |
| 792 | * 31~30 : port conetcivity |
| 793 | * 29~21 : reserve |
| 794 | * 20 : PCBEEP input |
| 795 | * 19~16 : Check sum (15:1) |
| 796 | * 15~1 : Custom |
| 797 | * 0 : override |
| 798 | */ |
| 799 | nid = 0x1d; |
| 800 | if (codec->vendor_id == 0x10ec0260) |
| 801 | nid = 0x17; |
| 802 | ass = snd_hda_codec_read(codec, nid, 0, |
| 803 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 804 | if (!(ass & 1) && !(ass & 0x100000)) |
| 805 | return; |
| 806 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 807 | return; |
| 808 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 809 | /* check sum */ |
| 810 | tmp = 0; |
| 811 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 812 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 813 | tmp++; |
| 814 | } |
| 815 | if (((ass >> 16) & 0xf) != tmp) |
| 816 | return; |
| 817 | do_sku: |
| 818 | /* |
| 819 | * 0 : override |
| 820 | * 1 : Swap Jack |
| 821 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 822 | * 3~5 : External Amplifier control |
| 823 | * 7~6 : Reserved |
| 824 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 825 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 826 | switch (tmp) { |
| 827 | case 1: |
| 828 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 829 | break; |
| 830 | case 3: |
| 831 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 832 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 833 | case 7: |
| 834 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 835 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 836 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 837 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 838 | case 0x10ec0260: |
| 839 | snd_hda_codec_write(codec, 0x0f, 0, |
| 840 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 841 | snd_hda_codec_write(codec, 0x10, 0, |
| 842 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 843 | break; |
| 844 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 845 | case 0x10ec0267: |
| 846 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 847 | case 0x10ec0269: |
| 848 | case 0x10ec0862: |
| 849 | case 0x10ec0662: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 850 | snd_hda_codec_write(codec, 0x14, 0, |
| 851 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 852 | snd_hda_codec_write(codec, 0x15, 0, |
| 853 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 854 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 855 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 856 | switch (codec->vendor_id) { |
| 857 | case 0x10ec0260: |
| 858 | snd_hda_codec_write(codec, 0x1a, 0, |
| 859 | AC_VERB_SET_COEF_INDEX, 7); |
| 860 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 861 | AC_VERB_GET_PROC_COEF, 0); |
| 862 | snd_hda_codec_write(codec, 0x1a, 0, |
| 863 | AC_VERB_SET_COEF_INDEX, 7); |
| 864 | snd_hda_codec_write(codec, 0x1a, 0, |
| 865 | AC_VERB_SET_PROC_COEF, |
| 866 | tmp | 0x2010); |
| 867 | break; |
| 868 | case 0x10ec0262: |
| 869 | case 0x10ec0880: |
| 870 | case 0x10ec0882: |
| 871 | case 0x10ec0883: |
| 872 | case 0x10ec0885: |
| 873 | case 0x10ec0888: |
| 874 | snd_hda_codec_write(codec, 0x20, 0, |
| 875 | AC_VERB_SET_COEF_INDEX, 7); |
| 876 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 877 | AC_VERB_GET_PROC_COEF, 0); |
| 878 | snd_hda_codec_write(codec, 0x20, 0, |
| 879 | AC_VERB_SET_COEF_INDEX, 7); |
| 880 | snd_hda_codec_write(codec, 0x20, 0, |
| 881 | AC_VERB_SET_PROC_COEF, |
| 882 | tmp | 0x2010); |
| 883 | break; |
| 884 | case 0x10ec0267: |
| 885 | case 0x10ec0268: |
| 886 | snd_hda_codec_write(codec, 0x20, 0, |
| 887 | AC_VERB_SET_COEF_INDEX, 7); |
| 888 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 889 | AC_VERB_GET_PROC_COEF, 0); |
| 890 | snd_hda_codec_write(codec, 0x20, 0, |
| 891 | AC_VERB_SET_COEF_INDEX, 7); |
| 892 | snd_hda_codec_write(codec, 0x20, 0, |
| 893 | AC_VERB_SET_PROC_COEF, |
| 894 | tmp | 0x3000); |
| 895 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 896 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 897 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 898 | break; |
| 899 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 900 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 901 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 902 | * when the external headphone out jack is plugged" |
| 903 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 904 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 905 | return; |
| 906 | /* |
| 907 | * 10~8 : Jack location |
| 908 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 909 | * 14~13: Resvered |
| 910 | * 15 : 1 --> enable the function "Mute internal speaker |
| 911 | * when the external headphone out jack is plugged" |
| 912 | */ |
| 913 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 914 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 915 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 916 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 917 | else |
| 918 | return; |
| 919 | } |
| 920 | |
| 921 | if (!spec->autocfg.hp_pins[0]) { |
| 922 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 923 | if (tmp == 0) |
| 924 | spec->autocfg.hp_pins[0] = porta; |
| 925 | else if (tmp == 1) |
| 926 | spec->autocfg.hp_pins[0] = porte; |
| 927 | else if (tmp == 2) |
| 928 | spec->autocfg.hp_pins[0] = portd; |
| 929 | else |
| 930 | return; |
| 931 | } |
| 932 | |
| 933 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 934 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 935 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 936 | spec->unsol_event = alc_sku_unsol_event; |
| 937 | spec->init_hook = alc_sku_automute; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 938 | } |
| 939 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 940 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 941 | * Fix-up pin default configurations |
| 942 | */ |
| 943 | |
| 944 | struct alc_pincfg { |
| 945 | hda_nid_t nid; |
| 946 | u32 val; |
| 947 | }; |
| 948 | |
| 949 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 950 | const struct snd_pci_quirk *quirk, |
| 951 | const struct alc_pincfg **pinfix) |
| 952 | { |
| 953 | const struct alc_pincfg *cfg; |
| 954 | |
| 955 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 956 | if (!quirk) |
| 957 | return; |
| 958 | |
| 959 | cfg = pinfix[quirk->value]; |
| 960 | for (; cfg->nid; cfg++) { |
| 961 | int i; |
| 962 | u32 val = cfg->val; |
| 963 | for (i = 0; i < 4; i++) { |
| 964 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 965 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 966 | val & 0xff); |
| 967 | val >>= 8; |
| 968 | } |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 973 | * ALC880 3-stack model |
| 974 | * |
| 975 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 976 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 977 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 978 | */ |
| 979 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 980 | static hda_nid_t alc880_dac_nids[4] = { |
| 981 | /* front, rear, clfe, rear_surr */ |
| 982 | 0x02, 0x05, 0x04, 0x03 |
| 983 | }; |
| 984 | |
| 985 | static hda_nid_t alc880_adc_nids[3] = { |
| 986 | /* ADC0-2 */ |
| 987 | 0x07, 0x08, 0x09, |
| 988 | }; |
| 989 | |
| 990 | /* The datasheet says the node 0x07 is connected from inputs, |
| 991 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 992 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 993 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 994 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 995 | /* ADC1-2 */ |
| 996 | 0x08, 0x09, |
| 997 | }; |
| 998 | |
| 999 | #define ALC880_DIGOUT_NID 0x06 |
| 1000 | #define ALC880_DIGIN_NID 0x0a |
| 1001 | |
| 1002 | static struct hda_input_mux alc880_capture_source = { |
| 1003 | .num_items = 4, |
| 1004 | .items = { |
| 1005 | { "Mic", 0x0 }, |
| 1006 | { "Front Mic", 0x3 }, |
| 1007 | { "Line", 0x2 }, |
| 1008 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1009 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1010 | }; |
| 1011 | |
| 1012 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1013 | /* 2ch mode */ |
| 1014 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1015 | /* set line-in to input, mute it */ |
| 1016 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1017 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1018 | /* set mic-in to input vref 80%, mute it */ |
| 1019 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1020 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1021 | { } /* end */ |
| 1022 | }; |
| 1023 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1024 | /* 6ch mode */ |
| 1025 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1026 | /* set line-in to output, unmute it */ |
| 1027 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1028 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1029 | /* set mic-in to output, unmute it */ |
| 1030 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1031 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1032 | { } /* end */ |
| 1033 | }; |
| 1034 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1035 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1036 | { 2, alc880_threestack_ch2_init }, |
| 1037 | { 6, alc880_threestack_ch6_init }, |
| 1038 | }; |
| 1039 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1040 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +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 | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1043 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1044 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +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), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1049 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1050 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1051 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1052 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1053 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1054 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1055 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1056 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1057 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1058 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1059 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1060 | { |
| 1061 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1062 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1063 | .info = alc_ch_mode_info, |
| 1064 | .get = alc_ch_mode_get, |
| 1065 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1066 | }, |
| 1067 | { } /* end */ |
| 1068 | }; |
| 1069 | |
| 1070 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1071 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1072 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1073 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1074 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1075 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1076 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1077 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1078 | { |
| 1079 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1080 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1081 | * So call somewhat different.. |
| 1082 | * FIXME: the controls appear in the "playback" view! |
| 1083 | */ |
| 1084 | /* .name = "Capture Source", */ |
| 1085 | .name = "Input Source", |
| 1086 | .count = 3, |
| 1087 | .info = alc_mux_enum_info, |
| 1088 | .get = alc_mux_enum_get, |
| 1089 | .put = alc_mux_enum_put, |
| 1090 | }, |
| 1091 | { } /* end */ |
| 1092 | }; |
| 1093 | |
| 1094 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1095 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1096 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1097 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1098 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1099 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1100 | { |
| 1101 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1102 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1103 | * So call somewhat different.. |
| 1104 | * FIXME: the controls appear in the "playback" view! |
| 1105 | */ |
| 1106 | /* .name = "Capture Source", */ |
| 1107 | .name = "Input Source", |
| 1108 | .count = 2, |
| 1109 | .info = alc_mux_enum_info, |
| 1110 | .get = alc_mux_enum_get, |
| 1111 | .put = alc_mux_enum_put, |
| 1112 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1113 | { } /* end */ |
| 1114 | }; |
| 1115 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1116 | |
| 1117 | |
| 1118 | /* |
| 1119 | * ALC880 5-stack model |
| 1120 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1121 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1122 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1123 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1124 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1125 | */ |
| 1126 | |
| 1127 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1128 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1129 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1130 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1131 | { } /* end */ |
| 1132 | }; |
| 1133 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1134 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1135 | /* 6ch mode */ |
| 1136 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1137 | /* set line-in to input, mute it */ |
| 1138 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1139 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1140 | { } /* end */ |
| 1141 | }; |
| 1142 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1143 | /* 8ch mode */ |
| 1144 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1145 | /* set line-in to output, unmute it */ |
| 1146 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1147 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1148 | { } /* end */ |
| 1149 | }; |
| 1150 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1151 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1152 | { 6, alc880_fivestack_ch6_init }, |
| 1153 | { 8, alc880_fivestack_ch8_init }, |
| 1154 | }; |
| 1155 | |
| 1156 | |
| 1157 | /* |
| 1158 | * ALC880 6-stack model |
| 1159 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1160 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1161 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1162 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1163 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1164 | */ |
| 1165 | |
| 1166 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1167 | /* front, rear, clfe, rear_surr */ |
| 1168 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1169 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1170 | |
| 1171 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1172 | .num_items = 4, |
| 1173 | .items = { |
| 1174 | { "Mic", 0x0 }, |
| 1175 | { "Front Mic", 0x1 }, |
| 1176 | { "Line", 0x2 }, |
| 1177 | { "CD", 0x4 }, |
| 1178 | }, |
| 1179 | }; |
| 1180 | |
| 1181 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1182 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1183 | { 8, NULL }, |
| 1184 | }; |
| 1185 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1186 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1187 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1188 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1189 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1190 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1191 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1192 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1193 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1194 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1195 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1196 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1197 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1198 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1199 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1200 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1201 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1202 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1203 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1204 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1205 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1206 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1207 | { |
| 1208 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1209 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1210 | .info = alc_ch_mode_info, |
| 1211 | .get = alc_ch_mode_get, |
| 1212 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1213 | }, |
| 1214 | { } /* end */ |
| 1215 | }; |
| 1216 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1217 | |
| 1218 | /* |
| 1219 | * ALC880 W810 model |
| 1220 | * |
| 1221 | * W810 has rear IO for: |
| 1222 | * Front (DAC 02) |
| 1223 | * Surround (DAC 03) |
| 1224 | * Center/LFE (DAC 04) |
| 1225 | * Digital out (06) |
| 1226 | * |
| 1227 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1228 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1229 | * |
| 1230 | * There is a variable resistor to control the speaker or headphone |
| 1231 | * volume. This is a hardware-only device without a software API. |
| 1232 | * |
| 1233 | * Plugging headphones in will disable the internal speakers. This is |
| 1234 | * implemented in hardware, not via the driver using jack sense. In |
| 1235 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1236 | * disable both the speakers and headphones. |
| 1237 | * |
| 1238 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1239 | * These may not do anything useful with this driver yet, because I |
| 1240 | * haven't setup any initialization verbs for these yet... |
| 1241 | */ |
| 1242 | |
| 1243 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1244 | /* front, rear/surround, clfe */ |
| 1245 | 0x02, 0x03, 0x04 |
| 1246 | }; |
| 1247 | |
| 1248 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1249 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1250 | { 6, NULL } |
| 1251 | }; |
| 1252 | |
| 1253 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1254 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1255 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1256 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1257 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1258 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1259 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1260 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1261 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1262 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1263 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1264 | { } /* end */ |
| 1265 | }; |
| 1266 | |
| 1267 | |
| 1268 | /* |
| 1269 | * Z710V model |
| 1270 | * |
| 1271 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1272 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1273 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1274 | */ |
| 1275 | |
| 1276 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1277 | 0x02 |
| 1278 | }; |
| 1279 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1280 | |
| 1281 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1282 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1283 | { 2, NULL } |
| 1284 | }; |
| 1285 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1286 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1287 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1288 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1289 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1290 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1291 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1292 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1293 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1294 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1295 | { } /* end */ |
| 1296 | }; |
| 1297 | |
| 1298 | |
| 1299 | /* FIXME! */ |
| 1300 | /* |
| 1301 | * ALC880 F1734 model |
| 1302 | * |
| 1303 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1304 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1305 | */ |
| 1306 | |
| 1307 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1308 | 0x03 |
| 1309 | }; |
| 1310 | #define ALC880_F1734_HP_DAC 0x02 |
| 1311 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1312 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1313 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1314 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1315 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1316 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1317 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1318 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1319 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1320 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1321 | { } /* end */ |
| 1322 | }; |
| 1323 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1324 | |
| 1325 | /* FIXME! */ |
| 1326 | /* |
| 1327 | * ALC880 ASUS model |
| 1328 | * |
| 1329 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1330 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1331 | * Mic = 0x18, Line = 0x1a |
| 1332 | */ |
| 1333 | |
| 1334 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1335 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1336 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1337 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1338 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1339 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1340 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1341 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1342 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1343 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1344 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1345 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1346 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1347 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1348 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1349 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1350 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1351 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1352 | { |
| 1353 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1354 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1355 | .info = alc_ch_mode_info, |
| 1356 | .get = alc_ch_mode_get, |
| 1357 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1358 | }, |
| 1359 | { } /* end */ |
| 1360 | }; |
| 1361 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1362 | /* FIXME! */ |
| 1363 | /* |
| 1364 | * ALC880 ASUS W1V model |
| 1365 | * |
| 1366 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1367 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1368 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1369 | */ |
| 1370 | |
| 1371 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1372 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1373 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1374 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1375 | { } /* end */ |
| 1376 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1377 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1378 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1379 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1380 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1381 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1382 | { } /* end */ |
| 1383 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1384 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1385 | /* TCL S700 */ |
| 1386 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1387 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1388 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1389 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1390 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1391 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1393 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1394 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1395 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1396 | { |
| 1397 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1398 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1399 | * So call somewhat different.. |
| 1400 | * FIXME: the controls appear in the "playback" view! |
| 1401 | */ |
| 1402 | /* .name = "Capture Source", */ |
| 1403 | .name = "Input Source", |
| 1404 | .count = 1, |
| 1405 | .info = alc_mux_enum_info, |
| 1406 | .get = alc_mux_enum_get, |
| 1407 | .put = alc_mux_enum_put, |
| 1408 | }, |
| 1409 | { } /* end */ |
| 1410 | }; |
| 1411 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1412 | /* Uniwill */ |
| 1413 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1414 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1415 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1416 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1417 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1418 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1419 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1420 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1421 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1422 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1423 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1424 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1425 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1426 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1427 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1428 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1429 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1430 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1431 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1432 | { |
| 1433 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1434 | .name = "Channel Mode", |
| 1435 | .info = alc_ch_mode_info, |
| 1436 | .get = alc_ch_mode_get, |
| 1437 | .put = alc_ch_mode_put, |
| 1438 | }, |
| 1439 | { } /* end */ |
| 1440 | }; |
| 1441 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1442 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1443 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1444 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1445 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1446 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1447 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1448 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1449 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1450 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1451 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1452 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1453 | { } /* end */ |
| 1454 | }; |
| 1455 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1456 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1457 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1458 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1459 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1460 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1461 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1462 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1463 | { } /* end */ |
| 1464 | }; |
| 1465 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1466 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1467 | * virtual master controls |
| 1468 | */ |
| 1469 | |
| 1470 | /* |
| 1471 | * slave controls for virtual master |
| 1472 | */ |
| 1473 | static const char *alc_slave_vols[] = { |
| 1474 | "Front Playback Volume", |
| 1475 | "Surround Playback Volume", |
| 1476 | "Center Playback Volume", |
| 1477 | "LFE Playback Volume", |
| 1478 | "Side Playback Volume", |
| 1479 | "Headphone Playback Volume", |
| 1480 | "Speaker Playback Volume", |
| 1481 | "Mono Playback Volume", |
| 1482 | "iSpeaker Playback Volume", |
| 1483 | "Line-Out Playback Volume", |
| 1484 | NULL, |
| 1485 | }; |
| 1486 | |
| 1487 | static const char *alc_slave_sws[] = { |
| 1488 | "Front Playback Switch", |
| 1489 | "Surround Playback Switch", |
| 1490 | "Center Playback Switch", |
| 1491 | "LFE Playback Switch", |
| 1492 | "Side Playback Switch", |
| 1493 | "Headphone Playback Switch", |
| 1494 | "Speaker Playback Switch", |
| 1495 | "Mono Playback Switch", |
| 1496 | "iSpeaker Playback Switch", |
| 1497 | NULL, |
| 1498 | }; |
| 1499 | |
| 1500 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1501 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1502 | */ |
| 1503 | static int alc_build_controls(struct hda_codec *codec) |
| 1504 | { |
| 1505 | struct alc_spec *spec = codec->spec; |
| 1506 | int err; |
| 1507 | int i; |
| 1508 | |
| 1509 | for (i = 0; i < spec->num_mixers; i++) { |
| 1510 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1511 | if (err < 0) |
| 1512 | return err; |
| 1513 | } |
| 1514 | |
| 1515 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1516 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1517 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1518 | if (err < 0) |
| 1519 | return err; |
| 1520 | } |
| 1521 | if (spec->dig_in_nid) { |
| 1522 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1523 | if (err < 0) |
| 1524 | return err; |
| 1525 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1526 | |
| 1527 | /* if we have no master control, let's create it */ |
| 1528 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
| 1529 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
| 1530 | HDA_OUTPUT, spec->vmaster_tlv); |
| 1531 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
| 1532 | spec->vmaster_tlv, alc_slave_vols); |
| 1533 | if (err < 0) |
| 1534 | return err; |
| 1535 | } |
| 1536 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1537 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1538 | NULL, alc_slave_sws); |
| 1539 | if (err < 0) |
| 1540 | return err; |
| 1541 | } |
| 1542 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1543 | return 0; |
| 1544 | } |
| 1545 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1546 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1547 | /* |
| 1548 | * initialize the codec volumes, etc |
| 1549 | */ |
| 1550 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1551 | /* |
| 1552 | * generic initialization of ADC, input mixers and output mixers |
| 1553 | */ |
| 1554 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1555 | /* |
| 1556 | * Unmute ADC0-2 and set the default input to mic-in |
| 1557 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1558 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1559 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1560 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1561 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1562 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1563 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1564 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1565 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1566 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1567 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1568 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1569 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1570 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1574 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1575 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1576 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1577 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1578 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1579 | /* |
| 1580 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1581 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1582 | /* set vol=0 to output mixers */ |
| 1583 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1584 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1585 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1586 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1587 | /* set up input amps for analog loopback */ |
| 1588 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1589 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1591 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1592 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1593 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1594 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1595 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1596 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1597 | |
| 1598 | { } |
| 1599 | }; |
| 1600 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1601 | /* |
| 1602 | * 3-stack pin configuration: |
| 1603 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1604 | */ |
| 1605 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1606 | /* |
| 1607 | * preset connection lists of input pins |
| 1608 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1609 | */ |
| 1610 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1611 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1612 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1613 | |
| 1614 | /* |
| 1615 | * Set pin mode and muting |
| 1616 | */ |
| 1617 | /* set front pin widgets 0x14 for output */ |
| 1618 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1619 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1620 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1621 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1622 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1623 | /* Mic2 (as headphone out) for HP output */ |
| 1624 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1625 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1626 | /* Line In pin widget for input */ |
| 1627 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1628 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1629 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1630 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1631 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1632 | /* CD pin widget for input */ |
| 1633 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1634 | |
| 1635 | { } |
| 1636 | }; |
| 1637 | |
| 1638 | /* |
| 1639 | * 5-stack pin configuration: |
| 1640 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1641 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1642 | */ |
| 1643 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1644 | /* |
| 1645 | * preset connection lists of input pins |
| 1646 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1647 | */ |
| 1648 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1649 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1650 | |
| 1651 | /* |
| 1652 | * Set pin mode and muting |
| 1653 | */ |
| 1654 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1655 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1656 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1657 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1658 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1659 | /* unmute pins for output (no gain on this amp) */ |
| 1660 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1661 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1662 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1663 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1664 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1665 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1666 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1667 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1668 | /* Mic2 (as headphone out) for HP output */ |
| 1669 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1670 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1671 | /* Line In pin widget for input */ |
| 1672 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1673 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1674 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1675 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1676 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1677 | /* CD pin widget for input */ |
| 1678 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1679 | |
| 1680 | { } |
| 1681 | }; |
| 1682 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1683 | /* |
| 1684 | * W810 pin configuration: |
| 1685 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1686 | */ |
| 1687 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1688 | /* hphone/speaker input selector: front DAC */ |
| 1689 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1690 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1691 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1692 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1693 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1694 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1695 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1696 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1697 | |
| 1698 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1699 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1700 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1701 | { } |
| 1702 | }; |
| 1703 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1704 | /* |
| 1705 | * Z71V pin configuration: |
| 1706 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1707 | */ |
| 1708 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1709 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1710 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1711 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1713 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1714 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1715 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1716 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1717 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1718 | |
| 1719 | { } |
| 1720 | }; |
| 1721 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1722 | /* |
| 1723 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1724 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1725 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1726 | */ |
| 1727 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1728 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1729 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1730 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1731 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1732 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1733 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1734 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1735 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1736 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1737 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1738 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1739 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1741 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1743 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1744 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1745 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1746 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1747 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1748 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1749 | { } |
| 1750 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1751 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1752 | /* |
| 1753 | * Uniwill pin configuration: |
| 1754 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1755 | * line = 0x1a |
| 1756 | */ |
| 1757 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1758 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1759 | |
| 1760 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1761 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1762 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1763 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1764 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1765 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1766 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1767 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1768 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1769 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1770 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1771 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1772 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1773 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1774 | |
| 1775 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1776 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1777 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1778 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1779 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1780 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1781 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1782 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1783 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1784 | |
| 1785 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1786 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1787 | |
| 1788 | { } |
| 1789 | }; |
| 1790 | |
| 1791 | /* |
| 1792 | * Uniwill P53 |
| 1793 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1794 | */ |
| 1795 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1796 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1797 | |
| 1798 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1799 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1800 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1802 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1803 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1805 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1806 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1807 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1808 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1809 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1810 | |
| 1811 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1812 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1813 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1814 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1815 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1816 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1817 | |
| 1818 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1819 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1820 | |
| 1821 | { } |
| 1822 | }; |
| 1823 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1824 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1825 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1826 | { } |
| 1827 | }; |
| 1828 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1829 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1830 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1831 | { |
| 1832 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1833 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1834 | |
| 1835 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1836 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1837 | bits = present ? HDA_AMP_MUTE : 0; |
| 1838 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1839 | HDA_AMP_MUTE, bits); |
| 1840 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1841 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1842 | } |
| 1843 | |
| 1844 | /* auto-toggle front mic */ |
| 1845 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1846 | { |
| 1847 | unsigned int present; |
| 1848 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1849 | |
| 1850 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1851 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1852 | bits = present ? HDA_AMP_MUTE : 0; |
| 1853 | 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] | 1854 | } |
| 1855 | |
| 1856 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1857 | { |
| 1858 | alc880_uniwill_hp_automute(codec); |
| 1859 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1860 | } |
| 1861 | |
| 1862 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1863 | unsigned int res) |
| 1864 | { |
| 1865 | /* Looks like the unsol event is incompatible with the standard |
| 1866 | * definition. 4bit tag is placed at 28 bit! |
| 1867 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1868 | switch (res >> 28) { |
| 1869 | case ALC880_HP_EVENT: |
| 1870 | alc880_uniwill_hp_automute(codec); |
| 1871 | break; |
| 1872 | case ALC880_MIC_EVENT: |
| 1873 | alc880_uniwill_mic_automute(codec); |
| 1874 | break; |
| 1875 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1876 | } |
| 1877 | |
| 1878 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1879 | { |
| 1880 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1881 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1882 | |
| 1883 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1884 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1885 | bits = present ? HDA_AMP_MUTE : 0; |
| 1886 | 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] | 1887 | } |
| 1888 | |
| 1889 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1890 | { |
| 1891 | unsigned int present; |
| 1892 | |
| 1893 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1894 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1895 | present &= HDA_AMP_VOLMASK; |
| 1896 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1897 | HDA_AMP_VOLMASK, present); |
| 1898 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1899 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1900 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1901 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1902 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1903 | unsigned int res) |
| 1904 | { |
| 1905 | /* Looks like the unsol event is incompatible with the standard |
| 1906 | * definition. 4bit tag is placed at 28 bit! |
| 1907 | */ |
| 1908 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1909 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1910 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1911 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1912 | } |
| 1913 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1914 | /* FIXME! */ |
| 1915 | /* |
| 1916 | * F1734 pin configuration: |
| 1917 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1918 | */ |
| 1919 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1920 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1921 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1922 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1923 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1924 | |
| 1925 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1926 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1929 | |
| 1930 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1931 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1932 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1933 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1934 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1935 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1936 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1937 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1938 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1939 | |
| 1940 | { } |
| 1941 | }; |
| 1942 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1943 | /* FIXME! */ |
| 1944 | /* |
| 1945 | * ASUS pin configuration: |
| 1946 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1947 | */ |
| 1948 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1949 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1950 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1951 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1952 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1953 | |
| 1954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1955 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1956 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1957 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1958 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1959 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1960 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1961 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1962 | |
| 1963 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1964 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1965 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1966 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1967 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1968 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1969 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1970 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1971 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1972 | |
| 1973 | { } |
| 1974 | }; |
| 1975 | |
| 1976 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1977 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1978 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1979 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1980 | /* Clevo m520g init */ |
| 1981 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1982 | /* headphone output */ |
| 1983 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1984 | /* line-out */ |
| 1985 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1986 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1987 | /* Line-in */ |
| 1988 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1989 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1990 | /* CD */ |
| 1991 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1992 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1993 | /* Mic1 (rear panel) */ |
| 1994 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1995 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1996 | /* Mic2 (front panel) */ |
| 1997 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1998 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1999 | /* headphone */ |
| 2000 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2001 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2002 | /* change to EAPD mode */ |
| 2003 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2004 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2005 | |
| 2006 | { } |
| 2007 | }; |
| 2008 | |
| 2009 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2010 | /* change to EAPD mode */ |
| 2011 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2012 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2013 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2014 | /* Headphone output */ |
| 2015 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2016 | /* Front output*/ |
| 2017 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2018 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2019 | |
| 2020 | /* Line In pin widget for input */ |
| 2021 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2022 | /* CD pin widget for input */ |
| 2023 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2024 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2025 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2026 | |
| 2027 | /* change to EAPD mode */ |
| 2028 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2029 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2030 | |
| 2031 | { } |
| 2032 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2033 | |
| 2034 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2035 | * LG m1 express dual |
| 2036 | * |
| 2037 | * Pin assignment: |
| 2038 | * Rear Line-In/Out (blue): 0x14 |
| 2039 | * Build-in Mic-In: 0x15 |
| 2040 | * Speaker-out: 0x17 |
| 2041 | * HP-Out (green): 0x1b |
| 2042 | * Mic-In/Out (red): 0x19 |
| 2043 | * SPDIF-Out: 0x1e |
| 2044 | */ |
| 2045 | |
| 2046 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2047 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2048 | 0x05, 0x02, 0x03 |
| 2049 | }; |
| 2050 | |
| 2051 | /* seems analog CD is not working */ |
| 2052 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2053 | .num_items = 3, |
| 2054 | .items = { |
| 2055 | { "Mic", 0x1 }, |
| 2056 | { "Line", 0x5 }, |
| 2057 | { "Internal Mic", 0x6 }, |
| 2058 | }, |
| 2059 | }; |
| 2060 | |
| 2061 | /* 2,4,6 channel modes */ |
| 2062 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2063 | /* set line-in and mic-in to input */ |
| 2064 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2065 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2066 | { } |
| 2067 | }; |
| 2068 | |
| 2069 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2070 | /* set line-in to out and mic-in to input */ |
| 2071 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2072 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2073 | { } |
| 2074 | }; |
| 2075 | |
| 2076 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2077 | /* set line-in and mic-in to output */ |
| 2078 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2079 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2080 | { } |
| 2081 | }; |
| 2082 | |
| 2083 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2084 | { 2, alc880_lg_ch2_init }, |
| 2085 | { 4, alc880_lg_ch4_init }, |
| 2086 | { 6, alc880_lg_ch6_init }, |
| 2087 | }; |
| 2088 | |
| 2089 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 2090 | /* FIXME: it's not really "master" but front channels */ |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2092 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2093 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2094 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2095 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2096 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2097 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2098 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2099 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2100 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2101 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2102 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2103 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2104 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2105 | { |
| 2106 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2107 | .name = "Channel Mode", |
| 2108 | .info = alc_ch_mode_info, |
| 2109 | .get = alc_ch_mode_get, |
| 2110 | .put = alc_ch_mode_put, |
| 2111 | }, |
| 2112 | { } /* end */ |
| 2113 | }; |
| 2114 | |
| 2115 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2116 | /* set capture source to mic-in */ |
| 2117 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2118 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2119 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2120 | /* mute all amp mixer inputs */ |
| 2121 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2122 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2123 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2124 | /* line-in to input */ |
| 2125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2126 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2127 | /* built-in mic */ |
| 2128 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2129 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2130 | /* speaker-out */ |
| 2131 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2132 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2133 | /* mic-in to input */ |
| 2134 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2135 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2136 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2137 | /* HP-out */ |
| 2138 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2139 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2140 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2141 | /* jack sense */ |
| 2142 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2143 | { } |
| 2144 | }; |
| 2145 | |
| 2146 | /* toggle speaker-output according to the hp-jack state */ |
| 2147 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2148 | { |
| 2149 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2150 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2151 | |
| 2152 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2153 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2154 | bits = present ? HDA_AMP_MUTE : 0; |
| 2155 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2156 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2157 | } |
| 2158 | |
| 2159 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2160 | { |
| 2161 | /* Looks like the unsol event is incompatible with the standard |
| 2162 | * definition. 4bit tag is placed at 28 bit! |
| 2163 | */ |
| 2164 | if ((res >> 28) == 0x01) |
| 2165 | alc880_lg_automute(codec); |
| 2166 | } |
| 2167 | |
| 2168 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2169 | * LG LW20 |
| 2170 | * |
| 2171 | * Pin assignment: |
| 2172 | * Speaker-out: 0x14 |
| 2173 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2174 | * Built-in Mic-In: 0x19 |
| 2175 | * Line-In: 0x1b |
| 2176 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2177 | * SPDIF-Out: 0x1e |
| 2178 | */ |
| 2179 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2180 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2181 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2182 | .items = { |
| 2183 | { "Mic", 0x0 }, |
| 2184 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2185 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2186 | }, |
| 2187 | }; |
| 2188 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2189 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2190 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2191 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2193 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2194 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2195 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2196 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2197 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2198 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2199 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2200 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2201 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2202 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2203 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2204 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2205 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2206 | { |
| 2207 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2208 | .name = "Channel Mode", |
| 2209 | .info = alc_ch_mode_info, |
| 2210 | .get = alc_ch_mode_get, |
| 2211 | .put = alc_ch_mode_put, |
| 2212 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2213 | { } /* end */ |
| 2214 | }; |
| 2215 | |
| 2216 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2217 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2218 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2219 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2220 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2221 | /* set capture source to mic-in */ |
| 2222 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2223 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2224 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2225 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2226 | /* speaker-out */ |
| 2227 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2228 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2229 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2230 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2231 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2232 | /* mic-in to input */ |
| 2233 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2234 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2235 | /* built-in mic */ |
| 2236 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2237 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2238 | /* jack sense */ |
| 2239 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2240 | { } |
| 2241 | }; |
| 2242 | |
| 2243 | /* toggle speaker-output according to the hp-jack state */ |
| 2244 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2245 | { |
| 2246 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2247 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2248 | |
| 2249 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2250 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2251 | bits = present ? HDA_AMP_MUTE : 0; |
| 2252 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2253 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2254 | } |
| 2255 | |
| 2256 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2257 | { |
| 2258 | /* Looks like the unsol event is incompatible with the standard |
| 2259 | * definition. 4bit tag is placed at 28 bit! |
| 2260 | */ |
| 2261 | if ((res >> 28) == 0x01) |
| 2262 | alc880_lg_lw_automute(codec); |
| 2263 | } |
| 2264 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2265 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2266 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2267 | { 0x0b, HDA_INPUT, 0 }, |
| 2268 | { 0x0b, HDA_INPUT, 1 }, |
| 2269 | { 0x0b, HDA_INPUT, 2 }, |
| 2270 | { 0x0b, HDA_INPUT, 3 }, |
| 2271 | { 0x0b, HDA_INPUT, 4 }, |
| 2272 | { } /* end */ |
| 2273 | }; |
| 2274 | |
| 2275 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2276 | { 0x0b, HDA_INPUT, 1 }, |
| 2277 | { 0x0b, HDA_INPUT, 6 }, |
| 2278 | { 0x0b, HDA_INPUT, 7 }, |
| 2279 | { } /* end */ |
| 2280 | }; |
| 2281 | #endif |
| 2282 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2283 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2284 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2285 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2286 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2287 | static int alc_init(struct hda_codec *codec) |
| 2288 | { |
| 2289 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2290 | unsigned int i; |
| 2291 | |
| 2292 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2293 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2294 | |
| 2295 | if (spec->init_hook) |
| 2296 | spec->init_hook(codec); |
| 2297 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2298 | return 0; |
| 2299 | } |
| 2300 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2301 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2302 | { |
| 2303 | struct alc_spec *spec = codec->spec; |
| 2304 | |
| 2305 | if (spec->unsol_event) |
| 2306 | spec->unsol_event(codec, res); |
| 2307 | } |
| 2308 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2309 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2310 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2311 | { |
| 2312 | struct alc_spec *spec = codec->spec; |
| 2313 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2314 | } |
| 2315 | #endif |
| 2316 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2317 | /* |
| 2318 | * Analog playback callbacks |
| 2319 | */ |
| 2320 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2321 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2322 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2323 | { |
| 2324 | struct alc_spec *spec = codec->spec; |
| 2325 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2326 | } |
| 2327 | |
| 2328 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2329 | struct hda_codec *codec, |
| 2330 | unsigned int stream_tag, |
| 2331 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2332 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2333 | { |
| 2334 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2335 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2336 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2337 | } |
| 2338 | |
| 2339 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2340 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2341 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2342 | { |
| 2343 | struct alc_spec *spec = codec->spec; |
| 2344 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2345 | } |
| 2346 | |
| 2347 | /* |
| 2348 | * Digital out |
| 2349 | */ |
| 2350 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2351 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2352 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2353 | { |
| 2354 | struct alc_spec *spec = codec->spec; |
| 2355 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2356 | } |
| 2357 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2358 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2359 | struct hda_codec *codec, |
| 2360 | unsigned int stream_tag, |
| 2361 | unsigned int format, |
| 2362 | struct snd_pcm_substream *substream) |
| 2363 | { |
| 2364 | struct alc_spec *spec = codec->spec; |
| 2365 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2366 | stream_tag, format, substream); |
| 2367 | } |
| 2368 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2369 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2370 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2371 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2372 | { |
| 2373 | struct alc_spec *spec = codec->spec; |
| 2374 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2375 | } |
| 2376 | |
| 2377 | /* |
| 2378 | * Analog capture |
| 2379 | */ |
| 2380 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2381 | struct hda_codec *codec, |
| 2382 | unsigned int stream_tag, |
| 2383 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2384 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2385 | { |
| 2386 | struct alc_spec *spec = codec->spec; |
| 2387 | |
| 2388 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2389 | stream_tag, 0, format); |
| 2390 | return 0; |
| 2391 | } |
| 2392 | |
| 2393 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2394 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2395 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2396 | { |
| 2397 | struct alc_spec *spec = codec->spec; |
| 2398 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2399 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2400 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2401 | return 0; |
| 2402 | } |
| 2403 | |
| 2404 | |
| 2405 | /* |
| 2406 | */ |
| 2407 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2408 | .substreams = 1, |
| 2409 | .channels_min = 2, |
| 2410 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2411 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2412 | .ops = { |
| 2413 | .open = alc880_playback_pcm_open, |
| 2414 | .prepare = alc880_playback_pcm_prepare, |
| 2415 | .cleanup = alc880_playback_pcm_cleanup |
| 2416 | }, |
| 2417 | }; |
| 2418 | |
| 2419 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 2420 | .substreams = 2, |
| 2421 | .channels_min = 2, |
| 2422 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2423 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2424 | .ops = { |
| 2425 | .prepare = alc880_capture_pcm_prepare, |
| 2426 | .cleanup = alc880_capture_pcm_cleanup |
| 2427 | }, |
| 2428 | }; |
| 2429 | |
| 2430 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2431 | .substreams = 1, |
| 2432 | .channels_min = 2, |
| 2433 | .channels_max = 2, |
| 2434 | /* NID is set in alc_build_pcms */ |
| 2435 | .ops = { |
| 2436 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2437 | .close = alc880_dig_playback_pcm_close, |
| 2438 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2439 | }, |
| 2440 | }; |
| 2441 | |
| 2442 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2443 | .substreams = 1, |
| 2444 | .channels_min = 2, |
| 2445 | .channels_max = 2, |
| 2446 | /* NID is set in alc_build_pcms */ |
| 2447 | }; |
| 2448 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2449 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 2450 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 2451 | .substreams = 0, |
| 2452 | .channels_min = 0, |
| 2453 | .channels_max = 0, |
| 2454 | }; |
| 2455 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2456 | static int alc_build_pcms(struct hda_codec *codec) |
| 2457 | { |
| 2458 | struct alc_spec *spec = codec->spec; |
| 2459 | struct hda_pcm *info = spec->pcm_rec; |
| 2460 | int i; |
| 2461 | |
| 2462 | codec->num_pcms = 1; |
| 2463 | codec->pcm_info = info; |
| 2464 | |
| 2465 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2466 | if (spec->stream_analog_playback) { |
| 2467 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2468 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2469 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2470 | } |
| 2471 | if (spec->stream_analog_capture) { |
| 2472 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2473 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2474 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2475 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2476 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2477 | if (spec->channel_mode) { |
| 2478 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2479 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2480 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2481 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2482 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2483 | } |
| 2484 | } |
| 2485 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2486 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2487 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2488 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2489 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2490 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2491 | if (spec->multiout.dig_out_nid && |
| 2492 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2493 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2494 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2495 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2496 | if (spec->dig_in_nid && |
| 2497 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2498 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2499 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2500 | } |
| 2501 | } |
| 2502 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2503 | /* If the use of more than one ADC is requested for the current |
| 2504 | * model, configure a second analog capture-only PCM. |
| 2505 | */ |
| 2506 | /* Additional Analaog capture for index #2 */ |
| 2507 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2508 | spec->adc_nids) { |
| 2509 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2510 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2511 | info->name = spec->stream_name_analog; |
| 2512 | /* No playback stream for second PCM */ |
| 2513 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2514 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2515 | if (spec->stream_analog_capture) { |
| 2516 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2517 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2518 | } |
| 2519 | } |
| 2520 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2521 | return 0; |
| 2522 | } |
| 2523 | |
| 2524 | static void alc_free(struct hda_codec *codec) |
| 2525 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2526 | struct alc_spec *spec = codec->spec; |
| 2527 | unsigned int i; |
| 2528 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2529 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2530 | return; |
| 2531 | |
| 2532 | if (spec->kctl_alloc) { |
| 2533 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2534 | kfree(spec->kctl_alloc[i].name); |
| 2535 | kfree(spec->kctl_alloc); |
| 2536 | } |
| 2537 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2538 | } |
| 2539 | |
| 2540 | /* |
| 2541 | */ |
| 2542 | static struct hda_codec_ops alc_patch_ops = { |
| 2543 | .build_controls = alc_build_controls, |
| 2544 | .build_pcms = alc_build_pcms, |
| 2545 | .init = alc_init, |
| 2546 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2547 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2548 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2549 | .check_power_status = alc_check_power_status, |
| 2550 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2551 | }; |
| 2552 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2553 | |
| 2554 | /* |
| 2555 | * Test configuration for debugging |
| 2556 | * |
| 2557 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2558 | * enum controls. |
| 2559 | */ |
| 2560 | #ifdef CONFIG_SND_DEBUG |
| 2561 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2562 | 0x02, 0x03, 0x04, 0x05 |
| 2563 | }; |
| 2564 | |
| 2565 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2566 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2567 | .items = { |
| 2568 | { "In-1", 0x0 }, |
| 2569 | { "In-2", 0x1 }, |
| 2570 | { "In-3", 0x2 }, |
| 2571 | { "In-4", 0x3 }, |
| 2572 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2573 | { "Front", 0x5 }, |
| 2574 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2575 | }, |
| 2576 | }; |
| 2577 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2578 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2579 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2580 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2581 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2582 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2583 | }; |
| 2584 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2585 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2586 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2587 | { |
| 2588 | static char *texts[] = { |
| 2589 | "N/A", "Line Out", "HP Out", |
| 2590 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2591 | }; |
| 2592 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2593 | uinfo->count = 1; |
| 2594 | uinfo->value.enumerated.items = 8; |
| 2595 | if (uinfo->value.enumerated.item >= 8) |
| 2596 | uinfo->value.enumerated.item = 7; |
| 2597 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2598 | return 0; |
| 2599 | } |
| 2600 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2601 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2602 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2603 | { |
| 2604 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2605 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2606 | unsigned int pin_ctl, item = 0; |
| 2607 | |
| 2608 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2609 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2610 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2611 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2612 | item = 2; |
| 2613 | else |
| 2614 | item = 1; |
| 2615 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2616 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2617 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2618 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2619 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2620 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2621 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2622 | } |
| 2623 | } |
| 2624 | ucontrol->value.enumerated.item[0] = item; |
| 2625 | return 0; |
| 2626 | } |
| 2627 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2628 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2629 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2630 | { |
| 2631 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2632 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2633 | static unsigned int ctls[] = { |
| 2634 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2635 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2636 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2637 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2638 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2639 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2640 | }; |
| 2641 | unsigned int old_ctl, new_ctl; |
| 2642 | |
| 2643 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2644 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2645 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2646 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2647 | int val; |
| 2648 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2649 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2650 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2651 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2652 | HDA_AMP_MUTE : 0; |
| 2653 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2654 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2655 | return 1; |
| 2656 | } |
| 2657 | return 0; |
| 2658 | } |
| 2659 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2660 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2661 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2662 | { |
| 2663 | static char *texts[] = { |
| 2664 | "Front", "Surround", "CLFE", "Side" |
| 2665 | }; |
| 2666 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2667 | uinfo->count = 1; |
| 2668 | uinfo->value.enumerated.items = 4; |
| 2669 | if (uinfo->value.enumerated.item >= 4) |
| 2670 | uinfo->value.enumerated.item = 3; |
| 2671 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2672 | return 0; |
| 2673 | } |
| 2674 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2675 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2676 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2677 | { |
| 2678 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2679 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2680 | unsigned int sel; |
| 2681 | |
| 2682 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2683 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2684 | return 0; |
| 2685 | } |
| 2686 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2687 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2688 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2689 | { |
| 2690 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2691 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2692 | unsigned int sel; |
| 2693 | |
| 2694 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2695 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2696 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2697 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2698 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2699 | return 1; |
| 2700 | } |
| 2701 | return 0; |
| 2702 | } |
| 2703 | |
| 2704 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2705 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2706 | .name = xname, \ |
| 2707 | .info = alc_test_pin_ctl_info, \ |
| 2708 | .get = alc_test_pin_ctl_get, \ |
| 2709 | .put = alc_test_pin_ctl_put, \ |
| 2710 | .private_value = nid \ |
| 2711 | } |
| 2712 | |
| 2713 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2714 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2715 | .name = xname, \ |
| 2716 | .info = alc_test_pin_src_info, \ |
| 2717 | .get = alc_test_pin_src_get, \ |
| 2718 | .put = alc_test_pin_src_put, \ |
| 2719 | .private_value = nid \ |
| 2720 | } |
| 2721 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2722 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2723 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2724 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2725 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2726 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2727 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2728 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2729 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2730 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2731 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2732 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2733 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2734 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2735 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2736 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2737 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2738 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2739 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2740 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2741 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2742 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2743 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2744 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2745 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2746 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2747 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2748 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2749 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2750 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2751 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2752 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2753 | { |
| 2754 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2755 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2756 | .info = alc_ch_mode_info, |
| 2757 | .get = alc_ch_mode_get, |
| 2758 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2759 | }, |
| 2760 | { } /* end */ |
| 2761 | }; |
| 2762 | |
| 2763 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2764 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2765 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2766 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2767 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2768 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2769 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2770 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2771 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2772 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2773 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2774 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2775 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2776 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2777 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2778 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2779 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2780 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2781 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2782 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2783 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2784 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2785 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2786 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2787 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2788 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2789 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2790 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2791 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2792 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2793 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2794 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2795 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2796 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2797 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2798 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2799 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2800 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2801 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2802 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2803 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2804 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2805 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2806 | /* Analog input/passthru */ |
| 2807 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2808 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2809 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2810 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2811 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2812 | { } |
| 2813 | }; |
| 2814 | #endif |
| 2815 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2816 | /* |
| 2817 | */ |
| 2818 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2819 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2820 | [ALC880_3ST] = "3stack", |
| 2821 | [ALC880_TCL_S700] = "tcl", |
| 2822 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2823 | [ALC880_CLEVO] = "clevo", |
| 2824 | [ALC880_5ST] = "5stack", |
| 2825 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2826 | [ALC880_W810] = "w810", |
| 2827 | [ALC880_Z71V] = "z71v", |
| 2828 | [ALC880_6ST] = "6stack", |
| 2829 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2830 | [ALC880_ASUS] = "asus", |
| 2831 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2832 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2833 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2834 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2835 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2836 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2837 | [ALC880_F1734] = "F1734", |
| 2838 | [ALC880_LG] = "lg", |
| 2839 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2840 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2841 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2842 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2843 | [ALC880_AUTO] = "auto", |
| 2844 | }; |
| 2845 | |
| 2846 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2847 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2848 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2849 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2850 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2851 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2852 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2853 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2854 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2855 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2856 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2857 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2858 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2859 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2860 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2861 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2862 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2863 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2864 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2865 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2866 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2867 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2868 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2869 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2870 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2871 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2872 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2873 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2874 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2875 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2876 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2877 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2878 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2879 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2880 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2881 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2882 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2883 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2884 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2885 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2886 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2887 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2888 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2889 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2890 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2891 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2892 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2893 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2894 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2895 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2896 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2897 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2898 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2899 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2900 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2901 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 2902 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2903 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2904 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2905 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2906 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2907 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2908 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2909 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2910 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2911 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2912 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2913 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 2914 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2915 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2916 | {} |
| 2917 | }; |
| 2918 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2919 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2920 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2921 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2922 | static struct alc_config_preset alc880_presets[] = { |
| 2923 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2924 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2925 | .init_verbs = { alc880_volume_init_verbs, |
| 2926 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2927 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2928 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2929 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2930 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2931 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2932 | .input_mux = &alc880_capture_source, |
| 2933 | }, |
| 2934 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2935 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2936 | .init_verbs = { alc880_volume_init_verbs, |
| 2937 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2938 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2939 | .dac_nids = alc880_dac_nids, |
| 2940 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2941 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2942 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2943 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2944 | .input_mux = &alc880_capture_source, |
| 2945 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2946 | [ALC880_TCL_S700] = { |
| 2947 | .mixers = { alc880_tcl_s700_mixer }, |
| 2948 | .init_verbs = { alc880_volume_init_verbs, |
| 2949 | alc880_pin_tcl_S700_init_verbs, |
| 2950 | alc880_gpio2_init_verbs }, |
| 2951 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2952 | .dac_nids = alc880_dac_nids, |
| 2953 | .hp_nid = 0x03, |
| 2954 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2955 | .channel_mode = alc880_2_jack_modes, |
| 2956 | .input_mux = &alc880_capture_source, |
| 2957 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2958 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2959 | .mixers = { alc880_three_stack_mixer, |
| 2960 | alc880_five_stack_mixer}, |
| 2961 | .init_verbs = { alc880_volume_init_verbs, |
| 2962 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2963 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2964 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2965 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2966 | .channel_mode = alc880_fivestack_modes, |
| 2967 | .input_mux = &alc880_capture_source, |
| 2968 | }, |
| 2969 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2970 | .mixers = { alc880_three_stack_mixer, |
| 2971 | alc880_five_stack_mixer }, |
| 2972 | .init_verbs = { alc880_volume_init_verbs, |
| 2973 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2974 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2975 | .dac_nids = alc880_dac_nids, |
| 2976 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2977 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2978 | .channel_mode = alc880_fivestack_modes, |
| 2979 | .input_mux = &alc880_capture_source, |
| 2980 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2981 | [ALC880_6ST] = { |
| 2982 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2983 | .init_verbs = { alc880_volume_init_verbs, |
| 2984 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2985 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2986 | .dac_nids = alc880_6st_dac_nids, |
| 2987 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2988 | .channel_mode = alc880_sixstack_modes, |
| 2989 | .input_mux = &alc880_6stack_capture_source, |
| 2990 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2991 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2992 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2993 | .init_verbs = { alc880_volume_init_verbs, |
| 2994 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2995 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2996 | .dac_nids = alc880_6st_dac_nids, |
| 2997 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2998 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2999 | .channel_mode = alc880_sixstack_modes, |
| 3000 | .input_mux = &alc880_6stack_capture_source, |
| 3001 | }, |
| 3002 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3003 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3004 | .init_verbs = { alc880_volume_init_verbs, |
| 3005 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3006 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3007 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3008 | .dac_nids = alc880_w810_dac_nids, |
| 3009 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3010 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3011 | .channel_mode = alc880_w810_modes, |
| 3012 | .input_mux = &alc880_capture_source, |
| 3013 | }, |
| 3014 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3015 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3016 | .init_verbs = { alc880_volume_init_verbs, |
| 3017 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3018 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3019 | .dac_nids = alc880_z71v_dac_nids, |
| 3020 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3021 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3022 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3023 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3024 | .input_mux = &alc880_capture_source, |
| 3025 | }, |
| 3026 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3027 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3028 | .init_verbs = { alc880_volume_init_verbs, |
| 3029 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3030 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3031 | .dac_nids = alc880_f1734_dac_nids, |
| 3032 | .hp_nid = 0x02, |
| 3033 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3034 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3035 | .input_mux = &alc880_capture_source, |
| 3036 | }, |
| 3037 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3038 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3039 | .init_verbs = { alc880_volume_init_verbs, |
| 3040 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3041 | alc880_gpio1_init_verbs }, |
| 3042 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3043 | .dac_nids = alc880_asus_dac_nids, |
| 3044 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3045 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3046 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3047 | .input_mux = &alc880_capture_source, |
| 3048 | }, |
| 3049 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3050 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3051 | .init_verbs = { alc880_volume_init_verbs, |
| 3052 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3053 | alc880_gpio1_init_verbs }, |
| 3054 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3055 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3056 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3057 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3058 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3059 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3060 | .input_mux = &alc880_capture_source, |
| 3061 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3062 | [ALC880_ASUS_DIG2] = { |
| 3063 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3064 | .init_verbs = { alc880_volume_init_verbs, |
| 3065 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3066 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3067 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3068 | .dac_nids = alc880_asus_dac_nids, |
| 3069 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3070 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3071 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3072 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3073 | .input_mux = &alc880_capture_source, |
| 3074 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3075 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3076 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3077 | .init_verbs = { alc880_volume_init_verbs, |
| 3078 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3079 | alc880_gpio1_init_verbs }, |
| 3080 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3081 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3082 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3083 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3084 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3085 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3086 | .input_mux = &alc880_capture_source, |
| 3087 | }, |
| 3088 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3089 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3090 | .init_verbs = { alc880_volume_init_verbs, |
| 3091 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3092 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3093 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3094 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3095 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3096 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3097 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3098 | .input_mux = &alc880_capture_source, |
| 3099 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3100 | [ALC880_UNIWILL] = { |
| 3101 | .mixers = { alc880_uniwill_mixer }, |
| 3102 | .init_verbs = { alc880_volume_init_verbs, |
| 3103 | alc880_uniwill_init_verbs }, |
| 3104 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3105 | .dac_nids = alc880_asus_dac_nids, |
| 3106 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3107 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3108 | .channel_mode = alc880_threestack_modes, |
| 3109 | .need_dac_fix = 1, |
| 3110 | .input_mux = &alc880_capture_source, |
| 3111 | .unsol_event = alc880_uniwill_unsol_event, |
| 3112 | .init_hook = alc880_uniwill_automute, |
| 3113 | }, |
| 3114 | [ALC880_UNIWILL_P53] = { |
| 3115 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3116 | .init_verbs = { alc880_volume_init_verbs, |
| 3117 | alc880_uniwill_p53_init_verbs }, |
| 3118 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3119 | .dac_nids = alc880_asus_dac_nids, |
| 3120 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3121 | .channel_mode = alc880_threestack_modes, |
| 3122 | .input_mux = &alc880_capture_source, |
| 3123 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3124 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3125 | }, |
| 3126 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3127 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3128 | alc880_pcbeep_mixer, }, |
| 3129 | .init_verbs = { alc880_volume_init_verbs, |
| 3130 | alc880_uniwill_p53_init_verbs, |
| 3131 | alc880_beep_init_verbs }, |
| 3132 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3133 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3134 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3135 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3136 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3137 | .input_mux = &alc880_capture_source, |
| 3138 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3139 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3140 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3141 | [ALC880_CLEVO] = { |
| 3142 | .mixers = { alc880_three_stack_mixer }, |
| 3143 | .init_verbs = { alc880_volume_init_verbs, |
| 3144 | alc880_pin_clevo_init_verbs }, |
| 3145 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3146 | .dac_nids = alc880_dac_nids, |
| 3147 | .hp_nid = 0x03, |
| 3148 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3149 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3150 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3151 | .input_mux = &alc880_capture_source, |
| 3152 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3153 | [ALC880_LG] = { |
| 3154 | .mixers = { alc880_lg_mixer }, |
| 3155 | .init_verbs = { alc880_volume_init_verbs, |
| 3156 | alc880_lg_init_verbs }, |
| 3157 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3158 | .dac_nids = alc880_lg_dac_nids, |
| 3159 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3160 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3161 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3162 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3163 | .input_mux = &alc880_lg_capture_source, |
| 3164 | .unsol_event = alc880_lg_unsol_event, |
| 3165 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3166 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3167 | .loopbacks = alc880_lg_loopbacks, |
| 3168 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3169 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3170 | [ALC880_LG_LW] = { |
| 3171 | .mixers = { alc880_lg_lw_mixer }, |
| 3172 | .init_verbs = { alc880_volume_init_verbs, |
| 3173 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3174 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3175 | .dac_nids = alc880_dac_nids, |
| 3176 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3177 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3178 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3179 | .input_mux = &alc880_lg_lw_capture_source, |
| 3180 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3181 | .init_hook = alc880_lg_lw_automute, |
| 3182 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3183 | #ifdef CONFIG_SND_DEBUG |
| 3184 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3185 | .mixers = { alc880_test_mixer }, |
| 3186 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3187 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3188 | .dac_nids = alc880_test_dac_nids, |
| 3189 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3190 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3191 | .channel_mode = alc880_test_modes, |
| 3192 | .input_mux = &alc880_test_capture_source, |
| 3193 | }, |
| 3194 | #endif |
| 3195 | }; |
| 3196 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3197 | /* |
| 3198 | * Automatic parse of I/O pins from the BIOS configuration |
| 3199 | */ |
| 3200 | |
| 3201 | #define NUM_CONTROL_ALLOC 32 |
| 3202 | #define NUM_VERB_ALLOC 32 |
| 3203 | |
| 3204 | enum { |
| 3205 | ALC_CTL_WIDGET_VOL, |
| 3206 | ALC_CTL_WIDGET_MUTE, |
| 3207 | ALC_CTL_BIND_MUTE, |
| 3208 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3209 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3210 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3211 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3212 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3213 | }; |
| 3214 | |
| 3215 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3216 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3217 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3218 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3219 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3220 | |
| 3221 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3222 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3223 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3224 | /* array + terminator */ |
| 3225 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3226 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3227 | return -ENOMEM; |
| 3228 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3229 | memcpy(knew, spec->kctl_alloc, |
| 3230 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3231 | kfree(spec->kctl_alloc); |
| 3232 | } |
| 3233 | spec->kctl_alloc = knew; |
| 3234 | spec->num_kctl_alloc = num; |
| 3235 | } |
| 3236 | |
| 3237 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3238 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3239 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3240 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3241 | return -ENOMEM; |
| 3242 | knew->private_value = val; |
| 3243 | spec->num_kctl_used++; |
| 3244 | return 0; |
| 3245 | } |
| 3246 | |
| 3247 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3248 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3249 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3250 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3251 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3252 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3253 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3254 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3255 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3256 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3257 | #define ALC880_PIN_CD_NID 0x1c |
| 3258 | |
| 3259 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3260 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3261 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3262 | { |
| 3263 | hda_nid_t nid; |
| 3264 | int assigned[4]; |
| 3265 | int i, j; |
| 3266 | |
| 3267 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3268 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3269 | |
| 3270 | /* check the pins hardwired to audio widget */ |
| 3271 | for (i = 0; i < cfg->line_outs; i++) { |
| 3272 | nid = cfg->line_out_pins[i]; |
| 3273 | if (alc880_is_fixed_pin(nid)) { |
| 3274 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3275 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3276 | assigned[idx] = 1; |
| 3277 | } |
| 3278 | } |
| 3279 | /* left pins can be connect to any audio widget */ |
| 3280 | for (i = 0; i < cfg->line_outs; i++) { |
| 3281 | nid = cfg->line_out_pins[i]; |
| 3282 | if (alc880_is_fixed_pin(nid)) |
| 3283 | continue; |
| 3284 | /* search for an empty channel */ |
| 3285 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3286 | if (!assigned[j]) { |
| 3287 | spec->multiout.dac_nids[i] = |
| 3288 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3289 | assigned[j] = 1; |
| 3290 | break; |
| 3291 | } |
| 3292 | } |
| 3293 | } |
| 3294 | spec->multiout.num_dacs = cfg->line_outs; |
| 3295 | return 0; |
| 3296 | } |
| 3297 | |
| 3298 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3299 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3300 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3301 | { |
| 3302 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3303 | static const char *chname[4] = { |
| 3304 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3305 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3306 | hda_nid_t nid; |
| 3307 | int i, err; |
| 3308 | |
| 3309 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3310 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3311 | continue; |
| 3312 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3313 | if (i == 2) { |
| 3314 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3315 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3316 | "Center Playback Volume", |
| 3317 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3318 | HDA_OUTPUT)); |
| 3319 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3320 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3321 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3322 | "LFE Playback Volume", |
| 3323 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3324 | HDA_OUTPUT)); |
| 3325 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3326 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3327 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3328 | "Center Playback Switch", |
| 3329 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3330 | HDA_INPUT)); |
| 3331 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3332 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3333 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3334 | "LFE Playback Switch", |
| 3335 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3336 | HDA_INPUT)); |
| 3337 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3338 | return err; |
| 3339 | } else { |
| 3340 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3341 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3342 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3343 | HDA_OUTPUT)); |
| 3344 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3345 | return err; |
| 3346 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3347 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3348 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3349 | HDA_INPUT)); |
| 3350 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3351 | return err; |
| 3352 | } |
| 3353 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3354 | return 0; |
| 3355 | } |
| 3356 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3357 | /* add playback controls for speaker and HP outputs */ |
| 3358 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3359 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3360 | { |
| 3361 | hda_nid_t nid; |
| 3362 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3363 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3364 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3365 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3366 | return 0; |
| 3367 | |
| 3368 | if (alc880_is_fixed_pin(pin)) { |
| 3369 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3370 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3371 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3372 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3373 | else |
| 3374 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3375 | /* control HP volume/switch on the output mixer amp */ |
| 3376 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3377 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3378 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3379 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3380 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3381 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3382 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3383 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3384 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3385 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3386 | return err; |
| 3387 | } else if (alc880_is_multi_pin(pin)) { |
| 3388 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3389 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3390 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3391 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3392 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3393 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3394 | return err; |
| 3395 | } |
| 3396 | return 0; |
| 3397 | } |
| 3398 | |
| 3399 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3400 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3401 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3402 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3403 | { |
| 3404 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3405 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3406 | |
| 3407 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3408 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3409 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3410 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3411 | return err; |
| 3412 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3413 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3414 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3415 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3416 | return err; |
| 3417 | return 0; |
| 3418 | } |
| 3419 | |
| 3420 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3421 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3422 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3423 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3424 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3425 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3426 | |
| 3427 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3428 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3429 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3430 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3431 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3432 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3433 | if (err < 0) |
| 3434 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3435 | imux->items[imux->num_items].label = |
| 3436 | auto_pin_cfg_labels[i]; |
| 3437 | imux->items[imux->num_items].index = |
| 3438 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3439 | imux->num_items++; |
| 3440 | } |
| 3441 | } |
| 3442 | return 0; |
| 3443 | } |
| 3444 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3445 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3446 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3447 | int dac_idx) |
| 3448 | { |
| 3449 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3450 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3451 | pin_type); |
| 3452 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3453 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3454 | /* need the manual connection? */ |
| 3455 | if (alc880_is_multi_pin(nid)) { |
| 3456 | struct alc_spec *spec = codec->spec; |
| 3457 | int idx = alc880_multi_pin_idx(nid); |
| 3458 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3459 | AC_VERB_SET_CONNECT_SEL, |
| 3460 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3461 | } |
| 3462 | } |
| 3463 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3464 | static int get_pin_type(int line_out_type) |
| 3465 | { |
| 3466 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3467 | return PIN_HP; |
| 3468 | else |
| 3469 | return PIN_OUT; |
| 3470 | } |
| 3471 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3472 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3473 | { |
| 3474 | struct alc_spec *spec = codec->spec; |
| 3475 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3476 | |
| 3477 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3478 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3479 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3480 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3481 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3482 | } |
| 3483 | } |
| 3484 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3485 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3486 | { |
| 3487 | struct alc_spec *spec = codec->spec; |
| 3488 | hda_nid_t pin; |
| 3489 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3490 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3491 | if (pin) /* connect to front */ |
| 3492 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3493 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3494 | if (pin) /* connect to front */ |
| 3495 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3496 | } |
| 3497 | |
| 3498 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3499 | { |
| 3500 | struct alc_spec *spec = codec->spec; |
| 3501 | int i; |
| 3502 | |
| 3503 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3504 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3505 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3506 | snd_hda_codec_write(codec, nid, 0, |
| 3507 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3508 | i <= AUTO_PIN_FRONT_MIC ? |
| 3509 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3510 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3511 | snd_hda_codec_write(codec, nid, 0, |
| 3512 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3513 | AMP_OUT_MUTE); |
| 3514 | } |
| 3515 | } |
| 3516 | } |
| 3517 | |
| 3518 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3519 | /* return 1 if successful, 0 if the proper config is not found, |
| 3520 | * or a negative error code |
| 3521 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3522 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3523 | { |
| 3524 | struct alc_spec *spec = codec->spec; |
| 3525 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3526 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3527 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3528 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3529 | alc880_ignore); |
| 3530 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3531 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3532 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3533 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3534 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3535 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3536 | if (err < 0) |
| 3537 | return err; |
| 3538 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3539 | if (err < 0) |
| 3540 | return err; |
| 3541 | err = alc880_auto_create_extra_out(spec, |
| 3542 | spec->autocfg.speaker_pins[0], |
| 3543 | "Speaker"); |
| 3544 | if (err < 0) |
| 3545 | return err; |
| 3546 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3547 | "Headphone"); |
| 3548 | if (err < 0) |
| 3549 | return err; |
| 3550 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3551 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3552 | return err; |
| 3553 | |
| 3554 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3555 | |
| 3556 | if (spec->autocfg.dig_out_pin) |
| 3557 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3558 | if (spec->autocfg.dig_in_pin) |
| 3559 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3560 | |
| 3561 | if (spec->kctl_alloc) |
| 3562 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3563 | |
| 3564 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3565 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3566 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3567 | spec->input_mux = &spec->private_imux; |
| 3568 | |
| 3569 | return 1; |
| 3570 | } |
| 3571 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3572 | /* additional initialization for auto-configuration model */ |
| 3573 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3574 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3575 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3576 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3577 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3578 | } |
| 3579 | |
| 3580 | /* |
| 3581 | * OK, here we have finally the patch for ALC880 |
| 3582 | */ |
| 3583 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3584 | static int patch_alc880(struct hda_codec *codec) |
| 3585 | { |
| 3586 | struct alc_spec *spec; |
| 3587 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3588 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3589 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3590 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3591 | if (spec == NULL) |
| 3592 | return -ENOMEM; |
| 3593 | |
| 3594 | codec->spec = spec; |
| 3595 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3596 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3597 | alc880_models, |
| 3598 | alc880_cfg_tbl); |
| 3599 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3600 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3601 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3602 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3603 | } |
| 3604 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3605 | if (board_config == ALC880_AUTO) { |
| 3606 | /* automatic parse from the BIOS config */ |
| 3607 | err = alc880_parse_auto_config(codec); |
| 3608 | if (err < 0) { |
| 3609 | alc_free(codec); |
| 3610 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3611 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3612 | printk(KERN_INFO |
| 3613 | "hda_codec: Cannot set up configuration " |
| 3614 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3615 | board_config = ALC880_3ST; |
| 3616 | } |
| 3617 | } |
| 3618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3619 | if (board_config != ALC880_AUTO) |
| 3620 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3621 | |
| 3622 | spec->stream_name_analog = "ALC880 Analog"; |
| 3623 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3624 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3625 | |
| 3626 | spec->stream_name_digital = "ALC880 Digital"; |
| 3627 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3628 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3629 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3630 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3631 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3632 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3633 | /* get type */ |
| 3634 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3635 | if (wcap != AC_WID_AUD_IN) { |
| 3636 | spec->adc_nids = alc880_adc_nids_alt; |
| 3637 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3638 | spec->mixers[spec->num_mixers] = |
| 3639 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3640 | spec->num_mixers++; |
| 3641 | } else { |
| 3642 | spec->adc_nids = alc880_adc_nids; |
| 3643 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3644 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3645 | spec->num_mixers++; |
| 3646 | } |
| 3647 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3648 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3649 | spec->vmaster_nid = 0x0c; |
| 3650 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3651 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3652 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3653 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3654 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3655 | if (!spec->loopback.amplist) |
| 3656 | spec->loopback.amplist = alc880_loopbacks; |
| 3657 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3658 | |
| 3659 | return 0; |
| 3660 | } |
| 3661 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3662 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3663 | /* |
| 3664 | * ALC260 support |
| 3665 | */ |
| 3666 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3667 | static hda_nid_t alc260_dac_nids[1] = { |
| 3668 | /* front */ |
| 3669 | 0x02, |
| 3670 | }; |
| 3671 | |
| 3672 | static hda_nid_t alc260_adc_nids[1] = { |
| 3673 | /* ADC0 */ |
| 3674 | 0x04, |
| 3675 | }; |
| 3676 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3677 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3678 | /* ADC1 */ |
| 3679 | 0x05, |
| 3680 | }; |
| 3681 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3682 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3683 | /* ADC1, 0 */ |
| 3684 | 0x05, 0x04 |
| 3685 | }; |
| 3686 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3687 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3688 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3689 | */ |
| 3690 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3691 | /* ADC0, ADC1 */ |
| 3692 | 0x04, 0x05 |
| 3693 | }; |
| 3694 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3695 | #define ALC260_DIGOUT_NID 0x03 |
| 3696 | #define ALC260_DIGIN_NID 0x06 |
| 3697 | |
| 3698 | static struct hda_input_mux alc260_capture_source = { |
| 3699 | .num_items = 4, |
| 3700 | .items = { |
| 3701 | { "Mic", 0x0 }, |
| 3702 | { "Front Mic", 0x1 }, |
| 3703 | { "Line", 0x2 }, |
| 3704 | { "CD", 0x4 }, |
| 3705 | }, |
| 3706 | }; |
| 3707 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3708 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3709 | * headphone jack and the internal CD lines since these are the only pins at |
| 3710 | * which audio can appear. For flexibility, also allow the option of |
| 3711 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3712 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3713 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3714 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3715 | { |
| 3716 | .num_items = 3, |
| 3717 | .items = { |
| 3718 | { "Mic/Line", 0x0 }, |
| 3719 | { "CD", 0x4 }, |
| 3720 | { "Headphone", 0x2 }, |
| 3721 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3722 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3723 | { |
| 3724 | .num_items = 4, |
| 3725 | .items = { |
| 3726 | { "Mic/Line", 0x0 }, |
| 3727 | { "CD", 0x4 }, |
| 3728 | { "Headphone", 0x2 }, |
| 3729 | { "Mixer", 0x5 }, |
| 3730 | }, |
| 3731 | }, |
| 3732 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3733 | }; |
| 3734 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3735 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3736 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3737 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3738 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3739 | { |
| 3740 | .num_items = 4, |
| 3741 | .items = { |
| 3742 | { "Mic", 0x0 }, |
| 3743 | { "Line", 0x2 }, |
| 3744 | { "CD", 0x4 }, |
| 3745 | { "Headphone", 0x5 }, |
| 3746 | }, |
| 3747 | }, |
| 3748 | { |
| 3749 | .num_items = 5, |
| 3750 | .items = { |
| 3751 | { "Mic", 0x0 }, |
| 3752 | { "Line", 0x2 }, |
| 3753 | { "CD", 0x4 }, |
| 3754 | { "Headphone", 0x6 }, |
| 3755 | { "Mixer", 0x5 }, |
| 3756 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3757 | }, |
| 3758 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3759 | /* |
| 3760 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3761 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3762 | * element which allows changing the channel mode, so the verb list is |
| 3763 | * never used. |
| 3764 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3765 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3766 | { 2, NULL }, |
| 3767 | }; |
| 3768 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3769 | |
| 3770 | /* Mixer combinations |
| 3771 | * |
| 3772 | * basic: base_output + input + pc_beep + capture |
| 3773 | * HP: base_output + input + capture_alt |
| 3774 | * HP_3013: hp_3013 + input + capture |
| 3775 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3776 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3777 | */ |
| 3778 | |
| 3779 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3780 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3781 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3782 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3783 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3784 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3785 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3786 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3787 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3788 | |
| 3789 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3790 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3791 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3792 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3793 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3796 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3797 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3798 | { } /* end */ |
| 3799 | }; |
| 3800 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3801 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3802 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3803 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3804 | { } /* end */ |
| 3805 | }; |
| 3806 | |
| 3807 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3808 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3809 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3810 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3811 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3812 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3813 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3814 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3815 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3816 | { } /* end */ |
| 3817 | }; |
| 3818 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3819 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3820 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3821 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3822 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3823 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3824 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3825 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3826 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3827 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3828 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3829 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3830 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3831 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3832 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3833 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3834 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3835 | { } /* end */ |
| 3836 | }; |
| 3837 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3838 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3839 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3840 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3841 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3842 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3843 | * revisions available in early 2006. Therefore for now allow the |
| 3844 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3845 | * that the lack of mic bias for this NID is intentional we could change the |
| 3846 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3847 | * |
| 3848 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3849 | * don't appear to make the mic bias available from the "line" jack, even |
| 3850 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3851 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3852 | * and the output jack. If this turns out to be the case for all such |
| 3853 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3854 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3855 | * |
| 3856 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3857 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 3858 | * controls for such models. On models without a "mono speaker" the control |
| 3859 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3860 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3861 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3862 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3863 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3864 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3865 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3866 | HDA_OUTPUT), |
| 3867 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 3868 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3870 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3871 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3872 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3873 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3874 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3875 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3876 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3877 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3878 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3879 | { } /* end */ |
| 3880 | }; |
| 3881 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3882 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 3883 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 3884 | */ |
| 3885 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 3886 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3887 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3888 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3889 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3890 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3891 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3892 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3893 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3894 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3895 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3896 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3897 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3898 | { } /* end */ |
| 3899 | }; |
| 3900 | |
| 3901 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 3902 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 3903 | */ |
| 3904 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 3905 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3906 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3907 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3908 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3909 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3910 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 3911 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 3912 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3913 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3914 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3915 | { } /* end */ |
| 3916 | }; |
| 3917 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3918 | /* capture mixer elements */ |
| 3919 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3920 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3921 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3922 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3923 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3924 | { |
| 3925 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3926 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3927 | * So call somewhat different.. |
| 3928 | * FIXME: the controls appear in the "playback" view! |
| 3929 | */ |
| 3930 | /* .name = "Capture Source", */ |
| 3931 | .name = "Input Source", |
| 3932 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3933 | .info = alc_mux_enum_info, |
| 3934 | .get = alc_mux_enum_get, |
| 3935 | .put = alc_mux_enum_put, |
| 3936 | }, |
| 3937 | { } /* end */ |
| 3938 | }; |
| 3939 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3940 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3941 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3942 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3943 | { |
| 3944 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3945 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3946 | * So call somewhat different.. |
| 3947 | * FIXME: the controls appear in the "playback" view! |
| 3948 | */ |
| 3949 | /* .name = "Capture Source", */ |
| 3950 | .name = "Input Source", |
| 3951 | .count = 1, |
| 3952 | .info = alc_mux_enum_info, |
| 3953 | .get = alc_mux_enum_get, |
| 3954 | .put = alc_mux_enum_put, |
| 3955 | }, |
| 3956 | { } /* end */ |
| 3957 | }; |
| 3958 | |
| 3959 | /* |
| 3960 | * initialization verbs |
| 3961 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3962 | static struct hda_verb alc260_init_verbs[] = { |
| 3963 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3964 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3965 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3966 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3967 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3968 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3969 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3970 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3971 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3972 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3973 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3974 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3975 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3976 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3977 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3978 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3979 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3980 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3981 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3982 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3983 | /* set connection select to line in (default select for this ADC) */ |
| 3984 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3985 | /* mute capture amp left and right */ |
| 3986 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3987 | /* set connection select to line in (default select for this ADC) */ |
| 3988 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3989 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3990 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3991 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3992 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3993 | /* set vol=0 HP mixer amp left and right */ |
| 3994 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3995 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3996 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3997 | /* set vol=0 Mono mixer amp left and right */ |
| 3998 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3999 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4000 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4001 | /* unmute LINE-2 out pin */ |
| 4002 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4003 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4004 | * Line In 2 = 0x03 |
| 4005 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4006 | /* mute analog inputs */ |
| 4007 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4008 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4009 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4010 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4011 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4012 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4013 | /* mute Front out path */ |
| 4014 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4015 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4016 | /* mute Headphone out path */ |
| 4017 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4018 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4019 | /* mute Mono out path */ |
| 4020 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4021 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4022 | { } |
| 4023 | }; |
| 4024 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4025 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4026 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4027 | /* Headphone and output */ |
| 4028 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4029 | /* mono output */ |
| 4030 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4031 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4032 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4033 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4034 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4035 | /* Line In pin widget for input */ |
| 4036 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4037 | /* Line-2 pin widget for output */ |
| 4038 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4039 | /* CD pin widget for input */ |
| 4040 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4041 | /* unmute amp left and right */ |
| 4042 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4043 | /* set connection select to line in (default select for this ADC) */ |
| 4044 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4045 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4046 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4047 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4048 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4049 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4050 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4051 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4052 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4053 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4054 | * Line In 2 = 0x03 |
| 4055 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4056 | /* mute analog inputs */ |
| 4057 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4058 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4059 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4061 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4062 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4063 | /* Unmute Front out path */ |
| 4064 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4065 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4066 | /* Unmute Headphone out path */ |
| 4067 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4068 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4069 | /* Unmute Mono out path */ |
| 4070 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4071 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4072 | { } |
| 4073 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4074 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4075 | |
| 4076 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4077 | /* Line out and output */ |
| 4078 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4079 | /* mono output */ |
| 4080 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4081 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4082 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4083 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4084 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4085 | /* Line In pin widget for input */ |
| 4086 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4087 | /* Headphone pin widget for output */ |
| 4088 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4089 | /* CD pin widget for input */ |
| 4090 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4091 | /* unmute amp left and right */ |
| 4092 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4093 | /* set connection select to line in (default select for this ADC) */ |
| 4094 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4095 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4096 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4097 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4098 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4099 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4100 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4101 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4102 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4103 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4104 | * Line In 2 = 0x03 |
| 4105 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4106 | /* mute analog inputs */ |
| 4107 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4108 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4110 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4111 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4112 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4113 | /* Unmute Front out path */ |
| 4114 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4115 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4116 | /* Unmute Headphone out path */ |
| 4117 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4118 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4119 | /* Unmute Mono out path */ |
| 4120 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4121 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4122 | { } |
| 4123 | }; |
| 4124 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4125 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4126 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4127 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4128 | */ |
| 4129 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4130 | /* Disable all GPIOs */ |
| 4131 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4132 | /* Internal speaker is connected to headphone pin */ |
| 4133 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4134 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4135 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4136 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4137 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4138 | /* Ensure all other unused pins are disabled and muted. */ |
| 4139 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4140 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4141 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4142 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4143 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4144 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4145 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4146 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4147 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4148 | /* Disable digital (SPDIF) pins */ |
| 4149 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4150 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4151 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4152 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4153 | * when acting as an output. |
| 4154 | */ |
| 4155 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4156 | |
| 4157 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4158 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4159 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4160 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4161 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4162 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4163 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4164 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4165 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4166 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4167 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4168 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4169 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4170 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4171 | * If the pin mode is changed by the user the pin mode control will |
| 4172 | * take care of enabling the pin's input/output buffers as needed. |
| 4173 | * Therefore there's no need to enable the input buffer at this |
| 4174 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4175 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4176 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4177 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4178 | * mixer ctrl) |
| 4179 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4180 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4181 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4182 | /* Mute capture amp left and right */ |
| 4183 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4184 | /* Set ADC connection select to match default mixer setting - line |
| 4185 | * in (on mic1 pin) |
| 4186 | */ |
| 4187 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4188 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4189 | /* Do the same for the second ADC: mute capture input amp and |
| 4190 | * set ADC connection to line in (on mic1 pin) |
| 4191 | */ |
| 4192 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4193 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4194 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4195 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4196 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4197 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4201 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4202 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4203 | {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] | 4204 | |
| 4205 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4206 | }; |
| 4207 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4208 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4209 | * similar laptops (adapted from Fujitsu init verbs). |
| 4210 | */ |
| 4211 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4212 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4213 | * the headphone jack. Turn this on and rely on the standard mute |
| 4214 | * methods whenever the user wants to turn these outputs off. |
| 4215 | */ |
| 4216 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4217 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4218 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4219 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4220 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4221 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4222 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4223 | /* Line In jack is connected to Line1 pin */ |
| 4224 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4225 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4226 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4227 | /* Ensure all other unused pins are disabled and muted. */ |
| 4228 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4229 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4230 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4231 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4233 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4234 | /* Disable digital (SPDIF) pins */ |
| 4235 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4236 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4237 | |
| 4238 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4239 | * bus when acting as outputs. |
| 4240 | */ |
| 4241 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4242 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4243 | |
| 4244 | /* Start with output sum widgets muted and their output gains at min */ |
| 4245 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4246 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4247 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4248 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4250 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4251 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4252 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4253 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4254 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4255 | /* Unmute Line-out pin widget amp left and right |
| 4256 | * (no equiv mixer ctrl) |
| 4257 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4258 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4259 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4260 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4261 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4262 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4263 | * will take care of enabling the pin's input/output buffers as needed. |
| 4264 | * Therefore there's no need to enable the input buffer at this |
| 4265 | * stage. |
| 4266 | */ |
| 4267 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4268 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4269 | |
| 4270 | /* Mute capture amp left and right */ |
| 4271 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4272 | /* Set ADC connection select to match default mixer setting - mic |
| 4273 | * (on mic1 pin) |
| 4274 | */ |
| 4275 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4276 | |
| 4277 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4278 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4279 | */ |
| 4280 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4281 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4282 | |
| 4283 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4284 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4285 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4287 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4288 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4289 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4290 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4291 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4292 | |
| 4293 | { } |
| 4294 | }; |
| 4295 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4296 | static struct hda_verb alc260_will_verbs[] = { |
| 4297 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4298 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4299 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4300 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4301 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4302 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4303 | {} |
| 4304 | }; |
| 4305 | |
| 4306 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4307 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4308 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4309 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4310 | |
| 4311 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4312 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4313 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4314 | |
| 4315 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4316 | {} |
| 4317 | }; |
| 4318 | |
| 4319 | /* toggle speaker-output according to the hp-jack state */ |
| 4320 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4321 | { |
| 4322 | unsigned int present; |
| 4323 | |
| 4324 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4325 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4326 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4327 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4328 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4329 | AC_VERB_SET_GPIO_DATA, 1); |
| 4330 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4331 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4332 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4333 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4334 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4335 | AC_VERB_SET_GPIO_DATA, 0); |
| 4336 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4337 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4338 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4339 | } |
| 4340 | } |
| 4341 | |
| 4342 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4343 | unsigned int res) |
| 4344 | { |
| 4345 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4346 | alc260_replacer_672v_automute(codec); |
| 4347 | } |
| 4348 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4349 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4350 | * configuration. |
| 4351 | */ |
| 4352 | #ifdef CONFIG_SND_DEBUG |
| 4353 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4354 | 0x02, |
| 4355 | }; |
| 4356 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4357 | 0x04, 0x05, |
| 4358 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4359 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4360 | * the signal assignments are different. This assumes that the first ADC |
| 4361 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4362 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4363 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4364 | { |
| 4365 | .num_items = 7, |
| 4366 | .items = { |
| 4367 | { "MIC1 pin", 0x0 }, |
| 4368 | { "MIC2 pin", 0x1 }, |
| 4369 | { "LINE1 pin", 0x2 }, |
| 4370 | { "LINE2 pin", 0x3 }, |
| 4371 | { "CD pin", 0x4 }, |
| 4372 | { "LINE-OUT pin", 0x5 }, |
| 4373 | { "HP-OUT pin", 0x6 }, |
| 4374 | }, |
| 4375 | }, |
| 4376 | { |
| 4377 | .num_items = 8, |
| 4378 | .items = { |
| 4379 | { "MIC1 pin", 0x0 }, |
| 4380 | { "MIC2 pin", 0x1 }, |
| 4381 | { "LINE1 pin", 0x2 }, |
| 4382 | { "LINE2 pin", 0x3 }, |
| 4383 | { "CD pin", 0x4 }, |
| 4384 | { "Mixer", 0x5 }, |
| 4385 | { "LINE-OUT pin", 0x6 }, |
| 4386 | { "HP-OUT pin", 0x7 }, |
| 4387 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4388 | }, |
| 4389 | }; |
| 4390 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4391 | /* Output driver widgets */ |
| 4392 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4393 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4394 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4395 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4396 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4397 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4398 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4399 | /* Modes for retasking pin widgets |
| 4400 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4401 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4402 | * mention this restriction. At this stage it's not clear whether |
| 4403 | * this behaviour is intentional or is a hardware bug in chip |
| 4404 | * revisions available at least up until early 2006. Therefore for |
| 4405 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4406 | * choices, but if it turns out that the lack of mic bias for these |
| 4407 | * NIDs is intentional we could change their modes from |
| 4408 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4409 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4410 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4411 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4412 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4413 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4414 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4415 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4416 | |
| 4417 | /* Loopback mixer controls */ |
| 4418 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4419 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4420 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4421 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4422 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4423 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4424 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4425 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4426 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4427 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4428 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4429 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4430 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4431 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4432 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4433 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4434 | |
| 4435 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4436 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4437 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4438 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4439 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4440 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4441 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4442 | * is ambigious as to which NID is which; testing on laptops which |
| 4443 | * make this output available should provide clarification. |
| 4444 | */ |
| 4445 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4446 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4447 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4448 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4449 | * this output to turn on an external amplifier. |
| 4450 | */ |
| 4451 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4452 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4453 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4454 | { } /* end */ |
| 4455 | }; |
| 4456 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4457 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4458 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4459 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4460 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4461 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4462 | /* Enable retasking pins as output, initially without power amp */ |
| 4463 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4464 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4466 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4467 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4468 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4469 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4470 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4471 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4472 | * payload also sets the generation to 0, output to be in "consumer" |
| 4473 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4474 | * control. |
| 4475 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4476 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4477 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4478 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4479 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4480 | * OUT1 sum bus when acting as an output. |
| 4481 | */ |
| 4482 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4483 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4484 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4485 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4486 | |
| 4487 | /* Start with output sum widgets muted and their output gains at min */ |
| 4488 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4489 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4491 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4492 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4493 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4494 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4495 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4496 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4497 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4498 | /* Unmute retasking pin widget output buffers since the default |
| 4499 | * state appears to be output. As the pin mode is changed by the |
| 4500 | * user the pin mode control will take care of enabling the pin's |
| 4501 | * input/output buffers as needed. |
| 4502 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4503 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4504 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4505 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4507 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4508 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4509 | /* Also unmute the mono-out pin widget */ |
| 4510 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4511 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4512 | /* Mute capture amp left and right */ |
| 4513 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4514 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4515 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4516 | */ |
| 4517 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4518 | |
| 4519 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4520 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4521 | */ |
| 4522 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4523 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4524 | |
| 4525 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4526 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4527 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4528 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4529 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4530 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4531 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4532 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4533 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4534 | |
| 4535 | { } |
| 4536 | }; |
| 4537 | #endif |
| 4538 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4539 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 4540 | .substreams = 1, |
| 4541 | .channels_min = 2, |
| 4542 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4543 | }; |
| 4544 | |
| 4545 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 4546 | .substreams = 1, |
| 4547 | .channels_min = 2, |
| 4548 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4549 | }; |
| 4550 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4551 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4552 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4553 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4554 | /* |
| 4555 | * for BIOS auto-configuration |
| 4556 | */ |
| 4557 | |
| 4558 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4559 | const char *pfx) |
| 4560 | { |
| 4561 | hda_nid_t nid_vol; |
| 4562 | unsigned long vol_val, sw_val; |
| 4563 | char name[32]; |
| 4564 | int err; |
| 4565 | |
| 4566 | if (nid >= 0x0f && nid < 0x11) { |
| 4567 | nid_vol = nid - 0x7; |
| 4568 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4569 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4570 | } else if (nid == 0x11) { |
| 4571 | nid_vol = nid - 0x7; |
| 4572 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4573 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4574 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4575 | nid_vol = 0x08; |
| 4576 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4577 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4578 | } else |
| 4579 | return 0; /* N/A */ |
| 4580 | |
| 4581 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4582 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4583 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4584 | return err; |
| 4585 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4586 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4587 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4588 | return err; |
| 4589 | return 1; |
| 4590 | } |
| 4591 | |
| 4592 | /* add playback controls from the parsed DAC table */ |
| 4593 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4594 | const struct auto_pin_cfg *cfg) |
| 4595 | { |
| 4596 | hda_nid_t nid; |
| 4597 | int err; |
| 4598 | |
| 4599 | spec->multiout.num_dacs = 1; |
| 4600 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4601 | spec->multiout.dac_nids[0] = 0x02; |
| 4602 | |
| 4603 | nid = cfg->line_out_pins[0]; |
| 4604 | if (nid) { |
| 4605 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4606 | if (err < 0) |
| 4607 | return err; |
| 4608 | } |
| 4609 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4610 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4611 | if (nid) { |
| 4612 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4613 | if (err < 0) |
| 4614 | return err; |
| 4615 | } |
| 4616 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4617 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4618 | if (nid) { |
| 4619 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4620 | if (err < 0) |
| 4621 | return err; |
| 4622 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4623 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4624 | } |
| 4625 | |
| 4626 | /* create playback/capture controls for input pins */ |
| 4627 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4628 | const struct auto_pin_cfg *cfg) |
| 4629 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4630 | struct hda_input_mux *imux = &spec->private_imux; |
| 4631 | int i, err, idx; |
| 4632 | |
| 4633 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4634 | if (cfg->input_pins[i] >= 0x12) { |
| 4635 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4636 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4637 | auto_pin_cfg_labels[i], idx, |
| 4638 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4639 | if (err < 0) |
| 4640 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4641 | imux->items[imux->num_items].label = |
| 4642 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4643 | imux->items[imux->num_items].index = idx; |
| 4644 | imux->num_items++; |
| 4645 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4646 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4647 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4648 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4649 | auto_pin_cfg_labels[i], idx, |
| 4650 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4651 | if (err < 0) |
| 4652 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4653 | imux->items[imux->num_items].label = |
| 4654 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4655 | imux->items[imux->num_items].index = idx; |
| 4656 | imux->num_items++; |
| 4657 | } |
| 4658 | } |
| 4659 | return 0; |
| 4660 | } |
| 4661 | |
| 4662 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4663 | hda_nid_t nid, int pin_type, |
| 4664 | int sel_idx) |
| 4665 | { |
| 4666 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4667 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4668 | pin_type); |
| 4669 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4670 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4671 | /* need the manual connection? */ |
| 4672 | if (nid >= 0x12) { |
| 4673 | int idx = nid - 0x12; |
| 4674 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4675 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4676 | } |
| 4677 | } |
| 4678 | |
| 4679 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4680 | { |
| 4681 | struct alc_spec *spec = codec->spec; |
| 4682 | hda_nid_t nid; |
| 4683 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4684 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4685 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4686 | if (nid) { |
| 4687 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4688 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4689 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4690 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4691 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4692 | if (nid) |
| 4693 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4694 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4695 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4696 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4697 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4698 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4699 | |
| 4700 | #define ALC260_PIN_CD_NID 0x16 |
| 4701 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4702 | { |
| 4703 | struct alc_spec *spec = codec->spec; |
| 4704 | int i; |
| 4705 | |
| 4706 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4707 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4708 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4709 | snd_hda_codec_write(codec, nid, 0, |
| 4710 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4711 | i <= AUTO_PIN_FRONT_MIC ? |
| 4712 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4713 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4714 | snd_hda_codec_write(codec, nid, 0, |
| 4715 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4716 | AMP_OUT_MUTE); |
| 4717 | } |
| 4718 | } |
| 4719 | } |
| 4720 | |
| 4721 | /* |
| 4722 | * generic initialization of ADC, input mixers and output mixers |
| 4723 | */ |
| 4724 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4725 | /* |
| 4726 | * Unmute ADC0-1 and set the default input to mic-in |
| 4727 | */ |
| 4728 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4729 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4730 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4731 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4732 | |
| 4733 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4734 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4735 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4736 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4737 | */ |
| 4738 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4739 | /* mute analog inputs */ |
| 4740 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4741 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4742 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4743 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4744 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4745 | |
| 4746 | /* |
| 4747 | * Set up output mixers (0x08 - 0x0a) |
| 4748 | */ |
| 4749 | /* set vol=0 to output mixers */ |
| 4750 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4751 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4752 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4753 | /* set up input amps for analog loopback */ |
| 4754 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4755 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4756 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4757 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4758 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4759 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4760 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4761 | |
| 4762 | { } |
| 4763 | }; |
| 4764 | |
| 4765 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4766 | { |
| 4767 | struct alc_spec *spec = codec->spec; |
| 4768 | unsigned int wcap; |
| 4769 | int err; |
| 4770 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4771 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4772 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4773 | alc260_ignore); |
| 4774 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4775 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4776 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4777 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4778 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4779 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4780 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4781 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4782 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4783 | return err; |
| 4784 | |
| 4785 | spec->multiout.max_channels = 2; |
| 4786 | |
| 4787 | if (spec->autocfg.dig_out_pin) |
| 4788 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4789 | if (spec->kctl_alloc) |
| 4790 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4791 | |
| 4792 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4793 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4794 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4795 | spec->input_mux = &spec->private_imux; |
| 4796 | |
| 4797 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4798 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4799 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4800 | if (wcap != AC_WID_AUD_IN) { |
| 4801 | spec->adc_nids = alc260_adc_nids_alt; |
| 4802 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4803 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4804 | } else { |
| 4805 | spec->adc_nids = alc260_adc_nids; |
| 4806 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4807 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4808 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4809 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4810 | |
| 4811 | return 1; |
| 4812 | } |
| 4813 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4814 | /* additional initialization for auto-configuration model */ |
| 4815 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4816 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4817 | alc260_auto_init_multi_out(codec); |
| 4818 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4819 | } |
| 4820 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4821 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4822 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4823 | { 0x07, HDA_INPUT, 0 }, |
| 4824 | { 0x07, HDA_INPUT, 1 }, |
| 4825 | { 0x07, HDA_INPUT, 2 }, |
| 4826 | { 0x07, HDA_INPUT, 3 }, |
| 4827 | { 0x07, HDA_INPUT, 4 }, |
| 4828 | { } /* end */ |
| 4829 | }; |
| 4830 | #endif |
| 4831 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4832 | /* |
| 4833 | * ALC260 configurations |
| 4834 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4835 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4836 | [ALC260_BASIC] = "basic", |
| 4837 | [ALC260_HP] = "hp", |
| 4838 | [ALC260_HP_3013] = "hp-3013", |
| 4839 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4840 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4841 | [ALC260_WILL] = "will", |
| 4842 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4843 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4844 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4845 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4846 | [ALC260_AUTO] = "auto", |
| 4847 | }; |
| 4848 | |
| 4849 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4850 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4851 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4852 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4853 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4854 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4855 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4856 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4857 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4858 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4859 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4860 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4861 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4862 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4863 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4864 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4865 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4866 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4867 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4868 | {} |
| 4869 | }; |
| 4870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4871 | static struct alc_config_preset alc260_presets[] = { |
| 4872 | [ALC260_BASIC] = { |
| 4873 | .mixers = { alc260_base_output_mixer, |
| 4874 | alc260_input_mixer, |
| 4875 | alc260_pc_beep_mixer, |
| 4876 | alc260_capture_mixer }, |
| 4877 | .init_verbs = { alc260_init_verbs }, |
| 4878 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4879 | .dac_nids = alc260_dac_nids, |
| 4880 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4881 | .adc_nids = alc260_adc_nids, |
| 4882 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4883 | .channel_mode = alc260_modes, |
| 4884 | .input_mux = &alc260_capture_source, |
| 4885 | }, |
| 4886 | [ALC260_HP] = { |
| 4887 | .mixers = { alc260_base_output_mixer, |
| 4888 | alc260_input_mixer, |
| 4889 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4890 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4891 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4892 | .dac_nids = alc260_dac_nids, |
| 4893 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4894 | .adc_nids = alc260_hp_adc_nids, |
| 4895 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4896 | .channel_mode = alc260_modes, |
| 4897 | .input_mux = &alc260_capture_source, |
| 4898 | }, |
| 4899 | [ALC260_HP_3013] = { |
| 4900 | .mixers = { alc260_hp_3013_mixer, |
| 4901 | alc260_input_mixer, |
| 4902 | alc260_capture_alt_mixer }, |
| 4903 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4904 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4905 | .dac_nids = alc260_dac_nids, |
| 4906 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4907 | .adc_nids = alc260_hp_adc_nids, |
| 4908 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4909 | .channel_mode = alc260_modes, |
| 4910 | .input_mux = &alc260_capture_source, |
| 4911 | }, |
| 4912 | [ALC260_FUJITSU_S702X] = { |
| 4913 | .mixers = { alc260_fujitsu_mixer, |
| 4914 | alc260_capture_mixer }, |
| 4915 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4916 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4917 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4918 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4919 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4920 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4921 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4922 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4923 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4924 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4925 | [ALC260_ACER] = { |
| 4926 | .mixers = { alc260_acer_mixer, |
| 4927 | alc260_capture_mixer }, |
| 4928 | .init_verbs = { alc260_acer_init_verbs }, |
| 4929 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4930 | .dac_nids = alc260_dac_nids, |
| 4931 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4932 | .adc_nids = alc260_dual_adc_nids, |
| 4933 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4934 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4935 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4936 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4937 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4938 | [ALC260_WILL] = { |
| 4939 | .mixers = { alc260_will_mixer, |
| 4940 | alc260_capture_mixer }, |
| 4941 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 4942 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4943 | .dac_nids = alc260_dac_nids, |
| 4944 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4945 | .adc_nids = alc260_adc_nids, |
| 4946 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4947 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4948 | .channel_mode = alc260_modes, |
| 4949 | .input_mux = &alc260_capture_source, |
| 4950 | }, |
| 4951 | [ALC260_REPLACER_672V] = { |
| 4952 | .mixers = { alc260_replacer_672v_mixer, |
| 4953 | alc260_capture_mixer }, |
| 4954 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 4955 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4956 | .dac_nids = alc260_dac_nids, |
| 4957 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4958 | .adc_nids = alc260_adc_nids, |
| 4959 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4960 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4961 | .channel_mode = alc260_modes, |
| 4962 | .input_mux = &alc260_capture_source, |
| 4963 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 4964 | .init_hook = alc260_replacer_672v_automute, |
| 4965 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4966 | #ifdef CONFIG_SND_DEBUG |
| 4967 | [ALC260_TEST] = { |
| 4968 | .mixers = { alc260_test_mixer, |
| 4969 | alc260_capture_mixer }, |
| 4970 | .init_verbs = { alc260_test_init_verbs }, |
| 4971 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4972 | .dac_nids = alc260_test_dac_nids, |
| 4973 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4974 | .adc_nids = alc260_test_adc_nids, |
| 4975 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4976 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4977 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4978 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4979 | }, |
| 4980 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4981 | }; |
| 4982 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4983 | static int patch_alc260(struct hda_codec *codec) |
| 4984 | { |
| 4985 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4986 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4987 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4988 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4989 | if (spec == NULL) |
| 4990 | return -ENOMEM; |
| 4991 | |
| 4992 | codec->spec = spec; |
| 4993 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4994 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 4995 | alc260_models, |
| 4996 | alc260_cfg_tbl); |
| 4997 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4998 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4999 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5000 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5001 | } |
| 5002 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5003 | if (board_config == ALC260_AUTO) { |
| 5004 | /* automatic parse from the BIOS config */ |
| 5005 | err = alc260_parse_auto_config(codec); |
| 5006 | if (err < 0) { |
| 5007 | alc_free(codec); |
| 5008 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5009 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5010 | printk(KERN_INFO |
| 5011 | "hda_codec: Cannot set up configuration " |
| 5012 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5013 | board_config = ALC260_BASIC; |
| 5014 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5015 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5016 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5017 | if (board_config != ALC260_AUTO) |
| 5018 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5019 | |
| 5020 | spec->stream_name_analog = "ALC260 Analog"; |
| 5021 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5022 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5023 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5024 | spec->stream_name_digital = "ALC260 Digital"; |
| 5025 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5026 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5027 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5028 | spec->vmaster_nid = 0x08; |
| 5029 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5030 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5031 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5032 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5033 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5034 | if (!spec->loopback.amplist) |
| 5035 | spec->loopback.amplist = alc260_loopbacks; |
| 5036 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5037 | |
| 5038 | return 0; |
| 5039 | } |
| 5040 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5041 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5042 | /* |
| 5043 | * ALC882 support |
| 5044 | * |
| 5045 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5046 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5047 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5048 | * 6-channel independent captures. |
| 5049 | * |
| 5050 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5051 | * driver yet). |
| 5052 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5053 | #define ALC882_DIGOUT_NID 0x06 |
| 5054 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5055 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5056 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5057 | { 8, NULL } |
| 5058 | }; |
| 5059 | |
| 5060 | static hda_nid_t alc882_dac_nids[4] = { |
| 5061 | /* front, rear, clfe, rear_surr */ |
| 5062 | 0x02, 0x03, 0x04, 0x05 |
| 5063 | }; |
| 5064 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5065 | /* identical with ALC880 */ |
| 5066 | #define alc882_adc_nids alc880_adc_nids |
| 5067 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5068 | |
| 5069 | /* input MUX */ |
| 5070 | /* FIXME: should be a matrix-type input source selection */ |
| 5071 | |
| 5072 | static struct hda_input_mux alc882_capture_source = { |
| 5073 | .num_items = 4, |
| 5074 | .items = { |
| 5075 | { "Mic", 0x0 }, |
| 5076 | { "Front Mic", 0x1 }, |
| 5077 | { "Line", 0x2 }, |
| 5078 | { "CD", 0x4 }, |
| 5079 | }, |
| 5080 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5081 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5082 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5083 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5084 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5085 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5086 | { |
| 5087 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5088 | struct alc_spec *spec = codec->spec; |
| 5089 | const struct hda_input_mux *imux = spec->input_mux; |
| 5090 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5091 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 5092 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 5093 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5094 | unsigned int i, idx; |
| 5095 | |
| 5096 | idx = ucontrol->value.enumerated.item[0]; |
| 5097 | if (idx >= imux->num_items) |
| 5098 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5099 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5100 | return 0; |
| 5101 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5102 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5103 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5104 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5105 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5106 | } |
| 5107 | *cur_val = idx; |
| 5108 | return 1; |
| 5109 | } |
| 5110 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5111 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5112 | * 2ch mode |
| 5113 | */ |
| 5114 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5115 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5116 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5117 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5118 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5119 | { } /* end */ |
| 5120 | }; |
| 5121 | |
| 5122 | /* |
| 5123 | * 6ch mode |
| 5124 | */ |
| 5125 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5126 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5127 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5128 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5129 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5130 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5131 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5132 | { } /* end */ |
| 5133 | }; |
| 5134 | |
| 5135 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5136 | { 2, alc882_3ST_ch2_init }, |
| 5137 | { 6, alc882_3ST_ch6_init }, |
| 5138 | }; |
| 5139 | |
| 5140 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5141 | * 6ch mode |
| 5142 | */ |
| 5143 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5144 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5145 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5146 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5147 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5148 | { } /* end */ |
| 5149 | }; |
| 5150 | |
| 5151 | /* |
| 5152 | * 8ch mode |
| 5153 | */ |
| 5154 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5155 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5156 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5157 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5158 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5159 | { } /* end */ |
| 5160 | }; |
| 5161 | |
| 5162 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5163 | { 6, alc882_sixstack_ch6_init }, |
| 5164 | { 8, alc882_sixstack_ch8_init }, |
| 5165 | }; |
| 5166 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5167 | /* |
| 5168 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5169 | */ |
| 5170 | |
| 5171 | /* |
| 5172 | * 2ch mode |
| 5173 | */ |
| 5174 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5175 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5176 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5177 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5178 | { } /* end */ |
| 5179 | }; |
| 5180 | |
| 5181 | /* |
| 5182 | * 6ch mode |
| 5183 | */ |
| 5184 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5185 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5186 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5187 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5188 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5189 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5190 | { } /* end */ |
| 5191 | }; |
| 5192 | |
| 5193 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5194 | { 2, alc885_mbp_ch2_init }, |
| 5195 | { 6, alc885_mbp_ch6_init }, |
| 5196 | }; |
| 5197 | |
| 5198 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5199 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5200 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5201 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5202 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5203 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5204 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5205 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5206 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5207 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5208 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5209 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5210 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5211 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5212 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5213 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5214 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5215 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5216 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5217 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5218 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5219 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5221 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5222 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5223 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5224 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5225 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5226 | { } /* end */ |
| 5227 | }; |
| 5228 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5229 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5230 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5231 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5232 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5233 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5234 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5235 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5236 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5237 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5238 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5239 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5240 | { } /* end */ |
| 5241 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5242 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5243 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5244 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5245 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5246 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5247 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5248 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5249 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5250 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5251 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5252 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5253 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5254 | { } /* end */ |
| 5255 | }; |
| 5256 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5257 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5258 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5259 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5260 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5261 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5262 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5263 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5264 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5265 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5266 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5267 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5268 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5269 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5270 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5271 | { } /* end */ |
| 5272 | }; |
| 5273 | |
| 5274 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5275 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5276 | */ |
| 5277 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5278 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5279 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5280 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5281 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5282 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5283 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5284 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5285 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5286 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5287 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5288 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5290 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5291 | { } /* end */ |
| 5292 | }; |
| 5293 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5294 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5295 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5296 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5297 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5298 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5299 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5300 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5301 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5302 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5303 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5304 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5305 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5306 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5307 | { } /* end */ |
| 5308 | }; |
| 5309 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5310 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5311 | { |
| 5312 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5313 | .name = "Channel Mode", |
| 5314 | .info = alc_ch_mode_info, |
| 5315 | .get = alc_ch_mode_get, |
| 5316 | .put = alc_ch_mode_put, |
| 5317 | }, |
| 5318 | { } /* end */ |
| 5319 | }; |
| 5320 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5321 | static struct hda_verb alc882_init_verbs[] = { |
| 5322 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5323 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5326 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5327 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5328 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5329 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5330 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5331 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5332 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5334 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5335 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5336 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5337 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5338 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5339 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5340 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5341 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5342 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5343 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5344 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5345 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5346 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5347 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5348 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5349 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5350 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5351 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5352 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5353 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5354 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5355 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5356 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5357 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5358 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5359 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5360 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5361 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5362 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5363 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5364 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5365 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5366 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5367 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5368 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5369 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5370 | |
| 5371 | /* FIXME: use matrix-type input source selection */ |
| 5372 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5373 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5374 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5375 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5376 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5377 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5378 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5379 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5380 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5381 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5382 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5383 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5384 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5385 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5386 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5387 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5388 | /* ADC1: mute amp left and right */ |
| 5389 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5390 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5391 | /* ADC2: mute amp left and right */ |
| 5392 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5393 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5394 | /* ADC3: mute amp left and right */ |
| 5395 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5396 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5397 | |
| 5398 | { } |
| 5399 | }; |
| 5400 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5401 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5402 | /* change to EAPD mode */ |
| 5403 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5404 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5405 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5406 | }; |
| 5407 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5408 | /* Mac Pro test */ |
| 5409 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5410 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5411 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5412 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5413 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5414 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5415 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5416 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5417 | { } /* end */ |
| 5418 | }; |
| 5419 | |
| 5420 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5421 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5422 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5425 | /* Front Pin: output 0 (0x0c) */ |
| 5426 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5427 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5428 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5429 | /* Front Mic pin: input vref at 80% */ |
| 5430 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5431 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5432 | /* Speaker: output */ |
| 5433 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5434 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5435 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5436 | /* Headphone output (output 0 - 0x0c) */ |
| 5437 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5438 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5439 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5440 | |
| 5441 | /* FIXME: use matrix-type input source selection */ |
| 5442 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5443 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5444 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5445 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5446 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5447 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5448 | /* Input mixer2 */ |
| 5449 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5450 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5451 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5452 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5453 | /* Input mixer3 */ |
| 5454 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5455 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5456 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5457 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5458 | /* ADC1: mute amp left and right */ |
| 5459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5460 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5461 | /* ADC2: mute amp left and right */ |
| 5462 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5463 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5464 | /* ADC3: mute amp left and right */ |
| 5465 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5466 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5467 | |
| 5468 | { } |
| 5469 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5470 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5471 | /* Macbook Pro rev3 */ |
| 5472 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5473 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5474 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5475 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5476 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5477 | /* Rear mixer */ |
| 5478 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5479 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5480 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5481 | /* Front Pin: output 0 (0x0c) */ |
| 5482 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5483 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5484 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5485 | /* HP Pin: output 0 (0x0d) */ |
| 5486 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5487 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5488 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5489 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5490 | /* Mic (rear) pin: input vref at 80% */ |
| 5491 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5492 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5493 | /* Front Mic pin: input vref at 80% */ |
| 5494 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5495 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5496 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5497 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5498 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5499 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5500 | |
| 5501 | /* FIXME: use matrix-type input source selection */ |
| 5502 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5503 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5504 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5505 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5506 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5507 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5508 | /* Input mixer2 */ |
| 5509 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5510 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5511 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5512 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5513 | /* Input mixer3 */ |
| 5514 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5515 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5516 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5517 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5518 | /* ADC1: mute amp left and right */ |
| 5519 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5520 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5521 | /* ADC2: mute amp left and right */ |
| 5522 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5523 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5524 | /* ADC3: mute amp left and right */ |
| 5525 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5526 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5527 | |
| 5528 | { } |
| 5529 | }; |
| 5530 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5531 | /* iMac 24 mixer. */ |
| 5532 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5533 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5534 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5535 | { } /* end */ |
| 5536 | }; |
| 5537 | |
| 5538 | /* iMac 24 init verbs. */ |
| 5539 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5540 | /* Internal speakers: output 0 (0x0c) */ |
| 5541 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5542 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5543 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5544 | /* Internal speakers: output 0 (0x0c) */ |
| 5545 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5546 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5547 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5548 | /* Headphone: output 0 (0x0c) */ |
| 5549 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5550 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5551 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5552 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5553 | /* Front Mic: input vref at 80% */ |
| 5554 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5555 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5556 | { } |
| 5557 | }; |
| 5558 | |
| 5559 | /* Toggle speaker-output according to the hp-jack state */ |
| 5560 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5561 | { |
| 5562 | unsigned int present; |
| 5563 | |
| 5564 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5565 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5566 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5567 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5568 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5569 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5570 | } |
| 5571 | |
| 5572 | /* Processes unsolicited events. */ |
| 5573 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5574 | unsigned int res) |
| 5575 | { |
| 5576 | /* Headphone insertion or removal. */ |
| 5577 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5578 | alc885_imac24_automute(codec); |
| 5579 | } |
| 5580 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5581 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5582 | { |
| 5583 | unsigned int present; |
| 5584 | |
| 5585 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5586 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5587 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5588 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5589 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5590 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5591 | |
| 5592 | } |
| 5593 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5594 | unsigned int res) |
| 5595 | { |
| 5596 | /* Headphone insertion or removal. */ |
| 5597 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5598 | alc885_mbp3_automute(codec); |
| 5599 | } |
| 5600 | |
| 5601 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5602 | static struct hda_verb alc882_targa_verbs[] = { |
| 5603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5605 | |
| 5606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5607 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5608 | |
| 5609 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5610 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5611 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5612 | |
| 5613 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5614 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5615 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5616 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5617 | { } /* end */ |
| 5618 | }; |
| 5619 | |
| 5620 | /* toggle speaker-output according to the hp-jack state */ |
| 5621 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5622 | { |
| 5623 | unsigned int present; |
| 5624 | |
| 5625 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5626 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5627 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5628 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5629 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5630 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5631 | } |
| 5632 | |
| 5633 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5634 | { |
| 5635 | /* Looks like the unsol event is incompatible with the standard |
| 5636 | * definition. 4bit tag is placed at 26 bit! |
| 5637 | */ |
| 5638 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5639 | alc882_targa_automute(codec); |
| 5640 | } |
| 5641 | } |
| 5642 | |
| 5643 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5645 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5646 | |
| 5647 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5648 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5649 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5650 | |
| 5651 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5652 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5653 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5654 | |
| 5655 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5656 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5657 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5658 | { } /* end */ |
| 5659 | }; |
| 5660 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5661 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5662 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5663 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5664 | |
| 5665 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5666 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5667 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5668 | |
| 5669 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5670 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5671 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5672 | |
| 5673 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5674 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5675 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5676 | { } /* end */ |
| 5677 | }; |
| 5678 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5679 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5680 | { |
| 5681 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5682 | |
| 5683 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5684 | AC_VERB_GET_GPIO_DATA, 0); |
| 5685 | |
| 5686 | if (!muted) |
| 5687 | gpiostate |= (1 << pin); |
| 5688 | else |
| 5689 | gpiostate &= ~(1 << pin); |
| 5690 | |
| 5691 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5692 | AC_VERB_GET_GPIO_MASK, 0); |
| 5693 | gpiomask |= (1 << pin); |
| 5694 | |
| 5695 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5696 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5697 | gpiodir |= (1 << pin); |
| 5698 | |
| 5699 | |
| 5700 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5701 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5702 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5703 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5704 | |
| 5705 | msleep(1); |
| 5706 | |
| 5707 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5708 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5709 | } |
| 5710 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5711 | /* set up GPIO at initialization */ |
| 5712 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5713 | { |
| 5714 | alc882_gpio_mute(codec, 0, 0); |
| 5715 | alc882_gpio_mute(codec, 1, 0); |
| 5716 | } |
| 5717 | |
| 5718 | /* set up GPIO and update auto-muting at initialization */ |
| 5719 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5720 | { |
| 5721 | alc885_macpro_init_hook(codec); |
| 5722 | alc885_imac24_automute(codec); |
| 5723 | } |
| 5724 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5725 | /* |
| 5726 | * generic initialization of ADC, input mixers and output mixers |
| 5727 | */ |
| 5728 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5729 | /* |
| 5730 | * Unmute ADC0-2 and set the default input to mic-in |
| 5731 | */ |
| 5732 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5733 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5734 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5735 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5736 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5737 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5738 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5739 | /* 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] | 5740 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5741 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5742 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5743 | */ |
| 5744 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5745 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5746 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5747 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5748 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5749 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5750 | |
| 5751 | /* |
| 5752 | * Set up output mixers (0x0c - 0x0f) |
| 5753 | */ |
| 5754 | /* set vol=0 to output mixers */ |
| 5755 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5756 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5757 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5758 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5759 | /* set up input amps for analog loopback */ |
| 5760 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5762 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5763 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5764 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5765 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5766 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5767 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5768 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5769 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5770 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5771 | |
| 5772 | /* FIXME: use matrix-type input source selection */ |
| 5773 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5774 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5775 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5776 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5777 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5778 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5779 | /* Input mixer2 */ |
| 5780 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5781 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5782 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5783 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5784 | /* Input mixer3 */ |
| 5785 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5786 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5787 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5788 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5789 | |
| 5790 | { } |
| 5791 | }; |
| 5792 | |
| 5793 | /* capture mixer elements */ |
| 5794 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5795 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5796 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5797 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5798 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5799 | { |
| 5800 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5801 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5802 | * So call somewhat different.. |
| 5803 | * FIXME: the controls appear in the "playback" view! |
| 5804 | */ |
| 5805 | /* .name = "Capture Source", */ |
| 5806 | .name = "Input Source", |
| 5807 | .count = 2, |
| 5808 | .info = alc882_mux_enum_info, |
| 5809 | .get = alc882_mux_enum_get, |
| 5810 | .put = alc882_mux_enum_put, |
| 5811 | }, |
| 5812 | { } /* end */ |
| 5813 | }; |
| 5814 | |
| 5815 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5816 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5817 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5818 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5819 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5820 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5821 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5822 | { |
| 5823 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5824 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5825 | * So call somewhat different.. |
| 5826 | * FIXME: the controls appear in the "playback" view! |
| 5827 | */ |
| 5828 | /* .name = "Capture Source", */ |
| 5829 | .name = "Input Source", |
| 5830 | .count = 3, |
| 5831 | .info = alc882_mux_enum_info, |
| 5832 | .get = alc882_mux_enum_get, |
| 5833 | .put = alc882_mux_enum_put, |
| 5834 | }, |
| 5835 | { } /* end */ |
| 5836 | }; |
| 5837 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5838 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5839 | #define alc882_loopbacks alc880_loopbacks |
| 5840 | #endif |
| 5841 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5842 | /* pcm configuration: identiacal with ALC880 */ |
| 5843 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5844 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5845 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5846 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5847 | |
| 5848 | /* |
| 5849 | * configuration and preset |
| 5850 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5851 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5852 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5853 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5854 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5855 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 5856 | [ALC882_TARGA] = "targa", |
| 5857 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 5858 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5859 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5860 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5861 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5862 | [ALC882_AUTO] = "auto", |
| 5863 | }; |
| 5864 | |
| 5865 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 5866 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5867 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 5868 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5869 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5870 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 5871 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 5872 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5873 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
| 5874 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 5875 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 5876 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5877 | {} |
| 5878 | }; |
| 5879 | |
| 5880 | static struct alc_config_preset alc882_presets[] = { |
| 5881 | [ALC882_3ST_DIG] = { |
| 5882 | .mixers = { alc882_base_mixer }, |
| 5883 | .init_verbs = { alc882_init_verbs }, |
| 5884 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5885 | .dac_nids = alc882_dac_nids, |
| 5886 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5887 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5888 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5889 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5890 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5891 | .input_mux = &alc882_capture_source, |
| 5892 | }, |
| 5893 | [ALC882_6ST_DIG] = { |
| 5894 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5895 | .init_verbs = { alc882_init_verbs }, |
| 5896 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5897 | .dac_nids = alc882_dac_nids, |
| 5898 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5899 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5900 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5901 | .channel_mode = alc882_sixstack_modes, |
| 5902 | .input_mux = &alc882_capture_source, |
| 5903 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5904 | [ALC882_ARIMA] = { |
| 5905 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5906 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 5907 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5908 | .dac_nids = alc882_dac_nids, |
| 5909 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5910 | .channel_mode = alc882_sixstack_modes, |
| 5911 | .input_mux = &alc882_capture_source, |
| 5912 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5913 | [ALC882_W2JC] = { |
| 5914 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 5915 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5916 | alc880_gpio1_init_verbs }, |
| 5917 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5918 | .dac_nids = alc882_dac_nids, |
| 5919 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5920 | .channel_mode = alc880_threestack_modes, |
| 5921 | .need_dac_fix = 1, |
| 5922 | .input_mux = &alc882_capture_source, |
| 5923 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5924 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5925 | [ALC885_MBP3] = { |
| 5926 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 5927 | .init_verbs = { alc885_mbp3_init_verbs, |
| 5928 | alc880_gpio1_init_verbs }, |
| 5929 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5930 | .dac_nids = alc882_dac_nids, |
| 5931 | .channel_mode = alc885_mbp_6ch_modes, |
| 5932 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 5933 | .input_mux = &alc882_capture_source, |
| 5934 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5935 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5936 | .unsol_event = alc885_mbp3_unsol_event, |
| 5937 | .init_hook = alc885_mbp3_automute, |
| 5938 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5939 | [ALC885_MACPRO] = { |
| 5940 | .mixers = { alc882_macpro_mixer }, |
| 5941 | .init_verbs = { alc882_macpro_init_verbs }, |
| 5942 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5943 | .dac_nids = alc882_dac_nids, |
| 5944 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5945 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5946 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5947 | .channel_mode = alc882_ch_modes, |
| 5948 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5949 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5950 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5951 | [ALC885_IMAC24] = { |
| 5952 | .mixers = { alc885_imac24_mixer }, |
| 5953 | .init_verbs = { alc885_imac24_init_verbs }, |
| 5954 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5955 | .dac_nids = alc882_dac_nids, |
| 5956 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5957 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5958 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5959 | .channel_mode = alc882_ch_modes, |
| 5960 | .input_mux = &alc882_capture_source, |
| 5961 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5962 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5963 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5964 | [ALC882_TARGA] = { |
| 5965 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 5966 | alc882_capture_mixer }, |
| 5967 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 5968 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5969 | .dac_nids = alc882_dac_nids, |
| 5970 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5971 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5972 | .adc_nids = alc882_adc_nids, |
| 5973 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5974 | .channel_mode = alc882_3ST_6ch_modes, |
| 5975 | .need_dac_fix = 1, |
| 5976 | .input_mux = &alc882_capture_source, |
| 5977 | .unsol_event = alc882_targa_unsol_event, |
| 5978 | .init_hook = alc882_targa_automute, |
| 5979 | }, |
| 5980 | [ALC882_ASUS_A7J] = { |
| 5981 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 5982 | alc882_capture_mixer }, |
| 5983 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 5984 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5985 | .dac_nids = alc882_dac_nids, |
| 5986 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5987 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5988 | .adc_nids = alc882_adc_nids, |
| 5989 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5990 | .channel_mode = alc882_3ST_6ch_modes, |
| 5991 | .need_dac_fix = 1, |
| 5992 | .input_mux = &alc882_capture_source, |
| 5993 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5994 | [ALC882_ASUS_A7M] = { |
| 5995 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 5996 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5997 | alc880_gpio1_init_verbs, |
| 5998 | alc882_asus_a7m_verbs }, |
| 5999 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6000 | .dac_nids = alc882_dac_nids, |
| 6001 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6002 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6003 | .channel_mode = alc880_threestack_modes, |
| 6004 | .need_dac_fix = 1, |
| 6005 | .input_mux = &alc882_capture_source, |
| 6006 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6007 | }; |
| 6008 | |
| 6009 | |
| 6010 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6011 | * Pin config fixes |
| 6012 | */ |
| 6013 | enum { |
| 6014 | PINFIX_ABIT_AW9D_MAX |
| 6015 | }; |
| 6016 | |
| 6017 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6018 | { 0x15, 0x01080104 }, /* side */ |
| 6019 | { 0x16, 0x01011012 }, /* rear */ |
| 6020 | { 0x17, 0x01016011 }, /* clfe */ |
| 6021 | { } |
| 6022 | }; |
| 6023 | |
| 6024 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6025 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6026 | }; |
| 6027 | |
| 6028 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6029 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6030 | {} |
| 6031 | }; |
| 6032 | |
| 6033 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6034 | * BIOS auto configuration |
| 6035 | */ |
| 6036 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6037 | hda_nid_t nid, int pin_type, |
| 6038 | int dac_idx) |
| 6039 | { |
| 6040 | /* set as output */ |
| 6041 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6042 | int idx; |
| 6043 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6044 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6045 | idx = 4; |
| 6046 | else |
| 6047 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 6048 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6049 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6050 | pin_type); |
| 6051 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 6052 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6053 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6054 | |
| 6055 | } |
| 6056 | |
| 6057 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6058 | { |
| 6059 | struct alc_spec *spec = codec->spec; |
| 6060 | int i; |
| 6061 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6062 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6063 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6064 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6065 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6066 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6067 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6068 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6069 | } |
| 6070 | } |
| 6071 | |
| 6072 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6073 | { |
| 6074 | struct alc_spec *spec = codec->spec; |
| 6075 | hda_nid_t pin; |
| 6076 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6077 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6078 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6079 | /* use dac 0 */ |
| 6080 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6081 | } |
| 6082 | |
| 6083 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6084 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6085 | |
| 6086 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6087 | { |
| 6088 | struct alc_spec *spec = codec->spec; |
| 6089 | int i; |
| 6090 | |
| 6091 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6092 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6093 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6094 | snd_hda_codec_write(codec, nid, 0, |
| 6095 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6096 | i <= AUTO_PIN_FRONT_MIC ? |
| 6097 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6098 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6099 | snd_hda_codec_write(codec, nid, 0, |
| 6100 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6101 | AMP_OUT_MUTE); |
| 6102 | } |
| 6103 | } |
| 6104 | } |
| 6105 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6106 | /* add mic boosts if needed */ |
| 6107 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6108 | { |
| 6109 | struct alc_spec *spec = codec->spec; |
| 6110 | int err; |
| 6111 | hda_nid_t nid; |
| 6112 | |
| 6113 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame^] | 6114 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6115 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6116 | "Mic Boost", |
| 6117 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6118 | if (err < 0) |
| 6119 | return err; |
| 6120 | } |
| 6121 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame^] | 6122 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6123 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6124 | "Front Mic Boost", |
| 6125 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6126 | if (err < 0) |
| 6127 | return err; |
| 6128 | } |
| 6129 | return 0; |
| 6130 | } |
| 6131 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6132 | /* almost identical with ALC880 parser... */ |
| 6133 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6134 | { |
| 6135 | struct alc_spec *spec = codec->spec; |
| 6136 | int err = alc880_parse_auto_config(codec); |
| 6137 | |
| 6138 | if (err < 0) |
| 6139 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6140 | else if (!err) |
| 6141 | return 0; /* no config found */ |
| 6142 | |
| 6143 | err = alc_auto_add_mic_boost(codec); |
| 6144 | if (err < 0) |
| 6145 | return err; |
| 6146 | |
| 6147 | /* hack - override the init verbs */ |
| 6148 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6149 | |
| 6150 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6151 | } |
| 6152 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6153 | /* additional initialization for auto-configuration model */ |
| 6154 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6155 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6156 | alc882_auto_init_multi_out(codec); |
| 6157 | alc882_auto_init_hp_out(codec); |
| 6158 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6159 | } |
| 6160 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6161 | static int patch_alc882(struct hda_codec *codec) |
| 6162 | { |
| 6163 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6164 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6165 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6166 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6167 | if (spec == NULL) |
| 6168 | return -ENOMEM; |
| 6169 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6170 | codec->spec = spec; |
| 6171 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6172 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6173 | alc882_models, |
| 6174 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6175 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6176 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6177 | /* Pick up systems that don't supply PCI SSID */ |
| 6178 | switch (codec->subsystem_id) { |
| 6179 | case 0x106b0c00: /* Mac Pro */ |
| 6180 | board_config = ALC885_MACPRO; |
| 6181 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6182 | case 0x106b1000: /* iMac 24 */ |
| 6183 | board_config = ALC885_IMAC24; |
| 6184 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6185 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6186 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6187 | board_config = ALC885_MBP3; |
| 6188 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6189 | default: |
| 6190 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6191 | "trying auto-probe from BIOS...\n"); |
| 6192 | board_config = ALC882_AUTO; |
| 6193 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6194 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6195 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6196 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6197 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6198 | if (board_config == ALC882_AUTO) { |
| 6199 | /* automatic parse from the BIOS config */ |
| 6200 | err = alc882_parse_auto_config(codec); |
| 6201 | if (err < 0) { |
| 6202 | alc_free(codec); |
| 6203 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6204 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6205 | printk(KERN_INFO |
| 6206 | "hda_codec: Cannot set up configuration " |
| 6207 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6208 | board_config = ALC882_3ST_DIG; |
| 6209 | } |
| 6210 | } |
| 6211 | |
| 6212 | if (board_config != ALC882_AUTO) |
| 6213 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6214 | |
| 6215 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6216 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6217 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6218 | |
| 6219 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6220 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6221 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6222 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6223 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6224 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6225 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6226 | /* get type */ |
| 6227 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6228 | if (wcap != AC_WID_AUD_IN) { |
| 6229 | spec->adc_nids = alc882_adc_nids_alt; |
| 6230 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6231 | spec->mixers[spec->num_mixers] = |
| 6232 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | spec->num_mixers++; |
| 6234 | } else { |
| 6235 | spec->adc_nids = alc882_adc_nids; |
| 6236 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 6237 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6238 | spec->num_mixers++; |
| 6239 | } |
| 6240 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6241 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6242 | spec->vmaster_nid = 0x0c; |
| 6243 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6244 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6245 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6246 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6247 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6248 | if (!spec->loopback.amplist) |
| 6249 | spec->loopback.amplist = alc882_loopbacks; |
| 6250 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6251 | |
| 6252 | return 0; |
| 6253 | } |
| 6254 | |
| 6255 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6256 | * ALC883 support |
| 6257 | * |
| 6258 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6259 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6260 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6261 | * 6-channel independent captures. |
| 6262 | * |
| 6263 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6264 | * driver yet). |
| 6265 | */ |
| 6266 | #define ALC883_DIGOUT_NID 0x06 |
| 6267 | #define ALC883_DIGIN_NID 0x0a |
| 6268 | |
| 6269 | static hda_nid_t alc883_dac_nids[4] = { |
| 6270 | /* front, rear, clfe, rear_surr */ |
| 6271 | 0x02, 0x04, 0x03, 0x05 |
| 6272 | }; |
| 6273 | |
| 6274 | static hda_nid_t alc883_adc_nids[2] = { |
| 6275 | /* ADC1-2 */ |
| 6276 | 0x08, 0x09, |
| 6277 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6278 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6279 | /* input MUX */ |
| 6280 | /* FIXME: should be a matrix-type input source selection */ |
| 6281 | |
| 6282 | static struct hda_input_mux alc883_capture_source = { |
| 6283 | .num_items = 4, |
| 6284 | .items = { |
| 6285 | { "Mic", 0x0 }, |
| 6286 | { "Front Mic", 0x1 }, |
| 6287 | { "Line", 0x2 }, |
| 6288 | { "CD", 0x4 }, |
| 6289 | }, |
| 6290 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6291 | |
| 6292 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6293 | .num_items = 2, |
| 6294 | .items = { |
| 6295 | { "Mic", 0x1 }, |
| 6296 | { "Line", 0x2 }, |
| 6297 | }, |
| 6298 | }; |
| 6299 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6300 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6301 | .num_items = 4, |
| 6302 | .items = { |
| 6303 | { "Mic", 0x0 }, |
| 6304 | { "iMic", 0x1 }, |
| 6305 | { "Line", 0x2 }, |
| 6306 | { "CD", 0x4 }, |
| 6307 | }, |
| 6308 | }; |
| 6309 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6310 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6311 | #define alc883_mux_enum_get alc_mux_enum_get |
| 6312 | |
| 6313 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 6314 | struct snd_ctl_elem_value *ucontrol) |
| 6315 | { |
| 6316 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6317 | struct alc_spec *spec = codec->spec; |
| 6318 | const struct hda_input_mux *imux = spec->input_mux; |
| 6319 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 6320 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 6321 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 6322 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 6323 | unsigned int i, idx; |
| 6324 | |
| 6325 | idx = ucontrol->value.enumerated.item[0]; |
| 6326 | if (idx >= imux->num_items) |
| 6327 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6328 | if (*cur_val == idx) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6329 | return 0; |
| 6330 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6331 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 6332 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6333 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6334 | HDA_AMP_MUTE, v); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6335 | } |
| 6336 | *cur_val = idx; |
| 6337 | return 1; |
| 6338 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6339 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6340 | /* |
| 6341 | * 2ch mode |
| 6342 | */ |
| 6343 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6344 | { 2, NULL } |
| 6345 | }; |
| 6346 | |
| 6347 | /* |
| 6348 | * 2ch mode |
| 6349 | */ |
| 6350 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6351 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6352 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6353 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6354 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6355 | { } /* end */ |
| 6356 | }; |
| 6357 | |
| 6358 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6359 | * 4ch mode |
| 6360 | */ |
| 6361 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6362 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6363 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6364 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6365 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6366 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6367 | { } /* end */ |
| 6368 | }; |
| 6369 | |
| 6370 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6371 | * 6ch mode |
| 6372 | */ |
| 6373 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6374 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6375 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6376 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6377 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6378 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6379 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6380 | { } /* end */ |
| 6381 | }; |
| 6382 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6383 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6384 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6385 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6386 | { 6, alc883_3ST_ch6_init }, |
| 6387 | }; |
| 6388 | |
| 6389 | /* |
| 6390 | * 6ch mode |
| 6391 | */ |
| 6392 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6393 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6394 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6395 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6396 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6397 | { } /* end */ |
| 6398 | }; |
| 6399 | |
| 6400 | /* |
| 6401 | * 8ch mode |
| 6402 | */ |
| 6403 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6404 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6405 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6406 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6407 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6408 | { } /* end */ |
| 6409 | }; |
| 6410 | |
| 6411 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6412 | { 6, alc883_sixstack_ch6_init }, |
| 6413 | { 8, alc883_sixstack_ch8_init }, |
| 6414 | }; |
| 6415 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6416 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6417 | /* eanable EAPD on medion laptop */ |
| 6418 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6419 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6420 | { } |
| 6421 | }; |
| 6422 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6423 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6424 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6425 | */ |
| 6426 | |
| 6427 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6428 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6429 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6430 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6431 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6432 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6433 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6434 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6435 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6436 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6437 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6438 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6439 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6440 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6441 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6442 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6443 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6444 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6445 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6446 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6447 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6448 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6449 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6450 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6451 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6452 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6453 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6454 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6455 | { |
| 6456 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6457 | /* .name = "Capture Source", */ |
| 6458 | .name = "Input Source", |
| 6459 | .count = 2, |
| 6460 | .info = alc883_mux_enum_info, |
| 6461 | .get = alc883_mux_enum_get, |
| 6462 | .put = alc883_mux_enum_put, |
| 6463 | }, |
| 6464 | { } /* end */ |
| 6465 | }; |
| 6466 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6467 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6468 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6469 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6470 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6471 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6472 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6473 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6474 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6475 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6476 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6477 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6478 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6479 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6480 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6481 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6482 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6483 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6484 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6485 | { |
| 6486 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6487 | /* .name = "Capture Source", */ |
| 6488 | .name = "Input Source", |
| 6489 | .count = 2, |
| 6490 | .info = alc883_mux_enum_info, |
| 6491 | .get = alc883_mux_enum_get, |
| 6492 | .put = alc883_mux_enum_put, |
| 6493 | }, |
| 6494 | { } /* end */ |
| 6495 | }; |
| 6496 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6497 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6498 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6499 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6500 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6501 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6502 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6503 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6504 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6505 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6506 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6508 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6509 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6510 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6511 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6512 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6513 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6514 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6515 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6516 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6517 | { |
| 6518 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6519 | /* .name = "Capture Source", */ |
| 6520 | .name = "Input Source", |
| 6521 | .count = 2, |
| 6522 | .info = alc883_mux_enum_info, |
| 6523 | .get = alc883_mux_enum_get, |
| 6524 | .put = alc883_mux_enum_put, |
| 6525 | }, |
| 6526 | { } /* end */ |
| 6527 | }; |
| 6528 | |
| 6529 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6530 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6531 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6532 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6533 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6534 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6535 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6536 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6537 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6538 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6539 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6540 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6541 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6542 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6543 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6544 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6545 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6546 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6547 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6548 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6549 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6550 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6551 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6552 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6553 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6554 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6555 | { |
| 6556 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6557 | /* .name = "Capture Source", */ |
| 6558 | .name = "Input Source", |
| 6559 | .count = 2, |
| 6560 | .info = alc883_mux_enum_info, |
| 6561 | .get = alc883_mux_enum_get, |
| 6562 | .put = alc883_mux_enum_put, |
| 6563 | }, |
| 6564 | { } /* end */ |
| 6565 | }; |
| 6566 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6567 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6568 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6569 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6570 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6571 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6572 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6573 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6574 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6575 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6576 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6577 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6578 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6579 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6580 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6581 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6582 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6583 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6584 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6585 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6586 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6587 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6588 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6589 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6590 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6591 | |
| 6592 | { |
| 6593 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6594 | /* .name = "Capture Source", */ |
| 6595 | .name = "Input Source", |
| 6596 | .count = 1, |
| 6597 | .info = alc883_mux_enum_info, |
| 6598 | .get = alc883_mux_enum_get, |
| 6599 | .put = alc883_mux_enum_put, |
| 6600 | }, |
| 6601 | { } /* end */ |
| 6602 | }; |
| 6603 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6604 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6605 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6606 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6607 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6608 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6609 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6610 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6611 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6612 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6613 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6614 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6615 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6616 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6617 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6619 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6620 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6621 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6622 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6623 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6624 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6625 | { |
| 6626 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6627 | /* .name = "Capture Source", */ |
| 6628 | .name = "Input Source", |
| 6629 | .count = 2, |
| 6630 | .info = alc883_mux_enum_info, |
| 6631 | .get = alc883_mux_enum_get, |
| 6632 | .put = alc883_mux_enum_put, |
| 6633 | }, |
| 6634 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6635 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6636 | |
| 6637 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6638 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6639 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6640 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6641 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6642 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6643 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6644 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6645 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6646 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6647 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6648 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6649 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6650 | { |
| 6651 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6652 | /* .name = "Capture Source", */ |
| 6653 | .name = "Input Source", |
| 6654 | .count = 2, |
| 6655 | .info = alc883_mux_enum_info, |
| 6656 | .get = alc883_mux_enum_get, |
| 6657 | .put = alc883_mux_enum_put, |
| 6658 | }, |
| 6659 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6660 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6661 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6662 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6663 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6664 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6665 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6666 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6669 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6670 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6671 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6672 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6673 | { |
| 6674 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6675 | /* .name = "Capture Source", */ |
| 6676 | .name = "Input Source", |
| 6677 | .count = 1, |
| 6678 | .info = alc883_mux_enum_info, |
| 6679 | .get = alc883_mux_enum_get, |
| 6680 | .put = alc883_mux_enum_put, |
| 6681 | }, |
| 6682 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6683 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6684 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6685 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6686 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6687 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6688 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6689 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6690 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6693 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6694 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6695 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6696 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6697 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6698 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6699 | { |
| 6700 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6701 | /* .name = "Capture Source", */ |
| 6702 | .name = "Input Source", |
| 6703 | .count = 2, |
| 6704 | .info = alc883_mux_enum_info, |
| 6705 | .get = alc883_mux_enum_get, |
| 6706 | .put = alc883_mux_enum_put, |
| 6707 | }, |
| 6708 | { } /* end */ |
| 6709 | }; |
| 6710 | |
| 6711 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6712 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6713 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6714 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6715 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6716 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6717 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6718 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6719 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6720 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6721 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6722 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6723 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6724 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6725 | { |
| 6726 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6727 | /* .name = "Capture Source", */ |
| 6728 | .name = "Input Source", |
| 6729 | .count = 2, |
| 6730 | .info = alc883_mux_enum_info, |
| 6731 | .get = alc883_mux_enum_get, |
| 6732 | .put = alc883_mux_enum_put, |
| 6733 | }, |
| 6734 | { } /* end */ |
| 6735 | }; |
| 6736 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6737 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6738 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6739 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6740 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6741 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6742 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6743 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6744 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6745 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6746 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6747 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6748 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6749 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6750 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6751 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6752 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6753 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6754 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6755 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6756 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6757 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6758 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6759 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6760 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6761 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6762 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6763 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6764 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6765 | { |
| 6766 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6767 | /* .name = "Capture Source", */ |
| 6768 | .name = "Input Source", |
| 6769 | .count = 2, |
| 6770 | .info = alc883_mux_enum_info, |
| 6771 | .get = alc883_mux_enum_get, |
| 6772 | .put = alc883_mux_enum_put, |
| 6773 | }, |
| 6774 | { } /* end */ |
| 6775 | }; |
| 6776 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6777 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6779 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6780 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6781 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6782 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6783 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6784 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6785 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6786 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6787 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6788 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6789 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6790 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6791 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6792 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6793 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6794 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6795 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6796 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6797 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6798 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6799 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6800 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6801 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6802 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6803 | { |
| 6804 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6805 | /* .name = "Capture Source", */ |
| 6806 | .name = "Input Source", |
| 6807 | .count = 2, |
| 6808 | .info = alc883_mux_enum_info, |
| 6809 | .get = alc883_mux_enum_get, |
| 6810 | .put = alc883_mux_enum_put, |
| 6811 | }, |
| 6812 | { } /* end */ |
| 6813 | }; |
| 6814 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6815 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6816 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6817 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6818 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6819 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6820 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6822 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6823 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6824 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6825 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6826 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6827 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6828 | { |
| 6829 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6830 | /* .name = "Capture Source", */ |
| 6831 | .name = "Input Source", |
| 6832 | .count = 2, |
| 6833 | .info = alc883_mux_enum_info, |
| 6834 | .get = alc883_mux_enum_get, |
| 6835 | .put = alc883_mux_enum_put, |
| 6836 | }, |
| 6837 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6838 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6839 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6840 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 6841 | { |
| 6842 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6843 | .name = "Channel Mode", |
| 6844 | .info = alc_ch_mode_info, |
| 6845 | .get = alc_ch_mode_get, |
| 6846 | .put = alc_ch_mode_put, |
| 6847 | }, |
| 6848 | { } /* end */ |
| 6849 | }; |
| 6850 | |
| 6851 | static struct hda_verb alc883_init_verbs[] = { |
| 6852 | /* ADC1: mute amp left and right */ |
| 6853 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6854 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6855 | /* ADC2: mute amp left and right */ |
| 6856 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6857 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6858 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6859 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6860 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6861 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6862 | /* Rear mixer */ |
| 6863 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6864 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6865 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6866 | /* CLFE mixer */ |
| 6867 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6868 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6869 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6870 | /* Side mixer */ |
| 6871 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6872 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6873 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6874 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6875 | /* mute analog input loopbacks */ |
| 6876 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6877 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6878 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6879 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6880 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6881 | |
| 6882 | /* Front Pin: output 0 (0x0c) */ |
| 6883 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6884 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6885 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6886 | /* Rear Pin: output 1 (0x0d) */ |
| 6887 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6888 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6889 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6890 | /* CLFE Pin: output 2 (0x0e) */ |
| 6891 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6892 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6893 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6894 | /* Side Pin: output 3 (0x0f) */ |
| 6895 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6896 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6897 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 6898 | /* Mic (rear) pin: input vref at 80% */ |
| 6899 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6900 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6901 | /* Front Mic pin: input vref at 80% */ |
| 6902 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6903 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6904 | /* Line In pin: input */ |
| 6905 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6906 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6907 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6908 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6909 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6910 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6911 | /* CD pin widget for input */ |
| 6912 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6913 | |
| 6914 | /* FIXME: use matrix-type input source selection */ |
| 6915 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6916 | /* Input mixer2 */ |
| 6917 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6918 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6919 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6920 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6921 | /* Input mixer3 */ |
| 6922 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6923 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6924 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6925 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6926 | { } |
| 6927 | }; |
| 6928 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6929 | /* toggle speaker-output according to the hp-jack state */ |
| 6930 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 6931 | { |
| 6932 | unsigned int present; |
| 6933 | |
| 6934 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6935 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6936 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6937 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6938 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 6939 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6940 | } |
| 6941 | |
| 6942 | /* auto-toggle front mic */ |
| 6943 | /* |
| 6944 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 6945 | { |
| 6946 | unsigned int present; |
| 6947 | unsigned char bits; |
| 6948 | |
| 6949 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 6950 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6951 | bits = present ? HDA_AMP_MUTE : 0; |
| 6952 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 6953 | } |
| 6954 | */ |
| 6955 | |
| 6956 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 6957 | { |
| 6958 | alc883_mitac_hp_automute(codec); |
| 6959 | /* alc883_mitac_mic_automute(codec); */ |
| 6960 | } |
| 6961 | |
| 6962 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 6963 | unsigned int res) |
| 6964 | { |
| 6965 | switch (res >> 26) { |
| 6966 | case ALC880_HP_EVENT: |
| 6967 | alc883_mitac_hp_automute(codec); |
| 6968 | break; |
| 6969 | case ALC880_MIC_EVENT: |
| 6970 | /* alc883_mitac_mic_automute(codec); */ |
| 6971 | break; |
| 6972 | } |
| 6973 | } |
| 6974 | |
| 6975 | static struct hda_verb alc883_mitac_verbs[] = { |
| 6976 | /* HP */ |
| 6977 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6978 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6979 | /* Subwoofer */ |
| 6980 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6981 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6982 | |
| 6983 | /* enable unsolicited event */ |
| 6984 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6985 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 6986 | |
| 6987 | { } /* end */ |
| 6988 | }; |
| 6989 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6990 | static struct hda_verb alc883_tagra_verbs[] = { |
| 6991 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6992 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6993 | |
| 6994 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6995 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6996 | |
| 6997 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6998 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6999 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7000 | |
| 7001 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7002 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7003 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7004 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7005 | |
| 7006 | { } /* end */ |
| 7007 | }; |
| 7008 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7009 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7010 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7011 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7012 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7013 | { } /* end */ |
| 7014 | }; |
| 7015 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7016 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7017 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7018 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7019 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7020 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7021 | { } /* end */ |
| 7022 | }; |
| 7023 | |
| 7024 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7027 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7028 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7029 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7030 | { } /* end */ |
| 7031 | }; |
| 7032 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7033 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7035 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7036 | |
| 7037 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7038 | |
| 7039 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7040 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7041 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7042 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7043 | { } /* end */ |
| 7044 | }; |
| 7045 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7046 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7047 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7048 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 7049 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 7050 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7051 | { } |
| 7052 | }; |
| 7053 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7054 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7055 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7056 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7057 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 7058 | { } |
| 7059 | }; |
| 7060 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7061 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7062 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7063 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7064 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7065 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7066 | { } |
| 7067 | }; |
| 7068 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7069 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7070 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7071 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7072 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7073 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7074 | { } |
| 7075 | }; |
| 7076 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7077 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7078 | { 2, alc888_3st_hp_2ch_init }, |
| 7079 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7080 | }; |
| 7081 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7082 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7083 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7084 | { |
| 7085 | unsigned int present; |
| 7086 | |
| 7087 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7088 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7089 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7090 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7091 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7092 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7093 | } |
| 7094 | |
| 7095 | /* toggle RCA according to the front-jack state */ |
| 7096 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7097 | { |
| 7098 | unsigned int present; |
| 7099 | |
| 7100 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7101 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7102 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7103 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7104 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7105 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7106 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7107 | unsigned int res) |
| 7108 | { |
| 7109 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7110 | alc888_lenovo_ms7195_front_automute(codec); |
| 7111 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7112 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7113 | } |
| 7114 | |
| 7115 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7118 | |
| 7119 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7120 | |
| 7121 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7122 | { } /* end */ |
| 7123 | }; |
| 7124 | |
| 7125 | /* toggle speaker-output according to the hp-jack state */ |
| 7126 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7127 | { |
| 7128 | unsigned int present; |
| 7129 | |
| 7130 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7131 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7132 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7133 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7134 | } |
| 7135 | |
| 7136 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7137 | unsigned int res) |
| 7138 | { |
| 7139 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7140 | alc883_medion_md2_automute(codec); |
| 7141 | } |
| 7142 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7143 | /* toggle speaker-output according to the hp-jack state */ |
| 7144 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7145 | { |
| 7146 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7147 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7148 | |
| 7149 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7150 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7151 | bits = present ? HDA_AMP_MUTE : 0; |
| 7152 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7153 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7154 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7155 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7156 | } |
| 7157 | |
| 7158 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7159 | { |
| 7160 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7161 | alc883_tagra_automute(codec); |
| 7162 | } |
| 7163 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7164 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7165 | { |
| 7166 | unsigned int present; |
| 7167 | unsigned char bits; |
| 7168 | |
| 7169 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7170 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7171 | bits = present ? 0x80 : 0; |
| 7172 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7173 | 0x80, bits); |
| 7174 | } |
| 7175 | |
| 7176 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7177 | unsigned int res) |
| 7178 | { |
| 7179 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7180 | alc883_haier_w66_automute(codec); |
| 7181 | } |
| 7182 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7183 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7184 | { |
| 7185 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7186 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7187 | |
| 7188 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7189 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7190 | bits = present ? HDA_AMP_MUTE : 0; |
| 7191 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7192 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7193 | } |
| 7194 | |
| 7195 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7196 | { |
| 7197 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7198 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7199 | |
| 7200 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7201 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7202 | bits = present ? HDA_AMP_MUTE : 0; |
| 7203 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7204 | HDA_AMP_MUTE, bits); |
| 7205 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7206 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7207 | } |
| 7208 | |
| 7209 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7210 | unsigned int res) |
| 7211 | { |
| 7212 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7213 | alc883_lenovo_101e_all_automute(codec); |
| 7214 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7215 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7216 | } |
| 7217 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7218 | /* toggle speaker-output according to the hp-jack state */ |
| 7219 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7220 | { |
| 7221 | unsigned int present; |
| 7222 | |
| 7223 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7224 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7225 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7226 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7227 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7228 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7229 | } |
| 7230 | |
| 7231 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7232 | unsigned int res) |
| 7233 | { |
| 7234 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7235 | alc883_acer_aspire_automute(codec); |
| 7236 | } |
| 7237 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7238 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7239 | /* HP Pin: output 0 (0x0c) */ |
| 7240 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7241 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7242 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7243 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7244 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7245 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7246 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7247 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7248 | /* eanable EAPD on medion laptop */ |
| 7249 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7250 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7251 | /* enable unsolicited event */ |
| 7252 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7253 | { } |
| 7254 | }; |
| 7255 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7256 | /* |
| 7257 | * generic initialization of ADC, input mixers and output mixers |
| 7258 | */ |
| 7259 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7260 | /* |
| 7261 | * Unmute ADC0-2 and set the default input to mic-in |
| 7262 | */ |
| 7263 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7264 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7265 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7266 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7267 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7268 | /* 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] | 7269 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7270 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7271 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7272 | */ |
| 7273 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7274 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7275 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7276 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7277 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7278 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7279 | |
| 7280 | /* |
| 7281 | * Set up output mixers (0x0c - 0x0f) |
| 7282 | */ |
| 7283 | /* set vol=0 to output mixers */ |
| 7284 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7285 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7286 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7287 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7288 | /* set up input amps for analog loopback */ |
| 7289 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7290 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7291 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7292 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7293 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7294 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7295 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7296 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7297 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7298 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7299 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7300 | |
| 7301 | /* FIXME: use matrix-type input source selection */ |
| 7302 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7303 | /* Input mixer1 */ |
| 7304 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7305 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7306 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7307 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7308 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7309 | /* Input mixer2 */ |
| 7310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7311 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7312 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7313 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7315 | |
| 7316 | { } |
| 7317 | }; |
| 7318 | |
| 7319 | /* capture mixer elements */ |
| 7320 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7321 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7322 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7323 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7324 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7325 | { |
| 7326 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7327 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7328 | * So call somewhat different.. |
| 7329 | * FIXME: the controls appear in the "playback" view! |
| 7330 | */ |
| 7331 | /* .name = "Capture Source", */ |
| 7332 | .name = "Input Source", |
| 7333 | .count = 2, |
| 7334 | .info = alc882_mux_enum_info, |
| 7335 | .get = alc882_mux_enum_get, |
| 7336 | .put = alc882_mux_enum_put, |
| 7337 | }, |
| 7338 | { } /* end */ |
| 7339 | }; |
| 7340 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7341 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7342 | #define alc883_loopbacks alc880_loopbacks |
| 7343 | #endif |
| 7344 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7345 | /* pcm configuration: identiacal with ALC880 */ |
| 7346 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7347 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 7348 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7349 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7350 | |
| 7351 | /* |
| 7352 | * configuration and preset |
| 7353 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7354 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7355 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7356 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7357 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7358 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7359 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7360 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7361 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7362 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7363 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7364 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7365 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7366 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7367 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7368 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7369 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7370 | [ALC888_6ST_HP] = "6stack-hp", |
| 7371 | [ALC888_3ST_HP] = "3stack-hp", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7372 | [ALC883_MITAC] = "mitac", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7373 | [ALC883_AUTO] = "auto", |
| 7374 | }; |
| 7375 | |
| 7376 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7377 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7378 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7379 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7380 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7381 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7382 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7383 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7384 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 7385 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 7386 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7387 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7388 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7389 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7390 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7391 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7392 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7393 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7394 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 7395 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
| 7396 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7397 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7398 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7399 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7400 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7401 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7402 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7403 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7404 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7405 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7406 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7407 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7408 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7409 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7410 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7411 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
| 7412 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7413 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7414 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7415 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7416 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7417 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7418 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7419 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7420 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7421 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7422 | {} |
| 7423 | }; |
| 7424 | |
| 7425 | static struct alc_config_preset alc883_presets[] = { |
| 7426 | [ALC883_3ST_2ch_DIG] = { |
| 7427 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7428 | .init_verbs = { alc883_init_verbs }, |
| 7429 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7430 | .dac_nids = alc883_dac_nids, |
| 7431 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7432 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7433 | .adc_nids = alc883_adc_nids, |
| 7434 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7435 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7436 | .channel_mode = alc883_3ST_2ch_modes, |
| 7437 | .input_mux = &alc883_capture_source, |
| 7438 | }, |
| 7439 | [ALC883_3ST_6ch_DIG] = { |
| 7440 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7441 | .init_verbs = { alc883_init_verbs }, |
| 7442 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7443 | .dac_nids = alc883_dac_nids, |
| 7444 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7445 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7446 | .adc_nids = alc883_adc_nids, |
| 7447 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7448 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7449 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7450 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7451 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7452 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7453 | [ALC883_3ST_6ch] = { |
| 7454 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7455 | .init_verbs = { alc883_init_verbs }, |
| 7456 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7457 | .dac_nids = alc883_dac_nids, |
| 7458 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7459 | .adc_nids = alc883_adc_nids, |
| 7460 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7461 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7462 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7463 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7464 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7465 | [ALC883_6ST_DIG] = { |
| 7466 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7467 | .init_verbs = { alc883_init_verbs }, |
| 7468 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7469 | .dac_nids = alc883_dac_nids, |
| 7470 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7471 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7472 | .adc_nids = alc883_adc_nids, |
| 7473 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7474 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7475 | .channel_mode = alc883_sixstack_modes, |
| 7476 | .input_mux = &alc883_capture_source, |
| 7477 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7478 | [ALC883_TARGA_DIG] = { |
| 7479 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7480 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7481 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7482 | .dac_nids = alc883_dac_nids, |
| 7483 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7484 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7485 | .adc_nids = alc883_adc_nids, |
| 7486 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7487 | .channel_mode = alc883_3ST_6ch_modes, |
| 7488 | .need_dac_fix = 1, |
| 7489 | .input_mux = &alc883_capture_source, |
| 7490 | .unsol_event = alc883_tagra_unsol_event, |
| 7491 | .init_hook = alc883_tagra_automute, |
| 7492 | }, |
| 7493 | [ALC883_TARGA_2ch_DIG] = { |
| 7494 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7495 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7496 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7497 | .dac_nids = alc883_dac_nids, |
| 7498 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7499 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7500 | .adc_nids = alc883_adc_nids, |
| 7501 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7502 | .channel_mode = alc883_3ST_2ch_modes, |
| 7503 | .input_mux = &alc883_capture_source, |
| 7504 | .unsol_event = alc883_tagra_unsol_event, |
| 7505 | .init_hook = alc883_tagra_automute, |
| 7506 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7507 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7508 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7509 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7510 | * and the headphone jack. Turn this on and rely on the |
| 7511 | * standard mute methods whenever the user wants to turn |
| 7512 | * these outputs off. |
| 7513 | */ |
| 7514 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7515 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7516 | .dac_nids = alc883_dac_nids, |
| 7517 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7518 | .adc_nids = alc883_adc_nids, |
| 7519 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7520 | .channel_mode = alc883_3ST_2ch_modes, |
| 7521 | .input_mux = &alc883_capture_source, |
| 7522 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7523 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7524 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7525 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7526 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7527 | .dac_nids = alc883_dac_nids, |
| 7528 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7529 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7530 | .adc_nids = alc883_adc_nids, |
| 7531 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7532 | .channel_mode = alc883_3ST_2ch_modes, |
| 7533 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7534 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7535 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7536 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7537 | [ALC883_MEDION] = { |
| 7538 | .mixers = { alc883_fivestack_mixer, |
| 7539 | alc883_chmode_mixer }, |
| 7540 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7541 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7542 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7543 | .dac_nids = alc883_dac_nids, |
| 7544 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7545 | .adc_nids = alc883_adc_nids, |
| 7546 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7547 | .channel_mode = alc883_sixstack_modes, |
| 7548 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7549 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7550 | [ALC883_MEDION_MD2] = { |
| 7551 | .mixers = { alc883_medion_md2_mixer}, |
| 7552 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7553 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7554 | .dac_nids = alc883_dac_nids, |
| 7555 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7556 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7557 | .adc_nids = alc883_adc_nids, |
| 7558 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7559 | .channel_mode = alc883_3ST_2ch_modes, |
| 7560 | .input_mux = &alc883_capture_source, |
| 7561 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7562 | .init_hook = alc883_medion_md2_automute, |
| 7563 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7564 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7565 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7566 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7567 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7568 | .dac_nids = alc883_dac_nids, |
| 7569 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7570 | .adc_nids = alc883_adc_nids, |
| 7571 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7572 | .channel_mode = alc883_3ST_2ch_modes, |
| 7573 | .input_mux = &alc883_capture_source, |
| 7574 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7575 | [ALC883_LENOVO_101E_2ch] = { |
| 7576 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7577 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7578 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7579 | .dac_nids = alc883_dac_nids, |
| 7580 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7581 | .adc_nids = alc883_adc_nids, |
| 7582 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7583 | .channel_mode = alc883_3ST_2ch_modes, |
| 7584 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7585 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7586 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7587 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7588 | [ALC883_LENOVO_NB0763] = { |
| 7589 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7590 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7591 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7592 | .dac_nids = alc883_dac_nids, |
| 7593 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7594 | .adc_nids = alc883_adc_nids, |
| 7595 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7596 | .channel_mode = alc883_3ST_2ch_modes, |
| 7597 | .need_dac_fix = 1, |
| 7598 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7599 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7600 | .init_hook = alc883_medion_md2_automute, |
| 7601 | }, |
| 7602 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7603 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7604 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7605 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7606 | .dac_nids = alc883_dac_nids, |
| 7607 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7608 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7609 | .adc_nids = alc883_adc_nids, |
| 7610 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7611 | .channel_mode = alc883_3ST_6ch_modes, |
| 7612 | .need_dac_fix = 1, |
| 7613 | .input_mux = &alc883_capture_source, |
| 7614 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7615 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7616 | }, |
| 7617 | [ALC883_HAIER_W66] = { |
| 7618 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7619 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7620 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7621 | .dac_nids = alc883_dac_nids, |
| 7622 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7623 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7624 | .adc_nids = alc883_adc_nids, |
| 7625 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7626 | .channel_mode = alc883_3ST_2ch_modes, |
| 7627 | .input_mux = &alc883_capture_source, |
| 7628 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7629 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7630 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7631 | [ALC888_6ST_HP] = { |
| 7632 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 7633 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7634 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7635 | .dac_nids = alc883_dac_nids, |
| 7636 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7637 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7638 | .adc_nids = alc883_adc_nids, |
| 7639 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7640 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7641 | .channel_mode = alc883_sixstack_modes, |
| 7642 | .input_mux = &alc883_capture_source, |
| 7643 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7644 | [ALC888_3ST_HP] = { |
| 7645 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7646 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7647 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7648 | .dac_nids = alc883_dac_nids, |
| 7649 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7650 | .adc_nids = alc883_adc_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7651 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7652 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7653 | .need_dac_fix = 1, |
| 7654 | .input_mux = &alc883_capture_source, |
| 7655 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7656 | [ALC883_MITAC] = { |
| 7657 | .mixers = { alc883_mitac_mixer }, |
| 7658 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 7659 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7660 | .dac_nids = alc883_dac_nids, |
| 7661 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7662 | .adc_nids = alc883_adc_nids, |
| 7663 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7664 | .channel_mode = alc883_3ST_2ch_modes, |
| 7665 | .input_mux = &alc883_capture_source, |
| 7666 | .unsol_event = alc883_mitac_unsol_event, |
| 7667 | .init_hook = alc883_mitac_automute, |
| 7668 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7669 | }; |
| 7670 | |
| 7671 | |
| 7672 | /* |
| 7673 | * BIOS auto configuration |
| 7674 | */ |
| 7675 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7676 | hda_nid_t nid, int pin_type, |
| 7677 | int dac_idx) |
| 7678 | { |
| 7679 | /* set as output */ |
| 7680 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7681 | int idx; |
| 7682 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7683 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7684 | idx = 4; |
| 7685 | else |
| 7686 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 7687 | |
| 7688 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7689 | pin_type); |
| 7690 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7691 | AMP_OUT_UNMUTE); |
| 7692 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7693 | |
| 7694 | } |
| 7695 | |
| 7696 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 7697 | { |
| 7698 | struct alc_spec *spec = codec->spec; |
| 7699 | int i; |
| 7700 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7701 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7702 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7703 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7704 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7705 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7706 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7707 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7708 | } |
| 7709 | } |
| 7710 | |
| 7711 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 7712 | { |
| 7713 | struct alc_spec *spec = codec->spec; |
| 7714 | hda_nid_t pin; |
| 7715 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7716 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7717 | if (pin) /* connect to front */ |
| 7718 | /* use dac 0 */ |
| 7719 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 7720 | } |
| 7721 | |
| 7722 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7723 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 7724 | |
| 7725 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 7726 | { |
| 7727 | struct alc_spec *spec = codec->spec; |
| 7728 | int i; |
| 7729 | |
| 7730 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7731 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 7732 | if (alc883_is_input_pin(nid)) { |
| 7733 | snd_hda_codec_write(codec, nid, 0, |
| 7734 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7735 | (i <= AUTO_PIN_FRONT_MIC ? |
| 7736 | PIN_VREF80 : PIN_IN)); |
| 7737 | if (nid != ALC883_PIN_CD_NID) |
| 7738 | snd_hda_codec_write(codec, nid, 0, |
| 7739 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7740 | AMP_OUT_MUTE); |
| 7741 | } |
| 7742 | } |
| 7743 | } |
| 7744 | |
| 7745 | /* almost identical with ALC880 parser... */ |
| 7746 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 7747 | { |
| 7748 | struct alc_spec *spec = codec->spec; |
| 7749 | int err = alc880_parse_auto_config(codec); |
| 7750 | |
| 7751 | if (err < 0) |
| 7752 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7753 | else if (!err) |
| 7754 | return 0; /* no config found */ |
| 7755 | |
| 7756 | err = alc_auto_add_mic_boost(codec); |
| 7757 | if (err < 0) |
| 7758 | return err; |
| 7759 | |
| 7760 | /* hack - override the init verbs */ |
| 7761 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7762 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 7763 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7764 | |
| 7765 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7766 | } |
| 7767 | |
| 7768 | /* additional initialization for auto-configuration model */ |
| 7769 | static void alc883_auto_init(struct hda_codec *codec) |
| 7770 | { |
| 7771 | alc883_auto_init_multi_out(codec); |
| 7772 | alc883_auto_init_hp_out(codec); |
| 7773 | alc883_auto_init_analog_input(codec); |
| 7774 | } |
| 7775 | |
| 7776 | static int patch_alc883(struct hda_codec *codec) |
| 7777 | { |
| 7778 | struct alc_spec *spec; |
| 7779 | int err, board_config; |
| 7780 | |
| 7781 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 7782 | if (spec == NULL) |
| 7783 | return -ENOMEM; |
| 7784 | |
| 7785 | codec->spec = spec; |
| 7786 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7787 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 7788 | alc883_models, |
| 7789 | alc883_cfg_tbl); |
| 7790 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7791 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 7792 | "trying auto-probe from BIOS...\n"); |
| 7793 | board_config = ALC883_AUTO; |
| 7794 | } |
| 7795 | |
| 7796 | if (board_config == ALC883_AUTO) { |
| 7797 | /* automatic parse from the BIOS config */ |
| 7798 | err = alc883_parse_auto_config(codec); |
| 7799 | if (err < 0) { |
| 7800 | alc_free(codec); |
| 7801 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7802 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7803 | printk(KERN_INFO |
| 7804 | "hda_codec: Cannot set up configuration " |
| 7805 | "from BIOS. Using base mode...\n"); |
| 7806 | board_config = ALC883_3ST_2ch_DIG; |
| 7807 | } |
| 7808 | } |
| 7809 | |
| 7810 | if (board_config != ALC883_AUTO) |
| 7811 | setup_preset(spec, &alc883_presets[board_config]); |
| 7812 | |
| 7813 | spec->stream_name_analog = "ALC883 Analog"; |
| 7814 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 7815 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 7816 | |
| 7817 | spec->stream_name_digital = "ALC883 Digital"; |
| 7818 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 7819 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 7820 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7821 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7822 | spec->adc_nids = alc883_adc_nids; |
| 7823 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 7824 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7825 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7826 | spec->vmaster_nid = 0x0c; |
| 7827 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7828 | codec->patch_ops = alc_patch_ops; |
| 7829 | if (board_config == ALC883_AUTO) |
| 7830 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7831 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7832 | if (!spec->loopback.amplist) |
| 7833 | spec->loopback.amplist = alc883_loopbacks; |
| 7834 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7835 | |
| 7836 | return 0; |
| 7837 | } |
| 7838 | |
| 7839 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7840 | * ALC262 support |
| 7841 | */ |
| 7842 | |
| 7843 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 7844 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 7845 | |
| 7846 | #define alc262_dac_nids alc260_dac_nids |
| 7847 | #define alc262_adc_nids alc882_adc_nids |
| 7848 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 7849 | |
| 7850 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 7851 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7852 | |
| 7853 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 7854 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7855 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7856 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7857 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7858 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7859 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7860 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7861 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7862 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7863 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7864 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7865 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7866 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7867 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7868 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 7869 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7870 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7871 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7872 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7873 | }; |
| 7874 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7875 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 7876 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7877 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7878 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7879 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7880 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7881 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7884 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7885 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7886 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7887 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7888 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7889 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7890 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 7891 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7892 | { } /* end */ |
| 7893 | }; |
| 7894 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7895 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 7896 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7897 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7898 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7899 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7900 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7901 | |
| 7902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7904 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7905 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7906 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7907 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7908 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7909 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7910 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7911 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7912 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7913 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7914 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 7915 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 7916 | { } /* end */ |
| 7917 | }; |
| 7918 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7919 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
| 7920 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7921 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7922 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7923 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7924 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7925 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7926 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7927 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7928 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7929 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7930 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7931 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7932 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7933 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7934 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7935 | { } /* end */ |
| 7936 | }; |
| 7937 | |
| 7938 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 7939 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7940 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7941 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7942 | { } /* end */ |
| 7943 | }; |
| 7944 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 7945 | static struct hda_bind_ctls alc262_hp_t5735_bind_front_vol = { |
| 7946 | .ops = &snd_hda_bind_vol, |
| 7947 | .values = { |
| 7948 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 7949 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 7950 | 0 |
| 7951 | }, |
| 7952 | }; |
| 7953 | |
| 7954 | static struct hda_bind_ctls alc262_hp_t5735_bind_front_sw = { |
| 7955 | .ops = &snd_hda_bind_sw, |
| 7956 | .values = { |
| 7957 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7958 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 7959 | 0 |
| 7960 | }, |
| 7961 | }; |
| 7962 | |
| 7963 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 7964 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 7965 | { |
| 7966 | struct alc_spec *spec = codec->spec; |
| 7967 | unsigned int mute; |
| 7968 | |
| 7969 | if (force || !spec->sense_updated) { |
| 7970 | unsigned int present; |
| 7971 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7972 | AC_VERB_GET_PIN_SENSE, 0); |
| 7973 | spec->jack_present = (present & 0x80000000) != 0; |
| 7974 | spec->sense_updated = 1; |
| 7975 | } |
| 7976 | if (spec->jack_present) |
| 7977 | mute = (0x7080 | ((0)<<8)); /* mute internal speaker */ |
| 7978 | else /* unmute internal speaker if necessary */ |
| 7979 | mute = (0x7000 | ((0)<<8)); |
| 7980 | snd_hda_codec_write(codec, 0x0c, 0, |
| 7981 | AC_VERB_SET_AMP_GAIN_MUTE, mute ); |
| 7982 | } |
| 7983 | |
| 7984 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 7985 | unsigned int res) |
| 7986 | { |
| 7987 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7988 | return; |
| 7989 | alc262_hp_t5735_automute(codec, 1); |
| 7990 | } |
| 7991 | |
| 7992 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 7993 | { |
| 7994 | alc262_hp_t5735_automute(codec, 1); |
| 7995 | } |
| 7996 | |
| 7997 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
| 7998 | HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_t5735_bind_front_vol), |
| 7999 | HDA_BIND_SW("PCM Playback Switch",&alc262_hp_t5735_bind_front_sw), |
| 8000 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8001 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8002 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8003 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8004 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8005 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8006 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8007 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8008 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8009 | { } /* end */ |
| 8010 | }; |
| 8011 | |
| 8012 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8013 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8014 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8015 | |
| 8016 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8017 | { } |
| 8018 | }; |
| 8019 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8020 | static struct hda_bind_ctls alc262_hp_rp5700_bind_front_vol = { |
| 8021 | .ops = &snd_hda_bind_vol, |
| 8022 | .values = { |
| 8023 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8024 | HDA_COMPOSE_AMP_VAL(0x0e, 3, 0, HDA_OUTPUT), |
| 8025 | 0 |
| 8026 | }, |
| 8027 | }; |
| 8028 | |
| 8029 | static struct hda_bind_ctls alc262_hp_rp5700_bind_front_sw = { |
| 8030 | .ops = &snd_hda_bind_sw, |
| 8031 | .values = { |
| 8032 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 8033 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 8034 | 0 |
| 8035 | }, |
| 8036 | }; |
| 8037 | |
| 8038 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
| 8039 | HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_rp5700_bind_front_vol), |
| 8040 | HDA_BIND_SW("PCM Playback Switch", &alc262_hp_rp5700_bind_front_sw), |
| 8041 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8042 | HDA_CODEC_MUTE("Master Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8043 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8044 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8046 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8047 | { } /* end */ |
| 8048 | }; |
| 8049 | |
| 8050 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8051 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8052 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8053 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8054 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8055 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8056 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8058 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8061 | {} |
| 8062 | }; |
| 8063 | |
| 8064 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8065 | .num_items = 1, |
| 8066 | .items = { |
| 8067 | { "Line", 0x1 }, |
| 8068 | }, |
| 8069 | }; |
| 8070 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8071 | /* bind hp and internal speaker mute (with plug check) */ |
| 8072 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8073 | struct snd_ctl_elem_value *ucontrol) |
| 8074 | { |
| 8075 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8076 | long *valp = ucontrol->value.integer.value; |
| 8077 | int change; |
| 8078 | |
| 8079 | /* change hp mute */ |
| 8080 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8081 | HDA_AMP_MUTE, |
| 8082 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8083 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8084 | HDA_AMP_MUTE, |
| 8085 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8086 | if (change) { |
| 8087 | /* change speaker according to HP jack state */ |
| 8088 | struct alc_spec *spec = codec->spec; |
| 8089 | unsigned int mute; |
| 8090 | if (spec->jack_present) |
| 8091 | mute = HDA_AMP_MUTE; |
| 8092 | else |
| 8093 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8094 | HDA_OUTPUT, 0); |
| 8095 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8096 | HDA_AMP_MUTE, mute); |
| 8097 | } |
| 8098 | return change; |
| 8099 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8100 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8101 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8102 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8103 | { |
| 8104 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8105 | .name = "Master Playback Switch", |
| 8106 | .info = snd_hda_mixer_amp_switch_info, |
| 8107 | .get = snd_hda_mixer_amp_switch_get, |
| 8108 | .put = alc262_sony_master_sw_put, |
| 8109 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8110 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8113 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8114 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8115 | { } /* end */ |
| 8116 | }; |
| 8117 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8118 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8119 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8120 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8121 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8124 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8125 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8126 | { } /* end */ |
| 8127 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8128 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8129 | #define alc262_capture_mixer alc882_capture_mixer |
| 8130 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8131 | |
| 8132 | /* |
| 8133 | * generic initialization of ADC, input mixers and output mixers |
| 8134 | */ |
| 8135 | static struct hda_verb alc262_init_verbs[] = { |
| 8136 | /* |
| 8137 | * Unmute ADC0-2 and set the default input to mic-in |
| 8138 | */ |
| 8139 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8140 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8141 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8142 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8143 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8144 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8145 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8146 | /* 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] | 8147 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8148 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8149 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8150 | */ |
| 8151 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8152 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8153 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8154 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8155 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8156 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8157 | |
| 8158 | /* |
| 8159 | * Set up output mixers (0x0c - 0x0e) |
| 8160 | */ |
| 8161 | /* set vol=0 to output mixers */ |
| 8162 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8163 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8164 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8165 | /* set up input amps for analog loopback */ |
| 8166 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8167 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8168 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8169 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8170 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8171 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8172 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8173 | |
| 8174 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8175 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8176 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8177 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8178 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8179 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8180 | |
| 8181 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8182 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8183 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8184 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8185 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8186 | |
| 8187 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8188 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8189 | |
| 8190 | /* FIXME: use matrix-type input source selection */ |
| 8191 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8192 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8197 | /* Input mixer2 */ |
| 8198 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8199 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8200 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8201 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8202 | /* Input mixer3 */ |
| 8203 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8204 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8205 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8206 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8207 | |
| 8208 | { } |
| 8209 | }; |
| 8210 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8211 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8212 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8213 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8214 | {} |
| 8215 | }; |
| 8216 | |
| 8217 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8219 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8220 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8221 | |
| 8222 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8223 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8224 | {} |
| 8225 | }; |
| 8226 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8227 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8228 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8229 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8230 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8231 | |
| 8232 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8233 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8234 | }; |
| 8235 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8236 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8237 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8238 | { |
| 8239 | struct alc_spec *spec = codec->spec; |
| 8240 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8241 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8242 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8243 | /* need to execute and sync at first */ |
| 8244 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8245 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8246 | AC_VERB_GET_PIN_SENSE, 0); |
| 8247 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8248 | if (spec->jack_present) { |
| 8249 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8250 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8251 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8252 | } else { |
| 8253 | /* unmute internal speaker if necessary */ |
| 8254 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8255 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8256 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8257 | } |
| 8258 | } |
| 8259 | |
| 8260 | /* unsolicited event for HP jack sensing */ |
| 8261 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8262 | unsigned int res) |
| 8263 | { |
| 8264 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8265 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8266 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8267 | } |
| 8268 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8269 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8270 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8271 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8272 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8273 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8274 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8275 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8276 | AC_VERB_GET_PIN_SENSE, 0); |
| 8277 | present = (present & 0x80000000) != 0; |
| 8278 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8279 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8280 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8281 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8282 | } else { |
| 8283 | /* unmute internal speaker if necessary */ |
| 8284 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8285 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8286 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8287 | } |
| 8288 | } |
| 8289 | |
| 8290 | /* unsolicited event for HP jack sensing */ |
| 8291 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8292 | unsigned int res) |
| 8293 | { |
| 8294 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8295 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8296 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8297 | } |
| 8298 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8299 | /* |
| 8300 | * fujitsu model |
| 8301 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 8302 | */ |
| 8303 | |
| 8304 | #define ALC_HP_EVENT 0x37 |
| 8305 | |
| 8306 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8307 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8309 | {} |
| 8310 | }; |
| 8311 | |
| 8312 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8313 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8314 | .items = { |
| 8315 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8316 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8317 | { "CD", 0x4 }, |
| 8318 | }, |
| 8319 | }; |
| 8320 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8321 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8322 | .num_items = 5, |
| 8323 | .items = { |
| 8324 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8325 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8326 | { "Line", 0x2 }, |
| 8327 | { "CD", 0x4 }, |
| 8328 | { "AUX IN", 0x6 }, |
| 8329 | }, |
| 8330 | }; |
| 8331 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8332 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8333 | .num_items = 4, |
| 8334 | .items = { |
| 8335 | { "Mic", 0x0 }, |
| 8336 | { "Front Mic", 0x2 }, |
| 8337 | { "Line", 0x1 }, |
| 8338 | { "CD", 0x4 }, |
| 8339 | }, |
| 8340 | }; |
| 8341 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8342 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8343 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8344 | { |
| 8345 | struct alc_spec *spec = codec->spec; |
| 8346 | unsigned int mute; |
| 8347 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8348 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8349 | unsigned int present; |
| 8350 | /* need to execute and sync at first */ |
| 8351 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8352 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8353 | AC_VERB_GET_PIN_SENSE, 0); |
| 8354 | spec->jack_present = (present & 0x80000000) != 0; |
| 8355 | spec->sense_updated = 1; |
| 8356 | } |
| 8357 | if (spec->jack_present) { |
| 8358 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8359 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8360 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8361 | } else { |
| 8362 | /* unmute internal speaker if necessary */ |
| 8363 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8364 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8365 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8366 | } |
| 8367 | } |
| 8368 | |
| 8369 | /* unsolicited event for HP jack sensing */ |
| 8370 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8371 | unsigned int res) |
| 8372 | { |
| 8373 | if ((res >> 26) != ALC_HP_EVENT) |
| 8374 | return; |
| 8375 | alc262_fujitsu_automute(codec, 1); |
| 8376 | } |
| 8377 | |
| 8378 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8379 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8380 | .ops = &snd_hda_bind_vol, |
| 8381 | .values = { |
| 8382 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8383 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8384 | 0 |
| 8385 | }, |
| 8386 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8387 | |
| 8388 | /* bind hp and internal speaker mute (with plug check) */ |
| 8389 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8390 | struct snd_ctl_elem_value *ucontrol) |
| 8391 | { |
| 8392 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8393 | long *valp = ucontrol->value.integer.value; |
| 8394 | int change; |
| 8395 | |
| 8396 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8397 | HDA_AMP_MUTE, |
| 8398 | valp[0] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8399 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8400 | HDA_AMP_MUTE, |
| 8401 | valp[1] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8402 | if (change) |
| 8403 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8404 | return change; |
| 8405 | } |
| 8406 | |
| 8407 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8408 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8409 | { |
| 8410 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8411 | .name = "Master Playback Switch", |
| 8412 | .info = snd_hda_mixer_amp_switch_info, |
| 8413 | .get = snd_hda_mixer_amp_switch_get, |
| 8414 | .put = alc262_fujitsu_master_sw_put, |
| 8415 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8416 | }, |
| 8417 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8418 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8419 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8420 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8421 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8422 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8423 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8424 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8425 | { } /* end */ |
| 8426 | }; |
| 8427 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8428 | /* additional init verbs for Benq laptops */ |
| 8429 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8430 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8431 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8432 | {} |
| 8433 | }; |
| 8434 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8435 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8436 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8437 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8438 | |
| 8439 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8440 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8441 | {} |
| 8442 | }; |
| 8443 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8444 | /* Samsung Q1 Ultra Vista model setup */ |
| 8445 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
| 8446 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8447 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8448 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8450 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8451 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8452 | { } /* end */ |
| 8453 | }; |
| 8454 | |
| 8455 | static struct hda_verb alc262_ultra_verbs[] = { |
| 8456 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8457 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8458 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8459 | /* Mic is on Node 0x19 */ |
| 8460 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8461 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8462 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8463 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8464 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8465 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8466 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8467 | {} |
| 8468 | }; |
| 8469 | |
| 8470 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 8471 | .num_items = 1, |
| 8472 | .items = { |
| 8473 | { "Mic", 0x1 }, |
| 8474 | }, |
| 8475 | }; |
| 8476 | |
| 8477 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8478 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 8479 | { |
| 8480 | struct alc_spec *spec = codec->spec; |
| 8481 | unsigned int mute; |
| 8482 | unsigned int present; |
| 8483 | |
| 8484 | /* need to execute and sync at first */ |
| 8485 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8486 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8487 | AC_VERB_GET_PIN_SENSE, 0); |
| 8488 | spec->jack_present = (present & 0x80000000) != 0; |
| 8489 | if (spec->jack_present) { |
| 8490 | /* mute internal speaker */ |
| 8491 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8492 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8493 | } else { |
| 8494 | /* unmute internal speaker if necessary */ |
| 8495 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 8496 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8497 | HDA_AMP_MUTE, mute); |
| 8498 | } |
| 8499 | } |
| 8500 | |
| 8501 | /* unsolicited event for HP jack sensing */ |
| 8502 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 8503 | unsigned int res) |
| 8504 | { |
| 8505 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8506 | return; |
| 8507 | alc262_ultra_automute(codec); |
| 8508 | } |
| 8509 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8510 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8511 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8512 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8513 | { |
| 8514 | hda_nid_t nid; |
| 8515 | int err; |
| 8516 | |
| 8517 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 8518 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8519 | spec->multiout.dac_nids[0] = 2; |
| 8520 | |
| 8521 | nid = cfg->line_out_pins[0]; |
| 8522 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8523 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8524 | "Front Playback Volume", |
| 8525 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 8526 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8527 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8528 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8529 | "Front Playback Switch", |
| 8530 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 8531 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8532 | return err; |
| 8533 | } |
| 8534 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 8535 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8536 | if (nid) { |
| 8537 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8538 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8539 | "Speaker Playback Volume", |
| 8540 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8541 | HDA_OUTPUT)); |
| 8542 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8543 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8544 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8545 | "Speaker Playback Switch", |
| 8546 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8547 | HDA_OUTPUT)); |
| 8548 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8549 | return err; |
| 8550 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8551 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8552 | "Speaker Playback Switch", |
| 8553 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8554 | HDA_OUTPUT)); |
| 8555 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8556 | return err; |
| 8557 | } |
| 8558 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8559 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8560 | if (nid) { |
| 8561 | /* spec->multiout.hp_nid = 2; */ |
| 8562 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8563 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8564 | "Headphone Playback Volume", |
| 8565 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8566 | HDA_OUTPUT)); |
| 8567 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8568 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8569 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8570 | "Headphone Playback Switch", |
| 8571 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8572 | HDA_OUTPUT)); |
| 8573 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8574 | return err; |
| 8575 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8576 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8577 | "Headphone Playback Switch", |
| 8578 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8579 | HDA_OUTPUT)); |
| 8580 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8581 | return err; |
| 8582 | } |
| 8583 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8584 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8585 | } |
| 8586 | |
| 8587 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8588 | #define alc262_auto_create_analog_input_ctls \ |
| 8589 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8590 | |
| 8591 | /* |
| 8592 | * generic initialization of ADC, input mixers and output mixers |
| 8593 | */ |
| 8594 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 8595 | /* |
| 8596 | * Unmute ADC0-2 and set the default input to mic-in |
| 8597 | */ |
| 8598 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8600 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8601 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8602 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8603 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8604 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8605 | /* 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] | 8606 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8607 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8608 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8609 | */ |
| 8610 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8611 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8612 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8613 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8614 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8615 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8616 | |
| 8617 | /* |
| 8618 | * Set up output mixers (0x0c - 0x0f) |
| 8619 | */ |
| 8620 | /* set vol=0 to output mixers */ |
| 8621 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8622 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8623 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8624 | |
| 8625 | /* set up input amps for analog loopback */ |
| 8626 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8627 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8628 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8629 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8630 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8631 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8632 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8633 | |
| 8634 | /* FIXME: use matrix-type input source selection */ |
| 8635 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8636 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8637 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8638 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8639 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8640 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8641 | /* Input mixer2 */ |
| 8642 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8643 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8644 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8645 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8646 | /* Input mixer3 */ |
| 8647 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8648 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8649 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8650 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8651 | |
| 8652 | { } |
| 8653 | }; |
| 8654 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8655 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 8656 | /* |
| 8657 | * Unmute ADC0-2 and set the default input to mic-in |
| 8658 | */ |
| 8659 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8660 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8661 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8662 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8663 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8664 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8665 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8666 | /* 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] | 8667 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8668 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8669 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8670 | */ |
| 8671 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8672 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8673 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8674 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8675 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8676 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8677 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8678 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8679 | |
| 8680 | /* |
| 8681 | * Set up output mixers (0x0c - 0x0e) |
| 8682 | */ |
| 8683 | /* set vol=0 to output mixers */ |
| 8684 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8685 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8686 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8687 | |
| 8688 | /* set up input amps for analog loopback */ |
| 8689 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8690 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8691 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8692 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8693 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8694 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8695 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8696 | |
| 8697 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8698 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8699 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8700 | |
| 8701 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8702 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8703 | |
| 8704 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8705 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8706 | |
| 8707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8708 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8709 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8710 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8711 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8712 | |
| 8713 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8714 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8715 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8716 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8717 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8718 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8719 | |
| 8720 | |
| 8721 | /* FIXME: use matrix-type input source selection */ |
| 8722 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8723 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8724 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8725 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8726 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8727 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8728 | /* Input mixer2 */ |
| 8729 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8730 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8731 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8732 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8733 | /* Input mixer3 */ |
| 8734 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8735 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8736 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8737 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8738 | |
| 8739 | { } |
| 8740 | }; |
| 8741 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8742 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 8743 | /* |
| 8744 | * Unmute ADC0-2 and set the default input to mic-in |
| 8745 | */ |
| 8746 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8747 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8748 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8749 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8750 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8751 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8752 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8753 | /* 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] | 8754 | * mixer widget |
| 8755 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 8756 | * panel mic (mic 2) |
| 8757 | */ |
| 8758 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8761 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8762 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8763 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8765 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 8766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8767 | /* |
| 8768 | * Set up output mixers (0x0c - 0x0e) |
| 8769 | */ |
| 8770 | /* set vol=0 to output mixers */ |
| 8771 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8772 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8773 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8774 | |
| 8775 | /* set up input amps for analog loopback */ |
| 8776 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8777 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8778 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8779 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8780 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8781 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8782 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8783 | |
| 8784 | |
| 8785 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 8786 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 8787 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 8788 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 8789 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 8790 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 8791 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 8792 | |
| 8793 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8794 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8795 | |
| 8796 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8797 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8798 | |
| 8799 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 8800 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8801 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8802 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8803 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8804 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8805 | |
| 8806 | /* FIXME: use matrix-type input source selection */ |
| 8807 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8808 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8809 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 8810 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 8811 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 8812 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 8813 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 8814 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8815 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 8816 | /* Input mixer2 */ |
| 8817 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8818 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8819 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8820 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8821 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8822 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8823 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 8824 | /* Input mixer3 */ |
| 8825 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8826 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8827 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8828 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8829 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8830 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8831 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 8832 | |
| 8833 | { } |
| 8834 | }; |
| 8835 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8836 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8837 | #define alc262_loopbacks alc880_loopbacks |
| 8838 | #endif |
| 8839 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8840 | /* pcm configuration: identiacal with ALC880 */ |
| 8841 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 8842 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 8843 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 8844 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 8845 | |
| 8846 | /* |
| 8847 | * BIOS auto configuration |
| 8848 | */ |
| 8849 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 8850 | { |
| 8851 | struct alc_spec *spec = codec->spec; |
| 8852 | int err; |
| 8853 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 8854 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8855 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 8856 | alc262_ignore); |
| 8857 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8858 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8859 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8860 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8861 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 8862 | if (err < 0) |
| 8863 | return err; |
| 8864 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 8865 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8866 | return err; |
| 8867 | |
| 8868 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 8869 | |
| 8870 | if (spec->autocfg.dig_out_pin) |
| 8871 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 8872 | if (spec->autocfg.dig_in_pin) |
| 8873 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 8874 | |
| 8875 | if (spec->kctl_alloc) |
| 8876 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 8877 | |
| 8878 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 8879 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8880 | spec->input_mux = &spec->private_imux; |
| 8881 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8882 | err = alc_auto_add_mic_boost(codec); |
| 8883 | if (err < 0) |
| 8884 | return err; |
| 8885 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8886 | return 1; |
| 8887 | } |
| 8888 | |
| 8889 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 8890 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 8891 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 8892 | |
| 8893 | |
| 8894 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8895 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8896 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8897 | alc262_auto_init_multi_out(codec); |
| 8898 | alc262_auto_init_hp_out(codec); |
| 8899 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8900 | } |
| 8901 | |
| 8902 | /* |
| 8903 | * configuration and preset |
| 8904 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8905 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 8906 | [ALC262_BASIC] = "basic", |
| 8907 | [ALC262_HIPPO] = "hippo", |
| 8908 | [ALC262_HIPPO_1] = "hippo_1", |
| 8909 | [ALC262_FUJITSU] = "fujitsu", |
| 8910 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8911 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 8912 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8913 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8914 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 8915 | [ALC262_BENQ_T31] = "benq-t31", |
| 8916 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8917 | [ALC262_ULTRA] = "ultra", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8918 | [ALC262_AUTO] = "auto", |
| 8919 | }; |
| 8920 | |
| 8921 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 8922 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 8923 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 8924 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8925 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 8926 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 8927 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 8928 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 8929 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 8930 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8931 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8932 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8933 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8934 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8935 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8936 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8937 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8938 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8939 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 8940 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 8941 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8942 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 8943 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8944 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8945 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8946 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8947 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 8948 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 8949 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8950 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8951 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8952 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8953 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8954 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8955 | {} |
| 8956 | }; |
| 8957 | |
| 8958 | static struct alc_config_preset alc262_presets[] = { |
| 8959 | [ALC262_BASIC] = { |
| 8960 | .mixers = { alc262_base_mixer }, |
| 8961 | .init_verbs = { alc262_init_verbs }, |
| 8962 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8963 | .dac_nids = alc262_dac_nids, |
| 8964 | .hp_nid = 0x03, |
| 8965 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8966 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 8967 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8968 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8969 | [ALC262_HIPPO] = { |
| 8970 | .mixers = { alc262_base_mixer }, |
| 8971 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 8972 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8973 | .dac_nids = alc262_dac_nids, |
| 8974 | .hp_nid = 0x03, |
| 8975 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8976 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8977 | .channel_mode = alc262_modes, |
| 8978 | .input_mux = &alc262_capture_source, |
| 8979 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8980 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8981 | }, |
| 8982 | [ALC262_HIPPO_1] = { |
| 8983 | .mixers = { alc262_hippo1_mixer }, |
| 8984 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 8985 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8986 | .dac_nids = alc262_dac_nids, |
| 8987 | .hp_nid = 0x02, |
| 8988 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8989 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8990 | .channel_mode = alc262_modes, |
| 8991 | .input_mux = &alc262_capture_source, |
| 8992 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8993 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8994 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8995 | [ALC262_FUJITSU] = { |
| 8996 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8997 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 8998 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8999 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9000 | .dac_nids = alc262_dac_nids, |
| 9001 | .hp_nid = 0x03, |
| 9002 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9003 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9004 | .channel_mode = alc262_modes, |
| 9005 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9006 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9007 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9008 | [ALC262_HP_BPC] = { |
| 9009 | .mixers = { alc262_HP_BPC_mixer }, |
| 9010 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9011 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9012 | .dac_nids = alc262_dac_nids, |
| 9013 | .hp_nid = 0x03, |
| 9014 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9015 | .channel_mode = alc262_modes, |
| 9016 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9017 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9018 | [ALC262_HP_BPC_D7000_WF] = { |
| 9019 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9020 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9021 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9022 | .dac_nids = alc262_dac_nids, |
| 9023 | .hp_nid = 0x03, |
| 9024 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9025 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9026 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9027 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9028 | [ALC262_HP_BPC_D7000_WL] = { |
| 9029 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9030 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9031 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9032 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9033 | .dac_nids = alc262_dac_nids, |
| 9034 | .hp_nid = 0x03, |
| 9035 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9036 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9037 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9038 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9039 | [ALC262_HP_TC_T5735] = { |
| 9040 | .mixers = { alc262_hp_t5735_mixer }, |
| 9041 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9042 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9043 | .dac_nids = alc262_dac_nids, |
| 9044 | .hp_nid = 0x03, |
| 9045 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9046 | .channel_mode = alc262_modes, |
| 9047 | .input_mux = &alc262_capture_source, |
| 9048 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9049 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9050 | }, |
| 9051 | [ALC262_HP_RP5700] = { |
| 9052 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9053 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9054 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9055 | .dac_nids = alc262_dac_nids, |
| 9056 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9057 | .channel_mode = alc262_modes, |
| 9058 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9059 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9060 | [ALC262_BENQ_ED8] = { |
| 9061 | .mixers = { alc262_base_mixer }, |
| 9062 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9063 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9064 | .dac_nids = alc262_dac_nids, |
| 9065 | .hp_nid = 0x03, |
| 9066 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9067 | .channel_mode = alc262_modes, |
| 9068 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9069 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9070 | [ALC262_SONY_ASSAMD] = { |
| 9071 | .mixers = { alc262_sony_mixer }, |
| 9072 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9073 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9074 | .dac_nids = alc262_dac_nids, |
| 9075 | .hp_nid = 0x02, |
| 9076 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9077 | .channel_mode = alc262_modes, |
| 9078 | .input_mux = &alc262_capture_source, |
| 9079 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9080 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9081 | }, |
| 9082 | [ALC262_BENQ_T31] = { |
| 9083 | .mixers = { alc262_benq_t31_mixer }, |
| 9084 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9085 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9086 | .dac_nids = alc262_dac_nids, |
| 9087 | .hp_nid = 0x03, |
| 9088 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9089 | .channel_mode = alc262_modes, |
| 9090 | .input_mux = &alc262_capture_source, |
| 9091 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9092 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9093 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9094 | [ALC262_ULTRA] = { |
| 9095 | .mixers = { alc262_ultra_mixer }, |
| 9096 | .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, |
| 9097 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9098 | .dac_nids = alc262_dac_nids, |
| 9099 | .hp_nid = 0x03, |
| 9100 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9101 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9102 | .channel_mode = alc262_modes, |
| 9103 | .input_mux = &alc262_ultra_capture_source, |
| 9104 | .unsol_event = alc262_ultra_unsol_event, |
| 9105 | .init_hook = alc262_ultra_automute, |
| 9106 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9107 | }; |
| 9108 | |
| 9109 | static int patch_alc262(struct hda_codec *codec) |
| 9110 | { |
| 9111 | struct alc_spec *spec; |
| 9112 | int board_config; |
| 9113 | int err; |
| 9114 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9115 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9116 | if (spec == NULL) |
| 9117 | return -ENOMEM; |
| 9118 | |
| 9119 | codec->spec = spec; |
| 9120 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9121 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9122 | * under-run |
| 9123 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9124 | { |
| 9125 | int tmp; |
| 9126 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9127 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9128 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9129 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9130 | } |
| 9131 | #endif |
| 9132 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9133 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9134 | alc262_models, |
| 9135 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9136 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9137 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9138 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9139 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9140 | board_config = ALC262_AUTO; |
| 9141 | } |
| 9142 | |
| 9143 | if (board_config == ALC262_AUTO) { |
| 9144 | /* automatic parse from the BIOS config */ |
| 9145 | err = alc262_parse_auto_config(codec); |
| 9146 | if (err < 0) { |
| 9147 | alc_free(codec); |
| 9148 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9149 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9150 | printk(KERN_INFO |
| 9151 | "hda_codec: Cannot set up configuration " |
| 9152 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9153 | board_config = ALC262_BASIC; |
| 9154 | } |
| 9155 | } |
| 9156 | |
| 9157 | if (board_config != ALC262_AUTO) |
| 9158 | setup_preset(spec, &alc262_presets[board_config]); |
| 9159 | |
| 9160 | spec->stream_name_analog = "ALC262 Analog"; |
| 9161 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9162 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9163 | |
| 9164 | spec->stream_name_digital = "ALC262 Digital"; |
| 9165 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9166 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9167 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9168 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9169 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9170 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9171 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9172 | /* get type */ |
| 9173 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9174 | if (wcap != AC_WID_AUD_IN) { |
| 9175 | spec->adc_nids = alc262_adc_nids_alt; |
| 9176 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9177 | spec->mixers[spec->num_mixers] = |
| 9178 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9179 | spec->num_mixers++; |
| 9180 | } else { |
| 9181 | spec->adc_nids = alc262_adc_nids; |
| 9182 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 9183 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9184 | spec->num_mixers++; |
| 9185 | } |
| 9186 | } |
| 9187 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9188 | spec->vmaster_nid = 0x0c; |
| 9189 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9190 | codec->patch_ops = alc_patch_ops; |
| 9191 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9192 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9193 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9194 | if (!spec->loopback.amplist) |
| 9195 | spec->loopback.amplist = alc262_loopbacks; |
| 9196 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9197 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9198 | return 0; |
| 9199 | } |
| 9200 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9201 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9202 | * ALC268 channel source setting (2 channel) |
| 9203 | */ |
| 9204 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9205 | #define alc268_modes alc260_modes |
| 9206 | |
| 9207 | static hda_nid_t alc268_dac_nids[2] = { |
| 9208 | /* front, hp */ |
| 9209 | 0x02, 0x03 |
| 9210 | }; |
| 9211 | |
| 9212 | static hda_nid_t alc268_adc_nids[2] = { |
| 9213 | /* ADC0-1 */ |
| 9214 | 0x08, 0x07 |
| 9215 | }; |
| 9216 | |
| 9217 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9218 | /* ADC0 */ |
| 9219 | 0x08 |
| 9220 | }; |
| 9221 | |
| 9222 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9223 | /* output mixer control */ |
| 9224 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9225 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9226 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9227 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9228 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9229 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9230 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9231 | { } |
| 9232 | }; |
| 9233 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9234 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9235 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9236 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9237 | { } |
| 9238 | }; |
| 9239 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9240 | /* Toshiba specific */ |
| 9241 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9242 | |
| 9243 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9244 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9245 | { } /* end */ |
| 9246 | }; |
| 9247 | |
| 9248 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9249 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9250 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9251 | .ops = &snd_hda_bind_vol, |
| 9252 | .values = { |
| 9253 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9254 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9255 | 0 |
| 9256 | }, |
| 9257 | }; |
| 9258 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9259 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9260 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9261 | { |
| 9262 | struct alc_spec *spec = codec->spec; |
| 9263 | unsigned int mute; |
| 9264 | |
| 9265 | if (force || !spec->sense_updated) { |
| 9266 | unsigned int present; |
| 9267 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9268 | AC_VERB_GET_PIN_SENSE, 0); |
| 9269 | spec->jack_present = (present & 0x80000000) != 0; |
| 9270 | spec->sense_updated = 1; |
| 9271 | } |
| 9272 | if (spec->jack_present) |
| 9273 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9274 | else /* unmute internal speaker if necessary */ |
| 9275 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9276 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9277 | HDA_AMP_MUTE, mute); |
| 9278 | } |
| 9279 | |
| 9280 | |
| 9281 | /* bind hp and internal speaker mute (with plug check) */ |
| 9282 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9283 | struct snd_ctl_elem_value *ucontrol) |
| 9284 | { |
| 9285 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9286 | long *valp = ucontrol->value.integer.value; |
| 9287 | int change; |
| 9288 | |
| 9289 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9290 | HDA_AMP_MUTE, |
| 9291 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9292 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9293 | HDA_AMP_MUTE, |
| 9294 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9295 | if (change) |
| 9296 | alc268_acer_automute(codec, 0); |
| 9297 | return change; |
| 9298 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9299 | |
| 9300 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9301 | /* output mixer control */ |
| 9302 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9303 | { |
| 9304 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9305 | .name = "Master Playback Switch", |
| 9306 | .info = snd_hda_mixer_amp_switch_info, |
| 9307 | .get = snd_hda_mixer_amp_switch_get, |
| 9308 | .put = alc268_acer_master_sw_put, |
| 9309 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9310 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9311 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9312 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9313 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9314 | { } |
| 9315 | }; |
| 9316 | |
| 9317 | static struct hda_verb alc268_acer_verbs[] = { |
| 9318 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9319 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9320 | |
| 9321 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9322 | { } |
| 9323 | }; |
| 9324 | |
| 9325 | /* unsolicited event for HP jack sensing */ |
| 9326 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9327 | unsigned int res) |
| 9328 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9329 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9330 | return; |
| 9331 | alc268_toshiba_automute(codec); |
| 9332 | } |
| 9333 | |
| 9334 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9335 | unsigned int res) |
| 9336 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9337 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9338 | return; |
| 9339 | alc268_acer_automute(codec, 1); |
| 9340 | } |
| 9341 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9342 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9343 | { |
| 9344 | alc268_acer_automute(codec, 1); |
| 9345 | } |
| 9346 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9347 | /* |
| 9348 | * generic initialization of ADC, input mixers and output mixers |
| 9349 | */ |
| 9350 | static struct hda_verb alc268_base_init_verbs[] = { |
| 9351 | /* Unmute DAC0-1 and set vol = 0 */ |
| 9352 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9353 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9354 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9355 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9356 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9357 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9358 | |
| 9359 | /* |
| 9360 | * Set up output mixers (0x0c - 0x0e) |
| 9361 | */ |
| 9362 | /* set vol=0 to output mixers */ |
| 9363 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9364 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9365 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9366 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9367 | |
| 9368 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9369 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9370 | |
| 9371 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9372 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9373 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9374 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9375 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9376 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9377 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9378 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9379 | |
| 9380 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9381 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9382 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9383 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9384 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9385 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9386 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9387 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9388 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9389 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 9390 | |
| 9391 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9393 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9394 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9395 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9396 | { } |
| 9397 | }; |
| 9398 | |
| 9399 | /* |
| 9400 | * generic initialization of ADC, input mixers and output mixers |
| 9401 | */ |
| 9402 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 9403 | /* set output DAC */ |
| 9404 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9405 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9406 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9407 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9408 | |
| 9409 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9410 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9411 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9412 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9413 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9414 | |
| 9415 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9416 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9417 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9418 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9419 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9420 | |
| 9421 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9422 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9423 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9424 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9425 | |
| 9426 | /* set PCBEEP vol = 0 */ |
| 9427 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 9428 | |
| 9429 | { } |
| 9430 | }; |
| 9431 | |
| 9432 | #define alc268_mux_enum_info alc_mux_enum_info |
| 9433 | #define alc268_mux_enum_get alc_mux_enum_get |
| 9434 | |
| 9435 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9436 | struct snd_ctl_elem_value *ucontrol) |
| 9437 | { |
| 9438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9439 | struct alc_spec *spec = codec->spec; |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9440 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9441 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9442 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 9443 | hda_nid_t nid = capture_mixers[adc_idx]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9444 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9445 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
| 9446 | nid, |
| 9447 | &spec->cur_mux[adc_idx]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9448 | } |
| 9449 | |
| 9450 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 9451 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9452 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9453 | { |
| 9454 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9455 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9456 | * So call somewhat different.. |
| 9457 | * FIXME: the controls appear in the "playback" view! |
| 9458 | */ |
| 9459 | /* .name = "Capture Source", */ |
| 9460 | .name = "Input Source", |
| 9461 | .count = 1, |
| 9462 | .info = alc268_mux_enum_info, |
| 9463 | .get = alc268_mux_enum_get, |
| 9464 | .put = alc268_mux_enum_put, |
| 9465 | }, |
| 9466 | { } /* end */ |
| 9467 | }; |
| 9468 | |
| 9469 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 9470 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9471 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9472 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9473 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9474 | { |
| 9475 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9476 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9477 | * So call somewhat different.. |
| 9478 | * FIXME: the controls appear in the "playback" view! |
| 9479 | */ |
| 9480 | /* .name = "Capture Source", */ |
| 9481 | .name = "Input Source", |
| 9482 | .count = 2, |
| 9483 | .info = alc268_mux_enum_info, |
| 9484 | .get = alc268_mux_enum_get, |
| 9485 | .put = alc268_mux_enum_put, |
| 9486 | }, |
| 9487 | { } /* end */ |
| 9488 | }; |
| 9489 | |
| 9490 | static struct hda_input_mux alc268_capture_source = { |
| 9491 | .num_items = 4, |
| 9492 | .items = { |
| 9493 | { "Mic", 0x0 }, |
| 9494 | { "Front Mic", 0x1 }, |
| 9495 | { "Line", 0x2 }, |
| 9496 | { "CD", 0x3 }, |
| 9497 | }, |
| 9498 | }; |
| 9499 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9500 | #ifdef CONFIG_SND_DEBUG |
| 9501 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
| 9502 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9503 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9504 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9505 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9506 | |
| 9507 | /* Volume widgets */ |
| 9508 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9509 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9510 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9511 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9512 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 9513 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 9514 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 9515 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 9516 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 9517 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 9518 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 9519 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 9520 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
| 9521 | HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 9522 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9523 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 9524 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 9525 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 9526 | |
| 9527 | /* Modes for retasking pin widgets */ |
| 9528 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 9529 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 9530 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 9531 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 9532 | |
| 9533 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 9534 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 9535 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 9536 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 9537 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 9538 | |
| 9539 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 9540 | * The ALC268 does not have an SPDIF input. |
| 9541 | */ |
| 9542 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 9543 | |
| 9544 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 9545 | * this output to turn on an external amplifier. |
| 9546 | */ |
| 9547 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 9548 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 9549 | |
| 9550 | { } /* end */ |
| 9551 | }; |
| 9552 | #endif |
| 9553 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9554 | /* create input playback/capture controls for the given pin */ |
| 9555 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 9556 | const char *ctlname, int idx) |
| 9557 | { |
| 9558 | char name[32]; |
| 9559 | int err; |
| 9560 | |
| 9561 | sprintf(name, "%s Playback Volume", ctlname); |
| 9562 | if (nid == 0x14) { |
| 9563 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9564 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 9565 | HDA_OUTPUT)); |
| 9566 | if (err < 0) |
| 9567 | return err; |
| 9568 | } else if (nid == 0x15) { |
| 9569 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9570 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 9571 | HDA_OUTPUT)); |
| 9572 | if (err < 0) |
| 9573 | return err; |
| 9574 | } else |
| 9575 | return -1; |
| 9576 | sprintf(name, "%s Playback Switch", ctlname); |
| 9577 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 9578 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 9579 | if (err < 0) |
| 9580 | return err; |
| 9581 | return 0; |
| 9582 | } |
| 9583 | |
| 9584 | /* add playback controls from the parsed DAC table */ |
| 9585 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9586 | const struct auto_pin_cfg *cfg) |
| 9587 | { |
| 9588 | hda_nid_t nid; |
| 9589 | int err; |
| 9590 | |
| 9591 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 9592 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9593 | spec->multiout.dac_nids[0] = 2; |
| 9594 | spec->multiout.dac_nids[1] = 3; |
| 9595 | |
| 9596 | nid = cfg->line_out_pins[0]; |
| 9597 | if (nid) |
| 9598 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 9599 | |
| 9600 | nid = cfg->speaker_pins[0]; |
| 9601 | if (nid == 0x1d) { |
| 9602 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9603 | "Speaker Playback Volume", |
| 9604 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9605 | if (err < 0) |
| 9606 | return err; |
| 9607 | } |
| 9608 | nid = cfg->hp_pins[0]; |
| 9609 | if (nid) |
| 9610 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 9611 | |
| 9612 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 9613 | if (nid == 0x16) { |
| 9614 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9615 | "Mono Playback Switch", |
| 9616 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 9617 | if (err < 0) |
| 9618 | return err; |
| 9619 | } |
| 9620 | return 0; |
| 9621 | } |
| 9622 | |
| 9623 | /* create playback/capture controls for input pins */ |
| 9624 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9625 | const struct auto_pin_cfg *cfg) |
| 9626 | { |
| 9627 | struct hda_input_mux *imux = &spec->private_imux; |
| 9628 | int i, idx1; |
| 9629 | |
| 9630 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9631 | switch(cfg->input_pins[i]) { |
| 9632 | case 0x18: |
| 9633 | idx1 = 0; /* Mic 1 */ |
| 9634 | break; |
| 9635 | case 0x19: |
| 9636 | idx1 = 1; /* Mic 2 */ |
| 9637 | break; |
| 9638 | case 0x1a: |
| 9639 | idx1 = 2; /* Line In */ |
| 9640 | break; |
| 9641 | case 0x1c: |
| 9642 | idx1 = 3; /* CD */ |
| 9643 | break; |
| 9644 | default: |
| 9645 | continue; |
| 9646 | } |
| 9647 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 9648 | imux->items[imux->num_items].index = idx1; |
| 9649 | imux->num_items++; |
| 9650 | } |
| 9651 | return 0; |
| 9652 | } |
| 9653 | |
| 9654 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 9655 | { |
| 9656 | struct alc_spec *spec = codec->spec; |
| 9657 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9658 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9659 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9660 | unsigned int dac_vol1, dac_vol2; |
| 9661 | |
| 9662 | if (speaker_nid) { |
| 9663 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 9664 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 9665 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9666 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9667 | AMP_IN_UNMUTE(1)); |
| 9668 | snd_hda_codec_write(codec, 0x10, 0, |
| 9669 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9670 | AMP_IN_UNMUTE(1)); |
| 9671 | } else { |
| 9672 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9673 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9674 | snd_hda_codec_write(codec, 0x10, 0, |
| 9675 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9676 | } |
| 9677 | |
| 9678 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 9679 | if (line_nid == 0x14) |
| 9680 | dac_vol2 = AMP_OUT_ZERO; |
| 9681 | else if (line_nid == 0x15) |
| 9682 | dac_vol1 = AMP_OUT_ZERO; |
| 9683 | if (hp_nid == 0x14) |
| 9684 | dac_vol2 = AMP_OUT_ZERO; |
| 9685 | else if (hp_nid == 0x15) |
| 9686 | dac_vol1 = AMP_OUT_ZERO; |
| 9687 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 9688 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 9689 | spec->autocfg.line_out_pins[2] != 0x16) |
| 9690 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 9691 | |
| 9692 | snd_hda_codec_write(codec, 0x02, 0, |
| 9693 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 9694 | snd_hda_codec_write(codec, 0x03, 0, |
| 9695 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 9696 | } |
| 9697 | |
| 9698 | /* pcm configuration: identiacal with ALC880 */ |
| 9699 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 9700 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
| 9701 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 9702 | |
| 9703 | /* |
| 9704 | * BIOS auto configuration |
| 9705 | */ |
| 9706 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 9707 | { |
| 9708 | struct alc_spec *spec = codec->spec; |
| 9709 | int err; |
| 9710 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 9711 | |
| 9712 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9713 | alc268_ignore); |
| 9714 | if (err < 0) |
| 9715 | return err; |
| 9716 | if (!spec->autocfg.line_outs) |
| 9717 | return 0; /* can't find valid BIOS pin config */ |
| 9718 | |
| 9719 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9720 | if (err < 0) |
| 9721 | return err; |
| 9722 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9723 | if (err < 0) |
| 9724 | return err; |
| 9725 | |
| 9726 | spec->multiout.max_channels = 2; |
| 9727 | |
| 9728 | /* digital only support output */ |
| 9729 | if (spec->autocfg.dig_out_pin) |
| 9730 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 9731 | |
| 9732 | if (spec->kctl_alloc) |
| 9733 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9734 | |
| 9735 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 9736 | spec->num_mux_defs = 1; |
| 9737 | spec->input_mux = &spec->private_imux; |
| 9738 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9739 | err = alc_auto_add_mic_boost(codec); |
| 9740 | if (err < 0) |
| 9741 | return err; |
| 9742 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9743 | return 1; |
| 9744 | } |
| 9745 | |
| 9746 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 9747 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 9748 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 9749 | |
| 9750 | /* init callback for auto-configuration model -- overriding the default init */ |
| 9751 | static void alc268_auto_init(struct hda_codec *codec) |
| 9752 | { |
| 9753 | alc268_auto_init_multi_out(codec); |
| 9754 | alc268_auto_init_hp_out(codec); |
| 9755 | alc268_auto_init_mono_speaker_out(codec); |
| 9756 | alc268_auto_init_analog_input(codec); |
| 9757 | } |
| 9758 | |
| 9759 | /* |
| 9760 | * configuration and preset |
| 9761 | */ |
| 9762 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 9763 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 9764 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9765 | [ALC268_ACER] = "acer", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9766 | #ifdef CONFIG_SND_DEBUG |
| 9767 | [ALC268_TEST] = "test", |
| 9768 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9769 | [ALC268_AUTO] = "auto", |
| 9770 | }; |
| 9771 | |
| 9772 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9773 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
| 9774 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
| 9775 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9776 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9777 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 9778 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 9779 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9780 | {} |
| 9781 | }; |
| 9782 | |
| 9783 | static struct alc_config_preset alc268_presets[] = { |
| 9784 | [ALC268_3ST] = { |
| 9785 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 9786 | .init_verbs = { alc268_base_init_verbs }, |
| 9787 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9788 | .dac_nids = alc268_dac_nids, |
| 9789 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9790 | .adc_nids = alc268_adc_nids_alt, |
| 9791 | .hp_nid = 0x03, |
| 9792 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 9793 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9794 | .channel_mode = alc268_modes, |
| 9795 | .input_mux = &alc268_capture_source, |
| 9796 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9797 | [ALC268_TOSHIBA] = { |
| 9798 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9799 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9800 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9801 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9802 | .dac_nids = alc268_dac_nids, |
| 9803 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9804 | .adc_nids = alc268_adc_nids_alt, |
| 9805 | .hp_nid = 0x03, |
| 9806 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9807 | .channel_mode = alc268_modes, |
| 9808 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9809 | .unsol_event = alc268_toshiba_unsol_event, |
| 9810 | .init_hook = alc268_toshiba_automute, |
| 9811 | }, |
| 9812 | [ALC268_ACER] = { |
| 9813 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, |
| 9814 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9815 | alc268_acer_verbs }, |
| 9816 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9817 | .dac_nids = alc268_dac_nids, |
| 9818 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9819 | .adc_nids = alc268_adc_nids_alt, |
| 9820 | .hp_nid = 0x02, |
| 9821 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9822 | .channel_mode = alc268_modes, |
| 9823 | .input_mux = &alc268_capture_source, |
| 9824 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9825 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9826 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9827 | #ifdef CONFIG_SND_DEBUG |
| 9828 | [ALC268_TEST] = { |
| 9829 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 9830 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9831 | alc268_volume_init_verbs }, |
| 9832 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9833 | .dac_nids = alc268_dac_nids, |
| 9834 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9835 | .adc_nids = alc268_adc_nids_alt, |
| 9836 | .hp_nid = 0x03, |
| 9837 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 9838 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9839 | .channel_mode = alc268_modes, |
| 9840 | .input_mux = &alc268_capture_source, |
| 9841 | }, |
| 9842 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9843 | }; |
| 9844 | |
| 9845 | static int patch_alc268(struct hda_codec *codec) |
| 9846 | { |
| 9847 | struct alc_spec *spec; |
| 9848 | int board_config; |
| 9849 | int err; |
| 9850 | |
| 9851 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 9852 | if (spec == NULL) |
| 9853 | return -ENOMEM; |
| 9854 | |
| 9855 | codec->spec = spec; |
| 9856 | |
| 9857 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 9858 | alc268_models, |
| 9859 | alc268_cfg_tbl); |
| 9860 | |
| 9861 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 9862 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 9863 | "trying auto-probe from BIOS...\n"); |
| 9864 | board_config = ALC268_AUTO; |
| 9865 | } |
| 9866 | |
| 9867 | if (board_config == ALC268_AUTO) { |
| 9868 | /* automatic parse from the BIOS config */ |
| 9869 | err = alc268_parse_auto_config(codec); |
| 9870 | if (err < 0) { |
| 9871 | alc_free(codec); |
| 9872 | return err; |
| 9873 | } else if (!err) { |
| 9874 | printk(KERN_INFO |
| 9875 | "hda_codec: Cannot set up configuration " |
| 9876 | "from BIOS. Using base mode...\n"); |
| 9877 | board_config = ALC268_3ST; |
| 9878 | } |
| 9879 | } |
| 9880 | |
| 9881 | if (board_config != ALC268_AUTO) |
| 9882 | setup_preset(spec, &alc268_presets[board_config]); |
| 9883 | |
| 9884 | spec->stream_name_analog = "ALC268 Analog"; |
| 9885 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 9886 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
| 9887 | |
| 9888 | spec->stream_name_digital = "ALC268 Digital"; |
| 9889 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 9890 | |
| 9891 | if (board_config == ALC268_AUTO) { |
| 9892 | if (!spec->adc_nids && spec->input_mux) { |
| 9893 | /* check whether NID 0x07 is valid */ |
| 9894 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9895 | |
| 9896 | /* get type */ |
| 9897 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 9898 | if (wcap != AC_WID_AUD_IN) { |
| 9899 | spec->adc_nids = alc268_adc_nids_alt; |
| 9900 | spec->num_adc_nids = |
| 9901 | ARRAY_SIZE(alc268_adc_nids_alt); |
| 9902 | spec->mixers[spec->num_mixers] = |
| 9903 | alc268_capture_alt_mixer; |
| 9904 | spec->num_mixers++; |
| 9905 | } else { |
| 9906 | spec->adc_nids = alc268_adc_nids; |
| 9907 | spec->num_adc_nids = |
| 9908 | ARRAY_SIZE(alc268_adc_nids); |
| 9909 | spec->mixers[spec->num_mixers] = |
| 9910 | alc268_capture_mixer; |
| 9911 | spec->num_mixers++; |
| 9912 | } |
| 9913 | } |
| 9914 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9915 | |
| 9916 | spec->vmaster_nid = 0x02; |
| 9917 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9918 | codec->patch_ops = alc_patch_ops; |
| 9919 | if (board_config == ALC268_AUTO) |
| 9920 | spec->init_hook = alc268_auto_init; |
| 9921 | |
| 9922 | return 0; |
| 9923 | } |
| 9924 | |
| 9925 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 9926 | * ALC269 channel source setting (2 channel) |
| 9927 | */ |
| 9928 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 9929 | |
| 9930 | #define alc269_dac_nids alc260_dac_nids |
| 9931 | |
| 9932 | static hda_nid_t alc269_adc_nids[1] = { |
| 9933 | /* ADC1 */ |
| 9934 | 0x07, |
| 9935 | }; |
| 9936 | |
| 9937 | #define alc269_modes alc260_modes |
| 9938 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 9939 | |
| 9940 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 9941 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9942 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9943 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9944 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9945 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9946 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9947 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9948 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9949 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9950 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9951 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9952 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 9953 | { } /* end */ |
| 9954 | }; |
| 9955 | |
| 9956 | /* capture mixer elements */ |
| 9957 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 9958 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9959 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9960 | { |
| 9961 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9962 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9963 | * So call somewhat different.. |
| 9964 | * FIXME: the controls appear in the "playback" view! |
| 9965 | */ |
| 9966 | /* .name = "Capture Source", */ |
| 9967 | .name = "Input Source", |
| 9968 | .count = 1, |
| 9969 | .info = alc_mux_enum_info, |
| 9970 | .get = alc_mux_enum_get, |
| 9971 | .put = alc_mux_enum_put, |
| 9972 | }, |
| 9973 | { } /* end */ |
| 9974 | }; |
| 9975 | |
| 9976 | /* |
| 9977 | * generic initialization of ADC, input mixers and output mixers |
| 9978 | */ |
| 9979 | static struct hda_verb alc269_init_verbs[] = { |
| 9980 | /* |
| 9981 | * Unmute ADC0 and set the default input to mic-in |
| 9982 | */ |
| 9983 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9984 | |
| 9985 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 9986 | * analog-loopback mixer widget |
| 9987 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9988 | * front panel mic (mic 2) |
| 9989 | */ |
| 9990 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 9991 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9992 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9993 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9994 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9995 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9996 | |
| 9997 | /* |
| 9998 | * Set up output mixers (0x0c - 0x0e) |
| 9999 | */ |
| 10000 | /* set vol=0 to output mixers */ |
| 10001 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10002 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10003 | |
| 10004 | /* set up input amps for analog loopback */ |
| 10005 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10006 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10007 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10008 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10009 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10010 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10011 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10012 | |
| 10013 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10014 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10015 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10016 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10017 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10018 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10019 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10020 | |
| 10021 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10022 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10023 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10024 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10025 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10026 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10027 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10028 | |
| 10029 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10030 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10031 | |
| 10032 | /* FIXME: use matrix-type input source selection */ |
| 10033 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10034 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10035 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10036 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10037 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10038 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10039 | |
| 10040 | /* set EAPD */ |
| 10041 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10042 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10043 | { } |
| 10044 | }; |
| 10045 | |
| 10046 | /* add playback controls from the parsed DAC table */ |
| 10047 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10048 | const struct auto_pin_cfg *cfg) |
| 10049 | { |
| 10050 | hda_nid_t nid; |
| 10051 | int err; |
| 10052 | |
| 10053 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10054 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10055 | spec->multiout.dac_nids[0] = 2; |
| 10056 | |
| 10057 | nid = cfg->line_out_pins[0]; |
| 10058 | if (nid) { |
| 10059 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10060 | "Front Playback Volume", |
| 10061 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10062 | if (err < 0) |
| 10063 | return err; |
| 10064 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10065 | "Front Playback Switch", |
| 10066 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10067 | if (err < 0) |
| 10068 | return err; |
| 10069 | } |
| 10070 | |
| 10071 | nid = cfg->speaker_pins[0]; |
| 10072 | if (nid) { |
| 10073 | if (!cfg->line_out_pins[0]) { |
| 10074 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10075 | "Speaker Playback Volume", |
| 10076 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10077 | HDA_OUTPUT)); |
| 10078 | if (err < 0) |
| 10079 | return err; |
| 10080 | } |
| 10081 | if (nid == 0x16) { |
| 10082 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10083 | "Speaker Playback Switch", |
| 10084 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10085 | HDA_OUTPUT)); |
| 10086 | if (err < 0) |
| 10087 | return err; |
| 10088 | } else { |
| 10089 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10090 | "Speaker Playback Switch", |
| 10091 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10092 | HDA_OUTPUT)); |
| 10093 | if (err < 0) |
| 10094 | return err; |
| 10095 | } |
| 10096 | } |
| 10097 | nid = cfg->hp_pins[0]; |
| 10098 | if (nid) { |
| 10099 | /* spec->multiout.hp_nid = 2; */ |
| 10100 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10101 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10102 | "Headphone Playback Volume", |
| 10103 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10104 | HDA_OUTPUT)); |
| 10105 | if (err < 0) |
| 10106 | return err; |
| 10107 | } |
| 10108 | if (nid == 0x16) { |
| 10109 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10110 | "Headphone Playback Switch", |
| 10111 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10112 | HDA_OUTPUT)); |
| 10113 | if (err < 0) |
| 10114 | return err; |
| 10115 | } else { |
| 10116 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10117 | "Headphone Playback Switch", |
| 10118 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10119 | HDA_OUTPUT)); |
| 10120 | if (err < 0) |
| 10121 | return err; |
| 10122 | } |
| 10123 | } |
| 10124 | return 0; |
| 10125 | } |
| 10126 | |
| 10127 | #define alc269_auto_create_analog_input_ctls \ |
| 10128 | alc880_auto_create_analog_input_ctls |
| 10129 | |
| 10130 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10131 | #define alc269_loopbacks alc880_loopbacks |
| 10132 | #endif |
| 10133 | |
| 10134 | /* pcm configuration: identiacal with ALC880 */ |
| 10135 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10136 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10137 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10138 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10139 | |
| 10140 | /* |
| 10141 | * BIOS auto configuration |
| 10142 | */ |
| 10143 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10144 | { |
| 10145 | struct alc_spec *spec = codec->spec; |
| 10146 | int err; |
| 10147 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10148 | |
| 10149 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10150 | alc269_ignore); |
| 10151 | if (err < 0) |
| 10152 | return err; |
| 10153 | |
| 10154 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10155 | if (err < 0) |
| 10156 | return err; |
| 10157 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10158 | if (err < 0) |
| 10159 | return err; |
| 10160 | |
| 10161 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10162 | |
| 10163 | if (spec->autocfg.dig_out_pin) |
| 10164 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10165 | |
| 10166 | if (spec->kctl_alloc) |
| 10167 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10168 | |
| 10169 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10170 | spec->num_mux_defs = 1; |
| 10171 | spec->input_mux = &spec->private_imux; |
| 10172 | |
| 10173 | err = alc_auto_add_mic_boost(codec); |
| 10174 | if (err < 0) |
| 10175 | return err; |
| 10176 | |
| 10177 | return 1; |
| 10178 | } |
| 10179 | |
| 10180 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10181 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10182 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10183 | |
| 10184 | |
| 10185 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10186 | static void alc269_auto_init(struct hda_codec *codec) |
| 10187 | { |
| 10188 | alc269_auto_init_multi_out(codec); |
| 10189 | alc269_auto_init_hp_out(codec); |
| 10190 | alc269_auto_init_analog_input(codec); |
| 10191 | } |
| 10192 | |
| 10193 | /* |
| 10194 | * configuration and preset |
| 10195 | */ |
| 10196 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10197 | [ALC269_BASIC] = "basic", |
| 10198 | }; |
| 10199 | |
| 10200 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10201 | {} |
| 10202 | }; |
| 10203 | |
| 10204 | static struct alc_config_preset alc269_presets[] = { |
| 10205 | [ALC269_BASIC] = { |
| 10206 | .mixers = { alc269_base_mixer }, |
| 10207 | .init_verbs = { alc269_init_verbs }, |
| 10208 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10209 | .dac_nids = alc269_dac_nids, |
| 10210 | .hp_nid = 0x03, |
| 10211 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10212 | .channel_mode = alc269_modes, |
| 10213 | .input_mux = &alc269_capture_source, |
| 10214 | }, |
| 10215 | }; |
| 10216 | |
| 10217 | static int patch_alc269(struct hda_codec *codec) |
| 10218 | { |
| 10219 | struct alc_spec *spec; |
| 10220 | int board_config; |
| 10221 | int err; |
| 10222 | |
| 10223 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10224 | if (spec == NULL) |
| 10225 | return -ENOMEM; |
| 10226 | |
| 10227 | codec->spec = spec; |
| 10228 | |
| 10229 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10230 | alc269_models, |
| 10231 | alc269_cfg_tbl); |
| 10232 | |
| 10233 | if (board_config < 0) { |
| 10234 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10235 | "trying auto-probe from BIOS...\n"); |
| 10236 | board_config = ALC269_AUTO; |
| 10237 | } |
| 10238 | |
| 10239 | if (board_config == ALC269_AUTO) { |
| 10240 | /* automatic parse from the BIOS config */ |
| 10241 | err = alc269_parse_auto_config(codec); |
| 10242 | if (err < 0) { |
| 10243 | alc_free(codec); |
| 10244 | return err; |
| 10245 | } else if (!err) { |
| 10246 | printk(KERN_INFO |
| 10247 | "hda_codec: Cannot set up configuration " |
| 10248 | "from BIOS. Using base mode...\n"); |
| 10249 | board_config = ALC269_BASIC; |
| 10250 | } |
| 10251 | } |
| 10252 | |
| 10253 | if (board_config != ALC269_AUTO) |
| 10254 | setup_preset(spec, &alc269_presets[board_config]); |
| 10255 | |
| 10256 | spec->stream_name_analog = "ALC269 Analog"; |
| 10257 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10258 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10259 | |
| 10260 | spec->stream_name_digital = "ALC269 Digital"; |
| 10261 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10262 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10263 | |
| 10264 | spec->adc_nids = alc269_adc_nids; |
| 10265 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10266 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10267 | spec->num_mixers++; |
| 10268 | |
| 10269 | codec->patch_ops = alc_patch_ops; |
| 10270 | if (board_config == ALC269_AUTO) |
| 10271 | spec->init_hook = alc269_auto_init; |
| 10272 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10273 | if (!spec->loopback.amplist) |
| 10274 | spec->loopback.amplist = alc269_loopbacks; |
| 10275 | #endif |
| 10276 | |
| 10277 | return 0; |
| 10278 | } |
| 10279 | |
| 10280 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10281 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 10282 | */ |
| 10283 | |
| 10284 | /* |
| 10285 | * set the path ways for 2 channel output |
| 10286 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 10287 | */ |
| 10288 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 10289 | /* set pin widget 1Ah (line in) for input */ |
| 10290 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10291 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10292 | * the vref |
| 10293 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10294 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10295 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10296 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10297 | #if 0 |
| 10298 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10299 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10300 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10301 | { } /* end */ |
| 10302 | }; |
| 10303 | /* |
| 10304 | * 6ch mode |
| 10305 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 10306 | */ |
| 10307 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 10308 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10309 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10310 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10311 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10312 | |
| 10313 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10314 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10315 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10316 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10317 | #if 0 |
| 10318 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10319 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10320 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10321 | { } /* end */ |
| 10322 | }; |
| 10323 | |
| 10324 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 10325 | { 2, alc861_threestack_ch2_init }, |
| 10326 | { 6, alc861_threestack_ch6_init }, |
| 10327 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10328 | /* Set mic1 as input and unmute the mixer */ |
| 10329 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 10330 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10331 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10332 | { } /* end */ |
| 10333 | }; |
| 10334 | /* Set mic1 as output and mute mixer */ |
| 10335 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 10336 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10337 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10338 | { } /* end */ |
| 10339 | }; |
| 10340 | |
| 10341 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 10342 | { 2, alc861_uniwill_m31_ch2_init }, |
| 10343 | { 4, alc861_uniwill_m31_ch4_init }, |
| 10344 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10345 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10346 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 10347 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 10348 | /* set pin widget 1Ah (line in) for input */ |
| 10349 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10350 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10351 | * the vref |
| 10352 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10353 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10354 | |
| 10355 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10356 | #if 0 |
| 10357 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10358 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10359 | #endif |
| 10360 | { } /* end */ |
| 10361 | }; |
| 10362 | /* Set mic1 nad line-in as output and mute mixer */ |
| 10363 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 10364 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10365 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10366 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10367 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10368 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10369 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10370 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10371 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10372 | |
| 10373 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10374 | #if 0 |
| 10375 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10376 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10377 | #endif |
| 10378 | { } /* end */ |
| 10379 | }; |
| 10380 | |
| 10381 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 10382 | { 2, alc861_asus_ch2_init }, |
| 10383 | { 6, alc861_asus_ch6_init }, |
| 10384 | }; |
| 10385 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10386 | /* patch-ALC861 */ |
| 10387 | |
| 10388 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 10389 | /* output mixer control */ |
| 10390 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10391 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10392 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10393 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10394 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10395 | |
| 10396 | /*Input mixer control */ |
| 10397 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10398 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10399 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10400 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10401 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10402 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10403 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10405 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10406 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10407 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10408 | /* Capture mixer control */ |
| 10409 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10410 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10411 | { |
| 10412 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10413 | .name = "Capture Source", |
| 10414 | .count = 1, |
| 10415 | .info = alc_mux_enum_info, |
| 10416 | .get = alc_mux_enum_get, |
| 10417 | .put = alc_mux_enum_put, |
| 10418 | }, |
| 10419 | { } /* end */ |
| 10420 | }; |
| 10421 | |
| 10422 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 10423 | /* output mixer control */ |
| 10424 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10425 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10426 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10427 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10428 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10429 | |
| 10430 | /* Input mixer control */ |
| 10431 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10432 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10433 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10434 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10435 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10436 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10437 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10438 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10439 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10440 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10441 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10442 | /* Capture mixer control */ |
| 10443 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10444 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10445 | { |
| 10446 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10447 | .name = "Capture Source", |
| 10448 | .count = 1, |
| 10449 | .info = alc_mux_enum_info, |
| 10450 | .get = alc_mux_enum_get, |
| 10451 | .put = alc_mux_enum_put, |
| 10452 | }, |
| 10453 | { |
| 10454 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10455 | .name = "Channel Mode", |
| 10456 | .info = alc_ch_mode_info, |
| 10457 | .get = alc_ch_mode_get, |
| 10458 | .put = alc_ch_mode_put, |
| 10459 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 10460 | }, |
| 10461 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10462 | }; |
| 10463 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10464 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10465 | /* output mixer control */ |
| 10466 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10469 | |
| 10470 | /*Capture mixer control */ |
| 10471 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10472 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10473 | { |
| 10474 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10475 | .name = "Capture Source", |
| 10476 | .count = 1, |
| 10477 | .info = alc_mux_enum_info, |
| 10478 | .get = alc_mux_enum_get, |
| 10479 | .put = alc_mux_enum_put, |
| 10480 | }, |
| 10481 | |
| 10482 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10483 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10484 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10485 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 10486 | /* output mixer control */ |
| 10487 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10488 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10489 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10490 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10491 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10492 | |
| 10493 | /* Input mixer control */ |
| 10494 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10495 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10496 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10497 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10498 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10499 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10502 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10503 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10504 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10505 | /* Capture mixer control */ |
| 10506 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10507 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10508 | { |
| 10509 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10510 | .name = "Capture Source", |
| 10511 | .count = 1, |
| 10512 | .info = alc_mux_enum_info, |
| 10513 | .get = alc_mux_enum_get, |
| 10514 | .put = alc_mux_enum_put, |
| 10515 | }, |
| 10516 | { |
| 10517 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10518 | .name = "Channel Mode", |
| 10519 | .info = alc_ch_mode_info, |
| 10520 | .get = alc_ch_mode_get, |
| 10521 | .put = alc_ch_mode_put, |
| 10522 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 10523 | }, |
| 10524 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10525 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10526 | |
| 10527 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 10528 | /* output mixer control */ |
| 10529 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10530 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10531 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10532 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10533 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10534 | |
| 10535 | /* Input mixer control */ |
| 10536 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10537 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10538 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10539 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10540 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10541 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10542 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10543 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10544 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10545 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 10546 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10547 | /* Capture mixer control */ |
| 10548 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10549 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10550 | { |
| 10551 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10552 | .name = "Capture Source", |
| 10553 | .count = 1, |
| 10554 | .info = alc_mux_enum_info, |
| 10555 | .get = alc_mux_enum_get, |
| 10556 | .put = alc_mux_enum_put, |
| 10557 | }, |
| 10558 | { |
| 10559 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10560 | .name = "Channel Mode", |
| 10561 | .info = alc_ch_mode_info, |
| 10562 | .get = alc_ch_mode_get, |
| 10563 | .put = alc_ch_mode_put, |
| 10564 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 10565 | }, |
| 10566 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10567 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10568 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10569 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10570 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10571 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10572 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10573 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10574 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10575 | { } |
| 10576 | }; |
| 10577 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10578 | /* |
| 10579 | * generic initialization of ADC, input mixers and output mixers |
| 10580 | */ |
| 10581 | static struct hda_verb alc861_base_init_verbs[] = { |
| 10582 | /* |
| 10583 | * Unmute ADC0 and set the default input to mic-in |
| 10584 | */ |
| 10585 | /* port-A for surround (rear panel) */ |
| 10586 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10587 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10588 | /* port-B for mic-in (rear panel) with vref */ |
| 10589 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10590 | /* port-C for line-in (rear panel) */ |
| 10591 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10592 | /* port-D for Front */ |
| 10593 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10594 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10595 | /* port-E for HP out (front panel) */ |
| 10596 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10597 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10598 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10599 | /* port-F for mic-in (front panel) with vref */ |
| 10600 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10601 | /* port-G for CLFE (rear panel) */ |
| 10602 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10603 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10604 | /* port-H for side (rear panel) */ |
| 10605 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10606 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10607 | /* CD-in */ |
| 10608 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10609 | /* route front mic to ADC1*/ |
| 10610 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10611 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10612 | |
| 10613 | /* Unmute DAC0~3 & spdif out*/ |
| 10614 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10615 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10616 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10617 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10618 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10619 | |
| 10620 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10621 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10622 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10623 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10624 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10625 | |
| 10626 | /* Unmute Stereo Mixer 15 */ |
| 10627 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10628 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10629 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10630 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10631 | |
| 10632 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10633 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10634 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10635 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10636 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10637 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10638 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10639 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10640 | /* hp used DAC 3 (Front) */ |
| 10641 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10642 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10643 | |
| 10644 | { } |
| 10645 | }; |
| 10646 | |
| 10647 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 10648 | /* |
| 10649 | * Unmute ADC0 and set the default input to mic-in |
| 10650 | */ |
| 10651 | /* port-A for surround (rear panel) */ |
| 10652 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10653 | /* port-B for mic-in (rear panel) with vref */ |
| 10654 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10655 | /* port-C for line-in (rear panel) */ |
| 10656 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10657 | /* port-D for Front */ |
| 10658 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10659 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10660 | /* port-E for HP out (front panel) */ |
| 10661 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10662 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10663 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10664 | /* port-F for mic-in (front panel) with vref */ |
| 10665 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10666 | /* port-G for CLFE (rear panel) */ |
| 10667 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10668 | /* port-H for side (rear panel) */ |
| 10669 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10670 | /* CD-in */ |
| 10671 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10672 | /* route front mic to ADC1*/ |
| 10673 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10674 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10675 | /* Unmute DAC0~3 & spdif out*/ |
| 10676 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10677 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10678 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10679 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10680 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10681 | |
| 10682 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10683 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10684 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10685 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10686 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10687 | |
| 10688 | /* Unmute Stereo Mixer 15 */ |
| 10689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10690 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10691 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10692 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10693 | |
| 10694 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10695 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10696 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10697 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10698 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10699 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10700 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10701 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10702 | /* hp used DAC 3 (Front) */ |
| 10703 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10704 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10705 | { } |
| 10706 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10707 | |
| 10708 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 10709 | /* |
| 10710 | * Unmute ADC0 and set the default input to mic-in |
| 10711 | */ |
| 10712 | /* port-A for surround (rear panel) */ |
| 10713 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10714 | /* port-B for mic-in (rear panel) with vref */ |
| 10715 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10716 | /* port-C for line-in (rear panel) */ |
| 10717 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10718 | /* port-D for Front */ |
| 10719 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10720 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10721 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10722 | /* this has to be set to VREF80 */ |
| 10723 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10724 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10725 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10726 | /* port-F for mic-in (front panel) with vref */ |
| 10727 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10728 | /* port-G for CLFE (rear panel) */ |
| 10729 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10730 | /* port-H for side (rear panel) */ |
| 10731 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10732 | /* CD-in */ |
| 10733 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10734 | /* route front mic to ADC1*/ |
| 10735 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10736 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10737 | /* Unmute DAC0~3 & spdif out*/ |
| 10738 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10739 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10740 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10741 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10742 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10743 | |
| 10744 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10745 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10746 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10747 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10748 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10749 | |
| 10750 | /* Unmute Stereo Mixer 15 */ |
| 10751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10752 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10753 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10754 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10755 | |
| 10756 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10757 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10758 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10759 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10760 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10761 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10762 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10763 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10764 | /* hp used DAC 3 (Front) */ |
| 10765 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10766 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10767 | { } |
| 10768 | }; |
| 10769 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10770 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 10771 | /* |
| 10772 | * Unmute ADC0 and set the default input to mic-in |
| 10773 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10774 | /* port-A for surround (rear panel) |
| 10775 | * according to codec#0 this is the HP jack |
| 10776 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10777 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 10778 | /* route front PCM to HP */ |
| 10779 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 10780 | /* port-B for mic-in (rear panel) with vref */ |
| 10781 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10782 | /* port-C for line-in (rear panel) */ |
| 10783 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10784 | /* port-D for Front */ |
| 10785 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10786 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10787 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10788 | /* this has to be set to VREF80 */ |
| 10789 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10790 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10791 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10792 | /* port-F for mic-in (front panel) with vref */ |
| 10793 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10794 | /* port-G for CLFE (rear panel) */ |
| 10795 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10796 | /* port-H for side (rear panel) */ |
| 10797 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10798 | /* CD-in */ |
| 10799 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10800 | /* route front mic to ADC1*/ |
| 10801 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10802 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10803 | /* Unmute DAC0~3 & spdif out*/ |
| 10804 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10805 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10806 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10807 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10808 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10809 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10810 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10811 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10812 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10813 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10814 | |
| 10815 | /* Unmute Stereo Mixer 15 */ |
| 10816 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10817 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10818 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10819 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10820 | |
| 10821 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10822 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10823 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10824 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10825 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10826 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10827 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10828 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10829 | /* hp used DAC 3 (Front) */ |
| 10830 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10831 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10832 | { } |
| 10833 | }; |
| 10834 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10835 | /* additional init verbs for ASUS laptops */ |
| 10836 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 10837 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 10838 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 10839 | { } |
| 10840 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10841 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10842 | /* |
| 10843 | * generic initialization of ADC, input mixers and output mixers |
| 10844 | */ |
| 10845 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 10846 | /* |
| 10847 | * Unmute ADC0 and set the default input to mic-in |
| 10848 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10849 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10850 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10851 | |
| 10852 | /* Unmute DAC0~3 & spdif out*/ |
| 10853 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10854 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10855 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10856 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10857 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10858 | |
| 10859 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10860 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10861 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10862 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10863 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10864 | |
| 10865 | /* Unmute Stereo Mixer 15 */ |
| 10866 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10867 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10868 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10869 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 10870 | |
| 10871 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10872 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10873 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10874 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10875 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10876 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10877 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10878 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10879 | |
| 10880 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10881 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10882 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10883 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10884 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10885 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10886 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10887 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10888 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10889 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10890 | |
| 10891 | { } |
| 10892 | }; |
| 10893 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10894 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 10895 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10896 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10897 | { } |
| 10898 | }; |
| 10899 | |
| 10900 | /* toggle speaker-output according to the hp-jack state */ |
| 10901 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 10902 | { |
| 10903 | unsigned int present; |
| 10904 | |
| 10905 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 10906 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10907 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 10908 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 10909 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 10910 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10911 | } |
| 10912 | |
| 10913 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 10914 | unsigned int res) |
| 10915 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10916 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10917 | alc861_toshiba_automute(codec); |
| 10918 | } |
| 10919 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10920 | /* pcm configuration: identiacal with ALC880 */ |
| 10921 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 10922 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 10923 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 10924 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 10925 | |
| 10926 | |
| 10927 | #define ALC861_DIGOUT_NID 0x07 |
| 10928 | |
| 10929 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 10930 | { 8, NULL } |
| 10931 | }; |
| 10932 | |
| 10933 | static hda_nid_t alc861_dac_nids[4] = { |
| 10934 | /* front, surround, clfe, side */ |
| 10935 | 0x03, 0x06, 0x05, 0x04 |
| 10936 | }; |
| 10937 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10938 | static hda_nid_t alc660_dac_nids[3] = { |
| 10939 | /* front, clfe, surround */ |
| 10940 | 0x03, 0x05, 0x06 |
| 10941 | }; |
| 10942 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10943 | static hda_nid_t alc861_adc_nids[1] = { |
| 10944 | /* ADC0-2 */ |
| 10945 | 0x08, |
| 10946 | }; |
| 10947 | |
| 10948 | static struct hda_input_mux alc861_capture_source = { |
| 10949 | .num_items = 5, |
| 10950 | .items = { |
| 10951 | { "Mic", 0x0 }, |
| 10952 | { "Front Mic", 0x3 }, |
| 10953 | { "Line", 0x1 }, |
| 10954 | { "CD", 0x4 }, |
| 10955 | { "Mixer", 0x5 }, |
| 10956 | }, |
| 10957 | }; |
| 10958 | |
| 10959 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10960 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 10961 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10962 | { |
| 10963 | int i; |
| 10964 | hda_nid_t nid; |
| 10965 | |
| 10966 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10967 | for (i = 0; i < cfg->line_outs; i++) { |
| 10968 | nid = cfg->line_out_pins[i]; |
| 10969 | if (nid) { |
| 10970 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 10971 | continue; |
| 10972 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 10973 | } |
| 10974 | } |
| 10975 | spec->multiout.num_dacs = cfg->line_outs; |
| 10976 | return 0; |
| 10977 | } |
| 10978 | |
| 10979 | /* add playback controls from the parsed DAC table */ |
| 10980 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10981 | const struct auto_pin_cfg *cfg) |
| 10982 | { |
| 10983 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10984 | static const char *chname[4] = { |
| 10985 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 10986 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10987 | hda_nid_t nid; |
| 10988 | int i, idx, err; |
| 10989 | |
| 10990 | for (i = 0; i < cfg->line_outs; i++) { |
| 10991 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10992 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10993 | continue; |
| 10994 | if (nid == 0x05) { |
| 10995 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10996 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10997 | "Center Playback Switch", |
| 10998 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 10999 | HDA_OUTPUT)); |
| 11000 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11001 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11002 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11003 | "LFE Playback Switch", |
| 11004 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11005 | HDA_OUTPUT)); |
| 11006 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11007 | return err; |
| 11008 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11009 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11010 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11011 | if (nid == alc861_dac_nids[idx]) |
| 11012 | break; |
| 11013 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11014 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11015 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11016 | HDA_OUTPUT)); |
| 11017 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11018 | return err; |
| 11019 | } |
| 11020 | } |
| 11021 | return 0; |
| 11022 | } |
| 11023 | |
| 11024 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11025 | { |
| 11026 | int err; |
| 11027 | hda_nid_t nid; |
| 11028 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11029 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11030 | return 0; |
| 11031 | |
| 11032 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11033 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11034 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11035 | "Headphone Playback Switch", |
| 11036 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11037 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11038 | return err; |
| 11039 | spec->multiout.hp_nid = nid; |
| 11040 | } |
| 11041 | return 0; |
| 11042 | } |
| 11043 | |
| 11044 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11045 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11046 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11047 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11048 | struct hda_input_mux *imux = &spec->private_imux; |
| 11049 | int i, err, idx, idx1; |
| 11050 | |
| 11051 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11052 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11053 | case 0x0c: |
| 11054 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11055 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11056 | break; |
| 11057 | case 0x0f: |
| 11058 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11059 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11060 | break; |
| 11061 | case 0x0d: |
| 11062 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11063 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11064 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11065 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11066 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11067 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11068 | break; |
| 11069 | case 0x11: |
| 11070 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11071 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11072 | break; |
| 11073 | default: |
| 11074 | continue; |
| 11075 | } |
| 11076 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11077 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11078 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11079 | if (err < 0) |
| 11080 | return err; |
| 11081 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11082 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11083 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11084 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11085 | } |
| 11086 | return 0; |
| 11087 | } |
| 11088 | |
| 11089 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11090 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11091 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11092 | |
| 11093 | { |
| 11094 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11095 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11096 | * So call somewhat different.. |
| 11097 | *FIXME: the controls appear in the "playback" view! |
| 11098 | */ |
| 11099 | /* .name = "Capture Source", */ |
| 11100 | .name = "Input Source", |
| 11101 | .count = 1, |
| 11102 | .info = alc_mux_enum_info, |
| 11103 | .get = alc_mux_enum_get, |
| 11104 | .put = alc_mux_enum_put, |
| 11105 | }, |
| 11106 | { } /* end */ |
| 11107 | }; |
| 11108 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11109 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11110 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11111 | int pin_type, int dac_idx) |
| 11112 | { |
| 11113 | /* set as output */ |
| 11114 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11115 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11116 | pin_type); |
| 11117 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11118 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11119 | |
| 11120 | } |
| 11121 | |
| 11122 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11123 | { |
| 11124 | struct alc_spec *spec = codec->spec; |
| 11125 | int i; |
| 11126 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11127 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11128 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11129 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11130 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11131 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11132 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11133 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11134 | } |
| 11135 | } |
| 11136 | |
| 11137 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11138 | { |
| 11139 | struct alc_spec *spec = codec->spec; |
| 11140 | hda_nid_t pin; |
| 11141 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11142 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11143 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11144 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11145 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11146 | } |
| 11147 | |
| 11148 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11149 | { |
| 11150 | struct alc_spec *spec = codec->spec; |
| 11151 | int i; |
| 11152 | |
| 11153 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11154 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11155 | if (nid >= 0x0c && nid <= 0x11) { |
| 11156 | snd_hda_codec_write(codec, nid, 0, |
| 11157 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11158 | i <= AUTO_PIN_FRONT_MIC ? |
| 11159 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11160 | } |
| 11161 | } |
| 11162 | } |
| 11163 | |
| 11164 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11165 | /* return 1 if successful, 0 if the proper config is not found, |
| 11166 | * or a negative error code |
| 11167 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11168 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11169 | { |
| 11170 | struct alc_spec *spec = codec->spec; |
| 11171 | int err; |
| 11172 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11173 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11174 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11175 | alc861_ignore); |
| 11176 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11177 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11178 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11179 | return 0; /* can't find valid BIOS pin config */ |
| 11180 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11181 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11182 | if (err < 0) |
| 11183 | return err; |
| 11184 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11185 | if (err < 0) |
| 11186 | return err; |
| 11187 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11188 | if (err < 0) |
| 11189 | return err; |
| 11190 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11191 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11192 | return err; |
| 11193 | |
| 11194 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11195 | |
| 11196 | if (spec->autocfg.dig_out_pin) |
| 11197 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11198 | |
| 11199 | if (spec->kctl_alloc) |
| 11200 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11201 | |
| 11202 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11203 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11204 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11205 | spec->input_mux = &spec->private_imux; |
| 11206 | |
| 11207 | spec->adc_nids = alc861_adc_nids; |
| 11208 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11209 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11210 | spec->num_mixers++; |
| 11211 | |
| 11212 | return 1; |
| 11213 | } |
| 11214 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11215 | /* additional initialization for auto-configuration model */ |
| 11216 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11217 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11218 | alc861_auto_init_multi_out(codec); |
| 11219 | alc861_auto_init_hp_out(codec); |
| 11220 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11221 | } |
| 11222 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11223 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11224 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11225 | { 0x15, HDA_INPUT, 0 }, |
| 11226 | { 0x15, HDA_INPUT, 1 }, |
| 11227 | { 0x15, HDA_INPUT, 2 }, |
| 11228 | { 0x15, HDA_INPUT, 3 }, |
| 11229 | { } /* end */ |
| 11230 | }; |
| 11231 | #endif |
| 11232 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11233 | |
| 11234 | /* |
| 11235 | * configuration and preset |
| 11236 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11237 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11238 | [ALC861_3ST] = "3stack", |
| 11239 | [ALC660_3ST] = "3stack-660", |
| 11240 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11241 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11242 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11243 | [ALC861_TOSHIBA] = "toshiba", |
| 11244 | [ALC861_ASUS] = "asus", |
| 11245 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11246 | [ALC861_AUTO] = "auto", |
| 11247 | }; |
| 11248 | |
| 11249 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11250 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11251 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11252 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11253 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11254 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11255 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11256 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11257 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11258 | * Any other models that need this preset? |
| 11259 | */ |
| 11260 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11261 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11262 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11263 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11264 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11265 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11266 | /* FIXME: the below seems conflict */ |
| 11267 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11268 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11269 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11270 | {} |
| 11271 | }; |
| 11272 | |
| 11273 | static struct alc_config_preset alc861_presets[] = { |
| 11274 | [ALC861_3ST] = { |
| 11275 | .mixers = { alc861_3ST_mixer }, |
| 11276 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11277 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11278 | .dac_nids = alc861_dac_nids, |
| 11279 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11280 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11281 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11282 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11283 | .adc_nids = alc861_adc_nids, |
| 11284 | .input_mux = &alc861_capture_source, |
| 11285 | }, |
| 11286 | [ALC861_3ST_DIG] = { |
| 11287 | .mixers = { alc861_base_mixer }, |
| 11288 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11289 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11290 | .dac_nids = alc861_dac_nids, |
| 11291 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11292 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11293 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11294 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11295 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11296 | .adc_nids = alc861_adc_nids, |
| 11297 | .input_mux = &alc861_capture_source, |
| 11298 | }, |
| 11299 | [ALC861_6ST_DIG] = { |
| 11300 | .mixers = { alc861_base_mixer }, |
| 11301 | .init_verbs = { alc861_base_init_verbs }, |
| 11302 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11303 | .dac_nids = alc861_dac_nids, |
| 11304 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11305 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 11306 | .channel_mode = alc861_8ch_modes, |
| 11307 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11308 | .adc_nids = alc861_adc_nids, |
| 11309 | .input_mux = &alc861_capture_source, |
| 11310 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11311 | [ALC660_3ST] = { |
| 11312 | .mixers = { alc861_3ST_mixer }, |
| 11313 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11314 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 11315 | .dac_nids = alc660_dac_nids, |
| 11316 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11317 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11318 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11319 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11320 | .adc_nids = alc861_adc_nids, |
| 11321 | .input_mux = &alc861_capture_source, |
| 11322 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11323 | [ALC861_UNIWILL_M31] = { |
| 11324 | .mixers = { alc861_uniwill_m31_mixer }, |
| 11325 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 11326 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11327 | .dac_nids = alc861_dac_nids, |
| 11328 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11329 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11330 | .channel_mode = alc861_uniwill_m31_modes, |
| 11331 | .need_dac_fix = 1, |
| 11332 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11333 | .adc_nids = alc861_adc_nids, |
| 11334 | .input_mux = &alc861_capture_source, |
| 11335 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11336 | [ALC861_TOSHIBA] = { |
| 11337 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11338 | .init_verbs = { alc861_base_init_verbs, |
| 11339 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11340 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11341 | .dac_nids = alc861_dac_nids, |
| 11342 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11343 | .channel_mode = alc883_3ST_2ch_modes, |
| 11344 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11345 | .adc_nids = alc861_adc_nids, |
| 11346 | .input_mux = &alc861_capture_source, |
| 11347 | .unsol_event = alc861_toshiba_unsol_event, |
| 11348 | .init_hook = alc861_toshiba_automute, |
| 11349 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11350 | [ALC861_ASUS] = { |
| 11351 | .mixers = { alc861_asus_mixer }, |
| 11352 | .init_verbs = { alc861_asus_init_verbs }, |
| 11353 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11354 | .dac_nids = alc861_dac_nids, |
| 11355 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11356 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 11357 | .channel_mode = alc861_asus_modes, |
| 11358 | .need_dac_fix = 1, |
| 11359 | .hp_nid = 0x06, |
| 11360 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11361 | .adc_nids = alc861_adc_nids, |
| 11362 | .input_mux = &alc861_capture_source, |
| 11363 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11364 | [ALC861_ASUS_LAPTOP] = { |
| 11365 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 11366 | .init_verbs = { alc861_asus_init_verbs, |
| 11367 | alc861_asus_laptop_init_verbs }, |
| 11368 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11369 | .dac_nids = alc861_dac_nids, |
| 11370 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11371 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11372 | .channel_mode = alc883_3ST_2ch_modes, |
| 11373 | .need_dac_fix = 1, |
| 11374 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11375 | .adc_nids = alc861_adc_nids, |
| 11376 | .input_mux = &alc861_capture_source, |
| 11377 | }, |
| 11378 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11379 | |
| 11380 | |
| 11381 | static int patch_alc861(struct hda_codec *codec) |
| 11382 | { |
| 11383 | struct alc_spec *spec; |
| 11384 | int board_config; |
| 11385 | int err; |
| 11386 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11387 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11388 | if (spec == NULL) |
| 11389 | return -ENOMEM; |
| 11390 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11391 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11392 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11393 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 11394 | alc861_models, |
| 11395 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11396 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11397 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11398 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 11399 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11400 | board_config = ALC861_AUTO; |
| 11401 | } |
| 11402 | |
| 11403 | if (board_config == ALC861_AUTO) { |
| 11404 | /* automatic parse from the BIOS config */ |
| 11405 | err = alc861_parse_auto_config(codec); |
| 11406 | if (err < 0) { |
| 11407 | alc_free(codec); |
| 11408 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11409 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11410 | printk(KERN_INFO |
| 11411 | "hda_codec: Cannot set up configuration " |
| 11412 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11413 | board_config = ALC861_3ST_DIG; |
| 11414 | } |
| 11415 | } |
| 11416 | |
| 11417 | if (board_config != ALC861_AUTO) |
| 11418 | setup_preset(spec, &alc861_presets[board_config]); |
| 11419 | |
| 11420 | spec->stream_name_analog = "ALC861 Analog"; |
| 11421 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 11422 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 11423 | |
| 11424 | spec->stream_name_digital = "ALC861 Digital"; |
| 11425 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 11426 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 11427 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11428 | spec->vmaster_nid = 0x03; |
| 11429 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11430 | codec->patch_ops = alc_patch_ops; |
| 11431 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11432 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11433 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11434 | if (!spec->loopback.amplist) |
| 11435 | spec->loopback.amplist = alc861_loopbacks; |
| 11436 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11437 | |
| 11438 | return 0; |
| 11439 | } |
| 11440 | |
| 11441 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11442 | * ALC861-VD support |
| 11443 | * |
| 11444 | * Based on ALC882 |
| 11445 | * |
| 11446 | * In addition, an independent DAC |
| 11447 | */ |
| 11448 | #define ALC861VD_DIGOUT_NID 0x06 |
| 11449 | |
| 11450 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 11451 | /* front, surr, clfe, side surr */ |
| 11452 | 0x02, 0x03, 0x04, 0x05 |
| 11453 | }; |
| 11454 | |
| 11455 | /* dac_nids for ALC660vd are in a different order - according to |
| 11456 | * Realtek's driver. |
| 11457 | * This should probably tesult in a different mixer for 6stack models |
| 11458 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 11459 | * - and it is the same as in 861vd. |
| 11460 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 11461 | */ |
| 11462 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 11463 | /* front, rear, clfe, rear_surr */ |
| 11464 | 0x02, 0x04, 0x03 |
| 11465 | }; |
| 11466 | |
| 11467 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 11468 | /* ADC0 */ |
| 11469 | 0x09, |
| 11470 | }; |
| 11471 | |
| 11472 | /* input MUX */ |
| 11473 | /* FIXME: should be a matrix-type input source selection */ |
| 11474 | static struct hda_input_mux alc861vd_capture_source = { |
| 11475 | .num_items = 4, |
| 11476 | .items = { |
| 11477 | { "Mic", 0x0 }, |
| 11478 | { "Front Mic", 0x1 }, |
| 11479 | { "Line", 0x2 }, |
| 11480 | { "CD", 0x4 }, |
| 11481 | }, |
| 11482 | }; |
| 11483 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11484 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 11485 | .num_items = 3, |
| 11486 | .items = { |
| 11487 | { "Front Mic", 0x0 }, |
| 11488 | { "ATAPI Mic", 0x1 }, |
| 11489 | { "Line In", 0x5 }, |
| 11490 | }, |
| 11491 | }; |
| 11492 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11493 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 11494 | .num_items = 2, |
| 11495 | .items = { |
| 11496 | { "Front Mic", 0x0 }, |
| 11497 | { "ATAPI Mic", 0x1 }, |
| 11498 | }, |
| 11499 | }; |
| 11500 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11501 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 11502 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 11503 | |
| 11504 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11505 | struct snd_ctl_elem_value *ucontrol) |
| 11506 | { |
| 11507 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11508 | struct alc_spec *spec = codec->spec; |
| 11509 | const struct hda_input_mux *imux = spec->input_mux; |
| 11510 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 11511 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 11512 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 11513 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 11514 | unsigned int i, idx; |
| 11515 | |
| 11516 | idx = ucontrol->value.enumerated.item[0]; |
| 11517 | if (idx >= imux->num_items) |
| 11518 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11519 | if (*cur_val == idx) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11520 | return 0; |
| 11521 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11522 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 11523 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 11524 | imux->items[i].index, |
| 11525 | HDA_AMP_MUTE, v); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11526 | } |
| 11527 | *cur_val = idx; |
| 11528 | return 1; |
| 11529 | } |
| 11530 | |
| 11531 | /* |
| 11532 | * 2ch mode |
| 11533 | */ |
| 11534 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 11535 | { 2, NULL } |
| 11536 | }; |
| 11537 | |
| 11538 | /* |
| 11539 | * 6ch mode |
| 11540 | */ |
| 11541 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 11542 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11543 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11544 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11545 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11546 | { } /* end */ |
| 11547 | }; |
| 11548 | |
| 11549 | /* |
| 11550 | * 8ch mode |
| 11551 | */ |
| 11552 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 11553 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11554 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11555 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11556 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11557 | { } /* end */ |
| 11558 | }; |
| 11559 | |
| 11560 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 11561 | { 6, alc861vd_6stack_ch6_init }, |
| 11562 | { 8, alc861vd_6stack_ch8_init }, |
| 11563 | }; |
| 11564 | |
| 11565 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 11566 | { |
| 11567 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11568 | .name = "Channel Mode", |
| 11569 | .info = alc_ch_mode_info, |
| 11570 | .get = alc_ch_mode_get, |
| 11571 | .put = alc_ch_mode_put, |
| 11572 | }, |
| 11573 | { } /* end */ |
| 11574 | }; |
| 11575 | |
| 11576 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 11577 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11578 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11579 | |
| 11580 | { |
| 11581 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11582 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11583 | * So call somewhat different.. |
| 11584 | *FIXME: the controls appear in the "playback" view! |
| 11585 | */ |
| 11586 | /* .name = "Capture Source", */ |
| 11587 | .name = "Input Source", |
| 11588 | .count = 1, |
| 11589 | .info = alc861vd_mux_enum_info, |
| 11590 | .get = alc861vd_mux_enum_get, |
| 11591 | .put = alc861vd_mux_enum_put, |
| 11592 | }, |
| 11593 | { } /* end */ |
| 11594 | }; |
| 11595 | |
| 11596 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 11597 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 11598 | */ |
| 11599 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 11600 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11601 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11602 | |
| 11603 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11604 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11605 | |
| 11606 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 11607 | HDA_OUTPUT), |
| 11608 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 11609 | HDA_OUTPUT), |
| 11610 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11611 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 11612 | |
| 11613 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 11614 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11615 | |
| 11616 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11617 | |
| 11618 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11619 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11620 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11621 | |
| 11622 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11623 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11624 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11625 | |
| 11626 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11627 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11628 | |
| 11629 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11630 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11631 | |
| 11632 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11633 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11634 | |
| 11635 | { } /* end */ |
| 11636 | }; |
| 11637 | |
| 11638 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 11639 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11640 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11641 | |
| 11642 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11643 | |
| 11644 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11645 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11646 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11647 | |
| 11648 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11649 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11650 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11651 | |
| 11652 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11653 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11654 | |
| 11655 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11656 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11657 | |
| 11658 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11659 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11660 | |
| 11661 | { } /* end */ |
| 11662 | }; |
| 11663 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11664 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 11665 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11666 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 11667 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11668 | |
| 11669 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11670 | |
| 11671 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11674 | |
| 11675 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11676 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11677 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11678 | |
| 11679 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11680 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11681 | |
| 11682 | { } /* end */ |
| 11683 | }; |
| 11684 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11685 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 11686 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 11687 | */ |
| 11688 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 11689 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11690 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11691 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11692 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11693 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11694 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11695 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11696 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11697 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11698 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11699 | { } /* end */ |
| 11700 | }; |
| 11701 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11702 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 11703 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 11704 | */ |
| 11705 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 11706 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11707 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11708 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11709 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11710 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11711 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11712 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11713 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11714 | |
| 11715 | { } /* end */ |
| 11716 | }; |
| 11717 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11718 | /* |
| 11719 | * generic initialization of ADC, input mixers and output mixers |
| 11720 | */ |
| 11721 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 11722 | /* |
| 11723 | * Unmute ADC0 and set the default input to mic-in |
| 11724 | */ |
| 11725 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11726 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11727 | |
| 11728 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 11729 | * the analog-loopback mixer widget |
| 11730 | */ |
| 11731 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11732 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11733 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11734 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11735 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11736 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11737 | |
| 11738 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11739 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11740 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11741 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11742 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11743 | |
| 11744 | /* |
| 11745 | * Set up output mixers (0x02 - 0x05) |
| 11746 | */ |
| 11747 | /* set vol=0 to output mixers */ |
| 11748 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11749 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11750 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11751 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11752 | |
| 11753 | /* set up input amps for analog loopback */ |
| 11754 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11755 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11756 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11757 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11758 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11759 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11760 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11761 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11762 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11763 | |
| 11764 | { } |
| 11765 | }; |
| 11766 | |
| 11767 | /* |
| 11768 | * 3-stack pin configuration: |
| 11769 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 11770 | */ |
| 11771 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 11772 | /* |
| 11773 | * Set pin mode and muting |
| 11774 | */ |
| 11775 | /* set front pin widgets 0x14 for output */ |
| 11776 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11777 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11778 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11779 | |
| 11780 | /* Mic (rear) pin: input vref at 80% */ |
| 11781 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11782 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11783 | /* Front Mic pin: input vref at 80% */ |
| 11784 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11785 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11786 | /* Line In pin: input */ |
| 11787 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11788 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11789 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11790 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11791 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11792 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11793 | /* CD pin widget for input */ |
| 11794 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11795 | |
| 11796 | { } |
| 11797 | }; |
| 11798 | |
| 11799 | /* |
| 11800 | * 6-stack pin configuration: |
| 11801 | */ |
| 11802 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 11803 | /* |
| 11804 | * Set pin mode and muting |
| 11805 | */ |
| 11806 | /* set front pin widgets 0x14 for output */ |
| 11807 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11809 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11810 | |
| 11811 | /* Rear Pin: output 1 (0x0d) */ |
| 11812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11814 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11815 | /* CLFE Pin: output 2 (0x0e) */ |
| 11816 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11817 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11818 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 11819 | /* Side Pin: output 3 (0x0f) */ |
| 11820 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11821 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11822 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 11823 | |
| 11824 | /* Mic (rear) pin: input vref at 80% */ |
| 11825 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11826 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11827 | /* Front Mic pin: input vref at 80% */ |
| 11828 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11829 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11830 | /* Line In pin: input */ |
| 11831 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11832 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11833 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11834 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11835 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11836 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11837 | /* CD pin widget for input */ |
| 11838 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11839 | |
| 11840 | { } |
| 11841 | }; |
| 11842 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11843 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 11844 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11845 | { } |
| 11846 | }; |
| 11847 | |
| 11848 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 11849 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11850 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11851 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11852 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11853 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11854 | {} |
| 11855 | }; |
| 11856 | |
| 11857 | /* toggle speaker-output according to the hp-jack state */ |
| 11858 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 11859 | { |
| 11860 | unsigned int present; |
| 11861 | unsigned char bits; |
| 11862 | |
| 11863 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 11864 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11865 | bits = present ? HDA_AMP_MUTE : 0; |
| 11866 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11867 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11868 | } |
| 11869 | |
| 11870 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 11871 | { |
| 11872 | unsigned int present; |
| 11873 | unsigned char bits; |
| 11874 | |
| 11875 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11876 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11877 | bits = present ? HDA_AMP_MUTE : 0; |
| 11878 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 11879 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11880 | } |
| 11881 | |
| 11882 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 11883 | { |
| 11884 | alc861vd_lenovo_hp_automute(codec); |
| 11885 | alc861vd_lenovo_mic_automute(codec); |
| 11886 | } |
| 11887 | |
| 11888 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 11889 | unsigned int res) |
| 11890 | { |
| 11891 | switch (res >> 26) { |
| 11892 | case ALC880_HP_EVENT: |
| 11893 | alc861vd_lenovo_hp_automute(codec); |
| 11894 | break; |
| 11895 | case ALC880_MIC_EVENT: |
| 11896 | alc861vd_lenovo_mic_automute(codec); |
| 11897 | break; |
| 11898 | } |
| 11899 | } |
| 11900 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11901 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 11902 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11903 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11904 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11905 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11906 | |
| 11907 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11909 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11911 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11912 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11913 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11914 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11915 | |
| 11916 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11917 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11918 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11919 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11920 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11921 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11922 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11923 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11924 | |
| 11925 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11926 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11927 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11928 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11929 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11930 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11931 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11932 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11933 | |
| 11934 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11935 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11936 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11937 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11938 | |
| 11939 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11940 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11941 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11942 | |
| 11943 | { } /* end */ |
| 11944 | }; |
| 11945 | |
| 11946 | /* toggle speaker-output according to the hp-jack state */ |
| 11947 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 11948 | { |
| 11949 | unsigned int present; |
| 11950 | |
| 11951 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11952 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11953 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11954 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11955 | } |
| 11956 | |
| 11957 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11958 | { |
| 11959 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11960 | alc861vd_dallas_automute(codec); |
| 11961 | } |
| 11962 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11963 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11964 | #define alc861vd_loopbacks alc880_loopbacks |
| 11965 | #endif |
| 11966 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11967 | /* pcm configuration: identiacal with ALC880 */ |
| 11968 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 11969 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 11970 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 11971 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 11972 | |
| 11973 | /* |
| 11974 | * configuration and preset |
| 11975 | */ |
| 11976 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 11977 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11978 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11979 | [ALC861VD_3ST] = "3stack", |
| 11980 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 11981 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11982 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11983 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11984 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11985 | [ALC861VD_AUTO] = "auto", |
| 11986 | }; |
| 11987 | |
| 11988 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11989 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 11990 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 11991 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11992 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 11993 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11994 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11995 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 11996 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11997 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 11998 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 11999 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12000 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12001 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12002 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12003 | {} |
| 12004 | }; |
| 12005 | |
| 12006 | static struct alc_config_preset alc861vd_presets[] = { |
| 12007 | [ALC660VD_3ST] = { |
| 12008 | .mixers = { alc861vd_3st_mixer }, |
| 12009 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12010 | alc861vd_3stack_init_verbs }, |
| 12011 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12012 | .dac_nids = alc660vd_dac_nids, |
| 12013 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12014 | .adc_nids = alc861vd_adc_nids, |
| 12015 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12016 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12017 | .input_mux = &alc861vd_capture_source, |
| 12018 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12019 | [ALC660VD_3ST_DIG] = { |
| 12020 | .mixers = { alc861vd_3st_mixer }, |
| 12021 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12022 | alc861vd_3stack_init_verbs }, |
| 12023 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12024 | .dac_nids = alc660vd_dac_nids, |
| 12025 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12026 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12027 | .adc_nids = alc861vd_adc_nids, |
| 12028 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12029 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12030 | .input_mux = &alc861vd_capture_source, |
| 12031 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12032 | [ALC861VD_3ST] = { |
| 12033 | .mixers = { alc861vd_3st_mixer }, |
| 12034 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12035 | alc861vd_3stack_init_verbs }, |
| 12036 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12037 | .dac_nids = alc861vd_dac_nids, |
| 12038 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12039 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12040 | .input_mux = &alc861vd_capture_source, |
| 12041 | }, |
| 12042 | [ALC861VD_3ST_DIG] = { |
| 12043 | .mixers = { alc861vd_3st_mixer }, |
| 12044 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12045 | alc861vd_3stack_init_verbs }, |
| 12046 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12047 | .dac_nids = alc861vd_dac_nids, |
| 12048 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12049 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12050 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12051 | .input_mux = &alc861vd_capture_source, |
| 12052 | }, |
| 12053 | [ALC861VD_6ST_DIG] = { |
| 12054 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12055 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12056 | alc861vd_6stack_init_verbs }, |
| 12057 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12058 | .dac_nids = alc861vd_dac_nids, |
| 12059 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12060 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12061 | .channel_mode = alc861vd_6stack_modes, |
| 12062 | .input_mux = &alc861vd_capture_source, |
| 12063 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12064 | [ALC861VD_LENOVO] = { |
| 12065 | .mixers = { alc861vd_lenovo_mixer }, |
| 12066 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12067 | alc861vd_3stack_init_verbs, |
| 12068 | alc861vd_eapd_verbs, |
| 12069 | alc861vd_lenovo_unsol_verbs }, |
| 12070 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12071 | .dac_nids = alc660vd_dac_nids, |
| 12072 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12073 | .adc_nids = alc861vd_adc_nids, |
| 12074 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12075 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12076 | .input_mux = &alc861vd_capture_source, |
| 12077 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12078 | .init_hook = alc861vd_lenovo_automute, |
| 12079 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12080 | [ALC861VD_DALLAS] = { |
| 12081 | .mixers = { alc861vd_dallas_mixer }, |
| 12082 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12083 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12084 | .dac_nids = alc861vd_dac_nids, |
| 12085 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12086 | .adc_nids = alc861vd_adc_nids, |
| 12087 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12088 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12089 | .input_mux = &alc861vd_dallas_capture_source, |
| 12090 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12091 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12092 | }, |
| 12093 | [ALC861VD_HP] = { |
| 12094 | .mixers = { alc861vd_hp_mixer }, |
| 12095 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12096 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12097 | .dac_nids = alc861vd_dac_nids, |
| 12098 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12099 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12100 | .adc_nids = alc861vd_adc_nids, |
| 12101 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12102 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12103 | .input_mux = &alc861vd_hp_capture_source, |
| 12104 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12105 | .init_hook = alc861vd_dallas_automute, |
| 12106 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12107 | }; |
| 12108 | |
| 12109 | /* |
| 12110 | * BIOS auto configuration |
| 12111 | */ |
| 12112 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12113 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12114 | { |
| 12115 | /* set as output */ |
| 12116 | snd_hda_codec_write(codec, nid, 0, |
| 12117 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 12118 | snd_hda_codec_write(codec, nid, 0, |
| 12119 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 12120 | } |
| 12121 | |
| 12122 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12123 | { |
| 12124 | struct alc_spec *spec = codec->spec; |
| 12125 | int i; |
| 12126 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12127 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12128 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12129 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12130 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12131 | if (nid) |
| 12132 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12133 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12134 | } |
| 12135 | } |
| 12136 | |
| 12137 | |
| 12138 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12139 | { |
| 12140 | struct alc_spec *spec = codec->spec; |
| 12141 | hda_nid_t pin; |
| 12142 | |
| 12143 | pin = spec->autocfg.hp_pins[0]; |
| 12144 | if (pin) /* connect to front and use dac 0 */ |
| 12145 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 12146 | } |
| 12147 | |
| 12148 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12149 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12150 | |
| 12151 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12152 | { |
| 12153 | struct alc_spec *spec = codec->spec; |
| 12154 | int i; |
| 12155 | |
| 12156 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12157 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12158 | if (alc861vd_is_input_pin(nid)) { |
| 12159 | snd_hda_codec_write(codec, nid, 0, |
| 12160 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12161 | i <= AUTO_PIN_FRONT_MIC ? |
| 12162 | PIN_VREF80 : PIN_IN); |
| 12163 | if (nid != ALC861VD_PIN_CD_NID) |
| 12164 | snd_hda_codec_write(codec, nid, 0, |
| 12165 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12166 | AMP_OUT_MUTE); |
| 12167 | } |
| 12168 | } |
| 12169 | } |
| 12170 | |
| 12171 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12172 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12173 | |
| 12174 | /* add playback controls from the parsed DAC table */ |
| 12175 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12176 | * different NIDs for mute/unmute switch and volume control */ |
| 12177 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12178 | const struct auto_pin_cfg *cfg) |
| 12179 | { |
| 12180 | char name[32]; |
| 12181 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12182 | hda_nid_t nid_v, nid_s; |
| 12183 | int i, err; |
| 12184 | |
| 12185 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12186 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12187 | continue; |
| 12188 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12189 | alc880_dac_to_idx( |
| 12190 | spec->multiout.dac_nids[i])); |
| 12191 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12192 | alc880_dac_to_idx( |
| 12193 | spec->multiout.dac_nids[i])); |
| 12194 | |
| 12195 | if (i == 2) { |
| 12196 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12197 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12198 | "Center Playback Volume", |
| 12199 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12200 | HDA_OUTPUT)); |
| 12201 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12202 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12203 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12204 | "LFE Playback Volume", |
| 12205 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12206 | HDA_OUTPUT)); |
| 12207 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12208 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12209 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12210 | "Center Playback Switch", |
| 12211 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12212 | HDA_INPUT)); |
| 12213 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12214 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12215 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12216 | "LFE Playback Switch", |
| 12217 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12218 | HDA_INPUT)); |
| 12219 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12220 | return err; |
| 12221 | } else { |
| 12222 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12223 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12224 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12225 | HDA_OUTPUT)); |
| 12226 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12227 | return err; |
| 12228 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12229 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12230 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12231 | HDA_INPUT)); |
| 12232 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12233 | return err; |
| 12234 | } |
| 12235 | } |
| 12236 | return 0; |
| 12237 | } |
| 12238 | |
| 12239 | /* add playback controls for speaker and HP outputs */ |
| 12240 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12241 | * different NIDs for mute/unmute switch and volume control */ |
| 12242 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12243 | hda_nid_t pin, const char *pfx) |
| 12244 | { |
| 12245 | hda_nid_t nid_v, nid_s; |
| 12246 | int err; |
| 12247 | char name[32]; |
| 12248 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12249 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12250 | return 0; |
| 12251 | |
| 12252 | if (alc880_is_fixed_pin(pin)) { |
| 12253 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12254 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12255 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12256 | spec->multiout.hp_nid = nid_v; |
| 12257 | else |
| 12258 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12259 | /* control HP volume/switch on the output mixer amp */ |
| 12260 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12261 | alc880_fixed_pin_idx(pin)); |
| 12262 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12263 | alc880_fixed_pin_idx(pin)); |
| 12264 | |
| 12265 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12266 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12267 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12268 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12269 | return err; |
| 12270 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12271 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12272 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12273 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12274 | return err; |
| 12275 | } else if (alc880_is_multi_pin(pin)) { |
| 12276 | /* set manual connection */ |
| 12277 | /* we have only a switch on HP-out PIN */ |
| 12278 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12279 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12280 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12281 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12282 | return err; |
| 12283 | } |
| 12284 | return 0; |
| 12285 | } |
| 12286 | |
| 12287 | /* parse the BIOS configuration and set up the alc_spec |
| 12288 | * return 1 if successful, 0 if the proper config is not found, |
| 12289 | * or a negative error code |
| 12290 | * Based on ALC880 version - had to change it to override |
| 12291 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12292 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12293 | { |
| 12294 | struct alc_spec *spec = codec->spec; |
| 12295 | int err; |
| 12296 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12297 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12298 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12299 | alc861vd_ignore); |
| 12300 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12301 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12302 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12303 | return 0; /* can't find valid BIOS pin config */ |
| 12304 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12305 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12306 | if (err < 0) |
| 12307 | return err; |
| 12308 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12309 | if (err < 0) |
| 12310 | return err; |
| 12311 | err = alc861vd_auto_create_extra_out(spec, |
| 12312 | spec->autocfg.speaker_pins[0], |
| 12313 | "Speaker"); |
| 12314 | if (err < 0) |
| 12315 | return err; |
| 12316 | err = alc861vd_auto_create_extra_out(spec, |
| 12317 | spec->autocfg.hp_pins[0], |
| 12318 | "Headphone"); |
| 12319 | if (err < 0) |
| 12320 | return err; |
| 12321 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12322 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12323 | return err; |
| 12324 | |
| 12325 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12326 | |
| 12327 | if (spec->autocfg.dig_out_pin) |
| 12328 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 12329 | |
| 12330 | if (spec->kctl_alloc) |
| 12331 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12332 | |
| 12333 | spec->init_verbs[spec->num_init_verbs++] |
| 12334 | = alc861vd_volume_init_verbs; |
| 12335 | |
| 12336 | spec->num_mux_defs = 1; |
| 12337 | spec->input_mux = &spec->private_imux; |
| 12338 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12339 | err = alc_auto_add_mic_boost(codec); |
| 12340 | if (err < 0) |
| 12341 | return err; |
| 12342 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12343 | return 1; |
| 12344 | } |
| 12345 | |
| 12346 | /* additional initialization for auto-configuration model */ |
| 12347 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 12348 | { |
| 12349 | alc861vd_auto_init_multi_out(codec); |
| 12350 | alc861vd_auto_init_hp_out(codec); |
| 12351 | alc861vd_auto_init_analog_input(codec); |
| 12352 | } |
| 12353 | |
| 12354 | static int patch_alc861vd(struct hda_codec *codec) |
| 12355 | { |
| 12356 | struct alc_spec *spec; |
| 12357 | int err, board_config; |
| 12358 | |
| 12359 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12360 | if (spec == NULL) |
| 12361 | return -ENOMEM; |
| 12362 | |
| 12363 | codec->spec = spec; |
| 12364 | |
| 12365 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 12366 | alc861vd_models, |
| 12367 | alc861vd_cfg_tbl); |
| 12368 | |
| 12369 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 12370 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 12371 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 12372 | board_config = ALC861VD_AUTO; |
| 12373 | } |
| 12374 | |
| 12375 | if (board_config == ALC861VD_AUTO) { |
| 12376 | /* automatic parse from the BIOS config */ |
| 12377 | err = alc861vd_parse_auto_config(codec); |
| 12378 | if (err < 0) { |
| 12379 | alc_free(codec); |
| 12380 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12381 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12382 | printk(KERN_INFO |
| 12383 | "hda_codec: Cannot set up configuration " |
| 12384 | "from BIOS. Using base mode...\n"); |
| 12385 | board_config = ALC861VD_3ST; |
| 12386 | } |
| 12387 | } |
| 12388 | |
| 12389 | if (board_config != ALC861VD_AUTO) |
| 12390 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 12391 | |
| 12392 | spec->stream_name_analog = "ALC861VD Analog"; |
| 12393 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 12394 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 12395 | |
| 12396 | spec->stream_name_digital = "ALC861VD Digital"; |
| 12397 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 12398 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 12399 | |
| 12400 | spec->adc_nids = alc861vd_adc_nids; |
| 12401 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 12402 | |
| 12403 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 12404 | spec->num_mixers++; |
| 12405 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12406 | spec->vmaster_nid = 0x02; |
| 12407 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12408 | codec->patch_ops = alc_patch_ops; |
| 12409 | |
| 12410 | if (board_config == ALC861VD_AUTO) |
| 12411 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12412 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12413 | if (!spec->loopback.amplist) |
| 12414 | spec->loopback.amplist = alc861vd_loopbacks; |
| 12415 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12416 | |
| 12417 | return 0; |
| 12418 | } |
| 12419 | |
| 12420 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12421 | * ALC662 support |
| 12422 | * |
| 12423 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 12424 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 12425 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 12426 | * 6-channel independent captures. |
| 12427 | * |
| 12428 | * In addition, an independent DAC for the multi-playback (not used in this |
| 12429 | * driver yet). |
| 12430 | */ |
| 12431 | #define ALC662_DIGOUT_NID 0x06 |
| 12432 | #define ALC662_DIGIN_NID 0x0a |
| 12433 | |
| 12434 | static hda_nid_t alc662_dac_nids[4] = { |
| 12435 | /* front, rear, clfe, rear_surr */ |
| 12436 | 0x02, 0x03, 0x04 |
| 12437 | }; |
| 12438 | |
| 12439 | static hda_nid_t alc662_adc_nids[1] = { |
| 12440 | /* ADC1-2 */ |
| 12441 | 0x09, |
| 12442 | }; |
| 12443 | /* input MUX */ |
| 12444 | /* FIXME: should be a matrix-type input source selection */ |
| 12445 | |
| 12446 | static struct hda_input_mux alc662_capture_source = { |
| 12447 | .num_items = 4, |
| 12448 | .items = { |
| 12449 | { "Mic", 0x0 }, |
| 12450 | { "Front Mic", 0x1 }, |
| 12451 | { "Line", 0x2 }, |
| 12452 | { "CD", 0x4 }, |
| 12453 | }, |
| 12454 | }; |
| 12455 | |
| 12456 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 12457 | .num_items = 2, |
| 12458 | .items = { |
| 12459 | { "Mic", 0x1 }, |
| 12460 | { "Line", 0x2 }, |
| 12461 | }, |
| 12462 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12463 | |
| 12464 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 12465 | .num_items = 2, |
| 12466 | .items = { |
| 12467 | { "i-Mic", 0x1 }, |
| 12468 | { "e-Mic", 0x0 }, |
| 12469 | }, |
| 12470 | }; |
| 12471 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12472 | #define alc662_mux_enum_info alc_mux_enum_info |
| 12473 | #define alc662_mux_enum_get alc_mux_enum_get |
| 12474 | |
| 12475 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12476 | struct snd_ctl_elem_value *ucontrol) |
| 12477 | { |
| 12478 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12479 | struct alc_spec *spec = codec->spec; |
| 12480 | const struct hda_input_mux *imux = spec->input_mux; |
| 12481 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12482 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12483 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 12484 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 12485 | unsigned int i, idx; |
| 12486 | |
| 12487 | idx = ucontrol->value.enumerated.item[0]; |
| 12488 | if (idx >= imux->num_items) |
| 12489 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 12490 | if (*cur_val == idx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12491 | return 0; |
| 12492 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12493 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 12494 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 12495 | imux->items[i].index, |
| 12496 | HDA_AMP_MUTE, v); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12497 | } |
| 12498 | *cur_val = idx; |
| 12499 | return 1; |
| 12500 | } |
| 12501 | /* |
| 12502 | * 2ch mode |
| 12503 | */ |
| 12504 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 12505 | { 2, NULL } |
| 12506 | }; |
| 12507 | |
| 12508 | /* |
| 12509 | * 2ch mode |
| 12510 | */ |
| 12511 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 12512 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 12513 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12514 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 12515 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12516 | { } /* end */ |
| 12517 | }; |
| 12518 | |
| 12519 | /* |
| 12520 | * 6ch mode |
| 12521 | */ |
| 12522 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 12523 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12524 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12525 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 12526 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12527 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12528 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12529 | { } /* end */ |
| 12530 | }; |
| 12531 | |
| 12532 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 12533 | { 2, alc662_3ST_ch2_init }, |
| 12534 | { 6, alc662_3ST_ch6_init }, |
| 12535 | }; |
| 12536 | |
| 12537 | /* |
| 12538 | * 2ch mode |
| 12539 | */ |
| 12540 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 12541 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12542 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12543 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12544 | { } /* end */ |
| 12545 | }; |
| 12546 | |
| 12547 | /* |
| 12548 | * 6ch mode |
| 12549 | */ |
| 12550 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 12551 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12552 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12553 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12554 | { } /* end */ |
| 12555 | }; |
| 12556 | |
| 12557 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 12558 | { 2, alc662_sixstack_ch6_init }, |
| 12559 | { 6, alc662_sixstack_ch8_init }, |
| 12560 | }; |
| 12561 | |
| 12562 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12563 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12564 | */ |
| 12565 | |
| 12566 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 12567 | /* output mixer control */ |
| 12568 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12569 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 12570 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12571 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12572 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12573 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12574 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12575 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12576 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12577 | |
| 12578 | /*Input mixer control */ |
| 12579 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 12580 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 12581 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 12582 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 12583 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 12584 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 12585 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 12586 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12587 | { } /* end */ |
| 12588 | }; |
| 12589 | |
| 12590 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 12591 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12592 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12593 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12594 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12595 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12596 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12597 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12598 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12599 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12600 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12601 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12602 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12603 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12604 | { } /* end */ |
| 12605 | }; |
| 12606 | |
| 12607 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 12608 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12609 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12610 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12611 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12612 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12613 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12614 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12615 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12616 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12617 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12618 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12619 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12620 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12621 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12622 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12623 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12624 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12625 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12626 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12627 | { } /* end */ |
| 12628 | }; |
| 12629 | |
| 12630 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 12631 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12632 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12633 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12634 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT), |
| 12635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12636 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12637 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12640 | { } /* end */ |
| 12641 | }; |
| 12642 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12643 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
| 12644 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12645 | |
| 12646 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12647 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12648 | |
| 12649 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 12650 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12651 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12652 | |
| 12653 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 12654 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12655 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12656 | { } /* end */ |
| 12657 | }; |
| 12658 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12659 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
| 12660 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12661 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12662 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12663 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12664 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12665 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12666 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12667 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12668 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12669 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12670 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12671 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12674 | { } /* end */ |
| 12675 | }; |
| 12676 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12677 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 12678 | { |
| 12679 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12680 | .name = "Channel Mode", |
| 12681 | .info = alc_ch_mode_info, |
| 12682 | .get = alc_ch_mode_get, |
| 12683 | .put = alc_ch_mode_put, |
| 12684 | }, |
| 12685 | { } /* end */ |
| 12686 | }; |
| 12687 | |
| 12688 | static struct hda_verb alc662_init_verbs[] = { |
| 12689 | /* ADC: mute amp left and right */ |
| 12690 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12691 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12692 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 12693 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12694 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12695 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12696 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12697 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12698 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12699 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 12700 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12701 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12702 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12703 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12704 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12705 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12706 | |
| 12707 | /* Front Pin: output 0 (0x0c) */ |
| 12708 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12709 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12710 | |
| 12711 | /* Rear Pin: output 1 (0x0d) */ |
| 12712 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12713 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12714 | |
| 12715 | /* CLFE Pin: output 2 (0x0e) */ |
| 12716 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12717 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12718 | |
| 12719 | /* Mic (rear) pin: input vref at 80% */ |
| 12720 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12721 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12722 | /* Front Mic pin: input vref at 80% */ |
| 12723 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12724 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12725 | /* Line In pin: input */ |
| 12726 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12727 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12728 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12729 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12730 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12731 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12732 | /* CD pin widget for input */ |
| 12733 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12734 | |
| 12735 | /* FIXME: use matrix-type input source selection */ |
| 12736 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12737 | /* Input mixer */ |
| 12738 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12739 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12740 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12741 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12742 | |
| 12743 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12744 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12745 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12746 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12747 | { } |
| 12748 | }; |
| 12749 | |
| 12750 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 12751 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 12752 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12753 | {} |
| 12754 | }; |
| 12755 | |
| 12756 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 12757 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12758 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12759 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12760 | }; |
| 12761 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12762 | /* Set Unsolicited Event*/ |
| 12763 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 12764 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12765 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12766 | {} |
| 12767 | }; |
| 12768 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12769 | /* |
| 12770 | * generic initialization of ADC, input mixers and output mixers |
| 12771 | */ |
| 12772 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 12773 | /* |
| 12774 | * Unmute ADC and set the default input to mic-in |
| 12775 | */ |
| 12776 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12777 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12778 | |
| 12779 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 12780 | * mixer widget |
| 12781 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12782 | * panel mic (mic 2) |
| 12783 | */ |
| 12784 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12785 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12786 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12787 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12788 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12789 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12790 | |
| 12791 | /* |
| 12792 | * Set up output mixers (0x0c - 0x0f) |
| 12793 | */ |
| 12794 | /* set vol=0 to output mixers */ |
| 12795 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12796 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12797 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12798 | |
| 12799 | /* set up input amps for analog loopback */ |
| 12800 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 12801 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12802 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12803 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12804 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12805 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12806 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12807 | |
| 12808 | |
| 12809 | /* FIXME: use matrix-type input source selection */ |
| 12810 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12811 | /* Input mixer */ |
| 12812 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12813 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12814 | { } |
| 12815 | }; |
| 12816 | |
| 12817 | /* capture mixer elements */ |
| 12818 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 12819 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12820 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12821 | { |
| 12822 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12823 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12824 | * So call somewhat different.. |
| 12825 | * FIXME: the controls appear in the "playback" view! |
| 12826 | */ |
| 12827 | /* .name = "Capture Source", */ |
| 12828 | .name = "Input Source", |
| 12829 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 12830 | .info = alc662_mux_enum_info, |
| 12831 | .get = alc662_mux_enum_get, |
| 12832 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12833 | }, |
| 12834 | { } /* end */ |
| 12835 | }; |
| 12836 | |
| 12837 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 12838 | { |
| 12839 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12840 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12841 | |
| 12842 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 12843 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12844 | bits = present ? HDA_AMP_MUTE : 0; |
| 12845 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12846 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12847 | } |
| 12848 | |
| 12849 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 12850 | { |
| 12851 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12852 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12853 | |
| 12854 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12855 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12856 | bits = present ? HDA_AMP_MUTE : 0; |
| 12857 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12858 | HDA_AMP_MUTE, bits); |
| 12859 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12860 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12861 | } |
| 12862 | |
| 12863 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 12864 | unsigned int res) |
| 12865 | { |
| 12866 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12867 | alc662_lenovo_101e_all_automute(codec); |
| 12868 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 12869 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 12870 | } |
| 12871 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12872 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 12873 | { |
| 12874 | unsigned int present; |
| 12875 | |
| 12876 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12877 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12878 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12879 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12880 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12881 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12882 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12883 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12884 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12885 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12886 | } |
| 12887 | |
| 12888 | /* unsolicited event for HP jack sensing */ |
| 12889 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 12890 | unsigned int res) |
| 12891 | { |
| 12892 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12893 | alc262_hippo1_automute( codec ); |
| 12894 | |
| 12895 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12896 | alc662_eeepc_mic_automute(codec); |
| 12897 | } |
| 12898 | |
| 12899 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 12900 | { |
| 12901 | alc262_hippo1_automute( codec ); |
| 12902 | alc662_eeepc_mic_automute(codec); |
| 12903 | } |
| 12904 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12905 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 12906 | { |
| 12907 | unsigned int mute; |
| 12908 | unsigned int present; |
| 12909 | |
| 12910 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 12911 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 12912 | AC_VERB_GET_PIN_SENSE, 0); |
| 12913 | present = (present & 0x80000000) != 0; |
| 12914 | if (present) { |
| 12915 | /* mute internal speaker */ |
| 12916 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 12917 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 12918 | } else { |
| 12919 | /* unmute internal speaker if necessary */ |
| 12920 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12921 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 12922 | HDA_AMP_MUTE, mute); |
| 12923 | } |
| 12924 | } |
| 12925 | |
| 12926 | /* unsolicited event for HP jack sensing */ |
| 12927 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 12928 | unsigned int res) |
| 12929 | { |
| 12930 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12931 | alc662_eeepc_ep20_automute(codec); |
| 12932 | } |
| 12933 | |
| 12934 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 12935 | { |
| 12936 | alc662_eeepc_ep20_automute(codec); |
| 12937 | } |
| 12938 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12939 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12940 | #define alc662_loopbacks alc880_loopbacks |
| 12941 | #endif |
| 12942 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12943 | |
| 12944 | /* pcm configuration: identiacal with ALC880 */ |
| 12945 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 12946 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 12947 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 12948 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 12949 | |
| 12950 | /* |
| 12951 | * configuration and preset |
| 12952 | */ |
| 12953 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 12954 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 12955 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 12956 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 12957 | [ALC662_5ST_DIG] = "6stack-dig", |
| 12958 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 12959 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12960 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12961 | [ALC662_AUTO] = "auto", |
| 12962 | }; |
| 12963 | |
| 12964 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12965 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12966 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12967 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12968 | {} |
| 12969 | }; |
| 12970 | |
| 12971 | static struct alc_config_preset alc662_presets[] = { |
| 12972 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12973 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12974 | .init_verbs = { alc662_init_verbs }, |
| 12975 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 12976 | .dac_nids = alc662_dac_nids, |
| 12977 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 12978 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 12979 | .adc_nids = alc662_adc_nids, |
| 12980 | .dig_in_nid = ALC662_DIGIN_NID, |
| 12981 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 12982 | .channel_mode = alc662_3ST_2ch_modes, |
| 12983 | .input_mux = &alc662_capture_source, |
| 12984 | }, |
| 12985 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12986 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 12987 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12988 | .init_verbs = { alc662_init_verbs }, |
| 12989 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 12990 | .dac_nids = alc662_dac_nids, |
| 12991 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 12992 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 12993 | .adc_nids = alc662_adc_nids, |
| 12994 | .dig_in_nid = ALC662_DIGIN_NID, |
| 12995 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 12996 | .channel_mode = alc662_3ST_6ch_modes, |
| 12997 | .need_dac_fix = 1, |
| 12998 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12999 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13000 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13001 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13002 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13003 | .init_verbs = { alc662_init_verbs }, |
| 13004 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13005 | .dac_nids = alc662_dac_nids, |
| 13006 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13007 | .adc_nids = alc662_adc_nids, |
| 13008 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13009 | .channel_mode = alc662_3ST_6ch_modes, |
| 13010 | .need_dac_fix = 1, |
| 13011 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13012 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13013 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13014 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13015 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13016 | .init_verbs = { alc662_init_verbs }, |
| 13017 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13018 | .dac_nids = alc662_dac_nids, |
| 13019 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13020 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13021 | .adc_nids = alc662_adc_nids, |
| 13022 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13023 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13024 | .channel_mode = alc662_5stack_modes, |
| 13025 | .input_mux = &alc662_capture_source, |
| 13026 | }, |
| 13027 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13028 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13029 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13030 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13031 | .dac_nids = alc662_dac_nids, |
| 13032 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13033 | .adc_nids = alc662_adc_nids, |
| 13034 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13035 | .channel_mode = alc662_3ST_2ch_modes, |
| 13036 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13037 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13038 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13039 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13040 | [ALC662_ASUS_EEEPC_P701] = { |
| 13041 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13042 | .init_verbs = { alc662_init_verbs, |
| 13043 | alc662_eeepc_sue_init_verbs }, |
| 13044 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13045 | .dac_nids = alc662_dac_nids, |
| 13046 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 13047 | .adc_nids = alc662_adc_nids, |
| 13048 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13049 | .channel_mode = alc662_3ST_2ch_modes, |
| 13050 | .input_mux = &alc662_eeepc_capture_source, |
| 13051 | .unsol_event = alc662_eeepc_unsol_event, |
| 13052 | .init_hook = alc662_eeepc_inithook, |
| 13053 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13054 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13055 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13056 | alc662_chmode_mixer }, |
| 13057 | .init_verbs = { alc662_init_verbs, |
| 13058 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13059 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13060 | .dac_nids = alc662_dac_nids, |
| 13061 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13062 | .adc_nids = alc662_adc_nids, |
| 13063 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13064 | .channel_mode = alc662_3ST_6ch_modes, |
| 13065 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13066 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13067 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13068 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13069 | |
| 13070 | }; |
| 13071 | |
| 13072 | |
| 13073 | /* |
| 13074 | * BIOS auto configuration |
| 13075 | */ |
| 13076 | |
| 13077 | /* add playback controls from the parsed DAC table */ |
| 13078 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13079 | const struct auto_pin_cfg *cfg) |
| 13080 | { |
| 13081 | char name[32]; |
| 13082 | static const char *chname[4] = { |
| 13083 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13084 | }; |
| 13085 | hda_nid_t nid; |
| 13086 | int i, err; |
| 13087 | |
| 13088 | for (i = 0; i < cfg->line_outs; i++) { |
| 13089 | if (!spec->multiout.dac_nids[i]) |
| 13090 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13091 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13092 | if (i == 2) { |
| 13093 | /* Center/LFE */ |
| 13094 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13095 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13096 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13097 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13098 | if (err < 0) |
| 13099 | return err; |
| 13100 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13101 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13102 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13103 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13104 | if (err < 0) |
| 13105 | return err; |
| 13106 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13107 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13108 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13109 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13110 | if (err < 0) |
| 13111 | return err; |
| 13112 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13113 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13114 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13115 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13116 | if (err < 0) |
| 13117 | return err; |
| 13118 | } else { |
| 13119 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13120 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13121 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13122 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13123 | if (err < 0) |
| 13124 | return err; |
| 13125 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13126 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13127 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13128 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13129 | if (err < 0) |
| 13130 | return err; |
| 13131 | } |
| 13132 | } |
| 13133 | return 0; |
| 13134 | } |
| 13135 | |
| 13136 | /* add playback controls for speaker and HP outputs */ |
| 13137 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13138 | const char *pfx) |
| 13139 | { |
| 13140 | hda_nid_t nid; |
| 13141 | int err; |
| 13142 | char name[32]; |
| 13143 | |
| 13144 | if (!pin) |
| 13145 | return 0; |
| 13146 | |
| 13147 | if (alc880_is_fixed_pin(pin)) { |
| 13148 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13149 | /* printk("DAC nid=%x\n",nid); */ |
| 13150 | /* specify the DAC as the extra output */ |
| 13151 | if (!spec->multiout.hp_nid) |
| 13152 | spec->multiout.hp_nid = nid; |
| 13153 | else |
| 13154 | spec->multiout.extra_out_nid[0] = nid; |
| 13155 | /* control HP volume/switch on the output mixer amp */ |
| 13156 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13157 | sprintf(name, "%s Playback Volume", pfx); |
| 13158 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13159 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13160 | if (err < 0) |
| 13161 | return err; |
| 13162 | sprintf(name, "%s Playback Switch", pfx); |
| 13163 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13164 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13165 | if (err < 0) |
| 13166 | return err; |
| 13167 | } else if (alc880_is_multi_pin(pin)) { |
| 13168 | /* set manual connection */ |
| 13169 | /* we have only a switch on HP-out PIN */ |
| 13170 | sprintf(name, "%s Playback Switch", pfx); |
| 13171 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13172 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13173 | if (err < 0) |
| 13174 | return err; |
| 13175 | } |
| 13176 | return 0; |
| 13177 | } |
| 13178 | |
| 13179 | /* create playback/capture controls for input pins */ |
| 13180 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13181 | const struct auto_pin_cfg *cfg) |
| 13182 | { |
| 13183 | struct hda_input_mux *imux = &spec->private_imux; |
| 13184 | int i, err, idx; |
| 13185 | |
| 13186 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13187 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13188 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13189 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13190 | auto_pin_cfg_labels[i], |
| 13191 | idx, 0x0b); |
| 13192 | if (err < 0) |
| 13193 | return err; |
| 13194 | imux->items[imux->num_items].label = |
| 13195 | auto_pin_cfg_labels[i]; |
| 13196 | imux->items[imux->num_items].index = |
| 13197 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13198 | imux->num_items++; |
| 13199 | } |
| 13200 | } |
| 13201 | return 0; |
| 13202 | } |
| 13203 | |
| 13204 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13205 | hda_nid_t nid, int pin_type, |
| 13206 | int dac_idx) |
| 13207 | { |
| 13208 | /* set as output */ |
| 13209 | snd_hda_codec_write(codec, nid, 0, |
| 13210 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 13211 | snd_hda_codec_write(codec, nid, 0, |
| 13212 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 13213 | /* need the manual connection? */ |
| 13214 | if (alc880_is_multi_pin(nid)) { |
| 13215 | struct alc_spec *spec = codec->spec; |
| 13216 | int idx = alc880_multi_pin_idx(nid); |
| 13217 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13218 | AC_VERB_SET_CONNECT_SEL, |
| 13219 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13220 | } |
| 13221 | } |
| 13222 | |
| 13223 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13224 | { |
| 13225 | struct alc_spec *spec = codec->spec; |
| 13226 | int i; |
| 13227 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13228 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13229 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13230 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13231 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13232 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13233 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13234 | i); |
| 13235 | } |
| 13236 | } |
| 13237 | |
| 13238 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13239 | { |
| 13240 | struct alc_spec *spec = codec->spec; |
| 13241 | hda_nid_t pin; |
| 13242 | |
| 13243 | pin = spec->autocfg.hp_pins[0]; |
| 13244 | if (pin) /* connect to front */ |
| 13245 | /* use dac 0 */ |
| 13246 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 13247 | } |
| 13248 | |
| 13249 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13250 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13251 | |
| 13252 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13253 | { |
| 13254 | struct alc_spec *spec = codec->spec; |
| 13255 | int i; |
| 13256 | |
| 13257 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13258 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13259 | if (alc662_is_input_pin(nid)) { |
| 13260 | snd_hda_codec_write(codec, nid, 0, |
| 13261 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13262 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13263 | PIN_VREF80 : PIN_IN)); |
| 13264 | if (nid != ALC662_PIN_CD_NID) |
| 13265 | snd_hda_codec_write(codec, nid, 0, |
| 13266 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13267 | AMP_OUT_MUTE); |
| 13268 | } |
| 13269 | } |
| 13270 | } |
| 13271 | |
| 13272 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13273 | { |
| 13274 | struct alc_spec *spec = codec->spec; |
| 13275 | int err; |
| 13276 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13277 | |
| 13278 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13279 | alc662_ignore); |
| 13280 | if (err < 0) |
| 13281 | return err; |
| 13282 | if (!spec->autocfg.line_outs) |
| 13283 | return 0; /* can't find valid BIOS pin config */ |
| 13284 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13285 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13286 | if (err < 0) |
| 13287 | return err; |
| 13288 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13289 | if (err < 0) |
| 13290 | return err; |
| 13291 | err = alc662_auto_create_extra_out(spec, |
| 13292 | spec->autocfg.speaker_pins[0], |
| 13293 | "Speaker"); |
| 13294 | if (err < 0) |
| 13295 | return err; |
| 13296 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13297 | "Headphone"); |
| 13298 | if (err < 0) |
| 13299 | return err; |
| 13300 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13301 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13302 | return err; |
| 13303 | |
| 13304 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13305 | |
| 13306 | if (spec->autocfg.dig_out_pin) |
| 13307 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13308 | |
| 13309 | if (spec->kctl_alloc) |
| 13310 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13311 | |
| 13312 | spec->num_mux_defs = 1; |
| 13313 | spec->input_mux = &spec->private_imux; |
| 13314 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13315 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13316 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13317 | spec->num_mixers++; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13318 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13319 | } |
| 13320 | |
| 13321 | /* additional initialization for auto-configuration model */ |
| 13322 | static void alc662_auto_init(struct hda_codec *codec) |
| 13323 | { |
| 13324 | alc662_auto_init_multi_out(codec); |
| 13325 | alc662_auto_init_hp_out(codec); |
| 13326 | alc662_auto_init_analog_input(codec); |
| 13327 | } |
| 13328 | |
| 13329 | static int patch_alc662(struct hda_codec *codec) |
| 13330 | { |
| 13331 | struct alc_spec *spec; |
| 13332 | int err, board_config; |
| 13333 | |
| 13334 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13335 | if (!spec) |
| 13336 | return -ENOMEM; |
| 13337 | |
| 13338 | codec->spec = spec; |
| 13339 | |
| 13340 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13341 | alc662_models, |
| 13342 | alc662_cfg_tbl); |
| 13343 | if (board_config < 0) { |
| 13344 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 13345 | "trying auto-probe from BIOS...\n"); |
| 13346 | board_config = ALC662_AUTO; |
| 13347 | } |
| 13348 | |
| 13349 | if (board_config == ALC662_AUTO) { |
| 13350 | /* automatic parse from the BIOS config */ |
| 13351 | err = alc662_parse_auto_config(codec); |
| 13352 | if (err < 0) { |
| 13353 | alc_free(codec); |
| 13354 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13355 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13356 | printk(KERN_INFO |
| 13357 | "hda_codec: Cannot set up configuration " |
| 13358 | "from BIOS. Using base mode...\n"); |
| 13359 | board_config = ALC662_3ST_2ch_DIG; |
| 13360 | } |
| 13361 | } |
| 13362 | |
| 13363 | if (board_config != ALC662_AUTO) |
| 13364 | setup_preset(spec, &alc662_presets[board_config]); |
| 13365 | |
| 13366 | spec->stream_name_analog = "ALC662 Analog"; |
| 13367 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 13368 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 13369 | |
| 13370 | spec->stream_name_digital = "ALC662 Digital"; |
| 13371 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 13372 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 13373 | |
| 13374 | if (!spec->adc_nids && spec->input_mux) { |
| 13375 | spec->adc_nids = alc662_adc_nids; |
| 13376 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 13377 | } |
| 13378 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13379 | spec->vmaster_nid = 0x02; |
| 13380 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13381 | codec->patch_ops = alc_patch_ops; |
| 13382 | if (board_config == ALC662_AUTO) |
| 13383 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13384 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13385 | if (!spec->loopback.amplist) |
| 13386 | spec->loopback.amplist = alc662_loopbacks; |
| 13387 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13388 | |
| 13389 | return 0; |
| 13390 | } |
| 13391 | |
| 13392 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13393 | * patch entries |
| 13394 | */ |
| 13395 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 13396 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13397 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13398 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13399 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13400 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13401 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13402 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13403 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 13404 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 13405 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13406 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 13407 | .patch = patch_alc883 }, |
| 13408 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 13409 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13410 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13411 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13412 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13413 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13414 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13415 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13416 | {} /* terminator */ |
| 13417 | }; |